600 lines
25 KiB
VB.net
600 lines
25 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Partial Class Bancos_RepIE
|
|
Inherits ClsPaginas
|
|
Private Shared missing As Object = System.Reflection.Missing.Value
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property Conciliacion As Boolean
|
|
Get
|
|
Return CBool(ViewState("Conciliacion").ToString)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("Conciliacion") = value
|
|
End Set
|
|
End Property
|
|
Private Property TipoPagina As String
|
|
Get
|
|
Return ViewState("TipoPagina").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("TipoPagina") = value
|
|
End Set
|
|
End Property
|
|
Protected Property AceptaOtrosIngresos As Boolean
|
|
Get
|
|
Return CBool(ViewState("AceptaOtrosIngresos"))
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("AceptaOtrosIngresos") = value
|
|
End Set
|
|
End Property
|
|
Private Property DtDatos As DataTable
|
|
Get
|
|
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
|
End Get
|
|
|
|
Set(ByVal value As DataTable)
|
|
ViewState("DtDatos") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
GvDatos.DataBind()
|
|
Me.Form.DefaultButton = BtnConsultar.UniqueID
|
|
txtFechaI.Text = Now.ToShortDateString
|
|
txtFechaF.Text = Now.ToShortDateString
|
|
CargaGvBitacora()
|
|
TipoPagina = ""
|
|
ViewState("Orden") = ""
|
|
ViewState("Conciliacion") = -1
|
|
SetPermisos()
|
|
ViewState("OCveIE") = "CveIE DESC"
|
|
ViewState("OTipoDocto") = "TipoDocto DESC"
|
|
ViewState("OTipo") = "Tipo DESC"
|
|
ViewState("ONumCuenta") = "NumCuenta DESC"
|
|
ViewState("OTipoTransaccion") = "TipoTransaccion DESC"
|
|
ViewState("OFechaDocumento") = "FechaDocumento DESC"
|
|
ViewState("OFolio") = "Folio DESC"
|
|
ViewState("OBanco") = "Banco DESC"
|
|
ViewState("OEstatusIE") = "EstatusIE DESC"
|
|
ViewState("OFechaIng") = "FechaIng DESC"
|
|
ViewState("OUsuario") = "Usuario DESC"
|
|
AceptaOtrosIngresos = False
|
|
|
|
'Cargamos los estatus antes para la página de Conciliaciones.
|
|
CargaEstatusIE()
|
|
|
|
|
|
If Request("Tipo") IsNot Nothing AndAlso Request("Tipo") = "Conciliaciones" Then
|
|
DdlConciliado.Items.Remove(DdlConciliado.Items.FindByValue("-1"))
|
|
TipoPagina = Request("Tipo")
|
|
|
|
DdlEstatusIE.SelectedValueExist("1")
|
|
DdlEstatusIE.Enabled = False
|
|
|
|
'habilita especificar otros ingresos en conciliaciones
|
|
AceptaOtrosIngresos = If(UsuarioActual.Empresa.Funcionalidad(124) = "1", True, False)
|
|
|
|
GvDatos.Columns(14).Visible = False
|
|
GvDatos.Columns(15).Visible = True
|
|
GvDatos.Columns(18).Visible = False
|
|
|
|
txtFechaI.Text = DateSerial(Year(Date.Now), Month(Date.Now), 1).ToShortDateString
|
|
txtFechaF.Text = Date.Now.ToShortDateString
|
|
ImgConciliacion.Visible = True
|
|
LblTitulo.Text = "Conciliación Bancaria"
|
|
End If
|
|
|
|
'Combos del FILTRO
|
|
DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
DdlTarjeta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
CargaCuenta()
|
|
CargaMoneda()
|
|
CargaTipoTransaccion("-1")
|
|
CargaUsuarioConcilio()
|
|
txtFechaI.Text = Now.ToShortDateString
|
|
|
|
DivDdlTarjeta.Visible = False
|
|
DivLabelTarjeta.Visible = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
|
|
If TipoPagina = "Conciliaciones" Then
|
|
If DdlConciliado.SelectedValue.ToEntero = 0 Then
|
|
BtnGuardar.Text = "Conciliar"
|
|
ElseIf DdlConciliado.SelectedValue.ToEntero = 1 Then
|
|
BtnGuardar.Text = "Desconciliar"
|
|
End If
|
|
UPDatos.Update()
|
|
End If
|
|
|
|
If GvDatos.Rows.Count = 0 Then Alert("No se encontraron Registros con los filtros actuales.", TipoMensaje.MsgAdvertencia)
|
|
End Sub
|
|
|
|
#Region " C A R G A - D A T O S "
|
|
Private Sub SetPermisos()
|
|
If UsuarioActual.TienePermisoProceso(99) Then
|
|
LnkCambiarFecha.Style.Remove("display")
|
|
GvDatos.Columns(18).Visible = True
|
|
End If
|
|
End Sub
|
|
Public Sub CargaDatos()
|
|
|
|
Dim Folio As String
|
|
Dim PagueseA As String
|
|
Dim FechaI, FechaF, FechaAplicacionI, FechaAplicacionF, FechaConciliadoI, FechaConciliadoF As Date
|
|
|
|
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
|
FechaAplicacionI = If(IsDate(TxtFechaAplicacionI.Text.Trim()), TxtFechaAplicacionI.Text.ToDate, MinFecha)
|
|
FechaAplicacionF = If(IsDate(TxtFechaAplicacionF.Text.Trim()), TxtFechaAplicacionF.Text.ToDate, MaxFecha)
|
|
FechaConciliadoI = If(IsDate(TxtFechaConciliadoI.Text.Trim()), TxtFechaConciliadoI.Text.ToDate, MinFecha)
|
|
FechaConciliadoF = If(IsDate(TxtFechaConciliadoF.Text.Trim()), TxtFechaConciliadoF.Text.ToDate, MaxFecha)
|
|
|
|
Dim Importe = If(TxtImporteFiltro.Text = "", -1, TxtImporteFiltro.Text.ToDouble)
|
|
Dim Tipo = If(DdlTipo.SelectedItem.ToString = "Todos", "-1", DdlTipo.SelectedItem.ToString)
|
|
Dim Cuenta = If(DdlCuenta.SelectedValue.ToEntero = 0, -1, DdlCuenta.SelectedValue.ToEntero)
|
|
|
|
If TxtPagueseA.Text <> "" Then PagueseA = String.Format("%{0}%", TxtPagueseA.Text) Else PagueseA = "-1"
|
|
If TxtFolio.Text.Trim = "" Then Folio = "-1" Else Folio = String.Format("%{0}%", TxtFolio.Text.Trim)
|
|
|
|
|
|
Dim ObjBancosIE As New ClsBancos
|
|
If ObjBancosIE.GetBancosIE(-1, -1, Cuenta, DdlTipo.SelectedValue, DdlTipoTransaccion.SelectedValue.ToEntero, Folio, PagueseA, -1, DdlMoneda.SelectedValue.ToEntero,
|
|
If(ChkEsAbonoEnCuenta.Checked.ToEntero = 0, -1, 1),
|
|
DdlConciliado.SelectedValue.ToEntero, DdlEstatusIE.SelectedValue.ToEntero, FechaI, FechaF, FechaAplicacionI, FechaAplicacionF,
|
|
FechaConciliadoI, FechaConciliadoF, DdlUsuarioConcilio.SelectedValue.ToEntero, Importe, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=DdlTarjeta.SelectedValue.ToEntero) Then
|
|
GvDatos.DataSource = ObjBancosIE.DtResultados
|
|
DtDatos = ObjBancosIE.DtResultados
|
|
End If
|
|
|
|
If ChkTotalizar.Checked Then
|
|
Dim SaldoDolares = DtDatos.SUM("Importe", "CveMoneda = 2") * GlobalTipoCambio(Now)
|
|
SaldoTotal.Text = (DtDatos.SUM("Importe") + SaldoDolares).ToString.FormatoNumero
|
|
LtlSaldo.Text = DtDatos.SUM("Importe", "CveMoneda = 1").ToString.FormatoNumero
|
|
LtlSaldoDolares.Text = DtDatos.SUM("Importe", "CveMoneda = 2").ToString.FormatoNumero
|
|
DivIndicador.Visible = True
|
|
Else
|
|
DivIndicador.Visible = False
|
|
End If
|
|
|
|
ObjBancosIE.Dispose()
|
|
GvDatos.DataBind()
|
|
OrdenaDatos()
|
|
UPDatos.Update()
|
|
UpIndicadores.Update()
|
|
|
|
If GvDatos.Rows.Count > 0 AndAlso TipoPagina = "Conciliaciones" Then
|
|
BtnGuardar.Visible = True
|
|
GvDatos.HeaderRow.FCTextBox("TxtFechaAplicadoHeader").Text = DateAdd("d", -1, Date.Now).ToShortDateString
|
|
|
|
If AceptaOtrosIngresos Then
|
|
Dim ObjProveedores As New ClsCompProveedores
|
|
ObjProveedores.GetProveedorProsepago(UsuarioActual.CveEmpresa)
|
|
|
|
GvDatos.HeaderRow.FCDropDownList("DdlProsePago").DataSource = ObjProveedores.DtResultados
|
|
GvDatos.HeaderRow.FCDropDownList("DdlProsePago").Visible = True
|
|
ObjProveedores.Dispose()
|
|
|
|
GvDatos.HeaderRow.FCDropDownList("DdlProsePago").DataBind()
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " C O N C I L I A C I O N E S "
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
|
Dim ObjIE As New ClsBancos()
|
|
ObjIE.IniciaTransacSQL()
|
|
|
|
Dim OcurrioError As Boolean = False
|
|
Dim ErrorFecha = False
|
|
Dim Fecha As Date
|
|
Dim FolioError As String = ""
|
|
Dim OtrosIngresos As Double = 0
|
|
Dim CveProveedorProsepago As Integer = -1
|
|
|
|
If AceptaOtrosIngresos Then
|
|
CveProveedorProsepago = GvDatos.HeaderRow.FCDropDownList("DdlProsePago").SelectedValue.ToEntero
|
|
End If
|
|
|
|
For Each Row As GridViewRow In GvDatos.Rows
|
|
|
|
If Row.FCCheckBox("ChkFueConciliado").Checked <> CBool(Row.FCHiddenField("HdnConciliado").Value) Then
|
|
If Not CBool(Row.FCHiddenField("HdnConciliado").Value) Then
|
|
If Row.FCTextBox("TxtFechaAplicado").Text.Trim.ToDate >= Row.FCLiteral("LtlFechaDocumento").Text.Trim.ToDate AndAlso Row.FCTextBox("TxtFechaAplicado").Text.Trim.ToDate < Date.Now Then '
|
|
Fecha = Row.FCTextBox("TxtFechaAplicado").Text.Trim.ToDate
|
|
Else
|
|
FolioError = Row.DataKey("Folio").ToString
|
|
ErrorFecha = True
|
|
OcurrioError = True
|
|
Exit For
|
|
End If
|
|
Else
|
|
Fecha = "01/01/1801".ToDate
|
|
End If
|
|
' para el manejo de otros ingresos
|
|
OtrosIngresos = 0
|
|
If AceptaOtrosIngresos Then
|
|
If Row.FCCheckBox("ChkFueConciliado").Checked Then OtrosIngresos = Row.FCTextBox("TxtOtIng").Text.ToDouble
|
|
|
|
End If
|
|
|
|
If Not ObjIE.UpdateBancos_IEConciliado(Row.FCCheckBox("ChkFueConciliado").Checked, Fecha.ToDateTime, OtrosIngresos, CveProveedorProsepago, UsuarioActual.CveUsuario, Row.DataKey("CveIE").ToEntero) Then
|
|
OcurrioError = True
|
|
Exit For
|
|
End If
|
|
|
|
End If
|
|
Next
|
|
|
|
If OcurrioError Then
|
|
ObjIE.RollBack()
|
|
Alert(If(ErrorFecha, String.Format("La Fecha de Aplicación es campo requerido cuando se concilia un movimiento y esta debe de ser mayor o igual que la fecha de emisión y menor o igual que la fecha actual. <br/> Registro que presenta error en fecha: Folio - {0}", FolioError), "Ocurrió un error al guardar las conciliaciones."), TipoMensaje.MsgAdvertencia) '
|
|
Else
|
|
ObjIE.Commit()
|
|
Alert("Los movimientos se conciliarion correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
ObjIE.Dispose()
|
|
|
|
BtnConsultar_Click(sender, e)
|
|
End Sub
|
|
Protected Sub ImgConciliacion_Click(sender As Object, e As EventArgs) Handles ImgConciliacion.Click
|
|
CargaDatosReporteConciliaciones()
|
|
End Sub
|
|
Private Sub CargaDatosReporteConciliaciones()
|
|
|
|
If DdlCuenta.SelectedValue.ToEntero < 0 Then
|
|
Alert("Seleccione una cuenta Bancaria", TipoMensaje.MsgAdvertencia)
|
|
UPDatos.Update()
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim DtConciliaciones As DataTable
|
|
Dim ObjBancos As New ClsBancos
|
|
|
|
Dim FechaI = txtFechaI.Text.ToDate
|
|
Dim FechaF = txtFechaF.Text.ToDate
|
|
|
|
If ObjBancos.GetConciliacionesReporte(DdlCuenta.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
|
DtConciliaciones = ObjBancos.DtResultados
|
|
Else
|
|
DtConciliaciones = Nothing
|
|
End If
|
|
ObjBancos.Dispose()
|
|
|
|
|
|
Dim Cuenta, CLABE, Banco As String
|
|
Cuenta = ""
|
|
CLABE = ""
|
|
Banco = ""
|
|
|
|
Dim dr As DataRow = GlobalDTBancosCuentas(-1, DdlCuenta.SelectedValue.ToEntero).FiltroPrimero("")
|
|
|
|
If dr IsNot Nothing Then
|
|
|
|
Cuenta = dr("NumCuenta").ToString
|
|
CLABE = dr("CLABE").ToString
|
|
Banco = dr("Banco").ToString
|
|
|
|
End If
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("FechaInicio", FechaI.ToString("dd/MM/yyyy")))
|
|
params.Add(New ReportParameter("FechaFin", FechaF.ToString("dd/MM/yyyy")))
|
|
params.Add(New ReportParameter("Cuenta", Cuenta))
|
|
params.Add(New ReportParameter("CLABE", CLABE))
|
|
params.Add(New ReportParameter("Banco", Banco))
|
|
|
|
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\RepConciliaciones.rdlc", UsuarioActual.Empresa.Ruta))
|
|
If Archivo.Exists Then
|
|
ImprimirPDF(String.Format("{0}Formatos\RepConciliaciones.rdlc", UsuarioActual.Empresa.Ruta), DtConciliaciones, params, "Conciliacion")
|
|
Else
|
|
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("RFCEmpresa", UsuarioActual.Empresa.RFC))
|
|
params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion))
|
|
ImprimirPDF(String.Format("Empresas\Grales\Formatos\RepConciliaciones.rdlc", UsuarioActual.Empresa.Ruta), DtConciliaciones, params, "Conciliacion")
|
|
End If
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "G V - D A T O S "
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Left
|
|
|
|
'If DdlConciliado.SelectedValue.ToEntero = 1 And
|
|
' Month(TxtFechaConciliadoI.ToDate) <> Month(TxtFechaConciliadoF.ToDate) Then
|
|
' e.Row.Attributes.Add("data-order", e.Row.DBCampo("FechaAplicado").ToDate.Ticks.ToString)
|
|
'End If
|
|
'Dim indice As Integer = 10
|
|
'For Each control As Control In UPPersonalizar.Controls
|
|
' If TypeOf control Is CheckBox Then
|
|
' If CType(control, CheckBox).Checked Then
|
|
' indice = indice + 1
|
|
' End If
|
|
|
|
' End If
|
|
'Next 10
|
|
'e.Row.Cells(indice).Attributes.Add("data-order", e.Row.DBCampo("FechaEstimadaEntrega").ToDate.Ticks.ToString)
|
|
If ChkFechaCancelacion.Checked Then
|
|
e.Row.Cells(11).Attributes.Add("data-order", e.Row.DBCampo("FechaCancelacion").ToDate.Ticks.ToString)
|
|
End If
|
|
|
|
If TipoPagina = "Conciliaciones" Then
|
|
Dim TipoTrasaccion = If(e.Row.DBCampo("CveTipoTransaccion").ToEntero = 2 Or e.Row.DBCampo("CveTipoTransaccion").ToEntero = 8, True, False)
|
|
'si no esta contabilizada le habilita la opcion, una vez contabilizada no se permite ajustar los movimientos
|
|
Dim StrTxtObr As String = If(AceptaOtrosIngresos AndAlso e.Row.DBCampo("IdPoliza").ToEntero <= 0, e.Row.FCTextBox("TxtOtIng").ClientID, "null")
|
|
e.Row.Cells(12).Visible = True
|
|
e.Row.FCTextBox("TxtFechaAplicado").Visible = True
|
|
e.Row.FCCheckBox("ChkFueConciliado").Enabled = True
|
|
e.Row.FCCheckBox("ChkFueConciliado").Attributes.Add("onclick", If(TipoTrasaccion, $"GetSelectedRow(this,{e.Row.FCTextBox("TxtFechaAplicado").ClientID},{StrTxtObr});", $"GetSelectedRow(this,{e.Row.FCTextBox("TxtFechaAplicado").ClientID},{StrTxtObr});FechaGeneral(this,'{e.Row.DBCampo("FechaDocumento").ToString.ToDate.ToShortDateString}');"))
|
|
e.Row.Cells(13).Style.Add("background-color", "#dddddd")
|
|
e.Row.Cells(15).Style.Add("background-color", "#dddddd")
|
|
If Not CBool(e.Row.DBCampo("FueConciliado").ToString) Then
|
|
e.Row.FCTextBox("TxtFechaAplicado").Text = If(TipoTrasaccion, e.Row.DBCampo("FechaDocumento"), DateAdd("d", -1, Date.Now).ToShortDateString)
|
|
e.Row.FCTextBox("TxtFechaAplicado").Style.Add("display", "none")
|
|
If AceptaOtrosIngresos Then e.Row.FCTextBox("TxtOtIng").Style.Add("display", "none")
|
|
e.Row.FCCalendarExtender("Calendario").StartDate = e.Row.DBCampo("FechaDocumento").ToDate
|
|
Else
|
|
e.Row.FCTextBox("TxtFechaAplicado").Style.Add("display", "")
|
|
e.Row.FCTextBox("TxtFechaAplicado").Text = e.Row.DBCampo("FechaAplicado")
|
|
End If
|
|
Else
|
|
e.Row.FCLiteral("LtlFechaAplicado").Visible = True
|
|
e.Row.Cells(14).Attributes.Add("data-order", e.Row.DBCampo("FechaAplicado").ToDate.Ticks.ToString)
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " O R D E N A M I E NT O "
|
|
Private Sub OrdenaDatos()
|
|
If (GvDatos.Rows.Count > 0) Then
|
|
GvDatos.UseAccessibleHeader = True
|
|
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
|
' RegistraScript("OrdenarGV();")
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "CARGA COMBOS FILTRO"
|
|
Private Sub CargaCuenta()
|
|
DdlCuenta.Items.Clear()
|
|
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario)
|
|
DdlCuenta.DataBind()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
|
|
CargaGridTarjetas()
|
|
End Sub
|
|
|
|
Private Sub CargaGridTarjetas()
|
|
Dim ObjCreditos As New ClsBancos
|
|
ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero)
|
|
DdlTarjeta.Items.Clear()
|
|
|
|
If DdlCuenta.SelectedValue.ToEntero > 0 Then
|
|
DdlTarjeta.DataSource = ObjCreditos.DtResultados
|
|
DdlTarjeta.DataBind()
|
|
Else
|
|
DdlTarjeta.DataSource = Nothing
|
|
DdlTarjeta.DataBind()
|
|
End If
|
|
|
|
DdlTarjeta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
|
|
ObjCreditos.Dispose()
|
|
|
|
DivDdlTarjeta.Visible = True
|
|
DivLabelTarjeta.Visible = True
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaTipoTransaccion(Tipo As String)
|
|
DdlTipoTransaccion.Items.Clear()
|
|
If Tipo <> "" And Tipo <> "-1" Then
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros(String.Format("Tipo = '{0}' ", Tipo))
|
|
DdlTipoTransaccion.DataBind()
|
|
Else
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones
|
|
DdlTipoTransaccion.DataBind()
|
|
End If
|
|
DdlTipoTransaccion.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
End Sub
|
|
Private Sub CargaMoneda()
|
|
DdlMoneda.DataSource = GlobalDTMonedas
|
|
DdlMoneda.DataBind()
|
|
DdlMoneda.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
End Sub
|
|
Private Sub CargaEstatusIE()
|
|
DdlEstatusIE.DataSource = GlobalDTBancosEstatusIE
|
|
DdlEstatusIE.DataBind()
|
|
End Sub
|
|
Private Sub CargaUsuarioConcilio()
|
|
Dim ObjBancos As New ClsBancos
|
|
|
|
If ObjBancos.GetUsuariosConcilio(UsuarioActual.CveEmpresa) Then
|
|
DdlUsuarioConcilio.DataSource = ObjBancos.DtResultados
|
|
End If
|
|
|
|
ObjBancos.Dispose()
|
|
DdlUsuarioConcilio.DataBind()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "DDLS SELECTED INDEX CHANGED"
|
|
Protected Sub DdlTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipo.SelectedIndexChanged
|
|
CargaTipoTransaccion(DdlTipo.SelectedValue)
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
|
|
|
GvDatos.Columns(13).Visible = False 'oculto la columna del checkbox
|
|
GvDatos.Columns(14).Visible = True 'visualizo la columna oculta de fecha aplicacion cuando es conciliacion
|
|
GvDatos.Columns(15).Visible = False 'oculto columna de fecha de aplicacion, en modo de registro
|
|
|
|
GvDatos.ExportToExcel("ReporteSaldos" & Now.ToShortDateString)
|
|
'Imprimir("EXCEL")
|
|
GvDatos.Columns(13).Visible = True
|
|
GvDatos.Columns(14).Visible = False
|
|
GvDatos.Columns(15).Visible = True
|
|
End Sub
|
|
Private Sub LnkCambiarFecha_Click(sender As Object, e As EventArgs) Handles LnkCambiarFecha.Click
|
|
Dim Fecha As Date
|
|
If IsDate(txtFechaIM.Text.Trim) AndAlso IsDate(TxtFechaFM.Text.Trim) Then
|
|
If txtFechaIM.Text = TxtFechaFM.Text Then
|
|
Fecha = txtFechaIM.Text.Trim.ToDate
|
|
Else
|
|
Alert("La Fecha Inicial y Fecha Final son diferentes. Iguálelas o capture un solo campo (FechaI o FechaF)", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
If IsDate(txtFechaIM.Text.Trim) AndAlso Not IsDate(TxtFechaFM.Text.Trim) Then
|
|
Fecha = txtFechaIM.Text.Trim.ToDate
|
|
End If
|
|
If IsDate(TxtFechaFM.Text.Trim) AndAlso Not IsDate(txtFechaIM.Text.Trim) Then
|
|
Fecha = TxtFechaFM.Text.Trim.ToDate
|
|
End If
|
|
|
|
If Fecha.ToShortDateString = "01/01/0001" Then
|
|
Alert("No se capturó fecha, por favor capture una en el campo Fecha Inicial o Fecha Final", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ObjIE As New ClsBancos()
|
|
ObjIE.IniciaTransacSQL()
|
|
|
|
Dim OcurrioError As Boolean = False
|
|
|
|
For Each Row As GridViewRow In GvDatos.Rows
|
|
If Row.FCCheckBox("ChkUpd").Checked AndAlso Not ObjIE.UpdateBancos_IE(Fecha, Fecha, Row.DataKey("CveIE").ToEntero) Then '('UpdateBancos_IEConciliado(Row.FCCheckBox("ChkFueConciliado").Checked, Row.FCTextBox("TxtFechaAplicado").Text.Trim.ToDateTime, Row.DataKey("CveIE").ToEntero) Then
|
|
OcurrioError = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
If OcurrioError Then
|
|
ObjIE.RollBack()
|
|
Alert("Ocurrió un error al guardar las nuevas fechas de los documentos.", TipoMensaje.MsgError)
|
|
Else
|
|
ObjIE.Commit()
|
|
Alert("Las nuevas fechas se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
ObjIE.Dispose()
|
|
|
|
BtnConsultar_Click(sender, e)
|
|
End Sub
|
|
Private Function GetMacro() As String
|
|
Dim SB As New StringBuilder
|
|
SB.Append(" Sub AddRow(Row As String) " & vbLf)
|
|
SB.Append(" Rows(Row & "":"" & Row).Select " & vbLf)
|
|
SB.Append(" Selection.Copy " & vbLf)
|
|
SB.Append(" Selection.Insert Shift:=xlDown " & vbLf)
|
|
SB.Append(" End Sub ")
|
|
Return SB.ToString
|
|
End Function
|
|
|
|
Private Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged
|
|
|
|
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
|
|
|
|
If dr IsNot Nothing AndAlso dr("UsaTarjeta").ToString = "True" Then
|
|
CargaGridTarjetas()
|
|
Else
|
|
DivDdlTarjeta.Visible = False
|
|
DivLabelTarjeta.Visible = False
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
|
GvDatos.Columns(9).Visible = ChkReferencia.Checked
|
|
GvDatos.Columns(10).Visible = ChkObservaciones.Checked
|
|
GvDatos.Columns(11).Visible = ChkFechaCancelacion.Checked
|
|
GvDatos.Columns(12).Visible = ChkUsuarioCancelacion.Checked
|
|
GvDatos.Columns(17).Visible = ChkDepositado.Checked
|
|
GvDatos.Columns(3).Visible = ChkTipo.Checked
|
|
OrdenaDatos()
|
|
UPDatos.Update()
|
|
End Sub
|
|
Private Sub Imprimir(Formato As String)
|
|
|
|
Dim LogoRutaFisica As String = String.Format("Empresas\{0}\Logo.png", UsuarioActual.CveEmpresa)
|
|
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica))
|
|
Dim Imagen As New System.IO.FileInfo(String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta))
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString))
|
|
|
|
Dim ParametrosReporte As String = "Caja chica: " & DdlCuenta.SelectedItem.Text & " Fecha inicio: " & txtFechaI.Text & " Fecha fin: " & txtFechaF.Text
|
|
|
|
params.Add(New ReportParameter("CajaChica", ParametrosReporte))
|
|
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", logouri))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepRembolsosComprobacionesIE.rdlc", DtDatos, params, "ReporteMovimientosBancarios", Formato:=Formato)
|
|
|
|
End Sub
|
|
Private Sub ImgPDF_Click(sender As Object, e As EventArgs) Handles ImgPDF.Click
|
|
Imprimir("PDF")
|
|
End Sub
|
|
|
|
#Region "Bitacora"
|
|
Private Sub CargaGvBitacora()
|
|
Dim ObjGral As New ClsGenerales
|
|
If ObjGral.GetHistorialBitacoraRemoveGet("Banco", UsuarioActual.CveEmpresa) Then
|
|
GvBitacora.DataSource = ObjGral.DtResultados
|
|
ObjGral.Dispose()
|
|
End If
|
|
GvBitacora.DataBind()
|
|
End Sub
|
|
|
|
Private Sub BtnMostrar_Click(sender As Object, e As EventArgs) Handles BtnMostrar.Click
|
|
GvBitacora.Visible = True
|
|
BtnOcultar.Visible = True
|
|
BtnMostrar.Visible = False
|
|
UpBitacora.Update()
|
|
End Sub
|
|
|
|
Private Sub BtnOcultar_Click(sender As Object, e As EventArgs) Handles BtnOcultar.Click
|
|
GvBitacora.Visible = False
|
|
BtnOcultar.Visible = False
|
|
BtnMostrar.Visible = True
|
|
UpBitacora.Update()
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
Private Sub DdlConciliado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConciliado.SelectedIndexChanged
|
|
|
|
End Sub
|
|
|
|
|
|
End Class
|