Commit inicial Ventas Productivo
This commit is contained in:
250
Inventarios/RepAlmacenPeriodo.aspx.vb
Normal file
250
Inventarios/RepAlmacenPeriodo.aspx.vb
Normal file
@@ -0,0 +1,250 @@
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Partial Class Inventarios_RepAlmacenPeriodo
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property TmpDT As DataTable
|
||||
Get
|
||||
Return CType(ViewState("TmpDT"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDT") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Ver As Integer
|
||||
Get
|
||||
Return CType(ViewState("VerEn"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("VerEn") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
Ver = 1
|
||||
CargaTipoAlmacen()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaTipoAlmacen()
|
||||
DdlTipoAlmacen.DataSource = GlobalDTTipoAlmacen(1)
|
||||
DdlTipoAlmacen.DataBind()
|
||||
DdlTipoAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim objInv As New ClsInventarios
|
||||
Dim FechaCorte As Date
|
||||
FechaCorte = If(IsDate(TxtFechaCorte.Text.Trim()), TxtFechaCorte.Text.ToDate, MaxFecha)
|
||||
Dim TipoAlmacen As String = If(DdlTipoAlmacen.GetSelectedValuesM = "", "-1", DdlTipoAlmacen.GetSelectedValuesM)
|
||||
|
||||
If RblTotal.Checked Then Ver = 1
|
||||
If RblExistencia.Checked Then Ver = 2
|
||||
|
||||
If objInv.GetRepAlmacenesPeriodo(FechaCorte, UsuarioActual.CveEmpresa, TipoAlmacen, DdlModalidadFiltro.SelectedValue.ToEntero, ChkInventariable.Checked, Ver) Then
|
||||
GVAlmacen.DataSource = objInv.DtResultados
|
||||
TmpDT = objInv.DtResultados
|
||||
End If
|
||||
objInv.Dispose()
|
||||
GVAlmacen.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GVAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If Not e.Row.DBCampo("CveAlmacen").ToEntero > 0 Then
|
||||
e.Row.CssClass = "Totales"
|
||||
End If
|
||||
If TxtFechaCorte.Text <> "" Then
|
||||
If TxtFechaCorte.Text.ToDate.Month < 12 Then
|
||||
e.Row.Cells(12).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 11 Then
|
||||
e.Row.Cells(11).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 10 Then
|
||||
e.Row.Cells(10).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 9 Then
|
||||
e.Row.Cells(9).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 8 Then
|
||||
e.Row.Cells(8).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 7 Then
|
||||
e.Row.Cells(7).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 6 Then
|
||||
e.Row.Cells(6).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 5 Then
|
||||
e.Row.Cells(5).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 4 Then
|
||||
e.Row.Cells(4).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 3 Then
|
||||
e.Row.Cells(3).Text = ""
|
||||
End If
|
||||
If TxtFechaCorte.Text.ToDate.Month < 2 Then
|
||||
e.Row.Cells(2).Text = ""
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnVerEn_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF()
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
Dim StrFiltro As New StringBuilder
|
||||
If TxtFechaCorte.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Corte </b>: {0}", TxtFechaCorte.Text.ToDate.ToShortDateString)
|
||||
If DdlTipoAlmacen.GetSelectedText <> "" Then StrFiltro.AppendFormat(" <b>Tipo Almacen</b>: {0}", DdlTipoAlmacen.GetSelectedText)
|
||||
|
||||
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.ToShortDateString))
|
||||
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepAlmacenPeriodo.rdlc", TmpDT, params, "ReporteAlmacenPeriodo")
|
||||
End Sub
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
Protected Sub LnkEXCEL_Click(sender As Object, e As EventArgs)
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
|
||||
If Not TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalGrafica').modal('show')")
|
||||
CargaGrafica()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGrafica()
|
||||
Dim Dt As New DataTable()
|
||||
Dt.Columns.Add("mes")
|
||||
|
||||
Dim Dt2 As New DataTable()
|
||||
Dt2.Columns.Add("balloonText")
|
||||
Dt2.Columns.Add("bullet")
|
||||
Dt2.Columns.Add("title")
|
||||
Dt2.Columns.Add("valueField")
|
||||
Dt2.Columns.Add("fillAlphas")
|
||||
|
||||
|
||||
Dim Cont As Integer = 1
|
||||
For Each Dr As DataRow In TmpDT.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 Then
|
||||
Dt.Columns.Add(Dr("Almacen").ToString)
|
||||
Dim Row4 As DataRow = Nothing
|
||||
Row4 = Dt2.NewRow()
|
||||
Select Case Ver
|
||||
Case 1
|
||||
Row4("balloonText") = "Total [[category]]: [[value]]"
|
||||
Case 2
|
||||
Row4("balloonText") = "Existencia [[category]]: [[value]]"
|
||||
End Select
|
||||
Row4("bullet") = "round"
|
||||
Row4("title") = Dr("Almacen").ToString
|
||||
Row4("valueField") = Dr("Almacen").ToString
|
||||
Row4("fillAlphas") = 0
|
||||
Dt2.Rows.Add(Row4)
|
||||
Cont += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim RowEnero As DataRow = Nothing
|
||||
RowEnero = Dt.NewRow()
|
||||
Dim RowFebrero As DataRow = Nothing
|
||||
RowFebrero = Dt.NewRow()
|
||||
Dim RowMarzo As DataRow = Nothing
|
||||
RowMarzo = Dt.NewRow()
|
||||
Dim RowAbril As DataRow = Nothing
|
||||
RowAbril = Dt.NewRow()
|
||||
Dim RowMayo As DataRow = Nothing
|
||||
RowMayo = Dt.NewRow()
|
||||
Dim RowJunio As DataRow = Nothing
|
||||
RowJunio = Dt.NewRow()
|
||||
Dim RowJulio As DataRow = Nothing
|
||||
RowJulio = Dt.NewRow()
|
||||
Dim RowAgosto As DataRow = Nothing
|
||||
RowAgosto = Dt.NewRow()
|
||||
Dim RowSeptiembre As DataRow = Nothing
|
||||
RowSeptiembre = Dt.NewRow()
|
||||
Dim RowOctubre As DataRow = Nothing
|
||||
RowOctubre = Dt.NewRow()
|
||||
Dim RowNoviembre As DataRow = Nothing
|
||||
RowNoviembre = Dt.NewRow()
|
||||
Dim RowDiciembre As DataRow = Nothing
|
||||
RowDiciembre = Dt.NewRow()
|
||||
For Each Dr As DataRow In TmpDT.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 Then
|
||||
RowEnero(Dr("Almacen").ToString) = Dr("Enero").ToString
|
||||
RowEnero("mes") = "Enero"
|
||||
RowFebrero(Dr("Almacen").ToString) = Dr("Febrero").ToString
|
||||
RowFebrero("mes") = "Febrero"
|
||||
RowMarzo(Dr("Almacen").ToString) = Dr("Marzo").ToString
|
||||
RowMarzo("mes") = "Marzo"
|
||||
RowAbril(Dr("Almacen").ToString) = Dr("Abril").ToString
|
||||
RowAbril("mes") = "Abril"
|
||||
RowMayo(Dr("Almacen").ToString) = Dr("Mayo").ToString
|
||||
RowMayo("mes") = "Mayo"
|
||||
RowJunio(Dr("Almacen").ToString) = Dr("Junio").ToString
|
||||
RowJunio("mes") = "Junio"
|
||||
RowJulio(Dr("Almacen").ToString) = Dr("Julio").ToString
|
||||
RowJulio("mes") = "Julio"
|
||||
RowAgosto(Dr("Almacen").ToString) = Dr("Agosto").ToString
|
||||
RowAgosto("mes") = "Agosto"
|
||||
RowSeptiembre(Dr("Almacen").ToString) = Dr("Septiembre").ToString
|
||||
RowSeptiembre("mes") = "Septiembre"
|
||||
RowOctubre(Dr("Almacen").ToString) = Dr("Octubre").ToString
|
||||
RowOctubre("mes") = "Octubre"
|
||||
RowNoviembre(Dr("Almacen").ToString) = Dr("Noviembre").ToString
|
||||
RowNoviembre("mes") = "Noviembre"
|
||||
RowDiciembre(Dr("Almacen").ToString) = Dr("Diciembre").ToString
|
||||
RowDiciembre("mes") = "Diciembre"
|
||||
End If
|
||||
Next
|
||||
Dt.Rows.Add(RowEnero)
|
||||
Dt.Rows.Add(RowFebrero)
|
||||
Dt.Rows.Add(RowMarzo)
|
||||
Dt.Rows.Add(RowAbril)
|
||||
Dt.Rows.Add(RowMayo)
|
||||
Dt.Rows.Add(RowJunio)
|
||||
Dt.Rows.Add(RowJulio)
|
||||
Dt.Rows.Add(RowAgosto)
|
||||
Dt.Rows.Add(RowSeptiembre)
|
||||
Dt.Rows.Add(RowOctubre)
|
||||
Dt.Rows.Add(RowNoviembre)
|
||||
Dt.Rows.Add(RowDiciembre)
|
||||
|
||||
RegistraScript($"CargaGraficaLineas({Dt.ToJson},{Dt2.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44")
|
||||
UpGrafica.Update()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user