Qual: Field for amount into pos module tmp table are same type than others amount
This commit is contained in:
parent
84ad4c0578
commit
832a389598
@ -30,7 +30,7 @@ require ('class/Facturation.class.php');
|
|||||||
if ( $_GET['id'] == 'NOUV' )
|
if ( $_GET['id'] == 'NOUV' )
|
||||||
{
|
{
|
||||||
unset($_SESSION['serObjFacturation']);
|
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 ...
|
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class Facturation {
|
|||||||
$montant_remise_ht = ($resultarray[6] - $resultarray[0]);
|
$montant_remise_ht = ($resultarray[6] - $resultarray[0]);
|
||||||
$this->montant_remise ($montant_remise_ht);
|
$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.= "fk_article";
|
||||||
$sql.= ", qte";
|
$sql.= ", qte";
|
||||||
$sql.= ", fk_tva";
|
$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
|
* @param aArticle
|
||||||
*/
|
*/
|
||||||
public function supprArticle($aArticle)
|
public function supprArticle($aArticle)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tmp_caisse";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."pos_tmp";
|
||||||
$sql.= " WHERE id = ".$aArticle;
|
$sql.= " WHERE id = ".$aArticle;
|
||||||
$sql.= " LIMIT 1";
|
$sql.= " LIMIT 1";
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ class Facturation {
|
|||||||
{
|
{
|
||||||
global $db;
|
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
|
LEFT JOIN '.MAIN_DB_PREFIX.'c_tva as t ON c.fk_tva = t.rowid
|
||||||
ORDER BY id');
|
ORDER BY id');
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* Copyright (C) 2007-2008 Jérémie Ollivier <jeremie.o@laposte.net>
|
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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,7 +16,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 () {
|
function modif () {
|
||||||
|
|
||||||
var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value );
|
var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value );
|
||||||
@ -26,7 +26,7 @@ function modif () {
|
|||||||
var remise = parseInt ( document.getElementById('frmQte').txtRemise.value );
|
var remise = parseInt ( document.getElementById('frmQte').txtRemise.value );
|
||||||
var stock = document.getElementById('frmQte').txtStock.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 ) {
|
// if ( qte > stock ) {
|
||||||
//
|
//
|
||||||
// qte = stock;
|
// qte = stock;
|
||||||
@ -51,7 +51,7 @@ function modif () {
|
|||||||
// Calcul du total HT, sans remise
|
// Calcul du total HT, sans remise
|
||||||
var total_ht = Math.round ( (prix_unit * qte) * 100 ) / 100;
|
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 ) {
|
if ( remise <= 0 ) {
|
||||||
|
|
||||||
document.getElementById('frmQte').txtRemise.value = 0;
|
document.getElementById('frmQte').txtRemise.value = 0;
|
||||||
@ -66,12 +66,12 @@ function modif () {
|
|||||||
// Recalcul du montant total, avec la remise
|
// Recalcul du montant total, avec la remise
|
||||||
var total = Math.round ( (total_ht - montant_remise) *100 ) / 100;
|
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);
|
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) {
|
function setSource (aSrc) {
|
||||||
|
|
||||||
document.getElementById('frmFacturation').hdnSource.value = 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 () {
|
function verifSaisie () {
|
||||||
|
|
||||||
if ( document.getElementById('frmQte').txtQte.value ) {
|
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 () {
|
function verifDifference () {
|
||||||
|
|
||||||
var du = parseFloat ( document.getElementById('frmDifference').txtDu.value );
|
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) {
|
function verifClic (aChoix) {
|
||||||
|
|
||||||
document.getElementById('frmDifference').hdnChoix.value = 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 () {
|
function verifReglement () {
|
||||||
|
|
||||||
var choix = document.getElementById('frmDifference').hdnChoix.value;
|
var choix = document.getElementById('frmDifference').hdnChoix.value;
|
||||||
|
|||||||
32
htdocs/cashdesk/sql/llx_pos_tmp.sql
Executable file
32
htdocs/cashdesk/sql/llx_pos_tmp.sql
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
-- ===========================================================================
|
||||||
|
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- 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;
|
||||||
@ -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;
|
|
||||||
@ -98,9 +98,13 @@ $Id$
|
|||||||
<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>
|
<tr><th><?php echo $langs->trans("Qty"); ?></th>
|
||||||
<th class="label1"><?php echo $langs->trans("Stock"); ?></th>
|
<th><?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>
|
<th><?php echo $langs->trans("PriceUHT"); ?></th>
|
||||||
|
<th></th>
|
||||||
|
<th ><?php echo $langs->trans("VATRate"); ?></th>
|
||||||
|
<th><?php echo $langs->trans("Discount"); ?> (%)</th>
|
||||||
|
<th><?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 -->
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Recuperation du contenu de la vente
|
// Recuperation du contenu de la vente
|
||||||
$request='SELECT id, ref, label, qte, price, remise_percent, remise, total_ht, total_ttc FROM '.MAIN_DB_PREFIX.'tmp_caisse as c
|
$request='SELECT id, ref, label, qte, price, remise_percent, remise, total_ht, total_ttc FROM '.MAIN_DB_PREFIX.'pos_tmp as c
|
||||||
LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON c.fk_article = p.rowid
|
LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON c.fk_article = p.rowid
|
||||||
ORDER BY id';
|
ORDER BY id';
|
||||||
dol_syslog($request);
|
dol_syslog($request);
|
||||||
|
|||||||
@ -116,7 +116,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$res = $db->query (
|
$res = $db->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
|
LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON c.fk_article = p.rowid
|
||||||
ORDER BY id');
|
ORDER BY id');
|
||||||
|
|
||||||
|
|||||||
@ -140,7 +140,7 @@ switch ( $_GET['action'] )
|
|||||||
// Recuperation de la liste des articles du panier
|
// Recuperation de la liste des articles du panier
|
||||||
$res=$db->query ('
|
$res=$db->query ('
|
||||||
SELECT fk_article, qte, fk_tva, remise_percent, remise, total_ht, total_ttc
|
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');
|
WHERE 1');
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = $db->fetch_array($res) )
|
while ( $tab = $db->fetch_array($res) )
|
||||||
|
|||||||
@ -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_order integer;
|
||||||
ALTER TABLE llx_actioncomm ADD COLUMN fk_supplier_invoice 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_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_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;
|
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);
|
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;
|
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;
|
||||||
|
|
||||||
|
|||||||
@ -26,17 +26,17 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Calculate totals (net, vat, ...) of a line.
|
* Calculate totals (net, vat, ...) of a line.
|
||||||
* \param qty Quantity
|
* @param qty Quantity
|
||||||
* \param pu Unit price (HT or TTC selon price_base_type)
|
* @param pu Unit price (HT or TTC selon price_base_type)
|
||||||
* \param remise_percent_ligne Discount for line
|
* @param remise_percent_ligne Discount for line
|
||||||
* \param txtva Vat rate
|
* @param txtva Vat rate
|
||||||
* \param txlocaltax1 Localtax1 rate (used for some countries only, like spain)
|
* @param txlocaltax1 Localtax1 rate (used for some countries only, like spain)
|
||||||
* \param txlocaltax2 Localtax2 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 remise_percent_global 0
|
||||||
* \param price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
|
* @param price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
|
||||||
* \param info_bits Miscellanous informations on line
|
* @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)
|
* @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)
|
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)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user