29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
33require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
35if (isModEnabled(
'project')) {
36 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40$langs->loadLangs(array(
'companies',
'bills'));
45$action =
GETPOST(
'action',
'aZ09');
47$objecttype =
'facture_rec';
48if ($action ==
"create" || $action ==
"add") {
54if (($id > 0 || $title) && $action !=
'create' && $action !=
'add') {
55 $ret =
$object->fetch($id, $title);
61$permissionnote = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
66 $socid = $user->socid;
68$hookmanager->initHooks(array(
'invoicenote'));
72$usercancreate = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
79$reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
84 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
96 $title =
$object->ref.
" - ".$langs->trans(
'Notes');
98 $title = $langs->trans(
'Notes');
100$helpurl =
"EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
105 $langs->load(
'errors');
106 echo
'<div class="error">'.$langs->trans(
"ErrorRecordNotFound").
'</div>';
120 $totalpaid =
$object->getSommePaiement();
122 print
dol_get_fiche_head($head,
'note', $langs->trans(
"InvoiceCustomer"), -1,
'bill');
126 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
129 if ($action !=
'editref') {
130 $morehtmlref .= $form->editfieldkey(
$object->ref,
'ref',
$object->ref, $object, 0,
'',
'', 0, 2);
132 $morehtmlref .= $form->editfieldval(
'',
'ref',
$object->ref, $object, 0,
'string');
134 $morehtmlref .=
'<div class="refidno">';
136 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object,
'',
'string',
'', 0, 1);
137 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, $usercancreate,
'string',
'',
null,
null,
'', 1);
139 $morehtmlref .=
'<br>' . $langs->trans(
'ThirdParty') .
' : ' .
$object->thirdparty->getNomUrl(1);
142 if (isModEnabled(
'project')) {
143 $langs->load(
"projects");
144 $morehtmlref .=
'<br>';
146 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
147 if ($action !=
'classify') {
148 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
150 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
152 if (!empty(
$object->fk_project)) {
154 $proj->fetch(
$object->fk_project);
155 $morehtmlref .= $proj->getNomUrl(1);
157 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
162 $morehtmlref .=
'</div>';
164 $morehtmlstatus =
'';
166 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlstatus);
168 print
'<div class="fichecenter">';
169 print
'<div class="underbanner clearboth"></div>';
172 $cssclass =
"titlefield";
176 $dateexample =
$object->date_when;
181 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'm'),
'%m') .
')';
182 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%m') .
')';
183 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'm'),
'%m') .
')';
184 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'm'),
'%B') .
')';
185 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%B') .
')';
186 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'm'),
'%B') .
')';
187 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'y'),
'%Y') .
')';
188 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%Y') .
')';
189 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'y'),
'%Y') .
')';
191 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans(
"DateNextInvoiceBeforeGen") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date((
$object->date_when ?
$object->date_when :
dol_now()),
'dayhour') .
')';
193 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] =
$object->nb_gen_done;
194 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] =
$object->nb_gen_max;
196 $htmltext =
'<i>' . $langs->trans(
"FollowingConstantsWillBeSubstituted") .
':<br>';
197 foreach ($substitutionarray as $key => $val) {
198 $htmltext .= $key .
' = ' . $langs->trans($val) .
'<br>';
202 $textNotePub = $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic', 2);
203 $textNotePrive = $form->textwithpicto($langs->trans(
"NotePrivate"), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
205 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoice templates.
Class to manage projects.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
supplier_invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.