diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index f8f696d38..25aa7506c 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1441,15 +1441,15 @@ Partial Class General_SaldosIniciales Dim Folio As String = Row("Folio").ToString() Dim Fecha As Date = Row("Fecha").ToString().ToDate Dim SubTotal As Decimal = Row("SubTotal").ToString().ToDecimal - Dim IVA As Decimal = Row("IVA").ToString().ToDecimal - Dim Total As Decimal = Row("Total").ToString().ToDecimal - Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal - Dim TipoDocto As String = Row("Tipo Documento").ToString() + Dim IVA As Decimal = Row("IVA").ToString().ToDecimal.RoundSQL + Dim Total As Decimal = Row("Total").ToString().ToDecimal.RoundSQL + Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal.RoundSQL + Dim TipoDocto As String = Row("Tipo Documento").ToString().Trim.ToUpper Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString().ToEntero() GuardaLog(Sucursal + " - " + Row("Sucursal").ToString()) - Dim RetIVA As Decimal = Row("Ret IVA").ToString().ToDecimal - Dim RetISR As Decimal = Row("Ret ISR").ToString().ToDecimal - Dim IEPS As Decimal = If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal + Dim RetIVA As Decimal = Row("Ret IVA").ToString().ToDecimal.RoundSQL + Dim RetISR As Decimal = Row("Ret ISR").ToString().ToDecimal.RoundSQL + Dim IEPS As Decimal = If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal.RoundSQL Dim Moneda As String = Row("Moneda").ToString() Dim TipoCambio As String = If(dt.Columns.Contains("Tipo Cambio"), Row("Tipo Cambio").ToString(), "1") Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate @@ -1466,9 +1466,16 @@ Partial Class General_SaldosIniciales If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorCompras = True If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For If Not CveProveedorSucursal > 0 Then CveProveedorSucursal = -1 + If PorcentajeIVA > 0 AndAlso IVA = 0 Then PorcentajeIVA = 0 - TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString() + Dim RetIVAConcepto As String = If(dt.Columns.Contains("RetIVAConcepto"), Row("RetIVAConcepto").ToString(), "").ToUpper + Dim RetISRConcepto As String = If(dt.Columns.Contains("RetISRConcepto"), Row("RetISRConcepto").ToString(), "").ToUpper + Dim CveRetIVAConcepto As Integer = If(RetIVAConcepto = "HONORARIOS", 1, If(RetIVAConcepto = "FLETES", 2, If(RetIVAConcepto = "ARRENDAMIENTO", 4, -1))) + Dim CveRetISRConcepto As Integer = If(RetISRConcepto = "HONORARIOS", 1, If(RetISRConcepto = "ARRENDAMIENTO", 2, If(RetISRConcepto = "RESICO", 4, -1))) + TipoDocto = IIf(TipoDocto.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA", "FACTURAS", ""), "Fac", "NC").ToString() + + 'RMF. falta validación de totales. 'Temporalmente SE BORRARA Dim Transaccion As String = "" 'Row("Transaccion2").ToString() Dim Folio2 As String = "" 'Row("Folio2").ToString() @@ -1497,9 +1504,9 @@ Partial Class General_SaldosIniciales If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then FechaVencimiento = Fecha End If - If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento, + If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal + ImpuestosLocales, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento, False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, - NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto) Then + NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto, CveRetIVAConcepto:=CveRetIVAConcepto, CveRetISRConcepto:=CveRetISRConcepto) Then ErrorCompras = True Exit For End If @@ -1510,6 +1517,12 @@ Partial Class General_SaldosIniciales ErrorCompras = True Exit For End If + 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 + ErrorCompras = True + Exit For + End If + End If Dim ConceptoContablePago As Integer = 17 If TipoDocto = "NC" Then ConceptoContablePago = 60 @@ -1525,7 +1538,7 @@ Partial Class General_SaldosIniciales If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, RetIVA, 15, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For If RetISR > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetISR, RetISR, 16, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For - If ImpuestosLocales > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImpuestosLocales, ImpuestosLocales, 27, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For + 'If ImpuestosLocales > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImpuestosLocales, ImpuestosLocales, 27, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For 'Saldo If Saldo < Total Then @@ -3443,11 +3456,6 @@ Partial Class General_SaldosIniciales ' CveEscolaridad = -1 'End If - - - - - myarraystr = MetodoPago.Split(":"c) If (myarraystr.Length > 1) Then CveMetodoPago = myarraystr(0).ToEntero() @@ -3497,6 +3505,8 @@ Partial Class General_SaldosIniciales + + Dim CvePersonal As Integer = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"NombreCompletoNombre = '{NombreCompleto}'").ToString().ToEntero() If Not (CvePersonal > 0) Then @@ -3948,8 +3958,8 @@ Partial Class General_SaldosIniciales libro.Cell(crow, ccol).Value = "CuentaContable" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Saldo" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Tipo Trabajador" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "RegistroPatronal" : ccol = ccol + 1 ' - libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White