From 832a3895988fd243a1646b351979cc66b468449b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Nov 2010 16:07:52 +0000 Subject: [PATCH] Qual: Field for amount into pos module tmp table are same type than others amount --- htdocs/cashdesk/affContenu.php | 4 +-- htdocs/cashdesk/class/Facturation.class.php | 8 ++--- htdocs/cashdesk/javascript/facturation1.js | 20 ++++++------ htdocs/cashdesk/sql/llx_pos_tmp.sql | 32 +++++++++++++++++++ htdocs/cashdesk/sql/llx_tmp_caisse.sql | 18 ----------- htdocs/cashdesk/tpl/facturation1.tpl.php | 10 ++++-- htdocs/cashdesk/tpl/liste_articles.tpl.php | 2 +- htdocs/cashdesk/tpl/ticket.tpl.php | 2 +- htdocs/cashdesk/validation_verif.php | 2 +- .../install/mysql/migration/2.9.0-3.0.0.sql | 19 +++++++++-- htdocs/lib/price.lib.php | 22 ++++++------- 11 files changed, 85 insertions(+), 54 deletions(-) create mode 100755 htdocs/cashdesk/sql/llx_pos_tmp.sql delete mode 100644 htdocs/cashdesk/sql/llx_tmp_caisse.sql diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 914ba152bdd..1ade459055e 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2008 Jeremie Ollivier * Copyright (C) 2008-2009 Laurent Destailleur * Copyright (C) 2009 Regis Houssin - * + * * 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 * the Free Software Foundation; either version 2 of the License, or @@ -30,7 +30,7 @@ require ('class/Facturation.class.php'); if ( $_GET['id'] == 'NOUV' ) { unset($_SESSION['serObjFacturation']); - $db->query ('DELETE FROM '.MAIN_DB_PREFIX.'tmp_caisse'); + $db->query ('DELETE FROM '.MAIN_DB_PREFIX.'pos_tmp'); } // Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ... diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index c5b0eb9a21a..fd55c4996c7 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -126,7 +126,7 @@ class Facturation { $montant_remise_ht = ($resultarray[6] - $resultarray[0]); $this->montant_remise ($montant_remise_ht); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."tmp_caisse ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."pos_tmp ("; $sql.= "fk_article"; $sql.= ", qte"; $sql.= ", fk_tva"; @@ -157,14 +157,14 @@ class Facturation { } /** - * Suppression du panier d'un article identifie par son id dans la table llx_tmp_caisse + * Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp * @param aArticle */ public function supprArticle($aArticle) { global $db; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."tmp_caisse"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."pos_tmp"; $sql.= " WHERE id = ".$aArticle; $sql.= " LIMIT 1"; @@ -179,7 +179,7 @@ class Facturation { { global $db; - $res = $db->query ('SELECT remise, total_ht, total_ttc, taux FROM '.MAIN_DB_PREFIX.'tmp_caisse as c + $res = $db->query ('SELECT remise, total_ht, total_ttc, taux FROM '.MAIN_DB_PREFIX.'pos_tmp as c LEFT JOIN '.MAIN_DB_PREFIX.'c_tva as t ON c.fk_tva = t.rowid ORDER BY id'); diff --git a/htdocs/cashdesk/javascript/facturation1.js b/htdocs/cashdesk/javascript/facturation1.js index e3acea156c2..bbb8c903adf 100644 --- a/htdocs/cashdesk/javascript/facturation1.js +++ b/htdocs/cashdesk/javascript/facturation1.js @@ -1,5 +1,5 @@ -/* Copyright (C) 2007-2008 Jérémie Ollivier +/* Copyright (C) 2007-2008 Jeremie Ollivier * * 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 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// Calcul et affichage en temps réel des informations sur le produit en cours +// Calcul et affichage en temps reel des informations sur le produit en cours function modif () { var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value ); @@ -26,7 +26,7 @@ function modif () { var remise = parseInt ( document.getElementById('frmQte').txtRemise.value ); var stock = document.getElementById('frmQte').txtStock.value; -// // On s'assure que la quantitée tapée ne dépasse pas le stock +// // On s'assure que la quantitee tapee ne depasse pas le stock // if ( qte > stock ) { // // qte = stock; @@ -51,7 +51,7 @@ function modif () { // Calcul du total HT, sans remise var total_ht = Math.round ( (prix_unit * qte) * 100 ) / 100; - // Calcul du montant de la remise, après s'être assuré que cette dernière ne soit pas négative + // Calcul du montant de la remise, apres s'etre assure que cette derniere ne soit pas negative if ( remise <= 0 ) { document.getElementById('frmQte').txtRemise.value = 0; @@ -66,12 +66,12 @@ function modif () { // Recalcul du montant total, avec la remise var total = Math.round ( (total_ht - montant_remise) *100 ) / 100; - // Affichage du résultat dans le formulaire + // Affichage du resultat dans le formulaire document.getElementById('frmQte').txtTotal.value = total.toFixed(2); } -// Affecte la source de la requete (liste déroulante ou champ texte 'ref') au champ caché +// Affecte la source de la requete (liste deroulante ou champ texte 'ref') au champ cache function setSource (aSrc) { document.getElementById('frmFacturation').hdnSource.value = aSrc; @@ -79,7 +79,7 @@ function setSource (aSrc) { } -// Vérification de la cohérence des informations saisies dans le formulaire de choix du nombre d'articles +// Verification de la coherence des informations saisies dans le formulaire de choix du nombre d'articles function verifSaisie () { if ( document.getElementById('frmQte').txtQte.value ) { @@ -95,7 +95,7 @@ function verifSaisie () { } -// Vérification de la cohérence des informations saisies dans le formulaire de calcul de la différence +// Verification de la coherence des informations saisies dans le formulaire de calcul de la difference function verifDifference () { var du = parseFloat ( document.getElementById('frmDifference').txtDu.value ); @@ -118,14 +118,14 @@ function verifDifference () { } -// Affecte le moyen de paiement (ESP, CB ou CHQ) au champ caché en fonction du bouton cliqué +// Affecte le moyen de paiement (ESP, CB ou CHQ) au champ cache en fonction du bouton clique function verifClic (aChoix) { document.getElementById('frmDifference').hdnChoix.value = aChoix; } -// Détermination du moyen de paiement, et validation du formulaire si les données sont cohérentes +// Determination du moyen de paiement, et validation du formulaire si les donnees sont coherentes function verifReglement () { var choix = document.getElementById('frmDifference').hdnChoix.value; diff --git a/htdocs/cashdesk/sql/llx_pos_tmp.sql b/htdocs/cashdesk/sql/llx_pos_tmp.sql new file mode 100755 index 00000000000..ed8e939ce70 --- /dev/null +++ b/htdocs/cashdesk/sql/llx_pos_tmp.sql @@ -0,0 +1,32 @@ +-- =========================================================================== +-- Copyright (C) 2010 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- =========================================================================== + +CREATE TABLE llx_pos_tmp ( + id integer NOT NULL auto_increment, + fk_article integer NOT NULL, + qte real NOT NULL, + fk_tva integer NOT NULL, + remise_percent real NOT NULL, + remise real NOT NULL, + total_ht double(24,8) NOT NULL, + total_tva double(24,8) NOT NULL, + total_ttc double(24,8) NOT NULL, + PRIMARY KEY (id) +) ENGINE=innodb; diff --git a/htdocs/cashdesk/sql/llx_tmp_caisse.sql b/htdocs/cashdesk/sql/llx_tmp_caisse.sql deleted file mode 100644 index 589f92af5a9..00000000000 --- a/htdocs/cashdesk/sql/llx_tmp_caisse.sql +++ /dev/null @@ -1,18 +0,0 @@ - --- -------------------------------------------------------- - --- --- Structure de la table `llx_tmp_caisse` --- - -CREATE TABLE llx_tmp_caisse ( - id integer NOT NULL auto_increment, - fk_article integer NOT NULL, - qte integer NOT NULL, - fk_tva integer NOT NULL, - remise_percent integer NOT NULL, - remise float NOT NULL, - total_ht float NOT NULL, - total_ttc float NOT NULL, - PRIMARY KEY (id) -) ENGINE=innodb; diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 265c23ace60..3e518683896 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -98,9 +98,13 @@ $Id$
- - - + + + + + + + diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 962d9deb3dc..b90ccf46bfc 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. query ( - 'SELECT id, ref, label, qte, price, remise_percent, remise, total_ht, total_ttc, tva_tx FROM '.MAIN_DB_PREFIX.'tmp_caisse as c + 'SELECT id, ref, label, qte, price, remise_percent, remise, total_ht, total_ttc, tva_tx FROM '.MAIN_DB_PREFIX.'pos_tmp as c LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON c.fk_article = p.rowid ORDER BY id'); diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index caee15aa890..906ce9c40fd 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -140,7 +140,7 @@ switch ( $_GET['action'] ) // Recuperation de la liste des articles du panier $res=$db->query (' SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc - FROM '.MAIN_DB_PREFIX.'tmp_caisse + FROM '.MAIN_DB_PREFIX.'pos_tmp WHERE 1'); $ret=array(); $i=0; while ( $tab = $db->fetch_array($res) ) diff --git a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql index 7a901b4447a..8b2b836fc57 100644 --- a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql +++ b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql @@ -53,9 +53,6 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN rang integer DEFAULT 0 AFTER special_c ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_order integer; ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_invoice integer; - -ALTER TABLE llx_tmp_caisse MODIFY fk_article integer NOT NULL; - ALTER TABLE llx_propaldet ADD COLUMN fk_parent_line integer NULL AFTER fk_propal; ALTER TABLE llx_commandedet ADD COLUMN fk_parent_line integer NULL AFTER fk_commande; ALTER TABLE llx_facturedet ADD COLUMN fk_parent_line integer NULL AFTER fk_facture; @@ -106,3 +103,19 @@ UPDATE llx_societe SET canvas = 'individual' WHERE canvas = 'individual@thirdpar insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS','7','chaine','Tolérance de retard avant alerte (en jours) sur commandes fournisseurs non traitées',0); ALTER TABLE llx_actioncomm ADD COLUMN fulldayevent smallint NOT NULL default 0 after priority; + +-- Enhance POS module +DROP TABLE llx_tmp_caisse; +CREATE TABLE llx_pos_tmp ( + id integer NOT NULL auto_increment, + fk_article integer NOT NULL, + qte real NOT NULL, + fk_tva integer NOT NULL, + remise_percent real NOT NULL, + remise real NOT NULL, + total_ht double(24,8) NOT NULL, + total_tva double(24,8) NOT NULL, + total_ttc double(24,8) NOT NULL, + PRIMARY KEY (id) +) ENGINE=innodb; + diff --git a/htdocs/lib/price.lib.php b/htdocs/lib/price.lib.php index 82488525c97..49e4eeb7ec8 100644 --- a/htdocs/lib/price.lib.php +++ b/htdocs/lib/price.lib.php @@ -26,17 +26,17 @@ /** - * \brief Calculate totals (net, vat, ...) of a line. - * \param qty Quantity - * \param pu Unit price (HT or TTC selon price_base_type) - * \param remise_percent_ligne Discount for line - * \param txtva Vat rate - * \param txlocaltax1 Localtax1 rate (used for some countries only, like spain) - * \param txlocaltax2 Localtax2 rate (used for some countries only, like spain) - * \param remise_percent_global 0 - * \param price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC - * \param info_bits Miscellanous informations on line - * \return result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) + * Calculate totals (net, vat, ...) of a line. + * @param qty Quantity + * @param pu Unit price (HT or TTC selon price_base_type) + * @param remise_percent_ligne Discount for line + * @param txtva Vat rate + * @param txlocaltax1 Localtax1 rate (used for some countries only, like spain) + * @param txlocaltax2 Localtax2 rate (used for some countries only, like spain) + * @param remise_percent_global 0 + * @param price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC + * @param info_bits Miscellanous informations on line + * @return result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) */ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $txlocaltax1=0, $txlocaltax2=0, $remise_percent_global=0, $price_base_type='HT', $info_bits=0) {
trans("Qty"); ?>trans("Stock"); ?>trans("PriceUHT"); ?>trans("VATRate"); ?>trans("Discount"); ?> (%)trans("TotalHT"); ?>
trans("Qty"); ?>trans("Stock"); ?>trans("PriceUHT"); ?>trans("VATRate"); ?>trans("Discount"); ?> (%)trans("TotalHT"); ?>