dolibarr  13.0.2
facturation1.tpl.php
1 <?php
2 /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
3  * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  *
21  */
22 
23 // Protection to avoid direct call of template
24 if (empty($langs) || !is_object($langs))
25 {
26  print "Error, template page can't be called as URL";
27  exit;
28 }
29 
30 // Load translation files required by the page
31 $langs->loadLangs(array("main", "bills", "cashdesk"));
32 
33 // Object $form must de defined
34 
35 ?>
36 
37 <script type="text/javascript" src="javascript/facturation1.js"></script>
38 <script type="text/javascript" src="javascript/dhtml.js"></script>
39 <script type="text/javascript" src="javascript/keypad.js"></script>
40 
41 <!-- ========================= Cadre "Article" ============================= -->
42 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Article"); ?></legend>
43  <form id="frmFacturation" class="formulaire1" method="post" action="facturation_verif.php" autocomplete="off">
44  <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
45 
46  <input type="hidden" name="hdnSource" value="NULL" />
47 
48  <table class="center">
49  <tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
50  <tr>
51  <!-- Affichage de la reference et de la designation -->
52  <!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
53  <td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
54  onchange="javascript: setSource('REF');"
55  onfocus="javascript: this.select();" />
56  </td>
57  <td class="select_design maxwidthonsmartphone">
58  <select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
59 <?php
60 print '<option value="0">'.$top_liste_produits.'</option>'."\n";
61 
62 $id = $obj_facturation->id();
63 
64 // Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
65 
66 $nbtoshow = $nbr_enreg;
67 if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes;
68 
69 for ($i = 0; $i < $nbtoshow; $i++)
70 {
71  if ($id == $tab_designations[$i]['rowid']) {
72  $selected = 'selected';
73  } else {
74  $selected = '';
75  }
76 
77  $label = $tab_designations[$i]['label'];
78 
79  print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'], 16).' - '.dol_trunc($label, 35, 'middle');
80  if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type'] == 0) {
81  print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel']) ? 0 : $tab_designations[$i]['reel']).')';
82  }
83  print '</option>'."\n";
84 }
85 ?>
86  </select>
87  </td>
88  </tr>
89  </table>
90  </form>
91 
92  <form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
93  <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
94  <table class="center">
95  <tr>
96  <th><?php echo $langs->trans("Qty"); ?></th>
97  <th><?php echo $langs->trans("PriceUHT"); ?></th>
98  <th><?php echo $langs->trans("Discount"); ?> (%)</th>
99  <th><?php echo $langs->trans("VATRate"); ?></th>
100  <th></th>
101  </tr>
102  <tr>
103  <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
104 <?php print genkeypad("txtQte", "frmQte"); ?>
105  </td>
106  <!-- Show unit price -->
107  <?php // TODO Remove the disabled and use this value when adding product into cart ?>
108  <td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
109  <!-- Choix de la remise -->
110  <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
111  <?php print genkeypad("txtRemise", "frmQte"); ?>
112  </td>
113  <!-- Choix du taux de TVA -->
114  <td class="select_tva center">
115  <?php
116  $vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
117 
118  $buyer = new Societe($db);
119  if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
120  echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
121  ?>
122  </td>
123  <td></td>
124  </tr>
125  <tr>
126  <!-- Affichage du stock pour l'article courant -->
127  <tr>
128  <td><?php echo $langs->trans("Stock"); ?></td>
129  <td>
130  <input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
131  </td>
132  <td><?php echo $langs->trans("TotalHT"); ?></td>
133  <!-- Affichage du total HT -->
134  <td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
135  </tr>
136 
137  </table>
138 
139  <input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
140  </form>
141 </fieldset>
142 
143 <!-- ========================= Cadre "Amount" ============================= -->
144 <form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=validate_sell">
145  <input type="hidden" name="hdnChoix" value="" />
146  <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
147 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
148  <table class="centpercent">
149  <tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
150  <tr>
151  <!-- Affichage du montant du -->
152  <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->amountWithTax(), 'MT'); ?>" disabled /></td>
153  <!-- Choix du montant encaisse -->
154  <td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
155 <?php print genkeypad("txtEncaisse", "frmDifference"); ?>
156  </td>
157  <!-- Affichage du montant rendu -->
158  <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
159  </tr>
160  <tr>
161  </table>
162 </fieldset>
163 
164 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("PaymentMode"); ?></legend>
165  <div class="inline-block">
166  <?php
167  print '<div class="inline-block" style="margin: 6px;">';
168  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
169  {
170  $langs->load("errors");
171  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
172  } else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
173  print '</div>';
174  print '<div class="inline-block" style="margin: 6px;">';
175  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
176  {
177  $langs->load("errors");
178  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
179  } else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
180  print '</div>';
181  print '<div class="inline-block" style="margin: 6px;">';
182  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
183  {
184  $langs->load("errors");
185  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
186  } else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
187  print '</div>';
188  print '<div class="clearboth">';
189  print '<div class="inline-block" style="margin: 6px;">';
190  ?>
191  <input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
192  <?php
193  print $langs->trans("DateDue").' :';
194  print $form->selectDate(-1, 'txtDatePaiement', 0, 0, 0, 'paymentmode', 1, 0);
195  print '</div>';
196  ?>
197  </div>
198 </fieldset>
199 </form>
200 
201 <script type="text/javascript">
202 /* Calendar.setup ({
203  inputField : "txtDatePaiement",
204  ifFormat : "%Y-%m-%d",
205  button : "btnCalendrier"
206  });
207 */
208  if (document.getElementById('frmFacturation').txtRef.value) {
209 
210  modif();
211  document.getElementById('frmQte').txtQte.focus();
212  document.getElementById('frmQte').txtQte.select();
213 
214  } else {
215 
216  document.getElementById('frmFacturation').txtRef.focus();
217 
218  }
219 
220 </script>
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print
Draft customers invoices.
Definition: index.php:89
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding &#39;...&#39; if string larger than length.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105