This commit is contained in:
2023-05-25 20:28:00 -07:00
62 changed files with 11187 additions and 60066 deletions

View File

@@ -2,6 +2,7 @@
Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports System.Globalization
Imports System.IO
Imports System.Net
@@ -2663,9 +2664,13 @@ Partial Class Clientes
ObjContaAC.Dispose()
End If
Dim CodigoCuentaAltaCompaq As String = ""
Dim NombreCuentaCuentaAltaCompaq As String = ""
Dim IdCuentaAltaCompaq As Integer = -1
'Si tiene contabilizacion automatica y la funcionalidad de carga cuenta automatica o UsaAC le agregamos automaticamente una cuenta al cliente
If UsuarioActual.Empresa.Funcionalidad(211).ToEntero() > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(200).ToEntero() > 0 Or UsuarioActual.Empresa.UsaAC) AndAlso DdlCtaContableClientes.SelectedValue.ToEntero() < 1 Then
If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes) Then
If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq) Then
ErrorProceso = True
End If
End If
@@ -2745,6 +2750,10 @@ Partial Class Clientes
End If
End If
If Not AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, ObjClientes.IniciaTransacSQL) Then
ErrorProceso = True
End If
If ErrorProceso Then
ObjClientes.RollBack()
@@ -3836,18 +3845,18 @@ Partial Class Clientes
Dim Button = DirectCast(sender, Button)
Select Case CuentaContable
Case "Clientes"
AgregarCuentaContable(Button, DdlCtaContableClientes)
AgregarCuentaContable(Button, DdlCtaContableClientes, "", "", -1)
Case "Anticipos"
AgregarCuentaContable(Button, DdlCtaContableAnticipos)
AgregarCuentaContable(Button, DdlCtaContableAnticipos, "", "", -1)
Case "RetIVA"
AgregarCuentaContable(Button, DdlCtaContableRetIVA)
AgregarCuentaContable(Button, DdlCtaContableRetIVA, "", "", -1)
Case "RetISR"
AgregarCuentaContable(Button, DdlCtaContableRetISR)
AgregarCuentaContable(Button, DdlCtaContableRetISR, "", "", -1)
End Select
End Sub
Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList) As Boolean
Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList, ByRef CodigoCuentaAltaCompaq As String, ByRef NombreCuentaCuentaAltaCompaq As String, ByRef IdCuentaAltaCompaq As Integer) As Boolean
Dim IdCuentaContable As Integer = -1
Dim CtaCodigo As String = ""
Dim TieneError = False
@@ -3856,6 +3865,8 @@ Partial Class Clientes
Dim ObjContaAC As New ClsContPAQi(UsuarioActual.Empresa)
ObjContaAC.IniciaTransacSQL()
Dim CuentaPadre = -1
@@ -3875,7 +3886,13 @@ Partial Class Clientes
'SI EL NOMBRE DEL PROVEEDOR ES MAYOR DE 50 LO CORTAMOS
Dim NombreCuenta = If(TxtNombreComercial.Text.Trim.Length > 50, TxtNombreComercial.Text.Trim.Substring(0, 50), TxtNombreComercial.Text.Trim)
IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(CuentaPadre, NombreCuenta, Tipo:="A", CuentaMayor:=2)
NombreCuentaCuentaAltaCompaq = NombreCuenta
IdCuentaAltaCompaq = IdCuentaContable
If IdCuentaContable > 0 Then
ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1)
@@ -3884,7 +3901,9 @@ Partial Class Clientes
If dt.Rows.Count = 1 Then
Dim row As DataRow = dt.Rows(0)
CtaCodigo = CStr(row("CtaCodigo"))
CodigoCuentaAltaCompaq = CStr(row("Codigo"))
Select Case btn.CommandArgument.ToString()
Case "Clientes"
@@ -3906,8 +3925,6 @@ Partial Class Clientes
ObjClientes.Dispose()
End If
Else
TieneError = True
End If
@@ -3916,6 +3933,9 @@ Partial Class Clientes
TieneError = True
End If
If Not TieneError Then
ObjContaAC.Commit()
Alert(String.Format("Se registo la Cuenta Contable: {0}", CtaCodigo, TipoMensaje.MsgInformacion))
@@ -3937,6 +3957,33 @@ Partial Class Clientes
Return ProcesoCorrecto
End Function
Private Function AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq As String, NombreCuentaCuentaAltaCompaq As String, IdCuentaAltaCompaq As Integer, Transaccion As SqlTransaction) As Boolean
Dim ObjContabilidad As New ClsContabilidad(Transaccion)
Dim Respuesta As Boolean = False
If UsuarioActual.CveEmpresa.Contiene(7, 11, 145, 122) Then
If ObjContabilidad.GetCuentasGlobales(UsuarioActual.CveEmpresa, 1) Then
Dim CvePadre As Integer = ObjContabilidad.DtResultados.FiltroPrimeroValor("CveCuenta").ToEntero
If CvePadre > 0 Then
If ObjContabilidad.AddCuenta(CvePadre, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, "A", 2, 1, CveCliente:=CveCliente, IdCompaq:=IdCuentaAltaCompaq) > 0 Then
Respuesta = True
End If
End If
End If
'If ObjContabilidad.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, 7, -1, 1) Then
'End If
End If
Return Respuesta
End Function
Private Sub ActivarRegistroAutomatico()
'Clientes

View File

@@ -2514,7 +2514,7 @@ Partial Class Ventas_ClientesAbonar
End If
If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=gr.DataKey("PorcetajeIVA").ToDecimal, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=gr.DataKey("PorcentajeIVA").ToDecimal, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If

View File

@@ -13825,6 +13825,7 @@ Partial Class Ventas
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim CveCuentaContabilizacion As Integer = 1
Dim tipoCambio As Decimal
Dim TCPago As Decimal = 1
Dim CuentasContablesInvalidasSIG As New StringBuilder
@@ -13838,6 +13839,7 @@ Partial Class Ventas
If ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio > 0 Then
tipoCambio = ObjFactura.TipoCambio
TCPago = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToString().ToDecimal
ElseIf ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio <= 1 Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambio = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToString().ToDecimal
@@ -14065,13 +14067,16 @@ Partial Class Ventas
End If
Dim TipoCambioNC As Decimal = 1
If tipoCambio > 1 Then
TipoCambioNC = tipoCambio
Else
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToDecimal
If ObjFactura.CveMoneda = 2 Then
If tipoCambio > 1 Then
TipoCambioNC = tipoCambio
Else
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToDecimal
Else
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
End If
End If
@@ -14106,7 +14111,7 @@ Partial Class Ventas
Pago.CveVentaAmortizacion = ObjFactura.CveVenta 'Dr("CveVenta").ToString().ToEntero()
Pago.AplicaTraslado = False
Pago.Referencia = Concepto
Pago.CveConceptoPago = 251
'Pago.CveConceptoPago = 251
ErrorPrepoliza = AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta)
@@ -14137,11 +14142,14 @@ Partial Class Ventas
'SI LA NC ES EN DOLARES Y PERO VIENE DE UN ANTICIPO EN PESOS
If (Not UsuarioActual.CveEmpresa.Contiene(72, 80, 146)) AndAlso ObjFactura.CveMoneda = 2 Then
Dim tipoCambioAnticipo As Decimal = 1D
Dim tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate).ToDecimal
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate.AddDays(-1)).ToDecimal
If CveMonedaAnticipo = 2 Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate.AddDays(-1)).ToDecimal
Else
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate).ToDecimal
End If
End If
@@ -14167,23 +14175,24 @@ Partial Class Ventas
End If
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 292, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
'Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 292, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 292, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContMonedaExtranjera, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 292, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContMonedaExtranjera, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
' ErrorPrepoliza = True
' Exit For
'End If
Else
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Importe11MX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
ViewState("SeGuardoPrePoliza") = True
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'ViewState("SeGuardoPrePoliza") = True
'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
' ErrorPrepoliza = True
' Exit For
'End If
'se hace acreditamiento de impuestos
'IVA X TRASLADAR
Dim EsAnticipoEspecial As Boolean = False
@@ -16460,7 +16469,7 @@ Partial Class Ventas
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
Pago.CveConceptoPago = 251
'Pago.CveConceptoPago = 251
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
SimplificaPrePoliza = False
@@ -19310,6 +19319,7 @@ Partial Class Ventas
DrPoliza("TotalImporte") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
DrPoliza("CveActivoFijo") = -1
TmpDT.Rows.Add(DrPoliza)
End If
@@ -21956,6 +21966,7 @@ Partial Class Ventas
drt("CveOSDetalle") = dr("CveOSDetalle")
drt("CveSubProyecto") = dr("CveSubProyecto")
drt("SubProyecto") = dr("SubProyecto")
drt("CveActivoFijo") = -1
TmpDT.Rows.Add(drt)
Cons = Cons + 1
Next
@@ -30085,6 +30096,7 @@ Partial Class Ventas
Row("CveVentaDetalleRNC") = CveVentaDetalleRNC
Row("CodigoObjetoImpuesto") = CodigoObjetoImpuesto
Row("CveActivoFijo") = -1
TmpDT.Rows.Add(Row)
End Sub
@@ -35008,6 +35020,7 @@ Partial Class Ventas
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveActivoFijo") = -1
TmpDT.Rows.Add(Row)
End Sub