Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = "select
- u.lastname as nomBenef,
- u.firstname as prenomBenef,
- a.adr1 as adresse,
- c.zipcode as zipcode,
- c.name as ville,
- r.id_type as idTypeRetour,
- r.id_organisme as organismeRetour,
- r.createAt as dateRetour,
- r.code as codeRetour,
- r.id_address as addressRetour,
- r.comment as commentRetour,
- rs.name as etatRetour,
- ao.number as numOrder,
- p.name as nameProduct,
- lr.id_motif as motifLigneRetour,
- ai.reference as sct,
- lr.sct_echange as newSctLigneRetour,
- mvp.size_value as tailleProduct,
- if (mvp.conf_id = 1, mvp.conf_value, null) as conformationProduct,
- mvp2.size_value as newTailleProduct,
- if (mvp2.conf_id = 1, mvp2.conf_value, null) as newConformationProduct,
- rm.name as ligneRetourMotif,
- rt.name as retourType
- from retour r
- join ligneretour lr on lr.id_retour = r.id
- join ligne_preparation lp on lp.id_ligne_preparation = lr.id_ligne_preparation
- join bon_preparation bp on bp.id_bon_preparation = lp.id_bon_preparation
- join anorder ao on ao.id = bp.id_commande
- join anorderitem ai on ai.order_id = ao.id and ai.reference = lp.id_stock_sct
- join product p on p.id = ai.product_id
- left join measuretypevalueproduct mvp on lr.sct = mvp.reference
- left join measuretypevalueproduct mvp2 on lr.sct_echange = mvp2.reference
- join retourstatus rs on r.id_status = rs.id
- left join retourmotif rm on lr.id_motif = rm.id
- join retourtype rt on r.id_type = rt.id
- join address a on r.id_address = a.id
- join commune c on a.commune_id = c.id
- join user u on ao.recipient_id = u.id";
- $sql .= $where;
- $sql .= " and r.id_type != :vrac
- group by lp.id_ligne_preparation
- order by r.createAt DESC";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement