From dfdaedb83cade9a03b58a49276da6a46b8883643 Mon Sep 17 00:00:00 2001 From: SLopez Date: Sat, 5 Jul 2025 08:56:18 -0700 Subject: [PATCH] CveSubProyecto y filtros en el reporte de exportaciones. --- App_Code/ClsExportaciones.vb | 24 ++- Export/ExpDetalle.aspx | 154 ++++++++-------- Export/ExpDetalle.aspx.cs | 14 +- Export/RepExportaciones.aspx | 313 +++++++++++++++++++++----------- Export/RepExportaciones.aspx.cs | 33 +++- 5 files changed, 343 insertions(+), 195 deletions(-) diff --git a/App_Code/ClsExportaciones.vb b/App_Code/ClsExportaciones.vb index 8670c2847..45ffee442 100644 --- a/App_Code/ClsExportaciones.vb +++ b/App_Code/ClsExportaciones.vb @@ -120,7 +120,8 @@ Public Class ClsExportaciones End Sub #Region "EXPORTACIONES" - Public Function GetExportacion(Optional CveExportacion As Integer = -1, Optional CveEmpresa As Integer = -1, Optional EsExportacion As Boolean = True, Optional FechaInicio As Date = MinFecha, Optional FechaFin As Date = MaxFecha) As Boolean + Public Function GetExportacion(Optional CveExportacion As Integer = -1, Optional CveEmpresa As Integer = -1, Optional EsExportacion As Boolean = True, Optional FechaInicio As Date = MinFecha, + Optional FechaFin As Date = MaxFecha, Optional CveSubProyecto As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Exp_ExportacionesRep") With SqlAdapter.SelectCommand.Parameters @@ -129,6 +130,7 @@ Public Class ClsExportaciones .Add("@EsExportacion", SqlDbType.Bit).Value = EsExportacion .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto End With Try SqlAdapter.Fill(Data) @@ -139,14 +141,15 @@ Public Class ClsExportaciones Return Retorno End Function - Public Function AddExportacion(NumeroPedimento As String, FechaPedimento As Date, CveVenta As Integer, TipoCambio As Decimal, TipoExportacion As Integer, CveExportacionEstatus As Integer, - CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, CveAgente As Integer, ClaveAduana As Integer, - CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, Sello3 As String, SCAC As String, - CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, CveDirConsignatario As Integer, + Public Function AddExportacion(CveSubProyecto As Integer, NumeroPedimento As String, FechaPedimento As Date, CveVenta As Integer, TipoCambio As Decimal, TipoExportacion As Integer, + CveExportacionEstatus As Integer, CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, CveAgente As Integer, + ClaveAduana As Integer, CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, Sello3 As String, + SCAC As String, CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, CveDirConsignatario As Integer, CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer, ITN As String, Vinculacion As Boolean, EsExportacion As Boolean) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Exp_ExportacionesAdd") With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@NumeroPedimento", SqlDbType.VarChar).Value = NumeroPedimento .Add("@FechaPedimento", SqlDbType.Date).Value = FechaPedimento .Add("@CveVenta", SqlDbType.Int).Value = CveVenta @@ -191,15 +194,16 @@ Public Class ClsExportaciones Return Retorno End Function - Public Function UpdateExportacion(CveExportacion As Integer, NumeroPedimento As String, FechaPedimento As Date, CveVenta As Integer, TipoCambio As Decimal, TipoExportacion As Integer, CveExportacionEstatus As Integer, - CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, CveAgente As Integer, ClaveAduana As Integer, - CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, Sello3 As String, SCAC As String, - CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, CveDirConsignatario As Integer, - CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer, ITN As String, Vinculacion As Boolean) As Boolean + Public Function UpdateExportacion(CveExportacion As Integer, CveSubProyecto As Integer, NumeroPedimento As String, FechaPedimento As Date, CveVenta As Integer, TipoCambio As Decimal, + TipoExportacion As Integer, CveExportacionEstatus As Integer, CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, + CveAgente As Integer, ClaveAduana As Integer, CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, + Sello3 As String, SCAC As String, CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, + CveDirConsignatario As Integer, CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer, ITN As String, Vinculacion As Boolean) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Exp_ExportacionesUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveExportacion", SqlDbType.Int).Value = CveExportacion + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@NumeroPedimento", SqlDbType.VarChar).Value = NumeroPedimento .Add("@FechaPedimento", SqlDbType.Date).Value = FechaPedimento .Add("@CveVenta", SqlDbType.Int).Value = CveVenta diff --git a/Export/ExpDetalle.aspx b/Export/ExpDetalle.aspx index cd4946771..b3b5f5d52 100644 --- a/Export/ExpDetalle.aspx +++ b/Export/ExpDetalle.aspx @@ -23,6 +23,10 @@
+
+ + +
@@ -616,81 +620,83 @@

- - - <%--asp:TemplateField HeaderText="Id" ItemStyle-HorizontalAlign="Left"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ + + <%--asp:TemplateField HeaderText="Id" ItemStyle-HorizontalAlign="Left"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + +
diff --git a/Export/ExpDetalle.aspx.cs b/Export/ExpDetalle.aspx.cs index f1903a5f0..fedd2b2a8 100644 --- a/Export/ExpDetalle.aspx.cs +++ b/Export/ExpDetalle.aspx.cs @@ -66,11 +66,18 @@ public partial class Export_ExpDetalle : ClsPaginas protected void InicializarValores() { int CveEmpresa = UsuarioActual.CveEmpresa; + int CveUsuario = UsuarioActual.CveUsuario; + + // Sub Proyecto + DdlSubProyecto.Items.Clear(); + DdlSubProyecto.DataSource = get_GlobalDTSubProyectosUsuarios(CveUsuario, -1, CveEmpresa); + DdlSubProyecto.Items.Insert(0, new ListItem("Seleccione", "-1")); + DdlSubProyecto.DataBind(); // Factura ClsVentas Ventas = new ClsVentas(); // El problema es que solo se obtienen los registros donde CveUsuarioConsulta = Sis_UsuariosSubProyectos.CveUsuario en la BD - if (Ventas.GetVentas(CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -1, -1, DateTime.Today.AddMonths(-1).ToString(), ModExtensiones.MaxFecha.ToString(), "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) + if (Ventas.GetVentas(CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -1, -1, DateTime.Today.AddMonths(-1).ToString(), ModExtensiones.MaxFecha.ToString(), "-1", CveUsuarioConsulta: CveUsuario)) { DdlVentas.Items.Clear(); DdlVentas.DataSource = Ventas.DtResultados; @@ -137,6 +144,8 @@ public partial class Export_ExpDetalle : ClsPaginas { LblExp.Text = DTExportaciones.FiltroPrimeroValor("CveExportacion"); + DdlSubProyecto.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveSubProyecto"); + string CveVenta = DTExportaciones.FiltroPrimeroValor("CveVenta"); if (CveVenta != "" && CveVenta != "-1") { @@ -345,6 +354,7 @@ public partial class Export_ExpDetalle : ClsPaginas } string ITN = TxtITN.Text; + int CveSubProyecto = DdlSubProyecto.Text.ToEntero(); string NumeroPedimento = TxtNumPed.Text; DateTime FechaPedimento = TxtFechaPedim.Text.ToDate(); int CveVenta = DdlVentas.Text.ToEntero(); @@ -388,6 +398,7 @@ public partial class Export_ExpDetalle : ClsPaginas if (CveExportacion == -1) { int ExportacionGuardada = Exportaciones.AddExportacion( + CveSubProyecto, NumeroPedimento, FechaPedimento, CveVenta, @@ -467,6 +478,7 @@ public partial class Export_ExpDetalle : ClsPaginas { bool Continuar = Exportaciones.UpdateExportacion( CveExportacion, + CveSubProyecto, NumeroPedimento, FechaPedimento, CveVenta, diff --git a/Export/RepExportaciones.aspx b/Export/RepExportaciones.aspx index b8f405ae6..abc763687 100644 --- a/Export/RepExportaciones.aspx +++ b/Export/RepExportaciones.aspx @@ -4,6 +4,56 @@ + Exportaciones @@ -18,125 +68,176 @@ - + - -
-
-
- - Información - -
- +
+
+ <%--asp:Literal ID="LtlPeriodoseleccionado" runat="server">
- - <%----%> + + <%--a href="javascript:;" class="expand">
-
+
+
+ Proyecto: +
+ +
+ SubProyecto: +
+ +
+
+ Fecha Inicio: + +
+
+
+ + + + +
+ + + + + + +
+
+ Fecha Fin: + +
+
+
+ + + + +
+ + + + + + +
+
+
+ <%--div class="tools">
" style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
+ +
+ <%--div class="portlet-body" style="display: none"> +
+ +
+ + +
- -
-
- - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Export/RepExportaciones.aspx.cs b/Export/RepExportaciones.aspx.cs index 3ee4b2c68..219fc6331 100644 --- a/Export/RepExportaciones.aspx.cs +++ b/Export/RepExportaciones.aspx.cs @@ -1,6 +1,7 @@ using DocumentFormat.OpenXml.Wordprocessing; using Extensiones; using HigLabo.Core; +using iText.Layout.Element; using StackExchange.Redis; using System; using System.Activities; @@ -42,15 +43,34 @@ public partial class Export_RepExportaciones : ClsPaginas if (Request["Opcion"] == "I") EsImportacion = true; } - LtlPeriodoseleccionado.Text = EsImportacion ? "Importaciones" : "Exportaciones"; - CargaExportaciones(); + //LtlPeriodoseleccionado.Text = EsImportacion ? "Importaciones" : "Exportaciones"; + InicializarValores(); + //CargaExportaciones(); } } + protected void InicializarValores() + { + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto: DivProyecto); + DdlProyecto.Visible = false; + LblProyecto.Visible = false; + DivProyecto.Visible = false; + LblSubProyecto.Text = $"{LblSubProyecto.Text}:"; + txtFechaI.Text = NowADS().FirstDayOfMonth().ToShortDateString(); + txtFechaF.Text = NowADS().ToShortDateString(); + + CargaExportaciones(); + } protected void CargaExportaciones() { - ClsExportaciones Exportaciones = new ClsExportaciones(); + bool EsExportacion = !EsImportacion; - if (Exportaciones.GetExportacion(-1, UsuarioActual.CveEmpresa, EsExportacion)) + string SubProyectos = DdlSubProyecto.GetSelectedValuesM(); + SubProyectos = SubProyectos == "" ? "-1" : SubProyectos; + DateTime FechaInicio = DateTime.TryParse(txtFechaI.Text, out _) ? txtFechaI.Text.ToDate() : ModExtensiones.MinFecha; + DateTime FechaFin = DateTime.TryParse(txtFechaF.Text, out _) ? txtFechaF.Text.ToDate() : ModExtensiones.MaxFecha; + + ClsExportaciones Exportaciones = new ClsExportaciones(); + if (Exportaciones.GetExportacion(-1, UsuarioActual.CveEmpresa, EsExportacion, FechaInicio, FechaFin, SubProyectos)) { GVExportaciones.DataSource = Exportaciones.DtResultados; GVExportaciones.DataBind(); @@ -64,6 +84,11 @@ public partial class Export_RepExportaciones : ClsPaginas Response.Redirect($"/Export/ExpDetalle.aspx?CveExportacion={gvRow.DataKey("CveExportacion")}", true); upDatosExp.Update(); } + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaExportaciones(); + upDatosExp.Update(); + } protected void EliminarExp_Click(object sender, EventArgs e) { GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);