From a4c844dcf9b844ac7e7692ecc52098fa8181863b Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 14 Nov 2024 08:15:52 -0700 Subject: [PATCH] Correciones Compras, Foramto OC 189, Formato CFDI GRales,RepContato detale correciones --- Compras/Compras.aspx.vb | 536 +++++++++++---------- Compras/eFacturas.aspx.vb | 5 +- Empresas/189/Formatos/OC.rdlc | 123 ++--- Empresas/Grales/Formatos/CFDIV3.rdlc | 6 +- Transportes/RepContratoDetalle.aspx | 42 +- Transportes/RepContratoDetalle.aspx.vb | 8 +- Transportes/RepContratosCalendario.aspx.vb | 2 +- Ventas/ProductosServicios.aspx.vb | 40 +- Ventas/Promociones.aspx.vb | 1 + 9 files changed, 395 insertions(+), 368 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index e6b366a25..05d53e680 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1962,10 +1962,12 @@ Partial Class Compras_Compras Dim BaseIVA As Decimal = 0 Dim TasaIEPS As String = "" Dim traslados As XmlNodeList = impuestosNode.SelectNodes("cfdi:Traslados/cfdi:Traslado", namespaces) + Dim tieneIEPS As Boolean = False For Each traslado As XmlNode In traslados ' Obtener los valores de los atributos Base e Importe Dim baseValue As Decimal = Decimal.Parse(ValorXML(traslado, "Base")).RoundSQL(2) Dim impuesto As String = ValorXML(traslado, "Impuesto") + Dim importeImpuesto As Decimal = ValorXML(traslado, "Importe").ToDecimal.RoundSQL(2) If impuesto = "001" Then impuesto = "ISR" @@ -1975,12 +1977,12 @@ Partial Class Compras_Compras ElseIf impuesto = "003" Then impuesto = "IEPS" TasaIEPS = ValorXML(traslado, "TasaOCuota") - BaseIEPS += baseValue + BaseIEPS = baseValue + importeImpuesto + tieneIEPS = True End If Next ' Validar si Base coincide con Importe - If BaseIVA <> BaseIEPS AndAlso BaseIEPS > 0 Then - 'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
") + If tieneIEPS AndAlso Math.Abs(BaseIVA - BaseIEPS) > 0.01 Then 'subTotal + IEPS SbValRet.Append($"Producto: {descripcion} La base del IEPS es no coincide con el subtotal, favor de desglosarlo en una base : {BaseIEPS.ToString()}, Tasa: {TasaIEPS}
") End If End If @@ -2447,11 +2449,12 @@ Partial Class Compras_Compras Msg &= String.Format("- Los descuentos del detalle no coinciden con el descuento general
") End If + If Math.Abs(Math.Round(IVATemp, 6) - Math.Round(TrasladoIVA, 6)) > 0.01 Then Msg &= String.Format("- Los IVAS del detalle no coinciden con el IVA general
") End If - If Math.Abs(Math.Round(IEPSTemp, 6) - Math.Round(TrasladoIEPS, 6)) > 0.01 Then + If Math.Abs(Math.Round(IEPSTemp, 6) - Math.Round(TrasladoIEPS, 6)).RoundAD(2) > 0.01 Then Msg &= String.Format("- Los IEPS del detalle no coinciden con el IEPS general
") End If @@ -5098,306 +5101,306 @@ Partial Class Compras_Compras End If End If - '-------INICIA U S A A C ------------------------------------------------------------------- - 'If UsuarioActual.Empresa.UsaAC AndAlso Not TieneError Then + '-------INICIA U S A A C ------------------------------------------------------------------- + 'If UsuarioActual.Empresa.UsaAC AndAlso Not TieneError Then - ' If TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0 Then - ' ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) - ' ObjContaAC.IniciaTransacSQL() + ' If TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0 Then + ' ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + ' ObjContaAC.IniciaTransacSQL() - ' ''POLIZA COMPROMETIDO SOLO SI NO SE VINCULA OC - ' If HdnVCveOC.Value.ToEntero > 0 Then + ' ''POLIZA COMPROMETIDO SOLO SI NO SE VINCULA OC + ' If HdnVCveOC.Value.ToEntero > 0 Then - ' IDPolizaComprometido = 1 - ' TotalPorDevengar = TotalPorDevengar * 2 - ' Else - ' TotalPorDevengar = TotalPorDevengar * 3 - ' End If + ' IDPolizaComprometido = 1 + ' TotalPorDevengar = TotalPorDevengar * 2 + ' Else + ' TotalPorDevengar = TotalPorDevengar * 3 + ' End If - ' IdPoliza = ObjContaAC.AddPoliza(3, TxtDescripcion.Text.Trim, TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate) + ' IdPoliza = ObjContaAC.AddPoliza(3, TxtDescripcion.Text.Trim, TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate) - ' 'Dim filtro As New StringBuilder - ' If IdPoliza > 0 Then - ' PolizaFolio = ObjContaAC.Folio - ' 'Dim RegistroMatriz As DataRow - ' 'Dim CuentaCargo As Integer - ' Dim CuentaAbono As Integer - ' Dim Importe As Decimal + ' 'Dim filtro As New StringBuilder + ' If IdPoliza > 0 Then + ' PolizaFolio = ObjContaAC.Folio + ' 'Dim RegistroMatriz As DataRow + ' 'Dim CuentaCargo As Integer + ' Dim CuentaAbono As Integer + ' Dim Importe As Decimal - ' 'CUENTA PROVEEDOR - ' 'If tIdContaProveedor <= 0 Then - ' ' 'normalmente debe de ser la cuenta 021120000000000000, para el caso de APH, se el cmabio al 2119 - ' ' If ObjContaAC.GetCuentas(-1, "021190000000000000", -1) Then - ' ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("") - ' ' If drCuenta IsNot Nothing Then + ' 'CUENTA PROVEEDOR + ' 'If tIdContaProveedor <= 0 Then + ' ' 'normalmente debe de ser la cuenta 021120000000000000, para el caso de APH, se el cmabio al 2119 + ' ' If ObjContaAC.GetCuentas(-1, "021190000000000000", -1) Then + ' ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("") + ' ' If drCuenta IsNot Nothing Then - ' ' CuentaAbono = drCuenta("Id").ToString.ToEntero - ' ' Dim FolioProveedor = ObjContaAC.GetFolioProveedores("021190000000000000").ToString - ' ' ViewState("CtaProveedor") = ObjContaAC.AddCuenta(String.Format("02119{0}000000000", FolioProveedor.PadLeft(4, "0"c)), NombreProveedor, "D", 2, 0, 1, 0, "", 1, CuentaAbono) - ' ' ObjProveedores.UpdateProveedorIdCuentaAC(CveProveedor, CtaProveedor) + ' ' CuentaAbono = drCuenta("Id").ToString.ToEntero + ' ' Dim FolioProveedor = ObjContaAC.GetFolioProveedores("021190000000000000").ToString + ' ' ViewState("CtaProveedor") = ObjContaAC.AddCuenta(String.Format("02119{0}000000000", FolioProveedor.PadLeft(4, "0"c)), NombreProveedor, "D", 2, 0, 1, 0, "", 1, CuentaAbono) + ' ' ObjProveedores.UpdateProveedorIdCuentaAC(CveProveedor, CtaProveedor) - ' ' Else - ' ' ErrorAC = True - ' ' ErrorACMEnsaje.Append(" - DrCuenta Nula") - ' ' End If - ' ' Else - ' ' ErrorACMEnsaje.Append(" - Error al consultar cuenta 021190000000000000 ") - ' ' ErrorAC = True - ' ' End If - ' 'End If + ' ' Else + ' ' ErrorAC = True + ' ' ErrorACMEnsaje.Append(" - DrCuenta Nula") + ' ' End If + ' ' Else + ' ' ErrorACMEnsaje.Append(" - Error al consultar cuenta 021190000000000000 ") + ' ' ErrorAC = True + ' ' End If + ' 'End If - ' Dim ConceptoRenglon As String = "" - ' If Not ErrorAC Then + ' Dim ConceptoRenglon As String = "" + ' If Not ErrorAC Then - ' 'INVENTARIOS EN AC - ' Dim ContadorInventario As Integer = GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) + ' 'INVENTARIOS EN AC + ' Dim ContadorInventario As Integer = GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) - ' Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA, tRetIVA, tRetISR As Decimal - ' Dim ipresup As Integer = 0 - ' 'COMIENZA: PRUEBA AGRUPACION CONCEPTOS - ' Dim Presup = From gvr As DataRow In TmpDT.Rows.Cast(Of DataRow)() - ' Group gvr By Grp = New With { - ' Key .CvePresupuestoEgreso = gvr("CvePresupuestoEgreso").ToString.ToEntero, - ' Key .CveOrdencompraDetalle = If(gvr("CveOrdencompraDetalle").ToString.ToEntero > 0, 1, -1), - ' Key .CveActivoFijo = If(gvr("TipoAF").ToString.ToEntero = 2, gvr("CveActivoFijo").ToString.ToEntero, -1) - ' } Into Group - ' Select Grp.CvePresupuestoEgreso, Grp.CveActivoFijo, Grp.CveOrdencompraDetalle, - ' TotalImporte = Group.Sum(Function(r) r("Total").ToString.ToDecimal) - ' Dim Fecha As Date = TxtFecha.Text.ToDate + ' Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA, tRetIVA, tRetISR As Decimal + ' Dim ipresup As Integer = 0 + ' 'COMIENZA: PRUEBA AGRUPACION CONCEPTOS + ' Dim Presup = From gvr As DataRow In TmpDT.Rows.Cast(Of DataRow)() + ' Group gvr By Grp = New With { + ' Key .CvePresupuestoEgreso = gvr("CvePresupuestoEgreso").ToString.ToEntero, + ' Key .CveOrdencompraDetalle = If(gvr("CveOrdencompraDetalle").ToString.ToEntero > 0, 1, -1), + ' Key .CveActivoFijo = If(gvr("TipoAF").ToString.ToEntero = 2, gvr("CveActivoFijo").ToString.ToEntero, -1) + ' } Into Group + ' Select Grp.CvePresupuestoEgreso, Grp.CveActivoFijo, Grp.CveOrdencompraDetalle, + ' TotalImporte = Group.Sum(Function(r) r("Total").ToString.ToDecimal) + ' Dim Fecha As Date = TxtFecha.Text.ToDate - ' 'Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA As Double - ' tTotalIVA = TxtIVA.Text.ToDecimal - ' tRetIVA = TxtRetIVA.Text.ToDecimal - ' tRetISR = TxtRetISR.Text.ToDecimal + ' 'Dim tTotalIVA, tTotalGral, tDiferenciaIVA, tIVA As Double + ' tTotalIVA = TxtIVA.Text.ToDecimal + ' tRetIVA = TxtRetIVA.Text.ToDecimal + ' tRetISR = TxtRetISR.Text.ToDecimal - ' 'tTotalIVA = tTotalIVA - tRetIVA - tRetISR + ' 'tTotalIVA = tTotalIVA - tRetIVA - tRetISR - ' tTotalGral = TxtTotal.Text.ToDecimal + tRetIVA + tRetISR ' EL TOTAL GENERAL DEBE DE SER EL SUBTOTAL + IVA, NO SE DEBEN DE INCLUIR LAS RETENCIONES, POR ESO SE RESTA - ' tDiferenciaIVA = tTotalIVA + ' tTotalGral = TxtTotal.Text.ToDecimal + tRetIVA + tRetISR ' EL TOTAL GENERAL DEBE DE SER EL SUBTOTAL + IVA, NO SE DEBEN DE INCLUIR LAS RETENCIONES, POR ESO SE RESTA + ' tDiferenciaIVA = tTotalIVA - ' ipresup = 0 + ' ipresup = 0 - ' Dim CuentaMatrizAlmacen As Integer + ' Dim CuentaMatrizAlmacen As Integer - ' 'PresupuestoEgresos - ' Dim DtPresupuestosTemp As DataTable - ' Dim IdCuentaComprometido, IdCuentaPorEjercer, IdCuentaDevengado, IdCuentaMatriz As Integer - ' ' Dim DescuentoConIVA As Decimal - ' Dim tPorIVA As Decimal = tTotalIVA / (tTotalGral - tTotalIVA) - ' Dim tAjusteTotal As Decimal + ' 'PresupuestoEgresos + ' Dim DtPresupuestosTemp As DataTable + ' Dim IdCuentaComprometido, IdCuentaPorEjercer, IdCuentaDevengado, IdCuentaMatriz As Integer + ' ' Dim DescuentoConIVA As Decimal + ' Dim tPorIVA As Decimal = tTotalIVA / (tTotalGral - tTotalIVA) + ' Dim tAjusteTotal As Decimal - ' For Each grp In Presup - ' Importe = grp.TotalImporte - ' TotalDetalle += Importe - ' ipresup += 1 - ' If Importe > 0 Then - ' 'saco la proporcion de iva que le corresponde - ' tIVA = Math.Round(Importe * tPorIVA, 2) - ' tDiferenciaIVA -= tIVA - ' 'identifico si es el ultimo registro, para ver si es necesario un ajuste - ' If ipresup = Presup.Count Then - ' If Math.Round(TotalDetalle - tTotalGral, 2) <= 0.01 AndAlso tDiferenciaIVA > 0 Then - ' tIVA += tDiferenciaIVA - ' End If - ' End If + ' For Each grp In Presup + ' Importe = grp.TotalImporte + ' TotalDetalle += Importe + ' ipresup += 1 + ' If Importe > 0 Then + ' 'saco la proporcion de iva que le corresponde + ' tIVA = Math.Round(Importe * tPorIVA, 2) + ' tDiferenciaIVA -= tIVA + ' 'identifico si es el ultimo registro, para ver si es necesario un ajuste + ' If ipresup = Presup.Count Then + ' If Math.Round(TotalDetalle - tTotalGral, 2) <= 0.01 AndAlso tDiferenciaIVA > 0 Then + ' tIVA += tDiferenciaIVA + ' End If + ' End If - ' 'le sumo el iva al concepto - ' Importe += tIVA + ' 'le sumo el iva al concepto + ' Importe += tIVA - ' 'codigo Provisional, para cuand tenga descuento, solo tome el subtotal * el iva,RMF - ' If TxtDescuento.Text.ToDouble > 0 Then - ' Importe = grp.TotalImporte * 1.16D - ' End If + ' 'codigo Provisional, para cuand tenga descuento, solo tome el subtotal * el iva,RMF + ' If TxtDescuento.Text.ToDouble > 0 Then + ' Importe = grp.TotalImporte * 1.16D + ' End If - ' tAjusteTotal += Importe - ' 'valido que la sumas de lo detalles no exceda al totalgeneral - ' If Math.Round(tAjusteTotal, 2) > tTotalGral Then - ' 'le resto la diferencia - ' Importe -= (tAjusteTotal - tTotalGral) - ' End If + ' tAjusteTotal += Importe + ' 'valido que la sumas de lo detalles no exceda al totalgeneral + ' If Math.Round(tAjusteTotal, 2) > tTotalGral Then + ' 'le resto la diferencia + ' Importe -= (tAjusteTotal - tTotalGral) + ' End If - ' 'Presupuesto Egresos - ' DtPresupuestosTemp = DtPresupuestos.FiltraParametros(String.Format("CvePresupuestoEgreso = {0}", grp.CvePresupuestoEgreso)) - ' If DtPresupuestosTemp.Rows.Count <> 1 Then - ' ErrorAC = True - ' ErrorACMEnsaje.Append(" - DtPresupuestosTemp.Rows.Count <> 1 ") - ' Exit For - ' End If - ' IdCuentaComprometido = DtPresupuestosTemp.Rows(0)("IdCuentaComprometido").ToString.ToEntero - ' IdCuentaPorEjercer = DtPresupuestosTemp.Rows(0)("IdCuentaPorEjercer").ToString.ToEntero - ' IdCuentaDevengado = DtPresupuestosTemp.Rows(0)("IdCuentaDevengado").ToString.ToEntero - ' IdCuentaMatriz = DtPresupuestosTemp.Rows(0)("IdCuentaMatriz").ToString.ToEntero + ' 'Presupuesto Egresos + ' DtPresupuestosTemp = DtPresupuestos.FiltraParametros(String.Format("CvePresupuestoEgreso = {0}", grp.CvePresupuestoEgreso)) + ' If DtPresupuestosTemp.Rows.Count <> 1 Then + ' ErrorAC = True + ' ErrorACMEnsaje.Append(" - DtPresupuestosTemp.Rows.Count <> 1 ") + ' Exit For + ' End If + ' IdCuentaComprometido = DtPresupuestosTemp.Rows(0)("IdCuentaComprometido").ToString.ToEntero + ' IdCuentaPorEjercer = DtPresupuestosTemp.Rows(0)("IdCuentaPorEjercer").ToString.ToEntero + ' IdCuentaDevengado = DtPresupuestosTemp.Rows(0)("IdCuentaDevengado").ToString.ToEntero + ' IdCuentaMatriz = DtPresupuestosTemp.Rows(0)("IdCuentaMatriz").ToString.ToEntero - ' 'COMPROMETIDO DEPENDIENTE SI EXISTE SU POLIZA - ' If grp.CveOrdencompraDetalle = -1 Then - ' ConceptoRenglon = String.Format("GC Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) - ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then - ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaPorEjercer, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then - ' ErrorAC = True - ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 1") - ' Exit For - ' End If - ' Else - ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 2") - ' ErrorAC = True - ' Exit For - ' End If - ' End If + ' 'COMPROMETIDO DEPENDIENTE SI EXISTE SU POLIZA + ' If grp.CveOrdencompraDetalle = -1 Then + ' ConceptoRenglon = String.Format("GC Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) + ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaPorEjercer, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ' ErrorAC = True + ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 1") + ' Exit For + ' End If + ' Else + ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 2") + ' ErrorAC = True + ' Exit For + ' End If + ' End If - ' ConceptoRenglon = String.Format("GD Fact:{0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) - ' 'DEVENGADO - ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaDevengado, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then - ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then - ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 3") - ' ErrorAC = True - ' Exit For - ' End If - ' Else - ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 4") - ' ErrorAC = True - ' Exit For - ' End If + ' ConceptoRenglon = String.Format("GD Fact:{0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) + ' 'DEVENGADO + ' If ObjContaAC.AddMovimiento(IdPoliza, IdCuentaDevengado, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ' If Not ObjContaAC.AddMovimiento(IdPoliza, IdCuentaComprometido, True, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 3") + ' ErrorAC = True + ' Exit For + ' End If + ' Else + ' ErrorACMEnsaje.Append(" - Error al agregar movimiento contabilidad 4") + ' ErrorAC = True + ' Exit For + ' End If - ' If ContadorInventario > 0 Then + ' If ContadorInventario > 0 Then - ' ' CuentaMatrizAlmacen = CtaAlmacen - ' ElseIf grp.CveActivoFijo > 0 Then + ' ' CuentaMatrizAlmacen = CtaAlmacen + ' ElseIf grp.CveActivoFijo > 0 Then - ' Dim CtaAF As Integer = -1 - ' Dim AF As String = "" - ' Dim CuentaInicial As Integer = -1 + ' Dim CtaAF As Integer = -1 + ' Dim AF As String = "" + ' Dim CuentaInicial As Integer = -1 - ' If ObjAF.GetActivosFijos(grp.CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1, UsuarioActual.CveEmpresa) Then - ' CtaAF = ObjAF.Cuenta - ' AF = ObjAF.Descripcion - ' CuentaInicial = ObjAF.CuentaInicial - ' Else - ' ErrorAC = True - ' ErrorACMEnsaje.Append(" - Error al obtener activos fijos ") - ' Exit For - ' End If + ' If ObjAF.GetActivosFijos(grp.CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1, UsuarioActual.CveEmpresa) Then + ' CtaAF = ObjAF.Cuenta + ' AF = ObjAF.Descripcion + ' CuentaInicial = ObjAF.CuentaInicial + ' Else + ' ErrorAC = True + ' ErrorACMEnsaje.Append(" - Error al obtener activos fijos ") + ' Exit For + ' End If - ' If Not CuentaInicial > 0 Then - ' CuentaInicial = 1241 - ' End If + ' If Not CuentaInicial > 0 Then + ' CuentaInicial = 1241 + ' End If - ' 'CUENTA AF - ' If CtaAF <= 0 Then - ' If ObjContaAC.GetCuentas(-1, String.Format("0{0}0000000000000", CuentaInicial), -1) Then - ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("") - ' If drCuenta IsNot Nothing Then - ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nula") - ' CuentaAbono = drCuenta("Id").ToString.ToEntero - ' Dim FolioAF As String = ObjContaAC.GetFolioProveedores(String.Format("0{0}0000000000000", CuentaInicial)).ToString - ' CtaAF = ObjContaAC.AddCuenta(String.Format("0{0}{1}000000000", CuentaInicial, FolioAF.PadLeft(4, "0"c)), AF, "A", 2, 0, 1, 0, "", 1, CuentaAbono) + ' 'CUENTA AF + ' If CtaAF <= 0 Then + ' If ObjContaAC.GetCuentas(-1, String.Format("0{0}0000000000000", CuentaInicial), -1) Then + ' Dim drCuenta As DataRow = ObjContaAC.DtResultados.FiltroPrimero("") + ' If drCuenta IsNot Nothing Then + ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nula") + ' CuentaAbono = drCuenta("Id").ToString.ToEntero + ' Dim FolioAF As String = ObjContaAC.GetFolioProveedores(String.Format("0{0}0000000000000", CuentaInicial)).ToString + ' CtaAF = ObjContaAC.AddCuenta(String.Format("0{0}{1}000000000", CuentaInicial, FolioAF.PadLeft(4, "0"c)), AF, "A", 2, 0, 1, 0, "", 1, CuentaAbono) - ' ObjAF.UpdateActivosFijosCuentaAC(grp.CveActivoFijo, CtaAF, UsuarioActual.CveUsuario) - ' Else - ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nulo") - ' ErrorAC = True - ' End If - ' Else - ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000") - ' ErrorAC = True - ' End If - ' End If + ' ObjAF.UpdateActivosFijosCuentaAC(grp.CveActivoFijo, CtaAF, UsuarioActual.CveUsuario) + ' Else + ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000 drCuenta nulo") + ' ErrorAC = True + ' End If + ' Else + ' ErrorACMEnsaje.Append(" - Error al obtener cuentas 0{0}0000000000000") + ' ErrorAC = True + ' End If + ' End If - ' CuentaMatrizAlmacen = CtaAF - ' Else - ' CuentaMatrizAlmacen = IdCuentaMatriz - ' End If + ' CuentaMatrizAlmacen = CtaAF + ' Else + ' CuentaMatrizAlmacen = IdCuentaMatriz + ' End If - ' ''AFECTAR MATRIZ EGRESOS - ' If ObjContaAC.AddMovimiento(IdPoliza, CuentaMatrizAlmacen, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ' ''AFECTAR MATRIZ EGRESOS + ' If ObjContaAC.AddMovimiento(IdPoliza, CuentaMatrizAlmacen, False, MultiplicadorNC * Importe, "", ConceptoRenglon, 0, Fecha, "") Then - ' ''VERIFICA SI TIENE DESCUENTO (AMORTIZACION) - ' 'If TxtDescuento.Text.ToDouble > 0 Then - ' ' DescuentoConIVA = TxtDescuento.Text.ToDouble * 1.16 + ' ''VERIFICA SI TIENE DESCUENTO (AMORTIZACION) + ' 'If TxtDescuento.Text.ToDouble > 0 Then + ' ' DescuentoConIVA = TxtDescuento.Text.ToDouble * 1.16 - ' ' 'Valida que el descuento con iva cuadre en los totales - ' ' If Math.Abs(DescuentoConIVA - (Importe - TxtTotal.Text.ToDouble)) < 0.02 Then - ' ' DescuentoConIVA = Importe - TxtTotal.Text.ToDouble - ' ' ElseIf DescuentoConIVA <> (Importe - TxtTotal.Text.ToDouble) Then - ' ' ErrorAC = True - ' ' Exit For - ' ' End If + ' ' 'Valida que el descuento con iva cuadre en los totales + ' ' If Math.Abs(DescuentoConIVA - (Importe - TxtTotal.Text.ToDouble)) < 0.02 Then + ' ' DescuentoConIVA = Importe - TxtTotal.Text.ToDouble + ' ' ElseIf DescuentoConIVA <> (Importe - TxtTotal.Text.ToDouble) Then + ' ' ErrorAC = True + ' ' Exit For + ' ' End If - ' ' 'actualizo el idcuenta del presupuesto - ' ' If ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, Importe - DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then - ' ' 'agrego a la cuenta contable anticipos - ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, CtaProveedorAnticipos, True, DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then - ' ' ErrorAC = True - ' ' Exit For - ' ' End If - ' ' Else - ' ' ErrorAC = True - ' ' Exit For - ' ' End If + ' ' 'actualizo el idcuenta del presupuesto + ' ' If ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, Importe - DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then + ' ' 'agrego a la cuenta contable anticipos + ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, CtaProveedorAnticipos, True, DescuentoConIVA, "", ConceptoRenglon, 0, Fecha, "") Then + ' ' ErrorAC = True + ' ' Exit For + ' ' End If + ' ' Else + ' ' ErrorAC = True + ' ' Exit For + ' ' End If - ' 'Else - ' ' 'actualizo el idcuenta del presupuesto - ' ' Importe = TxtTotal.Text.ToDouble - ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe), "", ConceptoRenglon, 0, Fecha, "") Then - ' ' ErrorAC = True - ' ' Exit For - ' ' End If + ' 'Else + ' ' 'actualizo el idcuenta del presupuesto + ' ' Importe = TxtTotal.Text.ToDouble + ' ' If Not ObjContaAC.AddMovimiento(123456, IdPoliza, tIdContaProveedor, True, If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe), "", ConceptoRenglon, 0, Fecha, "") Then + ' ' ErrorAC = True + ' ' Exit For + ' ' End If - ' 'End If + ' 'End If - ' Else - ' ErrorACMEnsaje.Append(" - Error AFECTAR MATRIZ EGRESOS ObjContaAC.AddMovimiento") - ' ErrorAC = True - ' Exit For - ' End If - ' ''TERMINA AFECTAR MATRIZ EGRESOS + ' Else + ' ErrorACMEnsaje.Append(" - Error AFECTAR MATRIZ EGRESOS ObjContaAC.AddMovimiento") + ' ErrorAC = True + ' Exit For + ' End If + ' ''TERMINA AFECTAR MATRIZ EGRESOS - ' Else - ' ErrorACMEnsaje.Append(" - For Each grp In Presup Importe > 0 ") - ' ErrorAC = True - ' Exit For - ' End If + ' Else + ' ErrorACMEnsaje.Append(" - For Each grp In Presup Importe > 0 ") + ' ErrorAC = True + ' Exit For + ' End If - ' Next + ' Next - ' ''actualizo el idcuenta del presupuesto - ' 'Importe = TxtTotal.Text.ToDecimal - ' 'If Not ObjContaAC.AddMovimiento(IdPoliza, tIdContaProveedor, True, MultiplicadorNC * (If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe)), "", ConceptoRenglon, 0, Fecha, "") Then - ' ' ErrorACMEnsaje.Append(" - actualizo el idcuenta del presupuesto ObjContaAC.AddMovimiento 3") - ' ' ErrorAC = True - ' 'End If - ' 'End If + ' ''actualizo el idcuenta del presupuesto + ' 'Importe = TxtTotal.Text.ToDecimal + ' 'If Not ObjContaAC.AddMovimiento(IdPoliza, tIdContaProveedor, True, MultiplicadorNC * (If(ArrAnticipos.Count > 0, ImporteAnticipo, Importe)), "", ConceptoRenglon, 0, Fecha, "") Then + ' ' ErrorACMEnsaje.Append(" - actualizo el idcuenta del presupuesto ObjContaAC.AddMovimiento 3") + ' ' ErrorAC = True + ' 'End If + ' 'End If - ' 'If tRetISR > 0 Then 'CtaProveedorRetISR - ' ' ConceptoRenglon = String.Format("GD Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) - ' ' If Not ObjContaAC.AddMovimiento(IdPoliza, 0, True, MultiplicadorNC * tRetISR, "", ConceptoRenglon, 0, Fecha, "") Then - ' ' ErrorACMEnsaje.Append(" RetISR > 0 ObjContaAC.AddMovimiento") - ' ' ErrorAC = True - ' ' End If - ' 'End If + ' 'If tRetISR > 0 Then 'CtaProveedorRetISR + ' ' ConceptoRenglon = String.Format("GD Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text) + ' ' If Not ObjContaAC.AddMovimiento(IdPoliza, 0, True, MultiplicadorNC * tRetISR, "", ConceptoRenglon, 0, Fecha, "") Then + ' ' ErrorACMEnsaje.Append(" RetISR > 0 ObjContaAC.AddMovimiento") + ' ' ErrorAC = True + ' ' End If + ' 'End If - ' 'TERMINA: PRUEBA AGRUPACION CONCEPTOS + ' 'TERMINA: PRUEBA AGRUPACION CONCEPTOS - ' 'registrar amortizar anticipos - ' End If + ' 'registrar amortizar anticipos + ' End If - ' Else - ' ErrorACMEnsaje.Append(" - Id Poliza = 0 ") - ' ErrorAC = True - ' End If - ' Else - ' TieneError = True - ' ErrorACMEnsaje.Append("- TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0") - ' ErrorAC = True - ' End If - 'End If - '-------FIN U S A A C ------------------------------------------------------------------- + ' Else + ' ErrorACMEnsaje.Append(" - Id Poliza = 0 ") + ' ErrorAC = True + ' End If + ' Else + ' TieneError = True + ' ErrorACMEnsaje.Append("- TotalPorDevengar <= TxtTotal.Text.ToDouble And TotalPorDevengar > 0") + ' ErrorAC = True + ' End If + 'End If + '-------FIN U S A A C ------------------------------------------------------------------- - If Not ErrorAC AndAlso Not TieneError Then + If Not ErrorAC AndAlso Not TieneError Then Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" @@ -7638,12 +7641,12 @@ Partial Class Compras_Compras Dim Msg As New StringBuilder Msg.Append("La compra se registró correctamente") - If Not ErrorPrepoliza AndAlso UsuarioActual.Empresa.TipoContabilidad = 1 AndAlso ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=4) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Compras/Compras-Guardar | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - ErrorPrepolizaDescuadre = True - End If - End If + 'If Not ErrorPrepoliza AndAlso UsuarioActual.Empresa.TipoContabilidad = 1 AndAlso ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=4) Then + ' If ObjConta.ValorPolizaDescuadre > 0 Then + ' GuardaLogAD($"Compras/Compras-Guardar | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + ' ErrorPrepolizaDescuadre = True + ' End If + 'End If 'ACTUALIZA CVEFACTURA If Request("CveFactura") IsNot Nothing Then @@ -13869,14 +13872,18 @@ Partial Class Compras_Compras End If End If + Dim dttpagos As DataTable = New DataTable ' 2024-11-13 OIC Esta ubicado antes de Refacturacion por que al refacturar los datos de pago dejan de estar disponibles dttpagos sellena antes + If ObjCompra.GetComprasPagos(CveCompraRefacturacion, UsuarioActual.CveEmpresa) Then + dttpagos = ObjCompra.DtResultados + End If + Dim Tipo As Integer = 1 If ChkRefacNC.Checked Then Tipo = 2 'CONTABILIZA REFACTURACION If ObjCompra.Refacturacion(CveCompraRefacturacion, CveCompra, UsuarioActual.CveEmpresa, Tipo) Then - Dim dttpagos As DataTable - If ObjCompra.GetComprasPagos(CveCompraRefacturacion, UsuarioActual.CveEmpresa) Then - dttpagos = ObjCompra.DtResultados + + If dttpagos IsNot Nothing AndAlso dttpagos.Rows.Count > 0 Then For Each drp As DataRow In dttpagos.Rows Dim Pago As New CompraPago @@ -13885,22 +13892,17 @@ Partial Class Compras_Compras Pago.CveMonedaPago = 1 Pago.CveCompraAmortizacion = -1 Pago.TipoPago = If(drp("CveIE").ToString.ToEntero > 0, "B", "NC") - Dim ErrorMovtosCxP As Boolean = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) Next - End If - Else ErrorBitacora = True End If - - - 'Return True Return ErrorBitacora + End Function Private Function GuardaRefacturacionBitacora(ObjCompra As ClsCompras, ObjEventos As ClsOIEventos) As Boolean diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 031d3d505..31475c28c 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -1686,7 +1686,7 @@ Partial Class Compras_eFacturas fpdf = fpdf.Replace($"{fpdfSplit(0)}-", "") End If - If fxml.Contains(fpdf) Then + If fxml.Contains(fpdf) Or (ListXML.Count = 1 And ListPDF.Count = 1) Then RutaPDF = fInfoPDF.FullName Exit For End If @@ -7985,6 +7985,9 @@ Namespace ADS.eFacturas GuardaLogAD(ex.ToString(), ArchivoLog) End Try + + ElseIf Fact.RespuestaInsert = 0 AndAlso Fact.CveFactura > 0 Then + 'FIXME OIC Else rowLog("Motivo") = $"RFC ""{Fact.ReceptorRFC}"" Error al insertar" End If diff --git a/Empresas/189/Formatos/OC.rdlc b/Empresas/189/Formatos/OC.rdlc index 94bf87649..48b328f60 100644 --- a/Empresas/189/Formatos/OC.rdlc +++ b/Empresas/189/Formatos/OC.rdlc @@ -504,7 +504,7 @@ =CStr(RowNumber(Nothing)) @@ -535,14 +535,14 @@ =Fields!Cantidad.Value @@ -553,6 +553,7 @@ + true @@ -567,13 +568,13 @@ =Fields!UM.Value @@ -598,7 +599,7 @@ =Fields!CodPS.Value @@ -629,7 +630,7 @@ =Fields!Producto.Value @@ -658,7 +659,7 @@ =Fields!Obs.Value @@ -687,7 +688,7 @@ =Fields!Importe.Value @@ -823,7 +824,7 @@ I.V.A. @@ -833,7 +834,7 @@ Textbox20 - 1.84536cm + 1.76972cm 15.76748cm 0.45183cm 2.5cm @@ -857,7 +858,7 @@ TOTAL: @@ -867,7 +868,7 @@ Textbox20 - 3.94467cm + 3.86903cm 15.77277cm 0.45183cm 2.5cm @@ -892,7 +893,7 @@ =Parameters!IVA.Value @@ -904,7 +905,7 @@ Textbox20 - 1.84536cm + 1.76972cm 18.26748cm 0.45183cm 2.4365cm @@ -930,7 +931,7 @@ =Parameters!Total.Value @@ -942,7 +943,7 @@ Textbox20 - 3.94467cm + 3.86903cm 18.27277cm 0.45183cm 2.43121cm @@ -968,7 +969,7 @@ SUB-TOTAL @@ -978,7 +979,7 @@ Textbox20 - 0.40195cm + 0.32631cm 15.76748cm 0.45183cm 2.5cm @@ -1003,7 +1004,7 @@ =Parameters!SubTotal.Value @@ -1015,8 +1016,8 @@ Textbox20 - 0.40195cm - 18.26748cm + 0.32631cm + 18.29588cm 0.45183cm 2.4365cm 5 @@ -1050,7 +1051,7 @@ Textbox46 - 4.05051cm + 4.13362cm 0.00001cm 0.45183cm 15.04926cm @@ -1080,7 +1081,7 @@ Textbox5 - 0.11768cm + 0.04204cm 0.14316cm 20.70398cm 7 @@ -1112,7 +1113,7 @@ Textbox5 - 3.73096cm + 3.65532cm 15.22566cm 0.14316cm 5.47753cm @@ -1145,7 +1146,7 @@ Textbox5 - 4.50233cm + 4.42669cm 15.22566cm 0.14502cm 5.47832cm @@ -1186,7 +1187,7 @@ Textbox1 - 0.43723cm + 0.36159cm 0.03529cm 0.41479cm 14.67376cm @@ -1211,7 +1212,7 @@ Ret I.V.A @@ -1221,7 +1222,7 @@ Textbox20 - 2.29719cm + 2.22155cm 15.76669cm 0.45183cm 2.5cm @@ -1249,7 +1250,7 @@ =Parameters!RetIVA.Value @@ -1261,7 +1262,7 @@ Textbox20 - 2.29719cm + 2.22155cm 18.26669cm 0.45183cm 2.4365cm @@ -1290,7 +1291,7 @@ Ret I.S.R @@ -1300,7 +1301,7 @@ Textbox20 - 2.74902cm + 2.67338cm 15.76669cm 0.45183cm 2.5cm @@ -1328,7 +1329,7 @@ =Parameters!RetISR.Value @@ -1340,7 +1341,7 @@ Textbox20 - 2.74902cm + 2.67338cm 18.26669cm 0.45183cm 2.4365cm @@ -1369,7 +1370,7 @@ I.E.P.S @@ -1379,7 +1380,7 @@ Textbox20 - 3.20085cm + 3.12521cm 15.76669cm 0.45183cm 2.5cm @@ -1407,7 +1408,7 @@ =Sum(Fields!IEPS.Value, "DsOC") @@ -1419,7 +1420,7 @@ Textbox20 - 3.20085cm + 3.12521cm 18.26669cm 0.45183cm 2.4365cm @@ -1448,7 +1449,7 @@ DESCUENTO @@ -1458,7 +1459,7 @@ Textbox20 - 0.88906cm + 0.81342cm 15.77355cm 0.45183cm 2.5cm @@ -1486,7 +1487,7 @@ =Parameters!Descuento.Value @@ -1498,7 +1499,7 @@ Textbox20 - 0.88906cm + 0.81342cm 18.27355cm 0.45183cm 2.4365cm @@ -1527,7 +1528,7 @@ SUB-TOTAL2 @@ -1537,7 +1538,7 @@ Textbox20 - 1.34089cm + 1.26525cm 15.77355cm 0.45183cm 2.5cm @@ -1565,7 +1566,7 @@ =Parameters!SubTotal2.Value @@ -1577,7 +1578,7 @@ Textbox20 - 1.34089cm + 1.26525cm 18.27355cm 0.45183cm 2.4365cm @@ -1598,10 +1599,10 @@ true - 1.12516cm + 1.04205cm 0.12849cm - 5.34083cm - 20.71005cm + 5.42394cm + 20.73238cm 1 - + + + + + 4 + true @@ -2226,7 +2227,7 @@ - RFC del proveedor de cretificación: + RFC del proveedor de certificación: - true diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 0ca5a6ff9..4d1b16a83 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -152,20 +152,19 @@ -
- -
- - - -
-
- -
-
+
+ +
+ + + +
+
+
+
@@ -388,10 +387,11 @@
-
+
+
+ - - Descargar + Descargar @@ -473,11 +473,9 @@ Subir Archivo - - - - + +
@@ -1147,6 +1145,7 @@
+ <%--Modal subir archivo--%> @@ -1220,6 +1219,7 @@