-- Cambios en timbrado, Método/Forma Pago

This commit is contained in:
2025-01-13 06:59:42 -07:00
parent 9a2e0baf05
commit aa13ab1990
13 changed files with 205 additions and 344 deletions

View File

@@ -613,6 +613,7 @@ Partial Class Ventas_PVCobranza
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
VentaActual.CveUsoCFDI = DbRowVenta("CveUsoCFDI").ToString.ToEntero
Dim CveVendedor As Integer = DbRowVenta("CveVendedor").ToString.ToEntero
Dim ObservacionesAlmacen = DbRowVenta("ObservacionesAlmacen").ToString()
@@ -641,7 +642,7 @@ Partial Class Ventas_PVCobranza
Dim PlazoCobranza As Integer = HdnPlazoCobranza.Value.ToEntero
Try
'FACTURAR LA REMISION PARA HACER EL PAGO
If UsuarioActual.CveEmpresa.Contiene(189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
If UsuarioActual.CveEmpresa.Contiene(1, 189, 197) AndAlso VentaActual.TipoDocto = "Rem" Then
CveVentaRemision = HdnCveVenta.Value.ToEntero
@@ -947,21 +948,20 @@ Partial Class Ventas_PVCobranza
Dim DtPagos As DataTable = New DataTable("DtPagosFactura")
DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer)))
DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
Dim PagadoSinEfectivo As Decimal = 0
If VentaConta Then
If TxtImporteCredito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
If TxtImporteCredito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal}) : PagadoSinEfectivo += TxtImporteCredito.Text.ToDecimal
If TxtImporteDebito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
If TxtImporteDebito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal}) : PagadoSinEfectivo += TxtImporteDebito.Text.ToDecimal
If TxtImporteCheque.Text.ToDecimal > 0 Then DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
If TxtImporteCheque.Text.ToDecimal > 0 Then DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal}) : PagadoSinEfectivo += TxtImporteCheque.Text.ToDecimal
If TxtImporteTransferencia.Text.ToDecimal > 0 Then DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
If TxtImporteTransferencia.Text.ToDecimal > 0 Then DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal}) : PagadoSinEfectivo += TxtImporteTransferencia.Text.ToDecimal
If TxtImporteEfectivo.Text.ToDecimal > 0 Then DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
If TxtNCDev.Text.ToDecimal > 0 Then DtPagos.Rows.Add({21, TxtNCDev.Text.ToDecimal})
If TxtNCDev.Text.ToDecimal > 0 Then DtPagos.Rows.Add({21, TxtNCDev.Text.ToDecimal}) : PagadoSinEfectivo += TxtNCDev.Text.ToDecimal
If TxtImporteOtrosContado.Text.ToDecimal() > 0 Then
PagadoSinEfectivo += TxtImporteOtrosContado.Text.ToDecimal
Select Case DdlOtroFormaPago.SelectedValue
Case "1" 'Debito
DtPagos.Rows.Add({18, TxtImporteOtrosContado.Text.ToDecimal})
@@ -972,19 +972,31 @@ Partial Class Ventas_PVCobranza
End Select
End If
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim tpag As Decimal = LtlSaldo.Text.ToDecimal - PagadoSinEfectivo
If TxtImporteEfectivo.Text.ToDecimal < tpag Then tpag = TxtImporteEfectivo.Text.ToDecimal
DtPagos.Rows.Add({1, tpag})
End If
Dim PagoMaximo = DtPagos.MAX("Importe")
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
If CveFormaPago > 0 Then
ObjFactura.CveFormaPago33 = CveFormaPago
ObjFactura.CveMetodoPago33 = 1
ObjFactura.CveFormaPago = CveFormaPago
ObjFactura.CveMetodoPago = 1
ObjFactura.ClaveMetodoPagoSAT = "PUE"
ObjFactura.ClaveFormaPagoSAT = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjFactura.CveFormaPago}")
End If
ObjFactura.FechaPago = Now 'venta de cantado el mismo dia
Else
'venta a crédito
ObjFactura.CveFormaPago33 = 20 ' por definir
ObjFactura.CveMetodoPago33 = 3 'PPD
ObjFactura.CveFormaPago = 20 ' por definir
ObjFactura.ClaveFormaPagoSAT = "99"
ObjFactura.CveMetodoPago = 3 'PPD
ObjFactura.ClaveMetodoPagoSAT = "PPD"
ObjFactura.CondicionesPago = 1 ' condiciones de pago: crédito
End If
ObjFactura.CveUsoCFDI = VentaRemision.CveUsoCFDI
ObjFactura.ClaveUsoCFDISAT = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {VentaRemision.CveUsoCFDI}")
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
@@ -1200,8 +1212,8 @@ Partial Class Ventas_PVCobranza
ObjNC.PreparaTimbre()
ObjNC.CveFormaPago33 = 21 'Aplicación de anticipos
ObjNC.CveMetodoPago33 = 1
ObjNC.CveFormaPago = 21 'Aplicación de anticipos
ObjNC.CveMetodoPago = 1
ObjNC.CveMetodoPago = 1
ObjNC.CveVendedor = CveVendedor
@@ -2031,7 +2043,7 @@ Partial Class Ventas_PVCobranza
Protected Sub GVAnticipos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
'Dim PagadoSinEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
If e.Row.RowIndex = 0 Then
e.Row.Cells(1).Width = Unit.Pixel(60)
@@ -2047,7 +2059,7 @@ Partial Class Ventas_PVCobranza
Dim saldo As Decimal = 0
Dim tipoCambio As Decimal = 0
Dim total As Decimal = LtlSaldo.Text.ToDecimal() '- Pagado
Dim total As Decimal = LtlSaldo.Text.ToDecimal() '- PagadoSinEfectivo
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
@@ -2208,7 +2220,7 @@ Partial Class Ventas_PVCobranza
Dim CveMon As Integer = 1
If DdlOtroFormaPago.SelectedValue.Contiene("1", "2") Then
DdlCuentaOtrosContado.dataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
ElseIf DdlOtroFormaPago.SelectedValue.Contiene("3") Then
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(195, 197) Then
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(CveMon <= 0, 1, CveMon)))