This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-08-16 09:14:51 -07:00
19 changed files with 1161 additions and 525 deletions

View File

@@ -1539,6 +1539,26 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function DesAplicarPago(CvePrePoliza As Integer, CveConcepto As Integer, CveVenta As Integer, CveVentaAmortizacion As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_DesAplicarMovimiento")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConcepto
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveVentaAmortizacion", SqlDbType.Int).Value = CveVentaAmortizacion
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al desaplicar pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function GetEncabezadoPrePoliza(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False

View File

@@ -9388,15 +9388,19 @@ Public Class ClsPaginas
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim tFecha As Date = Pago.Fecha
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
'FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
TCValuacion = UltimaFluctuacion.TCFluctuacion
If CompraActual.CveMoneda <> 1 OrElse Pago.CveMonedaPago <> 1 Then
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
'FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
TCValuacion = UltimaFluctuacion.TCFluctuacion
End If
End If
End If
If CompraActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares
tImportePago = ((Pago.ImportePago * TCValuacion / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL
ElseIf CompraActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares
@@ -9425,7 +9429,7 @@ Public Class ClsPaginas
ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL
If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaIVA
Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=CompraActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
@@ -9451,7 +9455,7 @@ Public Class ClsPaginas
ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL
If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetIVA
Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaRetIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
@@ -9467,7 +9471,7 @@ Public Class ClsPaginas
ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL
If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetISR
Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaRetISR
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
@@ -9483,7 +9487,7 @@ Public Class ClsPaginas
ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL
If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New CompraRetenciones
Dim Ret As New ConceptosRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(26, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
@@ -9590,9 +9594,9 @@ Public Class ClsPaginas
Public Property IdCtaContableProv As Integer
Public Property IdCtaContableProvComplementaria As Integer
Public ReadOnly Property ConceptoPrePolizaIVA As CompraRetenciones
Public ReadOnly Property ConceptoPrePolizaIVA As ConceptosRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Ret As New ConceptosRetenciones
If EsImportacion Then
Ret.CveConceptoAcreditable = 288
Ret.CveConceptoxAcreditar = 287
@@ -9618,9 +9622,9 @@ Public Class ClsPaginas
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetIVA As CompraRetenciones
Public ReadOnly Property ConceptoPrePolizaRetIVA As ConceptosRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Ret As New ConceptosRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetIVA = 1 Then
Funcionalidad = 308
@@ -9670,9 +9674,9 @@ Public Class ClsPaginas
Return Ret
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetISR As CompraRetenciones
Public ReadOnly Property ConceptoPrePolizaRetISR As ConceptosRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Ret As New ConceptosRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetISR = 1 Then
Funcionalidad = 316
@@ -9714,7 +9718,7 @@ Public Class ClsPaginas
End Class
Public Class CompraRetenciones
Public Class ConceptosRetenciones
Public Property CveConceptoxAcreditar As Integer
Public Property CveConceptoAcreditable As Integer
Public Property IdCtaContablexAcreditar As Integer
@@ -9727,5 +9731,290 @@ Public Class ClsPaginas
#End Region
#Region "P A G O D E V E N T A S "
Public Function AplicaPrePolizaPagoVenta(VentaActual As Venta, Pago As VentaPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
Dim ErrorMovtos As Boolean = False
Dim PorcentajePago As Decimal = Pago.ImportePago / VentaActual.Total
Dim ImporteMovimiento As Decimal = 0
Dim ImporteMN As Decimal = 0
Dim ImporteME As Decimal = 0
Dim TCValuacion As Decimal
Dim TCValuacionVenta As Decimal = VentaActual.TC
Dim TCValuacionPago As Decimal = Pago.TCPago
Dim tFechaUltimaFluctuacion As Date
Dim tImportePago, tImporteVenta As Decimal
Dim CveConceptoContableComplementaria As Integer = 207
Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 2, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 2
If VentaActual.CveMoneda <> 1 Then Pago.CveConceptoPago = 292
Dim Concepto As String = String.Format("{0} F:{1}", VentaActual.ClienteNombre, VentaActual.SerieFolio)
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim tFecha As Date = Pago.Fecha
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
tFechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
TCValuacion = UltimaFluctuacion.TCFluctuacion
End If
If VentaActual.Fecha < tFechaUltimaFluctuacion Then TCValuacionVenta = TCValuacion
If Pago.FechaDocumentoRelacionado < tFechaUltimaFluctuacion Then TCValuacionPago = TCValuacion
End If
If VentaActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares
tImportePago = ((Pago.ImportePago * TCValuacionVenta / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL
ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares
tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL
tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL
ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago = 1 Then 'factura dolares, pago en pesos
tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL
tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL
End If
If VentaActual.CveMoneda > 1 Then ImporteME = Pago.ImportePagoVenta
'movimiento de pago cliente
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, Pago.CveConceptoPago, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacion, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
'movimiento de pago cliente Complementaria
If Not ErrorMovtos AndAlso VentaActual.CveMoneda > 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, (ImporteME * TCValuacion - ImporteME).RoundSQL, CveConceptoContableComplementaria, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacion, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
End If
If Pago.AplicaTraslado 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, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) 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, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
End If
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, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) 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, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) 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, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) 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, 63, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) 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 UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(38, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
If ObjConta.GetRetCuenta(39, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
End If
If Pago.TipoPago = "A" AndAlso Not ErrorMovtos Then 'A N T I C I P O
Dim Ret As New ConceptosRetenciones
If Pago.CveMonedaPago > 1 Then
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 11, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipo, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
Else
'Agregamos Nacional
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 11, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoExtranjera, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago) Then ErrorMovtos = True
End If
End If
If Pago.TipoPago = "NC" AndAlso Not ErrorMovtos Then ' N O T A D E C R E D I T O
Dim Ret As New ConceptosRetenciones
If Pago.CveMonedaPago > 1 Then
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 91, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 203, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
Else
'Agregamos Nacional
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 91, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
End If
If Pago.TipoPago = "I" AndAlso Not ErrorMovtos Then 'I N G R E S O S X C O M P R O B A R
Dim Ret As New ConceptosRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(66, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
If Pago.CveMonedaPago > 1 AndAlso ObjConta.GetRetCuenta(207, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
End If
If Pago.CveMonedaPago > 1 Then
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 66, Pago.Referencia, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
Else
'Agregamos Nacional
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 66, Pago.Referencia, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
End If
'si tiene otros gastos/ingresos
ImporteMovimiento = Pago.OtroGastoIngreso
If Not ErrorMovtos AndAlso ImporteMovimiento <> 0 Then
Dim tOtCveCon As Integer = 211
Dim tOtTipoMovto As Boolean = False
If ImporteMovimiento < 0 Then
tOtTipoMovto = True : tOtCveCon = 78
ImporteMovimiento = Math.Abs(ImporteMovimiento)
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tOtTipoMovto, ImporteMovimiento, ImporteMovimiento, tOtCveCon, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveSubProyecto:=VentaActual.CveSubProyecto, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True
End If
If Not ErrorMovtos AndAlso VentaActual.TC <> Pago.TCPago Then
Dim ConceptoContable, IdCtaContable As Integer
Dim TipoMovimiento As Boolean
Dim Diferencia As Decimal = 0
If tImporteVenta <> tImportePago Then
If tImporteVenta > tImportePago Then
ConceptoContable = 64 : IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
TipoMovimiento = True
Else
ConceptoContable = 65 : IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
TipoMovimiento = False
End If
Diferencia = (tImporteVenta - tImportePago).Abs.RoundSQL
End If
If FuncionalidadFluctuacionImpuestos Then
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, Pago.TCPago, VentaActual.TC)
Diferencia = (Pago.ImportePago * VentaActual.TC) - (Pago.ImportePago * Pago.TCPago) 'Añadimos la diferencia de perdida en la venta
Diferencia -= ((VentaActual.IVA * PorcentajePago) * VentaActual.TC) - ((VentaActual.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
Diferencia += ((VentaActual.RetIVA * PorcentajePago) * VentaActual.TC) - ((VentaActual.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
Diferencia += ((VentaActual.RetISR * PorcentajePago) * VentaActual.TC) - ((VentaActual.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
Diferencia -= ((VentaActual.IEPS * PorcentajePago) * VentaActual.TC) - ((VentaActual.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS
Diferencia = Diferencia.Abs.RoundSQL
End If
If Diferencia <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Diferencia, Diferencia, ConceptoContable, Concepto, Concepto, IdCtaContable, CveVenta:=VentaActual.CveVenta, CveSubProyecto:=VentaActual.CveSubProyecto, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE) Then
ErrorMovtos = True
End If
End If
End If
Return ErrorMovtos
End Function
Public Class VentaPago
Public Property TipoPago As String = "B" ' B - Bancos, A - Anticipos, I - IxC, NC - Nota de crédito
Public FechaDocumentoRelacionado As Date
Public Fecha As Date
Public Property CveIE As Integer = -1
Public Property CvePersonal As Integer = -1
Public Property ImportePagoVenta As Decimal = 0
Public Property ImportePago As Decimal = 0
Public Property CveMonedaPago As Integer = 1
Public Property TCPago As Decimal = 1
Public Property CveVentaAmortizacion As Integer = 0
Public Property OtroGastoIngreso As Decimal = 0
Public Property CveConceptoPago As Integer = -1 'no definido de inicio
Public Property CveCreditoDetalle As Integer = -1
Public Property AplicaTraslado As Boolean = True
Public Property Referencia As String
End Class
Public Class Venta
Public Property CveVenta As Integer = -1
Public Property CveCliente As Integer
Public Property CveMoneda As Integer
Public Property Fecha As Date
Public Property SerieFolio As String = ""
Public Property ClienteNombre As String = ""
Public Property TC As Decimal = 1
Public Property Total As Decimal
Public Property IVA As Decimal
Public Property IEPS As Decimal
Public Property RetIVA As Decimal
Public Property RetISR As Decimal
Public Property PorcentajeIVA As Decimal
Public Property CveSubProyecto As Integer
Public Property UsuarioActual As Usuario
Public Property IdCtaContableCliente As Integer
Public Property IdCtaContableClienteComplementaria As Integer
Public Property IdCtaContableClienteAnticipo As Integer
Public Property IdCtaContableClienteAnticipoExtranjera As Integer
Public Property IdCtaContableClienteAnticipoComplementaria As Integer
End Class
#End Region
End Class

View File

@@ -3359,11 +3359,11 @@ Partial Class Bancos_IE
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
ErrorDevolucionImpuestos = True
End If
@@ -3547,23 +3547,19 @@ Partial Class Bancos_IE
PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal
Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC)
Dim CveCuentaIVAxAcreditarDevDinC = 0
Dim CveCuentaIVAAcreditableDevDinC = 0
Dim IdCtaIVAXAcreditarDevDinC As Integer
Dim IdCtaIVAAcreditableDevDinC As Integer
If DTCuentas IsNot Nothing AndAlso DTCuentas.Rows.Count > 0 Then
IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
Else
MsgError = "Sin Registros de porcentaje impuesto"
End If
'If DTCuentas IsNot Nothing AndAlso DTCuentas.Rows.Count > 0 Then
' IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
' IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
'Else
' MsgError = "Sin Registros de porcentaje impuesto"
'End If
Dim IVADevMN As Decimal = 0
Dim IEPSDevMN As Decimal = 0
Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2)
IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2)
@@ -3587,11 +3583,11 @@ Partial Class Bancos_IE
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then
IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
ErrorDevolucionImpuestos = True
End If

Binary file not shown.

View File

@@ -294,7 +294,7 @@
<asp:HiddenField runat="server" ID="HdnFechasComprasVinculadas" Value="-1" ClientIDMode="Static" />
<asp:GridView ID="GvCxP" GridLines="None" CssClass="table table-hover table-advance Widthall" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Cuentas por Pagar pendientes"
DataKeyNames="CveCompra,FechaCompra,CveProveedor,Proveedor,SerieFolio,SubTotal,IVA,RetIVA,RetISR,IEPS,Total,TipoCambio,IdCtaContProveedores,IdCtaContAcreedor,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible,CveTipoConcepto,CveSubProyecto,IVAPorPagar">
DataKeyNames="CveCompra,FechaCompra,CveProveedor,CveMoneda,Proveedor,SerieFolio,SubTotal,IVA,RetIVA,RetISR,IEPS,Total,TipoCambio,IdCtaContProveedores,IdCtaContAcreedor,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible,CveTipoConcepto,CveSubProyecto,IVAPorPagar">
<Columns>
<asp:TemplateField>
<HeaderTemplate>

View File

@@ -739,18 +739,18 @@ Partial Class Compras_ReembolsosComprobaciones
Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
End If
If MsgError = "" AndAlso Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Detalle"
If MsgError = "" Then
If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Detalle"
End If
Else
If AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then
MsgError = "Detalle"
End If
End If
If AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then
MsgError = "Detalle"
End If
End If
Dim SaldoExcedente As Decimal = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal

View File

@@ -30,6 +30,9 @@
.table table-striped table-hover dataTable no-footer {
margin-top: 0px !important;
}
.ajax__tab_xp .ajax__tab_body {
font-size: 12px !important;
}
</style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">

View File

@@ -778,6 +778,7 @@ Partial Class Compras_eFacturas
CargaGvBitacora()
CargaDatos()
MostrarSolcitudesSAT()
End If
removeasincevent()
End Sub
@@ -2976,6 +2977,18 @@ Partial Class Compras_eFacturas
End If
End Sub
Private Sub MostrarSolcitudesSAT()
LnkShowSolicitudes.Visible = False
If UsuarioActual.Empresa.ArchivoPfx.Trim.Length > 0 Then
Dim ArchivoCertificado As String = $"{UsuarioActual.Empresa.Ruta}Certificados\{UsuarioActual.Empresa.ArchivoPfx}"
If File.Exists(ArchivoCertificado) Then
LnkShowSolicitudes.Visible = True
End If
End If
End Sub
#End Region

View File

@@ -148,6 +148,7 @@
<asp:TemplateField HeaderText="Eliminar" Visible="false">
<ItemTemplate>
<asp:LinkButton ID="LnkDesAplicar" runat="server" ToolTip="DesAplicar" Visible='<%# Eval("CveConceptoContable").ToString() = "251" %>' AlternateText="Eliminar" CausesValidation="False" CommandName="DesAplicar" CssClass="btn btn-circle btn-sm blue" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
<asp:LinkButton ID="imgD" runat="server" Visible='<%# Eval("Eliminable").ToString() = "1" AndAlso Eval("CvePrePoliza").ToString.Length > 0 %>' AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>

View File

@@ -164,9 +164,6 @@ Partial Class PopUpAuxiliar
Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.BackColor = Drawing.Color.LightGray
@@ -213,6 +210,17 @@ Partial Class PopUpAuxiliar
e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
End If
If e.Row.DBCampo("CveConceptoContable").Contiene("91", "251") Then 'desaplicar NC
e.Row.FCLinkButton("LnkDesAplicar").Visible = True
e.Row.FCLinkButton("imgD").Visible = False
If e.Row.DBCampo("CveConceptoContable").Contiene("251") Then
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveVentaAmortizacion"))
Else
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVentaAmortizacion"), e.Row.DBCampo("CveVenta"))
End If
End If
If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}"
'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then
@@ -418,7 +426,6 @@ Partial Class PopUpAuxiliar
Alert(Str.ToString)
Else
ObjContabilidad.RollBack()
End If
ObjContabilidad.Dispose()
@@ -439,6 +446,43 @@ Partial Class PopUpAuxiliar
RegistraScript(" $('#DivCancelar').modal('show'); ")
End Sub
Private Sub GVAuxiliar_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GVAuxiliar.RowCommand
If e.CommandName = "DesAplicar" Then
Dim CvePrePoliza, CveVenta, CveVentaAmortizacion As Integer
Dim TieneError = False
Dim St As String() = e.CommandArgument.ToString.Split("|"c)
If St.Length > 0 Then
CvePrePoliza = St(0).ToEntero
CveVenta = St(1).ToEntero
CveVentaAmortizacion = St(2).ToEntero
End If
If CvePrePoliza > 0 Then
Dim Conta As New ClsContabilidad()
Conta.IniciaTransacSQL()
If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
TieneError = True
End If
If Not TieneError AndAlso Not Conta.DesAplicarPago(CvePrePoliza, 251, CveVenta, CveVentaAmortizacion) Then
TieneError = True
End If
If Not TieneError Then
Conta.Commit()
Alert("Pago Desaplicado.", TipoMensaje.ToastInformacion)
Else
Conta.RollBack()
Alert("Pago no fue desaplicado.", TipoMensaje.ToastError)
End If
End If
End If
End Sub
End Class

View File

@@ -426,8 +426,13 @@ Partial Class RepCxCDetalle
If UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) Then ChkAnticipos.Visible = True
End Sub
Private Function CargaDatos() As DataTable
Dim dt As DataTable = Nothing
Private Function CargaDatos() As DataSet
Dim DSRespuesta As New DataSet
Dim DTaDAtos As New DataTable
Dim DTCartera As New DataTable
Dim ObjMovtos As New ClsMovimientos()
Dim FechaI, FechaF, FechaVI, FechaVF As String
@@ -452,10 +457,20 @@ Partial Class RepCxCDetalle
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, LimiteCredito:=LimiteCredito, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero,
CveMoneda:=CveMoneda, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, AplicaAnticiposPagados:=If(ChkAnticipos.Checked, 1, 0)) Then
GvDatos.DataSource = ObjMovtos.DSResultados.Tables(0)
dt = ObjMovtos.DSResultados.Tables(0)
GvDatos.DataSource = ObjMovtos.DSResultados.Tables(0)
'DTaDAtos = ObjMovtos.DSResultados.Tables(0)
'DTaDAtos.TableName = "DTaDAtos"
DSRespuesta.Tables.Add(ObjMovtos.DSResultados.Tables(0).Copy)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
GvCartera.DataSource = ObjMovtos.DSResultados.Tables(1)
'DTCartera = ObjMovtos.DSResultados.Tables(1)
'DTCartera.TableName = "DTCartera"
DSRespuesta.Tables.Add(ObjMovtos.DSResultados.Tables(1).Copy)
End If
@@ -475,7 +490,7 @@ Partial Class RepCxCDetalle
UPDatos.Update()
UpCartera.Update()
Return dt
Return DSRespuesta
End Function
@@ -949,11 +964,36 @@ Partial Class RepCxCDetalle
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
Dim lrds As New List(Of ReportDataSource)
Dim DSDatos As DataSet = CargaDatos()
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DSDatos.Tables(0)}
lrds.Add(rds)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim rdsCartera As New ReportDataSource With {.Name = "DSCartera", .Value = DSDatos.Tables(1)}
lrds.Add(rdsCartera)
Else
Dim DTCartera As New DataTable
DTCartera.Columns.Add("Rango")
DTCartera.Columns.Add("Saldo", GetType(Decimal))
DTCartera.Columns.Add("Porcentaje", GetType(Decimal))
DTCartera.Columns.Add("Objetivo", GetType(Decimal))
Dim rdsCartera As New ReportDataSource With {.Name = "DSCartera", .Value = DTCartera}
lrds.Add(rdsCartera)
End If
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta))
If Archivo.Exists Then
ImprimirPDF(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta), CargaDatos, params, "ReporteCxCDetalle", TipoImpresion)
ImprimirPDF(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta), lrds, params, "ReporteCxCDetalle", TipoImpresion)
Else
ImprimirPDF("Empresas/Grales/Formatos/RepCxCDetalle.rdlc", CargaDatos, params, "ReporteCxCDetalle", TipoImpresion)
ImprimirPDF("Empresas/Grales/Formatos/RepCxCDetalle.rdlc", lrds, params, "ReporteCxCDetalle", TipoImpresion)
End If

View File

@@ -1202,8 +1202,435 @@
</Border>
</Style>
</Tablix>
<Tablix Name="Tablix2">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.49417cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox15">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Rango Días</Value>
<Style>
<FontSize>9pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox15</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<BottomBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</BottomBorder>
<LeftBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</LeftBorder>
<RightBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</RightBorder>
<BackgroundColor>Silver</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox19">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Importe</Value>
<Style>
<FontSize>9pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox19</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<BottomBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</BottomBorder>
<LeftBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</LeftBorder>
<RightBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</RightBorder>
<BackgroundColor>Silver</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox23">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>%</Value>
<Style>
<FontSize>9pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox23</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<BottomBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</BottomBorder>
<LeftBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</LeftBorder>
<RightBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</RightBorder>
<BackgroundColor>Silver</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox26">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Objetivo</Value>
<Style>
<FontSize>9pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox26</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<BottomBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</BottomBorder>
<LeftBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</LeftBorder>
<RightBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</RightBorder>
<BackgroundColor>Silver</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.2825cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Rango">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Rango.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=IIF(Fields!Rango.Value = "Total","Bold","Default")</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Rango</rd:DefaultName>
<Style>
<Border>
<Color>White</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Saldo1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Saldo.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=IIF(Fields!Rango.Value = "Total","Bold","Default")</FontWeight>
<Format>#,0.00;(#,0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Saldo1</rd:DefaultName>
<Style>
<Border>
<Color>White</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Porcentaje">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Porcentaje.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=IIF(Fields!Rango.Value = "Total","Bold","Default")</FontWeight>
<Format>0.00;(0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Porcentaje</rd:DefaultName>
<Style>
<Border>
<Color>White</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Objetivo">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Objetivo.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=IIF(Fields!Rango.Value = "Total","Bold","Default")</FontWeight>
<Format>#,0.00;(#,0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Objetivo</rd:DefaultName>
<Style>
<Border>
<Color>White</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Details" />
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DSCartera</DataSetName>
<Top>1.6429cm</Top>
<Height>0.77667cm</Height>
<Width>10cm</Width>
<ZIndex>1</ZIndex>
<Visibility>
<Hidden>=IIF(CountRows()&gt;0,false,true)</Hidden>
</Visibility>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>0.78933in</Height>
<Height>0.99425in</Height>
<Style />
</Body>
<Width>10.44508in</Width>
@@ -1331,7 +1758,6 @@
</Textbox>
<Line Name="Line1">
<Top>3.61032cm</Top>
<Left>0cm</Left>
<Height>0cm</Height>
<Width>26.34825cm</Width>
<ZIndex>4</ZIndex>
@@ -1373,7 +1799,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Top>0.20991cm</Top>
<Top>0.2099cm</Top>
<Left>23.83501cm</Left>
<Height>0.40039cm</Height>
<Width>2.35691cm</Width>
@@ -1405,7 +1831,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox8</rd:DefaultName>
<Top>0.20991cm</Top>
<Top>0.2099cm</Top>
<Left>0.14cm</Left>
<Height>0.40039cm</Height>
<Width>1.60042cm</Width>
@@ -1437,7 +1863,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox9</rd:DefaultName>
<Top>0.19403cm</Top>
<Top>0.19402cm</Top>
<Left>1.68433cm</Left>
<Height>0.41627cm</Height>
<Width>5.14936cm</Width>
@@ -1470,7 +1896,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox10</rd:DefaultName>
<Top>0.22225cm</Top>
<Top>0.22224cm</Top>
<Left>10.92719cm</Left>
<Height>0.40039cm</Height>
<Width>2.92333cm</Width>
@@ -1505,7 +1931,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox11</rd:DefaultName>
<Top>0.22225cm</Top>
<Top>0.22224cm</Top>
<Left>13.83641cm</Left>
<Height>0.40039cm</Height>
<Width>6.04724cm</Width>
@@ -1521,7 +1947,7 @@
</Style>
</Textbox>
<Line Name="Line2">
<Top>0.11642cm</Top>
<Top>0.11641cm</Top>
<Left>0.0635cm</Left>
<Height>0cm</Height>
<Width>26.34825cm</Width>
@@ -1549,7 +1975,7 @@
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox13</rd:DefaultName>
<Top>0.6103cm</Top>
<Top>0.61029cm</Top>
<Left>0.14cm</Left>
<Height>0.6cm</Height>
<Width>6.69369cm</Width>
@@ -1651,6 +2077,38 @@
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
<DataSet Name="DSCartera">
<Query>
<DataSourceName>DataSet</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Rango">
<DataField>Rango</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Saldo">
<DataField>Saldo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Porcentaje">
<DataField>Porcentaje</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
<Field Name="Objetivo">
<DataField>Objetivo</DataField>
<rd:TypeName>System.Double</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet</rd:DataSetName>
<rd:SchemaPath>C:\Users\Caudillo\Documents\Visual Studio 2013\WebSites\WebSite9\App_Code\DSCartera.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportParameters>
<ReportParameter Name="NombreEmpresa">

View File

@@ -27,7 +27,7 @@
</div>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" GridLines="None" DataKeyNames="CveCompuesto,Compuesto,Estatus" CssClass="table table-striped table-advance table-hover Widthall" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Compuestos Activos">
<asp:GridView ID="GvDatos" runat="server" GridLines="None" data-sort="true" DataKeyNames="CveCompuesto,Compuesto,Estatus" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Compuestos Activos">
<Columns>
<asp:BoundField DataField="Compuesto" ItemStyle-Width="20%" HeaderText="Compuesto" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="FechaIng" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="20%" HeaderText="Fecha Ing" ItemStyle-HorizontalAlign="center" />

View File

@@ -32,11 +32,11 @@ Partial Class General_CatCompuestos
CveCompuesto = -1
EsEditar = 0
dvEstatus.Visible = False
CargaDatos(-1)
CargaDatos()
End If
End Sub
Private Sub CargaDatos(CveConductor As Integer)
Private Sub CargaDatos()
Dim PS As New ClsProductosServicios
If PS.GetCompuestosActivos(UsuarioActual.CveEmpresa) Then
GvDatos.DataSource = PS.DtResultados
@@ -85,7 +85,7 @@ Partial Class General_CatCompuestos
TxtCompuesto.Text = ""
CargaDatos(-1)
CargaDatos()
UpDatos.Update()
UpBodyCompuesto.Update()
@@ -98,7 +98,7 @@ Partial Class General_CatCompuestos
Alert("El Compuesto se eliminó correctamente", TipoMensaje.MsgInformacion)
End If
PS.Dispose()
CargaDatos(-1)
CargaDatos()
UpDatos.Update()
End Sub

View File

@@ -113,21 +113,17 @@
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False"
DataKeyNames="CvePS,CveCompuesto,CveProveedorCompra,RegistroRSCO,FechaVigenciaRSCOStr,VigenciaIndeterminadaRSCO,CveUsuario"
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False"
EmptyDataText="No se Encontraron Registros" ToolTip="Listado de Unidades" CssClass="table table-striped table-advance table-hover mysmallbtn " data-sort="true" Style="width: 100%" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Clasificacion" DataField="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Compuesto" DataField="Compuesto" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Registro RSCO" DataField="RegistroRSCO" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha. Vigencia" ItemStyle-HorizontalAlign="Center" DataField="FechaVigenciaRSCOStr" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Fecha. Vigencia" ItemStyle-HorizontalAlign="Center" DataField="FechaVigenciaRSCOStr" />
<asp:BoundField HeaderText="Usuario" DataField="Usuario" />
<asp:BoundField HeaderText="Fecha Ing." ItemStyle-HorizontalAlign="Center" DataField="Fecha" ItemStyle-Width="5%" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Fecha Ing." ItemStyle-HorizontalAlign="Center" DataField="Fecha" ItemStyle-Width="5%" DataFormatString="{0:d}" />
</Columns>
</asp:GridView>

View File

@@ -462,19 +462,25 @@
</ItemTemplate>
</asp:TemplateField>
<%--25--%>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:TextBox ID="TxtLiqCol9" Width="55px" runat="server" Style="text-align: right;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<%--26--%>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:TextBox ID="TxtLiqColT" Width="55px" runat="server" Font-Bold="true" Style="text-align: right;" onkeypress="return disablekeys();"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<%--26--%>
<%--27--%>
<asp:TemplateField Visible="false" HeaderText="Anticipo" ItemStyle-Width="120px">
<ItemTemplate>
<asp:TextBox ID="TxtAmort" Width="50px" runat="server" Style="text-align: right;" ></asp:TextBox>
<asp:DropDownList ID="DdlAnti" runat="server" Width="40px" DataTextField="RazonSocial" DataValueField="CveIE"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<%--27--%>
<%--28--%>
<asp:TemplateField Visible="false" HeaderText="Anticipo2" ItemStyle-Width="120px">
<ItemTemplate>
<asp:TextBox ID="TxtAmort2" Width="50px" runat="server" Style="text-align: right;" ></asp:TextBox>
@@ -482,7 +488,7 @@
</ItemTemplate>
</asp:TemplateField>
<%--28--%>
<%--29--%>
<asp:TemplateField >
<HeaderTemplate>Auxiliar</HeaderTemplate>
<ItemTemplate>
@@ -490,7 +496,7 @@
</ItemTemplate>
</asp:TemplateField>
<%--29--%>
<%--30--%>
<asp:TemplateField >
<HeaderTemplate>Comp<br> Pago</HeaderTemplate>
<ItemTemplate>

View File

@@ -391,7 +391,8 @@ Partial Class Ventas_ClientesAbonar
GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
GvCxC.Columns(23).HeaderText = "Aduana<br/>USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
GvCxC.Columns(24).HeaderText = "Material<br/>Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
GvCxC.Columns(25).HeaderText = "Total<br/>Gastos"
GvCxC.Columns(25).HeaderText = "Semilla" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
GvCxC.Columns(26).HeaderText = "Total<br/>Gastos"
DvLiquidacion1.Visible = True
DvLiquidacion2.Visible = True
@@ -549,6 +550,7 @@ Partial Class Ventas_ClientesAbonar
e.Row.FCTextBox("TxtLiqCol6").Visible = False
e.Row.FCTextBox("TxtLiqCol7").Visible = False
e.Row.FCTextBox("TxtLiqCol8").Visible = False
e.Row.FCTextBox("TxtLiqCol9").Visible = False
e.Row.FCTextBox("TxtLiqColT").Visible = False
e.Row.FCTextBox("TxtAmort").Visible = False
e.Row.FCTextBox("TxtAmort2").Visible = False
@@ -638,6 +640,8 @@ Partial Class Ventas_ClientesAbonar
e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}")
e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}")
e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}")
e.Row.FCTextBox("TxtLiqCol9").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}")
e.Row.FCTextBox("TxtLiqColT").Attributes.Add("class", $"ClsSelLiqVentaTotal{e.Row.DBCampo("CveVenta")}")
e.Row.FCTextBox("TxtAmort").Attributes.Add("class", $"ClsSelLiqAnt")
e.Row.FCTextBox("TxtAmort2").Attributes.Add("class", $"ClsSelLiqAnt")
@@ -650,6 +654,7 @@ Partial Class Ventas_ClientesAbonar
e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
e.Row.FCTextBox("TxtLiqCol9").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
e.Row.FCTextBox("TxtAmort").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
e.Row.FCTextBox("TxtAmort2").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
@@ -1005,6 +1010,7 @@ Partial Class Ventas_ClientesAbonar
Dim ImporteLiq6 As Decimal = gvr.FCTextBox("TxtLiqCol6").Text.ToDecimal
Dim ImporteLiq7 As Decimal = gvr.FCTextBox("TxtLiqCol7").Text.ToDecimal
Dim ImporteLiq8 As Decimal = gvr.FCTextBox("TxtLiqCol8").Text.ToDecimal
Dim ImporteLiq9 As Decimal = gvr.FCTextBox("TxtLiqCol9").Text.ToDecimal
Dim CveClasificacionCol1 As Integer = 21514 'comisiones sobre venta
Dim CveClasificacionCol2 As Integer = 21916 ' manejo
@@ -1014,6 +1020,7 @@ Partial Class Ventas_ClientesAbonar
Dim CveClasificacionCol6 As Integer = 21920 ' diveros
Dim CveClasificacionCol7 As Integer = 21919 'gastos aduanales usa
Dim CveClasificacionCol8 As Integer = 21211 'material Empaque
Dim CveClasificacionCol9 As Integer = 21207 'Semilla
Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero
Dim CveConceptoLiquidacion As Integer = 51
@@ -1068,6 +1075,13 @@ Partial Class Ventas_ClientesAbonar
End If
End If
If ImporteLiq9 <> 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
MsgError = "No se pudo insertar la póliza"
Exit For
End If
End If
If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then
Dim TCP As Decimal = 0
Dim FolioPago As String = " "
@@ -2900,11 +2914,12 @@ Partial Class Ventas_ClientesAbonar
GvCxC.Columns(23).Visible = True
GvCxC.Columns(24).Visible = True
GvCxC.Columns(25).Visible = True
GvCxC.Columns(26).Visible = True 'anticipos
GvCxC.Columns(27).Visible = True 'anticipos2
GvCxC.Columns(26).Visible = True
GvCxC.Columns(27).Visible = True 'anticipos
GvCxC.Columns(28).Visible = True 'anticipos2
GvCxC.Columns(28).Visible = False
GvCxC.Columns(29).Visible = False
GvCxC.Columns(30).Visible = False
Else
@@ -2924,11 +2939,12 @@ Partial Class Ventas_ClientesAbonar
GvCxC.Columns(23).Visible = False
GvCxC.Columns(24).Visible = False
GvCxC.Columns(25).Visible = False
GvCxC.Columns(26).Visible = False 'anticipos
GvCxC.Columns(27).Visible = False 'anticipos2
GvCxC.Columns(26).Visible = False
GvCxC.Columns(27).Visible = False 'anticipos
GvCxC.Columns(28).Visible = False 'anticipos2
GvCxC.Columns(28).Visible = True
GvCxC.Columns(29).Visible = True
GvCxC.Columns(30).Visible = True
End If

