USE `vn`;
CREATE 
     OR REPLACE ALGORITHM = UNDEFINED 
    DEFINER = `root`@`%` 
    SQL SECURITY DEFINER
VIEW `buy` AS
    SELECT 
        `c`.`Id_Compra` AS `id`,
        `c`.`Id_Entrada` AS `entryFk`,
        `c`.`Id_Article` AS `itemFk`,
        `c`.`Cantidad` AS `amount`,
        `c`.`Costefijo` AS `buyingValue`,
        `c`.`Cantidad` AS `quantity`,
        `c`.`Id_Cubo` AS `packageFk`,
        `c`.`Etiquetas` AS `stickers`,
        `c`.`Portefijo` AS `freightValue`,
        `c`.`Embalajefijo` AS `packageValue`,
        `c`.`Comisionfija` AS `comissionValue`,
        `c`.`Packing` AS `packing`,
        `c`.`grouping` AS `grouping`,
        `c`.`caja` AS `groupingMode`,
        `c`.`Nicho` AS `location`,
        `c`.`Tarifa1` AS `price1`,
        `c`.`Tarifa2` AS `price2`,
        `c`.`Tarifa3` AS `price3`,
        `c`.`PVP` AS `minPrice`,
        `c`.`Productor` AS `producer`,
        `c`.`Vida` AS `printedStickers`,
        `c`.`punteo` AS `isChecked`,
        `c`.`Novincular` AS `isIgnored`
    FROM
        `vn2008`.`Compres` `c`;
