Saldos iniciales Compras detalles

This commit is contained in:
rakcsle
2024-02-26 16:37:41 -07:00
parent dd4ba99ad0
commit 717d5f0a8d

View File

@@ -225,7 +225,7 @@ Partial Class General_SaldosIniciales
ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "4" Or RblFormato.SelectedValue = "17" Or Or RblFormato.SelectedValue = "18" Then ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "4" Or RblFormato.SelectedValue = "17" Or RblFormato.SelectedValue = "18" Then
If Not dt.Columns(0).ColumnName = "Sucursal" Then If Not dt.Columns(0).ColumnName = "Sucursal" Then
Alert("El nombre de la primera columna debe ser 'Sucursal'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la primera columna debe ser 'Sucursal'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
@@ -1474,7 +1474,7 @@ Partial Class General_SaldosIniciales
'P R O V E E D O R E S - F A C T U R A S 'P R O V E E D O R E S - F A C T U R A S
ElseIf RblFormato.SelectedValue = "3" Then ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "18" Then
#Region "P R O V E E D O R E S - F A C T U R A S" #Region "P R O V E E D O R E S - F A C T U R A S"
@@ -1499,6 +1499,9 @@ Partial Class General_SaldosIniciales
Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero() Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero()
Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
Dim CountRow As Integer = 1
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'") Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'")
RFC = Row("RFC").ToString().Trim RFC = Row("RFC").ToString().Trim
@@ -1559,6 +1562,45 @@ Partial Class General_SaldosIniciales
TipoCambio = GlobalTipoCambio(Fecha).ToString TipoCambio = GlobalTipoCambio(Fecha).ToString
End If End If
Dim IEPSDetalle As Decimal = 0
Dim CantidadDetalle As Decimal = 0
Dim PUDetalle As Decimal = 0
Dim IVADetalle As Decimal = 0
If RblFormato.SelectedValue = "18" Then
Dim CodigoDetalle As String = Row("Codigo").ToString
If CodigoDetalle.Trim.Length > 0 Then
Dim DrDetalles As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = '{CodigoDetalle}'")
If DrDetalles IsNot Nothing Then
CvePS = DrDetalles("CvePS").ToString().ToEntero()
CveUnidadMedida = DrDetalles("CveUnidadMedida").ToString().ToEntero()
CveClasificacion = DrDetalles("CveClasificacion").ToString().ToEntero()
Else
Alert($"El código del producto no se encontro, error en registro {CountRow}")
ErrorCompras = True
End If
Else
Alert($"El código es requerido, error en registro {CountRow}")
ErrorCompras = True
End If
IEPSDetalle = Row("IEPS").ToString.ToDecimal
CantidadDetalle = Row("Cantidad").ToString.ToDecimal
PUDetalle = Row("PU").ToString.ToDecimal
IVADetalle = Row("IVA").ToString.ToDecimal
If CantidadDetalle = 0 Then
Alert($"No se especifico la cantidad, error en registro {CountRow}")
ErrorCompras = True
End If
End If
'PrePóliza 'PrePóliza
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Compras/SaldoInicial", 1, Total, Total, CveMoneda, Fecha, String.Format("{0}-{1}", Serie, Folio), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Compras/SaldoInicial", 1, Total, Total, CveMoneda, Fecha, String.Format("{0}-{1}", Serie, Folio), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not CvePrePoliza > 0 Then If Not CvePrePoliza > 0 Then
@@ -1578,10 +1620,24 @@ Partial Class General_SaldosIniciales
CveCompra = ObjCompras.CveCompra CveCompra = ObjCompras.CveCompra
'Compra Detalle 'Compra Detalle
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, SubTotal, SubTotal * PorcentajeIVA, SubTotal, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje) Then If RblFormato.SelectedValue = "18" Then
ErrorCompras = True
Exit For Dim TotalDetalles As Decimal = SubTotal
If PUDetalle > 0 Then
TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle
End If
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, CantidadDetalle, PUDetalle, (CantidadDetalle * PUDetalle) * PorcentajeIVA, TotalDetalles, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje, IEPSPS:=IEPSDetalle) Then
ErrorCompras = True
Exit For
End If
Else
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, SubTotal, SubTotal * PorcentajeIVA, SubTotal, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje) Then
ErrorCompras = True
Exit For
End If
End If End If
If ImpuestosLocales > 0 Then 'se agrega como parte de la partida, sin iva. If ImpuestosLocales > 0 Then 'se agrega como parte de la partida, sin iva.
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, ImpuestosLocales, ImpuestosLocales, ImpuestosLocales, 0, "Carga Inicial", -1, IVAPorcentaje:=0, RetIVAPorcentaje:=0, RetISRPorcentaje:=0) Then If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, 1, ImpuestosLocales, ImpuestosLocales, ImpuestosLocales, 0, "Carga Inicial", -1, IVAPorcentaje:=0, RetIVAPorcentaje:=0, RetISRPorcentaje:=0) Then
ErrorCompras = True ErrorCompras = True
@@ -1610,6 +1666,7 @@ Partial Class General_SaldosIniciales
End If End If
Encontrados = Encontrados + 1 Encontrados = Encontrados + 1
CountRow = CountRow + 1
Next Next
Catch ex As Exception Catch ex As Exception