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

@@ -8431,8 +8431,12 @@ Partial Class Compras_Compras
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If sumaAmortizacion = CompraSaldo Then
ImporteMovimiento = TxtIVA.Text.ToDecimal
IVACompleto = True
ImporteMovimiento = TxtIVA.Text.ToDecimal
If ImporteMovimiento > 0 Then
IVACompleto = True
End If
Else
ImporteMovimiento = 0
End If

View File

@@ -21240,20 +21240,24 @@ Partial Class Ventas
Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero = 1, Total, SubTotal)
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = ""
Dim importePuTemp As Decimal = 0
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"))
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("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 '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString.ToDecimal) * Dr("PorcentajeIVA").ToString.ToDecimal)
Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
'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
'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"))
@@ -24067,39 +24071,45 @@ Partial Class Ventas
#End Region
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
For Each RowServicio As DataRow In TmpDT.Rows
Dim tClienteRetIVA = ClienteRetIVA
If tClienteRetIVA <= 0 Then
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
tClienteRetIVA = 0.106667D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
tClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then
tClienteRetIVA = 0.06D
If CveVenta <= 0 Then
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
For Each RowServicio As DataRow In TmpDT.Rows
Dim tClienteRetIVA = ClienteRetIVA
If tClienteRetIVA <= 0 Then
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
tClienteRetIVA = 0.106667D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
tClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then
tClienteRetIVA = 0.06D
End If
ViewState("ClienteRetIVA") = tClienteRetIVA
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
Dim TotalCalculableImpuestos As Decimal = (RowServicio("Cantidad").ToString().ToDecimal() * RowServicio("PU").ToString().ToDecimal()) - RowServicio("Descuento").ToString().ToDecimal()
RowServicio("ImporteRetIVA") = (TotalCalculableImpuestos * ClienteRetIVA).RoundSQL()
RowServicio("PorcentajeRetIVA") = ClienteRetIVA
GvPS.DataSource = TmpDT
GvPS.DataBind()
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
UpPS.Update()
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
UpPS.Update()
End If
End If
End Sub
End Class