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.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()

View File

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

View File

@@ -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