diff --git a/Export/ExpDetalle.aspx.cs b/Export/ExpDetalle.aspx.cs index 8a29aa951..4045fd175 100644 --- a/Export/ExpDetalle.aspx.cs +++ b/Export/ExpDetalle.aspx.cs @@ -1198,10 +1198,32 @@ public partial class Export_ExpDetalle : ClsPaginas row["ValorUnitarioMN"] = Convert.ToDecimal(row["ValorTotalMXP"]) / cantidad; } } + ReportDataSource RDSPartidas = new ReportDataSource(); RDSPartidas.Name = "DsPartidas"; RDSPartidas.Value = DTPartidas; lrds.Add(RDSPartidas); + + var EmpaquesAgrupado = from row in DTPartidas.AsEnumerable() + where !string.IsNullOrWhiteSpace(row.Field("TipoEmpaque")) + group row by row.Field("TipoEmpaque") into g + select new + { + TipoEmpaque = g.Key, + Cantidad = g.Sum(r => r.Field("Cantidad")) + }; + DataTable DTBultos = new DataTable(); + DTBultos.Columns.Add("TipoEmpaque", typeof(string)); + DTBultos.Columns.Add("Cantidad", typeof(decimal)); + + foreach (var item in EmpaquesAgrupado) + { + DTBultos.Rows.Add(item.TipoEmpaque, item.Cantidad); + } + ReportDataSource RDSBultos = new ReportDataSource(); + RDSBultos.Name = "DsBultos"; + RDSBultos.Value = DTBultos; + lrds.Add(RDSBultos); } } @@ -1212,7 +1234,7 @@ public partial class Export_ExpDetalle : ClsPaginas NombreArchivo = NumFactura; } - string Formato = "FormatoExportacion.mrt"; + string Formato = "FormatoImportacion.mrt"; para.Add(new ReportParameter("Formato", "PDF")); string Ruta = ModExtensiones.DirectorioBaseEmpresas + $@"Empresas\{UsuarioActual.CveEmpresa}\Formatos\{Formato}";