public static void ImprimirVentasPorMozo(DateTime desde, DateTime hasta)
        {
            List <string[]> lista = new List <string[]>();

            lista = Persona_datos.VentasPorMozo(desde, hasta);

            string          SheetsName = "Hoja1";
            ExcelManagement em         = ExcelManagement.GetInstance();

            em.Open(Application.StartupPath + "\\VentasPorMozo.xlsx");

            int c = 2;

            foreach (string[] array in lista)
            {
                em.WriteCell(SheetsName, 1, 1, desde.Date);
                em.WriteCell(SheetsName, 1, 2, hasta.Date);
                em.WriteCell(SheetsName, c, 1, Convert.ToInt32(array[0]));
                em.WriteCell(SheetsName, c, 2, array[1]);
                em.WriteCell(SheetsName, c, 3, Convert.ToDouble(array[2]));
                c++;
            }

            string path = string.Concat(Application.StartupPath, "\\VentasPorMozo", DateTime.Today.Day.ToString(), DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString(), ".xlsx");

            em.SaveAsNew(path);

            Process.Start(path);
        }
        public static void ImprimirVentasDiarias(DateTime desde, DateTime hasta)
        {
            List <string[]> lista = new List <string[]>();

            lista = Comanda_datos.VentasPorDia(desde, hasta);

            string          SheetsName = "Hoja1";
            ExcelManagement em         = ExcelManagement.GetInstance();

            em.Open(Application.StartupPath + "\\VentasDiarias.xlsx");

            int c = 2;

            foreach (string[] array in lista)
            {
                em.WriteCell(SheetsName, 1, 1, desde.Date);
                em.WriteCell(SheetsName, 1, 2, hasta.Date);
                em.WriteCell(SheetsName, c, 1, array[0]);
                em.WriteCell(SheetsName, c, 2, Convert.ToDouble(array[1]));
                c++;
            }

            string path = string.Concat(Application.StartupPath, "\\VentasDiarias", DateTime.Today.Day.ToString(), DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString(), ".xlsx");

            em.SaveAsNew(path);

            //ProcessStartInfo startInfo = new ProcessStartInfo();
            //startInfo.FileName = "EXCEL.EXE";
            //startInfo.Arguments = path;
            //Process.Start(startInfo);
            System.Diagnostics.Process.Start(path);
        }
コード例 #3
0
        public static void ImprimirPreciosPorCategoria()
        {
            List <string[]> lista = new List <string[]>();

            lista = Producto_datos.PreciosPorCategoria();

            string          SheetsName = "Hoja1";
            ExcelManagement em         = ExcelManagement.GetInstance();

            em.Open(Application.StartupPath + "\\PreciosPorCategoria.xlsx");

            int c = 2;

            foreach (string[] array in lista)
            {
                em.WriteCell(SheetsName, c, 1, array[0]);
                em.WriteCell(SheetsName, c, 2, Convert.ToInt32(array[1]));
                em.WriteCell(SheetsName, c, 3, array[2]);
                em.WriteCell(SheetsName, c, 4, Convert.ToDouble(array[3]));
                c++;
            }

            string path = string.Concat(Application.StartupPath, "\\PreciosPorCategoria", DateTime.Today.Day.ToString(), DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString(), ".xlsx");

            em.SaveAsNew(path);

            //ProcessStartInfo startInfo = new ProcessStartInfo();
            //startInfo.FileName = "EXCEL.EXE";
            //startInfo.Arguments = path;
            //Process.Start(startInfo);
            System.Diagnostics.Process.Start(path);
        }
 /// <summary>
 /// Obtiene una instancia del manejador de Excel
 /// </summary>
 /// <returns></returns>
 public static ExcelManagement GetInstance()
 {
     if (excelManagement == null)
     {
         excelManagement = new ExcelManagement();
     }
     return(excelManagement);
 }
コード例 #5
0
        public static void ImprimirMateriaPrimaUtilizada(DateTime desde, DateTime hasta)
        {
            List <string[]> listaProdConsCom = new List <string[]>();
            List <string[]> listaConsComp    = new List <string[]>();

            listaProdConsCom = Producto_datos.ProductosConsumidosComanda(desde, hasta);
            listaConsComp    = Producto_datos.MPConsumidaPorCompuestos(desde, hasta);

            string          SheetsName = "Hoja1";
            ExcelManagement em         = ExcelManagement.GetInstance();

            em.Open(Application.StartupPath + "\\MateriaPrimaUtilizada.xlsx");

            int c = 2;

            foreach (string[] array in listaProdConsCom)
            {
                em.WriteCell(SheetsName, 1, 1, desde.Date);
                em.WriteCell(SheetsName, 1, 2, hasta.Date);
                em.WriteCell(SheetsName, c, 1, array[0]);
                em.WriteCell(SheetsName, c, 2, Convert.ToInt32(array[1]));
                em.WriteCell(SheetsName, c, 3, array[2]);
                em.WriteCell(SheetsName, c, 4, Convert.ToDouble(array[3]));
                c++;
            }

            c = 2;

            foreach (string[] array in listaConsComp)
            {
                em.WriteCell(SheetsName, c, 6, Convert.ToInt32(array[0]));
                em.WriteCell(SheetsName, c, 7, array[1]);
                em.WriteCell(SheetsName, c, 8, Convert.ToDouble(array[2]));
                em.WriteCell(SheetsName, c, 9, array[3]);
                c++;
            }

            string path = string.Concat(Application.StartupPath, "\\MateriaPrimaUtilizada", DateTime.Today.Day.ToString(), DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString(), ".xlsx");

            em.SaveAsNew(path);

            //ProcessStartInfo startInfo = new ProcessStartInfo();
            //startInfo.FileName = "EXCEL.EXE";
            //startInfo.Arguments = path;
            //Process.Start(startInfo);
            System.Diagnostics.Process.Start(path);
        }