dolibarr  7.0.0-beta
info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
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 
26 require '../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
31 if (! empty($conf->projet->enabled)) {
32  require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
33 }
34 
35 $langs->load("companies");
36 $langs->load("bills");
37 
38 $id = GETPOST("facid","int");
39 $ref=GETPOST("ref",'alpha');
40 
41 
42 /*
43  * View
44  */
45 
46 $form = new Form($db);
47 
48 $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
49 $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
50 llxHeader('', $title, $helpurl);
51 
52 $object = new Facture($db);
53 $object->fetch($id, $ref);
54 $object->fetch_thirdparty();
55 
56 $object->info($object->id);
57 
58 $head = facture_prepare_head($object);
59 dol_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
60 
61 $totalpaye = $object->getSommePaiement();
62 
63 // Invoice content
64 
65 $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
66 
67 $morehtmlref='<div class="refidno">';
68 // Ref customer
69 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
70 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
71 // Thirdparty
72 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
73 // Project
74 if (! empty($conf->projet->enabled))
75 {
76  $langs->load("projects");
77  $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
78  if ($user->rights->facture->creer)
79  {
80  if ($action != 'classify')
81  //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
82  $morehtmlref.=' : ';
83  if ($action == 'classify') {
84  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
85  $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
86  $morehtmlref.='<input type="hidden" name="action" value="classin">';
87  $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
88  $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
89  $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
90  $morehtmlref.='</form>';
91  } else {
92  $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
93  }
94  } else {
95  if (! empty($object->fk_project)) {
96  $proj = new Project($db);
97  $proj->fetch($object->fk_project);
98  $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
99  $morehtmlref.=$proj->ref;
100  $morehtmlref.='</a>';
101  } else {
102  $morehtmlref.='';
103  }
104  }
105 }
106 $morehtmlref.='</div>';
107 
108 $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
109 
110 dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
111 
112 print '<div class="fichecenter">';
113 print '<div class="underbanner clearboth"></div>';
114 
115 print '<br>';
116 
117 print '<table width="100%"><tr><td>';
118 dol_print_object_info($object);
119 print '</td></tr></table>';
120 
121 print '</div>';
122 
123 dol_fiche_end();
124 
125 llxFooter();
126 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header 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.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
dol_fiche_end($notab=0)
Show tab footer of a card.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91
Class to manage invoices.
facture_prepare_head($object)
Initialize the array of tabs for customer invoice.
Definition: invoice.lib.php:36