Clientes add cuenta sig, recibo de pago emd

This commit is contained in:
Oscar Irigoyen
2023-05-25 18:52:28 -07:00
parent 85000a1010
commit 1368c0d042
57 changed files with 11069 additions and 60014 deletions

View File

@@ -4617,6 +4617,10 @@ Partial Class Compras_Compras
Exit Sub
End If
'If Not AjustaIva() Then
' Exit Sub
'End If
If DdlFolioGarantia.Visible AndAlso DdlFolioGarantia.SelectedValue <> "-1" Then
If Not ValidaFolioGarantia() Then Exit Sub
End If
@@ -8199,6 +8203,91 @@ Partial Class Compras_Compras
End Function
Private Function AjustaIVA() As Boolean
Dim Respuesta As Boolean = False
Dim IVADetalles As Decimal = TmpDT.SUMD("IVA", " IVA > 0 ")
Dim DiferenciaIVas As Decimal = TxtIVA.Text.ToDecimal - IVADetalles
If Math.Abs(DiferenciaIVas) > 0.05 Then
Dim DTConsulta As New DataTable
DTConsulta = TmpDT.FiltraParametros(" IVA > 0 ")
If DTConsulta.Rows.Count > 0 Then
Dim IndiceContador As Integer = 0
Dim IndiceUltimo As Integer = 0
Dim CantidadRegistroConIVA As Decimal
For Each dRow As DataRow In TmpDT.Rows
If dRow("IVA").ToString.ToDecimal > 0 Then
IndiceUltimo = IndiceContador
CantidadRegistroConIVA = CantidadRegistroConIVA + 1
End If
IndiceContador = IndiceContador + 1
Next
IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ")
DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles
If Math.Abs(DiferenciaIVas) > 0.0D Then
If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then
Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaIVas) / CantidadRegistroConIVA
For Each dRow As DataRow In TmpDT.Rows
dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido
Next
Else
TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas
End If
TmpDT.AcceptChanges()
End If
End If
'Revalidacion de ajuste
IVADetalles = TmpDT.SUMD("IVA", " IVA > 0 ")
DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles
If Math.Abs(DiferenciaIVas) > 0.01D Then
Respuesta = False
If IVADetalles > 0 Then
For Each dRow As DataRow In TmpDT.Rows
If dRow("IVA").ToString.ToDecimal > 0 Then
dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas
TmpDT.AcceptChanges()
Respuesta = True
Exit For
End If
Next
Else
Alert("Los productos especificados en el listado no tienen asignado impuesto IVA, favor de realizar la corrección en el producto que aplique el impuesto.", TipoMensaje.MsgAdvertencia)
Respuesta = False
End If
Else
Respuesta = True
End If
Else
Alert("existe una diferencia de más de 0.05 entre el IVA de la compra y los detalles.", TipoMensaje.MsgAdvertencia)
Respuesta = False
End If
Return Respuesta
End Function
Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged
Dim ObjProveedores As New ClsCompProveedores()
@@ -16795,6 +16884,9 @@ Partial Class Compras_Compras
DdlCultivosCuadro.SelectedValueExist(GvRow.DataKey("CveCultivoCuadroDetalle"))
divIVA.Visible = True
UpPSS.Update()
RegistraScript("$('#divAddProducto').modal('show');")
End Sub
@@ -16950,8 +17042,19 @@ Partial Class Compras_Compras
End If
If Not CveFactura > 0 Then
ViewState("RetIVA") = If(PS("RetIVA").ToString = "-1", ViewState("RetIVA"), PS("RetIVA").ToString).ToString
ViewState("RetISR") = If(PS("RetISR").ToString = "-1", ViewState("RetISR"), PS("RetISR").ToString).ToString
ViewState("RetIVA") = If(ViewState("RetIVA").ToString = "-1", "0", ViewState("RetIVA").ToString)
ViewState("RetISR") = If(ViewState("RetISR").ToString = "-1", "0", ViewState("RetISR").ToString)
'ViewState("RetIVA") = If(PS("RetIVA").ToString = "-1", If(ViewState("RetIVA").ToString = "-1", 0, ViewState("RetIVA")), PS("RetIVA").ToString).ToString
'ViewState("RetISR") = If(PS("RetISR").ToString = "-1", If(ViewState("RetISR").ToString = "-1", 0, ViewState("RetISR")), PS("RetISR").ToString).ToString
Else
ViewState("RetIVA") = If(ViewState("RetIVA").ToString = "-1", "0", ViewState("RetIVA").ToString)
ViewState("RetISR") = If(ViewState("RetISR").ToString = "-1", "0", ViewState("RetISR").ToString)
End If
If TxtIEPSModal.Text = "" Then