208 lines
7.8 KiB
VB.net
208 lines
7.8 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
|
|
Partial Class Bancos_RepSaldos
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
InicializaValores()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub InicializaValores()
|
|
'CargaBanco()
|
|
CargaCuenta()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
txtFechaI.Text = Now.FirstDayOfMonth().ToShortDateString
|
|
txtFechaF.Text = Now.LastDayOfMonth().ToShortDateString
|
|
CargaMoneda()
|
|
CargaDatos()
|
|
|
|
'DivBtnPersonalizar.Attributes.Add("onclick", " PosicionaObjeto('C_BtnConsultar', 'DivPersonalizar', '', -100); $('#DivPersonalizar').show(1000);")
|
|
|
|
End Sub
|
|
|
|
|
|
#Region " CARGA VALORES INICIALES - DDLS COMBOS "
|
|
'Private Sub CargaBanco()
|
|
' DdlBanco.DataSource = GlobalDTBancos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
|
' DdlBanco.DataBind()
|
|
'End Sub
|
|
'Protected Sub DdlBanco_SelectedIndexChanged1(sender As Object, e As System.EventArgs) Handles DdlBanco.SelectedIndexChanged
|
|
' CargaCuenta()
|
|
'End Sub
|
|
Private Sub CargaCuenta()
|
|
DdlCuenta.Items.Clear()
|
|
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
|
|
DdlCuenta.DataBind()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
End Sub
|
|
Private Sub CargaMoneda()
|
|
'DdlCuenta.Items.Clear()
|
|
DdlMoneda.DataSource = GlobalDTMonedas
|
|
DdlMoneda.DataBind()
|
|
DdlMoneda.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " CARGA DATOS "
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
Dim FechaI, FechaF As String
|
|
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
|
|
|
Dim Ban As New ClsBancos
|
|
|
|
Dim Str As New StringBuilder
|
|
|
|
If ChkCheques.Checked Then Str.AppendFormat("{0},", 2)
|
|
If ChkInversion.Checked Then Str.AppendFormat("{0},", 3)
|
|
If ChkTC.Checked Then Str.AppendFormat("{0},", 4)
|
|
If ChkCajaChica.Checked Then Str.AppendFormat("{0},", 1)
|
|
If ChkVirtual.Checked Then Str.AppendFormat("{0},", 5)
|
|
If ChkCadenasProductivas.Checked Then Str.AppendFormat("{0},", 7)
|
|
If ChkCreditoRevolvente.Checked Then Str.AppendFormat("{0},", 6)
|
|
|
|
Str.Append("-1")
|
|
|
|
If Ban.GetBancosSaldos(-1, DdlCuenta.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, FechaI, FechaF, DdlOpcion.SelectedValue.ToEntero, Str.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
GvS.DataSource = Ban.DtResultados
|
|
End If
|
|
Ban.Dispose()
|
|
|
|
GvS.DataBind()
|
|
UPFiltros.Update()
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " PERSONALIZAR "
|
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As EventArgs) Handles BtnPersonalizar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvS.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.DBCampo("NumCuenta") = "" Then
|
|
|
|
e.Row.BackColor = Drawing.Color.LightGray
|
|
e.Row.Font.Bold = True
|
|
e.Row.Attributes.Add("style", "color:#337ab7")
|
|
|
|
'e.Row.Cells(3).Text = e.Row.DBCampo("SaldoInicial").FormatoNumero
|
|
'e.Row.Cells(4).Text = e.Row.DBCampo("Cargos").FormatoNumero
|
|
'e.Row.Cells(5).Text = e.Row.DBCampo("Abonos").FormatoNumero
|
|
'e.Row.Cells(6).Text = e.Row.DBCampo("Saldo").FormatoNumero
|
|
|
|
If e.Row.DBCampo("CveMoneda") = "2" Then
|
|
'Dim Liga = String.Format("/Bancos/RepSaldosDetalle.aspx?CveBanco={0}&CveCuenta={1}&FechaI={2}&FechaF={3}&CveMoneda={4}&Opcion={5}", e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaInicio"), e.Row.DBCampo("FechaFin"), e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("Opcion"))
|
|
'e.Row.Cells(6).Text = String.Format("<a href=""{2}"" class""texto""> Dlls:{0} <br/> Pesos:{1}</a>", e.Row.DBCampo("Saldo").FormatoNumero, (e.Row.DBCampo("Saldo").ToString.ToDouble * GlobalTipoCambio).ToString.FormatoNumero, Liga)
|
|
|
|
e.Row.Cells(6).Text = String.Format("Dolares: {0} <br/> Pesos: {1}", e.Row.DBCampo("Saldo").FormatoNumero, (e.Row.DBCampo("Saldo").ToString.ToDouble * GlobalTipoCambio).ToString.FormatoNumero)
|
|
End If
|
|
End If
|
|
|
|
If e.Row.RowIndex = 1 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(200)
|
|
e.Row.Cells(1).Width = Unit.Pixel(200)
|
|
e.Row.Cells(2).Width = Unit.Pixel(100)
|
|
e.Row.Cells(3).Width = Unit.Pixel(90)
|
|
e.Row.Cells(4).Width = Unit.Pixel(90)
|
|
e.Row.Cells(5).Width = Unit.Pixel(90)
|
|
e.Row.Cells(6).Width = Unit.Pixel(90)
|
|
End If
|
|
|
|
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " EXPORTA EXCEL "
|
|
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
' GvS.ExportToExcel("ReporteSaldos" & Now.ToShortDateString)
|
|
ImprimirReportePdf("Excel")
|
|
End Sub
|
|
|
|
|
|
#End Region
|
|
|
|
#Region "P D F"
|
|
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
|
|
|
|
|
ImprimirReportePdf()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub ImprimirReportePdf(Optional Formato As String = "PDF")
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
|
|
'OBTENEMOS LOS DATOS
|
|
Dim DtBancos As DataTable
|
|
Dim Ban As New ClsBancos
|
|
|
|
Dim FechaI, FechaF As String
|
|
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
|
|
|
Dim Str As New StringBuilder
|
|
|
|
If ChkCheques.Checked Then Str.AppendFormat("{0},", 2)
|
|
If ChkInversion.Checked Then Str.AppendFormat("{0},", 3)
|
|
If ChkTC.Checked Then Str.AppendFormat("{0},", 4)
|
|
If ChkCajaChica.Checked Then Str.AppendFormat("{0},", 1)
|
|
If ChkVirtual.Checked Then Str.AppendFormat("{0},", 5)
|
|
If ChkCadenasProductivas.Checked Then Str.AppendFormat("{0},", 7)
|
|
If ChkCreditoRevolvente.Checked Then Str.AppendFormat("{0},", 6)
|
|
|
|
Str.Append("-1")
|
|
If Ban.GetBancosSaldos(-1, DdlCuenta.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, FechaI, FechaF, DdlOpcion.SelectedValue.ToEntero, Str.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
DtBancos = Ban.DtResultados
|
|
Else
|
|
DtBancos = Nothing
|
|
End If
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
|
|
params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString()))
|
|
params.Add(New ReportParameter("FechaInicio", FechaI))
|
|
params.Add(New ReportParameter("FechaFin", FechaF))
|
|
|
|
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepSaldos.rdlc", DtBancos, params, "RepSaldos", Formato:=Formato)
|
|
|
|
Ban.Dispose()
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
End Class
|