mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -2933,17 +2933,17 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Type') . '</td><td>';
|
||||
print $object->getLibType();
|
||||
@@ -3303,7 +3303,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
@@ -3328,15 +3328,15 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// 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>';
|
||||
|
||||
|
||||
// Vat
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" class="nowrap">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Amount Local Taxes
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
@@ -3348,7 +3348,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Revenue stamp
|
||||
if ($selleruserevenustamp) // Test company use revenue stamp
|
||||
{
|
||||
@@ -3375,14 +3375,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Total with tax
|
||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td class="nowrap">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// List of payments
|
||||
|
||||
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||
$nbrows = 8;
|
||||
@@ -3491,9 +3491,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder paymenttable" width="100%">';
|
||||
|
||||
|
||||
// List of payments already done
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
|
||||
@@ -3505,9 +3505,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td class="liste_titre" align="right">' . $langs->trans('Amount') . '</td>';
|
||||
print '<td class="liste_titre" width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
// Payments already done (from payment on this invoice)
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||
@@ -3518,12 +3518,12 @@ else if ($id > 0 || ! empty($ref))
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
$sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
||||
$sql .= ' ORDER BY p.datep, p.tms';
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
// if ($object->type != 2)
|
||||
// {
|
||||
if ($num > 0) {
|
||||
@@ -3563,7 +3563,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
||||
// Total already paid
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
@@ -3572,10 +3572,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
else
|
||||
print $langs->trans('AlreadyPaid');
|
||||
print ' :</td><td align="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td> </td></tr>';
|
||||
|
||||
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
|
||||
// Loop on each credit note or deposit amount applied
|
||||
$creditnoteamount = 0;
|
||||
$depositamount = 0;
|
||||
@@ -3611,7 +3611,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Paye partiellement 'escompte'
|
||||
if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'discount_vat') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
@@ -3647,7 +3647,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = '';
|
||||
}
|
||||
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("Billed") . ' :</td><td align="right">' . price($object->total_ttc) . '</td><td> </td></tr>';
|
||||
|
||||
@@ -3667,10 +3667,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
print $langs->trans('AlreadyPaidBack');
|
||||
print ' :</td><td align="right">' . price($sign * $totalpaye) . '</td><td> </td></tr>';
|
||||
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("Billed") . ' :</td><td align="right">' . price($sign * $object->total_ttc) . '</td><td> </td></tr>';
|
||||
|
||||
|
||||
// Remainder to pay back
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
if ($resteapayeraffiche <= 0)
|
||||
@@ -3680,27 +3680,26 @@ else if ($id > 0 || ! empty($ref))
|
||||
print ' :</td>';
|
||||
print '<td align="right" bgcolor="#f0f0f0"><b>' . price($sign * $resteapayeraffiche) . '</b></td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
|
||||
|
||||
// Sold credit note
|
||||
// print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('TotalTTC').' :</td>';
|
||||
// print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($sign *
|
||||
// $object->total_ttc).'</b></td><td> </td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
@@ -3811,8 +3810,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
||||
if ($object->statut == 1)
|
||||
|
||||
@@ -790,7 +790,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
// Show Draft Watermark
|
||||
if($object->statut==0 && (! empty($conf->global->SHIPPING_DRAFT_WATERMARK)) )
|
||||
{
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK);
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
//Prepare la suite
|
||||
@@ -861,11 +861,11 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$title=$outputlangs->transnoentities("SendingSheet");
|
||||
$pdf->MultiCell($w, 4, $title, '', 'R');
|
||||
$posy+=1;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size + 1);
|
||||
|
||||
$posy+=4;
|
||||
$posy+=5;
|
||||
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R');
|
||||
@@ -873,10 +873,10 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
// Date planned delivery
|
||||
if (! empty($object->date_delivery))
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
|
||||
}
|
||||
|
||||
if (! empty($object->thirdparty->code_client))
|
||||
@@ -889,11 +889,10 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
|
||||
|
||||
$pdf->SetFont('','', $default_font_size + 3);
|
||||
$Yoff=25;
|
||||
$Yoff=25;
|
||||
|
||||
// Add list of linked orders
|
||||
|
||||
$origin = $object->origin;
|
||||
// Add list of linked orders
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
||||
// TODO move to external function
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -486,10 +486,10 @@ if (empty($reshook))
|
||||
{
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
|
||||
$fk_parent_line = 0;
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
$line->fk_facture = $object->id;
|
||||
$line->fk_facture_fourn = $object->id;
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
$line->subprice =-$line->subprice; // invert price for object
|
||||
@@ -2249,9 +2249,9 @@ else
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'<div class="inline-block"> ';
|
||||
@@ -2265,7 +2265,7 @@ else
|
||||
$s.='<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
|
||||
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc",$calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('','help'));
|
||||
print '</div></td></tr>';
|
||||
|
||||
|
||||
// Amount Local Taxes
|
||||
//TODO: Place into a function to control showing by country or study better option
|
||||
if ($societe->localtax1_assuj=="1") //Localtax1
|
||||
@@ -2281,7 +2281,7 @@ else
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
@@ -2298,22 +2298,26 @@ else
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
* 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->banque->enabled)) { $nbrows++; $nbcols++; }
|
||||
if (! empty($conf->incoterm->enabled)) $nbrows++;
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) $nbrows += 5;
|
||||
|
||||
// Local taxes
|
||||
if ($societe->localtax1_assuj=="1") $nbrows++;
|
||||
if ($societe->localtax2_assuj=="1") $nbrows++;
|
||||
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql.= ' c.id as paiement_type,';
|
||||
$sql.= ' pf.amount,';
|
||||
@@ -2325,7 +2329,7 @@ else
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid';
|
||||
$sql.= ' WHERE pf.fk_facturefourn = '.$object->id;
|
||||
$sql.= ' ORDER BY p.datep, p.tms';
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@@ -2333,14 +2337,14 @@ else
|
||||
$i = 0; $totalpaye = 0;
|
||||
print '<table class="noborder paymenttable" width="100%">';
|
||||
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('Type').'</td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right">'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Amount').'</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var=false;
|
||||
if ($num > 0)
|
||||
{
|
||||
@@ -2369,7 +2373,7 @@ else
|
||||
if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions');
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
print '<td align="right">' . price($sign * $objp->amount) . '</td>';
|
||||
print '<td align="center">';
|
||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
@@ -2387,7 +2391,8 @@ else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if ($object->paye == 0)
|
||||
{
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('AlreadyPaid').' :</td><td align="right">'.price($totalpaye).'</td><td></td></tr>';
|
||||
@@ -2398,14 +2403,139 @@ else
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('RemainderToPay').' :</td>';
|
||||
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':'').'>'.price($resteapayer).'</td><td></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
*/
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) {
|
||||
// Total already paid
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
if ($object->type != FactureFournisseur::TYPE_DEPOSIT)
|
||||
print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
|
||||
else
|
||||
print $langs->trans('AlreadyPaid');
|
||||
print ' :</td><td align="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td> </td></tr>';
|
||||
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
// Loop on each credit note or deposit amount applied
|
||||
$creditnoteamount = 0;
|
||||
$depositamount = 0;
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||
$sql .= " WHERE fk_facture = " . $object->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$invoice = new FactureFournisseur($db);
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
print $langs->trans("CreditNote") . ' ';
|
||||
if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
|
||||
print $langs->trans("Deposit") . ' ';
|
||||
print $invoice->getNomUrl(0);
|
||||
print ' :</td>';
|
||||
print '<td align="right">' . price($obj->amount_ttc) . '</td>';
|
||||
print '<td align="right">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '</a>';
|
||||
print '</td></tr>';
|
||||
$i ++;
|
||||
if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
$creditnoteamount += $obj->amount_ttc;
|
||||
if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
|
||||
$depositamount += $obj->amount_ttc;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Paye partiellement 'escompte'
|
||||
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1);
|
||||
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = '';
|
||||
}
|
||||
// Paye partiellement ou Abandon 'badsupplier'
|
||||
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1);
|
||||
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td> </td></tr>';
|
||||
// $resteapayeraffiche=0;
|
||||
$cssforamountpaymentcomplete = '';
|
||||
}
|
||||
// Paye partiellement ou Abandon 'product_returned'
|
||||
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1);
|
||||
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = '';
|
||||
}
|
||||
// Paye partiellement ou Abandon 'abandon'
|
||||
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') {
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
|
||||
$text = $langs->trans("HelpAbandonOther");
|
||||
if ($object->close_note)
|
||||
$text .= '<br><br><b>' . $langs->trans("Reason") . '</b>:' . $object->close_note;
|
||||
print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1);
|
||||
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = '';
|
||||
}
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("Billed") . ' :</td><td align="right">' . price($object->total_ttc) . '</td><td> </td></tr>';
|
||||
|
||||
// Remainder to pay
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
if ($resteapayeraffiche >= 0)
|
||||
print $langs->trans('RemainderToPay');
|
||||
else
|
||||
print $langs->trans('ExcessReceived');
|
||||
print ' :</td>';
|
||||
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':$cssforamountpaymentcomplete).'>' . price($resteapayeraffiche) . '</td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
}
|
||||
else // Credit note
|
||||
{
|
||||
// Total already paid back
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
print $langs->trans('AlreadyPaidBack');
|
||||
print ' :</td><td align="right">' . price($sign * $totalpaye) . '</td><td> </td></tr>';
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("Billed") . ' :</td><td align="right">' . price($sign * $object->total_ttc) . '</td><td> </td></tr>';
|
||||
|
||||
// Remainder to pay back
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
if ($resteapayeraffiche <= 0)
|
||||
print $langs->trans('RemainderToPayBack');
|
||||
else
|
||||
print $langs->trans('ExcessPaydBack');
|
||||
print ' :</td>';
|
||||
print '<td align="right" bgcolor="#f0f0f0"><b>' . price($sign * $resteapayeraffiche) . '</b></td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
|
||||
// Sold credit note
|
||||
// print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('TotalTTC').' :</td>';
|
||||
// print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($sign *
|
||||
// $object->total_ttc).'</b></td><td> </td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@@ -2432,16 +2562,12 @@ else
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
//$result = $object->getLinesArray();
|
||||
|
||||
|
||||
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'].'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="'.$object->id.'">
|
||||
<input type="hidden" name="socid" value="'.$societe->id.'">
|
||||
';
|
||||
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">';
|
||||
print '<input type="hidden" name="mode" value="">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) {
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
@@ -2449,7 +2575,7 @@ else
|
||||
|
||||
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;
|
||||
|
||||
// Show object lines
|
||||
@@ -2524,7 +2650,6 @@ else
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Make payments
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user