Option Explicit On Option Strict On Imports Extensiones Imports System.Data Partial Class Compras_Reembolsos Inherits ClsPaginas #Region "Propiedades" Private ReadOnly Property CveCajaChica As Integer Get Return ViewState("CveCajaChica").ToString.ToEntero End Get End Property Private ReadOnly Property CvePersonal As Integer Get Return ViewState("CvePersonal").ToString.ToEntero End Get End Property Private Property CveMoneda As Integer Get Return ViewState("CveMoneda").ToString.ToEntero End Get Set(value As Integer) ViewState("CveMoneda") = value End Set End Property Private Property DtCheques As DataTable Get Return CType(ViewState("DtCheques"), DataTable) End Get Set(value As DataTable) ViewState("DtCheques") = value End Set End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then TxtImporte.Attributes.Add("disabled", "disabled") TxtAboneA.Enabled = False ViewState("CveMoneda") = 1 'Cargar Filtros Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) dt = dt.FiltraParametros(String.Format("CveTipoCuenta = 1")) 'caja chica = 1 DdlCajaChica.DataSource = dt DdlCajaChica.DataBind() Dim ObjPersonal As New ClsRH ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) DdlPersonal.DataSource = ObjPersonal.DtResultados ObjPersonal.Dispose() DdlPersonal.DataBind() CargaTipoTransaccion() 'CargaCuentasDiferencia() 'TableDiferencia.Visible = False End If End Sub #Region " FILTROS " Protected Sub DdlTipoPago_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoPago.SelectedIndexChanged PnlCheques.Visible = False PnlChequeInfo.Visible = False TableExpedirCheque.Visible = False If DdlTipoPago.SelectedValue = "1" Then TdFunEmp.Visible = True DdlPersonal.SelectedValue = "-2" Else TdFunEmp.Visible = False DdlPersonal.SelectedValue = "-2" End If If DdlTipoPago.SelectedValue = "2" Then TdCajaChica.Visible = True DdlCajaChica.SelectedValue = "-2" Else TdCajaChica.Visible = False DdlCajaChica.SelectedValue = "-2" End If ViewState("CveCajaChica") = -2 ViewState("CvePersonal") = -2 LimpiaDatos() CargaCxP() End Sub Protected Sub DdlPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPersonal.SelectedIndexChanged ViewState("CvePersonal") = DdlPersonal.SelectedValue LimpiaDatos() CargaCxP() End Sub Protected Sub DdlCajaChica_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCajaChica.SelectedIndexChanged ViewState("CveCajaChica") = DdlCajaChica.SelectedValue LimpiaDatos() CargaCxP() End Sub #End Region #Region " CARGA DATOS " Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click If DdlCajaChica.SelectedIndex > 0 Or DdlPersonal.SelectedIndex > 0 Then LimpiaDatos() CargaCxP() Else Alert("Seleccione un Funcionario/Empleado o una Cuenta", TipoMensaje.MsgAdvertencia) End If End Sub Private Sub CargaDatos(tCveIE As Integer) Dim ObjIE As New ClsBancos() If ObjIE.GetBancosIE(tCveIE, UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then LtChequeFecha.Text = ObjIE.FechaDocumento.ToShortDateString HlCheque.Text = ObjIE.Folio HlCheque.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", tCveIE) HdnCheque.Value = tCveIE.ToString LtChequeImporte.Text = ObjIE.Importe.FormatoNumero TxtChequeSaldo.Text = DtCheques.Rows(DDlCheques.SelectedIndex - 1)("Saldo").ToString.FormatoNumero 'DdlTipoTransaccion.SelectedValue = ObjIE.CveTipoTransaccion.ToString 'DdlTipoTransaccion_SelectedIndexChanged(DdlTipoTransaccion, EventArgs.Empty) 'DdlTipoTransaccion.Enabled = False 'DdlCuenta.SelectedValue = ObjIE.CveCuenta.ToString 'DdlCuenta.Enabled = False 'TxtObservaciones.Text = ObjIE.Observaciones 'ChkAbonoCuenta.Checked = ObjIE.EsAbonoEnCuenta ''saco el tipo de transaccion 'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", ObjIE.CveTipoTransaccion)) 'Egs o Ing 'If dr IsNot Nothing Then ' If dr("Tipo").ToString = "Egs" Then ' LblPagueseA.Text = "Beneficiario" ' Else ' LblPagueseA.Text = "Pagador" ' End If 'End If Else Alert("El Documento solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) End If End If ObjIE.Dispose() End Sub Private Sub CargaTipoTransaccion() DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs'") 'Ing DdlTipoTransaccion.DataBind() DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) 'DdlTipoTransaccionDiferencia.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs'") 'Ing 'DdlTipoTransaccionDiferencia.DataBind() 'DdlTipoTransaccionDiferencia.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) End Sub Private Sub CargaCuentas() DdlCuenta.Items.Clear() DdlCuenta.SelectedIndex = -1 Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) dt = dt.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = {1}", 1, DdlTipoTransaccion.SelectedValue)) DdlCuenta.DataSource = dt DdlCuenta.DataBind() DdlCuenta.Items.Insert(0, New ListItem("Seleccione cuenta", "-1")) End Sub #End Region #Region " SELECTED INDEX CHANGED " Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged 'recargo la moneda con la que se va a pagar Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue) If dr IsNot Nothing Then CveMoneda = dr("CveMoneda").ToString.ToEntero End If If HdnTipoTransaccion.Value = "Egs" 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 End Sub Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) If dr IsNot Nothing Then HdnTipoTransaccion.Value = dr("Tipo").ToString End If CargaCuentas() End Sub Protected Sub DDlCheques_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DDlCheques.SelectedIndexChanged If DDlCheques.SelectedValue.ToEntero > 0 Then PnlChequeInfo.Visible = True CargaDatos(DDlCheques.SelectedValue.ToEntero) LimpiaDatos() TableExpedirCheque.Visible = False Else HlCheque.Text = "" HlCheque.NavigateUrl = "" HdnCheque.Value = "-1" TableExpedirCheque.Visible = True LimpiaDatos() ChkChequeExcedente.Checked = False PnlChequeInfo.Visible = False 'DdlTipoTransaccion.Enabled = True 'DdlCuenta.Enabled = True 'TxtChequeSaldo.Text = "" 'LimpiaDatos() End If End Sub #End Region #Region " BTN GUARDAR " Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click If HdnCheque.Value.ToEntero > 0 And ChkChequeExcedente.Checked And TxtImporte.Text.ToDouble = 0 Then Alert("El importe del cheque excedente debe ser mayor a cero", TipoMensaje.MsgAdvertencia) End If If TxtImporte.Text.ToDouble > 0 Or TxtImporteVinculado.Text.ToDouble > 0 Then Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim MsgError As String = "" Dim CveIERegistrado As Integer = 0 Dim CvePersonal As Integer = 0 Dim CvePrePolizaVieja As Integer = 0 Dim CvePrePolizaNueva As Integer = 0 Dim CveIE As Integer If HdnCheque.Value.ToEntero > 0 Then Dim FechaPrePoliza As Date = "01/01/0001".ToDate For Each gvr As GridViewRow In GvCxP.Rows If gvr.FCCheckBox("Chk").Checked Then If gvr.DataKey("FechaCompra").ToDate > FechaPrePoliza Then FechaPrePoliza = gvr.DataKey("FechaCompra").ToDate End If End If Next 'Dim FchasCompras = HdnFechasComprasVinculadas.Value.ToString.Split(","c) 'For index = 0 To FchasCompras.Length - 1 ' If FchasCompras(index).ToDate > FechaPrePoliza Then ' FechaPrePoliza = FchasCompras(index).ToDate ' End If 'Next If LtChequeFecha.Text.ToDate > FechaPrePoliza Then FechaPrePoliza = LtChequeFecha.Text.ToDate End If CvePrePolizaVieja = ObjMov.AddPrePolizas("Banc", 9, TxtImporteVinculado.Text.ToDouble, TxtImporteVinculado.Text.ToDouble, CveMoneda, FechaPrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIE = DDlCheques.SelectedValue.ToEntero CveIERegistrado = CveIE Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue) If DdlPersonal.Visible AndAlso DdlPersonal.SelectedValue.ToEntero > 0 Then CvePersonal = DdlPersonal.SelectedValue.ToEntero If dr IsNot Nothing Then CveMoneda = dr("CveMoneda").ToString.ToEntero End If If ChkChequeExcedente.Checked Then CvePrePolizaNueva = ObjMov.AddPrePolizas("Banc", 9, TxtImporte.Text.ToDouble, TxtImporte.Text.ToDouble, CveMoneda, TxtFechaDocumento.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDouble, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaNueva, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) End If Else CvePrePolizaNueva = ObjMov.AddPrePolizas("Banc", 9, TxtImporte.Text.ToDouble, TxtImporte.Text.ToDouble, CveMoneda, TxtFechaDocumento.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDouble, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaNueva, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) End If If CveIE > 0 Then 'inserto los movimientos de la conta para abonar al saldo If (TxtImporte.Text.ToDouble > 0 And CvePrePolizaNueva > 0) Or (TxtImporteVinculado.Text.ToDouble > 0 And HdnCheque.Value.ToEntero > 0 And CvePrePolizaVieja > 0) Then Dim SaldoCheque As Decimal = TxtChequeSaldo.Text.ToDecimal Dim SaldoActual As Decimal = 0 Dim SaldoAbonado As Decimal = 0 Dim PorcentajePago As Decimal = 1 'inserto las compras que voy a pagar For Each gvr As GridViewRow In GvCxP.Rows If gvr.FCCheckBox("Chk").Checked Then 'Saco el porcentaje de pago If gvr.DataKey("Original").ToDouble > 0 Then PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal Else PorcentajePago = 1 SaldoActual = gvr.FCTextBox("TxtAbonar").Text.ToDecimal SaldoAbonado = If(SaldoActual > SaldoCheque, SaldoCheque, SaldoActual) If gvr.DataKey("Original").ToDouble > 0 Then PorcentajePago = SaldoAbonado / gvr.DataKey("Original").ToDecimal Else PorcentajePago = 1 If CveIERegistrado > 0 AndAlso SaldoCheque > 0 Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaVieja, True, SaldoAbonado, SaldoAbonado, 29, " ", " ", CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaVieja, False, SaldoAbonado, SaldoAbonado, 17, " ", " ", CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If If MsgError = "" AndAlso gvr.DataKey("IVA").ToDouble > 0 Then 'Agrego el IVA If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaVieja, False, gvr.DataKey("IVA").ToDecimal * PorcentajePago, gvr.DataKey("IVA").ToDecimal * PorcentajePago, 14, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If 'Agrego el IVA If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaVieja, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, gvr.DataKey("IVA").ToDecimal * PorcentajePago, 19, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If End If End If SaldoActual = SaldoActual - SaldoAbonado If gvr.DataKey("Original").ToDouble > 0 Then PorcentajePago = SaldoActual / gvr.DataKey("Original").ToDecimal Else PorcentajePago = 1 If SaldoActual > 0 Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, True, SaldoActual, SaldoActual, 17, TxtObservaciones.Text, "", CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" Exit For Else If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, False, gvr.DataKey("SubTotal").ToDecimal * PorcentajePago, gvr.DataKey("SubTotal").ToDecimal * PorcentajePago, 30, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "no se pudo insertar el detalle de la poliza" End If '*********IVA. siempre se registra aunque sea cero PREGUNTAR POR EL CONCEPTO DE IVA EN Conta_Conceptos If MsgError = "" AndAlso gvr.DataKey("IVA").ToDouble > 0 Then 'Agrego el IVA If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, False, gvr.DataKey("IVA").ToDecimal * PorcentajePago, gvr.DataKey("IVA").ToDecimal * PorcentajePago, 14, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If 'Agrego el IVA If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, gvr.DataKey("IVA").ToDecimal * PorcentajePago, 19, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If End If If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDouble > 0 Then 'Agrego el RetIVA If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, True, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, 15, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If End If If MsgError = "" AndAlso gvr.DataKey("RetISR").ToDouble > 0 Then 'Agrego el RetISR If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaNueva, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, 16, TxtObservaciones.Text, TxtObservaciones.Text, CveIE:=CveIE, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero) Then MsgError = "Detalle" End If End If End If End If SaldoCheque = SaldoCheque - gvr.FCTextBox("TxtAbonar").Text.ToDecimal 'Saldo completo del concepto End If Next Else MsgError = "No se pudo insertar la póliza" End If Else MsgError = "No se insertó el encabezado" End If If MsgError.Trim = "" Then ObjIE.Commit() UPCompras.Update() CargaCxP() If CvePrePolizaNueva > 0 Then Alert(String.Format("Abono Registrado Correctamente.

