This commit is contained in:
Laurent Destailleur 2019-11-05 12:47:38 +01:00
parent 4d84ee2041
commit ce1dec253f
41 changed files with 240 additions and 812 deletions

View File

@ -922,8 +922,8 @@ while ($i < min($num, $limit))
{
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
$totalarray['totaldebit'] += $line->debit;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebit';
$totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
@ -931,8 +931,8 @@ while ($i < min($num, $limit))
{
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
$totalarray['totalcredit'] += $line->credit;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;
}
// Lettering code
@ -998,29 +998,7 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
{
$i=0;
print '<tr class="liste_total">';
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
else print '<td></td>';
}
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";

View File

@ -919,26 +919,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -588,26 +588,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -827,9 +827,12 @@ if ($rowid > 0)
$doleditor->Create();
print "</td></tr>";
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@ -838,33 +841,6 @@ if ($rowid > 0)
print '</table>';
// Extra field
if (empty($reshook))
{
print '<br><br><table class="border" width="100%">';
if (is_array($extrafields->attributes['adherent_type']['label']))
{
foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $object->array_options["options_" . $key];
}
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key, $value);
print "</td></tr>\n";
}
}
print '</table><br><br>';
}
dol_fiche_end();
print '<div class="center">';

View File

@ -497,26 +497,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -461,26 +461,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -555,26 +555,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -947,24 +947,24 @@ if ($resql)
{
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht';
$totalarray['val']['p.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['p.total_vat']['checked']))
{
print '<td class="right">'.price($obj->total_vat)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_vat;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_vat';
$totalarray['val']['p.total_vat'] += $obj->total_vat;
}
// Amount TTC
if (! empty($arrayfields['p.total_ttc']['checked']))
{
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ttc';
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
}
// Amount invoiced
if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) {
@ -984,8 +984,8 @@ if ($resql)
print '<td class="right">'.price($totalInvoiced)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield'];
$totalarray['totalhtinvoiced'] += $totalInvoiced;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_ht_invoiced';
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
}
// Amount invoiced
if(! empty($arrayfields['p.total_invoiced']['checked'])) {
@ -1005,8 +1005,8 @@ if ($resql)
print '<td class="right">'.price($totalInvoiced)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield'];
$totalarray['totalinvoiced'] += $totalInvoiced;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.total_invoiced';
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
}
$userstatic->id=$obj->fk_user_author;
@ -1120,45 +1120,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield'])
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
|| isset($totalarray['totalizable'])
)
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalhtinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalhtinvoiced']).'</td>';
elseif ($totalarray['totalinvoicedfield'] == $i) print '<td class="right">'.price($totalarray['totalinvoiced']).'</td>';
elseif ($totalarray['totalizable']) {
$printed = false;
foreach ($totalarray['totalizable'] as $totalizable) {
if ($totalizable['pos']==$i && ! $printed) {
print '<td class="right">'.price($totalizable['total']).'</td>';
$printed = true;
}
}
if (! $printed) {
print '<td></td>';
}
}
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -1057,24 +1057,25 @@ if ($resql)
{
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht';
$totalarray['val']['c.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['c.total_vat']['checked']))
{
print '<td class="right">'.price($obj->total_tva)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_tva;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva';
$totalarray['val']['c.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (! empty($arrayfields['c.total_ttc']['checked']))
{
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc';
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
}
// Extra fields
@ -1139,30 +1140,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield'])
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
)
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -919,13 +919,13 @@ if ($resql)
if (! empty($arrayfields['b.debit']['checked']))
{
print '<td class="liste_titre right">';
print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
print '<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).'">';
print '</td>';
}
if (! empty($arrayfields['b.credit']['checked']))
{
print '<td class="liste_titre right">';
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
print '<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>';
}
if (! empty($arrayfields['balancebefore']['checked']))
@ -1085,6 +1085,7 @@ if ($resql)
if ($tmpnbfieldbeforebalance)
{
print '<td colspan="'.$tmpnbfieldbeforebalance.'">';
print '&nbsp;';
print '</td>';
}
@ -1110,6 +1111,7 @@ if ($resql)
</script>';
print '</td>';
print '<td colspan="'.($tmpnbfieldafterbalance+2).'">';
print '&nbsp;';
print '</td>';
print '</tr>';
}
@ -1529,7 +1531,6 @@ if ($resql)
print ' '.img_warning($langs->trans("ReconciliationLate"));
}
}
print '&nbsp;';
if ($user->rights->banque->modifier)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;rowid='.$objp->rowid.'&amp;id='.$objp->bankid.'&amp;page='.$page.'">';

