Fix: Use the numbering module of Dolibarr.

This commit is contained in:
Laurent Destailleur 2009-09-27 21:10:09 +00:00
parent 45c013e663
commit 46d1a735b0
12 changed files with 82 additions and 89 deletions

View File

@ -69,21 +69,21 @@ if ( $nbr_enreg > 1 ) {
if ( $nbr_enreg > $conf_taille_listes ) { if ( $nbr_enreg > $conf_taille_listes ) {
$top_liste_produits = '----- '.$conf_taille_listes.' produits affiches sur un total de '.$nbr_enreg.' -----'; $top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("Products").' '.$langs->trans("on").' '.$nbr_enreg.' -----';
} else { } else {
$top_liste_produits = '----- '.$nbr_enreg.' produits affiches sur un total de '.$nbr_enreg.' -----'; $top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("Products").' '.$langs->trans("on").' '.$nbr_enreg.' -----';
} }
} else if ( $nbr_enreg == 1 ) { } else if ( $nbr_enreg == 1 ) {
$top_liste_produits = '----- 1 article trouve -----'; $top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound"). ' -----';
} else { } else {
$top_liste_produits = '----- Aucun article trouve -----'; $top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound"). ' -----';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,13 +16,16 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
include('../master.inc.php');
require ('include/environnement.php');
// Verification include('../master.inc.php');
if ( strlen ($_GET["code"]) > 1 ) { require ('include/environnement.php');
$res = $sql->query ( $langs->load("@cashdesk");
// Verification
if ( strlen ($_GET["code"]) > 1 ) {
$res = $sql->query (
"SELECT ".MAIN_DB_PREFIX."product.rowid, ref, label, tva_tx "SELECT ".MAIN_DB_PREFIX."product.rowid, ref, label, tva_tx
FROM ".MAIN_DB_PREFIX."product FROM ".MAIN_DB_PREFIX."product
LEFT JOIN ".MAIN_DB_PREFIX."product_stock ON ".MAIN_DB_PREFIX."product.rowid = ".MAIN_DB_PREFIX."product_stock.fk_product LEFT JOIN ".MAIN_DB_PREFIX."product_stock ON ".MAIN_DB_PREFIX."product.rowid = ".MAIN_DB_PREFIX."product_stock.fk_product
@ -33,45 +36,44 @@
OR label LIKE '%".$_GET['code']."%' OR label LIKE '%".$_GET['code']."%'
ORDER BY label"); ORDER BY label");
if ( $nbr = $sql->num_rows($res) ) { if ( $nbr = $sql->num_rows($res) ) {
$resultat = '<ul class="dhtml_bloc">'; $resultat = '<ul class="dhtml_bloc">';
$ret=array(); $i=0; $ret=array(); $i=0;
while ( $tab = $sql->fetch_array($res) ) while ( $tab = $sql->fetch_array($res) )
{
foreach ( $tab as $cle => $valeur )
{ {
foreach ( $tab as $cle => $valeur ) $ret[$i][$cle] = $valeur;
{
$ret[$i][$cle] = $valeur;
}
$i++;
} }
$tab=$ret; $i++;
}
$tab=$ret;
for ( $i = 0; $i < count ($tab); $i++ ) { for ( $i = 0; $i < count ($tab); $i++ ) {
$resultat .= ' $resultat .= '
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'" <li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
onMouseOver="javascript: this.className = \'dhtml_selection\';" onMouseOver="javascript: this.className = \'dhtml_selection\';"
onMouseOut="javascript: this.className = \'dhtml_defaut\';" onMouseOut="javascript: this.className = \'dhtml_defaut\';"
">'.htmlentities($tab[$i]['ref'].' - '.$tab[$i]['label']).'</li> ">'.htmlentities($tab[$i]['ref'].' - '.$tab[$i]['label']).'</li>
'; ';
} }
$resultat .= '</ul>'; $resultat .= '</ul>';
echo $resultat; echo $resultat;
} else { } else {
echo ('
echo ('
<ul class="dhtml_bloc"> <ul class="dhtml_bloc">
<li class="dhtml_defaut">'.htmlentities ('Aucun r<EFBFBD>sultat').'</li> <li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>
</ul> </ul>
'); ');
}
} }
}
?> ?>

View File

@ -80,7 +80,7 @@ switch ( $_GET['action'] ) {
} }
$redirection = 'affIndex.php?menu=facturation&filtre='.$filtre; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$filtre;
} else { } else {
@ -88,11 +88,11 @@ switch ( $_GET['action'] ) {
if ( $_POST['hdnSource'] == 'REF' ) { if ( $_POST['hdnSource'] == 'REF' ) {
$redirection = 'affIndex.php?menu=facturation&filtre='.$_POST['txtRef']; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$_POST['txtRef'];
} else { } else {
$redirection = 'affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
} }
@ -100,7 +100,7 @@ switch ( $_GET['action'] ) {
} else { } else {
$redirection = 'affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
} }
@ -112,13 +112,13 @@ switch ( $_GET['action'] ) {
$obj_facturation->remise_percent($_POST['txtRemise']); $obj_facturation->remise_percent($_POST['txtRemise']);
$obj_facturation->ajoutArticle(); $obj_facturation->ajoutArticle();
$redirection = 'affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
break; break;
case 'suppr_article': case 'suppr_article':
$obj_facturation->supprArticle($_GET['suppr_id']); $obj_facturation->supprArticle($_GET['suppr_id']);
$redirection = 'affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
break; break;
} }

View File

@ -34,7 +34,7 @@ include('../master.inc.php');
if ( $_SESSION['uid'] > 0 ) if ( $_SESSION['uid'] > 0 )
{ {
header ('Location: affIndex.php'); header ('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
exit; exit;
} }
@ -44,7 +44,7 @@ if ( $_SESSION['uid'] > 0 )
<html> <html>
<head> <head>
<title>Caisse : identification</title> <title>Point of Sale login</title>
<meta name="robots" content="none" /> <meta name="robots" content="none" />
@ -76,11 +76,11 @@ if ( $_SESSION['uid'] > 0 )
<table> <table>
<tr> <tr>
<td class="label1">Nom d'utilisateur</td> <td class="label1"><?php echo $langs->trans("Login"); ?></td>
<td><input name="txtUsername" class="texte_login" type="text" value="<?php echo $_GET['user']; ?>" /></td> <td><input name="txtUsername" class="texte_login" type="text" value="<?php echo $_GET['user']; ?>" /></td>
</tr> </tr>
<tr> <tr>
<td class="label1">Mot de passe</td> <td class="label1"><?php echo $langs->trans("Password"); ?></td>
<td><input name="pwdPassword" class="texte_login" type="password" value="" /></td> <td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
</tr> </tr>

View File

@ -52,11 +52,11 @@ if ( $retour >= 0 ) {
$_SESSION['nom'] = $tab['name']; $_SESSION['nom'] = $tab['name'];
$_SESSION['prenom'] = $tab['firstname']; $_SESSION['prenom'] = $tab['firstname'];
header ('Location: affIndex.php?menu=facturation&id=NOUV'); header ('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
} else { } else {
header ('Location: index.php?err='.$retour.'&user='.$username); header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.$retour.'&user='.$username);
} }

View File

@ -13,3 +13,7 @@ AddThisArticle=Add this article
RestartSelling=Go back on sell RestartSelling=Go back on sell
SellFinished=Sell finished SellFinished=Sell finished
PrintTicket=Print ticket PrintTicket=Print ticket
NoResults=No results
NoProductFound=No article found
ProductFound=product found
ProductsFound=products found

View File

@ -13,3 +13,7 @@ AddThisArticle=Ajouter cet article
RestartSelling=Reprendre la vente RestartSelling=Reprendre la vente
SellFinished=Vente terminée SellFinished=Vente terminée
PrintTicket=Imprimer ticket PrintTicket=Imprimer ticket
NoResults=Aucun résultat
NoProductFound=Aucun article trouvé
ProductFound=produit trouvé
ProductsFound=produits trouvés

View File

@ -310,7 +310,7 @@ p.titre {
} }
.texte_ref { .texte_ref {
width: 100px; width: 80px;
} }
.texte1,.texte1_off { .texte1,.texte1_off {

View File

@ -1,6 +1,7 @@
<?php <?php
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("@cashdesk");
?> ?>
<!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> <!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
@ -110,11 +111,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();"> <form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<table> <table>
<tr><th class="label1"><?php echo $langs->trans("Qty"); ?></th><th class="label1"><?php echo $langs->trans("Stock"); ?></th><th class="label1"><?php echo $langs->trans("PriceUHT"); ?></th><th></th><th class="label1"><?php echo $langs->trans("VATRate"); ?></th><th class="label1"><?php echo $langs->trans("Discount"); ?> (%)</th><th class="label1"><?php echo $langs->trans("TotalHT"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("Qty"); ?></th>
<th class="label1"><?php echo $langs->trans("Stock"); ?></th>
<th class="label1"><?php echo $langs->trans("PriceUHT"); ?></th><th></th><th class="label1"><?php echo $langs->trans("VATRate"); ?></th><th class="label1"><?php echo $langs->trans("Discount"); ?> (%)</th><th class="label1"><?php echo $langs->trans("TotalHT"); ?></th></tr>
<tr> <tr>
<td><input class="texte1" type="text" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" /></td> <td><input class="texte1" type="text" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" /></td>
<!-- Affichage du stock pour l'article courant --> <!-- Affichage du stock pour l'article courant -->
<td><input class="texte1_off" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled="disabled" /></td> <td>
<input class="texte1_off" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled="disabled" />
</td>
<!-- Affichage du prix unitaire --> <!-- Affichage du prix unitaire -->
<td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo number_format( $obj_facturation->prix(), 2, '.', '') ?>" disabled="disabled" /></td> <td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo number_format( $obj_facturation->prix(), 2, '.', '') ?>" disabled="disabled" /></td>
<td>&#8364;</td> <td>&#8364;</td>

View File

@ -1,7 +1,7 @@
<?php <?php
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("cashdesk"); $langs->load("@cashdesk");
?> ?>
<!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> <!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
@ -71,7 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
} else { } else {
echo ('<p class="cadre_aucun_article">Aucun article pour le moment</p>'."\n"); echo ('<p class="cadre_aucun_article">'.$langs->trans("NoArticle").'</p>'."\n");
} }

View File

@ -42,7 +42,10 @@ print '<li class="menu_choix2"><a href="'.eregi_replace('cashdesk','',$conf_url_
print '<li class="menu_choix0">'.$langs->trans("User").' : '.$_SESSION['prenom'].' '.$_SESSION['nom'].' <a href="deconnexion.php">'.$logout.'</a><br>'; print '<li class="menu_choix0">'.$langs->trans("User").' : '.$_SESSION['prenom'].' '.$_SESSION['nom'].' <a href="deconnexion.php">'.$logout.'</a><br>';
print $langs->trans("CashDeskThirdParty").' : '.$company->getNomUrl(1).'<br>'; print $langs->trans("CashDeskThirdParty").' : '.$company->getNomUrl(1).'<br>';
print $langs->trans("CashDeskBank").' : '.$bank->getNomUrl(1).'<br>'; print $langs->trans("CashDeskBank").' : '.$bank->getNomUrl(1).'<br>';
print $langs->trans("CashDeskWarehouse").' : '.$warehouse->getNomUrl(1); if ($conf->stock->enabled)
{
print $langs->trans("CashDeskWarehouse").' : '.$warehouse->getNomUrl(1);
}
print '</li></ul>'; print '</li></ul>';
print '</div>'; print '</div>';
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,8 +18,9 @@
*/ */
require ('../master.inc.php'); require ('../master.inc.php');
require ('include/environnement.php'); require (DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
require ('classes/Facturation.class.php'); require (DOL_DOCUMENT_ROOT.'/cashdesk/classes/Facturation.class.php');
require (DOL_DOCUMENT_ROOT.'/Facture.class.php');
$obj_facturation = unserialize ($_SESSION['serObjFacturation']); $obj_facturation = unserialize ($_SESSION['serObjFacturation']);
unset ($_SESSION['serObjFacturation']); unset ($_SESSION['serObjFacturation']);
@ -28,46 +29,20 @@ switch ( $_GET['action'] ) {
default: default:
$redirection = 'affIndex.php?menu=validation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=validation';
break; break;
case 'valide_achat': case 'valide_achat':
// R<>cup<75>ration du dernier num<75>ro de facture $company=new Societe($db);
$res = $sql->query ( $company->fetch($conf->global->CASHDESK_ID_THIRDPARTY);
"SELECT facnumber
FROM ".MAIN_DB_PREFIX."facture
WHERE facnumber LIKE 'FA%'
ORDER BY rowid DESC");
if ( $sql->num_rows ($res) ) { $invoice=new Facture($db);
$invoice->date=dol_now('tzserver');
$ret=array(); $invoice->type=0;
$tab = $sql->fetch_array($res); $num=$invoice->getNextNumRef($company);
foreach ( $tab as $cle => $valeur )
{
$ret[$cle] = $valeur;
}
$tab_num_facture = $ret;
$tab = explode ('-', $tab_num_facture['facnumber']);
$num_txt = $tab[1];
$num = $num_txt + 1;
// Formatage du num<75>ro sur quatre caract<63>res
if ( $num < 1000 ) { $num = '0'.$num; }
if ( $num < 100 ) { $num = '0'.$num; }
if ( $num < 10 ) { $num = '0'.$num; }
$obj_facturation->num_facture ('FA'.date('ym').'-'.$num);
} else {
$obj_facturation->num_facture ( 'FA'.date('ym').'-0001' );
}
$obj_facturation->num_facture($num);
$obj_facturation->mode_reglement ($_POST['hdnChoix']); $obj_facturation->mode_reglement ($_POST['hdnChoix']);