View File

@@ -957,7 +957,7 @@ Partial Class Ventas_RepVentas
ObjVentas.Dispose()
DTDataos.ExportToExcel("RepCartasPorte.xls")
DTDataos.ExportToExcel("RepCartasPorte")
End Sub

View File

@@ -1388,6 +1388,15 @@ Partial Class Ventas
End Set
End Property
Private Property VentaActual As Venta
Get
Return DirectCast(ViewState("VentaActual"), Venta)
End Get
Set(value As Venta)
ViewState("VentaActual") = value
End Set
End Property
Private Property ListaAnticiposAplicados As List(Of MAnticipoRelacionado)
Get
Return If(IsNothing(ViewState("ListaAnticiposAplicados")), Nothing, CType(ViewState("ListaAnticiposAplicados"), List(Of MAnticipoRelacionado)))
@@ -5055,6 +5064,30 @@ Partial Class Ventas
TxtPedidoContrato.Enabled = False
TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString().PadLeft(6, "0"c)
VentaActual = New Venta
VentaActual.CveVenta = CveVenta
VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString
VentaActual.ClienteNombre = DbRowVenta("ClienteNombre").ToString
VentaActual.TC = DbRowVenta("TipoCambio").ToString.ToDecimal
VentaActual.Total = DbRowVenta("Total").ToString.ToDecimal
VentaActual.IVA = DbRowVenta("IVA").ToString.ToDecimal
VentaActual.IEPS = DbRowVenta("IEPS").ToString.ToDecimal
VentaActual.RetIVA = DbRowVenta("RetIVA").ToString.ToDecimal
VentaActual.RetISR = DbRowVenta("RetISR").ToString.ToDecimal
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
VentaActual.IdCtaContableCliente = IIf(VentaActual.CveMoneda = 1, ViewState("IdCtaContClientes"), ViewState("IdCtaContMonedaExtranjera")).ToString.ToEntero
VentaActual.IdCtaContableClienteComplementaria = ViewState("IdCtaContComplementaria").ToString.ToEntero
VentaActual.IdCtaContableClienteAnticipo = ViewState("IdCtaContAnticipos").ToString.ToEntero
VentaActual.IdCtaContableClienteAnticipoExtranjera = ViewState("IdCtaContAnticiposExtranjera").ToString.ToEntero
VentaActual.IdCtaContableClienteAnticipoComplementaria = ViewState("IdCtaContAnticiposComplementaria").ToString.ToEntero
HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString()
HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2)
'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString()
@@ -15497,14 +15530,14 @@ Partial Class Ventas
Dim ErrorConta As Boolean
Dim CveIEAnticipo As Integer
Dim CvePlantillaPoliza As Integer = 10
Dim PorcentajeAmortizacion As Decimal
Dim sumaAmorticaciones As Decimal = 0
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim CveCuentaContabilizacion As Integer = 1
'Dim PorcentajeAmortizacion As Decimal
'Dim sumaAmorticaciones As Decimal = 0
'Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
'Dim CveCuentaContabilizacion As Integer = 1
Dim CuentasContablesInvalidas As New StringBuilder
Dim ContaIdPoliza As Integer = 0
Dim ConceptoAmortizacion As Integer = 0
Dim UsaComplementariaClientes As Boolean = True
'Dim ConceptoAmortizacion As Integer = 0
'Dim UsaComplementariaClientes As Boolean = True
Dim SimplificaPrePoliza As Boolean = True
''[IPP] PARCHE TEMPORAL PARA ANTICIPOS DE JAM
@@ -15533,11 +15566,6 @@ Partial Class Ventas
Dim Importe91 As Decimal = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("")
IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString().ToEntero()
IdCtaIVATrasladado = Dr("IdCtaIVATrasladado").ToString().ToEntero()
End If
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then
@@ -15558,7 +15586,6 @@ Partial Class Ventas
End If
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
tipoCambioPago = 1
tipoCambioVenta = 1
@@ -15581,440 +15608,167 @@ Partial Class Ventas
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
End If
If dtConceptos IsNot Nothing Then
For Each Row As DataRow In dtConceptos.Rows
Dim importeMovimiento As Decimal = 0
Dim importeMN As Decimal = 0
Dim TC As Decimal
Dim IdCtaContable As Integer
Dim TipoMovimiento As Boolean = True
Dim Concepto As String = VentaActual.SerieFolio
Dim Referencia As String = VentaActual.SerieFolio
Dim ConceptoContable = Row("CveConcepto").ToString().ToEntero()
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString() = "True", True, False)
Dim importeMovimiento As Decimal = 0
Dim importeMX As Decimal = 0
Dim IdCtaContable As Integer = 0
Dim FechaMovimiento As Date = Now
Dim Concepto As String = ViewState("VentaFolio").ToString()
Dim Referencia As String = ViewState("VentaFolio").ToString()
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim TipoCambioGeneral As Decimal = 1
Dim PorcentajeImpuesto As Decimal = 0
Select Case gvr.DataKey("CveConceptoContable").ToString()
Case "3"
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
Select Case ConceptoContable
Case 2 'Cliente
'If CveMonedaVenta > 1 Then ConceptoContable = 292
If Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66) Then
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion
ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento
End If
importeMovimiento = importeMovimiento.RoundSQL
importeMX = importeMX.RoundSQL
TipoCambioGeneral = tipoCambioVentaValuacion
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
If CveMonedaVenta = 1 Then
IdCtaContable = IdCtaContClientes
'CveCuenta = CveCuentaClientes
Else
IdCtaContable = IdCtaContComplementaria
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then
'Conta ContPAQ
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
importeMX = importeMovimiento
IdCtaContable = IdCtaContMonedaExtranjera
End If
End If
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
ConceptoContable = 251 ' cambia para dejar el concepto 2, solamente para pago en banco
End If
Case 11 'Anticipo
If gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
'Mantenemos la integridad de la suma para el pagocliente
'SumaAnticipos += row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal
'sumaAmorticaciones += row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal
TipoCambioGeneral = tipoCambioPago
IdCtaContable = IdCtaContAnticipos
If importeMovimiento <> 0 Then
'Conta ContPAQ
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
' PorcentajeAmortizacion = SumaAnticipos / TxtTotal.Text.ToDecimal
'Los Anticipos solo ocupan los ivas por trasladar
If PorcentajePago > 0 Then
Dim Importe13 = gvr.DataKey("IVA").ToDecimal
Dim Importe8 = gvr.DataKey("RetIVA").ToDecimal
Dim Importe9 = gvr.DataKey("RetISR").ToDecimal
If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrePoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then
ErrorConta = True
End If
End If
End If
importeMovimiento = 0
Case 91 'Amortizacion Nota de Credito
Dim TC As Decimal = 1
If gvr.DataKey("CveConceptoContable").ToEntero() = 12 Then
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString().ToDecimal
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
TC = TipoCambioFluctuacion
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
End If
importeMovimiento = importeMovimiento.RoundSQL
importeMX = importeMX.RoundSQL
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, CveCliente) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero()
End If
End If
If importeMovimiento <> 0 Then
'Conta ContPAQ
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
idCuentaContabilizacion = 0
End If
Dim ImporteComplementaria As Decimal = 0
If UsaComplementariaClientes = True AndAlso gvr.DataKey("CveMoneda").ToString().ToDecimal > 1 Then
IdCtaContable = IdCtaContComplementaria
importeMX = importeMovimiento
ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
IdCtaContable = IdCtaContMonedaExtranjera
End If
If CveMonedaVenta > 1 AndAlso IdCtaContMonedaExtranjera > 0 Then
IdCtaContable = IdCtaContMonedaExtranjera
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
'AMORTIZA NC CONTRA ANTICIPO A CLIENTES
If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal)
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
Else
ErrorConta = True
Exit For
End If
End If
End If
End If
Importe91 = importeMovimiento
importeMovimiento = 0
Case 92 'Amortizacion Ingreso X Comprobar
If gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero() = 66 Then
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
IdCtaContable = IdCtaContClientes
If importeMovimiento <> 0 Then
' Agregamos el 2
If tipoCambioPago = 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else 'Cuando son dolares
If importeMovimiento <> 0 Then
If IdCtaContComplementaria > 0 Or 0 > 0 Then
'Agregamos la Complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
End If
End If
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal)
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
If importeMX <> 0 Then
'Agregamos el 13
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos el 61
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
'IEPS
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIEPS.Text.ToDecimal)
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
If importeMX <> 0 Then
'Agregamos el 38
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos el 39
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
'Agregamos el 92
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
IdCtaContable = IdCtaContAnticipos
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
If Not tipoCambioPago = 1 Then
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
Else
IdCtaContable = ObjCliente.IdCtaContAnticipos
End If
End If
End If
If UsuarioActual.CveEmpresa.Contiene(119) Then
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
If Not tipoCambioPago = 1 Then
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
Else
IdCtaContable = ObjCliente.IdCtaContClientes
End If
End If
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
End If
importeMovimiento = 0
Case 64 'Ganancia
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then
If tipoCambioVentaValuacion > tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = Importe91 * (tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
Else
Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta)
If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioGanancia) 'Añadimos la diferencia de ganancia en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioGanancia, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
End If
Else
importeMovimiento = 0
End If
Case 65 'Perdida
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then
If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = Importe91 * Math.Abs(tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
Else
Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta)
If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioPerdida) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPerdida, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
End If
Else
importeMovimiento = 0
End If
Case 13 ' IVA x Trasladar
If gvr.DataKey("RegresarImpuesto") = "1" Then
''gvr.DataKey("DevolucionImportePagado"), de aqui se toma que % de pago tenia la DEV
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC
importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
importeMX = importeMovimiento
IdCtaContable = IdCtaIVAXTrasladar
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, VentaFolio, "")
'If importeMovimiento <> 0 Then
' IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
'End If
Else
importeMovimiento = 0
PorcentajeImpuesto = 0
End If
Case 61 ' IVA Trasladado
If gvr.DataKey("RegresarImpuesto") = "1" Then
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal
importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
importeMX = importeMovimiento
IdCtaContable = IdCtaIVATrasladado
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, VentaFolio, "")
Else
importeMovimiento = 0
PorcentajeImpuesto = 0
End If
Case 38 ' IEPS x Trasladar
If gvr.DataKey("RegresarImpuesto") = "1" Then
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
PorcentajeImpuesto = 0 '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC
importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
importeMX = importeMovimiento
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString().ToEntero()
End If
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, VentaFolio, "")
Else
importeMovimiento = 0
PorcentajeImpuesto = 0
End If
Case 39 ' IEPS Trasladado
If gvr.DataKey("RegresarImpuesto") = "1" Then
SimplificaPrePoliza = False
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
PorcentajeImpuesto = 0
importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
importeMX = importeMovimiento
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString().ToEntero()
End If
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, VentaFolio, "")
Else
importeMovimiento = 0
PorcentajeImpuesto = 0
End If
Case Else
importeMovimiento = 0
PorcentajeImpuesto = 0
importeMX = 0
End Select
' TipoCambioGeneral = tipoCambioPago
' IdCtaContable = IdCtaContAnticipos
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1,
CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, CveIE:=CveIEAnticipo,
PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
Dim Pago As New VentaPago
Pago.ImportePagoVenta = importeMovimiento
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
Pago.TipoPago = "A"
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
End If
Case "12"
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMN = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMN = importeMovimiento * gvr.DataKey("TipoCambio").ToString().ToDecimal
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMN = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
TC = TipoCambioFluctuacion
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMN = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
End If
importeMovimiento = importeMovimiento.RoundSQL
importeMN = importeMN.RoundSQL
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(12, CveCliente) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero()
End If
End If
Next
End If
If importeMovimiento <> 0 Then
Dim Pago As New VentaPago
Pago.Fecha = TxtFechaAnticipoCliente.Text.ToDate
Pago.FechaDocumentoRelacionado = gvr.DataKey("Fecha").ToDate
Pago.ImportePagoVenta = importeMovimiento
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
Pago.TipoPago = "NC"
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
SimplificaPrePoliza = False
End If
Case "66"
If gvr.DataKey("CveIE").ToEntero() > 0 Then
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
IdCtaContable = IdCtaContClientes
If importeMovimiento <> 0 Then
Dim Pago As New VentaPago
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
Pago.TipoPago = "A"
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
' Agregamos el 2
If tipoCambioPago = 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else 'Cuando son dolares
If importeMovimiento <> 0 Then
If IdCtaContComplementaria > 0 Or 0 > 0 Then
'Agregamos la Complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, Now, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
End If
End If
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal)
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
'Agregamos el 92
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
IdCtaContable = IdCtaContAnticipos
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
If Not tipoCambioPago = 1 Then
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
Else
IdCtaContable = ObjCliente.IdCtaContAnticipos
End If
End If
End If
If UsuarioActual.CveEmpresa.Contiene(119) Then
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
If Not tipoCambioPago = 1 Then
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
Else
IdCtaContable = ObjCliente.IdCtaContClientes
End If
End If
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 555, Concepto, Now, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMN, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
End If
End Select
End If
Next
Else