-- cambio a unificación función validaciónprepolizas
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
'Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports ADSTimbrado
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Ventas_ClientesAbonar
|
||||
@@ -1369,17 +1370,12 @@ Partial Class Ventas_ClientesAbonar
|
||||
|
||||
ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjFacturaDevolucion.TipoCambio = If(Me.CveMoneda = 1, 1, GlobalTipoCambio(NowADS()).FormatoNumero(4).ToDecimal())
|
||||
ObjFacturaDevolucion.ConvertirPesos = False
|
||||
ObjFacturaDevolucion.CveMoneda = CveMoneda
|
||||
ObjFacturaDevolucion.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda}")
|
||||
ObjFacturaDevolucion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda}")
|
||||
ObjFacturaDevolucion.Serie = Serie
|
||||
ObjFacturaDevolucion.Folio = Folio
|
||||
ObjFacturaDevolucion.Fecha = NowADS()
|
||||
ObjFacturaDevolucion.CvePrePoliza = -1
|
||||
ObjFacturaDevolucion.CveMetodoPago = 0
|
||||
ObjFacturaDevolucion.CondicionesPago = 0 ' 0 - Contado, 1 - Credito (CHECAR)
|
||||
ObjFacturaDevolucion.FormaPago = 0
|
||||
|
||||
ObjFacturaDevolucion.TipoDocto = "Egs"
|
||||
ObjFacturaDevolucion.Fecha = NowADS()
|
||||
@@ -1433,7 +1429,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
ObjFacturaDevolucion.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
|
||||
|
||||
Dim Fol As New List(Of String)
|
||||
For Each Fac In ListaVentasGenerarNC
|
||||
For Each Fac As Modelos.Factura In ListaVentasGenerarNC
|
||||
Fol.Add(Fac.FolioFiscal)
|
||||
|
||||
Dim RowVenta As DataRow = ObjFacturaDevolucion.DtVentasRelacionadas.NewRow
|
||||
@@ -1460,24 +1456,14 @@ Partial Class Ventas_ClientesAbonar
|
||||
End Select
|
||||
|
||||
ObjFacturaDevolucion.FechaPago = NowADS()
|
||||
Dim DtVentasNC As DataTable = InicializaDTVentasNC()
|
||||
|
||||
ObjFacturaDevolucion.CveCorte = -1
|
||||
'ObjFacturaDevolucion.CveMesa = -1
|
||||
ObjFacturaDevolucion.NumeroPersonas = 0
|
||||
ObjFacturaDevolucion.CveContrato = -1
|
||||
ObjFacturaDevolucion.DescripcionContrato = ""
|
||||
ObjFacturaDevolucion.CveClienteSucursal = -1
|
||||
ObjFacturaDevolucion.Entrega = ""
|
||||
ObjFacturaDevolucion.CveAlmacen = -1
|
||||
|
||||
Dim DtVentasNC = InicializaDTVentasNC()
|
||||
|
||||
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte")
|
||||
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA")
|
||||
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA")
|
||||
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR")
|
||||
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS")
|
||||
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento")
|
||||
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("TotalImporte")
|
||||
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA")
|
||||
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA")
|
||||
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR")
|
||||
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS")
|
||||
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("Descuento")
|
||||
Dim Amortizacion As Decimal = 0
|
||||
|
||||
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
|
||||
@@ -1493,8 +1479,8 @@ Partial Class Ventas_ClientesAbonar
|
||||
ObjFacturaDevolucion.Total = Total
|
||||
ObjFacturaDevolucion.TotalOtrosConceptos = 0
|
||||
|
||||
For Each Fac In ListaVentasGenerarNC
|
||||
Dim Drt = DtVentasNC.NewRow
|
||||
For Each Fac As Modelos.Factura In ListaVentasGenerarNC
|
||||
Dim Drt As DataRow = DtVentasNC.NewRow
|
||||
Drt("CveVenta") = Fac.CveVenta
|
||||
Drt("Importe") = Fac.DescuentoProntoPago
|
||||
Drt("FolioFiscal") = Fac.FolioFiscal
|
||||
@@ -1508,7 +1494,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion, ListaVentasGenerarNC)
|
||||
|
||||
Try
|
||||
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion)
|
||||
Dim Resp As Modelos.Factura.MMensajeFactura = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion)
|
||||
Retorno.Respuesta = Resp
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar la NC de pronto pago", ex)
|
||||
@@ -1572,7 +1558,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
|
||||
Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
|
||||
|
||||
For Each Fac In ListaVentasGenerarNC
|
||||
For Each Fac As Modelos.Factura In ListaVentasGenerarNC
|
||||
Timbre.CFDIRelacionados.UUID.Add(Fac.FolioFiscal)
|
||||
Next
|
||||
End If
|
||||
@@ -1601,7 +1587,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
tPS = tPS.Replace("|", " ")
|
||||
|
||||
If tPS.Length >= 1000 Then
|
||||
Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999)
|
||||
Dim tPSRecortado As String = tPS.Remove(999, tPS.Length - 999)
|
||||
tPS = tPSRecortado
|
||||
End If
|
||||
|
||||
@@ -1740,7 +1726,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
DtImpuestos.AcceptChanges()
|
||||
Dim AcumuladoNC As Decimal = 0
|
||||
|
||||
For Each Fac In ListaVentasGenerarNC
|
||||
For Each Fac As Modelos.Factura In ListaVentasGenerarNC
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Fac.CveVenta, Fac.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
|
||||
@@ -2384,7 +2370,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
MsgError = "Ocurrio un error al saldar el movimiento"
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
|
||||
If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=5) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
MsgError = ObjConta.MensajePolizaDescuadre + " " + ObjConta.ValorDiferencia
|
||||
GuardaLogAD($"Ventas/ClientesAbonar | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||
|
||||
Reference in New Issue
Block a user