From 9c42ed5ea6205afdcec0233bf7146fda53df1bcd Mon Sep 17 00:00:00 2001 From: Luis Quijada Date: Thu, 13 Mar 2025 09:53:23 -0700 Subject: [PATCH] Modulo Orden Produccion Detalle --- App_Code/ClsOP.vb | 126 ++++++++- App_Code/ClsPaginas.vb | 30 +++ OP/RepOP.aspx | 216 +++++++++++++++ OP/RepOP.aspx.vb | 161 +++++++++++ Sistemas/RolesDetalle.aspx | 536 ++++++++++++++++++------------------- 5 files changed, 797 insertions(+), 272 deletions(-) create mode 100644 OP/RepOP.aspx create mode 100644 OP/RepOP.aspx.vb diff --git a/App_Code/ClsOP.vb b/App_Code/ClsOP.vb index 16b22fa7b..8688a3969 100644 --- a/App_Code/ClsOP.vb +++ b/App_Code/ClsOP.vb @@ -2,6 +2,7 @@ Imports System.Data Imports System.Data.SqlClient Imports Microsoft.VisualBasic +Imports Telerik.Web.UI.ImageEditor Public Class ClsOP Implements IDisposable @@ -112,7 +113,55 @@ Public Class ClsOP Public Function GetProductosOP(CveOP As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_OP_ProductosGET") + DataAdapter("PA_OP_ProductosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosMO(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosMOGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosMP(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosMPGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetProductosCI(CveOP As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_ProductosCIGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveOP", SqlDbType.Int).Value = CveOP .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa @@ -359,7 +408,7 @@ Public Class ClsOP #Region "O R D E N E S D E P R O D U C C I O N" - Public Function GetReportesOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean + Public Function GetReportesOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OP_OrdendeProduccionGet") With SqlAdapter.SelectCommand.Parameters @@ -369,8 +418,8 @@ Public Class ClsOP .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus .Add("@Asignado", SqlDbType.Int).Value = Asignado - .Add("@FechaI", SqlDbType.Date).Value = FechaInicio - .Add("@FechaF", SqlDbType.Date).Value = FechaFin + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -382,6 +431,75 @@ Public Class ClsOP Return Retorno End Function + Public Function GetOP(CveOP As Integer, CveCliente As Integer, CveSubProyecto As Integer, CvePS As Integer, CveEstatus As Integer, Asignado As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_OrdendeProduccionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@Asignado", SqlDbType.Int).Value = Asignado + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetEstatusOP(CveEmpresa As Integer, Optional CveEstatusOP As Integer = -1, Optional TipoEstatus As Integer = -1, Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OP_EstatusOPGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveEstatusOP", SqlDbType.Int).Value = CveEstatusOP + .Add("@TipoEstatus", SqlDbType.Int).Value = TipoEstatus + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Estatus de Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateOP(CveOP As Integer, Descripcion As String, CveCliente As Integer, CvePS As Integer, CveSubProyecto As Integer, Cantidad As Integer, Fecha As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OP_OrdendeProduccionUp") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOP", SqlDbType.Int).Value = CveOP + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Cantidad", SqlDbType.Int).Value = Cantidad + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar la orden de producción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + + #End Region #Region "IDisposable Support" ' IDisposable diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b9c0c104c..e47dd72cc 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -403,6 +403,33 @@ Public Class ClsPaginas Application("GlobalDTEstatus") = value End Set End Property + +#Region "ordenes de producción" + Property GlobalDTOPEstatus(CveEmpresa As Integer, Optional Estatus As Integer = -1) As DataTable + Get + Dim AppNombre As String = $"GlobalDTOPEstatus-{CveEmpresa}" + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Using ObjOP As New ClsOP + If ObjOP.GetEstatusOP(CveEmpresa) Then Application(AppNombre) = ObjOP.DtResultados + End Using + End If + Dim filtros As New List(Of String) + If Estatus <> -1 Then filtros.Add($"Estatus = {Estatus}") + + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) + GlobalDTOPEstatus = Dv.ToTable + Dv.Dispose() + Else + GlobalDTOPEstatus = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTOPEstatus-{CveEmpresa}" + Application(AppNombre) = value + End Set + End Property +#End Region Property DtFacturaDefault() As DataTable Get DtFacturaDefault = DirectCast(Application("DtFacturaDefault"), DataTable) @@ -9892,6 +9919,7 @@ Public Class ClsPaginas PaginaDict.Add("/OI/ConvocatoriaDetalle.aspx".ToUpper(), 908) PaginaDict.Add("/OI/RepReuniones.aspx".ToUpper(), 908) PaginaDict.Add("/AdSistemasTeam/ProcedimientosAlmacenados.aspx".ToUpper(), -1) + PaginaDict.Add("/OS/CatOrdenesServiciosCaracteristicas.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOSCaracteristicasOpciones.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatSubTiposOrdenesServicios.aspx".ToUpper(), -1) @@ -11125,6 +11153,8 @@ Public Class ClsPaginas #Region "Ordenes de Produccion" PaginaDict.Add("/OP/CatConfiguracionProducto.aspx".ToUpper(), 790) PaginaDict.Add("/OP/RepOS.aspx".ToUpper(), 791) + PaginaDict.Add("/OP/OP.aspx".ToUpper(), -1) + PaginaDict.Add("/OP/RepOP.aspx".ToUpper(), -1) #End Region 'Antes de aquí. diff --git a/OP/RepOP.aspx b/OP/RepOP.aspx new file mode 100644 index 000000000..43dfa4ed2 --- /dev/null +++ b/OP/RepOP.aspx @@ -0,0 +1,216 @@ +<%@ Page Title="Orden de Produccion" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepOP.aspx.vb" Inherits="OP_RepOP" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + +
+ <%-- --%> +
+
+
+
+ +
  • + Agregar Orden de Producción +
  • +
    + + Orden de Producción + + + + + + +
    +
    +
    + + +
    + +
    +
    + +
    + +
    + + + Proyecto: + +
    + +
    + + Subproyecto: + +
    + +
    + + +
    + + + +
    +
    +
    +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + diff --git a/OP/RepOP.aspx.vb b/OP/RepOP.aspx.vb new file mode 100644 index 000000000..5522baed5 --- /dev/null +++ b/OP/RepOP.aspx.vb @@ -0,0 +1,161 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports Ionic.Zlib +Imports Microsoft.Reporting.WebForms + +Partial Class OP_RepOP + Inherits ClsPaginas + +#Region "PROPIEDADES" + + Private Property DtOp As DataTable + Get + Return DirectCast(ViewState("DtOp"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtOp") = value + End Set + End Property + Private Property Agrupador As String + Get + Return ViewState("Agrupador").ToString + End Get + + Set(value As String) + ViewState("Agrupador") = value + End Set + End Property + Private Property TCEspecifico As Double + Get + Return ViewState("TCEspecifico").ToString.ToDouble + End Get + + Set(value As Double) + ViewState("TCEspecifico") = value + End Set + End Property + Private Property TipoCambio As Integer + Get + Return ViewState("TipoCambio").ToString.ToEntero + End Get + + Set(value As Integer) + ViewState("TipoCambio") = value + End Set + End Property + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") + 'CargarMarcas() + SetValues() + End If + End Sub + + +#Region " CARGA DATOS INICIALES " + Private Sub SetValues() + 'Carga Productos + DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPS.SelectedText = "" + DdlPS.SelectedValue = "-1" + Else + DdlPS.ddl.Items.Clear() + DdlPS.ddl.DataBind() + DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + + 'CargaEstatus + DdlEstatusOP.DataSource = GlobalDTOPEstatus(UsuarioActual.CveEmpresa) + DdlEstatusOP.DataBind() + DdlEstatusOP.Items.Add(New ListItem("Canceladas", "4")) + DdlEstatusOP.SelectedValue = "-1" + + + 'Carga Clasificacion del cliente + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) + + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlClientes.setEsWebService(True) + Else + DdlClientes.setEsWebService(False) + DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlClientes.DataBind() + DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + End If + + DdlEstatusOP.DataSource = GlobalDTOPEstatus(UsuarioActual.CveEmpresa) + DdlEstatusOP.DataBind() + + txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString + txtFechaF.Text = NowADS().ToShortDateString + + If UsuarioActual.TienePermisoProceso(339) Then + GvDatos.Columns(3).Visible = False + GvDatos.Columns(4).Visible = False + GvDatos.Columns(5).Visible = False + GvDatos.Columns(6).Visible = False + End If + + End Sub +#End Region + + +#Region " CARGA DATOS " + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatos() + UPDatos.Update() + End Sub + + Private Sub CargaDatos() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1) + + Dim ObjOP As New ClsOP() + If ObjOP.GetReportesOP(-1, DdlClientes.SelectedValue.ToEntero, + DdlSubProyecto.SelectedValue.ToEntero, + DdlPS.SelectedValue.ToEntero, + DdlEstatusOP.SelectedValue.ToEntero, + -1, + FechaI, FechaF, + UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjOP.DtResultados + DtOp = ObjOP.DtResultados + + Else + GvDatos.DataSource = Nothing + End If + ObjOP.Dispose() + GvDatos.DataBind() + End Sub + +#End Region + +#Region "Gv Datos" + Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + 'Verificar si el DataKey existe + If e.Row.DataItem IsNot Nothing AndAlso GvDatos.DataKeys.Count > e.Row.RowIndex Then + Dim CveOP As Integer = GvDatos.DataKeys(e.Row.RowIndex).Value.ToString().ToEntero() + Dim Liga As String = $"/OP/OP.aspx?CveOP={CveOP}" + + 'Acceder al control solo si existe + Dim hl As HyperLink = TryCast(e.Row.FindControl("HlAgregarOrdenOP"), HyperLink) + If hl IsNot Nothing Then + hl.NavigateUrl = Liga + End If + End If + End If + End Sub +#End Region +End Class diff --git a/Sistemas/RolesDetalle.aspx b/Sistemas/RolesDetalle.aspx index 49659bde2..ca62e6793 100644 --- a/Sistemas/RolesDetalle.aspx +++ b/Sistemas/RolesDetalle.aspx @@ -1,317 +1,317 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RolesDetalle.aspx.vb" Inherits="Sistemas_RolesDetalle" %> + <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RolesDetalle.aspx.vb" Inherits="Sistemas_RolesDetalle" %> - - - - - - Rol: - - - - - - - - - + + + + + + Rol: + + + + + + + + + - - - + + + - - - - -
    -
    -
    -
    -
    - - General -
    -
    -
    + + + + +
    +
    +
    +
    +
    + + General
    -
    -
    - -
    -
    -
    -
    - - -
    -
    - - - <%-- --%> - -
    -
    -
    - -
    - -
    - -   - +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    + + + <%-- --%> + +
    +
    +
    + +
    + +
    + +   + +
    +
    + +
    +
    + + +
    +
    + + +
    -
    - - -
    -
    - - -
    -
    -
    - - - - - - - - - - - -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " class="btn btn-circle btn-sm label-info"> -
    - -
    -
    - - - - - - - - - - - - - P - - - - - - - - - - - + + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " class="btn btn-circle btn-sm label-info">
    -
    - - - - + +
    +
    + + + + + + + + + + + + + P + + + + + + + + + - - - - -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " class="btn btn-circle btn-sm label-info"> -
    - -
    -
    - - - - - - - - - - - - - P - - - - - - - - - - +
    -
    - - - - + + + + + + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " class="btn btn-circle btn-sm label-info"> +
    + +
    +
    + + + + + + + + + + + + + P + + + + + + + + + + + +
    +
    +
    +
    +
    +
    - - - - -
    -
    -
    -
    -
    - - Indicadores + + + + +
    +
    +
    +
    +
    + + Indicadores +
    +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + +
    +
    +
    +
    +
    -
    -
    -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + +
    +
    + +
    +
    +
    + + Usuarios +
    +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    - - - - - - - - - - -
    -
    - -
    -
    -
    - - Usuarios -
    -
    -
    -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    - -
    - +
    -
    +
    + + + + + +
    -
    - - - - - - -
    -
    - - - - + + + + - -
    + +
    - - - - -
    - -
    + + + + +
    + +
    - - + + - <%--MODAL ADJUNTAR--%> -