2010-04-09 08:20:10 +02:00
|
|
|
<?php
|
2018-10-27 14:43:12 +02:00
|
|
|
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
|
2013-01-24 12:53:42 +01:00
|
|
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
2014-09-14 13:09:31 +02:00
|
|
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
2010-04-09 08:20:10 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-04-09 08:20:10 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-04-09 08:20:10 +02:00
|
|
|
*/
|
2017-12-21 13:32:16 +01:00
|
|
|
|
|
|
|
|
// Protection to avoid direct call of template
|
2021-02-23 21:09:01 +01:00
|
|
|
if (empty($conf) || !is_object($conf)) {
|
2017-12-21 13:32:16 +01:00
|
|
|
print "Error, template page can't be called as URL";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-01 17:39:38 +01:00
|
|
|
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblock.tpl.php -->\n";
|
2010-12-24 12:28:46 +01:00
|
|
|
|
2014-09-14 13:09:31 +02:00
|
|
|
global $user;
|
2016-11-08 19:19:30 +01:00
|
|
|
global $noMoreLinkedObjectBlockAfter;
|
2014-09-14 13:09:31 +02:00
|
|
|
|
2010-12-24 12:28:46 +01:00
|
|
|
$langs = $GLOBALS['langs'];
|
2011-08-23 00:04:21 +02:00
|
|
|
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
2016-11-08 19:19:30 +01:00
|
|
|
|
2010-05-26 00:22:24 +02:00
|
|
|
$langs->load("bills");
|
2016-03-30 19:18:31 +02:00
|
|
|
|
2019-07-19 18:10:45 +02:00
|
|
|
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
2019-06-17 15:54:54 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$total = 0;
|
|
|
|
|
$ilink = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
foreach ($linkedObjectBlock as $key => $objectlink) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$ilink++;
|
2017-12-21 13:32:16 +01:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$trclass = 'oddeven';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
|
|
|
|
$trclass .= ' liste_sub_total';
|
|
|
|
|
}
|
2019-10-26 18:13:20 +02:00
|
|
|
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
|
2022-03-12 16:04:00 +01:00
|
|
|
print '<td class="linkedcol-element tdoverflowmax100">';
|
2019-10-26 18:13:20 +02:00
|
|
|
switch ($objectlink->type) {
|
|
|
|
|
case Facture::TYPE_REPLACEMENT:
|
|
|
|
|
echo $langs->trans("InvoiceReplacement");
|
|
|
|
|
break;
|
|
|
|
|
case Facture::TYPE_CREDIT_NOTE:
|
|
|
|
|
echo $langs->trans("InvoiceAvoir");
|
|
|
|
|
break;
|
|
|
|
|
case Facture::TYPE_DEPOSIT:
|
|
|
|
|
echo $langs->trans("InvoiceDeposit");
|
|
|
|
|
break;
|
|
|
|
|
case Facture::TYPE_PROFORMA:
|
|
|
|
|
echo $langs->trans("InvoiceProForma");
|
|
|
|
|
break;
|
|
|
|
|
case Facture::TYPE_SITUATION:
|
|
|
|
|
echo $langs->trans("InvoiceSituation");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
echo $langs->trans("CustomerInvoice");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2022-12-30 03:10:37 +01:00
|
|
|
print '<td class="linkedcol-name tdoverflowmax150">'.$objectlink->getNomUrl(1).'</td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<td class="linkedcol-ref left">'.$objectlink->ref_client.'</td>';
|
|
|
|
|
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
|
|
|
|
print '<td class="linkedcol-amount right">';
|
2022-09-20 11:15:15 +02:00
|
|
|
if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) {
|
2020-10-31 14:32:18 +01:00
|
|
|
if ($objectlink->statut != 3) {
|
2019-10-26 18:13:20 +02:00
|
|
|
// If not abandonned
|
2022-11-23 11:24:29 +01:00
|
|
|
$total += $objectlink->total_ht;
|
2020-10-31 14:32:18 +01:00
|
|
|
echo price($objectlink->total_ht);
|
|
|
|
|
} else {
|
|
|
|
|
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
|
|
|
|
}
|
2019-10-26 18:13:20 +02:00
|
|
|
}
|
2021-06-23 11:30:44 +02:00
|
|
|
|
2021-06-23 11:41:30 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="linkedcol-statut right">';
|
|
|
|
|
if (method_exists($objectlink, 'getSommePaiement')) {
|
2021-06-23 10:47:23 +02:00
|
|
|
print $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
|
2021-06-23 11:30:44 +02:00
|
|
|
} else {
|
2021-06-23 10:47:23 +02:00
|
|
|
print $objectlink->getLibStatut(3);
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td>';
|
2021-09-19 14:41:46 +02:00
|
|
|
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print "</tr>\n";
|
2010-05-26 00:22:24 +02:00
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if (count($linkedObjectBlock) > 1) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
|
|
|
|
|
print '<td>'.$langs->trans("Total").'</td>';
|
|
|
|
|
print '<td></td>';
|
|
|
|
|
print '<td class="center"></td>';
|
|
|
|
|
print '<td class="center"></td>';
|
|
|
|
|
print '<td class="right">'.price($total).'</td>';
|
|
|
|
|
print '<td class="right"></td>';
|
|
|
|
|
print '<td class="right"></td>';
|
|
|
|
|
print '</tr>';
|
2016-11-08 19:19:30 +01:00
|
|
|
}
|
2010-04-09 08:20:10 +02:00
|
|
|
|
2019-10-26 18:13:20 +02:00
|
|
|
print "<!-- END PHP TEMPLATE -->\n";
|