196 lines
6.9 KiB
VB.net
196 lines
6.9 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Bancos_RepCortes
|
|
Inherits ClsPaginas
|
|
Private Shared missing As Object = System.Reflection.Missing.Value
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property DtCortes As DataTable
|
|
Get
|
|
Return CType(ViewState("DtCortes"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtCortes") = value
|
|
End Set
|
|
End Property
|
|
Private Property DtCortesVentasResumen As DataTable
|
|
Get
|
|
Return CType(ViewState("DtCortesVentasResumen"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtCortesVentasResumen") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property DtCortesVentas As DataTable
|
|
Get
|
|
Return CType(ViewState("DtCortesVentas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtCortesVentas") = value
|
|
End Set
|
|
End Property
|
|
Private Property Fecha As String
|
|
Get
|
|
Return CType(ViewState("Fecha"), String)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Fecha") = value
|
|
End Set
|
|
End Property
|
|
Private Property Nombre As String
|
|
Get
|
|
Return CType(ViewState("Nombre"), String)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Nombre") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveCorte As Integer
|
|
Get
|
|
Return CType(ViewState("CveCorte"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCorte") = 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
|
|
txtFechaVI.Text = Now.ToShortDateString
|
|
txtFechaVF.Text = Now.ToShortDateString
|
|
Me.Form.DefaultButton = BtnConsultar.UniqueID
|
|
CargarCentrosDeCosto(Nothing, DdlSubProyectos, Nothing, LblSubProyecto)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " C A R G A - D A T O S "
|
|
Public Sub CargaDatos()
|
|
|
|
Dim FechaI As Date = If(txtFechaVI.Text <> "", txtFechaVI.Text.ToDate, MinFecha)
|
|
Dim FechaF As Date = If(txtFechaVF.Text <> "", txtFechaVF.Text.ToDate, MaxFecha)
|
|
|
|
Dim ObjPuntoVenta As New ClsPuntoVenta
|
|
If ObjPuntoVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaI, FechaF, DdlSubProyectos.SelectedValue.ToEntero) Then
|
|
DtCortes = ObjPuntoVenta.DtResultados.Copy()
|
|
End If
|
|
ObjPuntoVenta.Dispose()
|
|
|
|
GvDatos.DataSource = DtCortes
|
|
GvDatos.DataBind()
|
|
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
|
|
If e.Row.DBCampo("CveCorte").ToString = "" Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
If DtCortes IsNot Nothing Then
|
|
e.Row.FCLiteral("LtlImporteInicial").Text = DtCortes.SUMD("ImporteInicial").FormatoNumero(2)
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Protected Sub GvP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvP.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("MetodoPago").ToString = "Total" Then
|
|
e.Row.CssClass = "SubTotales"
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvD_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvD.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("CveVenta").ToString = "" Then
|
|
e.Row.CssClass = "Totales"
|
|
End If
|
|
If e.Row.DBCampo("ImportePagado").ToDecimal() < 0 Then
|
|
e.Row.FCLabel("LblTotal").CssClass = "badge badge-danger"
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
'Protected Sub GvD_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvD.RowCommand
|
|
' If e.CommandArgument.ToString.ToEntero > 0 Then
|
|
|
|
|
|
' End If
|
|
|
|
' Dim Vent As New ClsPuntoVenta
|
|
' If Vent.GetCortesDetalleVentas(16200, 61) Then
|
|
' Alert(Vent.DtResultados.Rows.Count.ToString)
|
|
' GvD.DataSource = Vent.DtResultados
|
|
' GvD.DataBind()
|
|
' 'RegistraScript("$get")
|
|
' divDetalle.Visible = True
|
|
' End If
|
|
|
|
' Vent.Dispose()
|
|
|
|
'End Sub
|
|
#End Region
|
|
|
|
#Region "BOTONES"
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
|
GvDatos.Columns(1).Visible = ChkUsuarioCancelacion.Checked
|
|
GvDatos.Columns(2).Visible = ChkTipo.Checked
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub LbDescripcion_Click(sender As Object, e As EventArgs)
|
|
Dim btn As LinkButton = DirectCast(sender, LinkButton)
|
|
Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow)
|
|
CveCorte = gvr.DataKey("CveCorte").ToString.ToEntero
|
|
Dim Finalizado As Integer = gvr.DataKey("Finalizado").ToString.ToEntero
|
|
Fecha = gvr.DataKey("FechaInicial").ToString
|
|
Nombre = gvr.DataKey("Nombre").ToString
|
|
Dim Vent As New ClsPuntoVenta
|
|
Dim Vn As New ClsVentas
|
|
If Vn.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GvP.DataSource = Vn.DtResultados
|
|
DtCortesVentasResumen = Vn.DtResultados
|
|
End If
|
|
If Vent.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GvD.DataSource = Vent.DtResultados
|
|
DtCortesVentas = Vent.DtResultados
|
|
divDetalle.Visible = True
|
|
End If
|
|
If DtCortesVentasResumen.Rows.Count > 0 Or DtCortesVentas.Rows.Count > 0 Then
|
|
HplDownPDF.Visible = True
|
|
HplDownEXCEL.Visible = True
|
|
HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "PDF", DdlSubProyectos.SelectedValue.ToEntero)))
|
|
HplDownEXCEL.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "EXCEL", DdlSubProyectos.SelectedValue.ToEntero)))
|
|
Else
|
|
HplDownPDF.Visible = False
|
|
HplDownEXCEL.Visible = False
|
|
End If
|
|
Vn.Dispose()
|
|
Vent.Dispose()
|
|
GvD.DataBind()
|
|
GvP.DataBind()
|
|
UPPDetalle.Update()
|
|
UpAcciones.Update()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
End Class
|