159 lines
7.0 KiB
VB.net
159 lines
7.0 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class RepAuxiliar
|
|
Inherits ClsPaginas
|
|
|
|
Private Property DTCuentas As DataTable
|
|
Get
|
|
Return CType(ViewState("DTCuentas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTCuentas") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property Saldo As Double
|
|
Get
|
|
Return CType(ViewState("Saldo"), Double)
|
|
End Get
|
|
Set(value As Double)
|
|
ViewState("Saldo") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
'*************************************************************************
|
|
'* NOTA: Borrar las siguientes 2 lineas cuando este operando normalmente *
|
|
'*************************************************************************
|
|
TxtFechaDel.Text = "01/01/2002"
|
|
TxtFechaAl.Text = Date.Today.ToShortDateString
|
|
CargaTipoCuentas()
|
|
TxtCuenta.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaTipoCuentas()
|
|
Dim ObjTipoCuenta As New ClsContPAQi(UsuarioActual.Empresa)
|
|
Dim strGlobal As String = ""
|
|
|
|
If ObjTipoCuenta.GetCuentas(-1, "-1", -1) Then
|
|
Dim dr As DataRow = ObjTipoCuenta.DtResultados.FiltroPrimero("Codigo IN ('_GLOBAL')")
|
|
If dr IsNot Nothing Then strGlobal = dr.Item(0).ToString
|
|
DTCuentas = ObjTipoCuenta.DtResultados.FiltraParametros("Afectable = 1")
|
|
DdlTipoCuentas.DataSource = ObjTipoCuenta.DtResultados.FiltraParametros("Codigo IN ('_ACTIVO', '_BPASIVO', '_CAPITAL', '_CUADRE', '_ESTADISTICAS', '_ORDEN', '_RAACREEDOR', '_RDEUDOR', '_UTILIDAD')")
|
|
End If
|
|
ObjTipoCuenta.Dispose()
|
|
DdlTipoCuentas.DataBind()
|
|
If strGlobal.Length > 0 Then DdlTipoCuentas.Items.Insert(0, New ListItem("Todas", strGlobal))
|
|
DdlTipoCuentas.Items.Add(New ListItem("Algun específico", "-2"))
|
|
DdlTipoCuentas.SelectedIndex = 0
|
|
|
|
End Sub
|
|
|
|
Protected Sub ButConsultar_Click(sender As Object, e As EventArgs) Handles ButConsultar.Click
|
|
CargaPolizas()
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaPolizas()
|
|
''*************************************************************************
|
|
''* NOTA: Borrar las siguientes 2 lineas cuando este operando normalmente *
|
|
''*************************************************************************
|
|
Dim strFechaDel As String = TxtFechaDel.Text
|
|
Dim strFechaAl As String = TxtFechaAl.Text
|
|
|
|
Dim ObjPolizas As New ClsEdosFinancieros(UsuarioActual.Empresa)
|
|
|
|
If DdlTipoCuentas.SelectedValue <> "-2" Then
|
|
If ObjPolizas.GetMovimientosAuxiliares(DdlTipoCuentas.SelectedValue.ToEntero, strFechaDel.ToDate, strFechaAl.ToDate) Then
|
|
GvPolizas.DataSource = ObjPolizas.Data
|
|
Else
|
|
GvPolizas.DataSource = Nothing
|
|
End If
|
|
Else
|
|
If ObjPolizas.GetMovimientosAuxiliares(HdnCveCuenta.Value.ToEntero, strFechaDel.ToDate, strFechaAl.ToDate) Then
|
|
GvPolizas.DataSource = ObjPolizas.Data
|
|
Else
|
|
GvPolizas.DataSource = Nothing
|
|
End If
|
|
End If
|
|
ObjPolizas.Dispose()
|
|
GvPolizas.DataBind()
|
|
'UpPolizas.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvPolizas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPolizas.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(83) 'Fecha
|
|
e.Row.Cells(1).Width = Unit.Pixel(83) 'TipoPoliza
|
|
e.Row.Cells(2).Width = Unit.Pixel(60) 'Numero
|
|
e.Row.Cells(3).Width = Unit.Pixel(205) 'Concepto
|
|
e.Row.Cells(4).Width = Unit.Pixel(162) 'Referencias
|
|
e.Row.Cells(5).Width = Unit.Pixel(92) 'Cargos
|
|
e.Row.Cells(6).Width = Unit.Pixel(92) 'Abonos
|
|
e.Row.Cells(7).Width = Unit.Pixel(92) 'Saldos
|
|
End If
|
|
If e.Row.DBCampo("Id").ToEntero > 0 And e.Row.DBCampo("IdPoliza").ToEntero = -1 Then
|
|
e.Row.Font.Bold = True
|
|
e.Row.FCLabel("LblFecha").Text = e.Row.DBCampo("Codigo")
|
|
e.Row.FCLabel("LblConcepto").Text = e.Row.DBCampo("Nombre")
|
|
If e.Row.FCLabel("LblSI").Text.ToEntero > -1 Then
|
|
e.Row.FCHyperLink("HplIdPoliza").Text = ""
|
|
e.Row.FCLabel("LblCargos").Text = ""
|
|
e.Row.FCLabel("LblAbonos").Text = "Saldo inicial:"
|
|
Saldo = 0
|
|
Else
|
|
e.Row.FCLabel("LblFecha").Text = ""
|
|
e.Row.FCHyperLink("HplIdPoliza").Text = ""
|
|
e.Row.FCLabel("LblConcepto").Text = ""
|
|
e.Row.FCLabel("LblReferencia").Text = "Total:"
|
|
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(5).Style.Add("border-top-style", "solid")
|
|
e.Row.Cells(6).Style.Add("border-top-style", "solid")
|
|
e.Row.Cells(7).Style.Add("border-top-style", "solid")
|
|
e.Row.FCLabel("LblSI").Text = Saldo.FormatoNumero
|
|
If Saldo < 0 Then e.Row.FCLabel("LblSI").ForeColor = Drawing.Color.Red
|
|
End If
|
|
Else
|
|
Saldo = Saldo + e.Row.FCLabel("LblCargos").Text.ToDouble - e.Row.FCLabel("LblAbonos").Text.ToDouble
|
|
e.Row.FCLabel("LblSI").Text = Saldo.FormatoNumero
|
|
If Saldo < 0 Then e.Row.FCLabel("LblSI").ForeColor = Drawing.Color.Red
|
|
If e.Row.FCLabel("LblAbonos").Text.ToEntero = 0 Then e.Row.FCLabel("LblAbonos").Text = ""
|
|
If e.Row.FCLabel("LblCargos").Text.ToEntero = 0 Then e.Row.FCLabel("LblCargos").Text = ""
|
|
End If
|
|
If e.Row.DBCampo("IdPoliza").ToEntero > 0 Then e.Row.FCHyperLink("HplIdPoliza").NavigateUrl = String.Format("/contabilidad/RegPoliza.aspx?IdPoliza={0}", e.Row.DBCampo("IdPoliza"))
|
|
e.Row.Cells(0).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(1).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(2).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(3).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(4).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(5).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(6).BorderStyle = BorderStyle.None
|
|
e.Row.Cells(7).BorderStyle = BorderStyle.None
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Function WSCuentas() As String
|
|
Dim Str As New StringBuilder
|
|
Dim i As Integer = 0
|
|
Dim dt As DataTable = DTCuentas.FiltraParametros("Afectable = 1")
|
|
|
|
For Each dr As DataRow In dt.Rows
|
|
i += 1
|
|
Str.AppendFormat("{{value:""{0}"",label:""{1}""}}{2}", dr("Id"), dr("CtaCodigo").ToString.Replace("""", ""), If(i < dt.Rows.Count, ",", ""))
|
|
Next
|
|
|
|
Return Str.ToString
|
|
End Function
|
|
|
|
|
|
End Class
|