Fix text in payment area of crabe pdf

This commit is contained in:
Laurent Destailleur 2018-07-02 11:33:33 +02:00
parent 932ff0be18
commit 11021353da
4 changed files with 9 additions and 6 deletions

View File

@ -4376,7 +4376,7 @@ else if ($id > 0 || ! empty($ref))
if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
} else {
//if ($resteapayer == 0) {
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
//} else {
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&amp;action=create&amp;accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';

View File

@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
}
/**
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
* Return amount (with tax) of all credit notes invoices + excess received used by invoice
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise

View File

@ -780,7 +780,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('','', $default_font_size - 4);
// Loop on each deposits and credit notes included
// Loop on each discount available (deposits and credit notes and excess of payment included)
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
$sql.= " re.description, re.fk_facture_source,";
$sql.= " f.type, f.datef";
@ -799,6 +799,7 @@ class pdf_crabe extends ModelePDFFactures
if ($obj->type == 2) $text=$outputlangs->trans("CreditNote");
elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit");
elseif ($obj->type == 0) $text=$outputlangs->trans("ExcessReceived");
else $text=$outputlangs->trans("UnknownType");
$invoice->fetch($obj->fk_facture_source);
@ -1289,7 +1290,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
@ -1307,9 +1308,10 @@ class pdf_crabe extends ModelePDFFactures
// Credit note
if ($creditnoteamount)
{
$labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
}
@ -1688,7 +1690,7 @@ class pdf_crabe extends ModelePDFFactures
{
$top_shift = $pdf->getY() - $current_y;
}
if ($showaddress)
{
// Sender properties

View File

@ -279,6 +279,7 @@ RelativeDiscount=Relative discount
GlobalDiscount=Global discount
CreditNote=Credit note
CreditNotes=Credit notes
CreditNotesOrExcessReceived=Credit notes or excess received
Deposit=Down payment
Deposits=Down payments
DiscountFromCreditNote=Discount from credit note %s