View File

@ -563,8 +563,8 @@ foreach ($accounts as $key=>$type)
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
$totalarray['totalbalance'] += $solde;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='balance';
$totalarray['val']['balance'] += $solde;
}
// Action column
@ -594,22 +594,10 @@ if (! $found)
}
// Show total line
if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
if ($lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalbalancefield'] == $i) print '<td class="right">'.price($totalarray['totalbalance'], 0, $langs, 0, -1, -1, $lastcurrencycode).'</td>';
else print '<td></td>';
}
print '</tr>';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
}
print '</table>';

View File

@ -256,15 +256,19 @@ if ($result)
// Ref
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Label payment
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
if (! $i) $totalarray['nbfield']++;
// Account
if (! empty($conf->banque->enabled))
@ -289,6 +293,7 @@ if ($result)
}
else print '&nbsp;';
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accounting account
@ -297,6 +302,7 @@ if ($result)
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Debit
@ -304,8 +310,10 @@ if ($result)
if ($obj->sens == 0)
{
print price($obj->amount);
$totalarray['totaldeb'] += $obj->amount;
$totalarray['val']['total_deb'] += $obj->amount;
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
print "</td>";
// Credit
@ -313,8 +321,10 @@ if ($result)
if ($obj->sens == 1)
{
print price($obj->amount);
$totalarray['totalcred'] += $obj->amount;
$totalarray['val']['total_cred'] += $obj->amount;
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
print "</td>";
print "<td></td>";
@ -326,12 +336,8 @@ if ($result)
if (! empty($conf->banque->enabled)) $colspan++;
if (! empty($conf->accounting->enabled)) $colspan++;
print '<tr class="liste_total">';
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total right">'.price($totalarray['totaldeb'])."</td>";
print '<td class="liste_total right">'.price($totalarray['totalcred'])."</td>";
print '<td></td>';
print '</tr>';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print '</div>';

View File

@ -516,26 +516,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -216,22 +216,22 @@ if ($resql)
if ($objp->amount < 0)
{
print price($objp->amount * -1);
$totalarray['totaldeb'] += $objp->amount;
$totalarray['val']['totaldebfield'] += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebfield';
// Credit
print '<td class="right">';
if ($objp->amount > 0)
{
print price($objp->amount);
$totalarray['totalcred'] += $objp->amount;
$totalarray['val']['totalcredfield'] += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalcredfield';
print "</tr>";
@ -239,24 +239,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldebfield'] == $i) print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
elseif ($totalarray['totalcredfield'] == $i) print '<td class="right">'.price($totalarray['totalcred']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";

View File

@ -676,28 +676,9 @@ if ($resql)
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
//var_dump($totalarray);
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print "</div>";

View File

@ -1232,40 +1232,40 @@ if ($resql)
{
print '<td class="right nowrap">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ht';
$totalarray['val']['f.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['f.total_vat']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_vat)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_vat;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_vat';
$totalarray['val']['f.total_vat'] += $obj->total_vat;
}
// Amount LocalTax1
if (! empty($arrayfields['f.total_localtax1']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_localtax1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield'];
$totalarray['totallocaltax1'] += $obj->total_localtax1;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax1';
$totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
}
// Amount LocalTax2
if (! empty($arrayfields['f.total_localtax2']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_localtax2)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield'];
$totalarray['totallocaltax2'] += $obj->total_localtax2;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax2';
$totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
}
// Amount TTC
if (! empty($arrayfields['f.total_ttc']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
}
if(! empty($arrayfields['f.retained_warranty']['checked']))
@ -1277,16 +1277,16 @@ if ($resql)
{
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $totalpay;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalam';
$totalarray['val']['totalam'] += $totalpay;
}
if (! empty($arrayfields['rtp']['checked']))
{
print '<td class="right nowrap">'.(! empty($remaintopay)?price($remaintopay, 0, $langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='rtp';
$totalarray['val']['rtp'] += $remaintopay;
}
// Extra fields
@ -1345,35 +1345,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield'])
|| isset($totalarray['totallocaltax1field'])
|| isset($totalarray['totallocaltax2field'])
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
) {
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
}
$db->free($resql);

View File

@ -373,26 +373,8 @@ if ($resql)
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>\n";
print "</div>";

View File

@ -292,8 +292,8 @@ if ($resql)
// Amount
print '<td class="right" width="100">'.price($obj->amount).'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->amount;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield';
$totalarray['val']['totalttcfield'] += $obj->amount;
// Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
@ -307,20 +307,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalttcfield']))
{
print '<tr class="liste_total">';
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td class="right">'.price($totalarray['totalttc']).'</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print '</table>';
print '</div>';

View File

@ -599,24 +599,18 @@ while ($i < min($num, $limit))
print '<td class="right">';
print price($obj->total_ht);
print '</td>';
$totalarray['totalht'] += $obj->total_ht;
if (! $i) {
$totalarray['displaytotalline']++;
$totalarray['nbfield']++;
$totalarray['totalhtfield']=$totalarray['nbfield'];
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_ht';
$totalarray['val']['cd.total_ht'] += $obj->total_ht;
}
if (! empty($arrayfields['cd.total_tva']['checked']))
{
print '<td class="right">';
print price($obj->total_tva);
print '</td>';
$totalarray['totalvat'] += $obj->total_tva;
if (! $i) {
$totalarray['nbfield']++;
$totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['displaytotalline']++;
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cd.total_tva';
$totalarray['val']['cd.total_tva'] += $obj->total_tva;
}
if (! empty($arrayfields['cd.tva_tx']['checked']))
{
@ -734,22 +728,7 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['displaytotalline'])) {
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield']) {
$i++;
if ($i == 1) {
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -224,9 +224,10 @@ class ExtraFields
* @param string $entity Entity of extrafields (for multicompany modules)
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @return int <=0 if KO, >0 if OK
*/
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@ -243,7 +244,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled);
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@ -371,9 +372,10 @@ class ExtraFields
* @param string $entity Entity of extrafields
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
{
// phpcs:enable
global $conf,$user;
@ -424,7 +426,8 @@ class ExtraFields
$sql.= " fk_user_modif,";
$sql.= " datec,";
$sql.= " enabled,";
$sql.= " help";
$sql.= " help,";
$sql.= " totalizable";
$sql.= " )";
$sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',";
@ -446,7 +449,8 @@ class ExtraFields
$sql .= " " . (is_object($user) ? $user->id : 0). ",";
$sql .= "'" . $this->db->idate(dol_now()) . "',";
$sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1").",";
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null");
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null").",";
$sql.= " ".($totalizable?'1':'0');
$sql.=')';
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);

View File

@ -56,7 +56,7 @@ foreach($object->fields as $key => $val)
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha');
print $object->showInputField($val, $key, $value, '', '', '', 0);
print $object->showInputField($val, $key, $value, '', '', '', 0, $object->table_element);
print '</td>';
print '</tr>';
}

View File

@ -55,8 +55,8 @@ foreach($object->fields as $key => $val)
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key, 'none'):$object->$key;
else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
//var_dump($val.' '.$key.' '.$value);
if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0);
else print $object->showInputField($val, $key, $value, '', '', '', 0);
if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0, $object->table_element);
else print $object->showInputField($val, $key, $value, '', '', '', 0, $object->table_element);
print '</td>';
print '</tr>';
}

View File

@ -171,7 +171,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id);
print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id, $object->table_element);
print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">';

View File

@ -0,0 +1,29 @@
<?php
// Move fields of totalizable into the common array pos and val
if (is_array($totalarray['totalizable'])) {
foreach($totalarray['totalizable'] as $keytotalizable => $valtotalizable) {
$totalarray['pos'][$valtotalizable['pos']] = $keytotalizable;
$totalarray['val'][$keytotalizable] = $valtotalizable['total'];
}
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}

View File

@ -738,24 +738,24 @@ if ($resql)
{
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.total_ht';
$totalarray['val']['d.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['d.total_vat']['checked']))
{
print '<td class="right">'.price($obj->total_tva)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_tva;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.total_tva';
$totalarray['val']['d.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (! empty($arrayfields['d.total_ttc']['checked']))
{
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.total_ttc';
$totalarray['val']['d.total_ttc'] += $obj->total_ttc;
}
// Extra fields
@ -815,25 +815,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -602,8 +602,8 @@ if ($resql)
{
print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration']+=$obj->duree;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='fd.duree';
$totalarray['val']['fd.duree'] += $obj->duree;
}
// Action column
print '<td class="nowrap center">';
@ -623,23 +623,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalduration']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldurationfield'] == $i) print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -1063,24 +1063,24 @@ if ($resql)
{
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ht';
$totalarray['val']['cf.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['cf.total_vat']['checked']))
{
print '<td class="right">'.price($obj->total_tva)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_tva;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_vat';
$totalarray['val']['cf.total_vat'] += $obj->total_tva;
}
// Amount TTC
if (! empty($arrayfields['cf.total_ttc']['checked']))
{
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ttc';
$totalarray['val']['cf.total_ttc'] += $obj->total_ttc;
}
// Extra fields
@ -1134,28 +1134,9 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print '</tr>';
}
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -1003,56 +1003,56 @@ if ($resql)
{
print '<td class="right nowrap">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ht';
$totalarray['val']['f.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['f.total_vat']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_vat)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_vat;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_vat';
$totalarray['val']['f.total_vat'] += $obj->total_vat;
}
// Amount LocalTax1
if (! empty($arrayfields['f.total_localtax1']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_localtax1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield'];
$totalarray['totallocaltax1'] += $obj->total_localtax1;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax1';
$totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
}
// Amount LocalTax2
if (! empty($arrayfields['f.total_localtax2']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_localtax2)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield'];
$totalarray['totallocaltax2'] += $obj->total_localtax2;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax2';
$totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
}
// Amount TTC
if (! empty($arrayfields['f.total_ttc']['checked']))
{
print '<td class="right nowrap">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
}
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $totalpay;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalam';
$totalarray['val']['totalam'] += $totalpay;
}
if (! empty($arrayfields['rtp']['checked']))
{
print '<td class="right nowrap">'.(! empty($remaintopay)?price($remaintopay, 0, $langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='rtp';
$totalarray['val']['rtp'] += $remaintopay;
}
@ -1105,35 +1105,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield'])
|| isset($totalarray['totallocaltax1field'])
|| isset($totalarray['totallocaltax2field'])
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
) {
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
}
$db->free($resql);

View File

@ -1024,26 +1024,7 @@ if (empty($action) || $action == 'list')
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print "</div>";

View File

@ -540,26 +540,7 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -524,26 +524,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -425,26 +425,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -484,26 +484,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -514,25 +514,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -834,11 +834,11 @@ while ($i < min($num, $limit))
if (strcmp($obj->opp_amount, ''))
{
print price($obj->opp_amount, 1, $langs, 1, -1, -1, '');
$totalarray['totalopp'] += $obj->opp_amount;
$totalarray['val']['p.opp_amount'] += $obj->opp_amount;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield'];
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.opp_amount';
}
// Opp percent
if (! empty($arrayfields['p.opp_percent']['checked']))
@ -855,11 +855,11 @@ while ($i < min($num, $limit))
if ($obj->budget_amount != '')
{
print price($obj->budget_amount, 1, $langs, 1, -1, -1);
$totalarray['totalbudget'] += $obj->budget_amount;
$totalarray['val']['p.budget_amount'] += $obj->budget_amount;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield'];
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.budget_amount';
}
// Usage opportunity
if (! empty($arrayfields['p.usage_opportunity']['checked']))
@ -940,24 +940,7 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaloppfield'] == $i) print '<td class="right">'.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).'</td>';
elseif ($totalarray['totalbudgetfield'] == $i) print '<td class="right">'.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -733,6 +733,8 @@ while ($i < min($num, $limit))
//else print '--:--';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.planned_workload';
$totalarray['val']['t.planned_workload'] += $obj->planned_workload;
if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield'];
$totalarray['totalplannedworkload'] += $obj->planned_workload;
}
@ -749,6 +751,8 @@ while ($i < min($num, $limit))
else print '</a>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.duration_effective';
$totalarray['val']['t.duration_effective'] += $obj->duration_effective;
if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield'];
$totalarray['totaldurationeffective'] += $obj->duration_effective;
}
@ -775,8 +779,10 @@ while ($i < min($num, $limit))
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalprogress_declaredfield']=$totalarray['nbfield'];
$totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.progress';
$totalarray['val']['t.progress'] += ($obj->planned_workload * $obj->progress / 100);
if (! $i) $totalarray['totalprogress_declaredfield']=$totalarray['nbfield'];
$totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
}
// Progress summary
if (! empty($arrayfields['t.progress_summary']['checked']))
@ -787,7 +793,7 @@ while ($i < min($num, $limit))
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalprogress_summary']=$totalarray['nbfield'];
if (! $i) $totalarray['totalprogress_summary']=$totalarray['nbfield'];
}
// Time not billed
if (! empty($arrayfields['t.tobill']['checked']))
@ -796,6 +802,7 @@ while ($i < min($num, $limit))
if ($obj->usage_bill_time)
{
print convertSecondToTime($obj->tobill, 'allhourmin');
$totalarray['val']['t.tobill'] += $obj->tobill;
$totalarray['totaltobill'] += $obj->tobill;
}
else
@ -804,6 +811,7 @@ while ($i < min($num, $limit))
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.tobill';
if (! $i) $totalarray['totaltobillfield']=$totalarray['nbfield'];
}
// Time billed
@ -813,6 +821,7 @@ while ($i < min($num, $limit))
if ($obj->usage_bill_time)
{
print convertSecondToTime($obj->billed, 'allhourmin');
$totalarray['val']['t.billed'] += $obj->billed;
$totalarray['totalbilled'] += $obj->billed;
}
else
@ -821,6 +830,7 @@ while ($i < min($num, $limit))
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.billed';
if (! $i) $totalarray['totalbilledfield']=$totalarray['nbfield'];
}
// Extra fields
@ -870,8 +880,9 @@ while ($i < min($num, $limit))
$i++;
}
// Show total line
//include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield'])
|| isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']))
|| isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']))
{
print '<tr class="liste_total">';
$i=0;
@ -889,7 +900,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
elseif ($totalarray['totalprogress_declaredfield'] == $i) print '<td class="center">'.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationdeclared'] / $totalarray['totalplannedworkload'], 2).' %' : '').'</td>';
elseif ($totalarray['totaltobillfield'] == $i) print '<td class="center">'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).'</td>';
elseif ($totalarray['totalbilledfield'] == $i) print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
else print '<td></td>';
else print '<td></td>';
}
print '</tr>';
}

