From 63eeedb36bdb1fe038b05523bd5e685431721dbd Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 26 Mar 2024 20:27:34 -0700 Subject: [PATCH] --Ferretera. --Aplicacion de pago de IxC --- App_Code/Modelos.vb | 16 +++------ Ventas/Ventas.aspx.vb | 79 +++++++++++++++++++++++++++++++------------ 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index a0ddf2eef..03c0b9655 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4122,12 +4122,8 @@ Namespace Modelos Pago.AplicaTraslado = False Pago.Referencia = DrPago("Folio").ToString() Pago.CveVentaAmortizacion = -1 - - If DrPago("TipoPago").ToString() = "NC" Then - Pago.TipoPago = "NC" - Else - Pago.TipoPago = "B" - End If + Pago.TipoPago = DrPago("TipoPago").ToString() + Pago.CveClientePago = ObjFactura.CveCliente ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=False) Else @@ -4178,12 +4174,8 @@ Namespace Modelos Pago.AplicaTraslado = False Pago.Referencia = DrPago("Folio").ToString() Pago.CveVentaAmortizacion = DrPago("CveVenta").ToString().ToEntero() - - If DrPago("TipoPago").ToString() = "NC" Then - Pago.TipoPago = "NC" - Else - Pago.TipoPago = "B" - End If + Pago.TipoPago = DrPago("TipoPago").ToString() + Pago.CveClientePago = ObjFactura.CveCliente ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaActual, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=False) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 83fec084d..7a5855aac 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3404,7 +3404,7 @@ Partial Class Ventas If TipoEstatus <> 5 Then 'ESTATUS DE CANCELACION PENDIENTE If Not Me.ObjFacturaNC.CveEstatusFactura = 23 Then - Alert($"El documento de tipo '{Me.ObjFacturaNC.TipodeComprobante}' a refacturar no ha sido cancelado. Favor de verificar el documento", TipoMensaje.MsgAdvertencia) + Alert($"El documento de tipo '{Me.ObjFacturaNC.TipodeComprobante}' a refacturar no ha sido marcado como 'Cancelación pendiente'. Favor de verificar el documento", TipoMensaje.MsgAdvertencia) BtnEmitirImprimir.Visible = False UpFacturar.Update() End If @@ -14397,6 +14397,15 @@ Partial Class Ventas AutoConta = False End If + 'VERIFICA SI EL OBJETO FACTURA TIENE EL OBJETO USUARIO, REQUERIDO PARA FUNCIONES DE PAGOS + If ObjFactura.UsuarioActual Is Nothing Then + ObjFactura.UsuarioActual = UsuarioActual + Else + If ObjFactura.UsuarioActual.Empresa Is Nothing Then + ObjFactura.UsuarioActual.Empresa = UsuarioActual.Empresa + End If + End If + Dim UsaComplementariaClientes As Boolean = True If ObjConta.GetPlantillaConceptos(ObjFactura.CveEmpresa, CvePlantilaPoliza) Then @@ -15508,6 +15517,48 @@ Partial Class Ventas End If + + 'APLICA PAGO SI SELECCIONA IxC + If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then + If Not ErrorPrepoliza Then + + Dim VentaActual As New ClsPaginas.Venta(ObjFactura, UsuarioActual) + + For Each row2 As GridViewRow In GVAnticipos.Rows + + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 66 Then + + If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then + importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal + + If importeMovimiento <> 0 Then + + Dim Pago As New ClsPaginas.VentaPago + Pago.Fecha = Now + Pago.FechaDocumentoRelacionado = row2.DataKey("Fecha").ToString().ToDateTime() + Pago.ImportePagoVenta = importeMovimiento + Pago.ImportePago = importeMovimiento + Pago.CveIE = row2.DataKey("CveIE").ToEntero() + Pago.CveMonedaPago = row2.DataKey("CveMoneda").ToEntero() + Pago.TCPago = row2.DataKey("TipoCambioPago").ToDecimal() + Pago.AplicaTraslado = False + Pago.Referencia = row2.DataKey("Folio") + Pago.CveVentaAmortizacion = -1 + Pago.TipoPago = "I" + Pago.CveClientePago = ObjFactura.CveCliente + + ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaActual, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=True) + + End If + End If + + End If + Next + End If + + End If + + 'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora If RemisionesLista.Count > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then @@ -15541,12 +15592,8 @@ Partial Class Ventas Pago.AplicaTraslado = False Pago.Referencia = DrPago("Folio").ToString() Pago.CveVentaAmortizacion = -1 - - If DrPago("TipoPago").ToString() = "NC" Then - Pago.TipoPago = "NC" - Else - Pago.TipoPago = "B" - End If + Pago.TipoPago = DrPago("TipoPago").ToString() + Pago.CveClientePago = ObjFactura.CveCliente ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=False) Else @@ -15587,13 +15634,7 @@ Partial Class Ventas 'TRASPASO DE PAGOS DE REMISIONES A FACTURA GLOBAL If ObjFactura.DtPagosFacturaGlobal IsNot Nothing Then - If ObjFactura.UsuarioActual Is Nothing Then - ObjFactura.UsuarioActual = UsuarioActual - Else - If ObjFactura.UsuarioActual.Empresa Is Nothing Then - ObjFactura.UsuarioActual.Empresa = UsuarioActual.Empresa - End If - End If + Dim VentaActual As New ClsPaginas.Venta(ObjFactura, UsuarioActual) For Each DrPago As DataRow In ObjFactura.DtPagosFacturaGlobal.Rows @@ -15610,12 +15651,8 @@ Partial Class Ventas Pago.AplicaTraslado = False Pago.Referencia = DrPago("Folio").ToString() Pago.CveVentaAmortizacion = DrPago("CveVenta").ToString().ToEntero() - - If DrPago("TipoPago").ToString() = "NC" Then - Pago.TipoPago = "NC" - Else - Pago.TipoPago = "B" - End If + Pago.TipoPago = DrPago("TipoPago").ToString() + Pago.CveClientePago = ObjFactura.CveCliente ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaActual, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=False) @@ -16995,7 +17032,7 @@ Partial Class Ventas If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then For Each gvr As GridViewRow In GVAnticipos.Rows - If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(12, 277) Then + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(12, 66, 277) Then Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal ' - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) End If Next