From 6c75038e1c69a079c90b3f462dc36aa619457716 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 27 Mar 2024 10:05:02 -0700 Subject: [PATCH 1/3] --FIX. Recargar global de sucursales de clientes en clientes.aspx. --FIX.Comentar facturacion de sucursales en ventas.aspx. --FIX. Filtro para sucursales de cliente en ventas.aspx --- Ventas/Clientes.aspx.vb | 9 +++++++-- Ventas/Ventas.aspx.vb | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 61a5959bd..758792a55 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -3176,6 +3176,8 @@ Partial Class Clientes ObjCliente.Dispose() + GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente) = Nothing + Else AddSucursalTemp() End If @@ -3190,8 +3192,9 @@ Partial Class Clientes Me.Actualizar = False Me.CveClienteSuc = -1 - RegistraScript("hideDivEC();") - + RegistraScript("hideDivEC();") + + End Sub Protected Sub LnkAgragarDireccion_Click(sender As Object, e As EventArgs) @@ -3232,6 +3235,8 @@ Partial Class Clientes GVSucursales.EditIndex = -1 ViewState("DTSucursalesCliente") = ObjCliente.DtResultados Alert("La Sucursal del Cliente se eliminĂ³ correctamente.", TipoMensaje.MsgInformacion) + + GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente) = Nothing End If Else TempDTSucursales.Rows.RemoveAt(e.RowIndex) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 1e82369c9..38fdec9d3 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -7006,7 +7006,7 @@ Partial Class Ventas End If DdlSucursalCliente.Items.Clear() - Dim dtts As DataTable = GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente) + Dim dtts As DataTable = GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente).FiltraParametros("CveClienteSucursal > 0") If dtts IsNot Nothing AndAlso dtts.Rows.Count > 0 Then DdlSucursalCliente.DataSource = dtts DdlSucursalCliente.Items.Insert(0, New ListItem("Matriz", "-1")) @@ -7018,9 +7018,9 @@ Partial Class Ventas End If 'SI UTILIZA EL RFC GENERICO PERMITE FACTURAR SUCURSAL - If (Not UsuarioActual.Empresa.Funcionalidad(558) = "1") AndAlso (CveVenta <= 0 OrElse NuevaFactura = 1) AndAlso LblRFC.Text.Trim() = "XAXX010101000" Then - HabilitarFacturacionSucursal() - End If + 'If (Not UsuarioActual.Empresa.Funcionalidad(558) = "1") AndAlso (CveVenta <= 0 OrElse NuevaFactura = 1) AndAlso LblRFC.Text.Trim() = "XAXX010101000" Then + ' HabilitarFacturacionSucursal() + 'End If 'CargaFolios() From 469403b44ef6f21a3d8be19d0d2d61f650db2000 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 27 Mar 2024 14:26:13 -0700 Subject: [PATCH 2/3] --FIX. Aplicacion de multiples metodos de pago en cobranza.aspx --- Ventas/PVCobranza.aspx.vb | 59 ++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 453eaa541..7c1c7fd05 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -55,8 +55,8 @@ Partial Class Ventas_PVCobranza 'MOSTRAR SOLO CUENTAS DE CONTADO EN BDH 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon)) - DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon)) + DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon)) + DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon)) 'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then @@ -296,12 +296,19 @@ Partial Class Ventas_PVCobranza 'validaciones Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal If Pagado = 0 Then - Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia) + Alert("Favor de especificar importe", TipoMensaje.MsgAdvertencia) Exit Sub End If - If LtlSaldo.Text.ToDecimal > Pagado Then - Alert("Favor de especificar el saldo total de pagar", TipoMensaje.ToastAdventencia) + If LtlSaldo.Text.ToDecimal() > Pagado Then + Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal + + If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then + Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -336,9 +343,10 @@ Partial Class Ventas_PVCobranza Dim CvePrePoliza As Integer Dim Fecha As Date = NowADS() - Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal + Dim MsgError As String = "" Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal + Dim PagoAplicado As Decimal = 0 Dim ObjConta As New ClsContabilidad Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL()) @@ -348,31 +356,44 @@ Partial Class Ventas_PVCobranza If CvePrePoliza > 0 Then - If PagoEfectivo > 0 Then - If PagoEfectivo > VentaActual.Total Then - TxtCambio.Text = (VentaActual.Total - PagoEfectivo).FormatoNumero - PagoEfectivo = VentaActual.Total - End If - MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) - End If - SaldoPendiente -= PagoEfectivo If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) - PagoEfectivo = TxtImporteCredito.Text.ToDecimal + SaldoPendiente -= TxtImporteCredito.Text.ToDecimal + PagoAplicado += TxtImporteCredito.Text.ToDecimal End If - SaldoPendiente -= PagoEfectivo + If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) - PagoEfectivo = TxtImporteDebito.Text.ToDecimal + SaldoPendiente -= TxtImporteDebito.Text.ToDecimal + PagoAplicado += TxtImporteDebito.Text.ToDecimal End If + If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) - PagoEfectivo = TxtImporteCheque.Text.ToDecimal + SaldoPendiente -= TxtImporteCheque.Text.ToDecimal + PagoAplicado += TxtImporteCheque.Text.ToDecimal End If If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) - PagoEfectivo = TxtImporteCheque.Text.ToDecimal + SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal + PagoAplicado += TxtImporteTransferencia.Text.ToDecimal + End If + + If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then + Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal + + PagoAplicado += PagoEfectivo + If PagoAplicado > VentaActual.Total Then + TxtCambio.Text = (PagoAplicado - VentaActual.Total).FormatoNumero + PagoEfectivo = SaldoPendiente + End If + MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2) + SaldoPendiente -= PagoEfectivo + End If + + If SaldoPendiente > 0 Then + MsgError = "Tiene saldo pendiente por aplicar" End If If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, CveCorte) Then From 154b3bdb67d0281a5e774c48192876658b395938 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 27 Mar 2024 17:42:44 -0700 Subject: [PATCH 3/3] FIX. Descuentos en factura global --- App_Code/Modelos.vb | 2 +- Ventas/FacturacionGlobal.aspx | 1 + Ventas/FacturacionGlobal.aspx.vb | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 03c0b9655..3a6b40a06 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -1670,7 +1670,7 @@ Namespace Modelos Me.IEPS = Me.DtDetalle.SUMD("ImporteIEPS") Me.Descuento = Me.DtDetalle.SUMD("Descuento") - Me.Total = Me.SubTotal + Me.IVA + Me.IEPS - (Me.RetIVA + Me.RetISR) + Me.Total = Me.SubTotal - Me.Descuento + Me.IVA + Me.IEPS - (Me.RetIVA + Me.RetISR) End Sub Public Sub PreparaTimbre() diff --git a/Ventas/FacturacionGlobal.aspx b/Ventas/FacturacionGlobal.aspx index ff74a30ee..60028d4a4 100644 --- a/Ventas/FacturacionGlobal.aspx +++ b/Ventas/FacturacionGlobal.aspx @@ -203,6 +203,7 @@ + diff --git a/Ventas/FacturacionGlobal.aspx.vb b/Ventas/FacturacionGlobal.aspx.vb index 5b0a90341..3d0392dde 100644 --- a/Ventas/FacturacionGlobal.aspx.vb +++ b/Ventas/FacturacionGlobal.aspx.vb @@ -106,6 +106,10 @@ Partial Class Ventas_FacturacionGlobal Public Sub CargaDatos() Me.CveSubProyecto = -1 + If UsuarioActual.CveRol = 1 Then + GvDatos.Columns(7).Visible = True + End If + Dim CveCliente As Integer = UsuarioActual.Empresa.Funcionalidad(714).ToEntero() Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") @@ -213,15 +217,21 @@ Partial Class Ventas_FacturacionGlobal ObjFactura.DtRemisiones = DtRemisiones.FiltraParametros($"CveVenta IN ({SbRemisiones.ToString()})") ObjFactura.DtPagosFacturaGlobal = DtPagosFacturaGlobal - For Each Dr As DataRow In DtRemisionesPS.Rows + 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(), CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero()) Next ObjFactura.CalculaTotales() + + 'DEBE ESTAR DENTRO DE LA CLASE, COMENTAR UNA VEZ SE HAYA HECHO EL CAMBIO + 'If ObjFactura.Descuento > 0 Then + ' ObjFactura.Total = ObjFactura.Total - ObjFactura.Descuento + 'End If + ObjFactura.PreparaTimbre() - If ObjFactura.Total <> DtPagosFacturaGlobal.SUMD("Importe") Then + If Math.Abs(ObjFactura.Total.RoundSQL(2) - DtPagosFacturaGlobal.SUMD("Importe").RoundSQL(2)) > 0.01 Then Alert("Los pagos no coinciden con el total de la factura", TipoMensaje.MsgError) Exit Sub End If