hotfix: detail facture

pull/8040/head
Gauthier LO 2025-03-27 15:09:04 +01:00
parent ce052f46fc
commit d6d9ffd343
2 changed files with 57 additions and 29 deletions

View File

@ -1,29 +1,56 @@
CREATE OR REPLACE VIEW detail_de_facture AS create definer = admin@`%` view detail_de_facture as
SELECT s.name AS 'Boutique', select `s`.`name` AS `Boutique`,
po.platform_order_id AS 'N° de Mabang', `po`.`platform_order_id` AS `N° de Mabang`,
po.platform_order_number AS 'N° de commande', `po`.`platform_order_number` AS `N° de commande`,
po.tracking_number AS 'N° de suivi', `po`.`tracking_number` AS `N° de suivi`,
po.order_time AS 'Date de commande', `po`.`order_time` AS `Date de commande`,
po.shipping_time AS 'Date d\'expédition', `po`.`shipping_time` AS `Date d'expédition`,
po.recipient AS 'Nom de client', `po`.`recipient` AS `Nom de client`,
po.country AS 'Pays', `po`.`country` AS `Pays`,
po.postcode AS 'Code postal', `po`.`postcode` AS `Code postal`,
JSON_ARRAYAGG(sku.erp_code) AS 'SKU', json_arrayagg(`wia_app`.`sku`.`erp_code`) AS `SKU`,
JSON_ARRAYAGG(sku.en_name) AS 'Nom produits', json_arrayagg(`wia_app`.`sku`.`en_name`) AS `Nom produits`,
JSON_ARRAYAGG(poc.quantity) AS 'Quantité', json_arrayagg(`poc`.`quantity`) AS `Quantité`,
SUM(poc.purchase_fee) AS 'Frais d\'achat', sum(`poc`.`purchase_fee`) AS `Frais d'achat`,
po.fret_fee AS 'Frais de FRET', `po`.`fret_fee` AS `Frais de FRET`,
SUM(poc.shipping_fee) AS 'Frais de livraison', sum(`poc`.`shipping_fee`) AS `Frais de livraison`,
po.order_service_fee + SUM(poc.service_fee) AS 'Frais de service', (`po`.`order_service_fee` + sum(`poc`.`service_fee`)) AS `Frais de service`,
po.picking_fee + SUM(poc.picking_fee) AS 'Frais de préparation', (`po`.`picking_fee` + sum(`poc`.`picking_fee`)) AS `Frais de préparation`,
po.packaging_material_fee AS 'Frais de matériel d\'emballage', `po`.`packaging_material_fee` AS `Frais de matériel d'emballage`,
SUM(poc.vat) AS 'TVA', `po`.`insurance_fee` AS `Frais d'assurance produits`,
po.shipping_invoice_number AS 'N° de facture' sum(`poc`.`vat`) AS `TVA`,
FROM platform_order po `po`.`shipping_invoice_number` AS `N° de facture`
JOIN shop s ON po.shop_id = s.id from ((`wia_app`.`platform_order_content` `poc` left join (`wia_app`.`platform_order` `po` join `wia_app`.`shop` `s`
RIGHT JOIN platform_order_content poc ON po.id = poc.platform_order_id on ((`po`.`shop_id` = `s`.`id`)))
JOIN sku ON poc.sku_id = sku.id on ((`po`.`id` = `poc`.`platform_order_id`))) join `wia_app`.`sku` on ((`poc`.`sku_id` = `wia_app`.`sku`.`id`)))
WHERE shipping_invoice_number IS NOT NULL where ((`po`.`order_time` > '2024-01-01') and (`po`.`shipping_invoice_number` is not null) and
AND poc.erp_status <> 5 (`poc`.`erp_status` <> 5))
GROUP BY po.id, s.name, po.order_time group by `po`.`id`, `s`.`name`, `po`.`order_time`
ORDER BY s.name, po.order_time; order by `s`.`name`, `po`.`order_time`;
-- comment on column detail_de_facture.Boutique not supported:
-- comment on column detail_de_facture.`N° de Mabang` not supported:
-- comment on column detail_de_facture.`N° de commande` not supported:
-- comment on column detail_de_facture.`N° de suivi` not supported:
-- comment on column detail_de_facture.`Date de commande` not supported:
-- comment on column detail_de_facture.`Date d'expédition` not supported:
-- comment on column detail_de_facture.`Nom de client` not supported:
-- comment on column detail_de_facture.Pays not supported:
-- comment on column detail_de_facture.`Code postal` not supported:
-- comment on column detail_de_facture.`Frais de FRET` not supported:
-- comment on column detail_de_facture.`Frais de matériel d'emballage` not supported:
-- comment on column detail_de_facture.`Frais d'assurance produits` not supported:
-- comment on column detail_de_facture.`N° de facture` not supported:

View File

@ -35,6 +35,7 @@
po.order_service_fee + SUM(poc.service_fee) AS 'Frais de service', po.order_service_fee + SUM(poc.service_fee) AS 'Frais de service',
po.picking_fee + SUM(poc.picking_fee) AS 'Frais de préparation', po.picking_fee + SUM(poc.picking_fee) AS 'Frais de préparation',
po.packaging_material_fee AS 'Frais de matériel d\'emballage', po.packaging_material_fee AS 'Frais de matériel d\'emballage',
COALESCE(po.insurance_fee, 0.00) AS 'Frais d\'assurance produits',
SUM(poc.vat) AS 'TVA', SUM(poc.vat) AS 'TVA',
po.shipping_invoice_number AS 'N° de facture' po.shipping_invoice_number AS 'N° de facture'
FROM platform_order po FROM platform_order po