-- 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

@@ -4,8 +4,6 @@ Option Strict On
Imports System.Data
Imports Extensiones
Imports System.Web.Services
Imports System.IO
Imports Microsoft.Reporting.WebForms
Partial Class Bancos_ProveedoresCreditos
Inherits ClsPaginas
@@ -114,24 +112,6 @@ Partial Class Bancos_ProveedoresCreditos
End Set
End Property
Private Property IDCtaContable As Integer
Get
Return ViewState("IDCtaContable").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IDCtaContable") = value
End Set
End Property
Private Property IDCtaBeneficiario As Integer
Get
Return ViewState("IDCtaBeneficiario").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IDCtaBeneficiario") = value
End Set
End Property
Private Property CvePrePoliza As Integer
Get
Return ViewState("CvePrePoliza").ToString.ToEntero
@@ -227,19 +207,6 @@ Partial Class Bancos_ProveedoresCreditos
' End Set
'End Property
Property IdCtaContProveedores As Integer
Get
If ViewState("IdCtaContProveedores") Is Nothing Then
Return -1
Else
Return ViewState("IdCtaContProveedores").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("IdCtaContProveedores") = value
End Set
End Property
Property CveCredito As Integer
Get
If ViewState("CveCredito") Is Nothing Then
@@ -370,8 +337,6 @@ Partial Class Bancos_ProveedoresCreditos
Programado = If(Request("Programado") = "1", True, False)
End If
IDCtaBeneficiario = 0
IDCtaContable = 0
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
TxtImporte.Attributes.Add("onblur", $"upIE(this,{CveMoneda});FncImporteCuenta(this);")
Calendario.StartDate = Now.AddMonths(-1).FirstDayOfMonth()
@@ -632,30 +597,7 @@ Partial Class Bancos_ProveedoresCreditos
HdnProvPorRetIVA.Value = ObjProveedor.RetIVA.ToString
HdnProvPorRetISR.Value = ObjProveedor.RetISR.ToString
IdCtaContProveedores = ObjProveedor.IdCtaContProveedores
Select Case RBL.SelectedValue
Case "P" : IDCtaBeneficiario = ObjProveedor.IdCtaContAnticipos
Case "DD" : IDCtaBeneficiario = ObjProveedor.IdCtaContDeudor
Case "AC" : IDCtaBeneficiario = ObjProveedor.IdCtaContAcreedor
Case "DP" : IDCtaBeneficiario = ObjProveedor.IdCtaContDocsXPagar
Case Else
IDCtaBeneficiario = ObjProveedor.IdCtaContProveedores
End Select
If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
If IDCtaBeneficiario = 0 Then
Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
Else
BtnGuardar.Enabled = True
End If
UpGuardar.Update()
End If
CargaCuentasDepositos()
Else
Alert("El Proveedor solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia)
End If
@@ -714,8 +656,6 @@ Partial Class Bancos_ProveedoresCreditos
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue))
If dr IsNot Nothing Then
CveMoneda = dr("CveMoneda").ToString.ToEntero
IDCtaContable = dr("IdCtaContable").ToString.ToEntero
If CveMoneda = 2 Then
TipoCambio = GlobalTipoCambio(Now).ToDecimal
ElseIf CveMoneda = 3 Then
@@ -870,39 +810,17 @@ Partial Class Bancos_ProveedoresCreditos
CveConceptoCompra = 48 'Anticipo Acreedores
CveConceptoContable = 30 'Bancos
Dim ObjProveedor As New ClsCompProveedores()
If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, DdlFinanciera.SelectedValue.ToEntero, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
If ObjProveedor.DtResultados.Rows.Count > 0 Then
IDCtaBeneficiario = ObjProveedor.IdCtaContAcreedor
End If
End If
ObjProveedor.Dispose()
'Dim Estatus As Integer = 2
If HdnCveTipoCredito.Value = "1" Then
'Estatus = 103
'cuando es crediproveedores es, pago a documentos por pagar
CveConceptoCompra = 57
End If
If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then
CIF = TxtImporte.Text.ToDouble - HdnImporteCredito.Value.ToDouble
Else
CIF = 0
End If
'Dim Estatus As Integer = 2
If HdnCveTipoCredito.Value = "1" Then
'Estatus = 103
'cuando es crediproveedores es, pago a documentos por pagar
CveConceptoCompra = 57
End If
If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then
CIF = TxtImporte.Text.ToDouble - HdnImporteCredito.Value.ToDouble
Else
CIF = 0
End If
Dim FolioFijo As Integer = 0
Dim tCveMoneda As Integer = CveMoneda
Dim tImporteMonedaExtranjera As Decimal = 0
@@ -923,10 +841,7 @@ Partial Class Bancos_ProveedoresCreditos
Dim CreditoIVACompra As Decimal = 0
Dim CreditoTotalCompra As Decimal = 0
Dim CtaAcredorComplementocredito As String = "0"
If CveIE > 0 Then
Dim ObjCompra As New ClsCompras(ObjMov.IniciaTransacSQL)
@@ -938,8 +853,6 @@ Partial Class Bancos_ProveedoresCreditos
If Not gvr.FCCheckBox("ChkPagar").Checked Then
Continue For
End If
Dim importeMovimiento = gvr.DataKey("Total").ToDecimal
Dim CveCreditoDetalle As Integer = gvr.DataKey("CveCreditoDetalle").ToEntero
Dim CveCredito As Integer = gvr.DataKey("CveCredito").ToEntero
@@ -1078,29 +991,15 @@ Partial Class Bancos_ProveedoresCreditos
Dim ConceptoContable = 0
Dim TipoMovimiento = False
Dim IdCtaContableI = 0
Dim IdCtaContablePro = 0
Dim Concepto = ""
Dim Referencia = $"Crédito: {TxtFolio.Text}"
Dim FechaMovimiento = Now.ToDate
'If ComplementoCredito = 1 Then
' DtPlantilla = DtPlantilla.FiltraParametros("CveConcepto IN (30)")
'End If
'If ComplementoCredito = 1 Then
' ObjIE.UpdateCreditosDetalle(3, CveCreditoDetalle, Saldo:=0)
'End If
For Each Row As DataRow In DtPlantilla.Rows
ConceptoContable = Row("CveConcepto").ToString.ToEntero
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
IdCtaContableI = Row("IdCtaContable").ToString.ToEntero
'importeMovimiento = 0
Dim TemoimporteMovimiento As Decimal = importeMovimiento
' Dim TemoimporteMovimiento As Decimal = ImportePagado
@@ -1176,90 +1075,40 @@ Partial Class Bancos_ProveedoresCreditos
TemoimporteMovimiento = FondoGarantia
Case 19
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
Try
IDCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
Catch ex As Exception
IDCtaContable = -1
End Try
End If
End If
If CreditoEstatus = 4 Then
CreditoIvaCapital = CreditoIVACompra
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaCapital, Referencia, ConceptoContable, Concepto, FechaMovimiento, IDCtaContable, -1, ImporteMX:=CreditoIvaCapital, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaCapital, Referencia, ConceptoContable, Concepto, FechaMovimiento, 0, -1, ImporteMX:=CreditoIvaCapital, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
MsgError = "no se pudo insertar el detalle de la póliza(Crédito) "
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaIntereses, Referencia, ConceptoContable, Concepto, FechaMovimiento, IDCtaContable, -1, ImporteMX:=CreditoIvaIntereses, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaIntereses, Referencia, ConceptoContable, Concepto, FechaMovimiento, 0, -1, ImporteMX:=CreditoIvaIntereses, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
MsgError = "no se pudo insertar el detalle de la póliza(Crédito) "
End If
TemoimporteMovimiento = 0
Case 100
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
Try
IDCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIntereseDiferido").ToString.ToEntero
Catch ex As Exception
IDCtaContable = -1
End Try
End If
End If
importeMovimiento = CreditoIntereses
Case 14
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
Try
IDCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
Catch ex As Exception
IDCtaContable = -1
End Try
End If
End If
If CreditoEstatus = 4 Then
CreditoIvaCapital = CreditoIVACompra
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaCapital, Referencia, ConceptoContable, Concepto, FechaMovimiento, IDCtaContable, -1, ImporteMX:=CreditoIvaCapital, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaCapital, Referencia, ConceptoContable, Concepto, FechaMovimiento, 0, -1, ImporteMX:=CreditoIvaCapital, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
MsgError = "no se pudo insertar el detalle de la póliza(Credito) "
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaIntereses, Referencia, ConceptoContable, Concepto, FechaMovimiento, IDCtaContable, -1, ImporteMX:=CreditoIvaIntereses, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, CreditoIvaIntereses, Referencia, ConceptoContable, Concepto, FechaMovimiento, 0, -1, ImporteMX:=CreditoIvaIntereses, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
MsgError = "no se pudo insertar el detalle de la póliza(Credito) "
End If
TemoimporteMovimiento = 0
Case 146
TemoimporteMovimiento = CreditoIntereses
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
Try
IDCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaGastosPorInteres").ToString.ToEntero
Catch ex As Exception
IDCtaContable = -1
End Try
End If
End If
Case 17
@@ -1269,26 +1118,18 @@ Partial Class Bancos_ProveedoresCreditos
Case 30
'solo se registra un dato
End Select
If TemoimporteMovimiento > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TemoimporteMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IDCtaContable, -1, CveIE:=CveIE, ImporteMX:=importeMovimiento, CveProveedor:=CveProveedor, CveCredito:=CveCredito, CveCreditoDetalle:=CveCreditoDetalle, CveCompra:=CveCompraCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TemoimporteMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, 0, -1, CveIE:=CveIE, ImporteMX:=importeMovimiento, CveProveedor:=CveProveedor, CveCredito:=CveCredito, CveCreditoDetalle:=CveCreditoDetalle, CveCompra:=CveCompraCredito) Then
MsgError = "no se pudo insertar el detalle de la póliza(Crédito) "
End If
End If
IDCtaContable = -1
Next
If OpcionACompra = 1 Then
If ImporteOpcionACompra > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteOpcionACompra, TxtFolio.Text, 147, TxtFolio.Text, FechaMovimiento, -1, -1, CveIE:=CveIE, ImporteMX:=ImporteOpcionACompra, CveProveedor:=CveProveedor, CveCredito:=CveCredito, CveCreditoDetalle:=CveCreditoDetalle) Then
MsgError = "no se pudo insertar el detalle de la póliza(Crédito) "
@@ -1300,25 +1141,10 @@ Partial Class Bancos_ProveedoresCreditos
Next
If MsgError = "" Then
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
Dim IdCuentaBancaria As Integer = 0
If dr IsNot Nothing Then
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
Else
IdCuentaBancaria = 0
End If
IDCtaContable = IdCuentaBancaria
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text.Trim, 30, TxtObservaciones.Text.Trim, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIE, ImporteMX:=TxtImporte.Text.ToDecimal, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text.Trim, 30, TxtObservaciones.Text.Trim, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIE, ImporteMX:=TxtImporte.Text.ToDecimal, CveProveedor:=CveProveedor, CveCredito:=CveCredito) Then
MsgError = "no se pudo insertar moviento bancario de pago(Crédito) "
End If
End If
Else
@@ -1327,11 +1153,8 @@ Partial Class Bancos_ProveedoresCreditos
Else
MsgError = "No se pudo insertar la póliza"
End If
Else
Msg.Append("El Documento se guardó correctamente.")
End If
If MsgError = "" Then