New: Add option INVOICE_POSITIVE_CREDIT_NOTE
This commit is contained in:
parent
79b9ceda30
commit
9ec3500b1f
@ -25,6 +25,7 @@ For users:
|
||||
- New: Cheques into cheques receipts are ordered by operation date.
|
||||
- New: Add hidden option MAIN_DISABLE_PDF_AUTOUPDATE to avoid generating pdf each time data change.
|
||||
- New: Add hidden option PROJECT_HIDE_UNSELECTABLES to hide project you can't select into combo list.
|
||||
- New: Add option INVOICE_POSITIVE_CREDIT_NOTE.
|
||||
- Fix: Can use POS module with several concurrent users.
|
||||
|
||||
For developers:
|
||||
|
||||
@ -941,7 +941,12 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0,$hookmanager=
|
||||
*/
|
||||
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
|
||||
{
|
||||
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
global $conf;
|
||||
|
||||
$sign=1;
|
||||
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
@ -950,7 +955,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($object->lines[$i]->subprice);
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,6 +1112,11 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0,$hookma
|
||||
*/
|
||||
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sign=1;
|
||||
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
@ -1122,7 +1132,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($object->lines[$i]->total_ht);
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -710,7 +710,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
global $conf,$mysoc;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
$sign=1;
|
||||
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
@ -727,7 +730,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + 0);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + $object->remise)), 0, 'R', 1);
|
||||
|
||||
// Show VAT by rates and total
|
||||
$pdf->SetFillColor(248,248,248);
|
||||
@ -753,7 +756,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$totalvat.=vatrate($tvakey,1).$tvacompl;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -763,7 +766,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
|
||||
|
||||
// Total LocalTax1
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
|
||||
@ -772,7 +775,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1);
|
||||
}
|
||||
|
||||
// Total LocalTax2
|
||||
@ -782,7 +785,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -810,7 +813,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -838,7 +841,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -856,7 +859,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
|
||||
}
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
|
||||
@ -578,18 +578,22 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche le total a payer
|
||||
* \param pdf Objet PDF
|
||||
* \param object Objet facture
|
||||
* \param deja_regle Montant deja regle
|
||||
* \param posy Position depart
|
||||
* \param outputlangs Objet langs
|
||||
* \return y Position pour suite
|
||||
* Affiche le total a payer
|
||||
*
|
||||
* @param pdf Objet PDF
|
||||
* @param object Objet facture
|
||||
* @param deja_regle Montant deja regle
|
||||
* @param posy Position depart
|
||||
* @param outputlangs Objet langs
|
||||
* @return y Position pour suite
|
||||
*/
|
||||
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$sign=1;
|
||||
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
@ -612,7 +616,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + 0);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 0);
|
||||
$pdf->SetXY($col2x, $tab2_top + 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + $object->remise)), 0, 'R', 0);
|
||||
|
||||
// Show VAT by rates and total
|
||||
$pdf->SetFillColor(248,248,248);
|
||||
@ -638,7 +642,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$totalvat.=vatrate($tvakey,1).$tvacompl;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,7 +652,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,7 +665,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetFont('','B', $default_font_size + 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'L', 0);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), 0, 'R', 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), 0, 'R', 0);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user