Appolline Posted March 16, 2017 Share Posted March 16, 2017 (edited) Bonjour, je cherche à avoir l'état de mon stock au 31/12/2016. Cette requête me donne l'état au jour J, comment lui indiquer la date du 31/12/2016 ? Est ce possible ? Merci beaucoup à tous, Appo SELECT p.id_product, p.id_category_default, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR "|") as categories, CASE WHEN pa.reference IS NULL THEN p.reference ELSE pa.reference END as reference, pl.name, CASE WHEN pa.price IS NULL THEN p.price ELSE p.price + pa.price END as price, p.wholesale_price, pq.quantity FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND (pa.id_product_attribute IS NULL OR pa.id_product_attribute = pq.id_product_attribute) ) LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) AND pal.id_lang = 1 LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product) LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) LEFT JOIN ps_category c ON (cp.id_category = c.id_category) WHERE pl.id_lang = 1 GROUP BY reference ORDER BY p.id_product, pac.id_attribute Edited March 17, 2017 by Appolline (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted March 16, 2017 Share Posted March 16, 2017 C'est impossible car les stocks sont mis à jour à chaque modification (vente, réassort, etc...) Ce qu'il faut, c'est créer une tâche cron qui vous sort votre stock chaque jour et stocker les résultats (xls, csv, pdf...) Link to comment Share on other sites More sharing options...
BeComWeb Posted March 16, 2017 Share Posted March 16, 2017 Peut-être en utilisant la table product_sale. C'est une piste, je ne suis pas certain que ce soit LA solution Link to comment Share on other sites More sharing options...
Appolline Posted March 17, 2017 Author Share Posted March 17, 2017 Bonjour et tout d'abord merci pour vos réponses. je crois que le circuit court est d'aller chercher un backup de la base au 31/12/2016 je vais mettre un cron pour l'an prochain 1 Link to comment Share on other sites More sharing options...
BeComWeb Posted March 17, 2017 Share Posted March 17, 2017 Je sens que tu vas faire un mécontent et que ce mécontent est comptable Mais effectivement le challenge était corsé. Pense à passer ton topic en "[Résolu]" et bon week-end 1 Link to comment Share on other sites More sharing options...
Appolline Posted March 17, 2017 Author Share Posted March 17, 2017 un comptable content est un oxymore.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now