Update Invoice Preview to be like order and propal preview
This commit is contained in:
parent
60e5369db2
commit
bc58641828
@ -3,7 +3,8 @@
|
|||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/facture/apercu.php
|
* \file htdocs/compta/facture/apercu.php
|
||||||
* \ingroup facture
|
* \ingroup facture
|
||||||
* \brief Page de l'onglet apercu d'une facture
|
* \brief Preview Tab of invoice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -67,12 +68,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($object->socid);
|
$soc->fetch($object->socid);
|
||||||
|
|
||||||
$author = new User($db);
|
|
||||||
if ($object->user_author)
|
|
||||||
{
|
|
||||||
$author->fetch($object->user_author);
|
|
||||||
}
|
|
||||||
|
|
||||||
$head = facture_prepare_head($object);
|
$head = facture_prepare_head($object);
|
||||||
dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
||||||
|
|
||||||
@ -80,32 +75,28 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$totalpaye = $object->getSommePaiement();
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Facture
|
* Invoice
|
||||||
*/
|
*/
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
$rowspan=3;
|
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
|
||||||
|
print '<td colspan="5">'.$object->ref.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Ref customer
|
// Ref customer
|
||||||
print '<tr><td width="20%">';
|
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<td colspan="5">'.$object->ref_client.'</td>';
|
||||||
print $langs->trans('RefCustomer');
|
print '</tr>';
|
||||||
print '</td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td colspan="5">';
|
|
||||||
print $object->ref_client;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Societe
|
// Thirdparty
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||||
print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>';
|
print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Type').'</td>';
|
||||||
|
print '<td colspan="5">';
|
||||||
print $object->getLibType();
|
print $object->getLibType();
|
||||||
if ($object->type == Facture::TYPE_REPLACEMENT)
|
if ($object->type == Facture::TYPE_REPLACEMENT)
|
||||||
{
|
{
|
||||||
@ -141,14 +132,15 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$facthatreplace->fetch($objectidnext);
|
$facthatreplace->fetch($objectidnext);
|
||||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Relative and absolute discounts
|
// Relative and absolute discounts
|
||||||
$addabsolutediscount=' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddGlobalDiscount").'</a>';
|
$addabsolutediscount=' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddGlobalDiscount").'</a>';
|
||||||
$addcreditnote=' <a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
|
$addcreditnote=' <a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Discounts');
|
print '<tr><td>'.$langs->trans('Discounts').'</td>';
|
||||||
print '</td><td colspan="5">';
|
print '<td colspan="5">';
|
||||||
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
|
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
|
||||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
|
|
||||||
@ -187,7 +179,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($absolute_creditnote > 0) // If not linke will be added later
|
if ($absolute_creditnote > 0) // If not linked will be added later
|
||||||
{
|
{
|
||||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
|
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'<br>';
|
||||||
else print '.';
|
else print '.';
|
||||||
@ -230,41 +222,17 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print $addabsolutediscount;
|
print $addabsolutediscount;
|
||||||
//print ' - '.$addcreditnote; // We disbale link to credit note
|
//print ' - '.$addcreditnote; // We disbale link to credit note
|
||||||
}*/
|
}*/
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Dates
|
// Dates
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td colspan="5">'.dol_print_date($object->date,"daytext").'</td>';
|
print '<td>'.dol_print_date($object->date,"daytext").'</td>';
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
// Date payment term
|
// Right part with $rowspan lines
|
||||||
print '<tr><td>'.$langs->trans('DateMaxPayment').'</td>';
|
$rowspan=5;
|
||||||
print '<td colspan="5">';
|
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
|
||||||
{
|
|
||||||
print dol_print_date($object->date_lim_reglement,'daytext');
|
|
||||||
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Conditions reglement
|
|
||||||
print '<tr><td>'.$langs->trans("PaymentConditionsShort").'</td><td colspan="5">';
|
|
||||||
$form->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->cond_reglement_id,"none");
|
|
||||||
print '</td>';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Mode de reglement
|
|
||||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="3">';
|
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none');
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
$nbrows=5;
|
|
||||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
|
||||||
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents
|
* Documents
|
||||||
@ -278,7 +246,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
|
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
|
||||||
|
|
||||||
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
|
||||||
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
||||||
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
|
||||||
$relativepathimage = $relativepath.'_preview.png';
|
$relativepathimage = $relativepath.'_preview.png';
|
||||||
|
|
||||||
@ -330,25 +298,30 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Total HT
|
// Total HT
|
||||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td></tr>';
|
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Total VAT
|
// Total VAT
|
||||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
||||||
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td></tr>';
|
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Total TTC
|
// Total TTC
|
||||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
||||||
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td></tr>';
|
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans('Status').'</td><td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||||
|
print '<td align="left">'.($object->getLibStatut(4,$totalpaye)).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Projet
|
// Projet
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
print '<tr>';
|
print '<tr><td>'.$langs->trans("Project").'</td>';
|
||||||
print '<td>'.$langs->trans("Project").'</td><td colspan="3">';
|
print '<td>';
|
||||||
if ($object->fk_project > 0)
|
if ($object->fk_project > 0)
|
||||||
{
|
{
|
||||||
$project = New Project($db);
|
$project = New Project($db);
|
||||||
@ -369,14 +342,17 @@ if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Facture non trouvee
|
// Facture non trouvee
|
||||||
print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
|
print $langs->trans("ErrorBillNotFound",$id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<div class="photolist">';
|
||||||
// Si fichier png PDF d'1 page trouve
|
// Si fichier png PDF d'1 page trouve
|
||||||
if (file_exists($fileimage))
|
if (file_exists($fileimage))
|
||||||
{
|
{
|
||||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||||
}
|
}
|
||||||
// Si fichier png PDF de plus d'1 page trouve
|
// Si fichier png PDF de plus d'1 page trouve
|
||||||
elseif (file_exists($fileimagebis))
|
elseif (file_exists($fileimagebis))
|
||||||
@ -389,11 +365,13 @@ elseif (file_exists($fileimagebis))
|
|||||||
|
|
||||||
if (file_exists($dir_output.$preview))
|
if (file_exists($dir_output.$preview))
|
||||||
{
|
{
|
||||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print '</div>';
|
||||||
|
print '</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user