View File

@ -1282,6 +1282,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.task_duration';
$totalarray['val']['t.task_duration'] += $task_time->task_duration;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration'] += $task_time->task_duration;
}
@ -1294,11 +1296,13 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print price($value, 1, $langs, 1, -1, -1, $conf->currency);
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvaluefield']=$totalarray['nbfield'];
$totalarray['totalvalue'] += $value;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='value';
$totalarray['val']['value'] += $value;
if (! $i) $totalarray['totalvaluefield']=$totalarray['nbfield'];
$totalarray['totalvalue'] += $value;
}
// Invoiced - Value billed
// Invoiced
if (! empty($arrayfields['valuebilled']['checked']))
{
print '<td class="center">'; // invoice_id and invoice_line_id
@ -1687,27 +1691,27 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
}
// Show total line
//include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
if (isset($totalarray['totaldurationfield']) || isset($totalarray['totalvaluefield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldurationfield'] == $i) print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
elseif ($totalarray['totalvaluefield'] == $i) print '<td class="right">'.price($totalarray['totalvalue']).'</td>';
//elseif ($totalarray['totalvaluebilledfield'] == $i) print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>';
else print '<td></td>';
}
print '</tr>';
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldurationfield'] == $i) print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
elseif ($totalarray['totalvaluefield'] == $i) print '<td class="right">'.price($totalarray['totalvalue']).'</td>';
//elseif ($totalarray['totalvaluebilledfield'] == $i) print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
if (! count($tasks))
{
$totalnboffields = 1;

View File

@ -501,26 +501,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -749,24 +749,25 @@ if ($resql)
{
print '<td class="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ht';
$totalarray['val']['sp.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['sp.total_vat']['checked']))
{
print '<td class="right">'.price($obj->total_vat)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_vat;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_vat';
$totalarray['val']['sp.total_vat'] += $obj->total_vat;
}
// Amount TTC
if (! empty($arrayfields['sp.total_ttc']['checked']))
{
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ttc';
$totalarray['val']['sp.total_ttc'] += $obj->total_ttc;
}
$userstatic->id=$obj->fk_user_author;
@ -831,30 +832,7 @@ if ($resql)
}
// Show total line
if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield'])
|| isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield'])
)
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$db->free($resql);

View File

@ -687,26 +687,8 @@ while ($i < min($num, $limit))
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)

View File

@ -570,27 +570,8 @@ while ($i < min($num, $limit)) {
}
// Show total line
if (isset($totalarray['pos'])) {
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield']) {
$i++;
if (! empty($totalarray['pos'][$i])) {
print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
} else {
if ($i == 1) {
if ($num < $limit) {
print '<td class="left">'.$langs->trans("Total").'</td>';
} else {
print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
} else {
print '<td></td>';
}
}
}
print '</tr>';
}
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {