Files
SIG/Contabilidad/Poliza.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

153 lines
6.5 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class Contabilidad_Poliza
Inherits ClsPaginas
Private Property CvePoliza As Integer
'Private Property CveEmpresa As Integer
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.LoadComplete
If Not IsPostBack Then
ViewState("Orden") = ""
Dim cont As New ClsContPAQi(UsuarioActual.Empresa)
If cont.GetTiposPoliza(-1, "-1") Then
DdlTipoPoliza.DataSource = cont.DtResultados
DdlTipoPoliza.DataBind()
End If
cont.Dispose()
If Request("IdPoliza") IsNot Nothing AndAlso Request("IdPoliza").ToEntero() > 0 Then
CvePoliza = Request("IdPoliza").ToEntero()
'CveEmpresa = Request("CveEmpresa").ToEntero()
'ViewState("Empresa") = If(Request("Empresa") IsNot Nothing, Request("Empresa"), EmpresaActual)
CargaDatos()
'btnImprimir.OnClientClick = "javascript:PrintPoliza('/Direccion/EdosFinancieros/PopUpImpPoliza.aspx?Empresa=" & Request("Empresa") & "&IdPoliza=" & Request("IdPoliza") & "', 900, 800); return false;"
End If
'LblEmpresa.Text = NombreEmpresa
'LblFechaDe.Text = Filtros1.FechaFinal.Text
'LblFechaAl.Text = Filtros1.FechaFinal.Text
End If
End Sub
Private Sub CargaDatos()
Dim ObjEdosFinancieros As New ClsContPAQi(UsuarioActual.Empresa)
Dim DT As DataTable = Nothing
LblEmpresa.Text = UsuarioActual.Empresa.Empresa
If ObjEdosFinancieros.GetPoliza(CvePoliza, -1, -1, -1, -1) Then
DT = ObjEdosFinancieros.DtResultados
End If
ObjEdosFinancieros.Dispose()
GvDatos.DataSource = DT
GvDatos.DataBind()
If DT IsNot Nothing Then DT.Dispose()
End Sub
Protected Sub gvDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
LblCargo.Text = e.Row.DBCampo("cargos").FormatoNumero(2)
LblAbono.Text = e.Row.DBCampo("abonos").FormatoNumero(2)
LblConcepto.Text = e.Row.DBCampo("ConceptoPoliza")
LblNumPoliza.Text = e.Row.DBCampo("folio")
txtNumPol.Text = e.Row.DBCampo("folio")
TxtFechaPol.Text = e.Row.DBCampo("fecha").ToDate.ToShortDateString
DdlTipoPoliza.SelectedValue = e.Row.DBCampo("CodigoTipoPoliza").ToString.Trim
LblFechaActual.Text = e.Row.DBCampo("fecha").ToDate.ToShortDateString
LblTipoPoliza.Text = e.Row.DBCampo("TipoPoliza")
If LblFechaDe.Text = "" Then
LblFechaDe.Text = e.Row.DBCampo("fecha").ToDate.ToShortDateString
End If
If LblFechaAl.Text = "" Then
LblFechaAl.Text = e.Row.DBCampo("fecha").ToDate.ToShortDateString
End If
'Filtros1.TipoPoliza.SelectedValue = e.Row.DBCampo("CodigoTipoPoliza").Trim
'Filtros1.FechaFinal.Text = e.Row.DBCampo("fecha").ToDate.ToShortDateString
'Filtros1.TipoPoliza.SelectedItem.Text = e.Row.DBCampo("TipoPoliza")
End If
e.Row.FCLabel("D").Text = String.Format("<b>{0}</b><br />{1}", e.Row.DBCampo("Cuenta"), e.Row.DBCampo("CONCEPTO"))
e.Row.FCHyperLink("B").NavigateUrl = e.Row.DBCampo("SIGReferencia").ContaReferenciaLiga
' e.Row.FCLabel("C").Text = e.Row.DBCampo("CODIGO").Substring(0, 4) & "-" & e.Row.DBCampo("CODIGO").Substring(4, 2) & "-" & e.Row.DBCampo("CODIGO").Substring(6)
If e.Row.DBCampo("CARGO") = "0" Then e.Row.Cells(5).Text = ""
If e.Row.DBCampo("ABONO") = "0" Then e.Row.Cells(6).Text = ""
End If
End Sub
'Protected Sub cmdExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles cmdExcel.Click
' tbl.ExportToExcel("Poliza_" & Now.Year & If(Now.Month.ToString.Length = 1, "0" & Now.Month.ToString, Now.Month.ToString) & If(Now.Day.ToString.Length = 1, "0" & Now.Day.ToString, Now.Day.ToString))
'End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
Dim ObjEdosFinancieros As New ClsContPAQi(UsuarioActual.Empresa)
Dim DT As DataTable = Nothing
If ObjEdosFinancieros.GetPoliza(-1, TxtFechaPol.Text.Trim.ToDate.Year, TxtFechaPol.Text.Trim.ToDate.Month, DdlTipoPoliza.SelectedValue.ToEntero, txtNumPol.Text.Trim.ToEntero) Then
DT = ObjEdosFinancieros.DtResultados
End If
ObjEdosFinancieros.Dispose()
GvDatos.DataSource = DT
GvDatos.DataBind()
If DT.Rows.Count = 0 Then
LblCargo.Text = ""
LblAbono.Text = ""
LblConcepto.Text = ""
LblNumPoliza.Text = ""
LblTipoPoliza.Text = ""
LblFechaActual.Text = ""
Alert("La póliza solicitada no existe.", TipoMensaje.MsgAdvertencia)
End If
If DT IsNot Nothing Then DT.Dispose()
'LblFechaDe.Text = Filtros1.FechaFinal.Text
'LblFechaAl.Text = Filtros1.FechaFinal.Text
upTitulos.Update()
upDatos.Update()
End Sub
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden
'CargaGrid(Orden)
End Sub
#End Region
End Class