Se agrego el catalogo de configuracion de productos
This commit is contained in:
384
App_Code/ClsOP.vb
Normal file
384
App_Code/ClsOP.vb
Normal file
@@ -0,0 +1,384 @@
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
Public Class ClsOP
|
||||
Implements IDisposable
|
||||
|
||||
#Region "Campos"
|
||||
'SQL
|
||||
Private SqlConexion As SqlConnection
|
||||
Private SqlAdapter As SqlDataAdapter
|
||||
Private SqlCommand As SqlCommand
|
||||
Private SqlTransacc As SqlTransaction
|
||||
Private Data As DataTable
|
||||
Protected DTSet As DataSet
|
||||
|
||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
'REGISTRAR CONEXIÓN
|
||||
Private CveConexion As Integer = 0
|
||||
Private EsTransaccionCompartida As Boolean = False
|
||||
|
||||
Public ReadOnly Property DtResultados() As DataTable
|
||||
Get
|
||||
DtResultados = Data
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DTSetResultados() As DataSet
|
||||
Get
|
||||
Return DTSet
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
|
||||
|
||||
If TransaccionCompartida Is Nothing Then
|
||||
SqlConexion = New SqlConnection
|
||||
SqlConexion.ConnectionString = ClsPaginas.UsuarioActualRutaDB
|
||||
Try
|
||||
SqlConexion.Open()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
|
||||
End Try
|
||||
Else
|
||||
SqlConexion = TransaccionCompartida.Connection
|
||||
SqlTransacc = TransaccionCompartida
|
||||
EsTransaccionCompartida = True
|
||||
End If
|
||||
|
||||
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
||||
ConexionAdd()
|
||||
End Sub
|
||||
Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand
|
||||
.Parameters.Clear()
|
||||
.CommandText = StrSQL
|
||||
.CommandType = TipoComando
|
||||
End With
|
||||
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||
Data = New DataTable
|
||||
End Sub
|
||||
#Region "Conexiones"
|
||||
|
||||
Private Sub ConexionAdd()
|
||||
If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||
Try
|
||||
DataAdapter("PA_Sis_RegistrarConexion")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
||||
.Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
|
||||
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
End With
|
||||
SqlAdapter.Fill(Data)
|
||||
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ConexionClose()
|
||||
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||
|
||||
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
CveConexion = 0
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
Public Function IniciaTransacSQL() As SqlTransaction
|
||||
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
||||
Return SqlTransacc
|
||||
End Function
|
||||
Public Sub RollBack()
|
||||
SqlTransacc.Rollback()
|
||||
End Sub
|
||||
Public Sub Commit()
|
||||
SqlTransacc.Commit()
|
||||
End Sub
|
||||
|
||||
#Region "CONFIGURACION PRODUCTOS"
|
||||
|
||||
|
||||
Public Function GetProductosOP(CveOP As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
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 GetCIReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_CostoIndirectoRecetaGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener la receta de ci del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddCI(Cantidad As Decimal, CvePS As Integer, CvePSMateriaPrima As Integer, CveUM As Integer, CveUMMateriaPrima As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_CIAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CvePSMateriaPrima", SqlDbType.Int).Value = CvePSMateriaPrima
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveUMMateriaPrima", SqlDbType.Int).Value = CveUMMateriaPrima
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar el costo indirecto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveCI(CveOPPS As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_CIRemove")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveOPPS", SqlDbType.Int).Value = CveOPPS
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el costo indirecto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetMOReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_ManodeObraRecetaGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener la receta de mo del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddMO(Cantidad As Decimal, CvePS As Integer, CvePuesto As Integer, CveUM As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MOAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar la mano de obra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveMO(CveOPManoObra As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MORemove")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveOPManoObra", SqlDbType.Int).Value = CveOPManoObra
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar la mano de obra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetMPReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MateriaPrimaRecetaGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener la receta de mp del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddMP(Cantidad As Decimal, CvePS As Integer, CvePSMateriaPrima As Integer, CveUM As Integer, CveUMMateriaPrima As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MPAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CvePSMateriaPrima", SqlDbType.Int).Value = CvePSMateriaPrima
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveUMMateriaPrima", SqlDbType.Int).Value = CveUMMateriaPrima
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar la materia prima.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveMP(CveOPPS As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MPRemove")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveOPPS", SqlDbType.Int).Value = CveOPPS
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar la materia prima.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetConfiguracionProducto(CvePS As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_ConfiguracionProductoGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.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 AddUpManodeObraReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer, xmlpuestos As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_ManodeObraRecetaUp")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@xmlpuestos", SqlDbType.Xml).Value = xmlpuestos
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar la mano de obra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddUpMateriaPrimaReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer, xmlproductos As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_MateriaPrimaRecetaUp")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@xmlproductos", SqlDbType.Xml).Value = xmlproductos
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar la materia prima.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddUpCostoIndirectoReceta(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer, xmlproductos As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OP_CostoIndirectoRecetaUp")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@CveUM", SqlDbType.Int).Value = CveUM
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@xmlproductos", SqlDbType.Xml).Value = xmlproductos
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar el costo indirecto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "IDisposable Support"
|
||||
' IDisposable
|
||||
Protected Overridable Sub Dispose(disposing As Boolean)
|
||||
If Not Me.disposedValue Then
|
||||
If disposing Then
|
||||
|
||||
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||
If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
||||
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
|
||||
|
||||
End If
|
||||
End If
|
||||
Me.disposedValue = True
|
||||
End Sub
|
||||
Public Sub Dispose() Implements IDisposable.Dispose
|
||||
ConexionClose()
|
||||
Dispose(True)
|
||||
GC.SuppressFinalize(Me)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -11094,6 +11094,10 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Transportes/CatRutas.aspx".ToUpper(), 604)
|
||||
PaginaDict.Add("/Transportes/RepViajesCalendario.aspx".ToUpper(), 605)
|
||||
#End Region
|
||||
|
||||
#Region "Ordenes de Produccion"
|
||||
PaginaDict.Add("/OP/CatConfiguracionProducto.aspx".ToUpper(), 790)
|
||||
#End Region
|
||||
'Antes de aquí.
|
||||
|
||||
Application("GlobalSIGAppPaginas") = PaginaDict
|
||||
|
||||
256
OP/CatConfiguracionProducto.aspx
Normal file
256
OP/CatConfiguracionProducto.aspx
Normal file
@@ -0,0 +1,256 @@
|
||||
<%@ Page Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatConfiguracionProducto.aspx.vb" Inherits="OP_CatConfiguracionProducto" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Configuración de productos
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel ID="UppAddAcciones" runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkAgregar" runat="server" Text="Agregar" OnClick="BtnAgregarProducto_Click"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row" style="margin-right: 10px; margin-top: 18px; margin-bottom: 5px;" align="right">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvProductos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvProductos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="GvProductos" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" DataKeyNames="CvePS,CveUM">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Codigo" HeaderText="Código" />
|
||||
<asp:BoundField DataField="PS" HeaderText="Producto" />
|
||||
<asp:BoundField DataField="UnidadMedida" HeaderText="Unidad de Medida" />
|
||||
<asp:TemplateField HeaderText="Materia Prima" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnMateriaPrima" runat="server" OnClick="BtnMateriaPrima_Click" data-toggle="tooltip" CssClass="btn btn-circle btn-xs green" title="Editar" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Mano de Obra" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnManoObra" runat="server" OnClick="BtnManoObra_Click" data-toggle="tooltip" CssClass="btn btn-circle btn-xs green" title="Editar" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Costo Indirecto" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnCostoIndirecto" runat="server" OnClick="BtnCostoIndirecto_Click" data-toggle="tooltip" CssClass="btn btn-circle btn-xs green" title="Editar" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<!-- Modal para Materia Prima -->
|
||||
<div id="divAddMateriaPrima" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpMateriaPrima" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Materia Prima</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" id="DivProductoConfigurar" runat="server">
|
||||
<div class="col-md-10">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="<%= DdlProductoConfigurar.ClientID.ToString()%>">
|
||||
Producto a configurar:</label>
|
||||
<ADS:Dropdownlost runat="server" ID="DdlProductoConfigurar" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" CssClassDdl="select2me" CssStyle="width: 100%;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="DivUMConfigurar" runat="server">
|
||||
<div class="col-md-10">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlUMConfigurar" Width="100%" runat="server" CssClass="form-control input-sm select2me" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida">
|
||||
</asp:DropDownList>
|
||||
<label for="<%=DdlUMConfigurar.ClientID.ToString()%>">Unidad de Medida:</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="<%= DdlMateriaPrima.ClientID.ToString()%>">
|
||||
Materia prima:</label>
|
||||
<ADS:Dropdownlost runat="server" ID="DdlMateriaPrima" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" CssClassDdl="select2me" CssStyle="width: 100%;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlUM" Width="100%" runat="server" CssClass="form-control input-sm select2me" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida">
|
||||
</asp:DropDownList>
|
||||
<label for="<%=DdlUM.ClientID.ToString()%>">UM:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCantidadMateriaPrima" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCantidadMateriaPrima" FilterType="Custom" ValidChars="1234567890." />
|
||||
<asp:RequiredFieldValidator ID="RFVTxtCantidadMateriaPrima" runat="server" ControlToValidate="TxtCantidadMateriaPrima" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad ''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAgregarMateriaPrima"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtCantidadMateriaPrima.ClientID.ToString()%>">
|
||||
Cantidad:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<asp:Button ID="BtnAgregarMateriaPrima" runat="server" Text="Agregar" CssClass="btn btn-primary" OnClick="BtnAgregarMateriaPrima_Click" ValidationGroup="GrpAgregarMateriaPrima" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<asp:GridView ID="GvMateriaPrima" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" DataKeyNames="CvePS,CveUM,CveOPPS,CvePSMateriaPrima,CveUMMateriaPrima,Cantidad">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="productoMateriaPrima" HeaderText="Producto" />
|
||||
<asp:BoundField DataField="Cantidad" DataFormatString="{0:#,#.##}" HeaderText="Cantidad" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnEliminarMateriaPrima" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" OnClick="BtnEliminarMateriaPrima_Click" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnGuardarMP" OnClick="BtnGuardarMP_Click" runat="server" Text="Guardar" CssClass="btn btn-primary" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal para Mano de Obra -->
|
||||
<div id="divAddManoObra" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpManoObra" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Mano de Obra</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlPuesto" Width="100%" runat="server" CssClass="form-control input-sm select2me" DataValueField="CvePuesto" DataTextField="Puesto">
|
||||
</asp:DropDownList>
|
||||
<label for="<%=DdlPuesto.ClientID.ToString()%>">Puesto:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtHoras" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtHoras" FilterType="Custom" ValidChars="1234567890." />
|
||||
<asp:RequiredFieldValidator ID="RFVTHoras" runat="server" ControlToValidate="TxtHoras" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Horas ''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAgregarManoObra"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtHoras.ClientID.ToString()%>">
|
||||
Horas:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<asp:Button ID="BtnAgregarManoObra" runat="server" Text="Agregar" CssClass="btn btn-primary" OnClick="BtnAgregarManoObra_Click" ValidationGroup="GrpAgregarManoObra" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<asp:GridView ID="GvManoObra" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" DataKeyNames="CvePS,CveUM,CveOPManoObra,CvePuesto,Cantidad">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Puesto" HeaderText="Puesto" />
|
||||
<asp:BoundField DataField="Cantidad" DataFormatString="{0:#,#.##}" HeaderText="Horas" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnEliminarManoObra" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" OnClick="BtnEliminarManoObra_Click" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnGuardarMO" OnClick="BtnGuardarMO_Click" runat="server" Text="Guardar" CssClass="btn btn-primary" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal para Costos Indirectos -->
|
||||
<div id="divAddCostoIndirecto" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpCostoIndirecto" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Costos Indirectos</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="<%= DdlProducto.ClientID.ToString()%>">
|
||||
Producto:</label>
|
||||
<ADS:Dropdownlost runat="server" ID="DdlProducto" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" CssClassDdl="select2me" CssStyle="width: 220px;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCosto" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCosto" FilterType="Custom" ValidChars="1234567890." />
|
||||
<asp:RequiredFieldValidator ID="RFVCosto" runat="server" ControlToValidate="TxtCosto" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Costo ''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAgregarCostoIndirecto"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtCosto.ClientID.ToString()%>">
|
||||
Costo:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<asp:Button ID="BtnAgregarCostoIndirecto" runat="server" Text="Agregar" CssClass="btn btn-primary" OnClick="BtnAgregarCostoIndirecto_Click" ValidationGroup="GrpAgregarCostoIndirecto" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<asp:GridView ID="GvCostoIndirecto" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" DataKeyNames="CvePS,CveUM,CveOPPS,Cantidad">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="productoMateriaPrima" HeaderText="Producto" />
|
||||
<asp:BoundField DataField="Cantidad" DataFormatString="{0:#,#.##}" HeaderText="Costo" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnEliminarCostoIndirecto" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" OnClick="BtnEliminarCostoIndirecto_Click" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnGuardarCI" OnClick="BtnGuardarCI_Click" runat="server" Text="Guardar" CssClass="btn btn-primary" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
602
OP/CatConfiguracionProducto.aspx.vb
Normal file
602
OP/CatConfiguracionProducto.aspx.vb
Normal file
@@ -0,0 +1,602 @@
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class OP_CatConfiguracionProducto
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
|
||||
Private Property CvePS As Integer
|
||||
Get
|
||||
If Not ViewState("CvePS") Is Nothing Then
|
||||
Return ViewState("CvePS").ToString.ToEntero
|
||||
Else
|
||||
Return -1
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CvePS") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveUM As Integer
|
||||
Get
|
||||
If Not ViewState("CveUM") Is Nothing Then
|
||||
Return ViewState("CveUM").ToString.ToEntero
|
||||
Else
|
||||
Return -1
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveUM") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtMP As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtMP"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtMP") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtMO As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtMO"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtMO") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtCI As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtCI"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtCI") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtEliminados As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtEliminados"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtEliminados") = 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
|
||||
CreaDtEliminados()
|
||||
CargarListadoPrincipal()
|
||||
CargarCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "CARGAS"
|
||||
|
||||
Private Sub CargarListadoPrincipal()
|
||||
Using clsOp As New ClsOP()
|
||||
If clsOp.GetConfiguracionProducto(-1, UsuarioActual.CveEmpresa) Then
|
||||
GvProductos.DataSource = clsOp.DtResultados
|
||||
GvProductos.DataBind()
|
||||
End If
|
||||
clsOp.Dispose()
|
||||
UpDatos.Update()
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
Private Sub CreaDtEliminados()
|
||||
DtEliminados = New DataTable
|
||||
DtEliminados.Columns.Add("Cve", GetType(Integer))
|
||||
End Sub
|
||||
|
||||
Private Sub CargarCombos()
|
||||
|
||||
DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
|
||||
DdlPuesto.DataBind()
|
||||
DdlPuesto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
DdlProductoConfigurar.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
|
||||
DdlProductoConfigurar.SelectedText = "Seleccione"
|
||||
DdlProductoConfigurar.SelectedValue = "-1"
|
||||
Else
|
||||
DdlProductoConfigurar.ddl.Items.Clear()
|
||||
DdlProductoConfigurar.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
DdlProductoConfigurar.ddl.DataBind()
|
||||
DdlProductoConfigurar.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
DdlMateriaPrima.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
|
||||
DdlMateriaPrima.SelectedText = "Seleccione"
|
||||
DdlMateriaPrima.SelectedValue = "-1"
|
||||
Else
|
||||
DdlMateriaPrima.ddl.Items.Clear()
|
||||
DdlMateriaPrima.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
DdlMateriaPrima.ddl.DataBind()
|
||||
DdlMateriaPrima.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
DdlProducto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
|
||||
DdlProducto.SelectedText = "Seleccione"
|
||||
DdlProducto.SelectedValue = "-1"
|
||||
Else
|
||||
DdlProducto.ddl.Items.Clear()
|
||||
DdlProducto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
DdlProducto.ddl.DataBind()
|
||||
DdlProducto.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
UpMateriaPrima.Update()
|
||||
UpManoObra.Update()
|
||||
UpCostoIndirecto.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlMateriaPrima.selectedindexchange
|
||||
DdlPSChange()
|
||||
End Sub
|
||||
|
||||
Private Sub DdlPSChange()
|
||||
If DdlMateriaPrima.SelectedValue.ToEntero > 0 Then
|
||||
Dim PS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlMateriaPrima.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
|
||||
If PS IsNot Nothing Then
|
||||
DdlUM.Items.Clear()
|
||||
DdlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa)
|
||||
DdlUM.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlUM.DataBind()
|
||||
DdlUM.SelectedValueExist(PS("CveUnidadMedida").ToString)
|
||||
End If
|
||||
Else
|
||||
DdlUM.Items.Clear()
|
||||
DdlUM.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlUM.SelectedValue = "-1"
|
||||
End If
|
||||
UpMateriaPrima.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlPSConfigurar_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProductoConfigurar.selectedindexchange
|
||||
DdlPSConfigurarChange()
|
||||
End Sub
|
||||
|
||||
Private Sub DdlPSConfigurarChange()
|
||||
If DdlProductoConfigurar.SelectedValue.ToEntero > 0 Then
|
||||
Dim PS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlProductoConfigurar.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
|
||||
If PS IsNot Nothing Then
|
||||
DdlUMConfigurar.Items.Clear()
|
||||
DdlUMConfigurar.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa)
|
||||
DdlUMConfigurar.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlUMConfigurar.DataBind()
|
||||
DdlUMConfigurar.SelectedValueExist(PS("CveUnidadMedida").ToString)
|
||||
End If
|
||||
Else
|
||||
DdlUMConfigurar.Items.Clear()
|
||||
DdlUMConfigurar.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlUMConfigurar.SelectedValue = "-1"
|
||||
End If
|
||||
UpMateriaPrima.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "MATERIA PRIMA"
|
||||
|
||||
Protected Sub BtnMateriaPrima_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
DdlProductoConfigurar.SelectedText = "Seleccione"
|
||||
DdlProductoConfigurar.SelectedValue = "-1"
|
||||
|
||||
DdlMateriaPrima.SelectedText = "Seleccione"
|
||||
DdlMateriaPrima.SelectedValue = "-1"
|
||||
|
||||
DdlUMConfigurar.SelectedValueExist("-1")
|
||||
DdlUM.SelectedValueExist("-1")
|
||||
|
||||
TxtCantidadMateriaPrima.Text = String.Empty
|
||||
|
||||
DtEliminados.Rows.Clear()
|
||||
|
||||
DivProductoConfigurar.Visible = False
|
||||
DivUMConfigurar.Visible = False
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CvePS = GvRow.DataKey("CvePS").ToEntero()
|
||||
CveUM = GvRow.DataKey("CveUM").ToEntero()
|
||||
Using clsOp As New ClsOP()
|
||||
If clsOp.GetMPReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then
|
||||
DtMP = clsOp.DtResultados.FiltraParametros("ISNULL(CveOPPS,0) > 0").Copy()
|
||||
GvMateriaPrima.DataSource = DtMP
|
||||
GvMateriaPrima.DataBind()
|
||||
End If
|
||||
clsOp.Dispose()
|
||||
UpMateriaPrima.Update()
|
||||
End Using
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddMateriaPrima"))
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEliminarMateriaPrima_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveOPPS = GvRow.DataKey("CveOPPS").ToEntero
|
||||
Dim Index = GvRow.RowIndex
|
||||
DtMP.Rows.RemoveAt(Index)
|
||||
|
||||
If CveOPPS > 0 Then
|
||||
Dim dr As DataRow = DtEliminados.NewRow
|
||||
dr("Cve") = CveOPPS
|
||||
DtEliminados.Rows.Add(dr)
|
||||
End If
|
||||
|
||||
GvMateriaPrima.DataSource = DtMP
|
||||
GvMateriaPrima.DataBind()
|
||||
|
||||
UpMateriaPrima.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarMateriaPrima_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
If Not DdlMateriaPrima.SelectedValue.ToEntero() > 0 Then
|
||||
Alert("Es necesario seleccionar una materia prima.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not DdlUM.SelectedValue.ToEntero() > 0 Then
|
||||
Alert("Es necesario seleccionar una unidad de medida.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(TxtCantidadMateriaPrima.Text) Or Not TxtCantidadMateriaPrima.Text.ToDecimal() > 0 Then
|
||||
Alert("Es necesario ingresar una cantidad mayor a 0.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim dr As DataRow = DtMP.NewRow
|
||||
dr("CveOPPS") = -1
|
||||
dr("CvePSMateriaPrima") = DdlMateriaPrima.SelectedValue.ToEntero()
|
||||
dr("CveUMMateriaPrima") = DdlUM.SelectedValue.ToEntero()
|
||||
dr("productoMateriaPrima") = DdlMateriaPrima.SelectedText
|
||||
dr("UnidadMedidaMateriaPrima") = DdlUM.SelectedItem.Text
|
||||
dr("Cantidad") = TxtCantidadMateriaPrima.Text.ToDecimal()
|
||||
dr("CvePS") = CvePS
|
||||
dr("CveUM") = CveUM
|
||||
|
||||
DtMP.Rows.Add(dr)
|
||||
|
||||
GvMateriaPrima.DataSource = DtMP
|
||||
GvMateriaPrima.DataBind()
|
||||
|
||||
DdlProductoConfigurar.SelectedText = "Seleccione"
|
||||
DdlProductoConfigurar.SelectedValue = "-1"
|
||||
|
||||
DdlMateriaPrima.SelectedText = "Seleccione"
|
||||
DdlMateriaPrima.SelectedValue = "-1"
|
||||
|
||||
DdlUMConfigurar.SelectedValueExist("-1")
|
||||
DdlUM.SelectedValueExist("-1")
|
||||
|
||||
TxtCantidadMateriaPrima.Text = String.Empty
|
||||
|
||||
UpMateriaPrima.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarProducto_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
DdlProductoConfigurar.SelectedText = "Seleccione"
|
||||
DdlProductoConfigurar.SelectedValue = "-1"
|
||||
|
||||
DdlMateriaPrima.SelectedText = "Seleccione"
|
||||
DdlMateriaPrima.SelectedValue = "-1"
|
||||
|
||||
DdlUMConfigurar.SelectedValueExist("-1")
|
||||
DdlUM.SelectedValueExist("-1")
|
||||
|
||||
TxtCantidadMateriaPrima.Text = String.Empty
|
||||
|
||||
DtEliminados.Rows.Clear()
|
||||
|
||||
CvePS = -1
|
||||
CveUM = -1
|
||||
|
||||
Using clsOp As New ClsOP()
|
||||
If clsOp.GetMPReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then
|
||||
DtMP = clsOp.DtResultados.FiltraParametros("ISNULL(CveOPPS,0) = 0").Copy()
|
||||
DtMP.Rows.Clear()
|
||||
GvMateriaPrima.DataSource = DtMP
|
||||
GvMateriaPrima.DataBind()
|
||||
End If
|
||||
clsOp.Dispose()
|
||||
End Using
|
||||
|
||||
DivProductoConfigurar.Visible = True
|
||||
DivUMConfigurar.Visible = True
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddMateriaPrima"))
|
||||
UpMateriaPrima.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "MANO OBRA"
|
||||
|
||||
Protected Sub BtnManoObra_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
DdlPuesto.SelectedValueExist("-1")
|
||||
|
||||
TxtHoras.Text = String.Empty
|
||||
|
||||
DtEliminados.Rows.Clear()
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CvePS = GvRow.DataKey("CvePS").ToEntero
|
||||
CveUM = GvRow.DataKey("CveUM").ToEntero
|
||||
Using clsOp As New ClsOP()
|
||||
If clsOp.GetMOReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then
|
||||
DtMO = clsOp.DtResultados.FiltraParametros("ISNULL(CveOPManoObra,0) > 0").Copy()
|
||||
GvManoObra.DataSource = DtMO
|
||||
GvManoObra.DataBind()
|
||||
End If
|
||||
clsOp.Dispose()
|
||||
UpManoObra.Update()
|
||||
End Using
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddManoObra"))
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEliminarManoObra_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveOPManoObra = GvRow.DataKey("CveOPManoObra").ToEntero
|
||||
Dim Index = GvRow.RowIndex
|
||||
DtMO.Rows.RemoveAt(Index)
|
||||
|
||||
If CveOPManoObra > 0 Then
|
||||
Dim dr As DataRow = DtEliminados.NewRow
|
||||
dr("Cve") = CveOPManoObra
|
||||
DtEliminados.Rows.Add(dr)
|
||||
End If
|
||||
|
||||
GvManoObra.DataSource = DtMO
|
||||
GvManoObra.DataBind()
|
||||
|
||||
UpManoObra.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarManoObra_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
If Not DdlPuesto.SelectedValue.ToEntero() > 0 Then
|
||||
Alert("Es necesario seleccionar un puesto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(TxtHoras.Text) Or Not TxtHoras.Text.ToDecimal() > 0 Then
|
||||
Alert("Es necesario ingresar una cantidad mayor a 0.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim dr As DataRow = DtMO.NewRow
|
||||
dr("CveOPManoObra") = -1
|
||||
dr("CvePuesto") = DdlPuesto.SelectedValue.ToEntero()
|
||||
dr("Puesto") = DdlPuesto.SelectedItem.Text
|
||||
dr("Cantidad") = TxtHoras.Text.ToDecimal()
|
||||
dr("CvePS") = CvePS
|
||||
dr("CveUM") = CveUM
|
||||
|
||||
DtMO.Rows.Add(dr)
|
||||
|
||||
GvManoObra.DataSource = DtMO
|
||||
GvManoObra.DataBind()
|
||||
|
||||
DdlPuesto.SelectedValueExist("-1")
|
||||
|
||||
TxtHoras.Text = String.Empty
|
||||
|
||||
UpManoObra.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "COSTO INDIRECTO"
|
||||
|
||||
Protected Sub BtnCostoIndirecto_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
DdlProducto.SelectedText = "Seleccione"
|
||||
DdlProducto.SelectedValue = "-1"
|
||||
|
||||
TxtCosto.Text = String.Empty
|
||||
|
||||
DtEliminados.Rows.Clear()
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CvePS = GvRow.DataKey("CvePS").ToEntero
|
||||
CveUM = GvRow.DataKey("CveUM").ToEntero
|
||||
Using clsOp As New ClsOP()
|
||||
If clsOp.GetCIReceta(CvePS, CveUM, UsuarioActual.CveEmpresa) Then
|
||||
DtCI = clsOp.DtResultados.FiltraParametros("ISNULL(CveOPPS,0) > 0").Copy()
|
||||
GvCostoIndirecto.DataSource = DtCI
|
||||
GvCostoIndirecto.DataBind()
|
||||
End If
|
||||
clsOp.Dispose()
|
||||
UpCostoIndirecto.Update()
|
||||
End Using
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddCostoIndirecto"))
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEliminarCostoIndirecto_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveOPPS = GvRow.DataKey("CveOPPS").ToEntero
|
||||
Dim Index = GvRow.RowIndex
|
||||
DtCI.Rows.RemoveAt(Index)
|
||||
|
||||
If CveOPPS > 0 Then
|
||||
Dim dr As DataRow = DtEliminados.NewRow
|
||||
dr("Cve") = CveOPPS
|
||||
DtEliminados.Rows.Add(dr)
|
||||
End If
|
||||
|
||||
GvCostoIndirecto.DataSource = DtCI
|
||||
GvCostoIndirecto.DataBind()
|
||||
|
||||
UpCostoIndirecto.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarCostoIndirecto_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
If Not DdlProducto.SelectedValue.ToEntero() > 0 Then
|
||||
Alert("Es necesario seleccionar un producto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(TxtCosto.Text) Or Not TxtCosto.Text.ToDecimal() > 0 Then
|
||||
Alert("Es necesario ingresar un costo mayor a 0.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim dr As DataRow = DtCI.NewRow
|
||||
dr("CveOPPS") = -1
|
||||
dr("CvePSMateriaPrima") = DdlProducto.SelectedValue.ToEntero()
|
||||
dr("productoMateriaPrima") = DdlProducto.SelectedText
|
||||
dr("Cantidad") = TxtCosto.Text.ToDecimal()
|
||||
dr("CvePS") = CvePS
|
||||
dr("CveUM") = CveUM
|
||||
|
||||
DtCI.Rows.Add(dr)
|
||||
|
||||
GvCostoIndirecto.DataSource = DtCI
|
||||
GvCostoIndirecto.DataBind()
|
||||
|
||||
DdlProducto.SelectedText = "Seleccione"
|
||||
DdlProducto.SelectedValue = "-1"
|
||||
|
||||
TxtCosto.Text = String.Empty
|
||||
|
||||
UpCostoIndirecto.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "GUARDADOS"
|
||||
|
||||
Protected Sub BtnGuardarMP_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If Not DtMP.Rows.Count > 0 Then
|
||||
Alert("Es necesario que agregue al menos una materia prima.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim GuardadoCorrecto As Boolean = True
|
||||
Dim clsOp As New ClsOP()
|
||||
clsOp.IniciaTransacSQL()
|
||||
|
||||
If DivProductoConfigurar.Visible Then
|
||||
|
||||
For Each Dr As DataRow In DtMP.Rows
|
||||
If Not Dr("CveOPPS").ToString().ToEntero() > 0 Then
|
||||
If Not clsOp.AddMP(Dr("Cantidad").ToString().ToDecimal(), DdlProductoConfigurar.SelectedValue.ToEntero(), Dr("CvePSMateriaPrima").ToString().ToEntero(), DdlUM.SelectedValue.ToEntero(), Dr("CveUMMateriaPrima").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Else
|
||||
For Each Dr As DataRow In DtMP.Rows
|
||||
If Not Dr("CveOPPS").ToString().ToEntero() > 0 Then
|
||||
If Not clsOp.AddMP(Dr("Cantidad").ToString().ToDecimal(), Dr("CvePS").ToString().ToEntero(), Dr("CvePSMateriaPrima").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero(), Dr("CveUMMateriaPrima").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each Dr As DataRow In DtEliminados.Rows
|
||||
If Not clsOp.RemoveMP(Dr("Cve").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If GuardadoCorrecto Then
|
||||
clsOp.Commit()
|
||||
Alert("Materia Prima Guardada Correctamente", TipoMensaje.MsgInformacion)
|
||||
CargarListadoPrincipal()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddMateriaPrima"), "jsHideModalMP")
|
||||
Else
|
||||
clsOp.RollBack()
|
||||
Alert("Ocurrió un error al guardar la Materia Prima", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardarMO_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GuardadoCorrecto As Boolean = True
|
||||
|
||||
Dim clsOp As New ClsOP()
|
||||
clsOp.IniciaTransacSQL()
|
||||
|
||||
For Each Dr As DataRow In DtMO.Rows
|
||||
If Not Dr("CveOPManoObra").ToString().ToEntero() > 0 Then
|
||||
If Not clsOp.AddMO(Dr("Cantidad").ToString().ToDecimal(), Dr("CvePS").ToString().ToEntero(), Dr("CvePuesto").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each Dr As DataRow In DtEliminados.Rows
|
||||
If Not clsOp.RemoveMO(Dr("Cve").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
Next
|
||||
|
||||
If GuardadoCorrecto Then
|
||||
clsOp.Commit()
|
||||
Alert("Mano de Obra Guardada Correctamente", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddManoObra"), "jsHideModalMO")
|
||||
Else
|
||||
clsOp.RollBack()
|
||||
Alert("Ocurrió un error al guardar la Mano de Obra", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardarCI_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GuardadoCorrecto As Boolean = True
|
||||
|
||||
Dim clsOp As New ClsOP()
|
||||
clsOp.IniciaTransacSQL()
|
||||
|
||||
For Each Dr As DataRow In DtCI.Rows
|
||||
If Not Dr("CveOPPS").ToString().ToEntero() > 0 Then
|
||||
If Not clsOp.AddCI(Dr("Cantidad").ToString().ToDecimal(), Dr("CvePS").ToString().ToEntero(), Dr("CvePSMateriaPrima").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero(), Dr("CveUMMateriaPrima").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each Dr As DataRow In DtEliminados.Rows
|
||||
If Not clsOp.RemoveCI(Dr("Cve").ToString().ToEntero()) Then
|
||||
GuardadoCorrecto = False
|
||||
End If
|
||||
Next
|
||||
|
||||
If GuardadoCorrecto Then
|
||||
clsOp.Commit()
|
||||
Alert("Costo Indirecto Guardado Correctamente", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddCostoIndirecto"), "jsHideModalCI")
|
||||
Else
|
||||
clsOp.RollBack()
|
||||
Alert("Ocurrió un error al guardar el Costo Indirecto", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user