29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
33 if (!empty($conf->project->enabled)) {
34 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37 $langs->loadLangs(array(
"bills",
"companies"));
41 $action =
GETPOST(
'action',
'aZ09');
45 $socid = $user->socid;
48 $hookmanager->initHooks(array(
'invoicesuppliernote'));
50 $result =
restrictedArea($user,
'fournisseur', $id,
'facture_fourn',
'facture');
53 $object->fetch($id, $ref);
55 $permissionnote = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
62 $reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
66 if (empty($reshook)) {
67 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
71 if ($action ==
'setlabel' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
72 $object->label =
GETPOST(
'label');
73 $result = $object->update($user);
86 $title = $langs->trans(
'SupplierInvoice').
" - ".$langs->trans(
'Notes');
87 $helpurl =
"EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores";
90 if ($object->id > 0) {
91 $object->fetch_thirdparty();
93 $alreadypaid = $object->getSommePaiement();
96 $titre = $langs->trans(
'SupplierInvoice');
101 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
103 $morehtmlref =
'<div class="refidno">';
105 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
106 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1);
108 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
109 if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
110 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/fourn/facture/list.php?socid='.$object->thirdparty->id.
'&search_company='.urlencode($object->thirdparty->name).
'">'.$langs->trans(
"OtherBills").
'</a>)';
113 if (!empty($conf->project->enabled)) {
114 $langs->load(
"projects");
115 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
116 if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) {
117 if ($action !=
'classify') {
119 $morehtmlref .=
' : ';
121 if ($action ==
'classify') {
123 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
124 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
125 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
126 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
127 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
128 $morehtmlref .=
'</form>';
130 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
133 if (!empty($object->fk_project)) {
135 $proj->fetch($object->fk_project);
136 $morehtmlref .=
' : '.$proj->getNomUrl(1);
138 $morehtmlref .=
' - '.$proj->title;
145 $morehtmlref .=
'</div>';
147 $object->totalpaid = $alreadypaid;
149 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
151 print
'<div class="fichecenter">';
152 print
'<div class="underbanner clearboth"></div>';
154 print
'<table class="border centpercent tableforfield">';
157 print
'<tr><td class="titlefield">'.$langs->trans(
'Type').
'</td><td>';
158 print
'<span class="badgeneutral">';
159 print $object->getLibType();
163 $facreplaced->fetch($object->fk_facture_source);
164 print
' ('.$langs->transnoentities(
"ReplaceInvoice", $facreplaced->getNomUrl(1)).
')';
168 $facusing->fetch($object->fk_facture_source);
169 print
' ('.$langs->transnoentities(
"CorrectInvoice", $facusing->getNomUrl(1)).
')';
172 $facidavoir = $object->getListIdAvoirFromInvoice();
173 if (count($facidavoir) > 0) {
174 $invoicecredits = array();
175 foreach ($facidavoir as $facid) {
177 $facavoir->fetch($facid);
178 $invoicecredits[] = $facavoir->getNomUrl(1);
180 print
' ('.$langs->transnoentities(
"InvoiceHasAvoir") . implode(
',', $invoicecredits) .
')';
192 print
'<tr><td>'.$form->editfieldkey(
"Label",
'label', $object->label, $object, 0).
'</td><td>';
193 print
$form->editfieldval(
"Label",
'label', $object->label, $object, 0);
197 print
'<tr><td>'.$langs->trans(
'AmountHT').
'</td><td>'.
price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
198 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td>'.
price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
202 if ($mysoc->localtax1_assuj ==
"1") {
203 print
'<tr><td>'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td>';
204 print
'<td>'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).
'</td>';
207 if ($mysoc->localtax2_assuj ==
"1") {
208 print
'<tr><td>'.$langs->transcountry(
"AmountLT2", $mysoc->country_code).
'</td>';
209 print
'<td>'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).
'</td>';
212 print
'<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td>'.
price($object->total_ttc, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
218 print
'<div class="underbanner clearboth"></div>';
219 $cssclass =
"titlefield";
220 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
const TYPE_REPLACEMENT
Replacement invoice.
Class to manage suppliers invoices.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
restrictedArea($user, $features, $objectid=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.
facturefourn_prepare_head($object)
Prepare array with list of tabs.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
const TYPE_CREDIT_NOTE
Credit note invoice.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.