Commit inicial Ventas Productivo
This commit is contained in:
345
Inventarios/RepMaximoMinimo.aspx.vb
Normal file
345
Inventarios/RepMaximoMinimo.aspx.vb
Normal file
@@ -0,0 +1,345 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Inventarios_RepMaximoMinimo
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES "
|
||||
Private Property PS As String
|
||||
Get
|
||||
If ViewState("PS") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("PS").ToString
|
||||
End If
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("PS") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DTOCDetalle As DataTable
|
||||
Get
|
||||
If ViewState("DTOCDetalle") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTOCDetalle"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTOCDetalle") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property PermiteClasificacion2 As Boolean
|
||||
Get
|
||||
Return (UsuarioActual.CveEmpresa.Contiene(72, 80))
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Private Sub Inventarios_RepMaximoMinimo_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region " INICIALIZA VALORES "
|
||||
Private Sub CargaCombos()
|
||||
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.Empresa.CveEmpresa, 1)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
|
||||
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.DataBind()
|
||||
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlAlmacenModal.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
DdlAlmacenModal.DataBind()
|
||||
DdlAlmacenModal.Items.Insert(0, New ListItem("Seleccione Almacén", "-1"))
|
||||
|
||||
DdlPSModal.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
DdlPSModal.DataBind()
|
||||
DdlPSModal.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
UpModalMaximoMinimo.Update()
|
||||
|
||||
|
||||
DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa)
|
||||
DdlClasificacion2.DataBind()
|
||||
DdlClasificacion2.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
'BLOQUEA DDL CLASIFICACION
|
||||
DivClaisficacionLabel.Visible = PermiteClasificacion2
|
||||
DivClasificacion2.Visible = PermiteClasificacion2
|
||||
TdModalClasificacion2.Visible = PermiteClasificacion2
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubProyecto.SelectedIndexChanged
|
||||
|
||||
'Dim DtSubptoyecto As DataTable = GlobalDTSubProyectos(-1, -1, UsuarioActual.Empresa.CveEmpresa, 1).FiltraParametros(String.Format(" CveSubProyecto ={0}", DdlSubProyecto.SelectedValue.ToEntero)) 'GlobalDTSucursales(" CveSucursal = ")
|
||||
DdlAlmacen.Items.Clear()
|
||||
'If DtSubptoyecto.Rows.Count > 0 Then
|
||||
'Dim CveSucursal As Integer = DtSubptoyecto(0)("CveSucursal").ToString.ToEntero
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto={0}", DdlSubProyecto.SelectedValue.ToEntero))
|
||||
DdlAlmacen.DataBind()
|
||||
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
'Else
|
||||
' DdlAlmacen.DataSource = Nothing
|
||||
' DdlAlmacen.DataBind()
|
||||
'End If
|
||||
|
||||
'GvDatos.DataSource = Nothing
|
||||
'GvDatos.DataBind()
|
||||
|
||||
'DdlAlmacen.SelectedIndex = 0
|
||||
OrdenaDatos()
|
||||
UpDatos.Update()
|
||||
UpTitulos.Update()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
Private Sub BtnFiltrar_Click(sender As Object, e As EventArgs) Handles BtnFiltrar.Click
|
||||
CargaGrid()
|
||||
OrdenaDatos()
|
||||
End Sub
|
||||
Private Sub CargaGrid()
|
||||
Dim ObjMaxMin As New ClsInventarios
|
||||
|
||||
If ObjMaxMin.RepMaximoMinimo(DdlSubProyecto.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjMaxMin.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
|
||||
If DdlAlmacen.SelectedValue.ToEntero > 0 Then
|
||||
GvDatos.Columns(9).Visible = True
|
||||
Else
|
||||
GvDatos.Columns(9).Visible = False
|
||||
End If
|
||||
|
||||
ObjMaxMin.Dispose()
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Private Sub OrdenaDatos()
|
||||
|
||||
'If (GvDatos.Rows.Count > 0) Then
|
||||
' GvDatos.UseAccessibleHeader = True
|
||||
' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
||||
' RegistraScript("OrdenarGV();", "ScriptOrdenamiento")
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCLiteral("LtCodigo").Text = $"<a class=""Texto"" target='_blank' href=""/Ventas/ProductosServicios.aspx?CvePS={e.Row.DataKey("CvePS")}"">{e.Row.DBCampo("Codigo")}</a>"
|
||||
e.Row.FCLabel("LtDescripcion").Text = $"<a class=""Texto"" target='_blank' href=""/Ventas/ProductosServicios.aspx?CvePS={e.Row.DataKey("CvePS")}"">{e.Row.DBCampo("PS")}</a>"
|
||||
|
||||
|
||||
|
||||
If e.Row.FCLinkButton("LnkPteRecibir").Text = "-" Then
|
||||
e.Row.FCLinkButton("LnkPteRecibir").Visible = False
|
||||
e.Row.FCLabel("LblPteRecibir").Visible = True
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " PENDIENTE POR RECIBIR "
|
||||
Private Sub GvDetalleOrdenCompra_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDetalleOrdenCompra.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCLiteral("LtlOc").Text = $"<a class=""Texto"" target='_blank' href=""/OC/OC.aspx?OC={e.Row.DataKey("CveOrdenCompra")}"">{e.Row.DBCampo("OC")}</a>"
|
||||
End If
|
||||
End Sub
|
||||
Public Sub Click_VerDetalleOC(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim activo As Boolean = False
|
||||
Dim CvePs As Integer = GvRow.DataKey("CvePS").ToString.ToEntero
|
||||
Dim CodigoPS As String = GvRow.DataKey("CodigoPS").ToString
|
||||
Dim Descripcion As String = GvRow.DataKey("PS").ToString
|
||||
|
||||
PS = Descripcion
|
||||
Dim objInventarios As New ClsInventarios
|
||||
|
||||
If objInventarios.RepMaximoMinimoDetalleGet(DdlSubProyecto.SelectedValue.ToEntero, CvePs, UsuarioActual.Empresa.CveEmpresa) Then
|
||||
DTOCDetalle = objInventarios.DtResultados
|
||||
GvDetalleOrdenCompra.DataSource = objInventarios.DtResultados
|
||||
End If
|
||||
OrdenaDatos()
|
||||
objInventarios.Dispose()
|
||||
GvDetalleOrdenCompra.DataBind()
|
||||
|
||||
LtlTitulo.Text = String.Format("{0}", CodigoPS)
|
||||
RegistraScript("$('#ModalDetalleOrdenCompra').modal({ backdrop: 'static', keyboard: false})", "ModalDetalle")
|
||||
|
||||
UpModaletalle.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " MODAL "
|
||||
Private Sub LnkDefinir_Click(sender As Object, e As EventArgs) Handles LnkDefinir.Click
|
||||
HFDefinir.Value = "I"
|
||||
DdlAlmacenModal.SelectedIndex = 0
|
||||
DdlPSModal.SelectedIndex = 0
|
||||
TxtMaximo.Text = ""
|
||||
TxtMinimo.Text = ""
|
||||
DdlAlmacenModal.Enabled = True
|
||||
DdlPSModal.Enabled = True
|
||||
LbAgregarMaximoMinimo.Text = "Agregar"
|
||||
UpModalMaximoMinimo.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "ModalMaximoMinimo"))
|
||||
End Sub
|
||||
|
||||
Private Sub LbAgregarMaximoMinimo_Click(sender As Object, e As EventArgs) Handles LbAgregarMaximoMinimo.Click
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
If HFDefinir.Value = "I" Then
|
||||
If ObjInventario.AddAlmacenMaximoMinimo(DdlAlmacenModal.SelectedValue.ToEntero, DdlPSModal.SelectedValue.ToEntero, TxtMaximo.Text.ToDouble, TxtMinimo.Text.ToDouble, UsuarioActual.CveUsuario) Then
|
||||
Alert("El Máximo/Mínimo se agregó correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ElseIf HFDefinir.Value = "U" Then
|
||||
If ObjInventario.UpdateAlmacenMaximoMinimo(DdlAlmacenModal.SelectedValue.ToEntero, DdlPSModal.SelectedValue.ToEntero, TxtMaximo.Text.ToDouble, TxtMinimo.Text.ToDouble, UsuarioActual.CveUsuario) Then
|
||||
Alert("El Máximo/Mínimo se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
|
||||
CargaGrid()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalMaximoMinimo"))
|
||||
ObjInventario.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateMaximoMinimo(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
HFDefinir.Value = "U"
|
||||
Dim CveAlmacen As Integer = GvRow.DataKey("CveAlmacen").ToString.ToEntero
|
||||
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToString.ToEntero
|
||||
Dim Maximo As String = GvRow.DataKey("Maximo").ToString
|
||||
Dim Minimo As String = GvRow.DataKey("Minimo").ToString
|
||||
|
||||
DdlAlmacenModal.Enabled = False
|
||||
DdlPSModal.Enabled = False
|
||||
|
||||
DdlAlmacenModal.SelectedValue = CveAlmacen.ToString
|
||||
DdlPSModal.SelectedValue = CvePS.ToString
|
||||
TxtMaximo.Text = Maximo
|
||||
TxtMinimo.Text = Minimo
|
||||
LbAgregarMaximoMinimo.Text = "Actualizar"
|
||||
UpModalMaximoMinimo.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "ModalMaximoMinimo"))
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
#Region "I M P R I M I R "
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
|
||||
GvDatos.ExportToExcel("RepFacturas_" & Now.ToShortDateString())
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF()
|
||||
Dim ObjDatos As New ClsInventarios
|
||||
|
||||
If ObjDatos.RepMaximoMinimo(DdlSubProyecto.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
If ObjDatos.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
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 dt As DataTable = ObjDatos.DtResultados
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("SubProyecto", DdlSubProyecto.SelectedItem.Text))
|
||||
params.Add(New ReportParameter("Almacen", DdlAlmacen.SelectedItem.Text))
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepMaximosMinimos.rdlc", dt, params, "ReporteMaxMin")
|
||||
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkImprimirDetalle_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If DTOCDetalle.Rows.Count > 0 Then
|
||||
|
||||
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 dt As DataTable = DTOCDetalle
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
params.Add(New ReportParameter("SubProyecto", DdlSubProyecto.SelectedItem.Text))
|
||||
params.Add(New ReportParameter("Almacen", DdlAlmacen.SelectedItem.Text))
|
||||
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("PS", PS))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepMaximosMinimosDetalle.rdlc", dt, params, "ReporteMaxMinDetalle")
|
||||
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
OrdenaDatos()
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " PERSONALIZAR COLUMNAS "
|
||||
Private Sub BtnPersonalizar_Click(sender As Object, e As EventArgs) Handles BtnPersonalizar.Click
|
||||
|
||||
If ChkClasificacion2.Checked Then
|
||||
GvDatos.Columns(1).Visible = True
|
||||
Else
|
||||
GvDatos.Columns(1).Visible = False
|
||||
End If
|
||||
|
||||
If ChkMarca.Checked Then
|
||||
GvDatos.Columns(3).Visible = True
|
||||
Else
|
||||
GvDatos.Columns(3).Visible = False
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivPersonalizar').modal('hide')")
|
||||
CargaGrid()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user