1610 lines
65 KiB
VB.net
1610 lines
65 KiB
VB.net
Option Explicit On
|
|
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
|
|
|
|
#Region "Propiedades"
|
|
|
|
'Configuración
|
|
Private Property CveIE As Integer
|
|
Get
|
|
Return ViewState("CveIE").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveIE") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveIEDeposito As Integer
|
|
Get
|
|
Return ViewState("CveIEDeposito").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveIEDeposito") = value
|
|
End Set
|
|
End Property
|
|
Private Property Cuenta As String
|
|
Get
|
|
Return ViewState("Cuenta").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Cuenta") = value
|
|
End Set
|
|
End Property
|
|
Private Property CuentaDepositoPadre As String
|
|
Get
|
|
Return ViewState("CuentaDepositoPadre").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("CuentaDepositoPadre") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveCuenta As Integer
|
|
Get
|
|
Return ViewState("CveCuenta").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCuenta") = value
|
|
End Set
|
|
End Property
|
|
|
|
'Private Property CveCompra As Integer
|
|
' Get
|
|
' Return If(IsNothing(ViewState("CveCompra")), -1, ViewState("CveCompra").ToString.ToEntero)
|
|
' End Get
|
|
' Set(value As Integer)
|
|
' ViewState("CveCompra") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
Private Property CveProveedor As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveProveedor")), -1, ViewState("CveProveedor").ToString.ToEntero)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProveedor") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveOrdenCompra As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveOrdenCompra")), -1, ViewState("CveOrdenCompra").ToString.ToEntero)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveOrdenCompra") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CvePersonal As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CvePersonal")), -1, ViewState("CvePersonal").ToString.ToEntero)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CvePersonal") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCliente As Integer
|
|
Get
|
|
Return If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCliente") = value
|
|
End Set
|
|
End Property
|
|
Private Property IDPoliza As Integer
|
|
Get
|
|
Return ViewState("IDPoliza").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("IDPoliza") = value
|
|
End Set
|
|
End Property
|
|
Private Property Opcion As String
|
|
Get
|
|
Return ViewState("Opcion").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Opcion") = value
|
|
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
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CvePrePoliza") = value
|
|
End Set
|
|
End Property
|
|
|
|
'Property SaldoCreditoAFecha As Decimal
|
|
|
|
' Get
|
|
' If ViewState("SaldoCreditoAFecha") Is Nothing Then
|
|
' Return 0
|
|
' Else
|
|
' Return ViewState("SaldoCreditoAFecha").ToString.ToDecimal
|
|
' End If
|
|
' End Get
|
|
' Set(value As Decimal)
|
|
' ViewState("SaldoCreditoAFecha") = value
|
|
' End Set
|
|
|
|
'End Property
|
|
|
|
Private Property CreditoEstatus As Integer
|
|
Get
|
|
If ViewState("CreditoEstatus") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return ViewState("CreditoEstatus").ToString.ToEntero
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CreditoEstatus") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Property UltimaMensualidadCredito As Boolean
|
|
Get
|
|
If ViewState("UltimaMensualidadCredito") Is Nothing Then
|
|
Return False
|
|
Else
|
|
Return Boolean.Parse(ViewState("UltimaMensualidadCredito").ToString)
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("UltimaMensualidadCredito") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
'Property ComplementoCredito As Integer
|
|
' Get
|
|
' If ViewState("ComplementoCredito") Is Nothing Then
|
|
' Return -1
|
|
' Else
|
|
' Return ViewState("ComplementoCredito").ToString.ToEntero
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Integer)
|
|
' ViewState("ComplementoCredito") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
'Property ImporteComplementoCredito As Decimal
|
|
' Get
|
|
' If ViewState("ImporteComplementoCredito") Is Nothing Then
|
|
' Return 0
|
|
' Else
|
|
' Return ViewState("ImporteComplementoCredito").ToString.ToDecimal
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Decimal)
|
|
' ViewState("ImporteComplementoCredito") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
'Property OpcionACompra As Integer
|
|
' Get
|
|
' If ViewState("OpcionACompra") Is Nothing Then
|
|
' Return -1
|
|
' Else
|
|
' Return ViewState("OpcionACompra").ToString.ToEntero
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Integer)
|
|
' ViewState("OpcionACompra") = value
|
|
' 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
|
|
Return -1
|
|
Else
|
|
Return ViewState("CveCredito").ToString.ToEntero
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCredito") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property CveCreditoDetalleOpcionCompra As Integer
|
|
Get
|
|
If ViewState("CveCreditoDetalle") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return ViewState("CveCreditoDetalle").ToString.ToEntero
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCreditoDetalle") = value
|
|
End Set
|
|
End Property
|
|
|
|
'Property ImporteOpcionACompra As Decimal
|
|
' Get
|
|
' If ViewState("ImporteOpcionACompra") Is Nothing Then
|
|
' Return 0
|
|
' Else
|
|
' Return ViewState("ImporteOpcionACompra").ToString.ToDecimal
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Decimal)
|
|
' ViewState("ImporteOpcionACompra") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
|
|
'Property CveCompraCapital As Integer
|
|
' Get
|
|
' If ViewState("CveCompraCapital") Is Nothing Then
|
|
' Return -1
|
|
' Else
|
|
' Return ViewState("CveCompraCapital").ToString.ToEntero
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Integer)
|
|
' ViewState("CveCompraCapital") = value
|
|
' End Set
|
|
'End Property
|
|
'Property CveCompraInteres As Integer
|
|
' Get
|
|
' If ViewState("CveCompraInteres") Is Nothing Then
|
|
' Return -1
|
|
' Else
|
|
' Return ViewState("CveCompraInteres").ToString.ToEntero
|
|
' End If
|
|
|
|
' End Get
|
|
' Set(value As Integer)
|
|
' ViewState("CveCompraInteres") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
|
|
Property CveMoneda As Integer
|
|
Get
|
|
If ViewState("CveMoneda") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return ViewState("CveMoneda").ToString.ToEntero
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMoneda") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Property TipoCambio As Decimal
|
|
Get
|
|
If ViewState("TipoCambio") Is Nothing Then
|
|
Return 1
|
|
Else
|
|
Return ViewState("TipoCambio").ToString.ToEntero
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Decimal)
|
|
ViewState("TipoCambio") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property Programado As Boolean
|
|
Get
|
|
If ViewState("Programado") Is Nothing Then
|
|
Return True
|
|
Else
|
|
Return Boolean.Parse(ViewState("Programado").ToString)
|
|
End If
|
|
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("Programado") = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
|
|
If Request("CveMoneda") IsNot Nothing Then
|
|
CveMoneda = Request("CveMoneda").ToEntero
|
|
End If
|
|
|
|
|
|
If Request("Programado") IsNot Nothing Then
|
|
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()
|
|
ViewState("IDPoliza") = "-1"
|
|
CveIEDeposito = -1
|
|
' rbPagueseA.Attributes.Add("onchange", "upPagueseA(this);")
|
|
'If UsuarioActual.CveRol = 1 Then
|
|
'rbPagueseAFuncionarioEmpleado.Visible = True : lblPagueseAFuncionarioEmpleado.Visible = True : rbPagueseAProveedor.Visible = True : lblPagueseAProveedor.Visible = True
|
|
|
|
If UsuarioActual.CveEmpresa = 66 Then trNotificar.Visible = True
|
|
|
|
'Guarda el modo actual de la pagina
|
|
Opcion = If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "-1")
|
|
|
|
Session("FileUpload") = ""
|
|
|
|
|
|
CargaTipoTransaccion()
|
|
CargaMoneda()
|
|
CargaCuenta()
|
|
|
|
|
|
'If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.UsaAC Then BtnSimplificarAC.Visible = True
|
|
'CargaEstatusIE()
|
|
|
|
|
|
ViewState("Orden") = ""
|
|
ViewState("OTipo") = "Tipo DESC"
|
|
ViewState("OTipoReferencia") = "TipoReferencia DESC"
|
|
ViewState("OEstado") = "Estado DESC"
|
|
ViewState("OFechaIng") = "FechaIng DESC"
|
|
ViewState("OUsuario") = "Usuario DESC"
|
|
|
|
Dim ObjIE As New ClsBancos
|
|
'Carga Estatus IE
|
|
If ObjIE.GetBancos_EstatusIE() Then
|
|
DdlEstatusIE.DataSource = ObjIE.DtResultados
|
|
DdlEstatusIE.DataBind()
|
|
End If
|
|
ObjIE.Dispose()
|
|
|
|
If Request("CveOrdenCompra") IsNot Nothing AndAlso IsNumeric(Request("CveOrdenCompra")) AndAlso Request("CveOrdenCompra").ToEntero > 0 Then
|
|
CveOrdenCompra = Request("CveOrdenCompra").ToEntero
|
|
End If
|
|
If Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then
|
|
CveProveedor = Request("CveProveedor").ToEntero
|
|
|
|
CargaProveedor(CveProveedor, "-1")
|
|
End If
|
|
|
|
|
|
|
|
If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then
|
|
LblPagueseA.Text = ""
|
|
LblPagueseA.Visible = False
|
|
Dim Dt As DataTable = Nothing
|
|
Dim Banc As New ClsBancos
|
|
' Dim CveCredito As Integer = -1
|
|
Dim CveCreditoDetalle As Integer = -1
|
|
|
|
'Dim AplicaSaldo As Integer = -1
|
|
CveCredito = IfNull(Request("CveCredito"), "-1").ToString.ToEntero
|
|
|
|
CveCreditoDetalle = IfNull(Request("CveCreditoDetalle"), "-1").ToString.ToEntero
|
|
CveCreditoDetalleOpcionCompra = IfNull(Request("CveCreditoDetalle"), "-1").ToString.ToEntero
|
|
|
|
Dim OpcionACompra As Integer = IfNull(Request("OpcionACompra"), "-1").ToString.ToEntero
|
|
' Dim ImporteOpcionACompra As Decimal = 0
|
|
Dim ComplementoCredito As Integer = 0
|
|
Dim ImporteComplementoCredito As Decimal = 0
|
|
ComplementoCredito = IfNull(Request("ComplementoCredito"), "-1").ToString.ToEntero
|
|
ImporteComplementoCredito = IfNull(Request("ImporteComplementoCredito"), "0").ToString.ToDecimal
|
|
' AplicaSaldo = IfNull(Request("AplicaSaldo"), "-1").ToString.ToEntero
|
|
|
|
LtlTitulo.Text = "Pago de Créditos"
|
|
|
|
If Banc.GetCreditos(CveCredito, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
Dt = Banc.DtResultados
|
|
|
|
'If OpcionACompra = 1 Then
|
|
' If Dt.Rows.Count > 0 Then
|
|
' ImporteOpcionACompra = Dt.Rows(0)("ImporteOpcionCompra").ToString.ToDecimal
|
|
' End If
|
|
'End If
|
|
|
|
End If
|
|
|
|
Banc.Dispose()
|
|
PnlFyE.Visible = False
|
|
|
|
'PnlCredito.Visible = True
|
|
|
|
DdlFinanciera.DataSource = Dt.FiltraParametros("", DistinctColumns:={"CveProveedor", "Proveedor"}, Orderby:="Proveedor")
|
|
|
|
|
|
DdlFinanciera.DataBind()
|
|
|
|
If DdlFinanciera.SelectedValue.ToEntero > 0 Then
|
|
DdlCredito.DataSource = Dt.FiltraParametros(String.Format("CveProveedor = {0} And EstatusNum In (1,2,101,102,4)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito")
|
|
DdlCredito.DataBind()
|
|
End If
|
|
DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
If CveCredito > 0 Then
|
|
'le asigno el valor
|
|
DdlCredito.SelectedValue = CveCredito.ToString
|
|
If CveCreditoDetalle > 0 Then
|
|
|
|
' DdlCreditoDetalle.SelectedValueExist(CveCreditoDetalle.ToString)
|
|
'
|
|
' CargaCreditosDetalle(CveCreditoDetalle)
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
If Request("CveIE") IsNot Nothing AndAlso IsNumeric(Request("CveIE")) AndAlso Request("CveIE").ToEntero > 0 Then
|
|
ViewState("CveIE") = Request("CveIE")
|
|
'Configuración de Modalidad Update
|
|
TxtFolio.Enabled = False
|
|
TxtFechaDocumento.Enabled = False
|
|
Calendario.Enabled = False
|
|
TxtPagueseA.Enabled = False
|
|
TxtImporte.Enabled = False
|
|
TxtImporteLetra.Enabled = False
|
|
|
|
DdlCuenta.Enabled = False
|
|
'DdlTipo.Enabled = False
|
|
DdlTipoTransaccion.Enabled = False
|
|
TxtObservaciones.Enabled = False
|
|
|
|
ChkAbonoCuenta.Enabled = False
|
|
'Anexo.Visible = False
|
|
|
|
|
|
'0CargaDatos()
|
|
|
|
BtnGuardar.Visible = False
|
|
LtlTitulo.Text = "Consulta del Ingreso/Egreso:"
|
|
'ImgAddObs.Attributes.Add("onclick", "javascript:PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ")
|
|
|
|
Else
|
|
'Configuración de Modalidad Insert
|
|
|
|
CveIE = -1
|
|
TxtFechaDocumento.Text = Now.ToShortDateString
|
|
ImgUpdateCuentaDeposito.Visible = False
|
|
End If
|
|
|
|
CargaDatosCreditos()
|
|
RegistraScript("CalculaTotales();")
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
#Region " CARGA DATOS "
|
|
|
|
Private Sub CargaDatosCreditos() 'pCveProveedor As Integer, tCveMoneda As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveUsuarioRegistro As Integer, CveUsuarioPrograma As Integer, Serie As String)
|
|
|
|
Dim ObjBancos As New ClsBancos
|
|
TxtObservaciones.Text = ""
|
|
TxtImporte.Text = ""
|
|
|
|
If ObjBancos.GetCreditosVencimiento(UsuarioActual.CveEmpresa, CveProveedor, -1, If(Programado, 1, 0), CveMoneda:=CveMoneda) Then
|
|
GvV.DataSource = ObjBancos.DtResultados
|
|
End If
|
|
|
|
TxtImporte.Text = ObjBancos.DtResultados.SUM("Total").ToString().ToDouble.Texto2Letras(CveMoneda)
|
|
|
|
TxtImporteLetra.Text = "---" & ObjBancos.DtResultados.SUM("Total").ToString().ToDouble.Texto2Letras(CveMoneda) & "---"
|
|
|
|
ObjBancos.Dispose()
|
|
GvV.DataBind()
|
|
'UPPCreditos.Update()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub GvV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvV.RowDataBound
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
Dim ChkPagar As CheckBox = e.Row.FCCheckBox("ChkPagar")
|
|
|
|
|
|
ChkPagar.InputAttributes.Add("class", "chkcreditos")
|
|
|
|
ChkPagar.InputAttributes.Add("data-referencia", $"{e.Row.DataKey("Referencia")} {e.Row.DataKey("ProximoPeriodo")}")
|
|
'ChkPagar.InputAttributes.Add("data-saldo", $"{If(e.Row.DataKey("SaldoAnterior").Length > 0, e.Row.DataKey("SaldoAnterior"), "0")}")
|
|
|
|
ChkPagar.InputAttributes.Add("data-valor", e.Row.DataKey("Total"))
|
|
ChkPagar.InputAttributes.Add("data-opcion", "0")
|
|
ChkPagar.InputAttributes.Add("data-complemento", "0")
|
|
ChkPagar.InputAttributes.Add("data-fondo", "0")
|
|
ChkPagar.InputAttributes.Add("data-txtaplicar", e.Row.FCTextBox("TxtAplicar").ClientID)
|
|
|
|
e.Row.FCTextBox("TxtAplicar").Attributes.Add("onfocusout", $"EvaluaAbono({CveMoneda},this,{e.Row.DataKey("Total")})")
|
|
|
|
e.Row.FCTextBox("TxtAplicar").Attributes.Add("onkeyup", $"bloqueGuardar(this,{e.Row.DataKey("Total")})")
|
|
|
|
If (e.Row.DataKey("Programado") = "1") Then
|
|
ChkPagar.Enabled = False
|
|
End If
|
|
|
|
ChkPagar.InputAttributes.Add("onclick", $"CalculaTotales({CveMoneda})")
|
|
|
|
If e.Row.DataKey("Marcador") = "1" Then
|
|
e.Row.Cells(7).Text = e.Row.DataKey("ProximoPeriodo") & "<br/> Opción a Compra"
|
|
ChkPagar.InputAttributes.Add("data-referencia", $"{e.Row.DataKey("Referencia")} {e.Row.DataKey("ProximoPeriodo")} Opción a Compra")
|
|
ChkPagar.InputAttributes.Add("data-opcion", $"{ If(e.Row.DataKey("Marcador") = "1", e.Row.DataKey("Total").ToString, "0") } ")
|
|
ElseIf e.Row.DataKey("Marcador") = "2" Then
|
|
e.Row.Cells(7).Text = e.Row.DataKey("ProximoPeriodo") & "<br/>Complemento"
|
|
ChkPagar.InputAttributes.Add("data-referencia", $"{e.Row.DataKey("Referencia")} {e.Row.DataKey("ProximoPeriodo")} Complemento")
|
|
ChkPagar.InputAttributes.Add("data-complemento", $"{ If(e.Row.DataKey("Marcador") = "2", e.Row.DataKey("Total").ToString, "0") } ")
|
|
ElseIf e.Row.DataKey("Marcador") = "-1" Then
|
|
|
|
ChkPagar.InputAttributes.Add("data-referencia", $"{e.Row.DataKey("Referencia")} {e.Row.DataKey("ProximoPeriodo")}")
|
|
|
|
'If e.Row.DataKey("Periodo").ToString.ToEntero = e.Row.DataKey("Periodos").ToString.ToEntero And e.Row.DataKey("AplicaFondoAuto").ToString.ToEntero = 1 Then
|
|
' ChkPagar.InputAttributes.Add("data-fondo", e.Row.DataKey("FondoGarantia"))
|
|
'End If
|
|
|
|
End If
|
|
|
|
If e.Row.DataKey("Total").ToDecimal = 0 Or e.Row.DataKey("CveCreditoDetalle") = "" Then
|
|
e.Row.Visible = False
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
#Region " CARGA PROVEEDOR "
|
|
Protected Sub BtnBuscarProveedor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnBuscarProveedor.Click
|
|
HdnCvePersonal.Value = "-1"
|
|
ViewState("CveProveedor") = HdnCveProveedor.Value.ToEntero
|
|
ViewState("CvePersonal") = -1
|
|
CargaProveedor(HdnCveProveedor.Value.ToEntero, "-1")
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaProveedor(ByVal CveProveedor As Integer, RFC As String)
|
|
Dim ObjProveedor As New ClsCompProveedores()
|
|
|
|
|
|
If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa) AndAlso ObjProveedor.DtResultados.Rows.Count > 0 Then
|
|
If ObjProveedor.DtResultados.Rows.Count > 0 Then
|
|
TxtPagueseA.Text = ObjProveedor.RazonSocial
|
|
TxtNotificarA.Text = ObjProveedor.NotificarA.Trim
|
|
|
|
HdnProvPorIVA.Value = ObjProveedor.IVA.ToString
|
|
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
|
|
End If
|
|
ObjProveedor.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " CARGA CUENTAS DEPOSITOS "
|
|
Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged
|
|
CambioTipoTransaccion()
|
|
End Sub
|
|
|
|
|
|
Private Sub CambioTipoTransaccion()
|
|
|
|
BtnGuardar.Enabled = True
|
|
|
|
Dim valor As Integer = DdlTipoTransaccion.SelectedValue.ToEntero
|
|
Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
|
|
|
|
If dr IsNot Nothing Then
|
|
HdnTipoTransaccion.Value = dr("Tipo").ToString
|
|
End If
|
|
|
|
Select Case valor
|
|
Case 1
|
|
LblPagueseA.Text = "Páguese a"
|
|
Case 2
|
|
LblPagueseA.Text = "Beneficiario"
|
|
End Select
|
|
|
|
|
|
'RecargaCuentas
|
|
CargaCuenta()
|
|
RecargaCuentasDepositos()
|
|
|
|
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
|
|
Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged
|
|
|
|
'si solo es de egreso el movimiento debe de generar el siguiente folio.
|
|
|
|
If HdnTipoTransaccion.Value = "Egs" AndAlso UsuarioActual.Empresa.Funcionalidad(505) <> "1" Then
|
|
Dim Folio As Long
|
|
Dim Banco As New ClsBancos
|
|
Folio = Banco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
Banco.Dispose()
|
|
TxtFolio.Text = Folio.ToString
|
|
Else
|
|
TxtFolio.Text = ""
|
|
End If
|
|
|
|
|
|
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
|
|
TipoCambio = GlobalTipoCambioEuro(Now).ToDecimal
|
|
Else
|
|
TipoCambio = 0
|
|
End If
|
|
End If
|
|
|
|
RegistraScript($"CalculaTotales({CveMoneda})", "SC")
|
|
System.Threading.Thread.Sleep(5)
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " CARGA CREDITOS - DETALLE "
|
|
|
|
Protected Sub DdlFinanciera_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFinanciera.SelectedIndexChanged
|
|
CargaCreditos(DdlFinanciera.SelectedValue.ToEntero)
|
|
End Sub
|
|
|
|
Private Sub CargaCreditos(CveProveedor As Integer)
|
|
If CveProveedor < 1 Then Exit Sub
|
|
|
|
Dim Cred As New ClsBancos
|
|
Dim dt As DataTable = Nothing
|
|
|
|
If Cred.GetCreditos(-1, -1, -1, CveProveedor, -1, UsuarioActual.CveEmpresa) Then
|
|
TxtPagueseA.Text = Cred.Proveedor
|
|
CveProveedor = Cred.CveProveedor
|
|
DdlCredito.DataSource = Cred.DtResultados.FiltraParametros(String.Format("CveProveedor = {0} AND EstatusNum in (1,2,101,102)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito")
|
|
DdlCredito.DataBind()
|
|
DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
|
|
End If
|
|
|
|
Cred.Dispose()
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE"
|
|
|
|
Private Sub CargaCuenta()
|
|
DdlCuenta.Items.Clear()
|
|
Dim dt As DataTable
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(127) = "1" Then
|
|
dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario)
|
|
Else
|
|
dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas
|
|
End If
|
|
|
|
|
|
If DdlTipoTransaccion.SelectedValue.ToEntero = 9 Then
|
|
dt = dt.FiltraParametros("UsaLayout = 1")
|
|
End If
|
|
|
|
DdlCuenta.DataSource = dt.FiltraParametros($"CveMoneda ={CveMoneda}")
|
|
DdlCuenta.DataBind()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End Sub
|
|
|
|
Private Sub CargaTipoTransaccion()
|
|
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
End Sub
|
|
|
|
Private Sub CargaMoneda()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
#Region " GUARDAR - ACTUALIZAR "
|
|
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
|
|
|
If DdlEstatusIE.SelectedValue = "2" AndAlso TxtImporte.Text.ToDouble > 0 Then
|
|
Alert("Un movimiento Cancelado debe tener importe = 0", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If DdlEstatusIE.SelectedValue <> "2" AndAlso TxtImporte.Text.ToDouble <= 0 Then
|
|
Alert("Debe ingresar un importe", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
'cuando sea activo es requerido proveedor o personal
|
|
If DdlEstatusIE.SelectedValue = "1" AndAlso (CveProveedor <= 0 And CvePersonal <= 0) AndAlso HdnTipoTransaccion.Value = "Egs" And RBL.SelectedValue <> "C" Then
|
|
Alert("Debe de seleccionar un Proveedor o un Funcionario Empleado", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If DdlEstatusIE.SelectedValue = "1" AndAlso TxtPagueseA.Text.Trim = "" Then
|
|
Alert("Ingrese Beneficiario", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim Dep As New ClsGenerales
|
|
If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor) Then
|
|
Dim Row = Dep.DtResultados.FiltroPrimero(String.Format("CveCuentaDeposito = {0}", DdlCuentaDeposito.SelectedValue.ToEntero))
|
|
If Row IsNot Nothing AndAlso Row("Estatus").ToString = "False" Then
|
|
Alert("La cuenta depósito del proveedor esta inactiva.", TipoMensaje.MsgAdvertencia)
|
|
Dep.Dispose()
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
Dim ObjIE As New ClsBancos()
|
|
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
|
|
Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL)
|
|
|
|
|
|
Dim MsgError As String = ""
|
|
Dim CveConceptoContable As Integer = 30
|
|
Dim CveConceptoCompra As Integer = 10
|
|
|
|
Dim CIF As Double = 0
|
|
Dim CvePlantillaPoliza As Integer = 92 'Pago mensualidad Credito
|
|
Dim CvePrePoliza As Integer = 0
|
|
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
|
|
Dim Msg As New StringBuilder
|
|
|
|
If CveIE = -1 Then
|
|
|
|
Dim CveCuentaDeposito As Integer = 0
|
|
|
|
If DdlCuentaDeposito.Items.Count > 0 Then
|
|
CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero
|
|
End If
|
|
|
|
'Cuando es Egreso sin factura, se registra una compra tipo anticipo
|
|
'If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSCREDITO" Then
|
|
|
|
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 FolioFijo As Integer = 0
|
|
Dim tCveMoneda As Integer = CveMoneda
|
|
Dim tImporteMonedaExtranjera As Decimal = 0
|
|
If tCveMoneda <> 1 Then tImporteMonedaExtranjera = TxtImporte.Text.ToDecimal * GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString.ToDecimal
|
|
'cheque
|
|
If DdlTipoTransaccion.SelectedValue = "1" Then FolioFijo = TxtFolio.Text.ToEntero
|
|
|
|
CvePrePoliza = ObjMov.AddPrePolizas("Bancos/ProvCred", CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, TxtPagueseA.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa))
|
|
|
|
'valida prepoliza
|
|
If CvePrePoliza > 0 Then
|
|
|
|
Dim Conc As String = If(TxtObservaciones.Text = "", TxtFolio.Text, TxtObservaciones.Text)
|
|
Dim Ref As String = If(TxtObservaciones.Text = "", TxtFolio.Text, TxtObservaciones.Text)
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, TxtImporte.Text.Trim.ToDouble, CveMoneda,
|
|
TipoCambio, TxtObservaciones.Text.Trim, TxtNotificarA.Text.Trim, ChkAbonoCuenta.Checked, False, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=DdlEstatusIE.SelectedValue.ToString.ToEntero, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"))
|
|
|
|
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)
|
|
|
|
For Each gvr As GridViewRow In GvV.Rows
|
|
|
|
Dim CveCompraCredito As Integer = -1
|
|
|
|
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
|
|
Dim DtDetallesCredito As DataTable
|
|
Dim OpcionACompra As Integer = 0
|
|
Dim ImporteOpcionACompra As Decimal = 0
|
|
Dim ComplementoCredito As Integer = 0
|
|
Dim ImporteComplementoCredito As Decimal = 0
|
|
Dim FondoGarantia As Decimal = 0
|
|
Dim SaldoCreditoAFecha As Decimal = 0
|
|
'Dim ImportePagado As Decimal = gvr.FCTextBox("TxtAplicar").Text.ToDecimal
|
|
|
|
'If ImportePagado = 0 Then
|
|
' ImportePagado = -1
|
|
'End If
|
|
|
|
ObjIE.GetCreditosDetalle(CveCredito, -1)
|
|
DtDetallesCredito = ObjIE.DtResultados
|
|
|
|
If gvr.DataKey("Marcador").ToEntero = 1 Then
|
|
OpcionACompra = 1
|
|
ImporteOpcionACompra = gvr.DataKey("Total").ToDecimal
|
|
|
|
'If ImportePagado > 0 Then
|
|
' ImporteOpcionACompra = ImportePagado
|
|
'End If
|
|
|
|
End If
|
|
|
|
|
|
'If gvr.DataKey("Marcador").ToEntero = 2 Then
|
|
' ComplementoCredito = 1
|
|
' ImporteComplementoCredito = gvr.DataKey("Total").ToDecimal
|
|
|
|
' If ImportePagado > 0 Then
|
|
' ImporteComplementoCredito = ImportePagado
|
|
' End If
|
|
|
|
'End If
|
|
|
|
'If gvr.DataKey("Marcador").ToEntero = -1 Then
|
|
|
|
' SaldoCreditoAFecha = gvr.DataKey("Saldo").ToDecimal
|
|
|
|
'End If
|
|
|
|
'cuando aplica fondo, es mensualidad(marcador=-1) y es el último pago
|
|
'If gvr.DataKey("AplicaFondoAuto") = "1" AndAlso gvr.DataKey("Marcador").ToEntero = -1 AndAlso gvr.DataKey("Periodo") = gvr.DataKey("Periodos") Then
|
|
' FondoGarantia = gvr.DataKey("FondoGarantia").ToString.ToDecimal
|
|
'End If
|
|
|
|
CreditoEstatus = gvr.DataKey("Estatus").ToEntero
|
|
CveCreditoDetalle = gvr.DataKey("CveCreditoDetalle").ToEntero
|
|
'SaldoCreditoAFecha = Drow.DataKey("SaldoCreditoAFecha").ToDecimal
|
|
|
|
|
|
Dim Estatus As Integer = 2
|
|
|
|
If HdnCveTipoCredito.Value = "1" Then
|
|
Estatus = 103
|
|
End If
|
|
|
|
Dim CveCompraCapital As Integer = gvr.DataKey("CveCompra").ToEntero
|
|
Dim CveCompraInteres As Integer = gvr.DataKey("CveCompraInteres").ToEntero
|
|
CveCompraCapital = If(CveCompraCapital < 1, -1, CveCompraCapital)
|
|
CveCompraInteres = If(CveCompraInteres < 1, -1, CveCompraInteres)
|
|
Dim ImporteCompraCapital As Decimal = 0
|
|
Dim ImporteCompraInteres As Decimal = 0
|
|
|
|
Dim ObjCompraCapitalInteres As New ClsCompras(ObjIE.IniciaTransacSQL)
|
|
|
|
If CveCompraCapital > 0 AndAlso ObjCompraCapitalInteres.GetCompras(CveCompraCapital, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjCompraCapitalInteres.DtResultados.Rows.Count > 0 Then
|
|
ImporteCompraCapital = ObjCompraCapitalInteres.DtResultados.Rows(0)("Total").ToString.ToDecimal
|
|
End If
|
|
|
|
If CveCompraInteres > 0 AndAlso ObjCompraCapitalInteres.GetCompras(CveCompraInteres, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjCompraCapitalInteres.DtResultados.Rows.Count > 0 Then
|
|
ImporteCompraInteres = ObjCompraCapitalInteres.DtResultados.Rows(0)("Total").ToString.ToDecimal
|
|
End If
|
|
|
|
If CreditoEstatus = 4 Or ComplementoCredito = 1 Then
|
|
|
|
If CveCompraCapital > 0 And CveCompraInteres > 0 Then
|
|
Estatus = 3
|
|
If CveCompraCapital = CveCompraInteres Then ' si son la misma se considera que se pago el capital e interes en una sola factura
|
|
importeMovimiento = ImporteCompraCapital
|
|
Else
|
|
importeMovimiento = ImporteCompraCapital + ImporteCompraInteres
|
|
End If
|
|
Else
|
|
importeMovimiento = importeMovimiento ' no cambia nada
|
|
End If
|
|
|
|
CveCompraCredito = DtDetallesCredito.FiltroPrimeroValor("CveCompra", $"CveCreditoDetalle = {CveCreditoDetalle}").ToString.ToEntero
|
|
|
|
If ObjCompra.GetCompras(CveCompraCredito, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
|
If ObjCompra.DtResultados.Rows.Count > 0 Then
|
|
CreditoIVACompra = ObjCompra.DtResultados.Rows(0)("IVA").ToString.ToDecimal
|
|
CreditoTotalCompra = ObjCompra.DtResultados.Rows(0)("Total").ToString.ToDecimal
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
If CveCompraCredito = 0 Then
|
|
CveCompraCredito = -1
|
|
End If
|
|
|
|
'If OpcionACompra = 1 Then
|
|
' ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle, GarantiaAplicada:=(If(ChkFondoDeGarantia.Checked, 1, -1)),
|
|
' CveIEOpcionCompra:=CveIE, OpcionACompra:=OpcionACompra, CveCompra:=CveCompraCredito, ImportePagadoOpcionCompra:=ImportePagado)
|
|
|
|
' ' ObjIE.UpdateCreditosIEOpcionCompra(CveCreditoDetalle, CveIE)
|
|
|
|
'ElseIf ComplementoCredito = 1 Then
|
|
' ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle, Complemento:=0, CveIEComplemento:=CveIE, ImportePagadoComplemento:=ImportePagado)
|
|
'Else
|
|
|
|
If CreditoEstatus = 1 Or CreditoEstatus = 4 Then
|
|
ObjIE.UpdateCreditosDetalle(CveCreditoDetalle, "01/01/2000".ToDate, -1, -1, -1, -1, -1, -1, Estatus)
|
|
|
|
'ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle, If(SaldoCreditoAFecha > 0, (SaldoCreditoAFecha * -1), 0),
|
|
' GarantiaAplicada:=(If(ChkFondoDeGarantia.Checked, 1, -1)), CveIEOpcionCompra:=-1,
|
|
' OpcionACompra:=OpcionACompra, CveCompra:=CveCompraCredito, ImportePagado:=ImportePagado)
|
|
End If
|
|
|
|
|
|
Dim CreditoMensualidad = DtDetallesCredito.FiltroPrimeroValor("Mensualidad", $"CveCreditoDetalle = {CveCreditoDetalle}").ToString.ToDecimal
|
|
Dim CreditoIvaCapital = DtDetallesCredito.FiltroPrimeroValor("IVACapital", $"CveCreditoDetalle = {CveCreditoDetalle}").ToString.ToDecimal
|
|
Dim CreditoIvaIntereses = DtDetallesCredito.FiltroPrimeroValor("IVAIntereses", $"CveCreditoDetalle = {CveCreditoDetalle}").ToString.ToDecimal
|
|
|
|
Dim CreditoIntereses = DtDetallesCredito.FiltroPrimeroValor("Intereses", $"CveCreditoDetalle = {CveCreditoDetalle}").ToString.ToDecimal
|
|
|
|
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) AndAlso ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
Dim DtPlantilla = ObjMov.DtResultados
|
|
|
|
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
|
|
|
|
'If CveCompraCapital > 0 And CveCompraInteres > 0 Then
|
|
' TemoimporteMovimiento = importeMovimiento
|
|
|
|
' 'If ImportePagado > 0 Then
|
|
' ' TemoimporteMovimiento = ImportePagado
|
|
' 'End If
|
|
|
|
'Else
|
|
' ' TemoimporteMovimiento = ImportePagado
|
|
'End If
|
|
|
|
Concepto = $"Pago crédito: {TxtFolio.Text}"
|
|
|
|
|
|
Select Case ConceptoContable
|
|
|
|
Case 42
|
|
|
|
If ComplementoCredito = 1 Then
|
|
TemoimporteMovimiento = ImporteComplementoCredito
|
|
Else
|
|
|
|
If CveCompraCapital > 0 Or CveCompraInteres > 0 Then
|
|
If CveCompraCapital > 0 And CveCompraInteres > 0 Then
|
|
|
|
If CveCompraCapital = CveCompraInteres Then
|
|
TemoimporteMovimiento = ImporteCompraCapital
|
|
Else
|
|
TemoimporteMovimiento = ImporteCompraCapital + ImporteCompraInteres
|
|
End If
|
|
|
|
TemoimporteMovimiento = ImporteCompraCapital + ImporteCompraInteres
|
|
ElseIf CveCompraCapital > 0 And CveCompraInteres = -1 Then
|
|
TemoimporteMovimiento = ImporteCompraCapital
|
|
ElseIf CveCompraCapital = -1 And CveCompraInteres > 0 Then
|
|
TemoimporteMovimiento = ImporteCompraInteres
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Case 21
|
|
|
|
If ComplementoCredito = 1 Then
|
|
TemoimporteMovimiento = ImporteComplementoCredito
|
|
Else
|
|
|
|
If CveCompraCapital > 0 Or CveCompraInteres > 0 Then
|
|
If CveCompraCapital > 0 And CveCompraInteres > 0 Then
|
|
|
|
If CveCompraCapital = CveCompraInteres Then
|
|
TemoimporteMovimiento = ImporteCompraCapital
|
|
Else
|
|
TemoimporteMovimiento = ImporteCompraCapital + ImporteCompraInteres
|
|
End If
|
|
|
|
TemoimporteMovimiento = ImporteCompraCapital + ImporteCompraInteres
|
|
ElseIf CveCompraCapital > 0 And CveCompraInteres = -1 Then
|
|
|
|
TemoimporteMovimiento = ImporteCompraCapital
|
|
ElseIf CveCompraCapital = -1 And CveCompraInteres > 0 Then
|
|
|
|
TemoimporteMovimiento = ImporteCompraInteres
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Case 58 'fondo de garantía
|
|
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
|
TemoimporteMovimiento = 0
|
|
' importeMovimiento = gvr.DataKey("Total").ToString.ToDecimal
|
|
|
|
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
|
|
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) "
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
|
|
If MsgError = "" Then
|
|
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).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
|
|
MsgError = "no se pudo insertar moviento bancario de pago(Crédito) "
|
|
End If
|
|
|
|
End If
|
|
|
|
Else
|
|
MsgError = "No se insertó el encabezado"
|
|
End If
|
|
Else
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
|
|
Else
|
|
|
|
Msg.Append("El Documento se guardó correctamente.")
|
|
|
|
End If
|
|
|
|
If MsgError = "" Then
|
|
|
|
If Msg.ToString = "" Then
|
|
Msg.Append("Pago Guardado Correctamente")
|
|
End If
|
|
|
|
Dim Archivo As System.IO.FileInfo = Nothing
|
|
'VERIFICA SI EXISTE EL FORMATO
|
|
If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then
|
|
Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta))
|
|
ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then
|
|
Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero))
|
|
End If
|
|
|
|
If Archivo IsNot Nothing Then
|
|
If Archivo.Exists Then
|
|
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}&ESCRE=1", CveIE)))
|
|
End If
|
|
End If
|
|
|
|
|
|
ObjIE.Commit()
|
|
|
|
Else
|
|
ObjIE.RollBack()
|
|
End If
|
|
|
|
If Msg.ToString <> "" Then
|
|
Alert(Msg.ToString, TipoMensaje.MsgInformacion, String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery))
|
|
End If
|
|
|
|
RecargaGlobalCuentasBancarias()
|
|
ObjIE.Dispose()
|
|
ObjMov.Dispose()
|
|
ObjComp.Dispose()
|
|
If ObjComp IsNot Nothing Then ObjComp.Dispose()
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnActualizar_Click(sender As Object, e As EventArgs) Handles BtnActualizar.Click
|
|
Dim IE As New ClsBancos
|
|
Dim FechaAplicado As DateTime? = Nothing
|
|
|
|
If IE.UpdateBancos_IE(TxtFechaDocumento.Text.ToDate, FechaAplicado, CveIE) Then
|
|
Alert("La Actualización del documento se realizó correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
IE.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub ImgUpdateCuentaDeposito_Click(sender As Object, e As ImageClickEventArgs)
|
|
Dim IE As New ClsBancos
|
|
|
|
If IE.UpdateBancos_IECuentaDeposito(DdlCuentaDeposito.SelectedValue.ToEntero, CveIE) Then
|
|
Alert("Se vinculó con exito la cuenta deposito", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("Ocurrió un error al vincular la cuenta deposito al IE", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
IE.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<WebMethod()> <Script.Services.ScriptMethodAttribute()>
|
|
Public Shared Function wsImporteLetra(ByVal contextKey As System.String, ByVal tCveMoneda As Integer) As System.String
|
|
Dim Retorno As String = ""
|
|
|
|
If contextKey.ToDouble >= 0 Then
|
|
Retorno = String.Format("---{0}---", contextKey.ToDouble.Texto2Letras(tCveMoneda))
|
|
End If
|
|
|
|
Return Retorno
|
|
End Function
|
|
|
|
Protected Sub RBL_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBL.SelectedIndexChanged
|
|
If RBL.SelectedValue = "FE" Then
|
|
HplBuscar.NavigateUrl = "/RH/PopUpBuscarPersonal.aspx?&CveEstatusPersonal=1&EsThickbox=S&Opt=Fact&TB_iframe=true&height=500&width=800"
|
|
|
|
ElseIf RBL.SelectedValue = "DD" Then
|
|
HplBuscar.NavigateUrl = "/Compras/PopUpBuscarProveedor.aspx?EsThickbox=S&Opt=Fact&Txt=Deudores&TB_iframe=true&height=500&width=800"
|
|
ElseIf RBL.SelectedValue = "C" Then
|
|
HplBuscar.NavigateUrl = "/Ventas/PopUpBuscarClientes.aspx?EsThickbox=S&Opt=Fact&TB_iframe=true&height=500&width=800"
|
|
Else
|
|
HplBuscar.NavigateUrl = "/Compras/PopUpBuscarProveedor.aspx?EsThickbox=S&Opt=Fact&TB_iframe=true&height=500&width=800"
|
|
End If
|
|
|
|
If RBL.SelectedValue = "C" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then
|
|
|
|
DdlTipoTransaccion.Items.Clear()
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
UpDatos.Update()
|
|
ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then
|
|
DdlTipoTransaccion.Items.Clear()
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
UpDatos.Update()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
#Region " IMPRIMIR "
|
|
'Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
|
' GeneraChequePDF(CveIE, UsuarioActual.Empresa)
|
|
'End Sub
|
|
'Protected Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
|
|
' GeneraChequePDF(CveIE, UsuarioActual.Empresa)
|
|
'End Sub
|
|
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click
|
|
If CveIE > 0 Then GeneraChequePDF(CveIE, UsuarioActual.Empresa)
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "I M P R I M E P D F - N U E V O -"
|
|
' Private Sub ImprimirIEPDF(CveTipoTransaccion As Integer)
|
|
' Dim Archivo As System.IO.FileInfo = Nothing
|
|
|
|
' 'VERIFICA SI EXISTE EL FORMATO
|
|
' If CveTipoTransaccion.Contiene(2, 8, 9) Then
|
|
' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta))
|
|
' ElseIf CveTipoTransaccion.Contiene(1) Then
|
|
' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, CveCuenta))
|
|
' End If
|
|
|
|
' ''PRUEBAS AD-TEAM
|
|
' 'LnkImprimir.Visible = False
|
|
' 'If UsuarioActual.CveUsuario = 100 Then
|
|
' ' LnkImprimir.Visible = True
|
|
' 'End If
|
|
|
|
' If Archivo IsNot Nothing AndAlso Archivo.Exists Then
|
|
' HLImprimir.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=IE&CVEIE={0}", CveIE)))
|
|
' HLImprimir.Visible = True
|
|
' Else
|
|
' HLImprimir.Visible = False
|
|
' End If
|
|
|
|
' End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " CUENTAS DEPOSITOS "
|
|
'Si la cuenta no esta activa, no la muestra.
|
|
Private Sub CargaCuentasDepositos()
|
|
DdlCuentaDeposito.Items.Clear()
|
|
If DdlTipoTransaccion.SelectedValue.Contiene("2", "9") Then ' transferencias y layout
|
|
trCuentaDeposito.Visible = False
|
|
|
|
|
|
Dim Dep As New ClsGenerales
|
|
If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCliente:=CveCliente, CvePersonal:=CvePersonal) Then
|
|
|
|
If DdlTipoTransaccion.SelectedValue = "9" Then
|
|
|
|
DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'")
|
|
|
|
If Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'").Rows.Count > 0 Then
|
|
trCuentaDeposito.Visible = True
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
Else
|
|
Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
Else
|
|
DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'")
|
|
If Dep.DtResultados.Rows.Count > 1 Then
|
|
trCuentaDeposito.Visible = True
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
End If
|
|
End If
|
|
|
|
|
|
''ANTIGUO
|
|
'GVCuentasPago.DataSource = Dep.DtResultados
|
|
'If Dep.DtResultados.Rows.Count > 1 Then
|
|
' trCuentaDeposito.Visible = True
|
|
' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
|
|
' 'Si tiene seleccionado Tipo Mov: Layout y no tiene cuenta deposito
|
|
'ElseIf DdlTipoTransaccion.SelectedValue = "9" AndAlso Not Dep.DtResultados.Rows.Count > 0 Then
|
|
' trCuentaDeposito.Visible = True
|
|
' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
|
|
' BtnIEGuardar.Enabled = False
|
|
' UpGuardar.Update()
|
|
' Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia)
|
|
'End If
|
|
|
|
End If
|
|
Dep.Dispose()
|
|
|
|
'If DdlTipoTransaccion.SelectedValue = "9" AndAlso DdlCuentaDeposito.Items.Count = 0 Then
|
|
' BtnIEGuardar.Enabled = False
|
|
'End If
|
|
|
|
'GVCuentasPago.DataBind()
|
|
DdlCuentaDeposito.DataBind()
|
|
|
|
Else
|
|
trCuentaDeposito.Visible = False
|
|
DdlCuentaDeposito.Items.Clear()
|
|
End If
|
|
RecargaGlobalCuentasBancarias()
|
|
UpCuentaDeposito.Update()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub RecargaCuentasDepositos()
|
|
If CveProveedor > 0 Then
|
|
|
|
Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
|
|
If dr IsNot Nothing Then
|
|
HdnTipoTransaccion.Value = dr("Tipo").ToString
|
|
End If
|
|
'cuando es transferencia bancaria, debe de solicitar a que cuenta se va a depositar
|
|
CargaCuentasDepositos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
'Recaga CuentasBancarias de Proveedor
|
|
Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1)
|
|
If CveProveedor > 0 Then
|
|
Dim ObjCuentasBancos As New ClsGenerales
|
|
|
|
If ObjCuentasBancos.GetCuentasDepositos() Then
|
|
GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados
|
|
End If
|
|
ObjCuentasBancos.Dispose()
|
|
End If
|
|
End Sub
|
|
Protected Sub DdlCuentaDeposito_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
Dim Dep As New ClsGenerales
|
|
If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero) AndAlso Dep.DtResultados.Rows.Count = 1 Then
|
|
If Dep.DtResultados.Rows(0)("TieneCIE").ToString.ToEntero = 1 Then
|
|
TrReferenciaCIE.Visible = True
|
|
TxtReferenciaCIE.Text = Dep.DtResultados.Rows(0)("Referencia").ToString
|
|
Else
|
|
TrReferenciaCIE.Visible = False
|
|
End If
|
|
End If
|
|
Dep.Dispose()
|
|
UpCuentaDeposito.Update()
|
|
End Sub
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Class |