From 77d3f221631a1a92e7c27c82126c33f505eea90c Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 6 May 2019 11:21:39 +0200 Subject: [PATCH 1/3] NEW : Amount invoiced column in propal list --- htdocs/comm/propal/list.php | 30 ++++++++++++++++++++++++++++++ htdocs/langs/fr_FR/main.lang | 1 + 2 files changed, 31 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 24c53d265260e..7355ea83269a6 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -160,6 +160,7 @@ 'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -637,6 +638,12 @@ print ''; print ''; } + if (! empty($arrayfields['p.total_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } if (! empty($arrayfields['u.login']['checked'])) { // Author @@ -701,6 +708,7 @@ if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -911,6 +919,27 @@ if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; } + // Amount invoiced + if(! empty($arrayfields['p.total_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ttc; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalinvoiced'] += $totalInvoiced; + } $userstatic->id=$obj->fk_user_author; $userstatic->login=$obj->login; @@ -1037,6 +1066,7 @@ elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalinvoicedfield'] == $i) print ''.price($totalarray['totalinvoiced']).''; elseif ($totalarray['totalizable']) { $printed = false; foreach ($totalarray['totalizable'] as $totalizable) { diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 552c3334bbe45..22e6914dcd97c 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -347,6 +347,7 @@ PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture AmountInvoiced=Montant facturé +AmountInvoicedTTC=Montant TTC facturé AmountPayment=Montant paiement AmountHTShort=Montant HT AmountTTCShort=Montant TTC From 6be48e69521262c461b91d61095362239acec38e Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 20 May 2019 08:59:44 +0200 Subject: [PATCH 2/3] NEW : Amount HT invoiced column in propal list --- htdocs/comm/propal/list.php | 32 +++++++++++++++++++++++++++++++- htdocs/langs/fr_FR/main.lang | 1 + 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7355ea83269a6..cd98800f6065e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -160,6 +160,7 @@ 'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0), 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), @@ -638,6 +639,12 @@ print ''; print ''; } + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } if (! empty($arrayfields['p.total_invoiced']['checked'])) { // Amount invoiced @@ -708,7 +715,8 @@ if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -920,6 +928,27 @@ $totalarray['totalttc'] += $obj->total_ttc; } // Amount invoiced + if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ht; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalhtinvoiced'] += $totalInvoiced; + } + // Amount invoiced if(! empty($arrayfields['p.total_invoiced']['checked'])) { $totalInvoiced = 0; $p = new Propal($db); @@ -1066,6 +1095,7 @@ elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtinvoicedfield'] == $i) print ''.price($totalarray['totalhtinvoiced']).''; elseif ($totalarray['totalinvoicedfield'] == $i) print ''.price($totalarray['totalinvoiced']).''; elseif ($totalarray['totalizable']) { $printed = false; diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22e6914dcd97c..3cbcf89574e9e 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -347,6 +347,7 @@ PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture AmountInvoiced=Montant facturé +AmountInvoicedHT=Montant HT facturé AmountInvoicedTTC=Montant TTC facturé AmountPayment=Montant paiement AmountHTShort=Montant HT From 330842d67eebc30f56ebc7dc9ed00246ec0a19a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2019 13:14:44 +0200 Subject: [PATCH 3/3] Update list.php --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ee8dacde3809d..555e89e7a6138 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -162,8 +162,8 @@ 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0), - 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), + 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), + 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),