diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index a3aa71224a3..8f03e33bb03 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Frederic France * * 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 @@ -21,9 +22,9 @@ */ /** - * \file htdocs/compta/facture/apercu.php - * \ingroup facture - * \brief Page de l'onglet apercu d'une facture + * \file htdocs/compta/facture/apercu.php + * \ingroup facture + * \brief Preview Tab of invoice */ require '../../main.inc.php'; @@ -67,12 +68,6 @@ if ($id > 0 || ! empty($ref)) $soc = new Societe($db); $soc->fetch($object->socid); - $author = new User($db); - if ($object->user_author) - { - $author->fetch($object->user_author); - } - $head = facture_prepare_head($object); dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill'); @@ -80,32 +75,28 @@ if ($id > 0 || ! empty($ref)) $totalpaye = $object->getSommePaiement(); /* - * Facture + * Invoice */ print ''; - $rowspan=3; // Ref - print ''; + print ''; + print ''; + print ''; // Ref customer - print ''; - print ''; + print ''; + print ''; + print ''; - // Societe + // Thirdparty print ''; print ''; print ''; // Type - print ''; + print ''; + print ''; + print ''; // Relative and absolute discounts $addabsolutediscount=' '.$langs->trans("AddGlobalDiscount").''; $addcreditnote=' '.$langs->trans("AddCreditNote").''; - print ''; + print ''; + print ''; + print ''; // Dates print ''; - print ''; - print ""; + print ''; - // Date payment term - print ''; - print ''; - - // Conditions reglement - print ''; - print ''; - - // Mode de reglement - print ''; - - $nbrows=5; - if (! empty($conf->projet->enabled)) $nbrows++; - print ''; - print ''; + print ''; + print ''; // Total VAT print ''; - print ''; + print ''; + print ''; // Total TTC print ''; - print ''; + print ''; + print ''; // Statut - print ''; + print ''; + print ''; + print ''; // Projet if (! empty($conf->projet->enabled)) { $langs->load("projects"); - print ''; - print ''; + print '
'.$langs->trans('Ref').''.$object->ref.'
'.$langs->trans('Ref').''.$object->ref.'
'; - print ''; - print '
'; - print $langs->trans('RefCustomer'); - print '
'; - print '
'; - print $object->ref_client; - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Company").''.$soc->getNomUrl(1,'compta').'
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { @@ -141,14 +132,15 @@ if ($id > 0 || ! empty($ref)) $facthatreplace->fetch($objectidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; } - print '
'.$langs->trans('Discounts'); - print ''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); @@ -187,7 +179,7 @@ if ($id > 0 || ! empty($ref)) } 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.'
'; else print '.'; @@ -230,41 +222,17 @@ if ($id > 0 || ! empty($ref)) print $addabsolutediscount; //print '   -   '.$addcreditnote; // We disbale link to credit note }*/ - print '
'.$langs->trans("Date").''.dol_print_date($object->date,"daytext").'
'.dol_print_date($object->date,"daytext").'
'.$langs->trans('DateMaxPayment').''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) - { - 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 '
'.$langs->trans("PaymentConditionsShort").''; - $form->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->cond_reglement_id,"none"); - print '
'.$langs->trans('PaymentMode').''; - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none'); - print ''; + // Right part with $rowspan lines + $rowspan=5; + if (! empty($conf->projet->enabled)) $rowspan++; + print ''; /* * Documents @@ -278,7 +246,7 @@ if ($id > 0 || ! empty($ref)) $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; // 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 $relativepathimage = $relativepath.'_preview.png'; @@ -330,25 +298,30 @@ if ($id > 0 || ! empty($ref)) // Total HT print '
'.$langs->trans("AmountHT").'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; if ($object->fk_project > 0) { $project = New Project($db); @@ -369,14 +342,17 @@ if ($id > 0 || ! empty($ref)) else { // Facture non trouvee - print $langs->trans("ErrorBillNotFound",$_GET["facid"]); + print $langs->trans("ErrorBillNotFound",$id); } } +print ''; +print ''; +print '
'; +print '
'; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -389,11 +365,13 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

'; + print '

'; } } } - +print '

'; +print '
'; llxFooter();