From 52eadfbc1e5bf6c904a26d641f0dea1d71424042 Mon Sep 17 00:00:00 2001 From: Jorge Luis caudillo esparza Date: Wed, 16 Jul 2025 09:50:31 -0700 Subject: [PATCH] Almacen en empaque destino --- App_Code/ClsCGame.vb | 10 ++++++++-- CGame/CatEmpaque.aspx | 20 +++++++++++++++++++- CGame/CatEmpaque.aspx.VB | 12 ++++++++++-- Nomina/RepMovtosPermanentes.aspx.cs | 20 +++++++++++--------- 4 files changed, 48 insertions(+), 14 deletions(-) diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb index 753dfe152..c76a30310 100644 --- a/App_Code/ClsCGame.vb +++ b/App_Code/ClsCGame.vb @@ -284,7 +284,7 @@ Public Class ClsCGame Return Retorno End Function - Public Function AddEmpaque(Empaque As String, CveUsuario As Integer, CveEmpresa As Integer, CostoXTonelada As Double, CostoPreEnfriado As Double, Full As Double, Sencillo As Double, TermoFull As Double, TermoSencillo As Double) As Boolean + Public Function AddEmpaque(Empaque As String, CveUsuario As Integer, CveEmpresa As Integer, CostoXTonelada As Double, CostoPreEnfriado As Double, Full As Double, Sencillo As Double, TermoFull As Double, TermoSencillo As Double, Optional CveAlmacen As Integer = -1, Optional CveAlmacenProductoTerminado As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CGame_EmpaqueAdd") With SqlAdapter.SelectCommand.Parameters @@ -297,6 +297,9 @@ Public Class ClsCGame .Add("@Sencillo", SqlDbType.Float).Value = Sencillo .Add("@TermoLleno", SqlDbType.Float).Value = TermoFull .Add("@TermoSencillo", SqlDbType.Float).Value = TermoSencillo + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveAlmacenProductoTerminado", SqlDbType.Int).Value = CveAlmacenProductoTerminado + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try SqlAdapter.Fill(Data) @@ -307,7 +310,7 @@ Public Class ClsCGame Return Retorno End Function - Public Function UpdateEmpaque(CveEmpaque As Integer, Estatus As Boolean, Empaque As String, CveUsuario As Integer, CveEmpresa As Integer, CostoXTonelada As Double, CostoPreEnfriado As Double, Full As Double, Sencillo As Double, TermoFull As Double, TermoSencillo As Double) As Boolean + Public Function UpdateEmpaque(CveEmpaque As Integer, Estatus As Boolean, Empaque As String, CveUsuario As Integer, CveEmpresa As Integer, CostoXTonelada As Double, CostoPreEnfriado As Double, Full As Double, Sencillo As Double, TermoFull As Double, TermoSencillo As Double, Optional CveAlmacen As Integer = -1, Optional CveAlmacenProductoTerminado As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CGame_EmpaqueUpdate") With SqlAdapter.SelectCommand.Parameters @@ -322,6 +325,9 @@ Public Class ClsCGame .Add("@Sencillo", SqlDbType.Float).Value = Sencillo .Add("@TermoLleno", SqlDbType.Float).Value = TermoFull .Add("@TermoSencillo", SqlDbType.Float).Value = TermoSencillo + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveAlmacenProductoTerminado", SqlDbType.Int).Value = CveAlmacenProductoTerminado + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try SqlAdapter.Fill(Data) diff --git a/CGame/CatEmpaque.aspx b/CGame/CatEmpaque.aspx index 66ba447fd..9c12d8151 100644 --- a/CGame/CatEmpaque.aspx +++ b/CGame/CatEmpaque.aspx @@ -66,7 +66,7 @@
+ DataKeyNames="CveEmpaque,Empaque,Estatus,FechaIng,CveUsuario,Usuario,CveEmpresa,Empresa,CostoXTonelada,CostoPreEnfriado,Lleno,Sencillo,TermoLleno,TermoSencillo,CveAlmacen,CveAlmacenProductoTerminado,CveSubProyecto"> @@ -103,6 +103,16 @@ + + + + + + + + + + @@ -184,6 +194,14 @@
+
+ + +
+
+ + +
diff --git a/CGame/CatEmpaque.aspx.VB b/CGame/CatEmpaque.aspx.VB index ef251b0c9..cf029ce01 100644 --- a/CGame/CatEmpaque.aspx.VB +++ b/CGame/CatEmpaque.aspx.VB @@ -16,13 +16,21 @@ #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then + + DdlAlmacenes.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) + DdlAlmacenes.DataBind() + DdlAlmacenesPT.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) + DdlAlmacenesPT.DataBind() 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") + TxtCostoXTonelada.Text = "" TxtCostoPreEnfriado.Text = "" TxtFull.Text = "" TxtSencillo.Text = "" TxtTermoFull.Text = "" TxtTermoSencillo.Text = "" + + DdlAlmacenes.SelectedValueExist("-1") DdlAlmacenesPT.SelectedValueExist("-1") 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")) ' CveSubProyecto + DdlAlmacenes.SelectedValueExist(gvRow.DataKey("CveAlmacen")) DdlAlmacenesPT.SelectedValueExist(gvRow.DataKey("CveAlmacenProductoTerminado")) 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 CveAlmacen As Integer = DdlAlmacenes.SelectedValue.ToEntero() Dim CveAlmacenProductoTerminado As Integer = DdlAlmacenesPT.SelectedValue.ToEntero() 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, CveAlmacen, CveAlmacenProductoTerminado) 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 CveAlmacen As Integer = DdlAlmacenes.SelectedValue.ToEntero() Dim CveAlmacenProductoTerminado As Integer = DdlAlmacenesPT.SelectedValue.ToEntero() 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, CveAlmacen, CveAlmacenProductoTerminado) 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 diff --git a/Nomina/RepMovtosPermanentes.aspx.cs b/Nomina/RepMovtosPermanentes.aspx.cs index 08d6e04e5..3516ab793 100644 --- a/Nomina/RepMovtosPermanentes.aspx.cs +++ b/Nomina/RepMovtosPermanentes.aspx.cs @@ -248,12 +248,13 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas // Encabezados ws.Cell(1, 1).Value = "Código"; ws.Cell(1, 2).Value = "Nombre Completo"; - ws.Cell(1, 3).Value = "Descuento Acordado"; - ws.Cell(1, 4).Value = "Descuento Aplicado"; - ws.Cell(1, 5).Value = "Acumulado"; + ws.Cell(1, 3).Value = "Fecha"; + ws.Cell(1, 4).Value = "Descuento Acordado"; + ws.Cell(1, 5).Value = "Descuento Aplicado"; + ws.Cell(1, 6).Value = "Acumulado"; // Estilo del encabezado - var headerRange = ws.Range("A1:E1"); + var headerRange = ws.Range("A1:F1"); headerRange.Style.Fill.BackgroundColor = XLColor.LightGray; headerRange.Style.Font.Bold = true; headerRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; @@ -271,19 +272,20 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas ws.Cell(row, 1).Value = codigo; ws.Cell(row, 2).Value = nombre; - ws.Cell(row, 3).Value = valor; - ws.Cell(row, 4).Value = aplicado; - ws.Cell(row, 5).Value = acumulado; + ws.Cell(row, 3).Value = dr["FechaInicioAplicacion"].ToString(); + ws.Cell(row, 4).Value = valor; + ws.Cell(row, 5).Value = aplicado; + ws.Cell(row, 6).Value = acumulado; // Formato numérico a columnas de dinero - ws.Cell(row, 3).Style.NumberFormat.Format = "#,##0.00"; ws.Cell(row, 4).Style.NumberFormat.Format = "#,##0.00"; ws.Cell(row, 5).Style.NumberFormat.Format = "#,##0.00"; + ws.Cell(row, 6).Style.NumberFormat.Format = "#,##0.00"; // Color especial si CveTipo = 0 if (cveTipo == 0) { - var range = ws.Range(row, 1, row, 5); + var range = ws.Range(row, 1, row, 6); range.Style.Fill.BackgroundColor = XLColor.FromArgb(221, 221, 221); range.Style.Font.Bold = true; }