From 7a0cda8f0b1f6632b7825e5a92f3b1075d813aa7 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 23 May 2024 10:58:11 -0700 Subject: [PATCH] OC Req 70253 sub total 0 con IVA --- OC/OC.aspx.vb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 9793c9c20..84e3df58c 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -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