mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-14 18:58:17 +02:00
feat: hit-parade date range + fournisseur filter; fix create user button layout
- Replace month dropdown with date picker (Du/Au) + Appliquer button - Add fournisseur filter dropdown (client-side, all suppliers from current data) - Totals update live when fournisseur filter changes - SQL: use BETWEEN date range instead of TO_CHAR month match - Create user button: proper 3-col form layout so button stays on one line Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
05354a0e74
commit
868886db87
4 files changed
+160
-119
No files matched your search
@@ -709,9 +709,9 @@ export interface HitParadeRow {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les ventes produit pour un mois donné, avec fournisseur, qté, CA TTC et marge par site.
|
||||
* Retourne les ventes produit sur une période, avec fournisseur, qté, CA TTC et marge par site.
|
||||
*/
|
||||
export async function pgGetHitParade(mois: string): Promise<HitParadeRow[]> {
|
||||
export async function pgGetHitParade(dateDebut: string, dateFin: string): Promise<HitParadeRow[]> {
|
||||
const result = await pgNoParallel(sql`
|
||||
SELECT
|
||||
a.codein::text AS codein,
|
||||
@@ -725,13 +725,13 @@ export async function pgGetHitParade(mois: string): Promise<HitParadeRow[]> {
|
||||
JOIN articles a ON a.no_id = m.artnoid
|
||||
LEFT JOIN artfou1 af ON af.art_no_id = a.no_id AND af.preference = 1
|
||||
LEFT JOIN fouident fi ON fi.code = af.code
|
||||
WHERE TO_CHAR(m.datmvt, 'YYYY-MM') = ${mois}
|
||||
WHERE m.datmvt BETWEEN ${dateDebut}::date AND ${dateFin}::date
|
||||
AND m.site IN ('292', '579')
|
||||
AND m.genremvt = 3
|
||||
GROUP BY a.codein, a.libelle1, fi.nom, af.code, m.site
|
||||
ORDER BY ca_ttc DESC
|
||||
`);
|
||||
|
||||
console.log(`[pg-ff] HitParade: ${result.rows.length} lignes pour ${mois}`);
|
||||
console.log(`[pg-ff] HitParade: ${result.rows.length} lignes pour ${dateDebut}→${dateFin}`);
|
||||
return result.rows as unknown as HitParadeRow[];
|
||||
}
|
||||
Reference in new issue
Block a user