Esempio n. 1
0
        public FileResult ExportExcelcorte(int cotizacion, int?ticket)
        {
            string ti = "";

            if (ticket != null)
            {
                ti = " Ticket no-" + ticket;
            }
            clsCallProcedure procedimiento = new clsCallProcedure();

            String ProcedureName = "[dbo].[sp_ObtenerHojaCorte]";
            Dictionary <String, String> parametros = new Dictionary <String, String>();

            parametros.Add("@IdCotizacion", cotizacion.ToString());
            parametros.Add("@NoTicket", ticket == null ? null : ticket.ToString());



            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(procedimiento.CallDT(ProcedureName, parametros));
                using (MemoryStream stream = new MemoryStream())
                {
                    wb.SaveAs(stream);
                    return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Lista de Corte Cotizacion no-" + cotizacion + ti + ".xlsx"));
                }
            }
        }
        // GET: Cotizaciones/Details/5


        public FileResult ExportExcelentrega(int cotizacion)
        {
            clsCallProcedure procedimiento = new clsCallProcedure();

            String ProcedureName = "[dbo].[sp_ObtenerHojaEntrega]";
            Dictionary <String, String> parametros = new Dictionary <String, String>();

            parametros.Add("@IdCotizacion", cotizacion.ToString());



            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(procedimiento.CallDT(ProcedureName, parametros));
                using (MemoryStream stream = new MemoryStream())
                {
                    wb.SaveAs(stream);
                    return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Lista de Entrega Cotizacion no-" + cotizacion + ".xlsx"));
                }
            }
        }