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