Cheque: {1} ", CveIE, TxtFolio.Text), TipoMensaje.MsgInformacion) Else Alert("Abono Registrado Correctamente.", TipoMensaje.MsgInformacion) End If LimpiaDatos() PnlChequeInfo.Visible = False Else Alert("Ocurrió un error al guardar el movimiento", TipoMensaje.MsgError) ObjIE.RollBack() End If Else Alert("El Importe debe de ser mayor a $0.00", TipoMensaje.MsgAdvertencia) End If End Sub Protected Sub LimpiaDatos() TxtFolio.Text = "" TxtObservaciones.Text = "" TxtImporte.Text = "" TxtFechaDocumento.Text = NowADS().ToShortDateString 'DdlCuenta.SelectedValue = "-1" DdlTipoTransaccion.SelectedValue = "-1" DdlTipoTransaccionDiferencia_SelectedIndexChanged(DdlTipoTransaccion, EventArgs.Empty) UpDatos.Update() For Each gvr As GridViewRow In GvCxP.Rows gvr.FCCheckBox("Chk").Checked = False gvr.FCTextBox("TxtAbonar").Text = "" Next UPCompras.Update() End Sub #End Region #Region " TABLA CxP " Protected Sub CargaCxP() Dim ObjMovtos As New ClsMovimientos ObjMovtos.GetCxPPersonalCajaChica(UsuarioActual.CveEmpresa, CvePersonal, CveCajaChica, If(TxtNumeroReembolso.Text.Trim = "", "-1", TxtNumeroReembolso.Text.Trim)) GvCxP.DataSource = ObjMovtos.DtResultados 'Limpia Ddl Cheques DDlCheques.Items.Clear() 'cargo si tiene cheques pendientes sin amortizar If CvePersonal > 0 Then ObjMovtos.GetEgresosSinComprobarPersonalDetalle(CvePersonal, UsuarioActual.CveEmpresa) CargaCuentas() End If If CveCajaChica > 0 Then ObjMovtos.GetCajaChicaDetalle(CveCajaChica, UsuarioActual.CveEmpresa) PnlCheques.Visible = True TableExpedirCheque.Visible = True DdlCuenta.Items.Clear() DdlCuenta.Items.Add(New ListItem(DdlCajaChica.SelectedItem.Text, DdlCajaChica.SelectedValue)) End If DtCheques = ObjMovtos.DtResultados.FiltraParametros("CveIE > 0") If DtCheques.Rows.Count > 0 Then PnlCheques.Visible = True DDlCheques.DataSource = DtCheques TableExpedirCheque.Visible = True End If ObjMovtos.Dispose() GvCxP.DataBind() DDlCheques.DataBind() DDlCheques.Items.Insert(0, New ListItem("Expedir Cheque", "-1")) If GvCxP.Rows.Count > 0 Then TxtFechaDocumento.Text = NowADS().ToShortDateString BtnIEGuardar.Enabled = True If Not DdlPersonal.SelectedValue = "-2" Then TxtAboneA.Text = DdlPersonal.SelectedItem.ToString End If If Not DdlCajaChica.SelectedValue = "-2" Then TxtAboneA.Text = DdlCajaChica.SelectedItem.ToString End If Else TxtAboneA.Text = "" BtnIEGuardar.Enabled = False End If UpDatos.Update() UpGuardar.Update() UPCompras.Update() UPPChq.Update() End Sub Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 0 Then e.Row.Cells(0).ColumnSpan = 4 e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(1).Visible = False e.Row.Cells(2).Visible = False e.Row.Cells(3).Visible = False e.Row.BackColor = Drawing.Color.LightGray e.Row.FCTextBox("TxtAbonar").Visible = False e.Row.FCCheckBox("Chk").Visible = False End If If e.Row.RowIndex = 1 Then e.Row.Cells(0).Width = Unit.Pixel(25) e.Row.Cells(1).Width = Unit.Pixel(80) e.Row.Cells(2).Width = Unit.Pixel(250) e.Row.Cells(3).Width = Unit.Pixel(70) e.Row.Cells(4).Width = Unit.Pixel(60) e.Row.Cells(5).Width = Unit.Pixel(50) e.Row.Cells(6).Width = Unit.Pixel(90) e.Row.Cells(7).Width = Unit.Pixel(70) e.Row.Cells(8).Width = Unit.Pixel(70) e.Row.Cells(9).Width = Unit.Pixel(80) End If e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(7).ForeColor = Drawing.Color.Red If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxP" Then e.Row.Cells(5).ForeColor = Drawing.Color.Red If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{2},{3});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCHiddenField("HdnGenerado").ClientID, e.Row.FCHiddenField("HdnVinculado").ClientID)) e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},{2},{3});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCHiddenField("HdnGenerado").ClientID, e.Row.FCHiddenField("HdnVinculado").ClientID)) End If End Sub #End Region #Region " APLICA DIFERENCIA " Protected Sub ChkChequeExcedente_CheckedChanged(sender As Object, e As EventArgs) If ChkChequeExcedente.Checked Then TableExpedirCheque.Visible = True Else LimpiaDatos() TxtImporteVinculado.Text = "" TableExpedirCheque.Visible = False End If End Sub Protected Sub BtnDiferencia_Click(sender As Object, e As EventArgs) TxtImporteVinculado.Text = HdnSaldo.Value If HdnSaldoDiferencia.Value.ToDouble > 0 AndAlso ChkChequeExcedente.Checked Then TxtImporte.Text = HdnSaldoDiferencia.Value End If End Sub Protected Sub DdlCuentaDiferencia_SelectedIndexChanged(sender As Object, e As EventArgs) 'Handles DdlCuentaDiferencia.SelectedIndexChanged 'recargo la moneda con la que se va a pagar 'Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero("CveCuenta = " & DdlCuentaDiferencia.SelectedValue) 'If dr IsNot Nothing Then ' CveMoneda = dr("CveMoneda").ToString.ToEntero 'End If 'If HdnTipoTransaccion.Value = "Egs" Then ' Dim Folio As Long ' Dim Banco As New ClsBancos ' Folio = Banco.GetNextFolio(DdlCuentaDiferencia.SelectedValue.ToEntero, DdlTipoTransaccionDiferencia.SelectedValue.ToEntero) ' Banco.Dispose() ' TxtFolioDiferencia.Text = Folio.ToString 'Else ' TxtFolioDiferencia.Text = "" 'End If End Sub Protected Sub DdlTipoTransaccionDiferencia_SelectedIndexChanged(sender As Object, e As EventArgs) 'Handles DdlTipoTransaccionDiferencia.SelectedIndexChanged 'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccionDiferencia.SelectedValue)) 'If dr IsNot Nothing Then ' HdnTipoTransaccionDiferencia.Value = dr("Tipo").ToString 'End If 'CargaCuentasDiferencia() End Sub Private Sub CargaCuentasDiferencia() 'DdlCuentaDiferencia.Items.Clear() 'Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario) 'dt = dt.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = {1}", 1, DdlTipoTransaccion.SelectedValue)) 'DdlCuentaDiferencia.DataSource = dt 'DdlCuentaDiferencia.DataBind() 'DdlCuentaDiferencia.Items.Insert(0, New ListItem("Seleccione cuenta", "-1")) End Sub #End Region End Class