Correciones Compras, Foramto OC 189, Formato CFDI GRales,RepContato detale correciones
This commit is contained in:
@@ -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()} <br>")
|
||||
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} <br>")
|
||||
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 <br>")
|
||||
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 <br>")
|
||||
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 <br>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user