28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
32 if (!empty($conf->projet->enabled)) {
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
36 $langs->loadLangs(array(
"bills",
"companies"));
40 $action =
GETPOST(
'action',
'aZ09');
43 if ($user->socid) $socid = $user->socid;
44 $result =
restrictedArea($user,
'fournisseur', $id,
'facture_fourn',
'facture');
47 $object->fetch($id, $ref);
49 $permissionnote = $user->rights->fournisseur->facture->creer;
56 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
59 if ($action ==
'setlabel' && $user->rights->fournisseur->facture->creer)
61 $object->label = $_POST[
'label'];
62 $result = $object->update($user);
71 $form =
new Form($db);
73 $title = $langs->trans(
'SupplierInvoice').
" - ".$langs->trans(
'Notes');
74 $helpurl =
"EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores";
79 $object->fetch_thirdparty();
81 $alreadypaid = $object->getSommePaiement();
84 $titre = $langs->trans(
'SupplierInvoice');
89 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
91 $morehtmlref =
'<div class="refidno">';
93 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
94 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1);
96 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
97 if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/fourn/facture/list.php?socid='.$object->thirdparty->id.
'&search_company='.urlencode($object->thirdparty->name).
'">'.$langs->trans(
"OtherBills").
'</a>)';
99 if (!empty($conf->projet->enabled))
101 $langs->load(
"projects");
102 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
103 if ($user->rights->fournisseur->commande->creer)
105 if ($action !=
'classify') {
107 $morehtmlref .=
' : ';
109 if ($action ==
'classify') {
111 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
112 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
113 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
114 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
115 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
116 $morehtmlref .=
'</form>';
118 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
121 if (!empty($object->fk_project)) {
123 $proj->fetch($object->fk_project);
124 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
125 $morehtmlref .= $proj->ref;
126 $morehtmlref .=
'</a>';
132 $morehtmlref .=
'</div>';
134 $object->totalpaye = $alreadypaid;
136 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
138 print '<div class="fichecenter">';
139 print '<div class="underbanner clearboth"></div>';
141 print '<table class="border centpercent tableforfield">';
144 print '<tr><td class="titlefield">'.$langs->trans(
'Type').
'</td><td>';
145 print $object->getLibType();
149 $facreplaced->fetch($object->fk_facture_source);
150 print ' ('.$langs->transnoentities(
"ReplaceInvoice", $facreplaced->getNomUrl(1)).
')';
155 $facusing->fetch($object->fk_facture_source);
156 print ' ('.$langs->transnoentities(
"CorrectInvoice", $facusing->getNomUrl(1)).
')';
159 $facidavoir = $object->getListIdAvoirFromInvoice();
160 if (count($facidavoir) > 0)
162 print ' ('.$langs->transnoentities(
"InvoiceHasAvoir");
164 foreach ($facidavoir as $fid)
166 if ($i == 0)
print ' ';
169 $facavoir->fetch($fid);
170 print $facavoir->getNomUrl(1);
177 $facthatreplace->fetch($facidnext);
178 print ' ('.$langs->transnoentities(
"ReplacedByInvoice", $facthatreplace->getNomUrl(1)).
')';
183 print '<tr><td>'.$form->editfieldkey(
"Label",
'label', $object->label, $object, 0).
'</td><td>';
184 print $form->editfieldval(
"Label",
'label', $object->label, $object, 0);
188 print '<tr><td>'.$langs->trans(
'AmountHT').
'</td><td>'.
price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
189 print '<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td>'.
price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
193 if ($societe->localtax1_assuj ==
"1")
195 print '<tr><td>'.$langs->transcountry(
"AmountLT1", $societe->country_code).
'</td>';
196 print '<td>'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).
'</td>';
199 if ($societe->localtax2_assuj ==
"1")
201 print '<tr><td>'.$langs->transcountry(
"AmountLT2", $societe->country_code).
'</td>';
202 print '<td>'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).
'</td>';
205 print '<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td>'.
price($object->total_ttc, 1, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
211 print '<div class="underbanner clearboth"></div>';
212 $cssclass =
"titlefield";
213 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.
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...
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
facturefourn_prepare_head($object)
Prepare array with list of tabs.
print $_SERVER["PHP_SELF"]
Edit parameters.
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.
print
Draft customers invoices.
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.