task #11278: Option into point of sale module to add services in list

This commit is contained in:
Juanjo Menent 2011-08-26 14:52:00 +00:00
parent 44eebeca76
commit db012b467d
7 changed files with 50 additions and 22 deletions

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -19,7 +20,7 @@
* \file htdocs/cashdesk/admin/cashdesk.php
* \ingroup cashdesk
* \brief Setup page for cashdesk module
* \version $Id: cashdesk.php,v 1.7 2011/08/03 00:46:38 eldy Exp $
* \version $Id: cashdesk.php,v 1.8 2011/08/26 14:52:00 simnandez Exp $
*/
require("../../main.inc.php");
@ -45,23 +46,37 @@ $langs->load("cashdesk");
/*
* Actions
*/
if ($_POST["action"] == 'set')
if (GETPOST("action") == 'set')
{
if ($_POST["socid"] < 0) $_POST["socid"]='';
if ($_POST["CASHDESK_ID_BANKACCOUNT"] < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]='';
if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';
$db->begin();
if (GETPOST("socid") < 0) $_POST["socid"]='';
/*if (GETPOST("CASHDESK_ID_BANKACCOUNT") < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]='';
if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/
dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["socid"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",$_POST["CASHDESK_ID_BANKACCOUNT_CASH"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",$_POST["CASHDESK_ID_BANKACCOUNT_CHEQUE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",$_POST["CASHDESK_ID_BANKACCOUNT_CB"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"],'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST("socid"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST("CASHDESK_ID_BANKACCOUNT_CB"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST("CASHDESK_ID_WAREHOUSE"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST("CASHDESK_SERVICES"),'chaine',0,'',$conf->entity);
dol_syslog("admin/cashdesk: level ".$_POST["level"]);
dol_syslog("admin/cashdesk: level ".GETPOST("level"));
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/*
* View
*/
@ -121,6 +136,13 @@ if ($conf->stock->enabled)
print '</td></tr>';
}
$var=! $var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("CashdeskShowServices");
print '<td colspan="2">';;
print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1);
print "</td></tr>\n";
print '</table>';
print '<br>';
@ -128,5 +150,7 @@ print '<center><input type="submit" class="button" value="'.$langs->trans("Save"
print "</form>\n";
llxFooter('$Date: 2011/08/03 00:46:38 $ - $Revision: 1.7 $');
dol_htmloutput_mesg($mesg);
llxFooter('$Date: 2011/08/26 14:52:00 $ - $Revision: 1.8 $');
?>

View File

@ -21,7 +21,7 @@
* \file htdocs/cashdesk/facturation.php
* \ingroup cashdesk
* \brief Include to show main page for cashdesk module
* \version $Id: facturation.php,v 1.19 2011/07/31 22:23:27 eldy Exp $
* \version $Id: facturation.php,v 1.20 2011/08/26 14:52:00 simnandez Exp $
*/
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
@ -30,12 +30,12 @@ if ( $_GET['filtre'] ) {
// Avec filtre
$ret=array(); $i=0;
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.tosell = 1";
$sql.= " AND p.fk_product_type = 0";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " AND (p.ref LIKE '%".$_GET['filtre']."%' OR p.label LIKE '%".$_GET['filtre']."%' ";
if ($conf->barcode->enabled) $sql.= " OR p.barcode='".$_GET['filtre']."')";
else $sql.= ")";
@ -66,12 +66,12 @@ if ( $_GET['filtre'] ) {
$ret=array();
$i=0;
$sql = "SELECT p.rowid, ref, label, tva_tx";
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.tosell = 1";
$sql.= " AND p.fk_product_type = 0";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " ORDER BY p.label";
dol_syslog($sql);

View File

@ -21,7 +21,7 @@ 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, see <http://www.gnu.org/licenses/>.
$Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $
$Id: facturation1.tpl.php,v 1.16 2011/08/26 14:52:00 simnandez Exp $
-->
<script type="text/javascript" src="javascript/facturation1.js"></script>
<script type="text/javascript" src="javascript/dhtml.js"></script>
@ -73,7 +73,7 @@ $Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $
$label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
if ($conf->stock->enabled && !empty($conf_fkentrepot)) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')';
if ($conf->stock->enabled && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')';
print '</option>'."\n ";
}
@ -91,7 +91,7 @@ $Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $
$label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
if ($conf->stock->enabled && !empty($conf_fkentrepot)) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
if ($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']).')';
print '</option>'."\n ";
}

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancari (efectiu)
CashDeskBankCB=Compte bancari (targetes)
CashDeskBankCheque=Compte bancari (xecs)
CashDeskWarehouse=Magatzem
CashdeskShowServices=Vendre serveis
CashDeskProducts=Productes
CashDeskStock=Estoc
CashDeskOn=de

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Bank account (cash)
CashDeskBankCB=Bank account (card)
CashDeskBankCheque=Bank account (cheque)
CashDeskWarehouse=Warehouse
CashdeskShowServices=Selling services
CashDeskProducts=Products
CashDeskStock=Stock
CashDeskOn=on

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Cuenta bancaria (efectivo)
CashDeskBankCB=Cuenta bancaria (tarjetas)
CashDeskBankCheque=Cuenta bancaria (cheques)
CashDeskWarehouse=Almacén
CashdeskShowServices=Vender servicios
CashDeskProducts=Productos
CashDeskStock=Stock
CashDeskOn=de

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancaire (liquide)
CashDeskBankCB=Compte bancaire (cartes)
CashDeskBankCheque=Compte bancaire (chèques)
CashDeskWarehouse=Entrepôt
CashdeskShowServices=Vendre des services
CashDeskProducts=Produits
CashDeskStock=Stock
CashDeskOn=de