Skip to content

Commit

Permalink
Fix text in payment area of crabe pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 2, 2018
1 parent 932ff0b commit 1102135
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion htdocs/compta/facture/card.php
Expand Up @@ -4376,7 +4376,7 @@ function js_recalculate_revenuestamp(){
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>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commoninvoice.class.php
Expand Up @@ -173,7 +173,7 @@ function getSumDepositsUsed($multicurrency=0)
}

/**
* 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
Expand Down
10 changes: 6 additions & 4 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -780,7 +780,7 @@ function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
$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";
Expand All @@ -799,6 +799,7 @@ function _tableau_versements(&$pdf, $object, $posy, $outputlangs)

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);
Expand Down Expand Up @@ -1289,7 +1290,7 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)

$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');
Expand All @@ -1307,9 +1308,10 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
// 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);
}
Expand Down Expand Up @@ -1688,7 +1690,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
$top_shift = $pdf->getY() - $current_y;
}

if ($showaddress)
{
// Sender properties
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/bills.lang
Expand Up @@ -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
Expand Down

0 comments on commit 1102135

Please sign in to comment.