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/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/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
diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb
index 438cd2e12..7c1c7fd05 100644
--- a/Ventas/PVCobranza.aspx.vb
+++ b/Ventas/PVCobranza.aspx.vb
@@ -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
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()