FIX. Descuentos en factura global

This commit is contained in:
2024-03-27 17:42:44 -07:00
parent 469403b44e
commit 154b3bdb67
3 changed files with 14 additions and 3 deletions

View File

@@ -1670,7 +1670,7 @@ Namespace Modelos
Me.IEPS = Me.DtDetalle.SUMD("ImporteIEPS") Me.IEPS = Me.DtDetalle.SUMD("ImporteIEPS")
Me.Descuento = Me.DtDetalle.SUMD("Descuento") 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 End Sub
Public Sub PreparaTimbre() Public Sub PreparaTimbre()

View File

@@ -203,6 +203,7 @@
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") & " " & Eval("Abreviatura").ToString %>'></asp:Literal> <asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") & " " & Eval("Abreviatura").ToString %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
</Columns> </Columns>
<HeaderStyle CssClass="Titulos" /> <HeaderStyle CssClass="Titulos" />
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />

View File

@@ -106,6 +106,10 @@ Partial Class Ventas_FacturacionGlobal
Public Sub CargaDatos() Public Sub CargaDatos()
Me.CveSubProyecto = -1 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 CveCliente As Integer = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.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.DtRemisiones = DtRemisiones.FiltraParametros($"CveVenta IN ({SbRemisiones.ToString()})")
ObjFactura.DtPagosFacturaGlobal = DtPagosFacturaGlobal 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(), 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()) CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero())
Next Next
ObjFactura.CalculaTotales() 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() 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) Alert("Los pagos no coinciden con el total de la factura", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If