
# Report / Ingreso/Egreso diario #

INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4988-9ed8-e24339f5b198', 'report.daily.entry.exit.name', 'report.daily.entry.exit.description', 'report.daily.entry.exit.path ', '20', '170', '0', '1', '1');

# Report / Google Drive #

INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4989-9ed8-e24339f5b198', 'report.google.drive.name', 'report.google.drive.description', 'report.google.drive.path', '20', '159', '0', '1', '1');


# Report / Historial de bancas #

INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4990-9ed8-e24339f5b198', 'report.banking.history.name', 'report.banking.history.description', 'report.banking.history.path', '20', '160', '0', '1', '1');


# Report /  Pagos en domingo #


INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4991-9ed8-e24339f5b198', 'report.payments.sunday.name', 'report.payments.sunday.description', 'report.payments.sunday.path', '20', '161', '0', '1', '1');



# Report /  Ventas esperadas #
INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4992-9ed8-e24339f5b198', 'report.expected.sales.name', 'report.expected.sales.description', 'report.expected.sales.path', '20', '162', '0', '1', '1');



# Report / Depósitos #
INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4993-9ed8-e24339f5b198', 'report.deposits.name', 'report.deposits.description', 'report.deposits.path', '20', '163', '0', '1', '1');

#  Facturación / facturación servicios  #

INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) VALUES ('fe816d8c-238b-4994-9ed8-e24339f5b198', 'invoicing.services.name', 'invoicing.services.description', 'invoicing.services.path', '20', '164', '0', '1', '1');

# nueva vista kardex_view
CREATE 
    OR REPLACE
VIEW `KARDEX_VIEW` AS
    SELECT 
        `e`.`id` AS `id`,
        `e`.`payment` AS `pago`,
        `e`.`created_on` AS `created_on`,
        (SELECT 
                `expense_income_catalog`.`name`
            FROM
                `EXPENSE_INCOME_CATALOG expense_income_catalog`
            WHERE
                (`expense_income_catalog`.`id` = `e`.`id_expense_type`)) AS `type`,
        `e`.`folio` AS `folio`,
        `e`.`description` AS `description`,
        (SELECT 
                `taxi`.`economic_number`
            FROM
                `TAXI taXI`
            WHERE
                (`taxi`.`id` = `e`.`taxi_id`)) AS `economic_number`
    FROM
        (`EXPENSE` `e`
        JOIN `TAXI` `t` ON ((`e`.`taxi_id` = `t`.`id`))) 
    UNION SELECT 
        `i`.`id` AS `id`,
        `i`.`total` AS `pago`,
        `i`.`fecha` AS `created_on`,
        'COMPRAS' AS `type`,
        `i`.`compra` AS `folio`,
        CONCAT(`i`.`producto`,
                ' - ',
                `i`.`producto_code`,
                ' - ',
                `i`.`comentarios`) AS `description`,
        (SELECT 
                `taxi`.`economic_number`
            FROM
                TAXI `taxi`
            WHERE
                (`taxi`.`id` = `i`.`taxi`)) AS `economic_number`
    FROM
        (`KARDEX_IN_STOCKTAKING_VIEW` `i`
        JOIN `TAXI` `t` ON ((`i`.`taxi` = `t`.`id`))) 
    UNION SELECT 
        `se`.`id` AS `id`,
        `se`.`total` AS `pago`,
        `se`.`fecha` AS `created_on`,
        'ORDEN DE SERVICIO' AS `type`,
        `se`.`orden_serivicio` AS `folio`,
        CONCAT(`se`.`producto`,
                ' - ',
                `se`.`codigo_producto`,
                ' - ',
                `se`.`marca`) AS `description`,
        (SELECT 
                `taxi`.`economic_number`
            FROM
                TAXI `taxi`
            WHERE
                (`taxi`.`id` = `se`.`taxi_id`)) AS `economic_number`
    FROM
        (`KARDEX_OUT_STOCKTAKING_VIEW` `se`
        JOIN `TAXI` `t` ON ((`se`.`taxi_id` = `t`.`id`)))

# Template /  Imprimir tickets #
INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) 
    VALUES ('fe816d8q-238b-4929-9ed8-e25339f5b198', 'print.ticket.name', 'print.ticket.description', 'print.ticket.path', '20', '30', '0', '1', '1');
# Administration / Vehículo / Kardex #
INSERT INTO `car_driver_tepic`.`PERMISSION` (`id`, `name`, `description`, `menu_path`, `left_to_right_order`, `top_to_bottom_order`, `general_access`, `application_menu`, `active`) 
    VALUES ('fe816d8q-238b-4929-9ed8-e26339f5b198', 'admin.taxi.kardex.name', 'admin.taxi.kardex.description', 'admin.taxi.kardex.path', '20', '30', '0', '1', '1');

