PageRenderTime 58ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/cashdesk/tpl/facturation1.tpl.php

https://bitbucket.org/speedealing/speedealing
PHP | 251 lines | 200 code | 23 blank | 28 comment | 14 complexity | a4dc46ca126dc5fcf47a8853c2e088fb MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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. *
  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. */
  20. $langs->load("main");
  21. $langs->load("bills");
  22. $langs->load("cashdesk");
  23. ?>
  24. <script type="text/javascript" src="javascript/facturation1.js"></script>
  25. <script type="text/javascript" src="javascript/dhtml.js"></script>
  26. <!-- ========================= Cadre "Article" ============================= -->
  27. <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Article"); ?></legend>
  28. <form id="frmFacturation" class="formulaire1" method="post" action="facturation_verif.php" autocomplete="off">
  29. <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
  30. <input type="hidden" name="hdnSource" value="NULL" />
  31. <table>
  32. <tr><th class="label1"><?php echo $langs->trans("Code"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
  33. <tr>
  34. <!-- Affichage de la reference et de la designation -->
  35. <td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
  36. onchange="javascript: setSource('REF');"
  37. onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value);"
  38. onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
  39. </td>
  40. <td class="select_design">
  41. <?php /*
  42. $selected='';
  43. $htmlname='idprod';
  44. $status=-1;
  45. $rice_level=$company->price_level;
  46. 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);
  47. if (! $hidelabel) print $langs->trans("RefOrLabel").' : ';
  48. print '<input type="text" size="4" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
  49. */
  50. ?>
  51. <select id="selProduit" name="selProduit" onchange="javascript: setSource('LISTE');">
  52. <?php
  53. print '<option value="0">'.$top_liste_produits.'</option>'."\n";
  54. $id = $obj_facturation->id();
  55. // Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
  56. if ( $nbr_enreg > $conf_taille_listes ) {
  57. for ($i = 0; $i < $conf_taille_listes; $i++) {
  58. if ( $id == $tab_designations[$i]['rowid'] )
  59. $selected = 'selected="selected"';
  60. else
  61. $selected = '';
  62. $label = $tab_designations[$i]['label'];
  63. print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
  64. if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')';
  65. print '</option>'."\n ";
  66. }
  67. // ... sinon on affiche tout
  68. } else {
  69. for ($i = 0; $i < $nbr_enreg; $i++) {
  70. if ( $id == $tab_designations[$i]['rowid'] )
  71. $selected = 'selected="selected"';
  72. else
  73. $selected = '';
  74. $label = $tab_designations[$i]['label'];
  75. print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
  76. 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']).')';
  77. print '</option>'."\n ";
  78. }
  79. }
  80. ?>
  81. </select>
  82. </td>
  83. </tr>
  84. <tr><td><div id="resultats_dhtml"></div></td></tr>
  85. </table>
  86. </form>
  87. <form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
  88. <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
  89. <table>
  90. <tr><th><?php echo $langs->trans("Qty"); ?></th>
  91. <th><?php echo $langs->trans("Stock"); ?></th>
  92. <th><?php echo $langs->trans("PriceUHT"); ?></th>
  93. <th></th>
  94. <th><?php echo $langs->trans("Discount"); ?> (%)</th>
  95. <th><?php echo $langs->trans("TotalHT"); ?></th>
  96. <th>&nbsp;</th>
  97. <th><?php echo $langs->trans("VATRate"); ?></th>
  98. </tr>
  99. <tr>
  100. <td><input class="texte1" type="text" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" /></td>
  101. <!-- Affichage du stock pour l'article courant -->
  102. <td>
  103. <input class="texte1_off" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled="disabled" />
  104. </td>
  105. <!-- Affichage du prix unitaire -->
  106. <td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" disabled="disabled" /></td>
  107. <td><?php echo $conf->currency; ?></td>
  108. <!-- Choix de la remise -->
  109. <td><input class="texte1" type="text" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/></td>
  110. <!-- Affichage du total HT -->
  111. <td><input class="texte1_off" type="text" name="txtTotal" value="" disabled="disabled" /></td><td><?php echo $conf->currency; ?></td>
  112. <!-- Choix du taux de TVA -->
  113. <td class="select_tva">
  114. <select name="selTva" onchange="javascript: modif();" >
  115. <?php
  116. $tva_tx = $obj_facturation->tva();
  117. $tab_tva_size=count($tab_tva);
  118. for($i=0;$i < $tab_tva_size;$i++) {
  119. if ( $tva_tx == $tab_tva[$i]['taux'] )
  120. $selected = 'selected="selected"';
  121. else
  122. $selected = '';
  123. echo ('<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ");
  124. }
  125. ?>
  126. </select>
  127. </td>
  128. </tr>
  129. </table>
  130. <input class="bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
  131. </form>
  132. </fieldset>
  133. <!-- ========================= Cadre "Difference" ============================= -->
  134. <form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=valide_achat">
  135. <input type="hidden" name="hdnChoix" value="" />
  136. <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
  137. <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
  138. <table>
  139. <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>
  140. <tr>
  141. <!-- Affichage du montant du -->
  142. <td><input class="texte2_off" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled="disabled" /></td>
  143. <!-- Choix du montant encaisse -->
  144. <td><input class="texte2" type="text" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" /></td>
  145. <!-- Affichage du montant rendu -->
  146. <td><input class="texte2_off" type="text" name="txtRendu" value="0" disabled="disabled" /></td>
  147. </tr>
  148. <tr>
  149. </table>
  150. </fieldset>
  151. <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("PaymentMode"); ?></legend>
  152. <table>
  153. <tr>
  154. <?php
  155. print '<td>';
  156. if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
  157. {
  158. $langs->load("errors");
  159. print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
  160. }
  161. else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
  162. print '</td>';
  163. print '<td>';
  164. if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
  165. {
  166. $langs->load("errors");
  167. print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
  168. }
  169. else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
  170. print '</td>';
  171. print '<td>';
  172. if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
  173. {
  174. $langs->load("errors");
  175. print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cheque").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
  176. }
  177. else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cheque").'" onclick="javascript: verifClic(\'CHQ\');" />';
  178. print '</td>';
  179. ?>
  180. </tr>
  181. </table>
  182. <table>
  183. <tr>
  184. <td>
  185. <input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
  186. <?php echo $langs->trans("DateEcheance"); ?> :
  187. <?php
  188. $form=new Form($db);
  189. print $form->select_date(-1,'txtDatePaiement');
  190. ?>
  191. <!-- <input class="texte2" type="text" id="txtDatePaiement" name="txtDatePaiement" value="" />
  192. <input class="bouton_cal" type="image" src="img/calendrier.png" id="btnCalendrier" value="..." title="<?php echo $langs->trans("CalTip"); ?>" />
  193. -->
  194. </td>
  195. </tr>
  196. </table>
  197. </fieldset>
  198. </form>
  199. <script type="text/javascript">
  200. /* Calendar.setup ({
  201. inputField : "txtDatePaiement",
  202. ifFormat : "%Y-%m-%d",
  203. button : "btnCalendrier"
  204. });
  205. */
  206. if (document.getElementById('frmFacturation').txtRef.value) {
  207. modif();
  208. document.getElementById('frmQte').txtQte.focus();
  209. document.getElementById('frmQte').txtQte.select();
  210. } else {
  211. document.getElementById('frmFacturation').txtRef.focus();
  212. }
  213. </script>