From 95a5152746c97da8784b0875edbbc04e08fd97d4 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 21 Oct 2016 15:38:52 +0200 Subject: [PATCH] NEW : Consumption view on thirdparty total line and total HT by element --- htdocs/societe/consumption.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 85695efff40..66e218a7909 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -279,12 +279,12 @@ if ($type_element == 'contract') $thirdTypeSelect='customer'; } -if (!empty($sql_select)) +if (!empty($sql_select)) { $sql = $sql_select; $sql.= ' d.description as description,'; - if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; + if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; $sql.= " s.rowid as socid "; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; @@ -313,10 +313,10 @@ if (!empty($sql_select)) $sql.=")"; } $sql.= $db->order($sortfield,$sortorder); - + $resql=$db->query($sql); $totalnboflines = $db->num_rows($resql); - + $sql.= $db->plimit($limit + 1, $offset); //print $sql; } @@ -334,6 +334,7 @@ $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPO $button = ''; $param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid."&type_element=".$type_element; +$total_qty=0; if ($sql_select) { @@ -362,6 +363,7 @@ if ($sql_select) print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); print "\n"; // Filters print ''; @@ -377,6 +379,8 @@ if ($sql_select) print ''; print ''; print ''; + print ''; + print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -554,11 +558,21 @@ if ($sql_select) //print ''.$prodreftxt.''; print ''.$objp->prod_qty.''; + $total_qty+=$objp->prod_qty; + + print ''.price($objp->total_ht).''; + $total_ht+=$objp->total_ht; + print "\n"; $i++; } + print ''; + print '' . $langs->trans('Total') . ''; + print ''; + print '' . $total_qty . ''; + print '' . price($total_ht) . ''; print ""; if ($num > $limit) {