From f714897873a5cb1bae186edb1b3c79ef13a1a1e5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Aug 2012 10:28:16 +0200 Subject: [PATCH] Fix: limit to products and services --- htdocs/compta/journal/sellsjournal.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 66e76117c8f..1e1bec80c3c 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -93,7 +93,8 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS); $idpays = $p[0]; -$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; +$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; +$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; $sql.= " ct.accountancy_code"; @@ -102,7 +103,9 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; -$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity; +$sql.= " WHERE f.entity = ".$conf->entity; +$sql.= " AND f.fk_statut > 0"; +$sql.= " AND fd.product_type IN (0,1)"; if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " ORDER BY f.rowid";