From e780acb81b110a8703447d0f18def2fc1d1ee3d4 Mon Sep 17 00:00:00 2001 From: SLopez Date: Tue, 1 Jul 2025 18:02:01 -0700 Subject: [PATCH] =?UTF-8?q?Cambios=20en=20la=20impresi=C3=B3n=20de=20la=20?= =?UTF-8?q?exportaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Export/ExpDetalle.aspx.cs | 70 +++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/Export/ExpDetalle.aspx.cs b/Export/ExpDetalle.aspx.cs index 895d00d9a..f9b41f66e 100644 --- a/Export/ExpDetalle.aspx.cs +++ b/Export/ExpDetalle.aspx.cs @@ -1,9 +1,10 @@ using ADSNetLibrary.Helpers; using CrystalDecisions.ReportAppServer.DataDefModel; - //using DocumentFormat.OpenXml.Wordprocessing; using Extensiones; using HigLabo.Core; +using iText.IO.Font.Otf; +using Microsoft.Reporting.WebForms; using Profact.TimbraCFDI; using Profact.TimbraCFDI.Complementos.ComercioExterior10; using StackExchange.Redis; @@ -13,13 +14,13 @@ using System.Activities.Expressions; using System.Activities.Statements; using System.Collections.Generic; using System.Data; +using System.Globalization; using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ModExtensiones = Extensiones.ModExtensiones; -using Microsoft.Reporting.WebForms; public partial class Export_ExpDetalle : ClsPaginas { @@ -927,7 +928,24 @@ public partial class Export_ExpDetalle : ClsPaginas string RFCImp = DTExportaciones.FiltroPrimeroValor("RFCImp"); string NumFactura = DTExportaciones.FiltroPrimeroValor("SerieFolio"); string ClaveSATPedimento = DTExportaciones.FiltroPrimeroValor("ClaveSATPedimento"); - string FechaFact = RowExp["FechaFact"] != DBNull.Value ? Convert.ToDateTime(RowExp["FechaFact"]).ToString("dd/MM/yyyy") : ""; + string ITN = DTExportaciones.FiltroPrimeroValor("ITN"); + string Vinculacion = DTExportaciones.FiltroPrimeroValor("Vinculacion") == "True" ? "SI" : "NO"; + string FechaFact = ""; + string NumSemana = ""; + if (RowExp["FechaFact"] != DBNull.Value) + { + DateTime fechaf = Convert.ToDateTime(RowExp["FechaFact"]); + FechaFact = fechaf.ToString("dd/MM/yyyy"); + + CultureInfo cultura = CultureInfo.CurrentCulture; + System.Globalization.Calendar calendario = cultura.Calendar; + int numeroSemana = calendario.GetWeekOfYear( + fechaf, + cultura.DateTimeFormat.CalendarWeekRule, + cultura.DateTimeFormat.FirstDayOfWeek + ); + NumSemana = numeroSemana.ToString(); + } string TipoCambio = ModExtensiones.ToDecimal(DTExportaciones.FiltroPrimeroValor("TipoCambio")).ToString("#,###.####"); string MedioTransporte = DTExportaciones.FiltroPrimeroValor("MedioTransporte"); string TipoContenedor = DTExportaciones.FiltroPrimeroValor("TipoContenedor"); @@ -953,8 +971,11 @@ public partial class Export_ExpDetalle : ClsPaginas string SCAC = DTExportaciones.FiltroPrimeroValor("SCAC"); string CAAT = DTExportaciones.FiltroPrimeroValor("CAAT"); string ClaveAduana = DTExportaciones.FiltroPrimeroValor("ClaveSATAduanaSeccionDescripcion"); + ClaveAduana = ClaveAduana != " - - " ? ClaveAduana : ""; string ClaveSATIncoterm = DTExportaciones.FiltroPrimeroValor("ClaveSATIncoterm"); - string CedulaAgente = DTExportaciones.FiltroPrimeroValor("CedulaAgente"); + string Patente = DTExportaciones.FiltroPrimeroValor("Patente"); + string AgenteExt = DTExportaciones.FiltroPrimeroValor("AgenteExt"); + string TaxId = DTExportaciones.FiltroPrimeroValor("TaxId"); List para = new List(); para.Add(new ReportParameter("CveExportacion", CveExportacion.ToString())); @@ -964,7 +985,10 @@ public partial class Export_ExpDetalle : ClsPaginas para.Add(new ReportParameter("RFCImp", RFCImp)); para.Add(new ReportParameter("NumFactura", NumFactura)); para.Add(new ReportParameter("ClaveSATPedimento", ClaveSATPedimento)); + para.Add(new ReportParameter("ITN", ITN)); + para.Add(new ReportParameter("Vinculacion", Vinculacion)); para.Add(new ReportParameter("FechaFact", FechaFact)); + para.Add(new ReportParameter("NumSemana", NumSemana)); para.Add(new ReportParameter("TipoCambio", TipoCambio)); para.Add(new ReportParameter("MedioTransporte", MedioTransporte)); para.Add(new ReportParameter("TipoContenedor", TipoContenedor)); @@ -1013,14 +1037,40 @@ public partial class Export_ExpDetalle : ClsPaginas para.Add(new ReportParameter("CAAT", CAAT)); para.Add(new ReportParameter("ClaveAduana", ClaveAduana)); para.Add(new ReportParameter("ClaveSATIncoterm", ClaveSATIncoterm)); - para.Add(new ReportParameter("CedulaAgente", CedulaAgente)); - + para.Add(new ReportParameter("Patente", Patente)); + para.Add(new ReportParameter("AgenteExt", AgenteExt)); + para.Add(new ReportParameter("TaxId", TaxId)); List lrds = new List(); - ReportDataSource rds = new ReportDataSource(); - rds.Name = "DsExportaciones"; - rds.Value = DTExportaciones; - lrds.Add(rds); + ReportDataSource RDSExportaciones = new ReportDataSource(); + RDSExportaciones.Name = "DsExportaciones"; + RDSExportaciones.Value = DTExportaciones; + lrds.Add(RDSExportaciones); + + DataTable DTPartidas = new DataTable(); + ClsExportaciones Partidas = new ClsExportaciones(); + if (Partidas.GetPartidas(UsuarioActual.CveEmpresa, CveExportacion)) + { + DTPartidas = Partidas.DtResultados; + if (DTPartidas.Rows.Count > 0) + { + DTPartidas.Columns.Add("ValorUnitarioUSD", typeof(decimal)); + DTPartidas.Columns.Add("ValorUnitarioMN", typeof(decimal)); + DTPartidas.Columns["ValorUnitarioUSD"].DefaultValue = 0.0m; + DTPartidas.Columns["ValorUnitarioMN"].DefaultValue = 0.0m; + DataRow RowPartida = DTPartidas.Rows[0]; + decimal cantidad = Convert.ToDecimal(RowPartida["Cantidad"]); + if (cantidad > 0) + { + RowPartida["ValorUnitarioUSD"] = Convert.ToDecimal(RowPartida["Precio"]) / cantidad; + RowPartida["ValorUnitarioMN"] = Convert.ToDecimal(RowPartida["ValorTotalMXP"]) / cantidad; + } + ReportDataSource RDSPartidas = new ReportDataSource(); + RDSPartidas.Name = "DsPartidas"; + RDSPartidas.Value = DTPartidas; + lrds.Add(RDSPartidas); + } + } string NombreArchivo = $"Exportacion_{CveExportacion}"; string CveVenta = DTExportaciones.FiltroPrimeroValor("CveVenta"); ;