====== Les ventes ======
===== Indicateurs du tableau de bord des ventes ====
==== Volume de ventes par mois ====
{{:thematiques:informatique:capture_du_2018-12-31_07-38-51.png?400|}}
SELECT sum("public"."report_pos_order"."price_total") AS "sum", date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp)) AS "date"
FROM "public"."report_pos_order"
GROUP BY date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp))
ORDER BY date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp)) ASC
==== Volume de ventes par semaine ====
{{:thematiques:informatique:capture_du_2018-12-31_07-40-23.png?400|}}
SELECT sum("public"."report_pos_order"."price_total") AS "sum", (date_trunc('week', CAST((CAST("public"."report_pos_order"."date" AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day') AS "date"
FROM "public"."report_pos_order"
GROUP BY (date_trunc('week', CAST((CAST("public"."report_pos_order"."date" AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day')
ORDER BY (date_trunc('week', CAST((CAST("public"."report_pos_order"."date" AS timestamp) + INTERVAL '1 day') AS timestamp)) - INTERVAL '1 day') ASC
==== Evolution du panier mensuel ====
{{:thematiques:informatique:capture_du_2018-12-31_07-41-45.png?400|}}
SELECT avg("inner_query"."sum"), "inner_query"."date"
FROM
(SELECT sum("public"."report_pos_order"."price_total") AS "sum", "public"."report_pos_order"."partner_id" AS "partner_id", date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp)) AS "date"
FROM "public"."report_pos_order"
GROUP BY "public"."report_pos_order"."partner_id", date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp))
ORDER BY "public"."report_pos_order"."partner_id" ASC, date_trunc('month', CAST("public"."report_pos_order"."date" AS timestamp)) ASC) AS "inner_query"
GROUP BY "inner_query"."date"