Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. <table id="t01">
  2. @{
  3. if (ViewBag.TipoReporte == 1)
  4. {
  5. <tr align="center" valign="middle">
  6. <th colspan="10"><h1>STOCK GENERAL</h1></th>
  7. </tr>
  8. <tr align="center" valign="middle">
  9. <th colspan="10"><h1>A LA FECHA @ViewBag.fecha</h1></th>
  10. </tr>
  11. <tr>
  12. <th>Tipo</th>
  13. <th>Codigo</th>
  14. <th>Material</th>
  15. <th>Rubro</th>
  16. <th>UM</th>
  17. <th>Ingresos</th>
  18. <th>Salidas</th>
  19. <th>Stock</th>
  20. <th>Costo</th>
  21. <th>Valorizado</th>
  22. </tr>
  23. foreach (var item in ViewBag.DatosExcel)
  24. {
  25. <tr>
  26. <td>@item.TipoAlmacen</td>
  27. <td>@String.Format(item.codigo_interno.ToString())</td>
  28. <td>@item.descripcion_material</td>
  29. <td>@item.rubro</td>
  30. <td>@item.unidadmaterial</td>
  31. <td align="right">@String.Format("{0:0.00}", item.ingreso).Replace(",", ".")</td>
  32. <td align="right">@String.Format("{0:0.00}", item.salida).Replace(",", ".")</td>
  33. <td align="right">@String.Format("{0:0.00}", item.stock).Replace(",", ".")</td>
  34. <td align="right">@String.Format("{0:0.00}", item.costo).Replace(",", ".")</td>
  35. <td align="right">@String.Format("{0:0.00}", item.valorizado).Replace(",", ".")</td>
  36. </tr>
  37. }
  38. }
  39. </table>
  40.  
  41. public ActionResult ExportarExcelStockAlmacen(string fecha, int Local = 0, int Almacen = 0, int LocalAlmacen = 0, int TipoReporte = 0)
  42. {
  43.  
  44. ReportesAD oReportesAD = new ReportesAD();
  45. ReporteStockAlmacen record = new ReporteStockAlmacen();
  46.  
  47. record.local = Convert.ToInt32(Local);
  48. record.almacen = Convert.ToInt32(Almacen);
  49. record.fechaEmisionDoc_GuiasCab = Convert.ToString(fecha);
  50. record.usuario = Convert.ToInt32(((Sesion)Session["Session_Usuario_Acceso"]).usuario.id_Usuario);
  51. //record.fechaemision = Convert.ToInt32(fecha);
  52.  
  53. // por stock general
  54. if (TipoReporte == 1)
  55. {
  56. record.tiporeporte = Convert.ToInt32(1);
  57. ViewBag.DatosExcel = oReportesAD.BuscarPorStockGeneral(record);
  58. }
  59. // por stock almacen
  60. else if (TipoReporte == 3)
  61. {
  62. record.tiporeporte = Convert.ToInt32(2);
  63. ViewBag.DatosExcel = oReportesAD.BuscarPorStockAlmacenGeneral(record);
  64. }
  65. // Stock General detallado por Movimientos
  66. else if (TipoReporte == 2)
  67. {
  68. record.tiporeporte = Convert.ToInt32(1);
  69. ViewBag.DatosExcel = oReportesAD.BuscarPorStockGeneralMovimientos(record);
  70. }
  71. // Movimientos o Stock por Almacen por Movimientos
  72. else if (TipoReporte == 4)
  73. {
  74. record.tiporeporte = Convert.ToInt32(2);
  75. ViewBag.DatosExcel = oReportesAD.BuscarPorStockAlmacenMovimientos(record);
  76. }
  77.  
  78. string archivo = "ReporteExcel_Almacen_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xls";
  79. Response.AddHeader("content-disposition", "attachment; filename=" + archivo);
  80. Response.ContentType = "application/ms-excel";
  81.  
  82. ViewBag.TipoReporte = TipoReporte;
  83. ViewBag.fecha = fecha;
  84. return View();
  85. }
  86.  
  87. foreach (var item in ViewBag.DatosExcel)
  88. {
  89. <tr>
  90. <td>@item.TipoAlmacen</td>
  91. <td>'@item.codigo_interno</td> @* Suponiendo que debe ser aquí *@
  92. <td>@item.descripcion_material</td>
  93. <td>@item.rubro</td>
  94. <td>@item.unidadmaterial</td>
  95. <td align="right">@String.Format("'{0:0.00}", item.ingreso).Replace(",", ".")</td> @* Suponiendo que deba ir aquí *@
  96. <td align="right">@String.Format("{0:0.00}", item.salida).Replace(",", ".")</td>
  97. <td align="right">@String.Format("{0:0.00}", item.stock).Replace(",", ".")</td>
  98. <td align="right">@String.Format("{0:0.00}", item.costo).Replace(",", ".")</td>
  99. <td align="right">@String.Format("{0:0.00}", item.valorizado).Replace(",", ".")</td>
  100. </tr>
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement