diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b3d365650b5..e31683f841d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -26,10 +26,11 @@ */ /** - * \file htdocs/compta/facture.php + * \file htdocs/compta/facture.php * \ingroup facture - * \brief Page to create/see an invoice + * \brief Page to create/see an invoice */ + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; @@ -81,8 +82,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co // Security check $fieldid = (! empty($ref) ? 'facnumber' : 'rowid'); -if ($user->societe_id) - $socid = $user->societe_id; +if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); // Nombre de ligne pour choix de produit/service predefinis @@ -1753,6 +1753,7 @@ if ($action == 'update_extras') { } + /* * View */ @@ -1782,6 +1783,7 @@ jQuery(document).ready(function() { * * ******************************************************************** */ + if ($action == 'create') { $facturestatic = new Facture($db); @@ -1860,8 +1862,7 @@ if ($action == 'create') print '
'; print ''; print ''; - if ($soc->id > 0) - print '' . "\n"; + if ($soc->id > 0) print '' . "\n"; print ''; print ''; print ''; @@ -1875,7 +1876,8 @@ if ($action == 'create') // Thirdparty print '' . $langs->trans('Customer') . ''; - if ($soc->id > 0) { + if ($soc->id > 0) + { print ''; print $soc->getNomUrl(1); print ''; @@ -1883,14 +1885,16 @@ if ($action == 'create') $outstandigBills = $soc->get_OutstandingBill(); print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') { - if ($outstandigBills > $soc->outstanding_limit) - print img_warning($langs->trans("OutstandingBillReached")); + if ($soc->outstanding_limit != '') + { + if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); print ' / ' . price($soc->outstanding_limit); } print ')'; print ''; - } else { + } + else + { print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); print ''; @@ -1986,17 +1990,6 @@ if ($action == 'create') print $desc; print '' . "\n"; - // Proforma - if (! empty($conf->global->FACTURE_USE_PROFORMAT)) - { - print ''; - print ''; - print ''; - $desc = $form->textwithpicto($langs->trans("InvoiceProForma"), $langs->transnoentities("InvoiceProFormaDesc"), 1); - print $desc; - print '' . "\n"; - } - if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit @@ -2055,45 +2048,70 @@ if ($action == 'create') print $desc; print '' . "\n"; } - - if (empty($origin) && $socid > 0) + else { - // Credit note - print ''; - print ''; - print ''; - print ''; - $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; - // $text.=''; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print ''; + print ''; + print ''; + $text = $langs->trans("InvoiceReplacement") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); print $desc; - - print '    0 ? 'checked="checked"':'').' /> "; - print '
    0 ? 'checked="checked"':'').' /> "; - print '' . "\n"; } + if (empty($origin)) + { + if ($socid > 0) + { + // Credit note + print ''; + print ''; + print ''; + print ''; + $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print $desc; + + print '    0 ? 'checked="checked"':'').' /> "; + print '
    0 ? 'checked="checked"':'').' /> "; + + print '' . "\n"; + } + else + { + print ''; + print ''; + print ''; + $text = $langs->trans("InvoiceAvoir") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print $desc; + print '' . "\n"; + } + } + print ''; print ''; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index b182952940e..1c83efae5cc 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -24,7 +24,7 @@ InvoiceProFormaAsk=Proforma invoice InvoiceProFormaDesc=Proforma invoice is an image of a true invoice but has no accountancy value. InvoiceReplacement=Replacement invoice InvoiceReplacementAsk=Replacement invoice for invoice -InvoiceReplacementDesc=Replacement invoice is used to cancel and replace completely an invoice with no payment already received.

Note: Only invoice with no payment on it can be replaced. If not closed, it will be automatically closed to 'abandoned'. +InvoiceReplacementDesc=Replacement invoice is used to cancel and replace completely an invoice with no payment already received.

Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'. InvoiceAvoir=Credit note InvoiceAvoirAsk=Credit note to correct invoice InvoiceAvoirDesc=The credit note is a negative invoice used to solve fact that an invoice has an amount that differs than amount really paid (because customer paid too much by error, or will not paid completely since he returned some products for example). @@ -399,6 +399,11 @@ ToMakePaymentBack=Pay back ListOfYourUnpaidInvoices=List of unpaid invoices NoteListOfYourUnpaidInvoices=Note: This list contains only invoices for third parties you are linked to as a sale representative. RevenueStamp=Revenue stamp +YouMustCreateInvoiceFromThird=This option is only available when creating invoice from tab "customer" of thirdparty +PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) +TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact @@ -408,11 +413,3 @@ TypeContact_invoice_supplier_internal_SALESREPFOLL=Representative following-up s TypeContact_invoice_supplier_external_BILLING=Supplier invoice contact TypeContact_invoice_supplier_external_SHIPPING=Supplier shipping contact TypeContact_invoice_supplier_external_SERVICE=Supplier service contact -# crabe PDF Model -PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) -# oursin PDF Model -PDFOursinDescription=Invoice PDF template Oursin. A complete invoice template (alternative Template) -# NumRef Modules -TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module.