Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table id="t01">
- @{
- if (ViewBag.TipoReporte == 1)
- {
- <tr align="center" valign="middle">
- <th colspan="10"><h1>STOCK GENERAL</h1></th>
- </tr>
- <tr align="center" valign="middle">
- <th colspan="10"><h1>A LA FECHA @ViewBag.fecha</h1></th>
- </tr>
- <tr>
- <th>Tipo</th>
- <th>Codigo</th>
- <th>Material</th>
- <th>Rubro</th>
- <th>UM</th>
- <th>Ingresos</th>
- <th>Salidas</th>
- <th>Stock</th>
- <th>Costo</th>
- <th>Valorizado</th>
- </tr>
- foreach (var item in ViewBag.DatosExcel)
- {
- <tr>
- <td>@item.TipoAlmacen</td>
- <td>@String.Format(item.codigo_interno.ToString())</td>
- <td>@item.descripcion_material</td>
- <td>@item.rubro</td>
- <td>@item.unidadmaterial</td>
- <td align="right">@String.Format("{0:0.00}", item.ingreso).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.salida).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.stock).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.costo).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.valorizado).Replace(",", ".")</td>
- </tr>
- }
- }
- </table>
- public ActionResult ExportarExcelStockAlmacen(string fecha, int Local = 0, int Almacen = 0, int LocalAlmacen = 0, int TipoReporte = 0)
- {
- ReportesAD oReportesAD = new ReportesAD();
- ReporteStockAlmacen record = new ReporteStockAlmacen();
- record.local = Convert.ToInt32(Local);
- record.almacen = Convert.ToInt32(Almacen);
- record.fechaEmisionDoc_GuiasCab = Convert.ToString(fecha);
- record.usuario = Convert.ToInt32(((Sesion)Session["Session_Usuario_Acceso"]).usuario.id_Usuario);
- //record.fechaemision = Convert.ToInt32(fecha);
- // por stock general
- if (TipoReporte == 1)
- {
- record.tiporeporte = Convert.ToInt32(1);
- ViewBag.DatosExcel = oReportesAD.BuscarPorStockGeneral(record);
- }
- // por stock almacen
- else if (TipoReporte == 3)
- {
- record.tiporeporte = Convert.ToInt32(2);
- ViewBag.DatosExcel = oReportesAD.BuscarPorStockAlmacenGeneral(record);
- }
- // Stock General detallado por Movimientos
- else if (TipoReporte == 2)
- {
- record.tiporeporte = Convert.ToInt32(1);
- ViewBag.DatosExcel = oReportesAD.BuscarPorStockGeneralMovimientos(record);
- }
- // Movimientos o Stock por Almacen por Movimientos
- else if (TipoReporte == 4)
- {
- record.tiporeporte = Convert.ToInt32(2);
- ViewBag.DatosExcel = oReportesAD.BuscarPorStockAlmacenMovimientos(record);
- }
- string archivo = "ReporteExcel_Almacen_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xls";
- Response.AddHeader("content-disposition", "attachment; filename=" + archivo);
- Response.ContentType = "application/ms-excel";
- ViewBag.TipoReporte = TipoReporte;
- ViewBag.fecha = fecha;
- return View();
- }
- foreach (var item in ViewBag.DatosExcel)
- {
- <tr>
- <td>@item.TipoAlmacen</td>
- <td>'@item.codigo_interno</td> @* Suponiendo que debe ser aquí *@
- <td>@item.descripcion_material</td>
- <td>@item.rubro</td>
- <td>@item.unidadmaterial</td>
- <td align="right">@String.Format("'{0:0.00}", item.ingreso).Replace(",", ".")</td> @* Suponiendo que deba ir aquí *@
- <td align="right">@String.Format("{0:0.00}", item.salida).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.stock).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.costo).Replace(",", ".")</td>
- <td align="right">@String.Format("{0:0.00}", item.valorizado).Replace(",", ".")</td>
- </tr>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement