Work on supplier credit note

This commit is contained in:
aspangaro 2016-10-29 07:45:24 +02:00
parent 38e6c9cc57
commit efd24e5922
2 changed files with 60 additions and 60 deletions

View File

@ -3330,7 +3330,7 @@ else if ($id > 0 || ! empty($ref))
} }
// Amount // Amount
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td class="titlefield">' . $langs->trans('AmountHT') . '</td>';
print '<td class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; print '<td class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Vat // Vat
@ -3694,7 +3694,6 @@ else if ($id > 0 || ! empty($ref))
$formmargin->displayMarginInfos($object); $formmargin->displayMarginInfos($object);
} }
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
@ -3811,8 +3810,7 @@ else if ($id > 0 || ! empty($ref))
print '<div class="tabsAction">'; print '<div class="tabsAction">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// modified by hook
if (empty($reshook)) { if (empty($reshook)) {
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta // Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == 1) if ($object->statut == 1)

View File

@ -8,7 +8,7 @@
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -2305,10 +2305,14 @@ else
/* /*
* List of payments * List of payments
*/ */
$nbrows=9; $nbcols=3; $sign = 1;
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = - 1;
$nbrows=9; $nbcols=3;
if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; } if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
if (! empty($conf->incoterm->enabled)) $nbrows++; if (! empty($conf->incoterm->enabled)) $nbrows++;
if (! empty($conf->multicurrency->enabled)) $nbrows += 5;
// Local taxes // Local taxes
if ($societe->localtax1_assuj=="1") $nbrows++; if ($societe->localtax1_assuj=="1") $nbrows++;
@ -2333,7 +2337,7 @@ else
$i = 0; $totalpaye = 0; $i = 0; $totalpaye = 0;
print '<table class="noborder paymenttable" width="100%">'; print '<table class="noborder paymenttable" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Payments').'</td>'; print '<td class="liste_titre">' . ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
print '<td>'.$langs->trans('Date').'</td>'; print '<td>'.$langs->trans('Date').'</td>';
print '<td>'.$langs->trans('Type').'</td>'; print '<td>'.$langs->trans('Type').'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right">'.$langs->trans('BankAccount').'</td>'; if (! empty($conf->banque->enabled)) print '<td align="right">'.$langs->trans('BankAccount').'</td>';
@ -2369,7 +2373,7 @@ else
if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions'); if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions');
print '</td>'; print '</td>';
} }
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">' . price($sign * $objp->amount) . '</td>';
print '<td align="center">'; print '<td align="center">';
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
{ {
@ -2406,7 +2410,6 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
@ -2435,13 +2438,12 @@ else
//$result = $object->getLinesArray(); //$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST"> print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">';
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'"> print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> print '<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">';
<input type="hidden" name="mode" value=""> print '<input type="hidden" name="mode" value="">';
<input type="hidden" name="id" value="'.$object->id.'"> print '<input type="hidden" name="id" value="'.$object->id.'">';
<input type="hidden" name="socid" value="'.$societe->id.'"> print '<input type="hidden" name="socid" value="'.$societe->id.'">';
';
if (! empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) { if (! empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
@ -2449,7 +2451,7 @@ else
print '<table id="tablelines" class="noborder noshadow" width="100%">'; print '<table id="tablelines" class="noborder noshadow" width="100%">';
global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax;
$forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1; $forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1;
// Show object lines // Show object lines