-- limpieza de código de mandar idcta de contpaq

This commit is contained in:
2023-08-09 19:00:12 -07:00
parent eb4abbe9a5
commit 4e13b96c3a
90 changed files with 1583 additions and 10362 deletions

View File

@@ -13,81 +13,11 @@ Partial Class Bancos_DepositoTerminal
Set(value As String)
ViewState("NombreComercial") = value
End Set
End Property
Private Property IdCuentaBancaria As Integer
Get
Return ViewState("IdCuentaBancaria").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IdCuentaBancaria") = value
End Set
End Property
Private Property IdCuentaBancariaComplementaria As Integer
Get
Return ViewState("IdCuentaBancariaComplementaria").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IdCuentaBancariaComplementaria") = value
End Set
End Property
Private Property IdCuentaCliente As Integer
Get
Return ViewState("IdCuentaCliente").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IdCuentaCliente") = value
End Set
End Property
Private ReadOnly Property IdCtaContMonedaExtranjera As Integer
Get
Return ViewState("IdCtaContMonedaExtranjera").ToString.ToEntero
End Get
End Property
Private ReadOnly Property IdCtaContComplementaria As Integer
Get
Return ViewState("IdCtaContComplementaria").ToString.ToEntero
End Get
End Property
Private ReadOnly Property IdCtaContRetIVA As Integer
Get
Return ViewState("IdCtaContRetIVA").ToString.ToEntero
End Get
End Property
Private ReadOnly Property IdCtaContRetISR As Integer
Get
Return ViewState("IdCtaContRetISR").ToString.ToEntero
End Get
End Property
Private Property CveCuentaCliente As Integer
Get
Return ViewState("CveCuentaCliente").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveCuentaCliente") = value
End Set
End Property
Private ReadOnly Property CveCuentaMonedaExtranjera As Integer
Get
Return ViewState("CveCuentaMonedaExtranjera").ToString.ToEntero
End Get
End Property
Private ReadOnly Property CveCuentaComplementaria As Integer
Get
Return ViewState("CveCuentaComplementaria").ToString.ToEntero
End Get
End Property
Private ReadOnly Property CveCuentaRetIVA As Integer
Get
Return ViewState("CveCuentaRetIVA").ToString.ToEntero
End Get
End Property
Private ReadOnly Property CveCuentaRetISR As Integer
Get
Return ViewState("CveCuentaRetISR").ToString.ToEntero
End Get
End Property
#End Region
Private Sub Bancos_DepositoTerminal_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
TxtFecha.Text = Now.ToShortDateString
@@ -132,20 +62,8 @@ Partial Class Bancos_DepositoTerminal
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub DdlCuentaSelectIndexChange()
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuentaDeposito.SelectedValue)
If dr IsNot Nothing Then
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
IdCuentaBancariaComplementaria = dr("IdCtaContableComplementaria").ToString.ToEntero
Else
IdCuentaBancaria = 0
IdCuentaBancariaComplementaria = 0
'CveCuentaBancaria = 0
'CveCuentaBancariaComplementaria = 0
End If
Private Sub DdlCuentaSelectIndexChange()
If UsuarioActual.Empresa.Funcionalidad(505) <> "1" Then
Dim Folio As Long
Dim Banco As New ClsBancos
@@ -219,9 +137,7 @@ Partial Class Bancos_DepositoTerminal
Dim MsgError As String = ""
If drDestino IsNot Nothing Then
CveMoneda = drDestino("CveMoneda").ToString.ToEntero
IdCuentaBancariaDestino = drDestino("IdCtaContable").ToString.ToEntero
CveCuentaBancariaDestino = drDestino("IdCtaContableSIG").ToString.ToEntero
CveMoneda = drDestino("CveMoneda").ToString.ToEntero
End If
NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Ventas", 11, TotalImporte, TotalImporte, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
@@ -232,9 +148,7 @@ Partial Class Bancos_DepositoTerminal
If NuevaCvePrePoliza > 0 Then
Dim PorcentajePago As Decimal = 1
Dim CvePlantillaPoliza As Integer = 11
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim idCuentaContabilizacion As Long = 1
Dim CveCuentaContabilizacion As Long = 1
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim dtConceptos As DataTable = Nothing
Dim tipoCambioVenta As Decimal
Dim tipoCambioActual As Decimal
@@ -250,18 +164,8 @@ Partial Class Bancos_DepositoTerminal
If gvr.FCCheckBox("ChkFactura").Checked Then
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1) Then
NombreComercial = ObjCliente.NombreComercial
ViewState("CtaCliente") = ObjCliente.IdCtaContClientes
ViewState("IdCuentaCliente") = ObjCliente.IdCtaContClientes
ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera
ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria
ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA
ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR
IdCuentaBancaria = 0
'CveCuentaBancaria = 0
NombreComercial = ObjCliente.NombreComercial
End If
If gvr.DataKey("CveMoneda").ToEntero = 2 Then
tipoCambioVenta = GlobalTipoCambio(gvr.FCLiteral("LtlFecha").Text.ToDate).ToString.ToDecimal
tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal
@@ -271,8 +175,6 @@ Partial Class Bancos_DepositoTerminal
tipoCambioActual = 1
tipoCambioManual = 1
End If
If dtConceptos IsNot Nothing Then
For Each Row As DataRow In dtConceptos.Rows
@@ -280,8 +182,7 @@ Partial Class Bancos_DepositoTerminal
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False)
Dim ImporteMovimiento As Decimal = 0
Dim importeMX As Decimal
Dim FechaMovimiento As Date = TxtFecha.Text.ToDate
Dim IdCtaContable As Integer = 0
Dim FechaMovimiento As Date = TxtFecha.Text.ToDate
Dim ConceptoMovimiento As String = ObjContabilidad.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreComercial, gvr.DataKey("SerieFolio").ToString, TxtFolio.ToString)
Dim Referencia As String = gvr.DataKey("SerieFolio").ToString
Dim CveSubProyecto As Integer = gvr.DataKey("CveSubProyecto").ToEntero
@@ -291,19 +192,14 @@ Partial Class Bancos_DepositoTerminal
ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
importeMX = ImporteMovimiento * tipoCambioVenta
If tipoCambioVenta = 1 Then
IdCtaContable = IdCuentaCliente
Else
ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
IdCtaContable = IdCtaContComplementaria
If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then
If tipoCambioVenta > 1 Then
ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
If ImporteMovimiento <> 0 Then
importeMX = ImporteMovimiento
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento) Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, 0, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
IdCtaContable = IdCtaContMonedaExtranjera
End If
End If
Case 8 'Ret IVA x Trasladar
@@ -311,35 +207,12 @@ Partial Class Bancos_DepositoTerminal
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = Math.Round(ImporteMovimiento, 2) * tipoCambioVenta
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVA <> 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjContabilidad.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 9 'Ret ISR x Trasladar
ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago
importeMX = Math.Round(ImporteMovimiento, 2) * tipoCambioVenta
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetISR <> 0 Then
IdCtaContable = IdCtaContRetISR
Else
If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjContabilidad.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
Case 13 'Iva por Trasladar
@@ -352,35 +225,12 @@ Partial Class Bancos_DepositoTerminal
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = Math.Round(ImporteMovimiento * tipoCambioVenta, 2)
If tipoCambioManual > 1 Then ConceptoMovimiento += $" TC:{tipoCambioManual} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVA <> 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjContabilidad.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 63 'Ret ISR Trasladado
ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago
importeMX = Math.Round(ImporteMovimiento * tipoCambioManual, 2)
If tipoCambioManual > 1 Then ConceptoMovimiento += $" TC:{tipoCambioManual} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetISR <> 0 Then
IdCtaContable = IdCtaContRetISR
Else
If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjContabilidad.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
Case 61 'Iva Trasladado
@@ -413,31 +263,25 @@ Partial Class Bancos_DepositoTerminal
End Select
If ImporteMovimiento <> 0 Then
'Conta ContPAQ
If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
idCuentaContabilizacion = 0
End If
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX) Then
If ImporteMovimiento <> 0 Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, 0, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
Next
End If
End If
Next
If IdCuentaBancariaComplementaria > 0 Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 30, "", TxtFecha.Text.ToDate, IdCuentaBancaria, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
Next
If CveMoneda > 1 Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 30, "", TxtFecha.Text.ToDate, 0, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
MsgError = "No se pudo insertar la póliza"
End If
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 30, "", TxtFecha.Text.ToDate, IdCuentaBancariaComplementaria, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 204, "", TxtFecha.Text.ToDate, 0, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
MsgError = "No se pudo insertar la póliza"
End If
Else
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 30, "", TxtFecha.Text.ToDate, IdCuentaBancaria, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TxtImporte.Text.ToDecimal, "", 30, "", TxtFecha.Text.ToDate, 0, -1, CveIE, -1, -1, -1, -1, ImporteMX:=TxtImporte.Text.ToDecimal) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -455,7 +299,6 @@ Partial Class Bancos_DepositoTerminal
TxtObservaciones.Text = ""
TxtImporte.Text = ""
UPPFiltros.Update()
Dim StrMsg As New StringBuilder