Agregar DT de deducciones
This commit is contained in:
@@ -382,16 +382,19 @@ Namespace Modelos
|
|||||||
Me.ListaMensajes = New List(Of String)
|
Me.ListaMensajes = New List(Of String)
|
||||||
Me.FolioFiscal = ""
|
Me.FolioFiscal = ""
|
||||||
Me.GenerarPDFFactura = False
|
Me.GenerarPDFFactura = False
|
||||||
IniciaValores()
|
IniciaValores()
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
Dim ObjVentas As New ClsVentas()
|
||||||
If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then
|
If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then
|
||||||
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
setValues(ObjVentas.DtResultados.Rows(0))
|
setValues(ObjVentas.DtResultados.Rows(0))
|
||||||
|
|
||||||
SetMetodoPago()
|
SetMetodoPago()
|
||||||
SetMoneda()
|
SetMoneda()
|
||||||
SetSubProyecto()
|
SetSubProyecto()
|
||||||
SetSubProyectoMatriz()
|
SetSubProyectoMatriz()
|
||||||
SetCliente()
|
SetCliente()
|
||||||
|
SetTotales(ObjVentas.DtResultados, ObjVentas)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
@@ -405,6 +408,58 @@ Namespace Modelos
|
|||||||
Me.DirectorioServidor = DirectorioServidor
|
Me.DirectorioServidor = DirectorioServidor
|
||||||
Timbre = New CFDITimbre
|
Timbre = New CFDITimbre
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub SetTotales(dtVentas As DataTable, ObjVentas As ClsVentas)
|
||||||
|
Dim TmpDTImpuestos = New DataTable
|
||||||
|
TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String))
|
||||||
|
TmpDTImpuestos.Columns.Add("Importe", GetType(Double))
|
||||||
|
TmpDTImpuestos.Columns.Add("Orden", GetType(Integer))
|
||||||
|
|
||||||
|
Dim DR As DataRow = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("IVA").ToString.ToDouble >= 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
|
||||||
|
'solo para eclipse, que muesre un subtotal debajo de IVA
|
||||||
|
If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
|
||||||
|
If dtVentas(0)("IEPS").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IEPS" : DR("Importe") = dtVentas(0)("IEPS").ToString.ToDouble : DR("Orden") = 80 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
|
||||||
|
If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 100 : TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
|
||||||
|
If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then
|
||||||
|
|
||||||
|
Dim dtImpuesto As DataTable = ObjVentas.DtResultados
|
||||||
|
If dtImpuesto.Rows.Count > 0 Then
|
||||||
|
For Each Row As DataRow In dtImpuesto.Rows
|
||||||
|
Dim Orden = 80
|
||||||
|
If Row("Importe").ToString.ToDouble <> 0 Then
|
||||||
|
DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString
|
||||||
|
DR("Importe") = Row("Importe").ToString.ToDouble
|
||||||
|
DR("Orden") = Orden
|
||||||
|
TmpDTImpuestos.Rows.Add(DR)
|
||||||
|
DR = TmpDTImpuestos.NewRow()
|
||||||
|
Orden = Orden + 1
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
Me.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
Private Sub IniciaValores()
|
Private Sub IniciaValores()
|
||||||
Me.FolioFiscal = ""
|
Me.FolioFiscal = ""
|
||||||
Me.CveContratoSecciones = ""
|
Me.CveContratoSecciones = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user