Correcion iva no cocide al genrar nota de credito

This commit is contained in:
Rakcsle Supertramp
2020-01-25 11:30:15 -07:00
parent 3de574d1f8
commit 5375506fce
2 changed files with 52 additions and 38 deletions

View File

@@ -8432,7 +8432,11 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If sumaAmortizacion = CompraSaldo Then If sumaAmortizacion = CompraSaldo Then
ImporteMovimiento = TxtIVA.Text.ToDecimal ImporteMovimiento = TxtIVA.Text.ToDecimal
IVACompleto = True
If ImporteMovimiento > 0 Then
IVACompleto = True
End If
Else Else
ImporteMovimiento = 0 ImporteMovimiento = 0
End If End If

View File

@@ -21240,20 +21240,24 @@ Partial Class Ventas
Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero = 1, Total, SubTotal) Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero = 1, Total, SubTotal)
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100 Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = "" Dim FiltroStr As String = ""
Dim importePuTemp As Decimal = 0
For Each Dr As DataRow In DtImpuestosLocal.Rows For Each Dr As DataRow In DtImpuestosLocal.Rows
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto")) FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
Dr("ImporteTotal") = Math.Round(Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr)), 2) importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr))).ToDecimal
Dr("ImporteTotal") = importePuTemp.RoundSQL()
'Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2) Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2) Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString.ToDecimal) * Dr("PorcentajeIVA").ToString.ToDecimal)
Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2) Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2) Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
'Dr("ImporteIVA") = (Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr)).RoundSQL(2)
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next Next
'codigo para ajuste de centavo, si el importe total no cuadra con los totales 'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
@@ -24067,39 +24071,45 @@ Partial Class Ventas
#End Region #End Region
Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then If CveVenta <= 0 Then
For Each RowServicio As DataRow In TmpDT.Rows If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
Dim tClienteRetIVA = ClienteRetIVA If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
If tClienteRetIVA <= 0 Then For Each RowServicio As DataRow In TmpDT.Rows
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then Dim tClienteRetIVA = ClienteRetIVA
tClienteRetIVA = 0.106667D If tClienteRetIVA <= 0 Then
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
tClienteRetIVA = 0.04D tClienteRetIVA = 0.106667D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
tClienteRetIVA = 0.06D tClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then
tClienteRetIVA = 0.06D
End If
ViewState("ClienteRetIVA") = tClienteRetIVA
End If End If
ViewState("ClienteRetIVA") = tClienteRetIVA
Dim TotalCalculableImpuestos As Decimal = (RowServicio("Cantidad").ToString().ToDecimal() * RowServicio("PU").ToString().ToDecimal()) - RowServicio("Descuento").ToString().ToDecimal()
RowServicio("ImporteRetIVA") = (TotalCalculableImpuestos * ClienteRetIVA).RoundSQL()
RowServicio("PorcentajeRetIVA") = ClienteRetIVA
Next
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal().FormatoNumero(2)
Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2)
If PorcentajeRetIVA > 0 Then
DdlTipoRetencion.Visible = True
End If End If
Dim TotalCalculableImpuestos As Decimal = (RowServicio("Cantidad").ToString().ToDecimal() * RowServicio("PU").ToString().ToDecimal()) - RowServicio("Descuento").ToString().ToDecimal() GvPS.DataSource = TmpDT
RowServicio("ImporteRetIVA") = (TotalCalculableImpuestos * ClienteRetIVA).RoundSQL() GvPS.DataBind()
RowServicio("PorcentajeRetIVA") = ClienteRetIVA
Next UpPS.Update()
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal().FormatoNumero(2)
Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2)
If PorcentajeRetIVA > 0 Then
DdlTipoRetencion.Visible = True
End If End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
UpPS.Update()
End If End If
End If End If
End Sub End Sub
End Class End Class