-
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
|
||||||
@@ -11096,6 +11096,10 @@ Public Class ClsPaginas
|
|||||||
PaginaDict.Add("/Transportes/CatRutas.aspx".ToUpper(), 604)
|
PaginaDict.Add("/Transportes/CatRutas.aspx".ToUpper(), 604)
|
||||||
PaginaDict.Add("/Transportes/RepViajesCalendario.aspx".ToUpper(), 605)
|
PaginaDict.Add("/Transportes/RepViajesCalendario.aspx".ToUpper(), 605)
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
#Region "Ordenes de Produccion"
|
||||||
|
PaginaDict.Add("/OP/CatConfiguracionProducto.aspx".ToUpper(), 790)
|
||||||
|
#End Region
|
||||||
'Antes de aquí.
|
'Antes de aquí.
|
||||||
|
|
||||||
Application("GlobalSIGAppPaginas") = PaginaDict
|
Application("GlobalSIGAppPaginas") = PaginaDict
|
||||||
|
|||||||
@@ -401,6 +401,26 @@ Public Class ClsPuntoVenta
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function GetVta_EstadoCajas(CveCuenta As Integer, CveEmpresa As Integer, FechaInicio As Date, FechaFin As Date) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Vta_VentasEstadoCajasGet")
|
||||||
|
|
||||||
|
SqlAdapter.SelectCommand.Parameters.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
|
||||||
|
SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
SqlAdapter.SelectCommand.Parameters.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
|
||||||
|
SqlAdapter.SelectCommand.Parameters.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener los Cortes del Punto de Venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
#Region "IDisposable Support"
|
#Region "IDisposable Support"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1679,6 +1679,14 @@ Partial Class Compras_Compras
|
|||||||
InicializaDTProrrateoGasolina()
|
InicializaDTProrrateoGasolina()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||||
|
If Request("SaldarRNC") IsNot Nothing AndAlso Request("SaldarRNC").ToString.ToEntero = 1 Then
|
||||||
|
SaldaConRNC()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'SE OCUPAN AFUERA DEL POSTBACK ??
|
'SE OCUPAN AFUERA DEL POSTBACK ??
|
||||||
@@ -1711,6 +1719,79 @@ Partial Class Compras_Compras
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub SaldaConRNC()
|
||||||
|
|
||||||
|
If CompraSaldo > 0 Then
|
||||||
|
ImporteRNC = CompraSaldo.ToDecimal
|
||||||
|
Dim ErrorSaldoRNC As Boolean = False
|
||||||
|
Dim ObjCompras As New ClsCompras
|
||||||
|
Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL)
|
||||||
|
ObjCompras.IniciaTransacSQL()
|
||||||
|
ObjCompras.IniciaTransacSQL()
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 Or ImporteRNCProntoPago > 0) Then
|
||||||
|
|
||||||
|
|
||||||
|
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
||||||
|
|
||||||
|
Dim CompraSaldar As New Compra
|
||||||
|
CompraSaldar.CveCompra = CveCompra
|
||||||
|
CompraSaldar.CveTipoConceptoProveedor = CveTipoConcepto
|
||||||
|
CompraSaldar.CveProveedor = CveProveedor
|
||||||
|
CompraSaldar.CveMoneda = DdlMoneda.SelectedValue.ToEntero
|
||||||
|
CompraSaldar.Fecha = TxtFecha.Text.ToDate
|
||||||
|
CompraSaldar.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim
|
||||||
|
CompraSaldar.ProveedorNombre = HplProveedor.Text
|
||||||
|
CompraSaldar.TC = TipoCambio
|
||||||
|
CompraSaldar.Total = TxtTotal.Text.ToDecimal
|
||||||
|
CompraSaldar.IVA = TxtIVA.Text.ToDecimal
|
||||||
|
CompraSaldar.IVADeducible = TxtIVA.Text.ToDecimal
|
||||||
|
CompraSaldar.IEPS = TxtIEPS.Text.ToDecimal
|
||||||
|
CompraSaldar.RetIVA = TxtRetIVA.Text.ToDecimal
|
||||||
|
CompraSaldar.RetISR = TxtRetISR.Text.ToDecimal
|
||||||
|
CompraSaldar.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero
|
||||||
|
CompraSaldar.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
|
||||||
|
CompraSaldar.PorcentajeIVA = PorcentajeIVA
|
||||||
|
CompraSaldar.UsuarioActual = UsuarioActual
|
||||||
|
CompraSaldar.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
|
||||||
|
CompraSaldar.EsImportacion = chkImportacion.Checked
|
||||||
|
|
||||||
|
Dim FolioFijo As Integer = 0
|
||||||
|
'cheque
|
||||||
|
If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = TxtFolio.Text.ToEntero
|
||||||
|
Dim ConceptoPoliza As String = String.Format("{0} - {1}{2} - {3}", NombreProveedor, TxtSerie.Text, TxtFolio.Text, TxtDescripcion.Text.Trim)
|
||||||
|
|
||||||
|
Dim CvePrePolizaSaldar = ObjConta.AddPrePolizas("Compras/SaldarRNC", 53, ImporteRNC.RoundSQL(2), ImporteRNC.RoundSQL(2), DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjCompras.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjConta.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa))
|
||||||
|
|
||||||
|
If CvePrePolizaSaldar > 0 Then
|
||||||
|
ImporteRNC = ImporteRNC.RoundSQL(2)
|
||||||
|
If PorcentajeIVA > 0 Then
|
||||||
|
ImporteRNC = ((ImporteRNC) / (1 + PorcentajeIVA))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraSaldar, ObjConta, CvePrePolizaSaldar, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal,
|
||||||
|
TxtSerie.Text, TxtFolio.Text, RedondearSaldado:=True) Then
|
||||||
|
ErrorSaldoRNC = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ErrorSaldoRNC Then
|
||||||
|
ObjCompras.RollBack()
|
||||||
|
Else
|
||||||
|
ObjCompras.Commit()
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjCompras.Dispose()
|
||||||
|
ObjConta.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub ConfiguraseleccionRemisionNotaCredito()
|
Private Sub ConfiguraseleccionRemisionNotaCredito()
|
||||||
|
|
||||||
Dim AutoSelRNC As Boolean = False
|
Dim AutoSelRNC As Boolean = False
|
||||||
@@ -21944,7 +22025,8 @@ Partial Class Compras_Compras
|
|||||||
#Region "PRONTO PAGO"
|
#Region "PRONTO PAGO"
|
||||||
|
|
||||||
Public Function GeneraRNC(ByRef sqltransaccion As SqlTransaction, CveCompraRegistrada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer,
|
Public Function GeneraRNC(ByRef sqltransaccion As SqlTransaction, CveCompraRegistrada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer,
|
||||||
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, TipoCambio As Decimal, Serie As String, Folio As String, Optional EsDRMN As Boolean = False, Optional TmpListadoPS As DataTable = Nothing) As Boolean
|
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, TipoCambio As Decimal, Serie As String, Folio As String,
|
||||||
|
Optional EsDRMN As Boolean = False, Optional TmpListadoPS As DataTable = Nothing, Optional RedondearSaldado As Boolean = False) As Boolean
|
||||||
CveCompraDRMC = -1
|
CveCompraDRMC = -1
|
||||||
Dim respuesta As Boolean = True
|
Dim respuesta As Boolean = True
|
||||||
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
||||||
@@ -21969,19 +22051,20 @@ Partial Class Compras_Compras
|
|||||||
If PSRow IsNot Nothing Then
|
If PSRow IsNot Nothing Then
|
||||||
|
|
||||||
Dim CompraRNC As New ClsCompraManagerCompras(UsuarioActual) With {
|
Dim CompraRNC As New ClsCompraManagerCompras(UsuarioActual) With {
|
||||||
.TipoDocto = "RNC",
|
.TipoDocto = "RNC",
|
||||||
.CveProveedor = CveProveedor,
|
.CveProveedor = CveProveedor,
|
||||||
.CveTipoProveedor = CveTipoProveedor,
|
.CveTipoProveedor = CveTipoProveedor,
|
||||||
.CveTipoConceptoProveedor = CveTipoConcepto,
|
.CveTipoConceptoProveedor = CveTipoConcepto,
|
||||||
.Descripcion = Descripcion,
|
.Descripcion = Descripcion,
|
||||||
.NombreProveedor = NombreProveedor,
|
.NombreProveedor = NombreProveedor,
|
||||||
.Fecha = Fecha,
|
.Fecha = Fecha,
|
||||||
.CveMoneda = CveMoneda,
|
.CveMoneda = CveMoneda,
|
||||||
.TipoCambio = If(CveMoneda = 1, 1, TipoCambio),
|
.TipoCambio = If(CveMoneda = 1, 1, TipoCambio),
|
||||||
.Serie = $"D-{Serie}",
|
.Serie = $"D-{Serie}",
|
||||||
.Folio = Folio,
|
.Folio = Folio,
|
||||||
.CveCompraAmortizacion = CveCompraRegistrada
|
.CveCompraAmortizacion = CveCompraRegistrada,
|
||||||
}
|
.CveCompraRelacionada = CveCompraRegistrada
|
||||||
|
}
|
||||||
|
|
||||||
'Dim CveTipoPS As Integer = PSRow("CveTipoPS").ToString.ToEntero
|
'Dim CveTipoPS As Integer = PSRow("CveTipoPS").ToString.ToEntero
|
||||||
'If PSRow("CvePSCargo").ToString <> "" Then
|
'If PSRow("CvePSCargo").ToString <> "" Then
|
||||||
@@ -21993,11 +22076,13 @@ Partial Class Compras_Compras
|
|||||||
Dim PS As String = PSRow("PSCodigo").ToString
|
Dim PS As String = PSRow("PSCodigo").ToString
|
||||||
Dim CveUM As Integer = PSRow("CveUnidadMedida").ToString.ToEntero
|
Dim CveUM As Integer = PSRow("CveUnidadMedida").ToString.ToEntero
|
||||||
Dim UM As String = PSRow("UnidadMedida").ToString
|
Dim UM As String = PSRow("UnidadMedida").ToString
|
||||||
Dim IVARNC As Decimal = (ImporteRNC * PorcentajeIVA).RoundSQL(2)
|
|
||||||
|
|
||||||
CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC, IVARNC, (ImporteRNC + IVARNC), PorcentajeIVA)
|
Dim IVARNC As Decimal = (ImporteRNC * PorcentajeIVA).RoundSQL(2)
|
||||||
|
Dim TotalRNC As Decimal = If(RedondearSaldado, (ImporteRNC + IVARNC).RoundSQL(2), (ImporteRNC + IVARNC))
|
||||||
|
|
||||||
|
CompraRNC.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNC, IVARNC, TotalRNC, PorcentajeIVA)
|
||||||
If CompraRNC.AddCompra(sqltransaccion) Then
|
If CompraRNC.AddCompra(sqltransaccion) Then
|
||||||
Dim tImporteRNC = ImporteRNC + IVARNC ' le agrego el importe del iva
|
Dim tImporteRNC = TotalRNC ' le agrego el importe del iva
|
||||||
Dim Pago As New CompraPago
|
Dim Pago As New CompraPago
|
||||||
Pago.ImportePago = tImporteRNC
|
Pago.ImportePago = tImporteRNC
|
||||||
Pago.CveMonedaPago = CompraActual.CveMoneda
|
Pago.CveMonedaPago = CompraActual.CveMoneda
|
||||||
@@ -22016,19 +22101,20 @@ Partial Class Compras_Compras
|
|||||||
If respuesta AndAlso ImporteRNCProntoPago > 0 Then
|
If respuesta AndAlso ImporteRNCProntoPago > 0 Then
|
||||||
|
|
||||||
Dim CompraRNCProntoPago As New ClsCompraManagerCompras(UsuarioActual) With {
|
Dim CompraRNCProntoPago As New ClsCompraManagerCompras(UsuarioActual) With {
|
||||||
.TipoDocto = "RNC",
|
.TipoDocto = "RNC",
|
||||||
.CveProveedor = CveProveedor,
|
.CveProveedor = CveProveedor,
|
||||||
.CveTipoProveedor = CveTipoProveedor,
|
.CveTipoProveedor = CveTipoProveedor,
|
||||||
.CveTipoConceptoProveedor = CveTipoConcepto,
|
.CveTipoConceptoProveedor = CveTipoConcepto,
|
||||||
.Descripcion = Descripcion,
|
.Descripcion = Descripcion,
|
||||||
.NombreProveedor = NombreProveedor,
|
.NombreProveedor = NombreProveedor,
|
||||||
.Fecha = Fecha,
|
.Fecha = Fecha,
|
||||||
.CveMoneda = CveMoneda,
|
.CveMoneda = CveMoneda,
|
||||||
.TipoCambio = If(CveMoneda = 1, 1, TipoCambio),
|
.TipoCambio = If(CveMoneda = 1, 1, TipoCambio),
|
||||||
.Serie = $"PP-{Serie}",
|
.Serie = $"PP-{Serie}",
|
||||||
.Folio = $"{Folio}",
|
.Folio = $"{Folio}",
|
||||||
.CveCompraAmortizacion = CveCompraRegistrada
|
.CveCompraAmortizacion = CveCompraRegistrada,
|
||||||
}
|
.CveCompraRelacionada = CveCompraRegistrada
|
||||||
|
}
|
||||||
Dim IVARNCProntoPago As Decimal = (ImporteRNCProntoPago * PorcentajeIVA).RoundSQL(2)
|
Dim IVARNCProntoPago As Decimal = (ImporteRNCProntoPago * PorcentajeIVA).RoundSQL(2)
|
||||||
|
|
||||||
CompraRNCProntoPago.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNCProntoPago, (ImporteRNCProntoPago + IVARNCProntoPago), IVARNCProntoPago, PorcentajeIVA)
|
CompraRNCProntoPago.ConfiguraRegistroRapido(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNCProntoPago, (ImporteRNCProntoPago + IVARNCProntoPago), IVARNCProntoPago, PorcentajeIVA)
|
||||||
@@ -22050,6 +22136,11 @@ Partial Class Compras_Compras
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If RedondearSaldado And respuesta Then
|
||||||
|
Alert("Saldado correctamente")
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Return respuesta
|
Return respuesta
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@@ -22865,6 +22956,8 @@ Public Class ClsCompraManagerCompras
|
|||||||
Public Property CveIE As Integer = -1
|
Public Property CveIE As Integer = -1
|
||||||
Public Property CveCompraAmortizacion As Integer = -1
|
Public Property CveCompraAmortizacion As Integer = -1
|
||||||
|
|
||||||
|
Public Property CveCompraRelacionada As Integer = -1
|
||||||
|
|
||||||
Public Sub New(UsuarioActual As Usuario)
|
Public Sub New(UsuarioActual As Usuario)
|
||||||
|
|
||||||
Errores = New StringBuilder
|
Errores = New StringBuilder
|
||||||
@@ -24503,7 +24596,8 @@ Public Class ClsCompraManagerCompras
|
|||||||
AplicoPromocion:=Me.AplicoPromocion, PorcentajeIVA:=Me.PorcentajeIVA, CveMetodoPago:=Me.CveMetodoPago, CveRetIVAConcepto:=Me.CveRetIVAConcepto,
|
AplicoPromocion:=Me.AplicoPromocion, PorcentajeIVA:=Me.PorcentajeIVA, CveMetodoPago:=Me.CveMetodoPago, CveRetIVAConcepto:=Me.CveRetIVAConcepto,
|
||||||
CveConceptoContableAlmacen:=Me.CveConceptoContableAlmacen,
|
CveConceptoContableAlmacen:=Me.CveConceptoContableAlmacen,
|
||||||
CveRetISRConcepto:=Me.CveRetISRConcepto, NoDeducible:=Me.NoDeducible, CveTipoCompra:=Me.CveTipoCompra, TotalOriginal:=Me.TotalOriginal, CveTipoConcepto:=Me.CveTipoConcepto,
|
CveRetISRConcepto:=Me.CveRetISRConcepto, NoDeducible:=Me.NoDeducible, CveTipoCompra:=Me.CveTipoCompra, TotalOriginal:=Me.TotalOriginal, CveTipoConcepto:=Me.CveTipoConcepto,
|
||||||
EsImportacion:=Me.EsImportacion, CveFactura:=Me.CveFactura, CveSubProyecto:=Me.CveSubProyectoPrincipal, DoctosRelacionados:=Me.DocumentosRelacionadosUUIDSString, CveFolioGarantia:=Me.CveFolioGarantia) Then
|
EsImportacion:=Me.EsImportacion, CveFactura:=Me.CveFactura, CveSubProyecto:=Me.CveSubProyectoPrincipal, DoctosRelacionados:=Me.DocumentosRelacionadosUUIDSString, CveFolioGarantia:=Me.CveFolioGarantia,
|
||||||
|
CveCompraRelacionada:=CveCompraRelacionada) Then
|
||||||
Me.CveCompra = ObjCompras.CveCompra
|
Me.CveCompra = ObjCompras.CveCompra
|
||||||
Else
|
Else
|
||||||
respuesta = False
|
respuesta = False
|
||||||
|
|||||||
@@ -780,7 +780,7 @@
|
|||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtRObjetivo" CssClass="form-control" runat="server"></asp:TextBox>
|
<asp:TextBox ID="TxtRObjetivo" CssClass="form-control" runat="server"></asp:TextBox>
|
||||||
<asp:RequiredFieldValidator ID="RfvTxtRObjetivo" runat="server" ControlToValidate="TxtRObjetivo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Objetivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpRangoEditar"></asp:RequiredFieldValidator>
|
<asp:RequiredFieldValidator ID="RfvTxtRObjetivo" runat="server" ControlToValidate="TxtRObjetivo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Objetivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpRangoEditar"></asp:RequiredFieldValidator>
|
||||||
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server" HighlightCssClass="vco" TargetControlID="RFVRI"></ajax:ValidatorCalloutExtender>
|
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server" HighlightCssClass="vco" TargetControlID="RfvTxtRObjetivo"></ajax:ValidatorCalloutExtender>
|
||||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtRObjetivo" FilterType="Custom, Numbers" ValidChars="." />
|
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtRObjetivo" FilterType="Custom, Numbers" ValidChars="." />
|
||||||
<label for="<%= TxtRObjetivo.ClientID.ToString()%>">Objetivo:</label>
|
<label for="<%= TxtRObjetivo.ClientID.ToString()%>">Objetivo:</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -862,12 +862,17 @@ Partial Class RepCxC
|
|||||||
TxtRI.Text = gvRow.DataKey("RangoInicial")
|
TxtRI.Text = gvRow.DataKey("RangoInicial")
|
||||||
TxtRF.Text = gvRow.DataKey("RangoFinal")
|
TxtRF.Text = gvRow.DataKey("RangoFinal")
|
||||||
TxtRObjetivo.Text = gvRow.DataKey("Objetivo").ToString.ToDecimal.ToString("###.00")
|
TxtRObjetivo.Text = gvRow.DataKey("Objetivo").ToString.ToDecimal.ToString("###.00")
|
||||||
|
|
||||||
If Not TxtRF.Text.ToDouble > 0 Then
|
If Not TxtRF.Text.ToDouble > 0 Then
|
||||||
ChkMayor.Checked = True
|
ChkMayor.Checked = True
|
||||||
TxtRF.Enabled = False
|
TxtRF.Enabled = False
|
||||||
|
CambioChecked()
|
||||||
Else
|
Else
|
||||||
ChkMayor.Checked = False
|
ChkMayor.Checked = False
|
||||||
|
TxtRF.Enabled = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
RegistraScript("$('#DivPersonalizarRangoEditar').modal()")
|
RegistraScript("$('#DivPersonalizarRangoEditar').modal()")
|
||||||
UpPersonalizarRangoEditar.Update()
|
UpPersonalizarRangoEditar.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
</div>
|
</div>
|
||||||
<div id="DivMedRin" style="overflow-y: auto; width: 765px; height: 325px;" runat="server" visible="false">
|
<div id="DivMedRin" style="overflow-y: auto; width: 765px; height: 305px;" runat="server" visible="false">
|
||||||
<asp:GridView ID="GvMedRin" Width="100%" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros" CssClass="table table-striped table-hover" GridLines="None">
|
<asp:GridView ID="GvMedRin" Width="100%" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros" CssClass="table table-striped table-hover" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField DataField="Almacen" HeaderText="Almacén" />
|
<asp:BoundField DataField="Almacen" HeaderText="Almacén" />
|
||||||
|
|||||||
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>
|
||||||
612
OP/CatConfiguracionProducto.aspx.vb
Normal file
612
OP/CatConfiguracionProducto.aspx.vb
Normal file
@@ -0,0 +1,612 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
If Not DdlProductoConfigurar.SelectedValue.ToEntero() > 0 Then
|
||||||
|
Alert("Es necesario seleccionar el producto a configurar.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not DdlUM.SelectedValue.ToEntero() > 0 Then
|
||||||
|
Alert("Es necesario seleccionar la unidad de medida a configurar.", 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
|
||||||
@@ -203,6 +203,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkCobrosEnTranscurso" runat="server" OnClick="LnkCobrosEnTranscurso_Click"><i class="fa fa-money"></i>Cobros en Transcurso</asp:LinkButton>
|
<asp:LinkButton ID="LnkCobrosEnTranscurso" runat="server" OnClick="LnkCobrosEnTranscurso_Click"><i class="fa fa-money"></i>Cobros en Transcurso</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LnkEstadosCaja" runat="server" OnClick="LnkEstadosCaja_Click" Visible="false"><i class="fa fa-list" aria-hidden="true"></i>Ver estados de las cajas</asp:LinkButton>
|
||||||
|
</li>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -1325,6 +1328,51 @@
|
|||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="DVEstadoCaja" class="modal ADS fade" role="dialog">
|
||||||
|
<asp:UpdatePanel runat="server" ID="UpDVEstadoCaja" UpdateMode="Conditional" RenderMode="Inline">
|
||||||
|
<ContentTemplate>
|
||||||
|
<div class="modal-dialog" style="width: 700px;">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header ">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
Estados de Cajas
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12" >
|
||||||
|
|
||||||
|
<asp:GridView ID="GvEstadoCajas" runat="server" AutoGenerateColumns="true" ClientIDMode="Static" EmptyDataText=""
|
||||||
|
OnRowDataBound="GvEstadoCajas_RowDataBound"
|
||||||
|
ToolTip="" CssClass="GVAnticipos table table-striped table-hover Widthall mysmallbtn" data-height="300" GridLines="None"
|
||||||
|
DataKeyNames="CveCuenta">
|
||||||
|
<Columns>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<%--<asp:Button ID="Button1" runat="server" Text="Aceptar" class="btn btn-primary" ValidationGroup="VGAnticiposClientes" />
|
||||||
|
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>--%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
|
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,10 @@ Partial Class Ventas_PVCobranza
|
|||||||
DivNoTimbradas.Visible = True
|
DivNoTimbradas.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.TienePermisoProceso(407) Then
|
||||||
|
LnkEstadosCaja.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -693,6 +697,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
|
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
|
||||||
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
|
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
|
||||||
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
|
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
|
||||||
|
SaldoPendientePagos = SaldoPendientePagos - PagoAplicado
|
||||||
|
|
||||||
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
|
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
|
||||||
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
||||||
@@ -723,6 +728,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
Else
|
Else
|
||||||
PagoAplicado += respNC.Factura.Total
|
PagoAplicado += respNC.Factura.Total
|
||||||
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
|
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
|
||||||
|
SaldoPendientePagos = SaldoPendientePagos - PagoAplicado
|
||||||
|
|
||||||
For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
|
For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
|
||||||
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
||||||
@@ -875,7 +881,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
MsgError = "Error al registrar prepólizas"
|
MsgError = "Error al registrar prepólizas"
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
|
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
|
||||||
@@ -3015,8 +3021,83 @@ Partial Class Ventas_PVCobranza
|
|||||||
TxtImporteContado.Text = (LtlSaldo.Text.ToDecimal + SaldoCxC).FormatoNumero
|
TxtImporteContado.Text = (LtlSaldo.Text.ToDecimal + SaldoCxC).FormatoNumero
|
||||||
RegistraScript("$('#divCxC').hide();", "AE21")
|
RegistraScript("$('#divCxC').hide();", "AE21")
|
||||||
UPPCobranza.Update()
|
UPPCobranza.Update()
|
||||||
UPPTotalesContado.update
|
UPPTotalesContado.Update()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Property DTEstadosCaja As DataTable
|
||||||
|
Get
|
||||||
|
If ViewState("DTEstadosCaja") Is Nothing Then
|
||||||
|
ViewState("DTEstadosCaja") = New DataTable
|
||||||
|
End If
|
||||||
|
Return DirectCast(ViewState("DTEstadosCaja"), DataTable)
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("DTEstadosCaja") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Protected Sub LnkEstadosCaja_Click(sender As Object, e As EventArgs)
|
||||||
|
GvEstadoCajas.DataSource = Nothing
|
||||||
|
DTEstadosCaja = New DataTable
|
||||||
|
Dim objPuntoVenta As New ClsPuntoVenta
|
||||||
|
Dim FechaInicio As Date = New Date(txtFechaI.Text.ToDate.Year, 1, 1)
|
||||||
|
Dim FechaFin As Date = New Date(FechaInicio.Year, 12, 31)
|
||||||
|
Dim CveCuenta As Integer = 197107
|
||||||
|
|
||||||
|
If objPuntoVenta.GetVta_EstadoCajas(CveCuenta, UsuarioActual.CveEmpresa, FechaInicio, FechaFin) Then
|
||||||
|
GvEstadoCajas.DataSource = objPuntoVenta.DtResultados
|
||||||
|
DTEstadosCaja = objPuntoVenta.DtResultados
|
||||||
|
End If
|
||||||
|
|
||||||
|
objPuntoVenta.Dispose()
|
||||||
|
|
||||||
|
GvEstadoCajas.DataBind()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UpDVEstadoCaja.Update()
|
||||||
|
RegistraScript("$('#DVEstadoCaja').modal()")
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Protected Sub GvEstadoCajas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||||
|
|
||||||
|
If DTEstadosCaja.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
If e.Row.RowType = DataControlRowType.Header Then
|
||||||
|
e.Row.Cells(0).Visible = False
|
||||||
|
e.Row.Cells(1).Width = 300
|
||||||
|
End If
|
||||||
|
|
||||||
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
|
e.Row.Cells(0).Visible = False
|
||||||
|
e.Row.Cells(1).Width = 300
|
||||||
|
e.Row.Cells(1).Attributes.Add("style", "white-space: nowrap;")
|
||||||
|
Dim IndexRow As Integer = e.Row.RowIndex
|
||||||
|
Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero
|
||||||
|
|
||||||
|
For x = 2 To DTEstadosCaja.Columns.Count - 1
|
||||||
|
|
||||||
|
Dim Fecha As Date = DTEstadosCaja.Columns(x).ColumnName.ToString.ToDate
|
||||||
|
Dim Liga As String = $"../Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx?CveCuenta={CveCuenta}&FI={Fecha.ToString("dd/MM/yyyy")}&FF={Fecha.ToString("dd/MM/yyyy")}&CveProyecto=-1&CveSubProyecto=-1&TP=1"
|
||||||
|
Dim Importe As Decimal = DTEstadosCaja.Rows(IndexRow)(x).ToString.ToDecimal
|
||||||
|
|
||||||
|
If Importe <> 0 Then
|
||||||
|
e.Row.Cells(x).Text = $"<a href='{Liga}' target='_blank' >{Importe.ToString("###,###,###.00")}</a>"
|
||||||
|
Else
|
||||||
|
e.Row.Cells(x).Text = ""
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class MRespuestaSAT
|
Public Class MRespuestaSAT
|
||||||
|
|||||||
@@ -6328,6 +6328,23 @@ Partial Class Ventas
|
|||||||
OnError("Ocurrió un error al cargar los datos de la addenda", ex)
|
OnError("Ocurrió un error al cargar los datos de la addenda", ex)
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim HabilitarExistencias As Boolean = False
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Cot") Then
|
||||||
|
HabilitarExistencias = True
|
||||||
|
GvPS.Columns(20).Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If HabilitarExistencias Then
|
||||||
|
For Each GvRow As GridViewRow In GvPS.Rows
|
||||||
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
|
GvRow.FCLinkButton("LnkExistencias").Visible = True
|
||||||
|
GvRow.FCLinkButton("imgClone").Visible = False
|
||||||
|
GvRow.FCLinkButton("LnkDescuentos").Visible = False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
End If
|
End If
|
||||||
@@ -40772,6 +40789,13 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub LnkCalcularPromociones_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkCalcularPromociones_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
If ObjVentas.GetPromocionesPS(-1, Now().Date, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), 1, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtPromociones = ObjVentas.DtResultados.Copy()
|
||||||
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
Dim Recalculo As Boolean = False
|
Dim Recalculo As Boolean = False
|
||||||
RecalculaPrecios(Recalculo, AplicarPromociones:=True)
|
RecalculaPrecios(Recalculo, AplicarPromociones:=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user