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