48 lines
5.6 KiB
Plaintext
48 lines
5.6 KiB
Plaintext
Option Strict On
|
|
Imports System.Data
|
|
Imports System.Collections.Generic
|
|
Imports System.Linq
|
|
Imports System.Web
|
|
Imports System.Web.UI.WebControls
|
|
Imports Extensiones
|
|
|
|
Partial Class CATTiposEtiqueta
|
|
Inherits ClsPaginas
|
|
|
|
|
|
#Region "Propiedades"
|
|
|
|
Private Property CveEmpaque() As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveEmpaque")), 0, CInt(ViewState("CveEmpaque")))
|
|
End Get
|
|
Set
|
|
ViewState("CveEmpaque") = Value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaEmpaque()
|
|
End If
|
|
End Sub
|
|
Protected Sub CargaEmpaque()
|
|
Dim ObjTipo As New ClsCGame()
|
|
If ObjTipo.GetEmpaques(UsuarioActual.CveEmpresa) Then
|
|
GvEmpaque.DataSource = ObjTipo.DtResultados
|
|
GvEmpaque.DataBind()
|
|
End If
|
|
ObjTipo.Dispose()
|
|
upDatosTipo.Update()
|
|
End Sub
|
|
|
|
Protected Sub LimpiaEmpaque()
|
|
TxtEmpaque.Text = ""
|
|
TxtCostoXTonelada.Text = ""
|
|
TxtCostoPreEnfriado.Text = ""
|
|
TxtFull.Text = ""
|
|
TxtSencillo.Text = ""
|
|
TxtTermoFull.Text = ""
|
|
TxtTermoSencillo.Text = ""
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub LnkEditarTipo_Click(sender As Object, e As EventArgs)
|
|
LimpiaEmpaque()
|
|
Dim gvRow As GridViewRow= DirectCast((DirectCast(sender,LinkButton)).NamingContainer,GridViewRow)
|
|
CveEmpaque = gvRow.DataKey("CveEmpaque").ToEntero()
|
|
TxtEmpaque.Text = gvRow.DataKey("Empaque")
|
|
TxtCostoXTonelada.Text = gvRow.DataKey("CostoXTonelada")
|
|
TxtCostoPreEnfriado.Text = gvRow.DataKey("CostoPreEnfriado")
|
|
TxtFull.Text = gvRow.DataKey("Lleno")
|
|
TxtSencillo.Text = gvRow.DataKey("Sencillo")
|
|
TxtTermoFull.Text = gvRow.DataKey("TermoLleno")
|
|
TxtTermoSencillo.Text = gvRow.DataKey("TermoSencillo")
|
|
ChkTipoestatus.Checked = CBool(gvRow.DataKey("Estatus"))
|
|
RegistraScript("$('#DModalTiposEtiqueta').modal()")
|
|
BtnTipoADD.Visible=False
|
|
BtnTipoEdit.Visible = True
|
|
DivEstatus.Visible = True
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub LnkAgregarTipo_Click(sender As Object, e As EventArgs)
|
|
RegistraScript("$('#DModalTiposEtiqueta').modal()")
|
|
LimpiaEmpaque()
|
|
BtnTipoADD.Visible=True
|
|
BtnTipoEdit.Visible = False
|
|
DivEstatus.Visible = False
|
|
UPModalTipo.Update()
|
|
End Sub
|
|
Protected Sub BtnTipoADD_Click(sender As Object, e As EventArgs)
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.AddEmpaque(TxtEmpaque.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtCostoXTonelada.Text.ToDouble, TxtCostoPreEnfriado.Text.ToDouble, TxtFull.Text.ToDouble, TxtSencillo.Text.ToDouble, TxtTermoFull.Text.ToDouble, TxtTermoSencillo.Text.ToDouble)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTiposEtiqueta').modal('hide')")
|
|
LimpiaEmpaque()
|
|
UPModalTipo.Update()
|
|
Alert("El empaque destino se ha agregado")
|
|
CargaEmpaque()
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnTipoEdit_Click(sender As Object, e As EventArgs)
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.UpdateEmpaque(CveEmpaque, ChkTipoestatus.Checked, TxtEmpaque.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtCostoXTonelada.Text.ToDouble, TxtCostoPreEnfriado.Text.ToDouble, TxtFull.Text.ToDouble, TxtSencillo.Text.ToDouble, TxtTermoFull.Text.ToDouble, TxtTermoSencillo.Text.ToDouble)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
RegistraScript("$('#DModalTiposEtiqueta').modal('hide')")
|
|
LimpiaEmpaque()
|
|
UPModalTipo.Update()
|
|
Alert("El empaque destino se ha actualizado")
|
|
CargaEmpaque()
|
|
End If
|
|
End Sub
|
|
Protected Sub LnkEliminarTipo_Click(sender As Object, e As EventArgs)
|
|
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
|
CveEmpaque = gvRow.DataKey("CveEmpaque").ToEntero()
|
|
Dim ObjTipo As New ClsCGame()
|
|
Dim Continuar As Boolean = ObjTipo.RemoveEmpaque(CveEmpaque)
|
|
ObjTipo.Dispose()
|
|
If (Continuar) Then
|
|
Alert("El empaque destino se ha eliminado")
|
|
CargaEmpaque()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GVTiposEtiqueta_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEmpaque.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If CBool(e.Row.DBCampo("Estatus")) = True Then
|
|
e.Row.FCLabel("lblestatus").Text = "Activo"
|
|
e.Row.FCLabel("lblestatus").ForeColor = Drawing.Color.Green
|
|
Else
|
|
e.Row.FCLabel("lblestatus").Text = "Inactivo"
|
|
e.Row.FCLabel("lblestatus").ForeColor = Drawing.Color.Red
|
|
End If
|
|
|
|
e.Row.FCLabel("LblCostoXTonelada").Text = e.Row.FCLabel("LblCostoXTonelada").Text.FormatoNumero
|
|
e.Row.FCLabel("LblCostoPreEnfriado").Text = e.Row.FCLabel("LblCostoPreEnfriado").Text.FormatoNumero
|
|
e.Row.FCLabel("LblFull").Text = e.Row.FCLabel("LblFull").Text.FormatoNumero
|
|
e.Row.FCLabel("LblSencillo").Text = e.Row.FCLabel("LblSencillo").Text.FormatoNumero
|
|
e.Row.FCLabel("LblTermoFull").Text = e.Row.FCLabel("LblTermoFull").Text.FormatoNumero
|
|
e.Row.FCLabel("LblTermoSencillo").Text = e.Row.FCLabel("LblTermoSencillo").Text.FormatoNumero
|
|
End If
|
|
End Sub
|
|
End Class
|