From 52593271df7b6630da0fea210d3d7dfe5b578bf5 Mon Sep 17 00:00:00 2001 From: Luis Quijada Date: Wed, 12 Mar 2025 19:44:50 -0700 Subject: [PATCH] =?UTF-8?q?Modulo=20de=20Orden=20De=20Producci=C3=B3n=20De?= =?UTF-8?q?talles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OP/OP.aspx | 244 +++++++++++++++++++++++++++++++++++++++++++++++ OP/OP.aspx.vb | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 501 insertions(+) create mode 100644 OP/OP.aspx create mode 100644 OP/OP.aspx.vb diff --git a/OP/OP.aspx b/OP/OP.aspx new file mode 100644 index 000000000..5ee985b8d --- /dev/null +++ b/OP/OP.aspx @@ -0,0 +1,244 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OP.aspx.vb" Inherits="OP_OP" %> + + + + + + + + + Orden de Producción + + + + + + + + + + + +
+ +
+

Orden de producción #

+
+ + + +
+
+ +
+
+ + +
+
+ + +
+ +
+ + Proyecto: + +
+ +
+ + Subproyecto: + +
+ +
+
+ +
+ + +
+ + + +
+ + +
+
+ +
+
+
+ + + + +
+ + + + + + +
+
+ + +
+ +
+ +
+ +
+ + + + +
+
+
Productos
+ + + + + + + +
+
+
+
+
Materia prima
+ + + + + + + + +
+
+ +
+
Mano de obra
+ + + + + + +
+ +
+
+
Costo indirecto
+ + + + + + +
+
+
+
+
+
+
+
+ + + + + diff --git a/OP/OP.aspx.vb b/OP/OP.aspx.vb new file mode 100644 index 000000000..fe1b4e75e --- /dev/null +++ b/OP/OP.aspx.vb @@ -0,0 +1,257 @@ +Imports System.Data +Imports System.Drawing +Imports DocumentFormat.OpenXml.Drawing.Diagrams +Imports System.IO +Imports Extensiones +Imports Microsoft.Reporting.WebForms +Imports Org.BouncyCastle.Asn1.Utilities +Partial Class OP_OP + Inherits ClsPaginas + +#Region "Propiedades" + Private Property CveOP As Integer + Get + Return ViewState("CveOP").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveOP") = value + End Set + End Property + + Private Property DtPS As DataTable + Get + Return DirectCast(ViewState("DtPS"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPS") = value + End Set + End Property + + Private Property DtMP As DataTable + Get + Return DirectCast(ViewState("DtMP"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMP") = value + End Set + End Property + + Private Property DtMO As DataTable + Get + Return DirectCast(ViewState("DtMO"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMO") = value + End Set + End Property + + Private Property DtCI As DataTable + Get + Return DirectCast(ViewState("DtCI"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCI") = 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 + CveOP = If(Request("CveOP") <> "", Request("CveOP").ToString.ToEntero, "-1".ToEntero) + CreaPS() + SetValues() + End If + End Sub + + Private Sub CreaPS() + DtPS = New DataTable() + DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtPS.Columns.Add("Clave", GetType(Integer)) + DtPS.Columns.Add("PSCodigo", GetType(String)) + DtPS.Columns.Add("UnidadMedida", GetType(String)) + DtPS.Columns.Add("Cantidad", GetType(Decimal)) + DtPS.Columns.Add("Surtido", GetType(Decimal)) + DtPS.Columns.Add("Costo", GetType(Decimal)) + + DtMP = New DataTable() + DtMP.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtMP.Columns.Add("Clave", GetType(Integer)) + DtMP.Columns.Add("Producto", GetType(String)) + DtMP.Columns.Add("UnidadMedida", GetType(String)) + DtMP.Columns.Add("Cantidad", GetType(Decimal)) + DtMP.Columns.Add("Surtido", GetType(Decimal)) + + DtMO = New DataTable() + DtMO.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtMO.Columns.Add("Clave", GetType(Integer)) + DtMO.Columns.Add("Puesto", GetType(String)) + DtMO.Columns.Add("Cantidad", GetType(Decimal)) + + DtCI = New DataTable() + DtCI.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI + DtCI.Columns.Add("Clave", GetType(Integer)) + DtCI.Columns.Add("Producto", GetType(String)) + DtCI.Columns.Add("Cantidad", GetType(Decimal)) + + + End Sub + + Private Sub SetValues() + + CargarClientes() + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) + CargarProductos() + + If CveOP = -1 Then + ' Modo registro: mostrar dropdowns y ocultar los TextBox + DdlClientes.Enabled = True + DdlProyecto.Enabled = True + DdlSubProyecto.Enabled = True + DdlPS.Enabled = True + + Else + DdlClientes.Enabled = False + DdlProyecto.Enabled = False + DdlSubProyecto.Enabled = False + DdlPS.Enabled = False + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + If CveOP > 0 Then + Dim ObjOP As New ClsOP() + If ObjOP.GetOP(CveOP, -1, -1, -1, -1, -1, MinFecha, MaxFecha, UsuarioActual.CveEmpresa) Then + Dim DTOP As DataTable = ObjOP.DtResultados + If DTOP.Rows.Count > 0 Then + Dim dr As DataRow = DTOP.Rows(0) + LblCveOP.Text = CveOP.ToString + DdlClientes.txtText.Value = dr("Cliente").ToString + DdlClientes.txtValue.Value = dr("CveCliente").ToString + TxtEstatus.Text = dr("Estatus").ToString + DdlSubProyecto.SelectedValue = dr("CveSubProyecto").ToString + DdlPS.txtText.Value = dr("Producto").ToString + DdlPS.txtValue.Value = dr("CvePS").ToString + Txtfecha.Text = dr("Fecha").ToString + TxtDescripcion.Text = dr("Descripcion").ToString + End If + End If + ObjOP.Dispose() + End If + End Sub + + Private Sub CargarClientes() + 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("Seleccione Cliente", "-1")) + End If + End Sub + + Private Sub CargarProductos() + 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 + End Sub + + Protected Sub BtnAgregarProducto_Click(sender As Object, e As EventArgs) Handles BtnAgregarProducto.Click + If DdlPS.SelectedValue = "-1" Then Exit Sub + + Dim newRow As DataRow = DtPS.NewRow() + Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero + Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + + newRow("Tipo") = "Producto" + newRow("Clave") = CvePS + newRow("PSCodigo") = DrPS("PSCodigo") + newRow("UnidadMedida") = DrPS("UnidadMedida") + newRow("Cantidad") = 1 + newRow("Surtido") = 0 + newRow("Costo") = 0 + DtPS.Rows.Add(newRow) + 'consultas GetMPReceta, GetMOReceta, GetCIReceta + + + Dim CveUM As Integer = DrPS("CveUnidadMedida").ToString.ToEntero + + Dim ObjMP As New ClsOP() + If ObjMP.GetMPReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drMP As DataRow In ObjMP.DtResultados.Rows + Dim rowMP As DataRow = DtMP.NewRow() + rowMP("Tipo") = "MP" + rowMP("Clave") = CvePS + rowMP("Producto") = drMP("producto").ToString() + rowMP("UnidadMedida") = drMP("UnidadMedida").ToString() + rowMP("Cantidad") = drMP("Cantidad").ToString().ToDecimal() + rowMP("Surtido") = 0 + DtMP.Rows.Add(rowMP) + Next + End If + + + Dim ObjMO As New ClsOP() + If ObjMO.GetMOReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drMO As DataRow In ObjMO.DtResultados.Rows + Dim rowMO As DataRow = DtMO.NewRow() + rowMO("Tipo") = "MO" + rowMO("Clave") = CvePS + rowMO("Puesto") = drMO("Puesto").ToString() + rowMO("Cantidad") = drMO("Cantidad").ToString().ToDecimal() + DtMO.Rows.Add(rowMO) + Next + End If + + + Dim ObjCI As New ClsOP() + If ObjCI.GetCIReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then + For Each drCI As DataRow In ObjCI.DtResultados.Rows + Dim rowCI As DataRow = DtCI.NewRow() + rowCI("Tipo") = "CI" + rowCI("Clave") = CvePS + rowCI("Producto") = drCI("producto").ToString() + rowCI("Cantidad") = drCI("Cantidad").ToString().ToDecimal() + DtCI.Rows.Add(rowCI) + Next + End If + + ActualizarGrids() + End Sub + + Private Sub ActualizarGrids() + GvProductos.DataSource = DtPS.Select("Tipo = 'Producto'").CopyToDataTable() + GvProductos.DataBind() + + + GvMateriaPrima.DataSource = DtMP.Select("Tipo = 'MP'").CopyToDataTable() + GvMateriaPrima.DataBind() + + GvManoObra.DataSource = DtMO.Select("Tipo = 'MO'").CopyToDataTable() + GvManoObra.DataBind() + + + GvCostosIndirectos.DataSource = DtCI.Select("Tipo = 'CI'").CopyToDataTable() + GvCostosIndirectos.DataBind() + + + UpGvDatosOP.Update() + End Sub + + + +End Class + +