Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 8.0

This commit is contained in:
Laurent Destailleur 2019-02-08 10:22:55 +01:00
commit 1c129a78ae
4 changed files with 77 additions and 29 deletions

View File

@ -706,7 +706,7 @@ class pdf_crabe extends ModelePDFFactures
// Affiche zone versements
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs, $heightforfooter);
}
// Pied de page
@ -751,15 +751,17 @@ class pdf_crabe extends ModelePDFFactures
* @param Object $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @param int $heightforfooter height for footer
* @return int <0 if KO, >0 if OK
*/
function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter)
{
global $conf;
$sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$current_page = $pdf->getPage();
$tab3_posx = 120;
$tab3_top = $posy + 8;
$tab3_width = 80;
@ -771,26 +773,7 @@ class pdf_crabe extends ModelePDFFactures
$default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($tab3_posx, $tab3_top - 4);
$pdf->MultiCell(60, 3, $title, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
$pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height);
$y=0;
@ -812,6 +795,17 @@ class pdf_crabe extends ModelePDFFactures
while ($i < $num)
{
$y+=3;
if ($tab3_top+$y >= $this->page_hauteur-$heightforfooter)
{
$y=0;
$current_page++;
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($current_page);
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height);
}
$obj = $this->db->fetch_object($resql);
if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote");
@ -858,6 +852,17 @@ class pdf_crabe extends ModelePDFFactures
$i=0;
while ($i < $num) {
$y+=3;
if ($tab3_top+$y >= $this->page_hauteur-$heightforfooter)
{
$y=0;
$current_page++;
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($current_page);
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height);
}
$row = $this->db->fetch_object($resql);
$pdf->SetXY($tab3_posx, $tab3_top+$y);
@ -884,6 +889,39 @@ class pdf_crabe extends ModelePDFFactures
}
/**
* @param PDF $pdf Object PDF
* @param Facture $object Object invoice
* @param Translate $outputlangs Object langs for output
* @param int $default_font_size Font size
* @param int $tab3_posx pos x
* @param int $tab3_top pos y
* @param int $tab3_width width
* @param int $tab3_height height
*/
function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
{
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($tab3_posx, $tab3_top - 4);
$pdf->MultiCell(60, 3, $title, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
$pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
}
/**
* Show miscellaneous information (payment mode, payment term, ...)

View File

@ -602,7 +602,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">'.price($objp->total_ttc).'</td>';
print '<td align="right">'.price($objp->am).'</td>';
print '<td align="right">'.price($objp->am);
if ($creditnotes) print '+'.price($creditnotes);
if ($deposits) print '+'.price($deposits);
print '</td>';
print '<td align="right">'.price($remaintopay).'</td>';
@ -657,6 +660,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$total+=$objp->total_ht;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$totalrecucreditnote+=$creditnotes;
$totalrecudeposits+=$deposits;
$i++;
}
if ($i > 1)
@ -669,8 +674,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->multicurrency->enabled)) print '<td>&nbsp;</td>';
if (!empty($conf->multicurrency->enabled)) print '<td>&nbsp;</td>';
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
print '<td align="right"><b>'.price($totalrecu).'</b></td>';
print '<td align="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
print '<td align="right"><b>'.price($totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print '</b></td>';
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="center" id="result" style="font-weight: bold;"></td>'; // Autofilled
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
print "</tr>\n";

View File

@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, d.rowid, d.total_ht as total_ht,";
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, d.rowid, d.total_ht as line_total_ht,";
$sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.libelle, f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut as statut, d.qty";
if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", sc.fk_soc, sc.fk_user ";
@ -205,7 +205,7 @@ if ($id > 0 || ! empty($ref))
print_liste_field_titre("SupplierCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder);
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref))
{
$objp = $db->fetch_object($result);
$total_ht+=$objp->total_ht;
$total_ht+=$objp->line_total_ht;
$total_qty+=$objp->qty;
$supplierinvoicestatic->id = $objp->facid;
@ -237,7 +237,7 @@ if ($id > 0 || ! empty($ref))
print '<td align="center">';
print dol_print_date($db->jdate($objp->datef), 'dayhour') . "</td>";
print '<td align="center">' . $objp->qty . "</td>\n";
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
print '<td align="right">' . price($objp->line_total_ht) . "</td>\n";
print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>';
print "</tr>\n";
$i++;

View File

@ -634,6 +634,8 @@ if (empty($reshook))
$ref_supplier = $productsupplier->ref_supplier;
$fk_unit = $productsupplier->fk_unit;
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha'));
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha'));
if (empty($tva_tx)) $tva_npr=0;