OC Req 70253 sub total 0 con IVA

This commit is contained in:
rakcsle
2024-05-23 10:58:11 -07:00
parent 6154a48d70
commit 7a0cda8f0b

View File

@@ -2646,6 +2646,10 @@ Partial Class OC_OC
End Function
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
If Not ValidaTotales() Then
Exit Sub
End If
'VALIDACIONES PARA GUARDAR
If ValidaGuardar() Then Exit Sub
@@ -2653,6 +2657,8 @@ Partial Class OC_OC
Exit Sub
End If
Dim MsgError As String = "Hubo un error al registrar"
'VARIABLES
Dim CveProveedorSucursal As Integer = -1
@@ -3348,6 +3354,30 @@ Partial Class OC_OC
End Sub
Private Function ValidaTotales() As Boolean
Dim Subtotal As Decimal = DtDetalle.SUMD("Total", "Total > 0") + DtDetalle.SUMD("Descuento")
Dim Descuento As Decimal = DtDetalle.SUMD("Descuento").RoundSQL
Dim SubTotalIEPSIVA As Decimal = DtDetalle.SUMD("IEPSPSIVA")
Dim IVA As Decimal = DtDetalle.SUMD("IVA") + SubTotalIEPSIVA
Dim SubTotalIEPS As Decimal = DtDetalle.SUMD("IEPSPS")
Dim SubTotalRetIVA As Decimal = DtDetalle.SUMD("RetIVA")
Dim SubTotalRetISR As Decimal = DtDetalle.SUMD("RetISR")
Dim Total As Decimal = (Subtotal - Descuento + IVA + SubTotalIEPS - SubTotalRetIVA - SubTotalRetISR)
Dim Diferencia As Decimal = (Total - LblTotal.Text.ToDecimal).RoundSQL(2)
If Math.Abs(Diferencia) > 0 Then
Alert($"Existe una diferencia de {Diferencia.ToString("###,###,###.00")} entre el Total y las Partidas.", TipoMensaje.MsgAdvertencia)
Return False
Else
Return True
End If
End Function
Protected Function GeneraOrdenes(ByRef objOrdenCompra As ClsOC, Conta As ClsContPAQi, ByRef ObjInventarios As ClsInventarios) As Boolean
'If Ddlcliente.txtValue.Value.ToEntero > 0 And DdlVendedor.SelectedValue.ToEntero <= 0 Then