Validacion de amortizaciones de NC
This commit is contained in:
@@ -7306,7 +7306,7 @@ Partial Class Ventas
|
|||||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||||
|
|
||||||
'Registramos la venta
|
'Registramos la venta
|
||||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos)
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||||
|
|
||||||
''Timbramos
|
''Timbramos
|
||||||
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
||||||
@@ -8801,7 +8801,9 @@ Partial Class Ventas
|
|||||||
|
|
||||||
|
|
||||||
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
||||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing)
|
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
||||||
|
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
|
||||||
|
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||||
|
|
||||||
Dim Msgok As New StringBuilder
|
Dim Msgok As New StringBuilder
|
||||||
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
||||||
@@ -9125,8 +9127,10 @@ Partial Class Ventas
|
|||||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos)
|
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos)
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
'inventarios
|
'inventarios
|
||||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
If Not EsNCAmortizacion Then
|
||||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||||
|
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
'estimaciones
|
'estimaciones
|
||||||
@@ -9147,7 +9151,9 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing)
|
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
|
||||||
|
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||||
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||||
|
|
||||||
Dim CveIE As Integer = -1
|
Dim CveIE As Integer = -1
|
||||||
Dim DT As DataTable = Nothing
|
Dim DT As DataTable = Nothing
|
||||||
@@ -9175,7 +9181,9 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi, Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing) As Boolean
|
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
|
||||||
|
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||||
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False) As Boolean
|
||||||
Try
|
Try
|
||||||
Dim DT As DataTable
|
Dim DT As DataTable
|
||||||
Dim CvePlantilaPoliza As Integer
|
Dim CvePlantilaPoliza As Integer
|
||||||
@@ -9422,146 +9430,149 @@ Partial Class Ventas
|
|||||||
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'APLICA NC SALDOS DIRECTOS
|
If Not EsNCAmortizacion Then
|
||||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
'APLICA NC SALDOS DIRECTOS
|
||||||
For Each Dr As DataRow In DtVentasNC.Rows
|
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||||
|
For Each Dr As DataRow In DtVentasNC.Rows
|
||||||
|
|
||||||
|
|
||||||
Dim Importe91 As Decimal = 0
|
Dim Importe91 As Decimal = 0
|
||||||
Dim ImporteMN91 As Decimal = 0
|
Dim ImporteMN91 As Decimal = 0
|
||||||
Dim Importe251 As Decimal = 0
|
Dim Importe251 As Decimal = 0
|
||||||
Dim ImporteMN251 As Decimal = 0
|
Dim ImporteMN251 As Decimal = 0
|
||||||
|
|
||||||
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||||
TipoCambioNC = 1
|
TipoCambioNC = 1
|
||||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
Importe251 = Dr("Importe").ToString.ToDecimal
|
Importe251 = Dr("Importe").ToString.ToDecimal
|
||||||
Importe91 = Dr("Importe").ToString.ToDecimal
|
Importe91 = Dr("Importe").ToString.ToDecimal
|
||||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
|
||||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
|
|
||||||
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
|
Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
|
||||||
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
ImporteMN91 = Dr("Importe").ToString.ToDecimal
|
||||||
End If
|
|
||||||
|
|
||||||
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
|
|
||||||
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
|
|
||||||
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
|
||||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
|
||||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
|
||||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
|
||||||
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
|
||||||
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
|
|
||||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
|
||||||
Else
|
|
||||||
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
Importe251 = (Importe251 * Multiplicador).RoundSQL
|
|
||||||
|
|
||||||
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
|
|
||||||
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
|
|
||||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
|
|
||||||
|
|
||||||
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
|
|
||||||
|
|
||||||
Dim ImporteComplementarioIngreso As Decimal = 0
|
|
||||||
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
|
|
||||||
ImporteMN91 = Importe91
|
|
||||||
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
|
||||||
ErrorPrepoliza = True
|
|
||||||
Exit For
|
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
|
||||||
ErrorPrepoliza = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
ImporteAcumulado91 += (ImporteMN91).RoundSQL
|
|
||||||
|
|
||||||
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
|
||||||
ImporteMN251 = Importe251
|
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
|
||||||
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
|
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
|
||||||
ErrorPrepoliza = True
|
|
||||||
Exit For
|
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
|
|
||||||
ErrorPrepoliza = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
'considero fluctuación.
|
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||||
|
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
|
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
|
||||||
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
|
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
|
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
|
||||||
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||||
Dim TipoMovtoFluctua As Boolean = True
|
|
||||||
Dim IdCtaContableFluctua As Integer
|
|
||||||
If difFluctuacion < 0 Then
|
|
||||||
CveConceptoFluctua = 65
|
|
||||||
TipoMovtoFluctua = False
|
|
||||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
|
||||||
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
|
||||||
Else
|
Else
|
||||||
CveConceptoFluctua = 64
|
ImporteMN251 = Dr("Importe").ToString.ToDecimal
|
||||||
TipoMovtoFluctua = True
|
|
||||||
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
|
||||||
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
|
||||||
End If
|
End If
|
||||||
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
|
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
|
Importe251 = (Importe251 * Multiplicador).RoundSQL
|
||||||
|
|
||||||
|
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
|
||||||
|
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
|
||||||
|
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
|
||||||
|
|
||||||
|
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
|
||||||
|
|
||||||
|
Dim ImporteComplementarioIngreso As Decimal = 0
|
||||||
|
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
|
||||||
|
ImporteMN91 = Importe91
|
||||||
|
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
End If
|
ImporteAcumulado91 += (ImporteMN91).RoundSQL
|
||||||
|
|
||||||
Next
|
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
|
||||||
|
ImporteMN251 = Importe251
|
||||||
|
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
If ImporteConcepto12 < ImporteAcumulado91 Then
|
|
||||||
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
|
'considero fluctuación.
|
||||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
|
||||||
|
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
|
||||||
|
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
|
||||||
|
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
|
||||||
|
Dim TipoMovtoFluctua As Boolean = True
|
||||||
|
Dim IdCtaContableFluctua As Integer
|
||||||
|
If difFluctuacion < 0 Then
|
||||||
|
CveConceptoFluctua = 65
|
||||||
|
TipoMovtoFluctua = False
|
||||||
|
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||||
|
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
||||||
|
Else
|
||||||
|
CveConceptoFluctua = 64
|
||||||
|
TipoMovtoFluctua = True
|
||||||
|
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||||
|
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
||||||
|
End If
|
||||||
|
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
|
||||||
|
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
If ImporteConcepto12 < ImporteAcumulado91 Then
|
||||||
|
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
|
||||||
|
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
End If
|
||||||
|
Else
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
ErrorPrepoliza = True
|
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
|
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
|
||||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||||
'ErrorPrepoliza = True
|
'ErrorPrepoliza = True
|
||||||
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
|
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
|
||||||
|
|
||||||
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
|
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
|
||||||
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
|
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
|
||||||
' Dim DtTest = ObjConta.DtResultados
|
' Dim DtTest = ObjConta.DtResultados
|
||||||
'End If
|
'End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If ErrorPrepoliza Then
|
If ErrorPrepoliza Then
|
||||||
Exit For
|
Exit For
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
'APLICA DEVOLUCION SALDOS DIRECTOS
|
'APLICA DEVOLUCION SALDOS DIRECTOS
|
||||||
If AplicaDevolucion Then
|
If AplicaDevolucion Then
|
||||||
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
|
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
|
||||||
|
|||||||
Reference in New Issue
Block a user