PageRenderTime 60ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/comm/remx.php

https://github.com/asterix14/dolibarr
PHP | 545 lines | 440 code | 55 blank | 50 comment | 56 complexity | e7557961fffe2aa7dfb57e7a95ba7294 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?PHP
  2. /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
  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 2 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. * \file htdocs/comm/remx.php
  21. * \ingroup societe
  22. * \brief Page to edit absolute discounts for a customer
  23. */
  24. require("../main.inc.php");
  25. require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
  26. require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
  27. require_once(DOL_DOCUMENT_ROOT."/core/class/discount.class.php");
  28. $langs->load("orders");
  29. $langs->load("bills");
  30. $langs->load("companies");
  31. $action=GETPOST('action');
  32. // Security check
  33. $socid = GETPOST("id");
  34. if ($user->societe_id > 0)
  35. {
  36. $socid = $user->societe_id;
  37. }
  38. /*
  39. * Actions
  40. */
  41. if (GETPOST('cancel') && GETPOST('backtopage'))
  42. {
  43. Header("Location: ".GETPOST("backtopage"));
  44. exit;
  45. }
  46. if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
  47. {
  48. //if ($user->rights->societe->creer)
  49. //if ($user->rights->facture->creer)
  50. $error=0;
  51. $remid=GETPOST("remid")?GETPOST("remid"):0;
  52. $discount=new DiscountAbsolute($db);
  53. $res=$discount->fetch($remid);
  54. if (! $res > 0)
  55. {
  56. $error++;
  57. $mesg='<div class="error">'.$langs->trans("ErrorFailedToLoadDiscount").'</div>';
  58. }
  59. if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
  60. {
  61. $error++;
  62. $mesg='<div class="error">'.$langs->trans("TotalOfTwoDiscountMustEqualsOriginal").'</div>';
  63. }
  64. if (! $error && $discount->fk_facture_line)
  65. {
  66. $error++;
  67. $mesg='<div class="error">'.$langs->trans("ErrorCantSplitAUsedDiscount").'</div>';
  68. }
  69. if (! $error)
  70. {
  71. $newdiscount1=new DiscountAbsolute($db);
  72. $newdiscount2=new DiscountAbsolute($db);
  73. $newdiscount1->fk_facture_source=$discount->fk_facture_source;
  74. $newdiscount2->fk_facture_source=$discount->fk_facture_source;
  75. $newdiscount1->fk_facture=$discount->fk_facture;
  76. $newdiscount2->fk_facture=$discount->fk_facture;
  77. $newdiscount1->fk_facture_line=$discount->fk_facture_line;
  78. $newdiscount2->fk_facture_line=$discount->fk_facture_line;
  79. if ($discount->description == '(CREDIT_NOTE)')
  80. {
  81. $newdiscount1->description=$discount->description;
  82. $newdiscount2->description=$discount->description;
  83. }
  84. else
  85. {
  86. $newdiscount1->description=$discount->description.' (1)';
  87. $newdiscount2->description=$discount->description.' (2)';
  88. }
  89. $newdiscount1->fk_user=$discount->fk_user;
  90. $newdiscount2->fk_user=$discount->fk_user;
  91. $newdiscount1->fk_soc=$discount->fk_soc;
  92. $newdiscount2->fk_soc=$discount->fk_soc;
  93. $newdiscount1->datec=$discount->datec;
  94. $newdiscount2->datec=$discount->datec;
  95. $newdiscount1->tva_tx=$discount->tva_tx;
  96. $newdiscount2->tva_tx=$discount->tva_tx;
  97. $newdiscount1->amount_ttc=$_POST["amount_ttc_1"];
  98. $newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc);
  99. $newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT');
  100. $newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT');
  101. $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht);
  102. $newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht);
  103. $db->begin();
  104. $discount->fk_facture_source=0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source
  105. $res=$discount->delete($user);
  106. $newid1=$newdiscount1->create($user);
  107. $newid2=$newdiscount2->create($user);
  108. if ($res > 0 && $newid1 > 0 && $newid2 > 0)
  109. {
  110. $db->commit();
  111. header("Location: ".$_SERVER["PHP_SELF"].'?id='.$_REQUEST['id']); // To avoid pb whith back
  112. exit;
  113. }
  114. else
  115. {
  116. $db->rollback();
  117. }
  118. }
  119. }
  120. if ($action == 'setremise')
  121. {
  122. //if ($user->rights->societe->creer)
  123. //if ($user->rights->facture->creer)
  124. if (price2num($_POST["amount_ht"]) > 0)
  125. {
  126. $error=0;
  127. if (empty($_POST["desc"]))
  128. {
  129. $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'</div>';
  130. $error++;
  131. }
  132. if (! $error)
  133. {
  134. $soc = new Societe($db);
  135. $soc->fetch($_GET["id"]);
  136. $discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]);
  137. if ($discountid > 0)
  138. {
  139. if (GETPOST("backtopage"))
  140. {
  141. Header("Location: ".GETPOST("backtopage").'&discountid='.$discountid);
  142. exit;
  143. }
  144. else
  145. {
  146. Header("Location: remx.php?id=".$_GET["id"]);
  147. exit;
  148. }
  149. }
  150. else
  151. {
  152. $error++;
  153. $mesg='<div class="error">'.$soc->error.'</div>';
  154. }
  155. }
  156. }
  157. else
  158. {
  159. $mesg='<div class="error">'.$langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")).'</div>';
  160. }
  161. }
  162. if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
  163. {
  164. //if ($user->rights->societe->creer)
  165. //if ($user->rights->facture->creer)
  166. $db->begin();
  167. $discount = new DiscountAbsolute($db);
  168. $result=$discount->fetch(GETPOST("remid"));
  169. $result=$discount->delete($user);
  170. if ($result > 0)
  171. {
  172. $db->commit();
  173. header("Location: ".$_SERVER["PHP_SELF"].'?id='.GETPOST('id')); // To avoid pb whith back
  174. exit;
  175. }
  176. else
  177. {
  178. $mesg='<div class="error">'.$discount->error.'</div>';
  179. $db->rollback();
  180. }
  181. }
  182. /*
  183. * View
  184. */
  185. $form=new Form($db);
  186. $facturestatic=new Facture($db);
  187. llxHeader('',$langs->trans("GlobalDiscount"));
  188. if ($socid > 0)
  189. {
  190. dol_htmloutput_mesg($mesg);
  191. // On recupere les donnees societes par l'objet
  192. $objsoc = new Societe($db);
  193. $objsoc->id=$socid;
  194. $objsoc->fetch($socid);
  195. /*
  196. * Affichage onglets
  197. */
  198. $head = societe_prepare_head($objsoc);
  199. dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
  200. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">';
  201. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  202. print '<input type="hidden" name="action" value="setremise">';
  203. print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
  204. print '<table class="border" width="100%">';
  205. // Name
  206. print '<tr><td width="38%">'.$langs->trans('Name').'</td>';
  207. print '<td>';
  208. print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
  209. print '</td></tr>';
  210. // Calcul avoirs en cours
  211. $remise_all=$remise_user=0;
  212. $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
  213. $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
  214. $sql.= " WHERE rc.fk_soc =". $objsoc->id;
  215. $sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
  216. $sql.= " GROUP BY rc.fk_user";
  217. $resql=$db->query($sql);
  218. if ($resql)
  219. {
  220. $obj = $db->fetch_object($resql);
  221. $remise_all+=$obj->amount;
  222. if ($obj->fk_user == $user->id) $remise_user+=$obj->amount;
  223. }
  224. else
  225. {
  226. dol_print_error($db);
  227. }
  228. print '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
  229. print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
  230. print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
  231. print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT").'</td></tr>';
  232. print '</table>';
  233. print '<br>';
  234. print_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
  235. print '<table class="border" width="100%">';
  236. print '<tr><td width="38%">'.$langs->trans("AmountHT").'</td>';
  237. print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
  238. print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
  239. print '<td>';
  240. print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,'');
  241. print '</td></tr>';
  242. print '<tr><td>'.$langs->trans("NoteReason").'</td>';
  243. print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
  244. print "</table>";
  245. print '<center>';
  246. print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
  247. if (GETPOST("backtopage"))
  248. {
  249. print '&nbsp; &nbsp; ';
  250. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  251. }
  252. print '</center>';
  253. print '</form>';
  254. dol_fiche_end();
  255. print '<br>';
  256. if ($_GET['action'] == 'remove')
  257. {
  258. $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
  259. }
  260. /*
  261. * Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture)
  262. */
  263. $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
  264. $sql.= " rc.datec as dc, rc.description,";
  265. $sql.= " rc.fk_facture_source,";
  266. $sql.= " u.login, u.rowid as user_id,";
  267. $sql.= " fa.facnumber as ref, fa.type as type";
  268. $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
  269. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
  270. $sql.= " WHERE rc.fk_soc =". $objsoc->id;
  271. $sql.= " AND u.rowid = rc.fk_user";
  272. $sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
  273. $sql.= " ORDER BY rc.datec DESC";
  274. $resql=$db->query($sql);
  275. if ($resql)
  276. {
  277. print_titre($langs->trans("DiscountStillRemaining"));
  278. print '<table width="100%" class="noborder">';
  279. print '<tr class="liste_titre">';
  280. print '<td width="120" align="left">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
  281. print '<td align="left">'.$langs->trans("ReasonDiscount").'</td>';
  282. print '<td width="150" nowrap="nowrap">'.$langs->trans("ConsumedBy").'</td>';
  283. print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
  284. print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
  285. print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
  286. print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
  287. print '<td width="50">&nbsp;</td>';
  288. print '</tr>';
  289. $var = true;
  290. $i = 0 ;
  291. $num = $db->num_rows($resql);
  292. while ($i < $num)
  293. {
  294. $obj = $db->fetch_object($resql);
  295. $var = !$var;
  296. print "<tr $bc[$var]>";
  297. print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
  298. if ($obj->description == '(CREDIT_NOTE)')
  299. {
  300. print '<td nowrap="nowrap">';
  301. $facturestatic->id=$obj->fk_facture_source;
  302. $facturestatic->ref=$obj->ref;
  303. $facturestatic->type=$obj->type;
  304. print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
  305. print '</td>';
  306. }
  307. elseif ($obj->description == '(DEPOSIT)')
  308. {
  309. print '<td nowrap="nowrap">';
  310. $facturestatic->id=$obj->fk_facture_source;
  311. $facturestatic->ref=$obj->ref;
  312. $facturestatic->type=$obj->type;
  313. print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
  314. print '</td>';
  315. }
  316. else
  317. {
  318. print '<td>';
  319. print $obj->description;
  320. print '</td>';
  321. }
  322. print '<td nowrap="nowrap">'.$langs->trans("NotConsumed").'</td>';
  323. print '<td align="right">'.price($obj->amount_ht).'</td>';
  324. print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
  325. print '<td align="right">'.price($obj->amount_ttc).'</td>';
  326. print '<td align="center">';
  327. print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
  328. print '</td>';
  329. if ($user->rights->societe->creer || $user->rights->facture->creer)
  330. {
  331. print '<td nowrap="nowrap">';
  332. print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=split&amp;remid='.$obj->rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').'</a>';
  333. print ' &nbsp; ';
  334. print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
  335. print '</td>';
  336. }
  337. else print '<td>&nbsp;</td>';
  338. print '</tr>';
  339. if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid)
  340. {
  341. print "<tr $bc[$var]>";
  342. print '<td colspan="8">';
  343. $amount1=price2num($obj->amount_ttc/2,'MT');
  344. $amount2=($obj->amount_ttc-$amount1);
  345. $formquestion=array(
  346. 'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
  347. array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
  348. array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
  349. );
  350. $langs->load("dict");
  351. $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->monnaie)), 'confirm_split', $formquestion, 0, 0);
  352. print '</td>';
  353. print '</tr>';
  354. }
  355. $i++;
  356. }
  357. $db->free($resql);
  358. print "</table>";
  359. }
  360. else
  361. {
  362. dol_print_error($db);
  363. }
  364. print '<br>';
  365. /*
  366. * Liste ristournes appliquees (=liees a une ligne de facture ou facture)
  367. */
  368. // Remises liees a lignes de factures
  369. $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
  370. $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
  371. $sql.= " rc.fk_facture_source,";
  372. $sql.= " u.login, u.rowid as user_id,";
  373. $sql.= " f.rowid, f.facnumber,";
  374. $sql.= " fa.facnumber as ref, fa.type as type";
  375. $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
  376. $sql.= " , ".MAIN_DB_PREFIX."user as u";
  377. $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
  378. $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
  379. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
  380. $sql.= " WHERE rc.fk_soc =". $objsoc->id;
  381. $sql.= " AND rc.fk_facture_line = fc.rowid";
  382. $sql.= " AND fc.fk_facture = f.rowid";
  383. $sql.= " AND rc.fk_user = u.rowid";
  384. $sql.= " ORDER BY dc DESC";
  385. //$sql.= " UNION ";
  386. // Remises liees a factures
  387. $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
  388. $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
  389. $sql2.= " rc.fk_facture_source,";
  390. $sql2.= " u.login, u.rowid as user_id,";
  391. $sql2.= " f.rowid, f.facnumber,";
  392. $sql2.= " fa.facnumber as ref, fa.type as type";
  393. $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
  394. $sql2.= " , ".MAIN_DB_PREFIX."user as u";
  395. $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
  396. $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
  397. $sql2.= " WHERE rc.fk_soc =". $objsoc->id;
  398. $sql2.= " AND rc.fk_facture = f.rowid";
  399. $sql2.= " AND rc.fk_user = u.rowid";
  400. $sql2.= " ORDER BY dc DESC";
  401. $resql=$db->query($sql);
  402. $resql2=null;
  403. if ($resql) $resql2=$db->query($sql2);
  404. if ($resql2)
  405. {
  406. print_titre($langs->trans("DiscountAlreadyCounted"));
  407. print '<table class="noborder" width="100%">';
  408. print '<tr class="liste_titre">';
  409. print '<td width="120" align="left">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
  410. print '<td align="left">'.$langs->trans("ReasonDiscount").'</td>';
  411. print '<td width="150" nowrap="nowrap">'.$langs->trans("ConsumedBy").'</td>';
  412. print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
  413. print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
  414. print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
  415. print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
  416. print '<td width="50">&nbsp;</td>';
  417. print '</tr>';
  418. $var = true;
  419. $tab_sqlobj=array();
  420. $tab_sqlobjOrder=array();
  421. $num = $db->num_rows($resql);
  422. for ($i = 0;$i < $num;$i++)
  423. {
  424. $sqlobj = $db->fetch_object($resql);
  425. $tab_sqlobj[] = $sqlobj;
  426. $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc);
  427. }
  428. $db->free($resql);
  429. $num = $db->num_rows($resql2);
  430. for ($i = 0;$i < $num;$i++)
  431. {
  432. $sqlobj = $db->fetch_object($resql2);
  433. $tab_sqlobj[] = $sqlobj;
  434. $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc);
  435. }
  436. $db->free($resql2);
  437. array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
  438. $num = count($tab_sqlobj);
  439. $i = 0 ;
  440. while ($i < $num )
  441. {
  442. $obj = array_shift($tab_sqlobj);
  443. $var = !$var;
  444. print "<tr $bc[$var]>";
  445. print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
  446. if ($obj->description == '(CREDIT_NOTE)')
  447. {
  448. print '<td nowrap="nowrap">';
  449. $facturestatic->id=$obj->fk_facture_source;
  450. $facturestatic->ref=$obj->ref;
  451. $facturestatic->type=$obj->type;
  452. print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
  453. print '</td>';
  454. }
  455. elseif ($obj->description == '(DEPOSIT)')
  456. {
  457. print '<td nowrap="nowrap">';
  458. $facturestatic->id=$obj->fk_facture_source;
  459. $facturestatic->ref=$obj->ref;
  460. $facturestatic->type=$obj->type;
  461. print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
  462. print '</td>';
  463. }
  464. else
  465. {
  466. print '<td>';
  467. print $obj->description;
  468. print '</td>';
  469. }
  470. print '<td align="left" nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
  471. print '<td align="right">'.price($obj->amount_ht).'</td>';
  472. print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
  473. print '<td align="right">'.price($obj->amount_ttc).'</td>';
  474. print '<td align="center">';
  475. print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
  476. print '</td>';
  477. print '<td>&nbsp;</td>';
  478. print '</tr>';
  479. $i++;
  480. }
  481. print "</table>";
  482. }
  483. else
  484. {
  485. print dol_print_error($db);
  486. }
  487. }
  488. $db->close();
  489. llxFooter();
  490. ?>