Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -9502,7 +9502,9 @@ Public Class ClsPaginas
|
||||
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
|
||||
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
|
||||
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
|
||||
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
|
||||
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
@@ -9540,6 +9542,39 @@ Public Class ClsPaginas
|
||||
End If
|
||||
End If
|
||||
|
||||
If Pago.AplicaConceptoImpuestoPendiente Then
|
||||
'si tiene iva y su proporcion
|
||||
If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
|
||||
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
|
||||
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
|
||||
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
End If
|
||||
'si tiene RET IVA y su proporcion
|
||||
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
|
||||
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
|
||||
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
|
||||
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
End If
|
||||
'si tiene Ret ISR y su proporcion
|
||||
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
|
||||
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
|
||||
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
|
||||
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
End If
|
||||
'si tiene IEPS y su proporcion
|
||||
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
|
||||
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
|
||||
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
|
||||
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
|
||||
Dim Ret As New ConceptosRetenciones
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
|
||||
End If
|
||||
End If
|
||||
|
||||
'concepto pago
|
||||
If Pago.TipoPago = "B" AndAlso Not ErrorMovtos AndAlso AplicarConceptoAplicacion Then ' B A N C O S
|
||||
Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia)
|
||||
@@ -9683,6 +9718,7 @@ Public Class ClsPaginas
|
||||
Public Property CveClientePago As Integer = -1
|
||||
Public Property ImporteFluctuacionAdicional As Decimal = 0
|
||||
Public Property ValorMultiplicador As Decimal = 1
|
||||
Public Property AplicaConceptoImpuestoPendiente As Boolean = False
|
||||
End Class
|
||||
Public Class Venta
|
||||
|
||||
@@ -11088,7 +11124,7 @@ Public Class ClsPaginas
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Public Shared Sub EnviaNotificacionSMS(Tipo As Integer, tEmpresa As Empresa, CveOS As Integer, Folio As String, FechaCirugía As DateTime, Hospital As String, Medico As String, Procedimiento As String, Tecnico As String, Vendedor As String, Remision As String, ListaPS As List(Of GenericaCantidadProducto), CorreoDestino As String)
|
||||
Public Shared Sub EnviaNotificacionSMS(Tipo As Integer, tEmpresa As Empresa, CveOS As Integer, Folio As String, FechaCirugía As DateTime, Hospital As String, TipoVenta As String, Medico As String, Procedimiento As String, Tecnico As String, Vendedor As String, Remision As String, ListaPS As List(Of GenericaCantidadProducto), CorreoDestino As String)
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim Asunto As String = ""
|
||||
Dim OpcionNegritas As String = ""
|
||||
@@ -11164,6 +11200,7 @@ Public Class ClsPaginas
|
||||
|
||||
Contenido.AppendFormat("<span style='{1}'>Fecha y hora de cx: {0}</span><br/>", FechaCirugía.ToString("dd/MM/yyyy HH:mm"), If(OpcionNegritas = "T", "Negritas", ""))
|
||||
Contenido.AppendFormat("Hospital: {0}<br/>", Hospital)
|
||||
If TipoVenta <> "" Then Contenido.AppendFormat("Tipo Venta: {0}<br/>", TipoVenta)
|
||||
If Medico <> "" Then Contenido.AppendFormat("Médico: {0}<br/>", Medico)
|
||||
If Procedimiento <> "" Then Contenido.AppendFormat("Procedimiento: {0}<br/>", Procedimiento)
|
||||
If Tecnico <> "" Then Contenido.AppendFormat("Técnico: {0}<br/>", If(OpcionNegritas = "T", $"<b>{Tecnico}</b>", Tecnico))
|
||||
@@ -11187,11 +11224,10 @@ Public Class ClsPaginas
|
||||
Contenido.AppendFormat("<br/> {0}<br/>", TextoFinal)
|
||||
|
||||
'Contenido.AppendFormat("<br/>CorreoDestino: {0}<br/>", CorreoDestino)
|
||||
'CorreoDestino = "rene.molina@adssistemas.mx"
|
||||
Contenido.Append(" </body>")
|
||||
Contenido.Append("</html>")
|
||||
|
||||
'CorreoDestino = "rene.molina@adssistemas.mx"
|
||||
|
||||
If ObjMail.SendMail(tEmpresa, CorreoDestino, Asunto, Contenido.ToString) Then
|
||||
|
||||
End If
|
||||
|
||||
@@ -547,7 +547,7 @@ Public Class ClsProductosServicios
|
||||
ElseIf Ex1.Message.Contains("UK_ProductosServicios_EmpresaNumeroParte") Then
|
||||
Alert("El Nuevo Producto o Servicio tiene Numero de Parte duplicado:" & NumeroParte, TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert("El Nuevo Producto o Servicio duplicado(ND):" & NumeroParte, TipoMensaje.MsgAdvertencia)
|
||||
Alert("El Nuevo Producto o Servicio tiene un valor duplicado(ND):" & NumeroParte, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
933
Ashx/SIGFacturacion.ashx
Normal file
933
Ashx/SIGFacturacion.ashx
Normal file
@@ -0,0 +1,933 @@
|
||||
<%@ WebHandler Language="VB" Class="SIGFacturacion" %>
|
||||
|
||||
Imports System
|
||||
Imports System.Web
|
||||
Imports System.Net.Http
|
||||
Imports System.Web.Http
|
||||
Imports System.Data
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports Extensiones
|
||||
Imports System.IO
|
||||
Imports Modelos
|
||||
|
||||
Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
Private Property CveEmpresaFacturar As Integer = 194
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
context.Response.ContentType = "text/plain"
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
Try
|
||||
|
||||
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
|
||||
GuardaLogFacturacion(" -------------------------- Inicio de Petición Metodo:" & Metodo & " --------------------------")
|
||||
If Metodo = "FactMasivaRemisiones" Then
|
||||
Dim pFechaI As String = ""
|
||||
Dim pFechaF As String = ""
|
||||
|
||||
If context.Request("FechaI") IsNot Nothing AndAlso context.Request("FechaF") IsNot Nothing Then
|
||||
pFechaI = context.Request("FechaI")
|
||||
pFechaF = context.Request("FechaF")
|
||||
End If
|
||||
|
||||
Retorno = IniciaFacturacionMasiva(CveEmpresaFacturar.ToString, pFechaI, pFechaF)
|
||||
End If
|
||||
GuardaLogFacturacion(" -------------------------- Fin de Petición Metodo:" & Metodo & " --------------------------")
|
||||
Catch ex As Exception
|
||||
ex.GuardaLog(ex.Message)
|
||||
End Try
|
||||
|
||||
If Retorno Then
|
||||
context.Response.Write("True")
|
||||
Else
|
||||
context.Response.Write("False")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Function IniciaFacturacionMasiva(pCveEmpresa As String, pFechaI As String, pFechaF As String) As Boolean
|
||||
Dim Retorno As Boolean = True
|
||||
Dim JsonRetorno As New JObject()
|
||||
Dim CveEmpresa As Integer = pCveEmpresa.ToEntero()
|
||||
|
||||
GuardaLogFacturacion("- Inicio de facturación ")
|
||||
If CveEmpresa > 0 Then
|
||||
GuardaLogFacturacion($"1.10 - CveE:{CveEmpresa}")
|
||||
Dim Usuario = ValidaUsuarioSistema(CveEmpresa)
|
||||
Dim FechaI, FechaF As DateTime
|
||||
'EnviarCorreoFactura(New Modelos.Factura(Usuario, 844966, 1, context.ModExtensiones.DirectorioBaseEmpresas), Usuario)
|
||||
|
||||
If String.IsNullOrEmpty(pFechaI) AndAlso String.IsNullOrEmpty(pFechaF) Then
|
||||
GuardaLogFacturacion("1.200")
|
||||
Dim FechaReferencia As Date = ClsPaginas.NowADS()
|
||||
If FechaReferencia.DayOfWeek = DayOfWeek.Sunday Then
|
||||
Dim Sabado = FechaReferencia.AddDays(-1)
|
||||
Dim DomingoAnterior = FechaReferencia.AddDays(-7)
|
||||
|
||||
FechaI = New DateTime(DomingoAnterior.Year, DomingoAnterior.Month, DomingoAnterior.Day, 0, 0, 0)
|
||||
FechaF = New DateTime(Sabado.Year, Sabado.Month, Sabado.Day, 23, 59, 59)
|
||||
|
||||
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
||||
Else
|
||||
Retorno = False
|
||||
GuardaLogFacturacion("Ejecución no permitida, no es el dia permitido para ejecucion o no se espeficaron las fechas")
|
||||
End If
|
||||
Else
|
||||
GuardaLogFacturacion("1.300")
|
||||
FechaI = pFechaI.ToDateTime()
|
||||
FechaF = pFechaF.ToDateTime()
|
||||
|
||||
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
||||
End If
|
||||
End If
|
||||
GuardaLogFacturacion("Ejecución Exitosa, se generaron las siguientes facturas:")
|
||||
GuardaLogFacturacion(JsonRetorno.ToString())
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function GetNextWeekday(ByVal start As DateTime, ByVal day As DayOfWeek, hora As TimeSpan) As DateTime
|
||||
Dim daysToAdd As Integer = (CInt(day) - CInt(start.DayOfWeek) + 7) Mod 7
|
||||
Dim fecha = start.AddDays(daysToAdd)
|
||||
Return (fecha.Date + hora)
|
||||
End Function
|
||||
Public Shared Function GetLastWeekday(ByVal start As DateTime, ByVal day As DayOfWeek, hora As TimeSpan) As DateTime
|
||||
Dim daysToAdd As Integer = (CInt(day) - CInt(start.DayOfWeek) - 7) Mod 7
|
||||
Dim fecha = start.AddDays(daysToAdd)
|
||||
Return (fecha.Date + hora)
|
||||
End Function
|
||||
|
||||
Private Function EjecutarFacturacionMasiva(UsuarioActual As Usuario, FechaI As DateTime, FechaF As DateTime, Optional Produccion As Boolean = True) As JObject
|
||||
Dim Facturas As New JArray()
|
||||
Dim DebeTimbrar As Boolean = True
|
||||
|
||||
Dim Json As New JObject(
|
||||
New JProperty("Empresa", UsuarioActual.Empresa.Empresa),
|
||||
New JProperty("Usuario", UsuarioActual.Usuario),
|
||||
New JProperty("FechaI", FechaI.ToString("dd/MM/yyy HH:mm:ss")),
|
||||
New JProperty("FechaF", FechaF.ToString("dd/MM/yyy HH:mm:ss"))
|
||||
)
|
||||
Dim DTClientes As DataTable = Nothing
|
||||
Dim DTRemisionesPS As DataTable = Nothing
|
||||
|
||||
Dim ObjCliente As New ClsClientes
|
||||
If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
DTClientes = ObjCliente.DtResultados.Copy()
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
|
||||
If DTClientes IsNot Nothing Then
|
||||
|
||||
'QUITAR CLIENTES QUE NO DEBEN DE ESTAR
|
||||
DTClientes = DTClientes.FiltraParametros("CveCliente NOT IN (1285420,1285423,1285424) ")
|
||||
|
||||
For Each RowCliente As DataRow In DTClientes.Rows
|
||||
Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero()
|
||||
Dim DatosRemisiones As JObject = CargaRemisiones(FechaI, FechaF, CveCliente)
|
||||
|
||||
Dim CveRemisiones As String = DatosRemisiones("VentasConcatenadas").ToString()
|
||||
|
||||
If Not String.IsNullOrEmpty(CveRemisiones) Then
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveRemisiones, 1, UsuarioActual.CveEmpresa) Then
|
||||
DTRemisionesPS = ObjClientes.DtResultados.Copy()
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
|
||||
If DTRemisionesPS IsNot Nothing AndAlso DTRemisionesPS.Rows.Count > 0 Then
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
Dim CveSubProyectoMatriz As Integer = ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero()
|
||||
|
||||
Dim ObjFactura = CreaFactura(Resp, UsuarioActual, DTRemisionesPS, RowCliente("CveCliente").ToString().ToEntero(), CveSubProyectoMatriz, 1, DatosRemisiones, FechaI, FechaF)
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
Resp = ObjFactura.EmitirFactura(DebeTimbrar)
|
||||
End If
|
||||
|
||||
If Resp.CveVenta > 0 AndAlso Not Resp.TieneError Then
|
||||
If Resp.SeTimbro OrElse Not Produccion Then
|
||||
EnviarCorreo(ObjFactura, UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
|
||||
Facturas.Add(JObject.Parse(JsonConvert.SerializeObject(Resp)))
|
||||
DTRemisionesPS.Dispose()
|
||||
|
||||
'ObjFactura.Dispose()
|
||||
End If
|
||||
End If
|
||||
|
||||
DTRemisionesPS = Nothing
|
||||
Next
|
||||
DTClientes.Dispose()
|
||||
End If
|
||||
|
||||
Json.Add(New JProperty("Facturas", Facturas))
|
||||
|
||||
Return Json
|
||||
End Function
|
||||
|
||||
Private Function CargaRemisiones(FechaI As DateTime, FechaF As DateTime, CveCliente As Integer) As JObject
|
||||
Dim json As New JObject()
|
||||
Dim VentasArray As New JArray
|
||||
|
||||
Dim DTRemisiones As DataTable = Nothing
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetRemisionesSinFacturar(FechaI.ToShortDateString, FechaF.ToShortDateString, CveCliente, -1, 1, -1) Then
|
||||
DTRemisiones = ObjVentas.DtResultados.FiltraParametros("CveContrato = 0")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
Dim sbRemisiones As New StringBuilder
|
||||
Dim MensajeRemisiones As New StringBuilder
|
||||
Dim ObsOC As New StringBuilder
|
||||
Dim ObsPedido As New StringBuilder
|
||||
Dim ObsInv As New StringBuilder
|
||||
|
||||
If DTRemisiones IsNot Nothing AndAlso DTRemisiones.Rows.Count > 0 Then
|
||||
MensajeRemisiones.Append("Remisiones: ")
|
||||
For Each Dr As DataRow In DTRemisiones.Rows
|
||||
|
||||
VentasArray.Add(New JObject(New JProperty("CveVenta", Dr("CveVenta").ToString)))
|
||||
|
||||
sbRemisiones.AppendFormat("{0},", Dr("CveVenta").ToString)
|
||||
MensajeRemisiones.AppendFormat("{0} {1}, ", Dr("Folio"), If(Dr("ObsFact").ToString.Length > 0, String.Format("({0})", Dr("ObsFact")), ""))
|
||||
ObsOC.AppendFormat("{0}, ", Dr("ObsOC"))
|
||||
ObsPedido.AppendFormat("{0}, ", Dr("ObsPedido"))
|
||||
ObsInv.AppendFormat("{0}, ", Dr("ObsInv"))
|
||||
Next
|
||||
sbRemisiones.Remove(sbRemisiones.Length - 1, 1)
|
||||
|
||||
DTRemisiones.Dispose()
|
||||
End If
|
||||
DTRemisiones = Nothing
|
||||
|
||||
json.Add(New JProperty("Ventas", VentasArray))
|
||||
json.Add(New JProperty("VentasConcatenadas", sbRemisiones.ToString()))
|
||||
json.Add(New JProperty("Observaciones", MensajeRemisiones.ToString()))
|
||||
json.Add(New JProperty("OrdenCompra", ObsOC.ToString()))
|
||||
json.Add(New JProperty("Pedido", ObsPedido.ToString()))
|
||||
json.Add(New JProperty("Almacen", ObsInv.ToString()))
|
||||
|
||||
Return json
|
||||
End Function
|
||||
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
||||
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
||||
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
||||
If UsuarioActual IsNot Nothing Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa)
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
For Each Row As Data.DataRow In dttmp.Rows
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
Next
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
End If
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
#Region "D E F I N I R - O B J E T O S"
|
||||
Private Function CreaFactura(Resp As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, DTRemisionesPS As DataTable, CveCliente As Integer, CveSubProyecto As Integer, CveMoneda As Integer, DatosRemisiones As JObject, FechaI As DateTime, FechaF As DateTime) As Modelos.Factura
|
||||
Try
|
||||
Dim Folio As String = ""
|
||||
Dim Serie As String = ""
|
||||
|
||||
|
||||
Dim ObjFolios As New ClsGralFolios()
|
||||
If ObjFolios.GetFolios("Ing", UsuarioActual.CveEmpresa) Then
|
||||
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" Estado = 'Activo' AND CveSubProyecto = {0}", CveSubProyecto))
|
||||
If DT.Rows.Count > 0 Then
|
||||
Serie = DT.Rows(0)("Serie").ToString()
|
||||
Folio = DT.Rows(0)("FActual").ToString()
|
||||
End If
|
||||
DT.Dispose()
|
||||
End If
|
||||
ObjFolios.Dispose()
|
||||
|
||||
Dim ObjFactura As New Modelos.Factura(UsuarioActual)
|
||||
ObjFactura.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio
|
||||
ObjFactura.Serie = Serie
|
||||
ObjFactura.Folio = Folio.ToEntero()
|
||||
ObjFactura.TipoMensajeRespuesta = TipoMensajeRespuesta.TextoLimpio
|
||||
ObjFactura.Version = "4.0"
|
||||
ObjFactura.FolioFiscal = ""
|
||||
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
||||
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjFactura.TipoCambio = 1
|
||||
ObjFactura.ConvertirPesos = False
|
||||
ObjFactura.CveMoneda = CveMoneda
|
||||
ObjFactura.Moneda = ClsPaginas.GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
ObjFactura.MonedaSAT = ClsPaginas.GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
ObjFactura.TipoDocto = "Ing"
|
||||
ObjFactura.RefDocto = ""
|
||||
'ObjFactura.CveMesa = -1
|
||||
ObjFactura.Fecha = ClsPaginas.NowADS()
|
||||
ObjFactura.CvePrePoliza = -1
|
||||
ObjFactura.FechaPago = ClsPaginas.NowADS()
|
||||
ObjFactura.MotivoDescuento = ""
|
||||
ObjFactura.FechaEjecucion = ClsPaginas.NowADS()
|
||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||
ObjFactura.CveCondicionEntrega = -1
|
||||
ObjFactura.CondicionEntrega = ""
|
||||
ObjFactura.NumeroCuenta = ""
|
||||
ObjFactura.CondicionesPago = 0
|
||||
ObjFactura.FormaPago = 0
|
||||
ObjFactura.PedidoContrato = ""
|
||||
ObjFactura.NumeroContrato = ""
|
||||
ObjFactura.DescripcionContrato = ""
|
||||
ObjFactura.CveCorte = -1
|
||||
ObjFactura.TipoDocumento = "Ingresos"
|
||||
ObjFactura.Alfa1 = ""
|
||||
ObjFactura.Alfa2 = ""
|
||||
ObjFactura.Alfa3 = ""
|
||||
ObjFactura.CveContrato = -1
|
||||
ObjFactura.ConvertirPesos = False
|
||||
ObjFactura.CveSubProyecto = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||
ObjFactura.SubProyecto = New SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
|
||||
ObjFactura.SubProyectoMatriz = New SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=-1 ).FiltroPrimero("TipoSucursal=1"))
|
||||
|
||||
'CLIENTE
|
||||
ObjFactura.CveCliente = CveCliente
|
||||
ObjFactura.SetCliente()
|
||||
ObjFactura.CveAlmacen = -1
|
||||
|
||||
Dim ObjCliente As New ClsClientes
|
||||
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
ObjFactura.CveFormaPago33 = ObjCliente.CveFormaPago33
|
||||
ObjFactura.FormaPago33 = ClsPaginas.GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
ObjFactura.FormaPagoSAT33 = ClsPaginas.GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
|
||||
ObjFactura.CveMetodoPago33 = ObjCliente.CveMetodoPago33
|
||||
ObjFactura.MetodoPago33 = ClsPaginas.GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
ObjFactura.ClaveMetodoPagoSAT = ClsPaginas.GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
|
||||
ObjFactura.CveUsoCFDI = ObjCliente.CveUsoCFDI
|
||||
ObjFactura.UsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
ObjFactura.ClaveUsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
|
||||
'ObjFactura.CveMetodoPago = ObjCliente.CveMetodoPago
|
||||
|
||||
'If GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago)).Rows.Count > 0 Then
|
||||
' ObjFactura.MetodoPago = GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago)).Rows(0)("MetodoPago").ToString
|
||||
'Else
|
||||
' ObjFactura.CveMetodoPago = 1
|
||||
' ObjFactura.MetodoPago = "Efectivo"
|
||||
'End If
|
||||
End If
|
||||
End If
|
||||
If ObjCliente.GetSucursales(CveCliente) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
ObjFactura.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
|
||||
Else
|
||||
ObjFactura.CveClienteSucursal = -1
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
|
||||
'DETALLES
|
||||
ObjFactura.DtDetalle = CreaDTDetalle(Resp, UsuarioActual, DTRemisionesPS)
|
||||
|
||||
ObjFactura.DtRemisionesPS = DTRemisionesPS
|
||||
|
||||
Dim TotalImporte As Decimal = ObjFactura.DtDetalle.SUM("TotalImporte")
|
||||
Dim ImporteIVA As Decimal = ObjFactura.DtDetalle.SUM("ImporteIVA")
|
||||
Dim ImporteRetIVA As Decimal = ObjFactura.DtDetalle.SUM("ImporteRetIVA")
|
||||
Dim ImporteRetISR As Decimal = ObjFactura.DtDetalle.SUM("ImporteRetISR")
|
||||
Dim ImporteIEPS As Decimal = ObjFactura.DtDetalle.SUM("ImporteIEPS")
|
||||
Dim Descuento As Decimal = ObjFactura.DtDetalle.SUM("Descuento")
|
||||
Dim Amortizacion As Decimal = 0
|
||||
|
||||
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
|
||||
|
||||
'DETALLES
|
||||
ObjFactura.SubTotal = TotalImporte
|
||||
ObjFactura.Descuento = Descuento
|
||||
ObjFactura.Amortizacion = Amortizacion
|
||||
ObjFactura.IVA = ImporteIVA
|
||||
ObjFactura.RetIVA = ImporteRetIVA
|
||||
ObjFactura.RetISR = ImporteRetISR
|
||||
ObjFactura.IEPS = ImporteIEPS
|
||||
ObjFactura.Total = Total
|
||||
ObjFactura.TotalOtrosConceptos = 0
|
||||
|
||||
'VALIDA PROMOCIONES Y EXISTENCIAS
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetPromocionesPS(-1, ClsPaginas.NowADS(), CveSubProyecto, ObjFactura.CveCliente, ObjFactura.CveVendedor, 1, UsuarioActual.CveEmpresa) Then
|
||||
ObjFactura.DtPromociones = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If ObjVentas.GetRemisionesSinFacturar(FechaI.ToShortDateString, FechaF.ToShortDateString, CveCliente, -1, 1, -1) Then
|
||||
ObjFactura.DtRemisiones = ObjVentas.DtResultados.FiltraParametros("CveContrato = 0")
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
ObjFactura.Observaciones = DatosRemisiones("Observaciones").ToString()
|
||||
ObjFactura.OrdenCompra = DatosRemisiones("OrdenCompra").ToString()
|
||||
ObjFactura.PedidoContrato = DatosRemisiones("Pedido").ToString()
|
||||
ObjFactura.ObservacionesAlmacen = DatosRemisiones("Almacen").ToString()
|
||||
|
||||
For Each Venta As JObject In DatosRemisiones("Ventas")
|
||||
ObjFactura.RemisionesLista.Add(Venta("CveVenta").ToString.ToEntero)
|
||||
Next
|
||||
|
||||
ObjFactura.Timbre = PreParaTimbre(ObjFactura)
|
||||
ObjFactura.FemsaFactura = New Modelos.FemsaFactura() With {
|
||||
.AplicaFEMSA = False,
|
||||
.FEMSA_Version = 1
|
||||
}
|
||||
Return ObjFactura
|
||||
Catch ex As Exception
|
||||
Resp.Mensajes.Add(ex.ToString())
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre
|
||||
Dim Timbre As New CFDITimbre
|
||||
Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
|
||||
Timbre.Comprobante.Folio = Obj.Folio.ToString
|
||||
Timbre.Comprobante.Serie = Obj.Serie
|
||||
Timbre.Comprobante.Fecha = Obj.FechaCP
|
||||
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
||||
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
||||
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
||||
Timbre.Comprobante.Subtotal = Obj.SubTotal
|
||||
Timbre.Comprobante.Descuentos = Obj.Descuento
|
||||
Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
||||
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
||||
Timbre.Comprobante.Total = Obj.Total
|
||||
|
||||
Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
|
||||
Timbre.Comprobante.Confirmacion = ""
|
||||
|
||||
Timbre.Receptor.RFC = Obj.Cliente.RFC
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
|
||||
Timbre.Receptor.ResidenciaFiscal = ""
|
||||
Timbre.Receptor.NumeroRegistroTributario = ""
|
||||
Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI
|
||||
|
||||
|
||||
If Obj.CveTipoRelacion > 0 Then
|
||||
Select Case Obj.CveTipoRelacion
|
||||
Case 1
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "01"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso"
|
||||
Case 2
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "02"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados"
|
||||
Case 3
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "03"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso"
|
||||
Case 4
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "04"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso"
|
||||
Case 7
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "07"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
||||
Case 8
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "08"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades "
|
||||
Case 9
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "09"
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos"
|
||||
|
||||
End Select
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim totSubTotal As Decimal = Obj.SubTotal
|
||||
Dim totIVA As Decimal = Obj.IVA
|
||||
Dim totRetIVA As Decimal = Obj.RetIVA
|
||||
Dim totRetISR As Decimal = Obj.RetISR
|
||||
Dim i As Integer = 1
|
||||
|
||||
'DETALLES
|
||||
Dim tPS As String = ""
|
||||
|
||||
For Each drr As DataRow In Obj.DtDetalle.Rows
|
||||
If drr("PS").ToString.Length = 1 Then
|
||||
tPS = drr("Obs").ToString
|
||||
Else
|
||||
If drr("PS").ToString.Length = 0 Then
|
||||
tPS = ""
|
||||
Else
|
||||
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
|
||||
End If
|
||||
End If
|
||||
|
||||
'CONDICIONANTE, ESPECIAL
|
||||
If Obj.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO
|
||||
|
||||
Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
|
||||
.Descripcion = tPS,
|
||||
.ValorUnitario = drr("PU").ToString.ToDecimal,
|
||||
.Importe = drr("TotalImporte").ToString.ToDecimal,
|
||||
.Descuento = drr("Descuento").ToString.ToDecimal,
|
||||
.Unidad = drr("UM").ToString,
|
||||
.ClaveUnidad = drr("SATClaveUM").ToString,
|
||||
.ClaveProdServ = drr("SATClaveProdServ").ToString,
|
||||
.Noidentificacion = drr("Noidentificacion").ToString,
|
||||
.CuentaPredial = drr("CuentaPredial").ToString}
|
||||
'VERIFICA SUMA SUBTOTALES
|
||||
If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES
|
||||
concepto.Importe = totSubTotal
|
||||
End If
|
||||
totSubTotal = totSubTotal - concepto.Importe
|
||||
|
||||
'SIEMPRE ESTAMOS AGREGANDO EL IVA
|
||||
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
|
||||
|
||||
If drr("ImporteIEPS").ToString.ToDouble > 0 Then
|
||||
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal})
|
||||
End If
|
||||
|
||||
If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones
|
||||
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal})
|
||||
End If
|
||||
|
||||
If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR
|
||||
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString.ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal})
|
||||
End If
|
||||
|
||||
Timbre.Conceptos.Add(concepto)
|
||||
i += 1
|
||||
Next
|
||||
Return Timbre
|
||||
End Function
|
||||
Private Function CreaDTDetalle(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, DtRemisionesPS As DataTable) As DataTable
|
||||
Dim TmpDT As New DataTable
|
||||
TmpDT.Columns.Add("CveVenta", GetType(Integer))
|
||||
TmpDT.Columns.Add("Consec", GetType(Integer))
|
||||
TmpDT.Columns.Add("Cantidad", GetType(Decimal))
|
||||
TmpDT.Columns.Add("Codigo", GetType(String))
|
||||
TmpDT.Columns.Add("CveUM", GetType(Integer))
|
||||
TmpDT.Columns.Add("UM", GetType(String))
|
||||
TmpDT.Columns.Add("SATClaveUM", GetType(String))
|
||||
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
|
||||
TmpDT.Columns.Add("Clasificacion", GetType(String))
|
||||
TmpDT.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDT.Columns.Add("PS", GetType(String))
|
||||
TmpDT.Columns.Add("CodigoPS", GetType(String))
|
||||
TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
|
||||
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
||||
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
|
||||
TmpDT.Columns.Add("Serie", GetType(String))
|
||||
TmpDT.Columns.Add("CuentaPredial", GetType(String))
|
||||
TmpDT.Columns.Add("Obs", GetType(String))
|
||||
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
|
||||
TmpDT.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDT.Columns.Add("IVA", GetType(Decimal))
|
||||
TmpDT.Columns.Add("ImporteIVA", GetType(Decimal))
|
||||
TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal))
|
||||
TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal))
|
||||
TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal))
|
||||
TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
|
||||
TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal))
|
||||
TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal))
|
||||
TmpDT.Columns.Add("IEPS", GetType(Decimal))
|
||||
TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal))
|
||||
TmpDT.Columns.Add("Descuento", GetType(Decimal))
|
||||
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
|
||||
TmpDT.Columns.Add("TotalImporte", GetType(Decimal))
|
||||
TmpDT.Columns.Add("Total", GetType(Decimal))
|
||||
'Para uso del módulo contable
|
||||
TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
|
||||
TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
|
||||
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
|
||||
TmpDT.Columns.Add("Proyecto", GetType(String))
|
||||
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
TmpDT.Columns.Add("SubProyecto", GetType(String))
|
||||
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
|
||||
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer))
|
||||
'Contratos
|
||||
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
||||
'Remisiones a Facturas
|
||||
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
|
||||
|
||||
'Pedido2 a Facturas
|
||||
TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer))
|
||||
|
||||
TmpDT.Columns.Add("Origen", GetType(Integer))
|
||||
'Ordenes Servicio
|
||||
TmpDT.Columns.Add("CveOS", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveOSDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("SeFacturara", GetType(Integer))
|
||||
TmpDT.Columns.Add("Folio", GetType(Integer))
|
||||
TmpDT.Columns.Add("Estatus", GetType(String))
|
||||
'Ordenamiento
|
||||
TmpDT.Columns.Add("Orden", GetType(Integer))
|
||||
TmpDT.Columns.Add("TipoDocto", GetType(String))
|
||||
'OC
|
||||
TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||
|
||||
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||
TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal))
|
||||
TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal))
|
||||
TmpDT.Columns.Add("CantidadInventario", GetType(Decimal))
|
||||
|
||||
TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String))
|
||||
TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String))
|
||||
TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
|
||||
TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
Try
|
||||
For Each Dr As DataRow In DtRemisionesPS.Select()
|
||||
Dim Row As DataRow = AgregarProductoServicio(Retorno, UsuarioActual, TmpDT, Dr("Consec").ToString.ToEntero(), Dr("Cantidad").ToString.ToDecimal(), Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString,
|
||||
Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PU").ToString.ToDecimal, Dr("Descuento").ToString.ToDecimal,
|
||||
Dr("CveSubProyecto").ToString.ToEntero, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero,
|
||||
CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString.ToEntero, RegeneraIEPS:=True)
|
||||
If Row IsNot Nothing Then
|
||||
TmpDT.Rows.Add(Row)
|
||||
Else
|
||||
Retorno.Mensajes.Add(String.Format("No se pudo agregar el producto/servicio: {0}", Dr("PS").ToString()))
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
Retorno.Mensajes.Add(ex.ToString())
|
||||
End Try
|
||||
|
||||
|
||||
Return TmpDT
|
||||
End Function
|
||||
|
||||
Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, TmpDT As DataTable, Consec As Integer, Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
|
||||
PU As Decimal, Descuento As Decimal, CveSubProyecto As Integer,
|
||||
Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
|
||||
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0,
|
||||
Optional ClienteRetIVA As Double = 0, Optional ClienteRetISR As Double = 0, Optional ClienteDesglosaIEPS As Boolean = True) As DataRow
|
||||
|
||||
|
||||
Dim DrPS As DataRow = Nothing
|
||||
|
||||
DrPS = ClsPaginas.GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Retorno.Mensajes.Add("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
'verifica si tiene ventaminima
|
||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDouble() > 0 Then
|
||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||
If Cantidad < DrPS("VentaMinima").ToString.ToDouble() Then
|
||||
Retorno.Mensajes.Add("La cantidad es menor que la venta minima")
|
||||
Return Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
If (DrPS("SATClaveUnidadMedida").ToString = "" Or DrPS("SATClavePS").ToString = "") Then
|
||||
'VALIDA CLAVESAT
|
||||
If DrPS("SATClavePS").ToString = "" Then
|
||||
Retorno.Mensajes.Add(String.Format("<b>{0}-{1}</b>: Sin producto SAT<br/>", DrPS("Codigo").ToString, DrPS("PS").ToString))
|
||||
Return Nothing
|
||||
ElseIf DrPS("SATClaveUnidadMedida").ToString = "" Then
|
||||
Retorno.Mensajes.Add(String.Format("<b>{0}-{1}</b>: Sin Unidad Medida SAT<br/>", DrPS("Codigo").ToString, DrPS("PS").ToString))
|
||||
Return Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
Dim DrSubProyecto As DataRow = ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto).Rows(0)
|
||||
|
||||
Row = TmpDT.NewRow()
|
||||
Row("CveProyecto") = DrSubProyecto("CveProyecto").ToString().ToEntero()
|
||||
Row("Proyecto") = DrSubProyecto("Proyecto").ToString()
|
||||
Row("CveSubProyecto") = CveSubProyecto
|
||||
Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString()
|
||||
Row("Serie") = Serie
|
||||
Row("TiempoEntrega") = TiempoEntrega
|
||||
Row("Orden") = TmpDT.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = CveUM
|
||||
Row("UM") = UM
|
||||
Row("CveClasificacion") = CveClasificacion
|
||||
Row("Clasificacion") = Clasificacion
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = Obs
|
||||
|
||||
TotalCalculableImpuestos = (Cantidad * PU) - Descuento
|
||||
|
||||
Row("PU") = PU
|
||||
Row("Codigo") = DrPS("Codigo")
|
||||
Row("NoIdentificacion") = DrPS("Codigo")
|
||||
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
|
||||
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
|
||||
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
|
||||
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
|
||||
Row("Consec") = Consec
|
||||
|
||||
Row("PS") = DrPS("PS")
|
||||
Row("CodigoPS") = DrPS("PSCodigo").ToString
|
||||
Row("CveTipoPS") = DrPS("CveTipoPS")
|
||||
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
||||
Row("CveTamaño") = DrPS("CveTamaño")
|
||||
|
||||
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = DrSubProyecto("IVA")
|
||||
Else
|
||||
Row("PorcentajeIVA") = DrPS("IVA")
|
||||
End If
|
||||
|
||||
Row("IVA") = Row("PorcentajeIVA")
|
||||
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, 2)
|
||||
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, 2)
|
||||
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, 2)
|
||||
Row("PorcentajeRetIVA") = ClienteRetIVA
|
||||
Row("PorcentajeRetISR") = ClienteRetISR
|
||||
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
||||
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, 2)
|
||||
Row("IEPS") = Row("ImporteIEPS")
|
||||
Row("Descuento") = Math.Round(Descuento, 2)
|
||||
Row("TipoDescuento") = "2"
|
||||
|
||||
Row("Total") = Cantidad * PU
|
||||
Row("TotalImporte") = Math.Round(Cantidad * PU, 2)
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
Row("EntregaDirecta") = EntregaDirecta
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = CveContratoDetalle
|
||||
Row("CveVentaDetalle") = CveVentaDetalle
|
||||
Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
|
||||
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
|
||||
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
|
||||
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
||||
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
|
||||
Row("CuentaPredial") = CuentaPredial
|
||||
|
||||
'RECARGAR GV
|
||||
Return Row
|
||||
End Function
|
||||
#End Region
|
||||
#Region "E N V I O - C O R R E O"
|
||||
Private Sub EnviarCorreo(Objfactura As Modelos.Factura, UsuarioActual As Usuario)
|
||||
Try
|
||||
Dim Hilo As New System.Threading.Thread(Sub() EnviarCorreoFactura(Objfactura, UsuarioActual))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el correo de facturación", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient As New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||
Using request As New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
File = Nothing
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
Return File
|
||||
End Function
|
||||
|
||||
Private Sub EnviarCorreoFactura(ObjFactura As Modelos.Factura, UsuarioActual As Usuario)
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ObjCliente As New ClsClientes
|
||||
Dim Mail As String = ""
|
||||
Dim MailCC As String = ""
|
||||
|
||||
Dim ArchivoXML As String = ""
|
||||
Dim ArchivoPDF As String = ""
|
||||
Dim ArchivoPDFBytes As Byte() = Nothing
|
||||
Dim ExistePDF As Boolean = False
|
||||
Try
|
||||
ArchivoXML = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||
ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||
|
||||
If Not File.Exists(ArchivoPDF) Then
|
||||
ArchivoPDFBytes = DescargarFactura(ObjFactura.CveVenta, ObjFactura.CveEmpresa)
|
||||
Else
|
||||
ExistePDF = True
|
||||
End If
|
||||
|
||||
If ObjFactura.CveClienteSucursal > 0 Then
|
||||
If ObjCliente.GetSucursales(ObjFactura.CveCliente, ObjFactura.CveClienteSucursal) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
Dim Correo As String = ObjCliente.DtResultados.Rows(0)("Correo").ToString
|
||||
If Correo.Trim.Length > 0 Then
|
||||
Mail = Correo
|
||||
End If
|
||||
MailCC = ObjCliente.NotificarA
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If ObjCliente.GetClientes(ObjFactura.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
Mail = If(ObjFactura.TipoDocto = "Cot", ObjCliente.MailCotizacion, ObjCliente.Mail)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el correo", ex)
|
||||
Finally
|
||||
ObjCliente.Dispose()
|
||||
End Try
|
||||
|
||||
If Not String.IsNullOrEmpty(Mail) Then
|
||||
Try
|
||||
Dim Asunto As String = String.Empty
|
||||
Dim Cuerpo As String = String.Empty
|
||||
Dim ResultadoMail As Integer = 0
|
||||
|
||||
Dim TipoComprobante As String = ""
|
||||
|
||||
If ObjFactura.TipoDocto = "Ing" Then TipoComprobante = "Factura"
|
||||
If ObjFactura.TipoDocto = "Egs" Then TipoComprobante = "Nota de Crédito"
|
||||
If ObjFactura.TipoDocto = "Dev" Then TipoComprobante = "Nota de Devolución"
|
||||
If ObjFactura.TipoDocto = "Rem" Then TipoComprobante = "Remisión"
|
||||
If ObjFactura.TipoDocto = "Cot" Then TipoComprobante = "Cotización"
|
||||
If ObjFactura.TipoDocto = "Ant" Then TipoComprobante = "Anticipo"
|
||||
|
||||
If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then
|
||||
Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta
|
||||
Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa)
|
||||
Cuerpo = Cuerpo.Replace("{""NombreCliente""}", ObjFactura.Cliente.NombreComercial)
|
||||
Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||
Cuerpo = Cuerpo.Replace("{""Fecha""}", ObjFactura.Fecha.ToString("dd/MM/yyyy"))
|
||||
Cuerpo = Cuerpo.Replace("{""Total""}", ObjFactura.Total.ToString)
|
||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", ObjFactura.FechaVencimiento.ToString("dd/MM/yyyy"))
|
||||
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", ObjFactura.SerieFolio)
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then
|
||||
Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta
|
||||
Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante)
|
||||
Asunto = Asunto.Replace("{""Sucursal""}", ObjFactura.SubProyecto.SubProyecto)
|
||||
Asunto = Asunto.Replace("{""SerieFolio""}", ObjFactura.SerieFolio)
|
||||
End If
|
||||
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = ArchivoXML})
|
||||
If ExistePDF Then
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = ArchivoPDF})
|
||||
Else
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ArchivoPDFBytes, .NombreArchivo = String.Format("{0}.pdf", ObjFactura.SerieFolio)})
|
||||
End If
|
||||
|
||||
Dim DisplayName As String = ""
|
||||
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
|
||||
|
||||
If ObjMail.SendMail(UsuarioActual.Empresa, Mail, Asunto, Cuerpo, If(String.IsNullOrEmpty(MailCC), "", MailCC), LSRutasMail, Displayname:=DisplayName) Then
|
||||
ResultadoMail = 1
|
||||
Else
|
||||
GuardaLogFacturacion($"No se envio el correo {Mail}, {Asunto}, {Cuerpo}, {MailCC},")
|
||||
GuardaLogFacturacion($"Ruta XML {ArchivoXML}")
|
||||
ResultadoMail = 3
|
||||
End If
|
||||
|
||||
ObjVentas.UpdateVentaMail(ResultadoMail, ObjFactura.CveVenta)
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el Mail", ex)
|
||||
GuardaLogFacturacion(ex.ToString())
|
||||
ObjVentas.UpdateVentaMail(3, ObjFactura.CveVenta)
|
||||
Finally
|
||||
ObjVentas.Dispose()
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
End If
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Public Sub GuardaLogFacturacion(Str As String)
|
||||
Dim ArchivoW As StreamWriter
|
||||
Dim strLineaTMP As String
|
||||
|
||||
' strLineaTMP = Chr(13) & Chr(10) & Day(NowADS()) & "/" & Month(NowADS()) & "/" & Year(NowADS()) & " " & Hour(NowADS()) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10)
|
||||
strLineaTMP = String.Format("{0}{1}Log: {2}{3}:{4}", Chr(13), Chr(10), Str, ClsPaginas.NowADS().ToShortDateString, ClsPaginas.NowADS().ToShortTimeString)
|
||||
Try
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\Log\LogFacturacion.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
|
||||
Catch ex As UnauthorizedAccessException
|
||||
'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
Catch ex As Exception
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
Try
|
||||
ArchivoW.WriteLine(strLineaTMP)
|
||||
Catch
|
||||
End Try
|
||||
|
||||
ArchivoW.Close()
|
||||
ArchivoW.Dispose()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
@@ -489,7 +489,7 @@
|
||||
<asp:BoundField DataField="PerdidaGanancia" HeaderText="Acción" ItemStyle-HorizontalAlign="Left" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:Label ID="LblTotalVentas" runat="server" Text=""></asp:Label>
|
||||
<asp:Label ID="LblTotalVentas" runat="server" Text="" Visible="false"></asp:Label>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
<ajax:TabPanel runat="server" ID="TabVentasAnt" HeaderText="Clientes Ant">
|
||||
|
||||
@@ -646,6 +646,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
If UsuarioActual.CveEmpresa <> 119 Then Return True
|
||||
Dim ErrorRegistrar As Boolean = False
|
||||
Dim tdt As DataTable = VerificacionFluctuacion(TipoFluctuacion, FechaUltimoDiaMes)
|
||||
CveConcepto = 299 ' manual
|
||||
'ajustar las cuentas.
|
||||
Dim AjusteTotal As Decimal = tdt.SUMD("Diferencia")
|
||||
Dim tTipoMovto As Boolean = If(TipoFluctuacion.Contiene(2, 3, 6), False, True) 'LAS OPCIONES QUE SE CARGAN
|
||||
@@ -667,6 +668,8 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
' AjusteTotal = AjusteTotal + dr("Importe").ToString.ToDecimal
|
||||
'End If
|
||||
tTipoMovto = dr("TipoMovto").ToString.ToBool
|
||||
If TipoFluctuacion.Contiene(3) AndAlso tTipoMovto AndAlso AjusteTotal > 0 Then AjusteTotal = -AjusteTotal 'si es cleintes, abonado y el ajustes es positivo tiene que restar
|
||||
|
||||
AjusteTotal = AjusteTotal + dr("Importe").ToString.ToDecimal
|
||||
If AjusteTotal < 0 Then
|
||||
AjusteTotal = Math.Abs(AjusteTotal) ' ' si hay cambio de fluctuacion de pérdida a ganancia, o viceversas
|
||||
@@ -1393,6 +1396,8 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
|
||||
#Region "VERIFICACION "
|
||||
Private Function VerificacionFluctuacion(Opcion As Integer, Fecha As Date) As DataTable
|
||||
If Fecha <= ("2024/09/01").ToDate Then Return Nothing ' si s mejor a sep/24, es esquema anterior
|
||||
|
||||
Dim tdt As DataTable = Nothing
|
||||
Dim Conta As New ClsContabilidad
|
||||
If Conta.GetAjusteFluctuacion(Opcion, Fecha, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
@@ -1305,9 +1305,11 @@
|
||||
|
||||
<asp:UpdatePanel ID="UpInv" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
|
||||
|
||||
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento,UUIDRow,AplicaLote,AplicaCaducidad,PS" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
|
||||
ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall mysmallbtn" Visible="false">
|
||||
<Columns>
|
||||
<%--0--%>
|
||||
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
|
||||
<HeaderTemplate>
|
||||
Aplica<br />
|
||||
@@ -1318,6 +1320,7 @@
|
||||
<asp:CheckBox ID="cbInv" runat="server" Checked="false" Enabled="false" AutoPostBack="true" OnCheckedChanged="CambiaTotalDevengar" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--1--%>
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TbCantidad" runat="server" Width="50px" Mask="999,999.99" Text='<%# Eval("CantidadF", "{0:N2}")%>'></asp:TextBox>
|
||||
@@ -1329,7 +1332,7 @@
|
||||
</ItemTemplate>
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:TemplateField>
|
||||
|
||||
<%--2--%>
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>
|
||||
Unidad
|
||||
@@ -1338,9 +1341,11 @@
|
||||
<asp:Label ID="LtlUnidadMedida" runat="server" Text='<%# Eval("UM") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="5%" />--%>
|
||||
<asp:BoundField ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left" HeaderText=" Servicio" DataField="PS" />
|
||||
<%--3--%>
|
||||
<asp:BoundField ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left" HeaderText=" Producto" DataField="PS" />
|
||||
<%--4--%>
|
||||
<asp:BoundField ItemStyle-Width="7.5%" HeaderText="P.U." DataField="PU" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" />
|
||||
<%--5--%>
|
||||
<asp:TemplateField ItemStyle-Width="10%">
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList ID="ddlEAlmacen" Enabled="false" runat="server" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="CambiaTotalDevengar"></asp:DropDownList>
|
||||
@@ -1350,6 +1355,7 @@
|
||||
<asp:DropDownList ID="ddlAlmacen" Enabled="True" runat="server" DataTextField="Almacen" OnSelectedIndexChanged="ddlAlmacen_SelectedIndexChanged" AppendDataBoundItems="true" AutoPostBack="true" CssClass="form-control input-sm select2me" DataValueField="CveAlmacen" Width="100%"></asp:DropDownList>
|
||||
</HeaderTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--6--%>
|
||||
<asp:TemplateField ItemStyle-Width="10%" HeaderText="Recibir" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList ID="DdlRecibirInv" Enabled="false" runat="server" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="CambiaTotalDevengar" CssClass="form-control input-sm select2me">
|
||||
@@ -1358,11 +1364,31 @@
|
||||
</asp:DropDownList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--<asp:TemplateField ItemStyle-Width="10%">
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="btnImgDestino" runat="server" AlternateText="+" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>--%>
|
||||
<%--7--%>
|
||||
<asp:TemplateField HeaderText="Lote" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtLote" CssClass="form-control input-sm" onblur="clickBtnInvActualizaLoteCaducidad();" runat="server" Visible="false" Text='<%# Eval("Lote") %>' Width="100px" ></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--8--%>
|
||||
<asp:TemplateField HeaderText="Fecha Caducidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" Visible="false">
|
||||
<ItemTemplate>
|
||||
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;" runat="server" visible="false" id="DvFechaCaducidad" >
|
||||
<asp:TextBox ID="TxtCaducidad" Text='<%# Eval("FechaCaducidad") %>' CssClass="form-control input-sm ADSMaskDate" onblur="clickBtnInvActualizaLoteCaducidad();" Style="width: 87px" runat="server" ></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton runat="server" ID="LnkCaducidad" class="btn default" Visible="false" > <i class="fa fa-calendar"></i> </asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MEECaducidad" runat="server" TargetControlID="TxtCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CECaducidad" TargetControlID="TxtCaducidad" PopupButtonID="LnkCaducidad" PopupPosition="TopLeft" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
|
||||
<%--<asp:RequiredFieldValidator ID="RFVCaducidad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Caducidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCECaducidad" runat="server" HighlightCssClass="vco" TargetControlID="RFVCaducidad"></ajax:ValidatorCalloutExtender>--%>
|
||||
</div>
|
||||
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--9--%>
|
||||
<asp:TemplateField ItemStyle-Width="10%" Visible="false">
|
||||
<HeaderTemplate>
|
||||
Almacén Consignación<br />
|
||||
@@ -1371,7 +1397,8 @@
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList ID="ddlAlmacenConsignacion" Enabled="False" runat="server" Width="100px" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="ddlAlmacenConsignacion_SelectedIndexChanged"></asp:DropDownList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<%--10--%>
|
||||
<asp:TemplateField ItemStyle-Width="15%" HeaderText="Consignación" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList runat="server" ID="DdlVinculaConsignacion" Enabled="false" OnSelectedIndexChanged="DdlVinculaConsignacion_SelectedIndexChanged" CssClass="form-control input-sm select2me" AutoPostBack="true" DataTextField="Detalle" DataValueField="No" Width="280px"></asp:DropDownList>
|
||||
@@ -1384,11 +1411,7 @@
|
||||
<asp:HiddenField runat="server" ID="HdnCveAlmacen" Value="-1" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Nuevo Producto o servicio" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList runat="server" ID="Ddlnewps" DataTextField="PSCodigo" DataValueField="CvePS" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>--%>
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
@@ -1481,7 +1504,7 @@
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,PS,CveTipoPS" ShowFooter="true" GridLines="None" AutoGenerateColumns="false" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" CssClass="table table-striped table-hover Widthall">
|
||||
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,PS,CveTipoPS,PUExtranjero" ShowFooter="true" GridLines="None" AutoGenerateColumns="false" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" CssClass="table table-striped table-hover Widthall">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px">
|
||||
<ItemTemplate>
|
||||
@@ -5639,7 +5662,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="DVModalConfirmaVinculacionProntoPago" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
@@ -5676,7 +5698,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="display:none">
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnInvActualizaLoteCaducidad" runat="server" OnClick="BtnInvActualizaLoteCaducidad_Click" ClientIDMode="Static" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
|
||||
</asp:Content>
|
||||
@@ -5738,10 +5766,38 @@
|
||||
$("#TabActivosFijos_tab .ajax__tab_inner").click(function () {
|
||||
$('#BtnCargarGVAF').click();
|
||||
});
|
||||
|
||||
|
||||
//$(".monitorLote").on("input", function () {
|
||||
|
||||
// var currentValue = $(this).val();
|
||||
// console.log("Texto cambiado: " + currentValue);
|
||||
// $("#BtnInvActualizaLoteCaducidad").click();
|
||||
|
||||
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
|
||||
// // Esto requiere un ScriptManager en tu página
|
||||
// //__doPostBack('txtExample', currentValue);
|
||||
//});
|
||||
|
||||
//$(".monitorCaducidad").on("input", function () {
|
||||
|
||||
// var currentValue = $(this).val();
|
||||
// console.log("Texto cambiado: " + currentValue);
|
||||
// $("#BtnInvActualizaLoteCaducidad").click();
|
||||
|
||||
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
|
||||
// // Esto requiere un ScriptManager en tu página
|
||||
// //__doPostBack('txtExample', currentValue);
|
||||
//});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function clickBtnInvActualizaLoteCaducidad() {
|
||||
$("#BtnInvActualizaLoteCaducidad").click();
|
||||
}
|
||||
|
||||
function ClickDeudorChk(Chk, Obj, total, saldo,txtOtrIngEgs) {
|
||||
debugger;
|
||||
total = parseFloat(parseFloat(total).toFixed(2));
|
||||
|
||||
@@ -12,10 +12,10 @@ Imports Extensiones
|
||||
Imports MoreLinq
|
||||
Imports System.Data.SqlClient
|
||||
Imports ClsPaginas
|
||||
Imports System.Activities.Expressions
|
||||
Imports Microsoft.Data.Edm.Expressions
|
||||
Imports Telerik.Web.UI
|
||||
Imports DocumentFormat.OpenXml.Math
|
||||
Imports Microsoft.Owin.Security.Provider
|
||||
|
||||
|
||||
|
||||
|
||||
Partial Class Compras_Compras
|
||||
Inherits ClsPaginas
|
||||
@@ -1906,6 +1906,21 @@ Partial Class Compras_Compras
|
||||
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
|
||||
End If
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
End If
|
||||
|
||||
|
||||
If Not TmpDT.Columns.Contains("Lote") Then
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
End If
|
||||
|
||||
AddPS2(False)
|
||||
|
||||
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
|
||||
@@ -2939,13 +2954,9 @@ Partial Class Compras_Compras
|
||||
TmpDT.Columns.Add("CveContrato", GetType(Integer))
|
||||
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
|
||||
|
||||
|
||||
|
||||
If Not TmpDT.Columns.Contains("CveContratoDetalle") Then
|
||||
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
||||
End If
|
||||
|
||||
|
||||
If Not TmpDT.Columns.Contains("CveCultivoCuadroDetalle") Then
|
||||
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
|
||||
End If
|
||||
@@ -2957,7 +2968,19 @@ Partial Class Compras_Compras
|
||||
If Not TmpDT.Columns.Contains("ImporteSinImpuestos") Then
|
||||
TmpDT.Columns.Add("ImporteSinImpuestos", GetType(Decimal))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
End If
|
||||
|
||||
If Not TmpDT.Columns.Contains("Lote") Then
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
End If
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
@@ -4288,6 +4311,14 @@ Partial Class Compras_Compras
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not validaFechaNumeroReembolso() Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not ValidaLoteFechaCaducidad() Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim TotalRealDevolucion As Decimal = 0
|
||||
|
||||
Dim EstatusCredito As Integer = 0
|
||||
@@ -5588,8 +5619,10 @@ Partial Class Compras_Compras
|
||||
For Each dr As DataRow In DtInv.Rows
|
||||
If dr("cvealmacen").ToString.ToEntero = tcvealmacen Then
|
||||
'hay que restarle descuento
|
||||
Dim Lote As String = dr("Lote").ToString
|
||||
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
|
||||
importeconcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, dr("pu").ToString.ToDecimal, dr("pu").ToString.ToDecimal * TipoCambioGuardar) - (If(DdlMoneda.SelectedValue.ToEntero = 1, dr("descuento").ToString.ToDecimal, dr("descuento").ToString.ToDecimal * TipoCambioGuardar) / dr("cantidad").ToString.ToDecimal)
|
||||
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -5606,7 +5639,9 @@ Partial Class Compras_Compras
|
||||
Else
|
||||
If ObjInventario.GetMovimientosDetalle(cvemovimientoentrada, UsuarioActual.CveEmpresa) Then
|
||||
For Each dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
|
||||
Dim Lote As String = dr("Lote").ToString
|
||||
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
|
||||
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -5699,11 +5734,21 @@ Partial Class Compras_Compras
|
||||
tDescuento = Dr("Descuento").ToString.ToDecimal / CantidadInv
|
||||
CostoIndirecto = Dr("CostoIndirectoAlmacen").ToString.ToDecimal
|
||||
|
||||
Dim Lote As String = Dr("Lote").ToString
|
||||
Dim FechaCaducidad As Date = If(Dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, Dr("FechaCaducidad").ToString.ToDate)
|
||||
|
||||
Dim AplicaLote As Boolean = If(Dr("AplicaLote").ToString.Trim = "", False, Boolean.Parse(Dr("AplicaLote").ToString))
|
||||
Dim AplicaCaducidad As Boolean = If(Dr("AplicaCaducidad").ToString.Trim = "", False, Boolean.Parse(Dr("AplicaCaducidad").ToString))
|
||||
Dim CodigoPS As String = Dr("CodigoPS").ToString
|
||||
|
||||
If Dr("CveMetodoInventario").ToString.ToEntero = 5 Then
|
||||
'SI FUE POR SERIE LOTE
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("CvePS = {0}", Dr("CvePS")))
|
||||
If DtDetalle.Rows.Count > 0 Then
|
||||
For Each drr As DataRow In DtDetalle.Rows
|
||||
|
||||
Dim fechaDetalle As Date = drr("FechaCaducidad").ToString.ToDate
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=drr("Serie").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CostoIndirecto:=Dr("CostoIndirectoAlmacen").ToString.ToDecimal, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
@@ -5731,10 +5776,26 @@ Partial Class Compras_Compras
|
||||
'si no es por serie lote
|
||||
ImporteConcepto = If(UsuarioActual.Empresa.UsaAC, ImporteConcepto * IVA, ImporteConcepto)
|
||||
If Dr("CveAlmacen").ToString.ToEntero = tCveAlmacen Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
|
||||
|
||||
If AplicaLote And Lote.Trim = "" Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere Lote.", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
If AplicaCaducidad And FechaCaducidad <= MinFecha Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere fecha de caducidad.", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
i = i + 1
|
||||
@@ -6781,7 +6842,10 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Dim DiferenciaDevolucion As Decimal = importeMovimiento - TotalRealDevolucion
|
||||
|
||||
|
||||
Dim DiferenciaDevolucion As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, (importeMovimiento * TxtTC.Text.ToDecimal), importeMovimiento) - TotalRealDevolucion
|
||||
|
||||
If TotalRealDevolucion <> 0 Then
|
||||
|
||||
If Math.Abs(DiferenciaDevolucion) > 0 Then
|
||||
@@ -6795,7 +6859,7 @@ Partial Class Compras_Compras
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion.RoundSQL(), (TotalRealDevolucion * tipoCambioActual).RoundSQL(), ConceptoContabilizacionNC, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteME:=If(tipoCambioActual = 1, 0, TotalRealDevolucion).RoundSQL(), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion.RoundSQL(), (TotalRealDevolucion).RoundSQL(), ConceptoContabilizacionNC, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteME:=If(tipoCambioActual = 1, 0, TotalRealDevolucion).RoundSQL(), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
Else
|
||||
@@ -7725,7 +7789,7 @@ Partial Class Compras_Compras
|
||||
|
||||
If Not ErrorPrepoliza AndAlso Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=4, AutoConta:=AutoConta) Then
|
||||
TieneError = True
|
||||
If ObjConta.ValorPolizaDescuadre > 0 AndAlso UsuarioActual.CveRol = 1 Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError)
|
||||
ErrorPrepolizaDescuadre = True
|
||||
End If
|
||||
@@ -7964,6 +8028,45 @@ Partial Class Compras_Compras
|
||||
|
||||
End Function
|
||||
|
||||
Private Function ValidaLoteFechaCaducidad() As Boolean
|
||||
Dim Respuesta As Boolean = True
|
||||
Dim sbErrores As New StringBuilder
|
||||
If UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoCompra.SelectedValue <> "13" Then 'And UsuarioActual.Empresa.UsaAC = False
|
||||
For Each gvRow As GridViewRow In GvInv.Rows
|
||||
Dim Chk As CheckBox = gvRow.FCCheckBox("cbInv")
|
||||
|
||||
If Chk.Checked Then
|
||||
|
||||
Dim Ps As String = gvRow.DataKey("PS")
|
||||
Dim AplicaLote As Boolean = If(gvRow.DataKey("AplicaLote").Trim = "", False, Boolean.Parse(gvRow.DataKey("AplicaLote")))
|
||||
Dim AplicaCaducidad As Boolean = If(gvRow.DataKey("AplicaCaducidad").Trim = "", False, Boolean.Parse(gvRow.DataKey("AplicaCaducidad")))
|
||||
Dim Lote As String = gvRow.FCTextBox("TxtLote").Text
|
||||
Dim FechaCaducidad As Date = gvRow.FCTextBox("TxtCaducidad").Text.ToDate
|
||||
|
||||
If AplicaLote AndAlso Lote.Trim = String.Empty Then
|
||||
sbErrores.Append($"Producto {Ps} requiere Lote.</br>")
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
If AplicaCaducidad AndAlso (FechaCaducidad <= MinFecha) Then
|
||||
sbErrores.Append($"Producto {Ps} requiere Fecha de Caducidad.</br>")
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
If Not Respuesta Then
|
||||
Alert($"Los siguientes productos requieren que se les especifique Lote o Fecha de Caducidad.</br>{sbErrores.ToString}", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
|
||||
Return Respuesta
|
||||
|
||||
End Function
|
||||
|
||||
Private Function AjustaCombustibles() As Boolean
|
||||
|
||||
Dim Respuesta As Boolean = False
|
||||
@@ -9374,14 +9477,87 @@ Partial Class Compras_Compras
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function validaFechaNumeroReembolso() As Boolean
|
||||
|
||||
Private Function validaNumeroReembolso(transaccionSql As SqlTransaction) As Boolean
|
||||
Dim respuesta As Boolean = True
|
||||
Dim CvePersonalVal As Integer = -1
|
||||
Dim CveCajaChicaVal As Integer = -1
|
||||
Dim FechaCompra As Date = TxtFecha.Text.ToDate
|
||||
|
||||
If RblRembolso.SelectedValue.ToEntero = 1 Then
|
||||
'IMPORATNTE DdlPersonalReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoPersonal
|
||||
CvePersonalVal = DdlPersonalReembolso.SelectedValue.ToEntero
|
||||
|
||||
Else
|
||||
'IMPORATNTE DdlCuentaCajaChicaReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoCajaChica
|
||||
CveCajaChicaVal = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
|
||||
End If
|
||||
|
||||
Dim objCompras As New ClsCompras()
|
||||
|
||||
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
|
||||
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
|
||||
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
Dim FechaReembolso As Date = objCompras.DtResultados.Rows(0)("Fecha").ToString.ToDate
|
||||
|
||||
Dim MesReembolsoInt As Integer = FechaReembolso.Month
|
||||
Dim AnioReembolsoInt As Integer = FechaReembolso.Year
|
||||
|
||||
Dim mesAnterior As Integer
|
||||
Dim AnioValidoInt As Integer
|
||||
|
||||
If MesReembolsoInt = 1 Then
|
||||
mesAnterior = 12
|
||||
AnioValidoInt = AnioReembolsoInt - 1
|
||||
Else
|
||||
mesAnterior = MesReembolsoInt - 1
|
||||
AnioValidoInt = AnioReembolsoInt
|
||||
End If
|
||||
|
||||
|
||||
If MesReembolsoInt = FechaCompra.Month Or (FechaCompra.Month = mesAnterior AndAlso FechaCompra.Year = AnioValidoInt) Then
|
||||
respuesta = True 'Correcto Fecha de compra dentro del mes del reembolso o mes anterior
|
||||
Else
|
||||
respuesta = False 'La fecha de la compra esta por fuera de lo permitido mes actual o mes anterior
|
||||
|
||||
If FechaCompra.Month > MesReembolsoInt Then
|
||||
Alert($"La fecha de la compra que se quiere registrar esta adelantada al mes de la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert($"La fecha de la compra que se quiere registrar es anterior al mes permitido por la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
respuesta = True ' No existe numero reembolso por lo que se considera Verdadero
|
||||
End If
|
||||
Else
|
||||
respuesta = False ' al no poder consultar no se puede validar la fecha por lo que por default se considera como fecha no valida para el reembolso
|
||||
End If
|
||||
End If
|
||||
|
||||
objCompras.Dispose()
|
||||
|
||||
Return respuesta
|
||||
|
||||
End Function
|
||||
|
||||
Private Function validaNumeroReembolso(ByRef transaccionSql As SqlTransaction) As Boolean
|
||||
|
||||
|
||||
Dim CvePersonalVal As Integer = -1
|
||||
Dim CveCajaChicaVal As Integer = -1
|
||||
|
||||
If RblRembolso.SelectedValue.ToEntero = 1 Then
|
||||
CvePersonalVal = DdlRembolsoPersonal.SelectedValue.ToEntero
|
||||
Else
|
||||
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
|
||||
End If
|
||||
|
||||
Dim objCompras As New ClsCompras(transaccionSql)
|
||||
Dim objConta As New ClsContabilidad(transaccionSql)
|
||||
|
||||
|
||||
Dim tienePagoContabilizado As Boolean = False
|
||||
Dim ErrorProceso As Boolean = False
|
||||
|
||||
@@ -9390,15 +9566,6 @@ Partial Class Compras_Compras
|
||||
|
||||
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
|
||||
|
||||
Dim CvePersonalVal As Integer = -1
|
||||
Dim CveCajaChicaVal As Integer = -1
|
||||
|
||||
If RblRembolso.SelectedValue.ToEntero = 1 Then
|
||||
CvePersonalVal = DdlRembolsoPersonal.SelectedValue.ToEntero
|
||||
Else
|
||||
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
|
||||
End If
|
||||
|
||||
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
If objCompras.DtResultados.Rows.Count > 0 Then
|
||||
@@ -9419,10 +9586,8 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If NumeroReembolsoOriginal = "" And TxtRembolsoNumero.Text.Trim.Length > 0 Then
|
||||
|
||||
|
||||
If objCompras.GetComprobacionPagosContabilizados(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
|
||||
@@ -10668,6 +10833,11 @@ Partial Class Compras_Compras
|
||||
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("TemporadaCuadro", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
|
||||
TmpDTOriginal = New DataTable
|
||||
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
|
||||
@@ -10778,7 +10948,10 @@ Partial Class Compras_Compras
|
||||
TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double))
|
||||
TmpDTOriginal.Columns.Add("TemporadaCuadro", GetType(String))
|
||||
|
||||
|
||||
TmpDTOriginal.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDTOriginal.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
TmpDTOriginal.Columns.Add("Lote", GetType(String))
|
||||
TmpDTOriginal.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -10952,6 +11125,33 @@ Partial Class Compras_Compras
|
||||
#Region " ALMACEN "
|
||||
Private Sub CargaGvInv()
|
||||
|
||||
|
||||
If Not TmpDT.Columns.Contains("UUIDRow") Then
|
||||
TmpDT.Columns.Add("UUIDRow", GetType(String))
|
||||
End If
|
||||
|
||||
For Each dRow As DataRow In TmpDT.Rows
|
||||
If dRow("UUIDRow").ToString.Trim = "" Then
|
||||
dRow("UUIDRow") = Guid.NewGuid().ToString()
|
||||
End If
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
|
||||
dRow("AplicaLote") = False
|
||||
dRow("AplicaCaducidad") = False
|
||||
|
||||
If CvePS > 0 Then
|
||||
Dim drPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePS={CvePS}")
|
||||
If drPS IsNot Nothing Then
|
||||
dRow("AplicaLote") = If(drPS("AplicaLote").ToString = "", False, Boolean.Parse(drPS("AplicaLote").ToString))
|
||||
dRow("AplicaCaducidad") = If(drPS("AplicaCaducidad").ToString = "", False, Boolean.Parse(drPS("AplicaCaducidad").ToString))
|
||||
'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
TmpDT.AcceptChanges()
|
||||
|
||||
'SI ES CONSIGNACION NO LIMITA POR TIPO PS - PARA GLUYAS
|
||||
If ChkConsignacion.Checked Then
|
||||
DtInv = TmpDT.Copy
|
||||
@@ -10959,6 +11159,18 @@ Partial Class Compras_Compras
|
||||
DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy
|
||||
End If
|
||||
|
||||
|
||||
For Each dRow As DataRow In DtInv.Rows
|
||||
|
||||
'Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim AplicaLote As Boolean = Boolean.Parse(dRow("AplicaLote").ToString) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
|
||||
Dim AplicaCaducidad As Boolean = Boolean.Parse(dRow("AplicaCaducidad").ToString) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
|
||||
|
||||
GvInv.Columns(7).Visible = AplicaLote
|
||||
GvInv.Columns(8).Visible = AplicaCaducidad
|
||||
|
||||
Next
|
||||
|
||||
GvInv.DataSource = DtInv
|
||||
GvInv.DataBind()
|
||||
|
||||
@@ -10972,6 +11184,35 @@ Partial Class Compras_Compras
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnInvActualizaLoteCaducidad_Click(sender As Object, e As EventArgs)
|
||||
|
||||
For Each gvRow As GridViewRow In GvInv.Rows
|
||||
|
||||
Dim TxtLote As TextBox = gvRow.FCTextBox("TxtLote")
|
||||
Dim TxtFechaCaducidad As TextBox = gvRow.FCTextBox("TxtCaducidad")
|
||||
|
||||
Dim UUIDRow As String = gvRow.DataKey("UUIDRow")
|
||||
Dim FechaCaducidad As Date = If(TxtFechaCaducidad.Text.ToDate <= MinFecha, MinFecha, TxtFechaCaducidad.Text.ToDate)
|
||||
|
||||
|
||||
For Each dRow As DataRow In TmpDT.Rows
|
||||
If dRow("UUIDRow").ToString = UUIDRow Then
|
||||
dRow("Lote") = TxtLote.Text
|
||||
dRow("FechaCaducidad") = FechaCaducidad
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each dRow As DataRow In DtInv.Rows
|
||||
If dRow("UUIDRow").ToString = UUIDRow Then
|
||||
dRow("Lote") = TxtLote.Text
|
||||
dRow("FechaCaducidad") = FechaCaducidad
|
||||
End If
|
||||
Next
|
||||
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaFletesAgregados()
|
||||
CreaDTServicios()
|
||||
BtnFiltrar_Click(Nothing, Nothing)
|
||||
@@ -10998,6 +11239,29 @@ Partial Class Compras_Compras
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim CvePS As Integer = e.Row.DataKey("CvePS").ToEntero
|
||||
|
||||
Dim AplicaLote As Boolean = False
|
||||
Dim AplicaCaducidad As Boolean = False
|
||||
|
||||
If CvePS > 0 Then
|
||||
Dim drPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePS={CvePS}")
|
||||
If drPS IsNot Nothing Then
|
||||
AplicaLote = If(drPS("AplicaLote").ToString = "", False, Boolean.Parse(drPS("AplicaLote").ToString)) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
|
||||
AplicaCaducidad = If(drPS("AplicaCaducidad").ToString = "", False, Boolean.Parse(drPS("AplicaCaducidad").ToString)) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If AplicaLote Then
|
||||
e.Row.FCTextBox("TxtLote").Visible = True
|
||||
End If
|
||||
|
||||
If AplicaCaducidad Then
|
||||
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
|
||||
DvFechaCaducidad.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then e.Row.FCCheckBox("cbInv").Enabled = False
|
||||
|
||||
Dim StrTipo As String = "CveTipoAlmacen IN (1,2,7,14,19)"
|
||||
@@ -11074,7 +11338,7 @@ Partial Class Compras_Compras
|
||||
e.Row.FCDropDownList("ddlAlmacenConsignacion").SelectedValueExist(e.Row.DBCampo("CveAlmacenConsignacion"))
|
||||
End If
|
||||
''CARGA CONSIGNACIONES
|
||||
e.Row.FCDropDownList("DdlVinculaConsignacion").DataSource = DtConsignaciones.FiltraParametros(String.Format("CveAlmacenSalida = {0} OR {0} = '-1'", e.Row.FCDropDownList("ddlAlmacenConsignacion").SelectedValue))
|
||||
e.Row.FCDropDownList("DdlVinculaConsignacion").DataSource = DtConsignaciones.FiltraParametros(String.Format("CveAlmacenSalida = {0} Or {0} = '-1'", e.Row.FCDropDownList("ddlAlmacenConsignacion").SelectedValue))
|
||||
e.Row.FCDropDownList("DdlVinculaConsignacion").DataBind()
|
||||
e.Row.FCDropDownList("DdlVinculaConsignacion").Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
@@ -13242,8 +13506,8 @@ Partial Class Compras_Compras
|
||||
|
||||
If ChkConsignacion.Checked Then
|
||||
'LiConsignacion.Visible = True
|
||||
GvInv.Columns(7).Visible = True
|
||||
GvInv.Columns(8).Visible = True
|
||||
GvInv.Columns(9).Visible = True
|
||||
GvInv.Columns(10).Visible = True
|
||||
CargaConsignaciones2()
|
||||
|
||||
CargaGvInv()
|
||||
@@ -13256,8 +13520,8 @@ Partial Class Compras_Compras
|
||||
BtnGuardar.Enabled = False
|
||||
UpFacturar.Update()
|
||||
Else
|
||||
GvInv.Columns(7).Visible = False
|
||||
GvInv.Columns(8).Visible = False
|
||||
GvInv.Columns(9).Visible = False
|
||||
GvInv.Columns(10).Visible = False
|
||||
'LiConsignacion.Visible = False
|
||||
CveConsignacion = -1
|
||||
|
||||
@@ -13529,7 +13793,8 @@ Partial Class Compras_Compras
|
||||
Cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
If Cantidad > 0 Then
|
||||
realizadevolucion = True
|
||||
subtotaldevolucion += Dr.DataKey("PU").ToString.ToDecimal * Cantidad
|
||||
Dim PU As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, Dr.DataKey("PUExtranjero").ToString.ToDecimal, Dr.DataKey("PU").ToString.ToDecimal)
|
||||
subtotaldevolucion += PU * Cantidad
|
||||
End If
|
||||
Next
|
||||
'si no esta vinculado a nc simplemente me lo brinco
|
||||
@@ -13544,6 +13809,7 @@ Partial Class Compras_Compras
|
||||
Else
|
||||
Dim Acumulado As Decimal = 0
|
||||
Dim PU As Decimal
|
||||
Dim PUExtranjero As Decimal
|
||||
Dim CantidadRenglones As Integer = 0
|
||||
Dim ii As Integer = 0
|
||||
For Each Dr As GridViewRow In GVDevolucion.Rows
|
||||
@@ -13556,6 +13822,7 @@ Partial Class Compras_Compras
|
||||
If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
|
||||
Acumulado += (Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)
|
||||
PU = Dr.DataKey("PU").ToString.ToDecimal
|
||||
PUExtranjero = Dr.DataKey("PUExtranjero").ToString.ToDecimal
|
||||
ii += 1
|
||||
If CantidadRenglones = ii Then
|
||||
Dim dif As Decimal = subtotal - Acumulado
|
||||
@@ -13581,7 +13848,7 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr.FCTextBox("TxtCantidad").Text.ToDecimal, Dr.DataKey("CveUM").ToString.ToEntero, Dr.DataKey("CvePS").ToString.ToEntero, PU, -1, CveMovimientoDetalleEntrada:=Dr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr.FCTextBox("TxtCantidad").Text.ToDecimal, Dr.DataKey("CveUM").ToString.ToEntero, Dr.DataKey("CvePS").ToString.ToEntero, PU, -1, CveMovimientoDetalleEntrada:=Dr.DataKey("CveMovimientoDetalle").ToString.ToEntero, PUTC:=PUExtranjero) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -13598,7 +13865,10 @@ Partial Class Compras_Compras
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa, -1) Then
|
||||
|
||||
For Each drow As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
|
||||
TotalSumaPU = TotalSumaPU + drow("Total").ToString.ToDecimal
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
@@ -14155,6 +14425,20 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("Lote") Then
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
End If
|
||||
|
||||
|
||||
If ObjInventario.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
tbmovs = ObjInventario.DtResultados
|
||||
@@ -21632,6 +21916,8 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -22156,6 +22442,21 @@ Public Class ClsCompraManagerCompras
|
||||
If Not TmpDT.Columns.Contains("Amortizacion") Then
|
||||
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
|
||||
End If
|
||||
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("Lote") Then
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
End If
|
||||
|
||||
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
|
||||
Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
|
||||
For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows
|
||||
@@ -22402,6 +22703,13 @@ Public Class ClsCompraManagerCompras
|
||||
|
||||
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
|
||||
|
||||
|
||||
@@ -1707,7 +1707,12 @@ Partial Class Compras_eFacturas
|
||||
If File.Exists(PDfDestino) Then
|
||||
File.Delete(PDfDestino)
|
||||
End If
|
||||
File.Move(RutaPDF, PDfDestino)
|
||||
Try
|
||||
File.Move(RutaPDF, PDfDestino)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -988,8 +988,8 @@ Partial Class Inventarios_EntradasSalidas
|
||||
End If
|
||||
|
||||
End If
|
||||
If CveConcepto.Contiene(26, 27) Then
|
||||
LnkAgregarProducto.Visible = False ' si es traspaso no se debe permitir agregar
|
||||
If CveConcepto.Contiene(26, 27, 8, 9) Then
|
||||
LnkAgregarProducto.Visible = False ' si es traspaso no se debe permitir agregar, ni entregas por adelantado
|
||||
End If
|
||||
If CveConcepto.Contiene(3, 8) Then
|
||||
LiLnkGuias.Visible = True
|
||||
|
||||
@@ -876,7 +876,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
Dim FiltroPS As String = ""
|
||||
Select Case ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString()
|
||||
Case "Ing"
|
||||
Filtro = "CveConcepto IN (3,40)"
|
||||
Filtro = "CveConcepto IN (3,40,35)"
|
||||
Case "Dev"
|
||||
'cuand es devolucionventa=1, es cancelación de la devolución
|
||||
If EsDevolucionVenta = 1 Then
|
||||
@@ -4003,7 +4003,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
objOS.Dispose()
|
||||
' TxtObservaciones.Text = $"Dr. {drE("Medico").ToString}{vbCrLf}Cx. {drE("Procedimiento").ToString}{vbCrLf}F. Cirugía {drE("FechaParaSurtir").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm")}{vbCrLf}H. {drE("Sucursal").ToString}{vbCrLf}"
|
||||
|
||||
EnviaNotificacionSMS(6, UsuarioActual.Empresa, tCveOS, FolioOS, dr("FechaParaSurtir").ToString.ToDateTime, dr("ClienteNombre").ToString, dr("Medico").ToString, dr("Procedimiento").ToString, "", dr("VendedorNombre").ToString, FolioRemision.ToString, ListMateriales, CorreoVendedor)
|
||||
EnviaNotificacionSMS(6, UsuarioActual.Empresa, tCveOS, FolioOS, dr("FechaParaSurtir").ToString.ToDateTime, dr("ClienteNombre").ToString, dr("TipoVenta").ToString, dr("Medico").ToString, dr("Procedimiento").ToString, "", dr("VendedorNombre").ToString, FolioRemision.ToString, ListMateriales, CorreoVendedor)
|
||||
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
@@ -449,8 +449,21 @@ Partial Class Inventarios_RepAnomalias
|
||||
Dim params As New List(Of ReportParameter)
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim Inventario As New ClsInventarios
|
||||
|
||||
|
||||
Dim Firma1 As String = ""
|
||||
Dim Firma2 As String = ""
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(208) <> "" Then
|
||||
Dim temp As String = UsuarioActual.Empresa.Funcionalidad(208)
|
||||
Dim arr As String() = temp.Split(","c)
|
||||
For Each ar As String In arr
|
||||
If ar.Contains(lbSubProyecto.Text) Then
|
||||
Dim temp2 As String = ar.Split(":"c)(1)
|
||||
Firma1 = temp2.Split("|"c)(0)
|
||||
Firma2 = temp2.Split("|"c)(1)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim dtS As DataTable = Nothing
|
||||
Dim dtF As DataTable = Nothing
|
||||
|
||||
@@ -464,6 +477,8 @@ Partial Class Inventarios_RepAnomalias
|
||||
params.Add(New ReportParameter("FechaFin", Inventario.FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToString))
|
||||
params.Add(New ReportParameter("Firma1", Firma1))
|
||||
params.Add(New ReportParameter("Firma2", Firma2))
|
||||
|
||||
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
||||
|
||||
@@ -1066,11 +1081,9 @@ Partial Class Inventarios_RepAnomalias
|
||||
End If
|
||||
contadorS += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
contadorF += 1
|
||||
|
||||
Next
|
||||
|
||||
@@ -2775,10 +2775,10 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
If ObjTimbres.Timbrar(CvePACEspecifico:=4) Then
|
||||
|
||||
Try
|
||||
PdfFactura(ObjTimbres.ObjFactura)
|
||||
ObjTimbres.ObjFactura.Inv_CveMovimiento = CveMovimientoTimbrado
|
||||
PdfFactura(ObjTimbres.ObjFactura)
|
||||
Catch ex As Exception
|
||||
|
||||
OnError("Ocurrió un error al generar el pdf", ex)
|
||||
End Try
|
||||
|
||||
MensajeAlert.Append("Emitido con éxito.")
|
||||
@@ -2788,11 +2788,6 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=DesXmlTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", CveMovimientoTimbrado, "XML", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto)))
|
||||
End If
|
||||
'PDF
|
||||
'Dim ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjTimbres.ObjFactura.TipoDocto, ObjTimbres.ObjFactura.SerieFolio)
|
||||
'If File.Exists(ArchivoPDF) Then
|
||||
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=DesPdfTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", CveMovimientoTimbrado, "PDF", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto)))
|
||||
'End If
|
||||
|
||||
If ChkEmitirCartaPorte.Checked Then
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Carta Porte</a></li></ul>", Encripta(String.Format("OP=CARPOTIMBRE&CVETIMBRE={0}", CveTimbre)))
|
||||
Else
|
||||
|
||||
@@ -524,10 +524,10 @@ Partial Class OS_Asignaciones
|
||||
|
||||
'técnico
|
||||
CorreoDestino = CorreoUsuarioAsignado
|
||||
EnviaNotificacionSMS(7, UsuarioActual.Empresa, CveOS, Folio, FechaCirugia, NombreCliente, Medico, Procedimiento, Tecnico, Vendedor, "", ListMateriales, CorreoDestino)
|
||||
EnviaNotificacionSMS(7, UsuarioActual.Empresa, CveOS, Folio, FechaCirugia, NombreCliente, TipoVenta, Medico, Procedimiento, Tecnico, Vendedor, "", ListMateriales, CorreoDestino)
|
||||
'vendedor
|
||||
CorreoDestino = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo", $"CveVendedor ={dr("CveVendedor")}")
|
||||
EnviaNotificacionSMS(8, UsuarioActual.Empresa, CveOS, Folio, FechaCirugia, NombreCliente, Medico, Procedimiento, Tecnico, Vendedor, "", ListMateriales, CorreoDestino)
|
||||
EnviaNotificacionSMS(8, UsuarioActual.Empresa, CveOS, Folio, FechaCirugia, NombreCliente, TipoVenta, Medico, Procedimiento, Tecnico, Vendedor, "", ListMateriales, CorreoDestino)
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -3370,6 +3370,14 @@ Partial Class OS_OrdenesServicios
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If ProcesoOK Then ' bitácora de la remisión generada.
|
||||
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
|
||||
Dim LigaVenta As String = String.Format("Remisión Generada: <a href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", CveVentaRemisionGenerada, Respuesta.SerieFolio)
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Observaciones:=TxtObservacionModal.Text.Trim) Then
|
||||
@@ -3483,7 +3491,6 @@ Partial Class OS_OrdenesServicios
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
AnexoManerialUtilizado.Text = "[]"
|
||||
|
||||
@@ -343,6 +343,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-md-4">Es Presupuestal</label>
|
||||
<div class="col-md-8">
|
||||
<asp:CheckBox runat="server" ID="ChkEsPresupuestal" CssClass="make-switchsd" data-size="small" Checked="true" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; padding-top: 20px;">
|
||||
|
||||
@@ -254,6 +254,8 @@ Partial Class RepContratoDetalle
|
||||
|
||||
If CveVentaRemision > 0 Then
|
||||
DVFactura.Visible = True
|
||||
ChkEsPresupuestal.Enabled = False
|
||||
ChkEsPresupuestal.Checked = False
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -326,6 +328,8 @@ Partial Class RepContratoDetalle
|
||||
HypRemision.Text = Contrato.Rows(0)("RemisionSerieFolio").ToString
|
||||
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ CveVentaRemision}"
|
||||
|
||||
ChkEsPresupuestal.Checked = Boolean.Parse(Contrato.Rows(0)("EsPresupuestal").ToString)
|
||||
|
||||
If Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal > 0 Then
|
||||
LblSaldo.Text = $"Saldo { Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
|
||||
Else
|
||||
@@ -449,22 +453,7 @@ Partial Class RepContratoDetalle
|
||||
|
||||
End Sub
|
||||
|
||||
'Protected Sub CargarArchivo(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
|
||||
' If AFU.HasFile Then
|
||||
|
||||
|
||||
' Dim UploadFolder As String = String.Format("{0}\Temp\", UsuarioActual.Empresa.Ruta)
|
||||
' UploadFolder.DirectoryExistsCreate()
|
||||
' Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
|
||||
|
||||
' If File.Exists(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension)) Then File.Delete(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension))
|
||||
|
||||
' AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
|
||||
' Session("FileUpload") = UploadFolder & UsuarioActual.CveUsuario.ToString & Extension
|
||||
' Session("FileExtension") = Extension
|
||||
' Session("FileFolder") = UploadFolder
|
||||
' End If
|
||||
'End Sub
|
||||
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
|
||||
Dim Archivo As New System.IO.FileInfo(filePath)
|
||||
@@ -526,16 +515,8 @@ Partial Class RepContratoDetalle
|
||||
BtnDescargar.Visible = True
|
||||
End If
|
||||
End Sub
|
||||
'Private Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
||||
' Dim File As New FileInfo(ViewState("FUrl").ToString)
|
||||
' Dim Url As String = $"{ObtenerUrlCompleta()}Compras/PopUpVerFactura.aspx?ArchivoContrato={Encripta(File.FullName)}"
|
||||
' If File.Exists Then
|
||||
' RegistraScript($"window.open({Url}, ""_blank"");")
|
||||
' End If
|
||||
|
||||
|
||||
'End Sub
|
||||
|
||||
Public Function ObtenerUrlCompleta() As String
|
||||
|
||||
Dim Solicitud As HttpRequest = HttpContext.Current.Request
|
||||
@@ -555,35 +536,13 @@ Partial Class RepContratoDetalle
|
||||
Return url
|
||||
|
||||
End Function
|
||||
'Private Sub DescargaArchivo(urlArchivo As String)
|
||||
|
||||
' Dim File As New FileInfo(urlArchivo)
|
||||
|
||||
' If File.Exists Then 'set appropriate headers
|
||||
|
||||
' Response.Clear()
|
||||
' Response.ClearHeaders()
|
||||
' Response.ClearContent()
|
||||
' Response.AddHeader("Content-Disposition", "inline; filename=" & TxtFolio.Text & $"{File.Extension}")
|
||||
' Response.AddHeader("Content-Length", File.Length.ToString())
|
||||
' 'Response.ContentType = "text/plain"
|
||||
' Response.ContentType = "application/octet-stream"
|
||||
' Response.Flush()
|
||||
' ' Response.TransmitFile(File.FullName)
|
||||
' Response.WriteFile(File.FullName)
|
||||
' Response.End()
|
||||
|
||||
' Else
|
||||
|
||||
' Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()")
|
||||
|
||||
' End If
|
||||
|
||||
'End Sub
|
||||
|
||||
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
||||
Dim ArchivoUpdate As String = "-1"
|
||||
Dim ErrorProceso As Boolean = False
|
||||
Dim SeGeneroRemision As Boolean = False
|
||||
Dim SerieFolioRemision As String = ""
|
||||
If Session("FileExtension").ToString <> "" Then
|
||||
|
||||
'ArchivoUpdate = $"{CveContrato.ToString}.{ Session("FileExtension")}"
|
||||
@@ -597,7 +556,7 @@ Partial Class RepContratoDetalle
|
||||
|
||||
|
||||
If Not ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "",
|
||||
DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkEsPresupuestal.Checked, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=CveContratoTipo, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveContratosEstatus:=CveContratoEstatus, Observaciones:=TxtObservaciones.Text) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
@@ -617,11 +576,36 @@ Partial Class RepContratoDetalle
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
If Not ErrorProceso AndAlso Not CveVentaRemision > 0 AndAlso ChkEsPresupuestal.Checked = False Then
|
||||
'CveVentaRemision
|
||||
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{TxtFolio.Text}"
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim CvePS As Integer = 907784
|
||||
Respuesta = GeneraRemision(CveContrato, ObsRemisionPartida, TxtImporte.Text.ToDecimal, CvePS, ObjContratos.IniciaTransacSQL, DdlSubProyecto.SelectedValue.ToEntero)
|
||||
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
CveVentaRemision = Respuesta.CveVenta
|
||||
SerieFolioRemision = Respuesta.SerieFolio
|
||||
ErrorProceso = False
|
||||
SeGeneroRemision = True
|
||||
Else
|
||||
ErrorProceso = True
|
||||
Alert("se presento un error al generar la remisión", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
ObjContratos.Commit()
|
||||
AgregarABitacora($"Actualización del contrato {CveContrato}")
|
||||
Alert("Contrato actualizado correctamente")
|
||||
|
||||
If SeGeneroRemision Then
|
||||
Alert($"Contrato actualizado correctamente..<br> Remisión Generada <a target='_blank' class='Texto' href='/Ventas/Ventas.aspx?CveVenta={CveVentaRemision}' ><b>{SerieFolioRemision}</b></a>", TipoMensaje.MsgInformacion, "window.location.reload();")
|
||||
Else
|
||||
Alert("Contrato actualizado correctamente", TipoMensaje.MsgInformacion, "window.location.reload();")
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
Alert("Ocurrió un ocurrió un error al actualizar su boleto", TipoMensaje.MsgError)
|
||||
ObjContratos.RollBack()
|
||||
@@ -796,23 +780,7 @@ Partial Class RepContratoDetalle
|
||||
New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
||||
New ReportParameter("Usuario", UsuarioActual.Nombre)
|
||||
}
|
||||
'New ReportParameter("Folio", TxtFolio.Text),
|
||||
' New ReportParameter("Cliente", DdlClientes.SelectedText),
|
||||
' New ReportParameter("Servicio", TxtDescripcion.Text),
|
||||
' New ReportParameter("Observaciones", TxtObservaciones.Text),
|
||||
' New ReportParameter("Ubicacion", TxtUbicacion.Text),
|
||||
' New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy")),
|
||||
' New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy")),
|
||||
' New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
|
||||
' New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
|
||||
' New ReportParameter("Pesos", Math.Round(TxtImporte.Text.ToDecimal, 2).ToString),
|
||||
' New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
|
||||
' New ReportParameter("Anticipo", Math.Round((TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal), 2).ToString),
|
||||
' New ReportParameter("Total", Math.Round((TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal)), 2).ToString),
|
||||
' New ReportParameter("DiaSalida", $"{TxtFechaSalida.Text.ToDate.Hour}:{TxtFechaSalida.Text.ToDate.Minute} "),
|
||||
' New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
|
||||
' New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
||||
' New ReportParameter("Usuario", UsuarioActual.Nombre)
|
||||
|
||||
|
||||
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Contrato.mrt", dtResult, params, NombreArchivo:=TxtFolio.Text)
|
||||
End Sub
|
||||
@@ -1114,7 +1082,85 @@ Partial Class RepContratoDetalle
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " R E M I S I O N "
|
||||
Private Function GeneraRemision(CveContrato As Integer, ObsPartida As String, Importe As Decimal, CvePS As Integer, ByRef TransaccionSQL As SqlClient.SqlTransaction, CveSubProyecto As Integer) As RespuestaFacturacion
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim CveRemisionGenerada As Integer = -1
|
||||
Dim ObjVentas As New ClsVentas(TransaccionSQL)
|
||||
Dim ProcesoOK As Boolean = True
|
||||
Dim CveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero
|
||||
|
||||
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, DdlClientes.SelectedValue.ToEntero, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing AndAlso ProcesoOK Then
|
||||
|
||||
ObjFactura.CveMoneda = CveMoneda
|
||||
ObjFactura.CveContrato = CveContrato
|
||||
ObjFactura.Observaciones = ObsPartida
|
||||
ObjFactura.CveFormaPago33 = 20 ' por definir
|
||||
If CveMoneda > 1 Then
|
||||
ObjFactura.TipoCambio = GlobalTipoCambio(DateTime.Now).ToDecimal
|
||||
End If
|
||||
|
||||
Dim TmpDTMat As New DataTable
|
||||
TmpDTMat.Columns.Add("Consec", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CveUM", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("Cantidad", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDTMat.Columns.Add("Lote", GetType(String))
|
||||
TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
|
||||
Dim CantidadRegistro As Decimal = 1
|
||||
Dim PorcentajeIVA As Decimal = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto).FiltroPrimeroValor("IVA").ToDecimal
|
||||
Dim SubTotal As Decimal = (Importe / (1D + PorcentajeIVA))
|
||||
Dim PU As Decimal = SubTotal
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim Obs As String = ObsPartida
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=PorcentajeIVA) Then
|
||||
Dim drp As DataRow = TmpDTMat.NewRow
|
||||
drp("CvePS") = CvePS
|
||||
drp("Cantidad") = CantidadRegistro
|
||||
drp("PU") = PU
|
||||
TmpDTMat.Rows.Add(drp)
|
||||
Else
|
||||
Alert("Error al agregar producto", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
ObjFactura.CalculaTotales()
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL)
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.CveVenta = Resp.CveVenta
|
||||
Respuesta.SerieFolio = Resp.SerieFolio
|
||||
Respuesta.dtdetalle = TmpDTMat
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Return Respuesta
|
||||
|
||||
End Function
|
||||
Friend Class RespuestaFacturacion
|
||||
Public Property CveVenta As Integer = -1
|
||||
Public Property SerieFolio As String = "-1"
|
||||
Public Property dtdetalle As DataTable = Nothing
|
||||
Public Sub New()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -257,14 +257,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4 bold text-primary">Folio</label>
|
||||
<%--<asp:Label class="col-md-8" runat="server" ID="LbFolio" Text="Folio"></asp:Label>--%>
|
||||
<label class="col-md-4 bold text-primary">Folio</label>
|
||||
<div class="col-md-8">
|
||||
|
||||
<asp:TextBox ID="LbFolio" runat="server" MaxLength="70" Width="200px" CssClass="form-control" ></asp:TextBox>
|
||||
|
||||
|
||||
</div>
|
||||
<asp:TextBox ID="LbFolio" runat="server" MaxLength="70" Width="200px" CssClass="form-control"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-1">
|
||||
@@ -488,6 +484,15 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4">Es Presupuestal</label>
|
||||
<div class="col-md-8">
|
||||
<asp:CheckBox runat="server" ID="ChkEsPresupuestal" CssClass="make-switchsd" data-size="small" Checked="true" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,7 +137,7 @@ Partial Class ListadoContratos
|
||||
Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL())
|
||||
|
||||
CveContrato = ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDateTime, TxtFechaRegreso.Text.ToDateTime, TxtUbicacion.Text, "",
|
||||
DdlSubProyectoModal.SelectedValue.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlSubProyectoModal.SelectedValue.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkEsPresupuestal.Checked, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text,
|
||||
CveVendedor:=UsuarioActual.CveVendedor)
|
||||
|
||||
@@ -180,7 +180,7 @@ Partial Class ListadoContratos
|
||||
End If
|
||||
Anexo.Text = ""
|
||||
|
||||
If ErrorProceso = False Then
|
||||
If ErrorProceso = False AndAlso Not ChkEsPresupuestal.Checked Then
|
||||
|
||||
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{LbFolio.Text}"
|
||||
|
||||
@@ -211,7 +211,13 @@ Partial Class ListadoContratos
|
||||
|
||||
If Not ErrorProceso Then
|
||||
ObjContratos.Commit()
|
||||
Alert($"Agregado Correctamente.<br> Remisión Generada <a target='_blank' class='Texto' href='/Ventas/Ventas.aspx?CveVenta={CveVentaRemision}' ><b>{SerieFolioRemision}</b></a>")
|
||||
|
||||
If CveVentaRemision > 0 Then
|
||||
Alert($"Agregado Correctamente.<br> Remisión Generada <a target='_blank' class='Texto' href='/Ventas/Ventas.aspx?CveVenta={CveVentaRemision}' ><b>{SerieFolioRemision}</b></a>")
|
||||
Else
|
||||
Alert($"Agregado Correctamente")
|
||||
End If
|
||||
|
||||
Else
|
||||
ObjContratos.RollBack()
|
||||
Alert("Se presento un error al guardar el contrato.", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
@@ -749,23 +749,17 @@
|
||||
<asp:HiddenField runat="server" ID="HidRemisionSaldo" Value="-1" ClientIDMode="Static" />
|
||||
<asp:HiddenField runat="server" ID="HidCveAF" Value="-1" ClientIDMode="Static" />
|
||||
<asp:HiddenField runat="server" ID="HidCveAFDes" Value="-1" ClientIDMode="Static" />
|
||||
|
||||
<div style="display:none!important">
|
||||
<asp:UpdatePanel runat="server" ID="UPCargaCalendario">
|
||||
<ContentTemplate>
|
||||
<asp:Button runat="server" ID="BtnCargaContratoCalendario" OnClick="BtnCargaContratoCalendario_Click" ClientIDMode="Static" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
|
||||
<%--<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
|
||||
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>--%>
|
||||
<%--<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>--%>
|
||||
<%--<script src="/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js"></script>--%>
|
||||
<%--<script src="/Transportes/Gant/dhtmlxgantt.js"></script>--%>
|
||||
|
||||
|
||||
<!-- Essential JS 2 all material theme -->
|
||||
<%--<link href="Gant/material.css" rel="stylesheet" type="text/css"/>
|
||||
<!-- Essential JS 2 all script -->
|
||||
<script src="Gant/ej2.min.js" type="text/javascript"></script>--%>
|
||||
|
||||
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
|
||||
|
||||
<!-- Librería principal de amCharts 4 -->
|
||||
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
|
||||
@@ -780,39 +774,7 @@
|
||||
<script src="https://cdn.amcharts.com/lib/4/lang/es_ES.js"></script>
|
||||
|
||||
<script>
|
||||
// Create root element
|
||||
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
|
||||
//var root = am5.Root.new("chartdiv");
|
||||
|
||||
var am5locales_es_ES = {
|
||||
"Jan": "Enero",
|
||||
"Feb": "Febrero",
|
||||
"Mar": "Marzo",
|
||||
"Apr": "Abril",
|
||||
"May": "Mayo",
|
||||
"Jun": "Junio",
|
||||
"Jul": "Julio",
|
||||
"Aug": "Agosto",
|
||||
"Sep": "Septiembre",
|
||||
"Oct": "Octubre",
|
||||
"Nov": "Noviembre",
|
||||
"Dec": "Diciembre",
|
||||
|
||||
"January": "Enero",
|
||||
"February": "Febrero",
|
||||
"March": "Marzo",
|
||||
"April": "Abril",
|
||||
"June": "Junio",
|
||||
"July": "Julio",
|
||||
"August": "Agosto",
|
||||
"September": "Septiembre",
|
||||
"October": "Octubre",
|
||||
"November": "Noviembre",
|
||||
"December": "Diciembre",
|
||||
|
||||
};
|
||||
let dateAxis;
|
||||
let yAxis;
|
||||
|
||||
var chartHeader;
|
||||
var chartBody;
|
||||
@@ -834,6 +796,7 @@
|
||||
// Convertir valores a objetos Date
|
||||
let minDate = new Date(fechaI.split("/").reverse().join("-"));
|
||||
let maxDate = new Date(fechaF.split("/").reverse().join("-"));
|
||||
maxDate.setDate(maxDate.getDate() + 1);
|
||||
maxDate.setHours(23, 59, 59, 999);
|
||||
|
||||
// Crear instancia del gráfico del encabezado
|
||||
@@ -856,14 +819,14 @@
|
||||
// Crear eje X (DateAxis) para el encabezado
|
||||
var xAxisHeader = chartHeader.xAxes.push(new am4charts.DateAxis());
|
||||
//xAxisHeader.baseInterval = { timeUnit: "hour", count: 1 };
|
||||
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 }; // Cambiado a "day"
|
||||
xAxisHeader.minPeriod = "day"; // Añadido
|
||||
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 };
|
||||
xAxisHeader.minPeriod = "day";
|
||||
xAxisHeader.min = minDate.getTime();
|
||||
xAxisHeader.max = maxDate.getTime();
|
||||
xAxisHeader.renderer.opposite = false; // Cambiado a false
|
||||
xAxisHeader.renderer.opposite = false;
|
||||
xAxisHeader.renderer.minGridDistance = 1; // Ajusta según sea necesario para evitar superposición
|
||||
xAxisHeader.renderer.minorGridEnabled = false;
|
||||
xAxisHeader.markUnitChange = false;
|
||||
xAxisHeader.markUnitChange = false;
|
||||
|
||||
|
||||
// Configurar las líneas de cuadrícula
|
||||
@@ -880,11 +843,26 @@
|
||||
xAxisHeader.renderer.labels.template.fontWeight = "bold";
|
||||
|
||||
// Formatear las etiquetas de fecha
|
||||
xAxisHeader.dateFormatter.dateFormat = "dd/MM";
|
||||
//xAxisHeader.dateFormats.setKey("day", "dd/MM"); // Añadido
|
||||
xAxisHeader.periodChangeDateFormats.setKey("day", "dd/MM"); // Asegurado
|
||||
xAxisHeader.periodChangeDateFormats.setKey("month", "MMMM"); // Opcional, si deseas mostrar meses
|
||||
xAxisHeader.dateFormatter.dateFormat = "dd";
|
||||
xAxisHeader.markUnitChange = false;
|
||||
xAxisHeader.periodChangeDateFormats.setKey("day", "dd");
|
||||
xAxisHeader.periodChangeDateFormats.setKey("month", "dd");
|
||||
xAxisHeader.periodChangeDateFormats.setKey("year", "dd");
|
||||
|
||||
// Personalizar las etiquetas del eje X
|
||||
xAxisHeader.renderer.labels.template.adapter.add("text", function (text, target) {
|
||||
if (target.dataItem && target.dataItem.date) {
|
||||
var date = target.dataItem.date;
|
||||
var numberFormatter = new am4core.NumberFormatter();
|
||||
return numberFormatter.format(date.getDate(), "00");
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
// Desactivar marcas y rellenos de cambio de periodo
|
||||
xAxisHeader.renderer.ticks.template.disabled = true;
|
||||
xAxisHeader.renderer.axisFills.template.disabled = true;
|
||||
|
||||
|
||||
// Crear eje Y (ValueAxis) para el encabezado (dummy)
|
||||
@@ -893,18 +871,18 @@
|
||||
yAxisHeader.renderer.grid.template.disabled = true;
|
||||
|
||||
// Asignar datos al gráfico del encabezado
|
||||
// Creamos datos dummy con fechas mínimas y máximas
|
||||
// Creamos datos con fechas mínimas y máximas
|
||||
chartHeader.data = [
|
||||
{ date: minDate, value: 0 },
|
||||
{ date: maxDate, value: 0 }
|
||||
];
|
||||
|
||||
// Añadir una serie dummy para que el eje X se renderice correctamente
|
||||
// Añadir una serie para que el eje X se renderice correctamente
|
||||
var seriesHeader = chartHeader.series.push(new am4charts.LineSeries());
|
||||
seriesHeader.dataFields.dateX = "date";
|
||||
seriesHeader.dataFields.valueY = "value";
|
||||
seriesHeader.strokeOpacity = 0; // Hacemos la línea invisible
|
||||
seriesHeader.fillOpacity = 0;
|
||||
seriesHeader.strokeOpacity = 1; // Hacemos la línea invisible
|
||||
seriesHeader.fillOpacity = 1;
|
||||
|
||||
// Crear instancia del gráfico principal (cuerpo)
|
||||
chartBody = am4core.create("chart-body", am4charts.XYChart);
|
||||
@@ -925,9 +903,9 @@
|
||||
|
||||
|
||||
// Configurar el cursor para permitir interacción solo en el eje X
|
||||
chartBody.cursor = new am4charts.XYCursor();
|
||||
chartBody.cursor.behavior = "zoomX"; // O "panX" si solo deseas desplazamiento horizontal
|
||||
chartBody.cursor.lineY.disabled = true; // Deshabilita la línea vertical del cursor
|
||||
chartBody.cursor = new am4charts.XYCursor();
|
||||
chartBody.cursor.behavior = "zoomX"; // O "panX" si solo deseas desplazamiento horizontal
|
||||
chartBody.cursor.lineY.disabled = true; // Deshabilita la línea vertical del cursor
|
||||
|
||||
|
||||
// Definir cellSize para el tamaño fijo de cada categoría en el eje Y
|
||||
@@ -959,8 +937,9 @@
|
||||
|
||||
// Deshabilitar las etiquetas y grids del eje X en el gráfico principal
|
||||
xAxisBody.renderer.labels.template.disabled = true;
|
||||
xAxisBody.renderer.grid.template.disabled = true;
|
||||
|
||||
// visibilzar grid
|
||||
xAxisBody.renderer.grid.template.disabled = false;
|
||||
xAxisBody.renderer.labels.template.forceShow = true;
|
||||
|
||||
|
||||
// Añadir la serie al gráfico principal
|
||||
@@ -969,12 +948,13 @@
|
||||
seriesBody.dataFields.dateX = "toDate";
|
||||
seriesBody.dataFields.categoryY = "category";
|
||||
|
||||
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nDURACIÓN: {fromDate} - {toDate}";
|
||||
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nCLIENTE: {cliente}\nDURACIÓN: {fromDate} - {toDate}";
|
||||
seriesBody.columns.template.strokeOpacity = 0;
|
||||
|
||||
// Asignar colores a las columnas basado en el campo 'color' de los datos
|
||||
seriesBody.columns.template.propertyFields.fill = "color";
|
||||
seriesBody.columns.template.propertyFields.stroke = "color";
|
||||
|
||||
|
||||
var labelBullet = seriesBody.bullets.push(new am4charts.LabelBullet());
|
||||
labelBullet.label.text = "{contrato}";
|
||||
@@ -1015,10 +995,23 @@
|
||||
yAxisBody.zoom({ start: 0, end: 1 });
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Animaciones al cargar
|
||||
seriesBody.appear();
|
||||
chartBody.appear(1000, 100);
|
||||
|
||||
|
||||
chartBody.events.on("datavalidated", function () {
|
||||
//chartHeader.paddingLeft = yAxisBody.renderer.pixelWidth;
|
||||
chartHeader.paddingLeft = 50;
|
||||
//alert(chartBody.yAxes.getIndex(0).renderer.pixelWidth);
|
||||
chartHeader.validateLayout();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cargaDiagramaGrant(data, categorias, TipoVista) {
|
||||
@@ -1244,195 +1237,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
<%--function cargaDiagramaGrant(data, categorias, TipoVista) {
|
||||
|
||||
am5.ready(function () {
|
||||
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
|
||||
root.container.children.clear();
|
||||
|
||||
root.dateFormatter.setAll({
|
||||
dateFormat: "dd/MM/yyyy HH:mm",
|
||||
dateFields: ["valueX", "openValueX"]
|
||||
});
|
||||
|
||||
root.locale = am5locales_es_ES;
|
||||
|
||||
// Set themes
|
||||
// https://www.amcharts.com/docs/v5/concepts/themes/
|
||||
root.setThemes([
|
||||
am5themes_Animated.new(root)
|
||||
]);
|
||||
|
||||
// Create chart
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/
|
||||
var chart = root.container.children.push(am5xy.XYChart.new(root, {
|
||||
panX: false,
|
||||
panY: false,
|
||||
wheelX: "none",
|
||||
wheelY: "none",
|
||||
layout: root.verticalLayout,
|
||||
paddingLeft: 0
|
||||
}));
|
||||
|
||||
// Add legend
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/
|
||||
var legend = chart.children.push(am5.Legend.new(root, {
|
||||
centerX: am5.p50,
|
||||
x: am5.p50
|
||||
}))
|
||||
|
||||
var colors = chart.get("colors");
|
||||
|
||||
// Create axes
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
|
||||
var yAxis = chart.yAxes.push(
|
||||
am5xy.CategoryAxis.new(root, {
|
||||
categoryField: "category",
|
||||
renderer: am5xy.AxisRendererY.new(root, {
|
||||
inversed: true,
|
||||
minorGridEnabled: true
|
||||
}),
|
||||
tooltip: am5.Tooltip.new(root, {
|
||||
themeTags: ["axis"],
|
||||
animationDuration: 200
|
||||
})
|
||||
})
|
||||
);
|
||||
|
||||
yAxis.data.setAll(categorias);
|
||||
|
||||
// Obtener valores de las cajas de texto
|
||||
var fechaI = document.getElementById('<%= txtFechaI.ClientID %>').value;
|
||||
var fechaF = document.getElementById('<%= txtFechaF.ClientID %>').value;
|
||||
|
||||
// Convertir valores a objetos Date
|
||||
var minDate = new Date(fechaI.split("/").reverse().join("-"));
|
||||
var maxDate = new Date(fechaF.split("/").reverse().join("-"));
|
||||
|
||||
|
||||
var xAxis = chart.xAxes.push(
|
||||
am5xy.DateAxis.new(root, {
|
||||
baseInterval: { timeUnit: "day", count: 1 },
|
||||
renderer: am5xy.AxisRendererX.new(root, {
|
||||
opposite: true,
|
||||
minorGridEnabled: true,
|
||||
minGridDistance: 30 // Ajusta según sea necesario
|
||||
}),
|
||||
min: minDate.getTime(),
|
||||
max: maxDate.getTime(),
|
||||
groupData: false,
|
||||
markUnitChange: false
|
||||
})
|
||||
);
|
||||
|
||||
// Asegurar que todas las etiquetas se muestren
|
||||
xAxis.get("renderer").labels.template.setAll({
|
||||
forceHidden: false,
|
||||
minPosition: 0.001,
|
||||
maxPosition: 0.999,
|
||||
location: 0.5 // Centra las etiquetas
|
||||
});
|
||||
|
||||
|
||||
// Formatear las etiquetas de fecha
|
||||
xAxis.get("renderer").labels.template.adapters.add("text", function (text, target) {
|
||||
var dataItem = target.dataItem;
|
||||
if (dataItem) {
|
||||
var value = dataItem.get('value');
|
||||
var date = new Date(value);
|
||||
var day = date.getDate().toString().padStart(2, '0');
|
||||
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||
return day + '/' + month;
|
||||
} else {
|
||||
return text; // O puedes devolver una cadena vacía: return '';
|
||||
}
|
||||
});
|
||||
|
||||
//chart.topAxesContainer.children.push(dateAxis);
|
||||
|
||||
// Add series
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
|
||||
var series = chart.series.push(am5xy.ColumnSeries.new(root, {
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
openValueXField: "fromDate",
|
||||
valueXField: "toDate",
|
||||
categoryYField: "category",
|
||||
sequencedInterpolation: true
|
||||
}));
|
||||
|
||||
|
||||
series.columns.template.setAll({
|
||||
templateField: "columnSettings",
|
||||
strokeOpacity: 0,
|
||||
tooltipText: "UNIDAD: {category}-{unidad} \nCONTRATO: {contrato} \nDURACIÓN: {openValueX} - {valueX}"
|
||||
});
|
||||
|
||||
series.data.processor = am5.DataProcessor.new(root, {
|
||||
dateFields: ["fromDate", "toDate"],
|
||||
dateFormat: "yyyy-MM-dd HH:mm"
|
||||
});
|
||||
series.data.setAll(data);
|
||||
|
||||
|
||||
// Scrollbar X
|
||||
var scrollbarX = am5.Scrollbar.new(root, {
|
||||
orientation: "horizontal"
|
||||
});
|
||||
|
||||
var scrollbarY = am5.Scrollbar.new(root, {
|
||||
orientation: "vertical"
|
||||
});
|
||||
|
||||
chart.set("scrollbarX", scrollbarX);
|
||||
chart.bottomAxesContainer.children.push(scrollbarX);
|
||||
|
||||
chart.set("scrollbarY", scrollbarY);
|
||||
|
||||
|
||||
//MOSTRAR MODAL DE CONTRATO AL HACER CLICK
|
||||
series.columns.template.events.on("click", e => {
|
||||
let cveContrato = e.target.dataItem.dataContext.cveContrato;
|
||||
|
||||
$('#<%=HdnCveContrato.ClientID%>').val(cveContrato);
|
||||
|
||||
let url = '/Ashx/CargaEventos.ashx?METODO=contrato_transportes';
|
||||
let parametros = '&cveContrato=' + cveContrato + '&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E=' + '<%= UsuarioActual.CveEmpresa %>' + '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val(); + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
|
||||
|
||||
fetch(url + parametros).then(response => response.json()).then(json => {
|
||||
updateEvent(json[0], null, false);
|
||||
}).catch(err => console.log('Solicitud fallida', err));
|
||||
});
|
||||
|
||||
series.events.on("datavalidated", function (ev) {
|
||||
let cellSize = 45;
|
||||
|
||||
if (TipoVista == 1) {
|
||||
cellSize = 60;
|
||||
}
|
||||
//let series = ev.target;
|
||||
//let chart = series.chart;
|
||||
let xAxis = chart.xAxes.getIndex(0);
|
||||
|
||||
// Calculate how we need to adjust chart height
|
||||
let chartHeight = categorias.length * cellSize + xAxis.height() + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0);
|
||||
|
||||
// Set it on chart's container
|
||||
chart.root.dom.style.height = chartHeight + "px";
|
||||
|
||||
// ev.target.get("xAxis").zoomToValues(new Date(2024,6,15).getTime(), new Date(2024,6,20).getTime());
|
||||
});
|
||||
|
||||
// Make stuff animate on load
|
||||
// https://www.amcharts.com/docs/v5/concepts/animations/
|
||||
series.appear();
|
||||
chart.appear(1000, 100);
|
||||
|
||||
|
||||
}); // end am5.ready()
|
||||
}--%>
|
||||
|
||||
|
||||
|
||||
var PrimeraCargaCalendario = true;
|
||||
@@ -1459,73 +1263,10 @@
|
||||
|
||||
function updateEvent(event, element, esCalendario = true) {
|
||||
|
||||
$('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros);
|
||||
$('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato);
|
||||
$('#<%=TxtObservaciones.ClientID%>').val(event.Observaciones);
|
||||
$('#<%=TxtDescripcion.ClientID%>').val(event.description);
|
||||
$('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento);
|
||||
|
||||
if (esCalendario) {
|
||||
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i));
|
||||
} else {
|
||||
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start));
|
||||
}
|
||||
$('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal));
|
||||
$('#<%=DdlClientes.ClientID%>').val(event.CveCliente);
|
||||
|
||||
$('#<%=DdlChofer.ClientID%>').val(event.CvePersonal);
|
||||
|
||||
if (event.CvePersonal2 > 0) {
|
||||
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', true);
|
||||
setTimeout(function () { $('#<%=DdlChofer2.ClientID%>').val(event.CvePersonal2).change(); }, 500);;
|
||||
;
|
||||
} else {
|
||||
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', false);
|
||||
$('#<%=DdlChofer2.ClientID%>').val(-1);
|
||||
}
|
||||
|
||||
$('#<%=DdlEstatusContrato.ClientID%>').val(event.CveEventoEstatus);
|
||||
$('#<%=TxtDolares.ClientID%>').val(event.Dolares);
|
||||
$('#<%=TxtPesos.ClientID%>').val(event.Pesos);
|
||||
$('#<%=TxtMoneda.ClientID%>').val(event.Moneda);
|
||||
|
||||
|
||||
|
||||
$('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo);
|
||||
$('#<%=HdnCveContrato.ClientID%>').val(event.id);
|
||||
$('#<%=DdlTipoAF.ClientID%>').val(event.CveTipoAF);
|
||||
$('#<%=DdlSubProyectoModal.ClientID%>').val(event.CveSubProyecto);
|
||||
|
||||
$('#<%= HidCveTipoAF.ClientID%>').val($('#<%=TxtAnticipo.ClientID%>').val());
|
||||
|
||||
<%--$('#<%=BtnDdlTipoAF.ClientID%>').click();--%>
|
||||
<%--$('#<%=DdlAF.ClientID%>').val(event.CveActivoFijo);--%>
|
||||
|
||||
$('#HidNumChoferes').val(event.NumChoferes);
|
||||
|
||||
$('#HidRemisionSerieFolio').val(event.RemisionSerieFolio);
|
||||
$('#HidCveVentaRemision').val(event.CveVentaRemision);
|
||||
$('#HidRemisionSaldo').val(event.RemisionSaldo);
|
||||
$('#HdnNumContrato').val(event.NumeroContrato);
|
||||
|
||||
if (event.CveActivoFijo > 0) {
|
||||
$('#HidCveAF').val(event.CveActivoFijo);
|
||||
} else {
|
||||
$('#HidCveAF').val('-1');
|
||||
}
|
||||
|
||||
|
||||
if (event.NombreComercial !== null) {
|
||||
$('#HidModClienteNombre').val('');
|
||||
} else {
|
||||
$('#HidModClienteNombre').val(event.NombreComercial);
|
||||
}
|
||||
|
||||
$('#HidModCveCliente').val(event.CveCliente);
|
||||
|
||||
$('#<%=HdnCveContrato.ClientID%>').click();
|
||||
|
||||
$('#<%=BtnModal.ClientID%>').click();
|
||||
$('#BtnCargaContratoCalendario').click();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,8 @@ Partial Class RepContratosCalendario
|
||||
strData.AppendLine($"color: am4core.color('" & String.Format("#{0:X6}", random.Next(16777216)) & "'),")
|
||||
strData.AppendLine($"cveContrato: {Row("CveContrato").ToString.ToEntero},")
|
||||
strData.AppendLine($"contrato: '{Row("NumeroContrato").ToString}',")
|
||||
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}'")
|
||||
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}',")
|
||||
strData.AppendLine($"cliente: '{Row("NombreComercial").ToString.Replace("'", "")}'")
|
||||
strData.AppendLine("},")
|
||||
|
||||
|
||||
@@ -564,6 +565,82 @@ Partial Class RepContratosCalendario
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCargaContratoCalendario_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim CveContratoConsulta As Integer = HdnCveContrato.Value.ToEntero
|
||||
|
||||
If CveContratoConsulta > 0 Then
|
||||
Dim Objcontrato As New ClsContratos
|
||||
If Objcontrato.GetContratos(CveContratoConsulta, UsuarioActual.CveEmpresa) AndAlso Objcontrato.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
Dim DRow As DataRow
|
||||
DRow = Objcontrato.DtResultados.Rows(0)
|
||||
'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim NumChoferes As Integer = DRow("NumChoferes").ToString.ToEntero
|
||||
|
||||
TxtFolio.Text = DRow("NumeroContrato").ToString
|
||||
TxtCantidadPasajeros.Text = DRow("CantidadPasajeros").ToString
|
||||
DdlClientes.SelectedValue = DRow("CveCliente").ToString
|
||||
DdlClientes.SelectedText = DRow("NombreComercial").ToString
|
||||
TxtDescripcion.Text = DRow("DescripcionContrato").ToString
|
||||
TxtObservaciones.Text = DRow("Observaciones").ToString
|
||||
TxtUbicacion.Text = DRow("Ubicacion").ToString
|
||||
TxtFechaSalida.Text = Convert.ToDateTime(DRow("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss")
|
||||
TxtFechaRegreso.Text = Convert.ToDateTime(DRow("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ")
|
||||
TxtMoneda.Text = DRow("Moneda").ToString
|
||||
'Requeridos
|
||||
|
||||
DdlChofer.SelectedValueExist(DRow("CveChofer").ToString)
|
||||
DdlChofer2.SelectedValueExist(DRow("CveChofer2").ToString)
|
||||
chkSegundoChofer.Checked = If(NumChoferes = 2, True, False)
|
||||
|
||||
DdlEstatusContrato.SelectedValueExist(DRow("CveContratosEstatus").ToString)
|
||||
DdlSubProyectoModal.SelectedValueExist(DRow("CveSubProyecto").ToString)
|
||||
|
||||
DdlTipoAF.SelectedValueExist(DRow("CveTipoAF").ToString)
|
||||
DdlTipoAF_SelectedIndexChanged(Nothing, Nothing)
|
||||
|
||||
DdlAF.SelectedValueExist(DRow("CveAF").ToString)
|
||||
|
||||
HidCveAF.Value = "-1"
|
||||
HidCveAFDes.Value = ""
|
||||
If DRow("CveAF").ToString.ToEntero > 0 Then
|
||||
HidCveAF.Value = DRow("CveAF").ToString.ToString
|
||||
HidCveAFDes.Value = DdlAF.SelectedItem.Text
|
||||
End If
|
||||
TxtMotivoCambioUnidad.Text = ""
|
||||
DVMotivoCambioAF.Visible = False
|
||||
|
||||
|
||||
HypRemision.Text = DRow("RemisionSerieFolio").ToString
|
||||
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={DRow("CveVentaRemision").ToString}"
|
||||
|
||||
If DRow("RemisionSaldo").ToString.ToDecimal > 0 Then
|
||||
LblSaldo.Text = $"Saldo {DRow("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
|
||||
Else
|
||||
LblSaldo.Text = ""
|
||||
End If
|
||||
|
||||
CveContrato = CveContratoConsulta
|
||||
OcultarMostrarSegundoChofer()
|
||||
|
||||
UpCommando.Update()
|
||||
UpModal.Update()
|
||||
RegistraScript("$('#ModalActualizar').modal('show');")
|
||||
|
||||
End If
|
||||
Objcontrato.Dispose()
|
||||
Else
|
||||
Alert("Contrato no especificado", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -597,11 +674,11 @@ Partial Class RepContratosCalendario
|
||||
End If
|
||||
End If
|
||||
|
||||
If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
|
||||
If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
'If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
|
||||
' If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
|
||||
' TieneError = True
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero,
|
||||
-1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34,
|
||||
@@ -718,6 +795,7 @@ Partial Class RepContratosCalendario
|
||||
UpModal.Update()
|
||||
myModalLabel.InnerText = "Contrato: " & HdnNumContrato.Value
|
||||
RegistraScript("$('#ModalActualizar').modal('show');")
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub chkSegundoChofer_CheckedChanged(sender As Object, e As EventArgs)
|
||||
@@ -857,4 +935,6 @@ Partial Class RepContratosCalendario
|
||||
CargaCronograma(DdlTipoVistaCalendario.SelectedValue.ToEntero)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -78,8 +78,7 @@
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Fin:
|
||||
|
||||
Fecha Fin:
|
||||
</div>
|
||||
<div class="col-md-1" style="min-width: 115px">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
@@ -165,6 +164,11 @@
|
||||
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Comisiones" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="90px">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlComisiones" runat="server" Text='<%# Eval("ComisionMedico", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Gasto" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="90px">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlGasto" runat="server" Text='<%# Eval("Gasto", "{0:N2}") %>'></asp:Literal>
|
||||
|
||||
@@ -479,10 +479,8 @@ Partial Class ProductosyServicios
|
||||
DdlEcommerceClasificacion.DataBind()
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(267) = "1" Then
|
||||
DVCodigoPSAlterno.Visible = True
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -1159,12 +1157,9 @@ Partial Class ProductosyServicios
|
||||
ChkFechaIndeterminadaRSCO.Checked = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
TxtCodigoAlterno.Text = ObjProductosServicios.DtResultados.Rows(0)("CodigoAlterno").ToString
|
||||
TxtPSAlterno.Text = ObjProductosServicios.DtResultados.Rows(0)("PSAlterno").ToString
|
||||
DVCodigoPSAlterno.Visible = True
|
||||
|
||||
End If
|
||||
TxtCodigoAlterno.Text = ObjProductosServicios.DtResultados.Rows(0)("CodigoAlterno").ToString
|
||||
TxtPSAlterno.Text = ObjProductosServicios.DtResultados.Rows(0)("PSAlterno").ToString
|
||||
DVCodigoPSAlterno.Visible = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
DivPSExhibicion.Visible = True
|
||||
|
||||
@@ -807,6 +807,13 @@ Partial Class Ventas
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property ClienteUsaProductoAlterno As Boolean
|
||||
Get
|
||||
Return CType(IfNull(ViewState("ClienteUsaProductoAlterno"), "false").ToString(), Boolean)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
'Cliente
|
||||
Private ReadOnly Property NombreCliente As String
|
||||
Get
|
||||
@@ -6986,6 +6993,7 @@ Partial Class Ventas
|
||||
LtlClienteMsg.Text += "<br/>Cálculo sin desglose de IVA"
|
||||
End If
|
||||
ViewState("CargoUsado") = ObjCliente.CargoUsados
|
||||
ViewState("ClienteUsaProductoAlterno") = ObjCliente.UsaProductoAlterno
|
||||
|
||||
Dim dr As DataRow = Nothing
|
||||
dr = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal = 1 And Estatus = 'Activo' ")
|
||||
@@ -11444,14 +11452,14 @@ Partial Class Ventas
|
||||
For Each dRow As DataRow In TmpDT.Rows
|
||||
ListMateriales.Add(New GenericaCantidadProducto With {.Cantidad = dRow("Cantidad").ToString.ToEntero, .Producto = dRow("PS").ToString})
|
||||
Next
|
||||
EnviaNotificacionSMS(3, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", ListMateriales, CorreoDestino)
|
||||
EnviaNotificacionSMS(3, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), RBLTipoVenta.SelectedItem.Text, DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, LblTipoVenta.Text, DdlVendedor.SelectedItem.Text, "", ListMateriales, CorreoDestino)
|
||||
Else
|
||||
EnviaNotificacionSMS(4, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino)
|
||||
EnviaNotificacionSMS(4, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), RBLTipoVenta.SelectedItem.Text, DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, LblTipoVenta.Text, DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino)
|
||||
End If
|
||||
'cirugía en el mismo día o si es despues de las 9 y requiere técnico, 'jefe de técnicos
|
||||
If TxtFechaOS.Text.ToDate.ToShortDateString = NowADS.ToShortDateString OrElse (NowADS.Hour > 21 And NowADS.AddDays(1).ToShortDateString = TxtFechaOS.Text.ToDate.ToShortDateString AndAlso ChkRequiereTecnicoModal.Checked) Then
|
||||
CorreoDestino = UsuarioActual.Empresa.Funcionalidad(199).ListaBusquedaValor("JefeTécnicos")
|
||||
EnviaNotificacionSMS(5, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, "", DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino)
|
||||
EnviaNotificacionSMS(5, UsuarioActual.Empresa, CveVenta, TxtFolio.Text, TxtFechaOS.Text.ToDateTime, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedItem.Text, LblCliente.Text), RBLTipoVenta.SelectedItem.Text, DdlMedico.SelectedItem.Text, DdlProcedimiento.SelectedItem.Text, LblTipoVenta.Text, DdlVendedor.SelectedItem.Text, "", Nothing, CorreoDestino)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -13651,13 +13659,13 @@ Partial Class Ventas
|
||||
Dim totRetIVA As Decimal = Obj.RetIVA
|
||||
Dim totRetISR As Decimal = Obj.RetISR
|
||||
Dim i As Integer = 1
|
||||
Dim tPS As String
|
||||
Dim tPS, tCodigo As String
|
||||
'detalles
|
||||
For Each drr As DataRow In Obj.DtDetalle.Rows
|
||||
If drr("PS").ToString().Length = 1 Then
|
||||
If drr("PS").ToString.Length = 1 Then
|
||||
tPS = drr("Obs").ToString()
|
||||
Else
|
||||
If drr("PS").ToString().Length = 0 Then
|
||||
If drr("PS").ToString.Length = 0 Then
|
||||
tPS = ""
|
||||
Else
|
||||
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
|
||||
@@ -13665,6 +13673,12 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
tPS = tPS.Replace("|", " ")
|
||||
tCodigo = drr("Noidentificacion").ToString()
|
||||
|
||||
If ClienteUsaProductoAlterno AndAlso drr("CodigoAlterno").ToString <> "" Then
|
||||
tPS = drr("PSAlterno").ToString()
|
||||
tCodigo = drr("CodigoAlterno").ToString()
|
||||
End If
|
||||
|
||||
If tPS.Length >= 1000 Then
|
||||
Dim tPSRecortado As String = tPS.Remove(999, tPS.Length - 999)
|
||||
@@ -13682,7 +13696,7 @@ Partial Class Ventas
|
||||
.Unidad = drr("UM").ToString(),
|
||||
.ClaveUnidad = drr("SATClaveUM").ToString(),
|
||||
.ClaveProdServ = drr("SATClaveProdServ").ToString(),
|
||||
.Noidentificacion = drr("Noidentificacion").ToString(),
|
||||
.Noidentificacion = tCodigo,
|
||||
.CuentaPredial = drr("CuentaPredial").ToString(),
|
||||
.ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal,
|
||||
.ObjetoImpuesto = drr("CodigoObjetoImpuesto").ToString(),
|
||||
@@ -17474,10 +17488,12 @@ Partial Class Ventas
|
||||
Case "3", "295"
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
|
||||
importeMN = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = importeMovimiento
|
||||
Pago.ImportePagoVenta = importeMN
|
||||
Pago.ImportePago = importeMovimiento
|
||||
Pago.CveIE = CveIEAnticipo
|
||||
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
|
||||
@@ -17487,6 +17503,7 @@ Partial Class Ventas
|
||||
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
|
||||
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
|
||||
Pago.Referencia = gvr.DataKey("Folio")
|
||||
Pago.AplicaConceptoImpuestoPendiente = (Not gvr.DataKey("RegresarImpuesto") = "1") AndAlso (VentaActual.IVA > 0 OrElse VentaActual.IEPS > 0)
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
|
||||
@@ -17608,7 +17625,7 @@ Partial Class Ventas
|
||||
ObjConta.Commit()
|
||||
BtnAceptarAnticipos.Enabled = False
|
||||
|
||||
Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
|
||||
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
|
||||
End If
|
||||
|
||||
ObjConta.Dispose()
|
||||
@@ -21126,7 +21143,7 @@ Partial Class Ventas
|
||||
'Puede facturar
|
||||
If Not UsuarioActual.TienePermisoProceso(60) Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
||||
If Not UsuarioActual.TienePermisoProceso(399) Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
||||
If Not UsuarioActual.TienePermisoProceso(175) Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
|
||||
End If
|
||||
@@ -21134,6 +21151,10 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
|
||||
End If
|
||||
End If
|
||||
'Puede anticipos
|
||||
If UsuarioActual.TienePermisoProceso(399) Then
|
||||
If DdlTipoComprobante.Items.FindByValue("Ant") Is Nothing Then DdlTipoComprobante.Items.Add(New ListItem("Anticipo", "Ant"))
|
||||
End If
|
||||
|
||||
'Puede remisionar
|
||||
If Not UsuarioActual.TienePermisoProceso(199) Then
|
||||
|
||||
Reference in New Issue
Block a user