dolibarr  9.0.0
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 <http://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 $_SESSION['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  <?php /*
59  $selected='';
60  $htmlname='idprod';
61  $status=-1;
62  $rice_level=$company->price_level;
63  print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', 'outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
64  if (! $hidelabel) print $langs->trans("RefOrLabel").' : ';
65  print '<input type="text" size="4" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
66  */
67  ?>
68 
69  <select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
70  <?php
71  print '<option value="0">'.$top_liste_produits.'</option>'."\n";
72 
73  $id = $obj_facturation->id();
74 
75  // Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
76 
77  $nbtoshow = $nbr_enreg;
78  if (! empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes;
79 
80  for ($i = 0; $i < $nbtoshow; $i++)
81  {
82  if ( $id == $tab_designations[$i]['rowid'] )
83  $selected = 'selected';
84  else
85  $selected = '';
86 
87  $label = $tab_designations[$i]['label'];
88 
89  print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],16).' - '.dol_trunc($label,35,'middle');
90  if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
91  print '</option>'."\n";
92  }
93  ?>
94  </select>
95  </td>
96  </tr>
97  </table>
98  </form>
99 
100  <form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
101  <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
102  <table class="center">
103  <tr>
104  <th><?php echo $langs->trans("Qty"); ?></th>
105  <th><?php echo $langs->trans("PriceUHT"); ?></th>
106  <th><?php echo $langs->trans("Discount"); ?> (%)</th>
107  <th><?php echo $langs->trans("VATRate"); ?></th>
108  <th></th>
109  </tr>
110  <tr>
111  <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
112 <?php print genkeypad("txtQte", "frmQte");?>
113  </td>
114  <!-- Show unit price -->
115  <?php // TODO Remove the disabled and use this value when adding product into cart ?>
116  <td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
117  <!-- Choix de la remise -->
118  <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
119  <?php print genkeypad("txtRemise", "frmQte");?>
120  </td>
121  <!-- Choix du taux de TVA -->
122  <td class="select_tva center">
123  <?php
124  $vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
125 
126  $buyer = new Societe($db);
127  if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
128  echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
129  ?>
130  </td>
131  <td></td>
132  </tr>
133  <tr>
134  <!-- Affichage du stock pour l'article courant -->
135  <tr>
136  <td><?php echo $langs->trans("Stock"); ?></td>
137  <td>
138  <input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
139  </td>
140  <td><?php echo $langs->trans("TotalHT"); ?></td>
141  <!-- Affichage du total HT -->
142  <td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
143  </tr>
144 
145  </table>
146 
147  <input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
148  </form>
149 </fieldset>
150 
151 <!-- ========================= Cadre "Amount" ============================= -->
152 <form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=valide_achat">
153  <input type="hidden" name="hdnChoix" value="" />
154  <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
155 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
156  <table class="centpercent">
157  <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>
158  <tr>
159  <!-- Affichage du montant du -->
160  <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td>
161  <!-- Choix du montant encaisse -->
162  <td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
163 <?php print genkeypad("txtEncaisse", "frmDifference");?>
164  </td>
165  <!-- Affichage du montant rendu -->
166  <td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
167  </tr>
168  <tr>
169  </table>
170 </fieldset>
171 
172 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("PaymentMode"); ?></legend>
173  <div class="inline-block">
174  <?php
175  print '<div class="inline-block" style="margin: 6px;">';
176  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
177  {
178  $langs->load("errors");
179  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
180  }
181  else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
182  print '</div>';
183  print '<div class="inline-block" style="margin: 6px;">';
184  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
185  {
186  $langs->load("errors");
187  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
188  }
189  else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
190  print '</div>';
191  print '<div class="inline-block" style="margin: 6px;">';
192  if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
193  {
194  $langs->load("errors");
195  print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
196  }
197  else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
198  print '</div>';
199  print '<div class="clearboth">';
200  print '<div class="inline-block" style="margin: 6px;">';
201  ?>
202  <input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
203  <?php
204  print $langs->trans("DateDue").' :';
205  print $form->selectDate(-1,'txtDatePaiement',0,0,0,'paymentmode',1,0);
206  print '</div>';
207  ?>
208  </div>
209 </fieldset>
210 </form>
211 
212 <script type="text/javascript">
213 /* Calendar.setup ({
214  inputField : "txtDatePaiement",
215  ifFormat : "%Y-%m-%d",
216  button : "btnCalendrier"
217  });
218 */
219  if (document.getElementById('frmFacturation').txtRef.value) {
220 
221  modif();
222  document.getElementById('frmQte').txtQte.focus();
223  document.getElementById('frmQte').txtQte.select();
224 
225  } else {
226 
227  document.getElementById('frmFacturation').txtRef.focus();
228 
229  }
230 
231 </script>
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
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.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
type
Definition: viewcat.php:284
Class to manage third parties objects (customers, suppliers, prospects...)
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...