1 | <?php |
||
2 | /* Copyright (C) 2004 Rodolphe Quiedeville <[email protected]> |
||
3 | * Copyright (C) 2004-2005 Laurent Destailleur <[email protected]> |
||
4 | * Copyright (C) 2017 Ferran Marcet <[email protected]> |
||
5 | * |
||
6 | * This program is free software; you can redistribute it and/or modify |
||
7 | * it under the terms of the GNU General Public License as published by |
||
8 | * the Free Software Foundation; either version 3 of the License, or |
||
9 | * (at your option) any later version. |
||
10 | * |
||
11 | * This program is distributed in the hope that it will be useful, |
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | * GNU General Public License for more details. |
||
15 | * |
||
16 | * You should have received a copy of the GNU General Public License |
||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | */ |
||
19 | |||
20 | /** |
||
21 | * \file htdocs/compta/facture/info.php |
||
22 | * \ingroup facture |
||
23 | * \brief Page des informations d'une facture |
||
24 | */ |
||
25 | |||
26 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
||
27 | |||
28 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
||
29 | |||
30 | require DOL_BASE_PATH . '/main.inc.php'; |
||
31 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
||
32 | require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
||
33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
||
34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
||
35 | if (! empty($conf->projet->enabled)) { |
||
36 | include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
||
37 | } |
||
38 | |||
39 | // Load translation files required by the page |
||
40 | $langs->loadLangs(array('companies', 'bills')); |
||
41 | |||
42 | $id = GETPOST("facid","int"); |
||
43 | $ref=GETPOST("ref",'alpha'); |
||
44 | |||
45 | |||
46 | /* |
||
47 | * View |
||
48 | */ |
||
49 | |||
50 | $form = new Form($db); |
||
51 | |||
52 | $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info'); |
||
53 | $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; |
||
54 | llxHeader('', $title, $helpurl); |
||
55 | |||
56 | $object = new Facture($db); |
||
57 | $object->fetch($id, $ref); |
||
58 | $object->fetch_thirdparty(); |
||
59 | |||
60 | $object->info($object->id); |
||
61 | |||
62 | $head = facture_prepare_head($object); |
||
63 | dol_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'); |
||
64 | |||
65 | $totalpaye = $object->getSommePaiement(); |
||
66 | |||
67 | // Invoice content |
||
68 | |||
69 | $linkback = '<a href="' . BASE_URL . '?controller=compta/facture&method=list&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
70 | |||
71 | $morehtmlref='<div class="refidno">'; |
||
72 | // Ref customer |
||
73 | $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
||
74 | $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
||
75 | // Thirdparty |
||
76 | $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); |
||
77 | // Project |
||
78 | if (! empty($conf->projet->enabled)) |
||
79 | { |
||
80 | $langs->load("projects"); |
||
81 | $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
||
82 | if ($user->rights->facture->creer) |
||
83 | { |
||
84 | if ($action != 'classify') |
||
85 | //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
||
86 | $morehtmlref.=' : '; |
||
87 | if ($action == 'classify') { |
||
88 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
||
89 | $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
||
90 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
||
91 | $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
||
92 | $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
||
93 | $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
||
94 | $morehtmlref.='</form>'; |
||
95 | } else { |
||
96 | $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
||
97 | } |
||
98 | } else { |
||
99 | if (! empty($object->fk_project)) { |
||
100 | $proj = new Project($db); |
||
101 | $proj->fetch($object->fk_project); |
||
102 | $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
||
103 | $morehtmlref.=$proj->ref; |
||
104 | $morehtmlref.='</a>'; |
||
105 | } else { |
||
106 | $morehtmlref.=''; |
||
107 | } |
||
108 | } |
||
109 | } |
||
110 | $morehtmlref.='</div>'; |
||
111 | |||
112 | $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status |
||
113 | |||
114 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); |
||
115 | |||
116 | print '<div class="fichecenter">'; |
||
117 | print '<div class="underbanner clearboth"></div>'; |
||
118 | |||
119 | print '<br>'; |
||
120 | |||
121 | print '<table width="100%"><tr><td>'; |
||
122 | dol_print_object_info($object); |
||
123 | print '</td></tr></table>'; |
||
124 | |||
125 | print '</div>'; |
||
126 | |||
127 | dol_fiche_end(); |
||
128 | |||
129 | // End of page |
||
130 | llxFooter(); |
||
131 | $db->close(); |
||
132 |