private void panel9_Click(object sender, EventArgs e)
        {
            string filter = "";
            string title  = "";

            switch ((sender as Panel).Name)
            {
            case "panelCAT":
                title  = "Devoluciones Totales por Año";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) ";
                break;

            case "panelCMT":
                title  = "Devoluciones Totales por Mes";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW())))";
                break;

            case "panelCDT":
                title  = "Devoluciones Totales por Dia";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW()))) " +
                         "AND DAY(FechaEmision) = (SELECT(DAY(NOW())))";
                break;

            case "panelCTT":
                title = "Devoluciones Totales Totales";
                break;

            case "panelCAC":
                title  = "Devoluciones Aprobadas por Año";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND Aprobado = 1";
                break;

            case "panelCMC":
                title  = "Devoluciones Aprobadas por Mes";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW())))" +
                         "AND Aprobado = 1";
                break;

            case "panelCDC":
                title  = "Devoluciones Aprobadas por Dia";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW()))) " +
                         "AND DAY(FechaEmision) = (SELECT(DAY(NOW())))" +
                         "AND Aprobado = 1";
                break;

            case "panelCTC":
                title  = "Devoluciones Aprobadas Totales";
                filter = "AND Aprobado = 1";
                break;
            }
            UI_Vistas form = new UI_Vistas(title, "" +
                                           "tbl_devolucionencabezado.id as 'CÓDIGO',  CONCAT(tbl_persona.Nombre,',',tbl_organizacion.Nombre) as 'CLIENTE', " +
                                           "tbl_devolucionencabezado.Motivo as 'MOTIVO', " +
                                           "tbl_devolucionencabezado.FechaEmision as 'FECHA DE EMISIÓN' ",
                                           "tbl_devolucionencabezado, tbl_organizacion,tbl_persona,tbl_cliente ",
                                           "tbl_devolucionencabezado.tbl_Cliente_id = tbl_Cliente.NIT " +
                                           "AND tbl_Cliente.tbl_organizacion_id = tbl_organizacion.id " +
                                           "AND tbl_Cliente.tbl_Persona_id = tbl_Persona.id " +
                                           "AND tbl_devolucionencabezado.status = 1 " +
                                           filter,
                                           "Visualizacion de Devoluciones Encabezado",
                                           true,
                                           5,
                                           true);

            form.ShowDialog();
        }
예제 #2
0
        private void panel9_Click(object sender, EventArgs e)
        {
            string filter = "";
            string title  = "";

            switch ((sender as Panel).Name)
            {
            case "panelCAT":
                title  = "Ventas Totales por Año";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) ";
                break;

            case "panelCMT":
                title  = "Ventas Totales por Mes";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW())))";
                break;

            case "panelCDT":
                title  = "Ventas Totales por Dia";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW()))) " +
                         "AND DAY(FechaEmision) = (SELECT(DAY(NOW())))";
                break;

            case "panelCTT":
                title = "Ventas Totales Totales";
                break;

            case "panelCAC":
                title  = "Ventas Canceladas por Año";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND Cancelado = 1";
                break;

            case "panelCMC":
                title  = "Ventas Canceladas por Mes";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW())))" +
                         "AND Cancelado = 1";
                break;

            case "panelCDC":
                title  = "Ventas Canceladas por Dia";
                filter = "AND YEAR(FechaEmision) = (SELECT(YEAR(NOW()))) " +
                         "AND MONTH(FechaEmision) = (SELECT(MONTH(NOW()))) " +
                         "AND DAY(FechaEmision) = (SELECT(DAY(NOW())))" +
                         "AND Cancelado = 1";
                break;

            case "panelCTC":
                title  = "Ventas Canceladas Totales";
                filter = "AND Cancelado = 1";
                break;

            case "panelCFP":
                title = "Ventas prontas a pagar";
                DateTime dt         = (DateTime.Now).AddDays(7);
                string   futureDate = dt.ToString("yyyyMMdd");
                string   nowDate    = DateTime.Now.ToString("yyyyMMdd");
                filter = " AND fechaCancelacion BETWEEN '" + nowDate + "' AND '" + futureDate + "'";
                break;
            }
            UI_Vistas form = new UI_Vistas(title, "" +
                                           "tbl_ventasencabezado.id as 'CÓDIGO',  CONCAT(tbl_persona.Nombre,',',tbl_organizacion.Nombre) as 'CLIENTE', " +
                                           "tbl_ventasencabezado.FechaEmision as 'FECHA DE EMISIÓN', " +
                                           "tbl_ventasencabezado.FechaCancelacion as 'FECHA DE CANCELACIÓN', " +
                                           "tbl_ventasencabezado.Saldo as 'SALDO', " +
                                           "tbl_ventasencabezado.Total as 'TOTAL', " +
                                           "tbl_ventasencabezado.Transporte as 'TRANSPORTE' ",
                                           "tbl_ventasencabezado, tbl_organizacion,tbl_persona,tbl_cliente ",
                                           "tbl_ventasencabezado.tbl_Cliente_id = tbl_Cliente.NIT " +
                                           "AND tbl_Cliente.tbl_organizacion_id = tbl_organizacion.id " +
                                           "AND tbl_Cliente.tbl_Persona_id = tbl_Persona.id " +
                                           "AND tbl_ventasencabezado.status = 1 " +
                                           filter,
                                           "Visualizacion de Ventas Encabezado",
                                           true,
                                           5,
                                           true);

            form.ShowDialog();
        }