Removed old simple POS module ('cashdesk' module)

This commit is contained in:
Laurent Destailleur 2021-08-17 04:57:53 +02:00
parent 4b89a45ade
commit 92d6ad9597
43 changed files with 5 additions and 4239 deletions

View File

@ -1,191 +0,0 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/admin/cashdesk.php
* \ingroup cashdesk
* \brief Setup page for cashdesk module
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
// If socid provided by ajax company selector
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
}
// Security check
if (!$user->admin) {
accessforbidden();
}
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
/*
* Actions
*/
if (GETPOST('action', 'alpha') == 'set') {
$db->begin();
if (GETPOST('socid', 'int') < 0) {
$_POST["socid"] = '';
}
$res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE", (GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", GETPOST('CASHDESK_NO_DECREASE_STOCK', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_DOLIBAR_RECEIPT_PRINTER", GETPOST('CASHDESK_DOLIBAR_RECEIPT_PRINTER', 'alpha'), 'chaine', 0, '', $conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
if (!($res > 0)) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form = new Form($db);
$formproduct = new FormProduct($db);
llxHeader('', $langs->trans("CashDeskSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("CashDeskSetup").' (SimplePOS)', $linkback, 'title_setup');
print '<br>';
// Mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
if (!empty($conf->service->enabled)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><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>';
}
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Terminal").' 0</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client in (1,3) AND s.status = 1)', 1, 0, 0, array(), 0);
print '</td></tr>';
if (!empty($conf->banque->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE, 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", 1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1);
print '</td></tr>';
}
if (!empty($conf->stock->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
print '<td colspan="2">';
if (empty($conf->productbatch->enabled)) {
print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1);
} else {
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
}
print $langs->trans("Yes").'<br>';
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
}
print '</td></tr>';
$disabled = $conf->global->CASHDESK_NO_DECREASE_STOCK;
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value)
print '<td colspan="2">';
if (!$disabled) {
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled);
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>';
} else {
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
}
print '</td></tr>';
}
// Use Dolibarr Receipt Printer
if (!empty($conf->receiptprinter->enabled)) {
print '<tr class="oddeven"><td>';
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
print '<td colspan="2">';
print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER", $conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER, 1);
print "</td></tr>\n";
}
print '</table>';
print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
print "</form>\n";
// End of page
llxFooter();
$db->close();

View File

@ -1,100 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affContenu.php
* \ingroup cashdesk
* \brief Include to show main page for cashdesk module
*/
require_once 'class/Facturation.class.php';
// Si nouvelle vente, reinitialisation des donnees (destruction de l'objet et vidage de la table contenant la liste des articles)
if (GETPOST('id', 'int') == 'NOUV') {
unset($_SESSION['serObjFacturation']);
unset($_SESSION['poscart']);
}
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
if (isset($_SESSION['serObjFacturation'])) {
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
} else {
// ... sinon, c'est une nouvelle vente
$obj_facturation = new Facturation();
}
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
// $obj_facturation contains data for all invoice total + selection of current product
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
$total_ttc = $obj_facturation->amountWithTax();
/*var_dump($obj_facturation);
var_dump($_SESSION['poscart']);
var_dump($total_ttc);
exit;*/
// Left area with selected articles (area for article, amount and payments)
print '<div class="inline-block" style="vertical-align: top">';
print '<div class="principal">';
$page = GETPOST('menutpl', 'alpha');
if (empty($page)) {
$page = 'facturation';
}
if (in_array(
$page,
array(
'deconnexion',
'index', 'index_verif', 'facturation', 'facturation_verif', 'facturation_dhtml',
'validation', 'validation_ok', 'validation_ticket', 'validation_verif',
)
)) {
include $page.'.php';
} else {
dol_print_error('', 'menu param '.$page.' is not inside allowed list');
}
print '</div>';
print '</div>';
// Right area with selected articles (shopping cart)
print '<div class="inline-block" style="vertical-align: top">';
print '<div class="liste_articles">';
require 'tpl/liste_articles.tpl.php';
print '</div>';
print '</div>';
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -1,78 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* 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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affIndex.php
* \ingroup cashdesk
* \brief First page of point of sale module
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php';
$error = GETPOST('error');
// Test if already logged
if ($_SESSION['uid'] <= 0) {
header('Location: index.php');
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("companies", "compta", "cashdesk"));
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
$arrayofjs = array();
$arrayofcss = array('/cashdesk/css/style.css');
top_htmlhead($head, $langs->trans("CashDesk"), 0, 0, $arrayofjs, $arrayofcss);
print '<body>'."\n";
if (!empty($error)) {
dol_htmloutput_events();
}
print '<div class="conteneur">'."\n";
print '<div class="conteneur_img_gauche">'."\n";
print '<div class="conteneur_img_droite">'."\n";
print '<div class="menu_principal">'."\n";
include_once 'tpl/menu.tpl.php';
print '</div>'."\n";
print '<div class="contenu">'."\n";
include_once 'affContenu.php';
print '</div>'."\n";
include_once 'affPied.php';
print '</div></div></div>'."\n";
print '</body></html>'."\n";

View File

@ -1,52 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affPied.php
* \ingroup cashdesk
* \brief Bottom of main page of point of sale module
*/
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
?>
<!-- affPied.php -->
<div class="pied">
<?php
// Wrapper to show tooltips
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) {
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
tooltipClass: "mytooltip",
content: function () {
return $(this).prop(\'title\'); /* To force to get title as is */
}
});
});
</script>' . "\n";
}
printCommonFooter('private');
?>
</div>

View File

@ -1,144 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* Class ot manage authentication for pos module (cashdesk)
*/
class Auth
{
protected $db;
private $login;
private $passwd;
private $reponse;
public $sqlQuery;
/**
* Enter description here ...
*
* @param DoliDB $db Database handler
* @return void
*/
public function __construct($db)
{
$this->db = $db;
$this->reponse(null);
}
/**
* Enter description here ...
*
* @param string $aLogin Login
* @return void
*/
public function login($aLogin)
{
$this->login = $aLogin;
}
/**
* Enter description here ...
*
* @param string $aPasswd Password
* @return void
*/
public function passwd($aPasswd)
{
$this->passwd = $aPasswd;
}
/**
* Enter description here ...
*
* @param string $aReponse Response
* @return void
*/
public function reponse($aReponse)
{
$this->reponse = $aReponse;
}
/**
* Validate login/pass
*
* @param string $aLogin Login
* @param string $aPasswd Password
* @return int 0 or 1
*/
public function verif($aLogin, $aPasswd)
{
global $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_auto_user;
$ret = -1;
$login = '';
$test = true;
// Authentication mode
if (empty($dolibarr_main_authentication)) {
$dolibarr_main_authentication = 'http,dolibarr';
}
// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
$dolibarr_auto_user = 'auto';
}
// Set authmode
$authmode = explode(',', $dolibarr_main_authentication);
// No authentication mode
if (!count($authmode)) {
$langs->load('main');
dol_print_error('', $langs->trans("ErrorConfigParameterNotDefined", 'dolibarr_main_authentication'));
exit;
}
$usertotest = $aLogin;
$passwordtotest = $aPasswd;
$entitytotest = $conf->entity;
// Validation tests user / password
// If ok, the variable will be initialized login
// If error, we will put error message in session under the name dol_loginmesg
$goontestloop = false;
if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
$goontestloop = true;
}
if (isset($aLogin) || GETPOST('openid_mode', 'alpha', 1)) {
$goontestloop = true;
}
if ($test && $goontestloop) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
if ($login) {
$this->login($aLogin);
$this->passwd($aPasswd);
$ret = 0;
} else {
$ret = -1;
}
}
return $ret;
}
}

View File

@ -1,558 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2010 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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
/**
* Class to manage invoices for pos module (cashdesk)
*/
class Facturation
{
/**
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
* int $id => 'rowid' du produit dans llx_product
* string $ref => 'ref' du produit dans llx_product
* int $qte => Quantite pour le produit en cours de traitement
* int $stock => Stock theorique pour le produit en cours de traitement
* int $remise_percent => Remise en pourcent sur le produit en cours
* int $montant_remise => Remise en pourcent sur le produit en cours
* int $prix => Prix HT du produit en cours
* int $tva => 'rowid' du taux de tva dans llx_c_tva
*/
/**
* @var int ID
*/
public $id;
protected $ref;
protected $qte;
protected $stock;
protected $remise_percent;
protected $montant_remise;
protected $prix;
protected $tva;
/**
* Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation)
* string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX)
* string $mode_reglement => Mode de reglement (ESP, CB ou CHQ)
* int $montant_encaisse => Montant encaisse en cas de reglement en especes
* int $montant_rendu => Monnaie rendue en cas de reglement en especes
* int $paiement_le => Date de paiement en cas de paiement differe
*
* int $prix_total_ht => Prix total hors taxes
* int $montant_tva => Montant total de la TVA, tous taux confondus
* int $prix_total_ttc => Prix total TTC
*/
protected $num_facture;
protected $mode_reglement;
protected $montant_encaisse;
protected $montant_rendu;
protected $paiement_le;
protected $prix_total_ht;
protected $montant_tva;
protected $prix_total_ttc;
/**
* Constructor
*/
public function __construct()
{
$this->raz();
$this->razPers();
}
// Data processing methods
/**
* Add a product into cart
*
* @return void
*/
public function ajoutArticle()
{
global $conf, $db, $mysoc;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$product = new Product($db);
$product->fetch($this->id);
$vatrowid = $this->tva();
$tmp = getTaxesFromId($vatrowid);
$txtva = $tmp['rate'].(empty($tmp['code']) ? '' : ' ('.$tmp['code'].')');
$vat_npr = $tmp['npr'];
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg)) {
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Define part of HT, VAT, TTC
$resultarray = calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $vat_npr, $product->type, $mysoc, $localtaxarray);
// Calculation of total HT without discount
$total_ht = $resultarray[0];
$total_vat = $resultarray[1];
$total_ttc = $resultarray[2];
$total_localtax1 = $resultarray[9];
$total_localtax2 = $resultarray[10];
// Calculation of the discount amount
if ($this->remisePercent()) {
$remise_percent = $this->remisePercent();
} else {
$remise_percent = 0;
}
$montant_remise_ht = ($resultarray[6] - $resultarray[0]);
$this->amountDiscount($montant_remise_ht);
$newcartarray = $_SESSION['poscart'];
$i = 0;
if (!is_null($newcartarray) && !empty($newcartarray)) {
$i = count($newcartarray);
}
$newcartarray[$i]['id'] = $i;
$newcartarray[$i]['ref'] = $product->ref;
$newcartarray[$i]['label'] = $product->label;
$newcartarray[$i]['price'] = $product->price;
$newcartarray[$i]['price_ttc'] = $product->price_ttc;
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
if (isset($product->multiprices[$societe->price_level])) {
$newcartarray[$i]['price'] = $product->multiprices[$societe->price_level];
$newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
}
}
$newcartarray[$i]['fk_article'] = $this->id;
$newcartarray[$i]['qte'] = $this->qte();
$newcartarray[$i]['fk_tva'] = $this->tva(); // Vat rowid
$newcartarray[$i]['remise_percent'] = $remise_percent;
$newcartarray[$i]['remise'] = price2num($montant_remise_ht);
$newcartarray[$i]['total_ht'] = price2num($total_ht, 'MT');
$newcartarray[$i]['total_ttc'] = price2num($total_ttc, 'MT');
$newcartarray[$i]['total_vat'] = price2num($total_vat, 'MT');
$newcartarray[$i]['total_localtax1'] = price2num($total_localtax1, 'MT');
$newcartarray[$i]['total_localtax2'] = price2num($total_localtax2, 'MT');
$_SESSION['poscart'] = $newcartarray;
$this->raz();
}
/**
* Remove a product from panel
*
* @param int $aArticle Id of line into cart to remove
* @return void
*/
public function supprArticle($aArticle)
{
$poscart = $_SESSION['poscart'];
$j = 0;
$newposcart = array();
foreach ($poscart as $key => $val) {
if ($poscart[$key]['id'] != $aArticle) {
$newposcart[$j] = $poscart[$key];
$newposcart[$j]['id'] = $j;
$j++;
}
}
unset($poscart);
//var_dump($poscart);exit;
$_SESSION['poscart'] = $newposcart;
}
/**
* Calculation of total HT, total TTC and VAT amounts
*
* @return int Total
*/
public function calculTotaux()
{
global $db;
$total_ht = 0;
$total_ttc = 0;
$total_vat = 0;
$total_localtax1 = 0;
$total_localtax2 = 0;
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
// Total HT
$remise = $tab[$i]['remise'];
$total_ht += ($tab[$i]['total_ht']);
$total_vat += ($tab[$i]['total_vat']);
$total_ttc += ($tab[$i]['total_ttc']);
$total_localtax1 += ($tab[$i]['total_localtax1']);
$total_localtax2 += ($tab[$i]['total_localtax2']);
}
$this->prix_total_ttc = $total_ttc;
$this->prix_total_ht = $total_ht;
$this->prix_total_vat = $total_vat;
$this->prix_total_localtax1 = $total_localtax1;
$this->prix_total_localtax2 = $total_localtax2;
$this->montant_tva = $total_ttc - $total_ht;
//print 'total: '.$this->prix_total_ttc; exit;
}
/**
* Reset attributes
*
* @return void
*/
public function raz()
{
$this->id('RESET');
$this->ref('RESET');
$this->qte('RESET');
$this->stock('RESET');
$this->remisePercent('RESET');
$this->amountDiscount('RESET');
$this->prix('RESET');
$this->tva('RESET');
}
/**
* Resetting persistent attributes
*
* @return void
*/
private function razPers()
{
$this->numInvoice('RESET');
$this->getSetPaymentMode('RESET');
$this->amountCollected('RESET');
$this->amountReturned('RESET');
$this->paiementLe('RESET');
$this->amountWithoutTax('RESET');
$this->amountVat('RESET');
$this->amountWithTax('RESET');
}
// Methods for modifying protected attributes
/**
* Getter for id
*
* @param int $aId Id
* @return int Id
*/
public function id($aId = null)
{
if (!$aId) {
return $this->id;
} elseif ($aId == 'RESET') {
$this->id = null;
} else {
$this->id = $aId;
}
}
/**
* Getter for ref
*
* @param string $aRef Ref
* @return string Ref
*/
public function ref($aRef = null)
{
if (is_null($aRef)) {
return $this->ref;
} elseif ($aRef == 'RESET') {
$this->ref = null;
} else {
$this->ref = $aRef;
}
}
/**
* Getter for qte
*
* @param int $aQte Qty
* @return int Qty
*/
public function qte($aQte = null)
{
if (is_null($aQte)) {
return $this->qte;
} elseif ($aQte == 'RESET') {
$this->qte = null;
} else {
$this->qte = $aQte;
}
}
/**
* Getter for stock
*
* @param string $aStock Stock
* @return string Stock
*/
public function stock($aStock = null)
{
if (is_null($aStock)) {
return $this->stock;
} elseif ($aStock == 'RESET') {
$this->stock = null;
} else {
$this->stock = $aStock;
}
}
/**
* Getter for remise_percent
*
* @param string $aRemisePercent Discount
* @return string Discount
*/
public function remisePercent($aRemisePercent = null)
{
if (is_null($aRemisePercent)) {
return $this->remise_percent;
} elseif ($aRemisePercent == 'RESET') {
$this->remise_percent = null;
} else {
$this->remise_percent = $aRemisePercent;
}
}
/**
* Getter for montant_remise
*
* @param int $aMontantRemise Amount
* @return string Amount
*/
public function amountDiscount($aMontantRemise = null)
{
if (is_null($aMontantRemise)) {
return $this->montant_remise;
} elseif ($aMontantRemise == 'RESET') {
$this->montant_remise = null;
} else {
$this->montant_remise = $aMontantRemise;
}
}
/**
* Getter for prix
*
* @param int $aPrix Price
* @return string Stock
*/
public function prix($aPrix = null)
{
if (is_null($aPrix)) {
return $this->prix;
} elseif ($aPrix == 'RESET') {
$this->prix = null;
} else {
$this->prix = $aPrix;
}
}
/**
* Getter for tva
*
* @param int $aTva Vat
* @return int Vat
*/
public function tva($aTva = null)
{
if (is_null($aTva)) {
return $this->tva;
} elseif ($aTva == 'RESET') {
$this->tva = null;
} else {
$this->tva = $aTva;
}
}
/**
* Get num invoice
*
* @param string $aNumFacture Invoice ref
* @return string Invoice ref
*/
public function numInvoice($aNumFacture = null)
{
if (is_null($aNumFacture)) {
return $this->num_facture;
} elseif ($aNumFacture == 'RESET') {
$this->num_facture = null;
} else {
$this->num_facture = $aNumFacture;
}
}
/**
* Get payment mode
*
* @param int $aModeReglement Payment mode
* @return int Payment mode
*/
public function getSetPaymentMode($aModeReglement = null)
{
if (is_null($aModeReglement)) {
return $this->mode_reglement;
} elseif ($aModeReglement == 'RESET') {
$this->mode_reglement = null;
} else {
$this->mode_reglement = $aModeReglement;
}
}
/**
* Get amount
*
* @param int $aMontantEncaisse Amount
* @return int Amount
*/
public function amountCollected($aMontantEncaisse = null)
{
if (is_null($aMontantEncaisse)) {
return $this->montant_encaisse;
} elseif ($aMontantEncaisse == 'RESET') {
$this->montant_encaisse = null;
} else {
$this->montant_encaisse = $aMontantEncaisse;
}
}
/**
* Get amount
*
* @param int $aMontantRendu Amount
* @return int Amount
*/
public function amountReturned($aMontantRendu = null)
{
if (is_null($aMontantRendu)) {
return $this->montant_rendu;
} elseif ($aMontantRendu == 'RESET') {
$this->montant_rendu = null;
} else {
$this->montant_rendu = $aMontantRendu;
}
}
/**
* Get payment date
*
* @param integer $aPaiementLe Date
* @return integer Date
*/
public function paiementLe($aPaiementLe = null)
{
if (is_null($aPaiementLe)) {
return $this->paiement_le;
} elseif ($aPaiementLe == 'RESET') {
$this->paiement_le = null;
} else {
$this->paiement_le = $aPaiementLe;
}
}
/**
* Get total HT
*
* @param int $aTotalHt Total amount
* @return int Total amount
*/
public function amountWithoutTax($aTotalHt = null)
{
if (is_null($aTotalHt)) {
return $this->prix_total_ht;
} elseif ($aTotalHt == 'RESET') {
$this->prix_total_ht = null;
} else {
$this->prix_total_ht = $aTotalHt;
}
}
/**
* Get amount vat
*
* @param int $aMontantTva Amount vat
* @return int Amount vat
*/
public function amountVat($aMontantTva = null)
{
if (is_null($aMontantTva)) {
return $this->montant_tva;
} elseif ($aMontantTva == 'RESET') {
$this->montant_tva = null;
} else {
$this->montant_tva = $aMontantTva;
}
}
/**
* Get total TTC
*
* @param int $aTotalTtc Amount ttc
* @return int Amount ttc
*/
public function amountWithTax($aTotalTtc = null)
{
if (is_null($aTotalTtc)) {
return $this->prix_total_ttc;
} elseif ($aTotalTtc == 'RESET') {
$this->prix_total_ttc = null;
} else {
$this->prix_total_ttc = $aTotalTtc;
}
}
}

View File

@ -1,455 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
body {
background: #fff;
color: #333;
margin: 0;
padding: 0;
}
p {
margin: 0;
}
.conteneur {
background: #fff;
text-align: left;
/*max-width: 770px;*/
/*margin: 10px auto;
border: 2px solid #000;*/
}
.conteneur_img_gauche {
/* background: url("../img/bg_conteneur_gauche.png") top left repeat-y; */
}
.conteneur_img_droite {
/* background: url("../img/bg_conteneur_droite.png") top right repeat-y; */
}
.contenu {
width: 100%;
text-align: center;
padding-top: 20px;
}
.logo {
text-align: center;
}
.logopos {
padding-top: 20px;
max-height: 40px;
}
/* ------------------- Header ------------------- */
.entete {
height: 15px;
margin: 0;
/* background: url('../img/bg_entete.png') no-repeat left top; */
}
.entete span {
display: none;
}
.principal_login td.label1 {
width: 50%;
}
/* ------------------- Menu ------------------- */
.menu_principal {
margin: 0;
font-size: 14px;
height: 84px;
background: #CCCCCC;
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(40,40,40,.3)) );
}
.menu_bloc {
margin-left: 12px;
}
.menu {
margin: 0;
list-style-type: none;
padding: 8px 0 0;
}
.menu li {
float: left;
padding-right: 10px;
}
.menu_choix0 {
font-size: 10px;
text-align: right;
font-style: italic;
font-weight: normal;
display: block;
color: #333;
text-decoration: none;
padding-right: 5px;
}
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
.menu_choix0 {
max-width: 180px;
}
}
.menu_choix0 a {
font-weight: normal;
text-decoration: none;
}
li.menu_choix0 {
float: right;
}
/* ------------------- Remind of products ------------------- */
.liste_articles {
min-width: 215px;
float: right;
margin-top: 8px;
margin-right: 20px;
border: 1px dotted #5ca64d;
padding-bottom: 10px;
vertical-align: middle;
}
p.titre {
margin: 0 0 20px;
text-align: center;
font-weight: bold;
font-size: 1.4em;
color: #5ca64d;
border-bottom: 1px dotted;
}
.cadre_article {
width: 180px;
text-align: center;
margin: 0 auto 10px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
.cadre_article p {
color: #5ca64d;
}
.cadre_article p a {
color: #333;
font-size: 1.1em;
text-decoration: none;
padding-right: 25px;
background: url('../img/basket_delete.png') top right no-repeat;
}
.cadre_article p a:hover {
color: #6d3f6d;
}
.cadre_aucun_article {
text-align: center;
font-style: italic;
}
.cadre_prix_total {
text-align: center;
font-weight: bold;
font-size: 1.4em;
color: #6d3f6d;
padding-top: 10px;
padding-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
border: 1px dotted #6d3f6d;
}
/* ------------------- Contenu ------------------- */
.principal_login {
margin: 10px;
padding: 0;
max-width: 800px;
text-align: left;
}
.formulaire_login {
text-align: center;
}
.formulaire_login table {
padding-left: 60px;
margin: 0 auto 20px;
background: url('../img/login.png') bottom left no-repeat;
}
.formulaire_login table tr {
height: 30px;
}
.texte_login {
padding-left: 2px;
padding-right: 2px;
background: #fff;
border: 1px solid #6d3f6d;
}
.principal {
float: left;
margin: 0 15px;
padding: 0;
max-width: 900px;
}
.blocksellfinished {
min-width: 215px;
margin-top: 8px;
}
.titre1 {
font-weight: bold;
color: #ff9900;
margin: 0;
font-size: 1.4em;
}
.label1 {
color: #333;
font-size: 1.1em;
}
.cadre_facturation {
border: 2px solid #ddd;
margin-bottom: 15px;
}
.principal p {
padding-left: 10px;
padding-right: 10px;
}
.lien1 {
color: #333;
font-size: 1.1em;
text-decoration: underline;
}
.lien1:hover {
color: #6d3f6d;
}
/* Formulaires */
.formulaire1 {
padding: 0;
}
/* --------------------- Combo lists ------------------- */
.select_design {
overflow: auto;
}
.select_design select {
border: 1px solid #6d3f6d;
font: 12px verdana,arial,helvetica;
background: #fff;
}
.select_tva select {
width: 60px;
border: 1px solid #6d3f6d;
background: #fff;
}
.top_liste {
font-style: italic;
text-align: center;
color: #aaa;
}
/* --------------- Champs texte ---------------- */
.texte_ref,.texte1,.texte1_off,.texte2,.texte2_off,.textarea_note {
padding-left: 2px;
padding-right: 2px;
}
.texte_ref,.texte1,.texte2,.textarea_note {
background: #fff;
border: 1px solid #6d3f6d;
}
.texte1_off,.texte2_off {
color: #000;
border: 1px solid #eee;
background: #eee;
}
.texte_ref {
min-width: 150px;
}
.texte1,.texte1_off {
width: 60px;
}
.texte2,.texte2_off {
width: 140px;
}
/* ------------------- */
.textarea_note {
width: 100%;
height: 50px;
padding: 2px 2px;
}
/* -------------- Buttons for SimplePOS --------------------- */
.bouton_ajout_article {
margin-top: 10px;
width: 60%;
height: 40px;
}
.bouton_mode_reglement, .bouton_mode_reglement_disabled {
width: 150px;
height: 40px;
}
.bouton_validation { /* width: 80px; */
margin-left: 10px;
margin-top: 20px;
margin-bottom: 10px;
}
.formulaire2 {
padding: 0;
width: 100%;
}
.table_resume {
width: 100%;
}
.table_resume tr {
background: #eee;
}
.table_resume td {
padding-left: 8px;
}
.resume_label,.note_label {
min-width: 200px;
font-weight: bold;
font-size: 1.1em;
}
.note_label {
padding-top: 20px;
}
/* ------------------- Pied de page ------------------- */
.pied {
clear: both;
height: 15px;
/* background: url('../img/bg_pied.png') no-repeat bottom left; */
}
/* ------------------- Param<61>tres communs (messages d'erreur, informations, etc...) ------------------- */
.msg_err1 {
color: #c00;
}
/* Messages d'erreur */
.cadre_err1 {
margin-right: 10px;
margin-bottom: 10px;
padding: 10px 10px;
border: 1px solid #c00;
background: #feffac;
color: #c00;
}
/* Titre */
.err_titre {
font-weight: bold;
margin: 0 0 10px;
padding: 0;
}
/* Description */
.err_desc {
margin: 0;
padding: 0;
}
/* Messages d'information */
.cadre_msg1 {
margin-right: 10px;
margin-bottom: 10px;
padding: 10px 10px;
border: 1px solid #070;
background: #e8f8da;
color: #070;
}
/* Titre */
.msg_titre {
font-weight: bold;
margin: 0 0 10px;
padding: 0;
}
/* Description */
.msg_desc {
margin: 0;
padding: 0;
}
/* Affichage de la liste des resultats */
.dhtml_bloc {
margin: 0;
padding: 3px;
font-size: 13px;
font-family: arial, sans-serif;
border: 1px solid #000;
z-index: 1;
width: 455px;
max-height: 500px;
overflow: auto;
position: absolute;
background-color: white;
}
.dhtml_defaut {
list-style-type: none;
display: block;
height: 16px;
overflow: hidden;
}
.dhtml_selection {
background-color: #3366cc;
color: white ! important;
}

View File

@ -1,61 +0,0 @@
/*
* TPV ticket.css
*/
body {
font-size: 1.5em;
position: relative;
}
.entete { /* position: relative; */
}
.address { /* float: left; */
font-size: 12px;
}
.date_heure {
position: absolute;
top: 0;
right: 0;
font-size: 16px;
}
.infos {
position: relative;
}
.liste_articles {
width: 100%;
border-bottom: 1px solid #000;
text-align: center;
}
.liste_articles tr.titres th {
border-bottom: 1px solid #000;
}
.liste_articles td.total {
text-align: right;
}
.totaux {
margin-top: 20px;
width: 30%;
float: right;
text-align: right;
}
.lien {
position: absolute;
top: 0;
left: 0;
display: none;
}
@media print {
.lien {
display: none;
}
}

View File

@ -1,48 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/deconnexion.php
* \ingroup cashdesk
* \brief Manage deconnexion for point of sale module
*/
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
require_once '../main.inc.php';
// This destroy tag that say "Point of Sale session is on".
unset($_SESSION['uid']);
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php');
exit;

View File

@ -1,159 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Adolfo Segura <adolfo.segura@gmail.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation.php
* \ingroup cashdesk
* \brief Include to show main page for cashdesk module
*/
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if (GETPOST('filtre', 'alpha')) {
// Avec filtre
$ret = array(); $i = 0;
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($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 = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) {
$sql .= " AND p.fk_product_type = 0";
}
$sql .= " AND (";
$sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (!empty($conf->barcode->enabled)) {
$filtre = GETPOST('filtre', 'alpha');
//If the barcode looks like an EAN13 format and the last digit is included in it,
//then whe look for the 12-digit too
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
if (strlen($filtre) == 13) {
$crit_12digit = substr($filtre, 0, 12);
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
} else {
$sql .= " OR p.barcode LIKE '%".$db->escape($filtre)."%'";
}
}
$sql .= ")";
$sql .= " ORDER BY label";
dol_syslog("facturation.php", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$nbr_enreg = $db->num_rows($resql);
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
$tab_designations = $ret;
} else {
// Sans filtre
$ret = array();
$i = 0;
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($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 = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) {
$sql .= " AND p.fk_product_type = 0";
}
$sql .= " ORDER BY p.label";
dol_syslog($sql);
$resql = $db->query($sql);
if ($resql) {
$nbr_enreg = $db->num_rows($resql);
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
$tab_designations = $ret;
}
//$nbr_enreg = count($tab_designations);
if ($nbr_enreg > 1) {
if ($nbr_enreg > $conf_taille_listes) {
$top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
} else {
$top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
}
} elseif ($nbr_enreg == 1) {
$top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound").' -----';
} else {
$top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound").' -----';
}
// Recuperation des taux de tva
global $mysoc;
$ret = array();
$i = 0;
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
$obj_facturation->getSetPaymentMode('RESET');
$obj_facturation->amountCollected('RESET');
$obj_facturation->amountReturned('RESET');
$obj_facturation->paiementLe('RESET');
// Affichage des templates
require 'tpl/facturation1.tpl.php';

View File

@ -1,129 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation_dhtml.php
* \ingroup cashdesk
* \brief This page is called each time we press a key in the code search form to show product combo list.
*/
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
// Change this following line to use the correct relative path (../, ../../, etc)
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
top_httphead('text/html');
$search = GETPOST("code", "alpha");
// Search from criteria
if (dol_strlen($search) >= 0) { // If search criteria is on char length at least
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($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 = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
$sql .= " AND p.fk_product_type = 0";
// Add criteria on ref/label
if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) {
$sql .= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'";
if (!empty($conf->barcode->enabled)) {
$sql .= " OR p.barcode LIKE '".$db->escape($search)."%'";
}
$sql .= ")";
} else {
$sql .= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'";
if (!empty($conf->barcode->enabled)) {
$sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'";
}
$sql .= ")";
}
$sql .= " ORDER BY label";
dol_syslog("facturation_dhtml.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
if ($nbr = $db->num_rows($result)) {
$resultat = '<ul class="dhtml_bloc">';
$ret = array(); $i = 0;
while ($tab = $db->fetch_array($result)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$tab = $ret;
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
$resultat .= '
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
onMouseOver="javascript: this.className = \'dhtml_selection\';"
onMouseOut="javascript: this.className = \'dhtml_defaut\';"
>'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</li>
';
}
$resultat .= '</ul>';
print $resultat;
} else {
$langs->load("cashdesk");
print '<ul class="dhtml_bloc">';
print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>';
print '</ul>';
}
}
}

View File

@ -1,225 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2018 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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation_verif.php
* \ingroup cashdesk
* \brief facturation_verif.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$action = GETPOST('action', 'aZ09');
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
switch ($action) {
default:
if (GETPOST('hdnSource') != 'NULL') {
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($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 = ".((int) $conf_fkentrepot);
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
// Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ...
if ($_POST['hdnSource'] == 'LISTE') {
$sql .= " AND p.rowid = ".((int) GETPOST('selProduit', 'int'));
} elseif ($_POST['hdnSource'] == 'REF') {
$sql .= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'";
}
$result = $db->query($sql);
if ($result) {
// ... et enregistrement dans l'objet
if ($db->num_rows($result)) {
$ret = array();
$tab = $db->fetch_array($result);
foreach ($tab as $key => $value) {
$ret[$key] = $value;
}
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
$productid = $ret['rowid'];
$product = new Product($db);
$product->fetch($productid);
$prod = $product;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $societe, $product->id);
$tva_npr = get_default_npr($mysoc, $societe, $product->id);
if (empty($tva_tx)) {
$tva_npr = 0;
}
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
// multiprix
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($societe->price_level)) {
$pu_ht = $prod->multiprices[$societe->price_level];
$pu_ttc = $prod->multiprices_ttc[$societe->price_level];
$price_min = $prod->multiprices_min[$societe->price_level];
$price_base_type = $prod->multiprices_base_type[$societe->price_level];
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
if (isset($prod->multiprices_tva_tx[$societe->price_level])) {
$tva_tx = $prod->multiprices_tva_tx[$societe->price_level];
}
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) {
$tva_npr = $prod->multiprices_recuperableonly[$societe->price_level];
}
}
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $societe->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result >= 0) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) {
$tva_npr = 0;
}
}
} else {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
}
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (!empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
}
$obj_facturation->id($ret['rowid']);
$obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']);
//$obj_facturation->prix($ret['price']);
$obj_facturation->prix($pu_ht);
$vatrate = $tva_tx;
$obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code)
// Definition du filtre pour n'afficher que le produit concerne
if (GETPOST('hdnSource') == 'LISTE') {
$filtre = $ret['ref'];
} elseif (GETPOST('hdnSource') == 'REF') {
$filtre = GETPOST('txtRef');
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode($filtre);
} else {
$obj_facturation->raz();
if (GETPOST('hdnSource') == 'REF') {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode(GETPOST('txtRef'));
} else {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
}
}
} else {
dol_print_error($db);
}
} else {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
}
break;
case 'change_thirdparty': // We have clicked on button "Modify" a thirdparty
$newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY', 'int');
if ($newthirdpartyid > 0) {
$_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid;
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
case 'ajout_article':
if (!empty($obj_facturation->id)) { // A product was previously selected and stored in session, so we can add it
dol_syslog("facturation_verif save vat ".GETPOST('selTva'));
$obj_facturation->qte(GETPOST('txtQte'));
$obj_facturation->tva(GETPOST('selTva')); // id of vat. Saved so we can use it for next product
$obj_facturation->remisePercent(GETPOST('txtRemise'));
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
// We update prixTotalTtc
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
case 'suppr_article':
$obj_facturation->supprArticle(GETPOST('suppr_id'));
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
}
// We saved object obj_facturation
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
//var_dump($_SESSION['serObjFacturation']);
header('Location: '.$redirection);
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,50 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2009-2011 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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
// This file initializes more variables to already initialized variables with main.inc.php
// So include of this file must be always done after include to main.inc.php
$conf_db_type = $dolibarr_main_db_type;
// Parametres de connexion a la base
$conf_db_host = $dolibarr_main_db_host;
$conf_db_user = $dolibarr_main_db_user;
$conf_db_pass = $dolibarr_main_db_pass;
$conf_db_base = $dolibarr_main_db_name;
// Identifiant unique correspondant au tiers generique pour la vente
$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0);
// Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
}
// Identifiant unique correspondant au compte caisse / liquide
$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0);
// Identifiant unique correspondant au compte cheque
$conf_fkaccount_cheque = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE : 0);
// Identifiant unique correspondant au compte cb
$conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CB : 0);
//var_dump($_SESSION);
// View parameters
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes

View File

@ -1,56 +0,0 @@
<?php
/* Copyright (C) 2014 Charles-FR BENKE <charles.fr@benke.fr>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* Return a string to output a keypad
*
* @param string $keypadname Key pad name
* @param string $formname Form name
* @return string HTML code to show a js keypad.
*/
function genkeypad($keypadname, $formname)
{
global $conf;
if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) {
return '';
}
// défine the font size of button
$btnsize = 32;
$sz = '<input type="button" id="closekeypad'.$keypadname.'" value="X" style="display:none;" onclick="closekeypad(\''.$keypadname.'\')"/>'."\n";
$sz .= '<input type="button" value="..." id="openkeypad'.$keypadname.'" onclick="openkeypad(\''.$keypadname.'\')"/><br>'."\n";
$sz .= '<div id="keypad'.$keypadname.'" style="position:absolute;z-index:90;display:none; background:#AAA; vertical-align:top;">'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 7 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',7);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 8 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',8);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 9 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',9);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 4 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',4);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 5 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',5);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 6 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',6);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 1 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',1);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 2 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',2);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 3 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',3);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 0 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',0);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value="&larr;" ';
$sz .= ' onclick="document.getElementById(\''.$keypadname.'\').value=document.getElementById(\''.$keypadname.'\').value.substr(0,document.getElementById(\''.$keypadname.'\').value.length-1);modif();"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value="CE" onclick="document.getElementById(\''.$keypadname.'\').value=0;modif();"/>'."\n";
$sz .= '</div>';
return $sz;
}

View File

@ -1,232 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/index.php
* \ingroup cashdesk
* \brief File to login to point of sales
*/
// Set and init common variables
// This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
// Test if user logged
if ($_SESSION['uid'] > 0) {
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
exit;
}
$usertxt = GETPOST('user', '', 1);
$err = GETPOST("err");
// Instantiate hooks of thirdparty module only if not already define
$hookmanager->initHooks(array('cashdeskloginpage'));
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
$formproduct = new FormProduct($db);
$arrayofcss = array('/cashdesk/css/style.css');
top_htmlhead('', '', 0, 0, '', $arrayofcss);
// Execute hook getLoginPageOptions (for table)
$parameters = array('entity' => GETPOST('entity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
} else {
$morelogincontent = $hookmanager->resPrint;
}
?>
<body>
<div class="conteneur">
<div class="conteneur_img_gauche">
<div class="conteneur_img_droite">
<div class="menu_principal hideonsmartphone">
<div class="logo">
<?php
if (!empty($mysoc->logo_small)) {
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
} else {
print '<div class="logopos">'.$mysoc->name.'</div>';
}
?>
</div>
</div>
<div class="contenu">
<div class="inline-block" style="vertical-align: top">
<div class="principal_login">
<?php if ($err) {
print dol_escape_htmltag($err)."<br><br>\n";
} ?>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
<form id="frmLogin" method="POST" action="index_verif.php">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<table>
<tr>
<td class="label1"><?php echo $langs->trans("Login"); ?></td>
<td><input name="txtUsername" class="texte_login maxwidth150onsmartphoneimp" type="text" value="<?php echo $usertxt; ?>" /></td>
</tr>
<tr>
<td class="label1"><?php echo $langs->trans("Password"); ?></td>
<td><input name="pwdPassword" class="texte_login maxwidth150onsmartphoneimp" type="password" value="" /></td>
</tr>
<?php
if (!empty($morelogincontent)) {
if (is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option) {
if ($format == 'table') {
echo '<!-- Option by hook -->';
echo $option;
}
}
} else {
echo '<!-- Option by hook -->';
echo $morelogincontent;
}
}
?>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<?php
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td>';
$disabled = 0;
$langs->load("companies");
if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) {
$disabled = 1; // If a particular third party is defined, we disable choice
}
print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 0, array(), 0, 'maxwidth300');
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$langs->load("stocks");
print "<tr>";
print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
print '<td>';
$disabled = 0;
if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) {
$disabled = 1; // If a particular stock is defined, we disable choice
}
print $formproduct->selectWarehouses((GETPOST('warehouseid') ?GETPOST('warehouseid', 'int') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE)), 'warehouseid', '', !$disabled, $disabled);
print '</td>';
print "</tr>\n";
}
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cash') > 0) ?GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH), 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cheque') > 0) ?GETPOST('bankid_cheque') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE), 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cb') > 0) ?GETPOST('bankid_cb') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB), 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
?>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
</table>
<br>
<div align="center"><span class="bouton_login"><input class="button" type="submit" value="<?php echo dol_escape_htmltag($langs->trans("Connection")); ?>" /></span></div>
</form>
</fieldset>
<?php
if ($_GET['err'] < 0) {
echo ('<script type="text/javascript">');
echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
echo ('</script>');
} else {
echo ('<script type="text/javascript">');
echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
echo ('</script>');
}
?>
</div>
</div>
</div>
<?php include 'affPied.php'; ?></div>
</div>
</div>
</body>
<?php
print '</html>';

View File

@ -1,126 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*
* This page is called after submission of login page.
* We set here login choices into session.
*/
/**
* \file htdocs/cashdesk/index_verif.php
* \ingroup cashdesk
* \brief index_verif.php
*/
include '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
$username = GETPOST("txtUsername");
$password = GETPOST("pwdPassword");
$thirdpartyid = (GETPOST('socid', 'int') > 0) ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY;
$warehouseid = (GETPOST("warehouseid") > 0) ?GETPOST("warehouseid", 'int') : $conf->global->CASHDESK_ID_WAREHOUSE;
$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CB", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
// Check username
if (empty($username)) {
$retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Login"));
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
// Check third party id
if (!($thirdpartyid > 0)) {
$retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("CashDeskThirdPartyForSell"));
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
// If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished.
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !($warehouseid > 0)) {
$retour = $langs->trans("CashDeskYouDidNotDisableStockDecease");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
// If stock decrease on bill validation, check user has stock edit permissions
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !empty($username)) {
$testuser = new User($db);
$testuser->fetch(0, $username);
$testuser->getrights('stock');
if (empty($testuser->rights->stock->creer)) {
$retour = $langs->trans("UserNeedPermissionToEditStockToUsePos");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
}
// Check password
$auth = new Auth($db);
$retour = $auth->verif($username, $password);
if ($retour >= 0) {
$return = array();
$sql = "SELECT rowid, lastname, firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."user";
$sql .= " WHERE login = '".$db->escape($username)."'";
$sql .= " AND entity IN (0,".$conf->entity.")";
$result = $db->query($sql);
if ($result) {
$tab = $db->fetch_array($res);
foreach ($tab as $key => $value) {
$return[$key] = $value;
}
$_SESSION['uid'] = $tab['rowid'];
$_SESSION['uname'] = $username;
$_SESSION['lastname'] = $tab['lastname'];
$_SESSION['firstname'] = $tab['firstname'];
$_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : '');
$_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
//var_dump($_SESSION);exit;
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV');
exit;
} else {
dol_print_error($db);
}
} else {
// Load translation files required by the page
$langs->loadLangs(array("other", "errors"));
$retour = $langs->trans("ErrorBadLoginPassword");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
exit;
}

View File

@ -1,73 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
// Instanciation et initialisation de l'objet xmlhttprequest
function file(fichier) {
// Instanciation de l'objet pour Mozilla, Konqueror, Opera, Safari, etc ...
if (window.XMLHttpRequest) {
xhr_object = new XMLHttpRequest ();
// ... ou pour IE
} else if (window.ActiveXObject) {
xhr_object = new ActiveXObject ("Microsoft.XMLHTTP");
} else {
return (false);
}
xhr_object.open ("GET", fichier, false);
xhr_object.send (null);
if (xhr_object.readyState == 4) {
return (xhr_object.responseText);
} else {
return (false);
}
}
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode, iLimit) {
if (aCode != '' && aCode.length >= iLimit) {
if (texte = file('facturation_dhtml.php?code='+escape(aCode))) {
document.getElementById(aCible).innerHTML = texte;
} else
document.getElementById(aCible).innerHTML = '';
}
}
// Change dynamiquement la classe de l'element ayant l'id aIdElement pour aClasse
function setStyle(aIdElement, aClasse) {
aIdElement.className = aClasse;
}

View File

@ -1,175 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
// Calcul et affichage en temps reel des informations sur le produit en cours
function modif() {
var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value );
var qte = parseFloat ( document.getElementById('frmQte').txtQte.value );
var _index = parseFloat ( document.getElementById('frmQte').selTva.selectedIndex );
var tva = parseFloat ( document.getElementById('frmQte').selTva.options[_index].text );
var remise = parseInt ( document.getElementById('frmQte').txtRemise.value );
var stock = document.getElementById('frmQte').txtStock.value;
// // On s'assure que la quantitee tapee ne depasse pas le stock
// if ( qte > stock ) {
//
// qte = stock;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
//
// if ( qte < 1 ) {
//
// qte = 1;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
//
// if ( !stock || stock <= 0 ) {
//
// qte = 0;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
// Calcul du total HT, sans remise
var total_ht = Math.round ( (prix_unit * qte) * 100 ) / 100;
// 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;
montant_remise = 0;
} else {
var montant_remise = total_ht * remise / 100;
}
// Recalcul du montant total, avec la remise
var total = Math.round ( (total_ht - montant_remise) *100 ) / 100;
// Affichage du resultat dans le formulaire
document.getElementById('frmQte').txtTotal.value = total.toFixed(2);
}
// Affecte la source de la requete (liste deroulante ou champ texte 'ref') au champ cache
function setSource(aSrc) {
document.getElementById('frmFacturation').hdnSource.value = aSrc;
document.getElementById('frmFacturation').submit();
}
// Verification de la coherence des informations saisies dans le formulaire de choix du nombre d'articles
function verifSaisie() {
if ( document.getElementById('frmQte').txtQte.value ) {
return true;
} else {
document.getElementById('frmQte').txtQte.focus();
return false;
}
}
// 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 );
var encaisse = parseFloat ( document.getElementById('frmDifference').txtEncaisse.value );
if (encaisse > du) {
resultat = Math.round ( (encaisse - du) * 100 ) / 100;
document.getElementById('frmDifference').txtRendu.value = resultat.toFixed(2);
} else if (encaisse == du) {
document.getElementById('frmDifference').txtRendu.value = '0';
} else {
document.getElementById('frmDifference').txtRendu.value = '-';
}
}
// 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;
}
// Determination du moyen de paiement, et validation du formulaire si les donnees sont coherentes
function verifReglement() {
var choix = document.getElementById('frmDifference').hdnChoix.value;
var du = parseFloat (document.getElementById('frmDifference').txtDu.value);
var encaisse = parseFloat (document.getElementById('frmDifference').txtEncaisse.value);
if ( du > 0 ) {
if ( choix == 'ESP' ) {
if ( encaisse != 0 && encaisse >= du ) {
return true;
} else {
document.getElementById('frmDifference').txtEncaisse.select();
document.getElementById('frmDifference').txtEncaisse.focus();
return false;
}
} else if ( choix == 'DIF' ) {
if ( document.getElementById('frmDifference').txtDatePaiement.value ) {
return true;
} else {
document.getElementById('frmDifference').txtDatePaiement.select();
document.getElementById('frmDifference').txtDatePaiement.focus();
return false;
}
} else {
return true;
}
} else {
return false;
}
}

View File

@ -1,36 +0,0 @@
/* Copyright (C) 2014 Charles-FR BENKE <charles.fr@benke.fr>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
function closekeypad(keypadname)
{
document.getElementById('keypad'+keypadname).style.display='none';
document.getElementById('closekeypad'+keypadname).style.display='none';
document.getElementById('openkeypad'+keypadname).style.display='inline-block';
}
function openkeypad(keypadname)
{
document.getElementById('keypad'+keypadname).style.display='inline-block';
document.getElementById('closekeypad'+keypadname).style.display='inline-block';
document.getElementById('openkeypad'+keypadname).style.display='none';
}
function addvalue(keypadname, formname, valueToAdd)
{
myform=document.forms[formname];
if (myform.elements[keypadname].value=="0")
myform.elements[keypadname].value="";
myform.elements[keypadname].value+=valueToAdd;
modif();
}

View File

@ -1,225 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "cashdesk"));
// Object $form must de defined
?>
<script type="text/javascript" src="javascript/facturation1.js"></script>
<script type="text/javascript" src="javascript/dhtml.js"></script>
<script type="text/javascript" src="javascript/keypad.js"></script>
<!-- ========================= Cadre "Article" ============================= -->
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Article"); ?></legend>
<form id="frmFacturation" class="formulaire1" method="post" action="facturation_verif.php" autocomplete="off">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<input type="hidden" name="hdnSource" value="NULL" />
<table class="center">
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr>
<!-- Affichage de la reference et de la designation -->
<!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');"
onfocus="javascript: this.select();" />
</td>
<td class="select_design maxwidthonsmartphone">
<select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
<?php
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
$id = $obj_facturation->id();
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
$nbtoshow = $nbr_enreg;
if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) {
$nbtoshow = $conf_taille_listes;
}
for ($i = 0; $i < $nbtoshow; $i++) {
if ($id == $tab_designations[$i]['rowid']) {
$selected = 'selected';
} else {
$selected = '';
}
$label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'], 16).' - '.dol_trunc($label, 35, 'middle');
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']).')';
}
print '</option>'."\n";
}
?>
</select>
</td>
</tr>
</table>
</form>
<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 newToken(); ?>" />
<table class="center">
<tr>
<th><?php echo $langs->trans("Qty"); ?></th>
<th><?php echo $langs->trans("PriceUHT"); ?></th>
<th><?php echo $langs->trans("Discount"); ?> (%)</th>
<th><?php echo $langs->trans("VATRate"); ?></th>
<th></th>
</tr>
<tr>
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtQte", "frmQte"); ?>
</td>
<!-- Show unit price -->
<?php // TODO Remove the disabled and use this value when adding product into cart ?>
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
<!-- Choix de la remise -->
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
<?php print genkeypad("txtRemise", "frmQte"); ?>
</td>
<!-- Choix du taux de TVA -->
<td class="select_tva center">
<?php
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
$buyer = new Societe($db);
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) {
$buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
}
echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
?>
</td>
<td></td>
</tr>
<tr>
<!-- Affichage du stock pour l'article courant -->
<tr>
<td><?php echo $langs->trans("Stock"); ?></td>
<td>
<input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
</td>
<td><?php echo $langs->trans("TotalHT"); ?></td>
<!-- Affichage du total HT -->
<td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
</tr>
</table>
<input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
</form>
</fieldset>
<!-- ========================= Cadre "Amount" ============================= -->
<form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=validate_sell">
<input type="hidden" name="hdnChoix" value="" />
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
<table class="centpercent">
<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>
<tr>
<!-- Affichage du montant du -->
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->amountWithTax(), 'MT'); ?>" disabled /></td>
<!-- Choix du montant encaisse -->
<td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtEncaisse", "frmDifference"); ?>
</td>
<!-- Affichage du montant rendu -->
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
</tr>
<tr>
</table>
</fieldset>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("PaymentMode"); ?></legend>
<div class="inline-block">
<?php
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
}
print '</div>';
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
}
print '</div>';
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
}
print '</div>';
print '<div class="clearboth">';
print '<div class="inline-block" style="margin: 6px;">';
?>
<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
<?php
print $langs->trans("DateDue").' :';
print $form->selectDate(-1, 'txtDatePaiement', 0, 0, 0, 'paymentmode', 1, 0);
print '</div>';
?>
</div>
</fieldset>
</form>
<script type="text/javascript">
/* Calendar.setup ({
inputField : "txtDatePaiement",
ifFormat : "%Y-%m-%d",
button : "btnCalendrier"
});
*/
if (document.getElementById('frmFacturation').txtRef.value) {
modif();
document.getElementById('frmQte').txtQte.focus();
document.getElementById('frmQte').txtQte.select();
} else {
document.getElementById('frmFacturation').txtRef.focus();
}
</script>

View File

@ -1,73 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "cashdesk"));
?>
<div class="liste_articles_haut">
<div class="liste_articles_bas">
<p class="titre"><?php echo $langs->trans("ShoppingCart"); ?></p>
<?php
/** add Ditto for MultiPrix*/
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
/** end add Ditto */
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
$tab_size = count($tab);
if ($tab_size <= 0) {
print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
} else {
for ($i = 0; $i < $tab_size; $i++) {
echo ('<div class="cadre_article">'."\n");
echo ('<p><a href="facturation_verif.php?action=suppr_article&suppr_id='.$tab[$i]['id'].'" title="'.$langs->trans("DeleteArticle").'">'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</a></p>'."\n");
if ($tab[$i]['remise_percent'] > 0) {
$remise_percent = ' -'.$tab[$i]['remise_percent'].'%';
} else {
$remise_percent = '';
}
$remise = $tab[$i]['remise'];
echo ('<p>'.$tab[$i]['qte'].' x '.price2num($tab[$i]['price'], 'MT').$remise_percent.' = '.price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT").' ('.price(price2num($tab[$i]['total_ttc'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC").')</p>'."\n");
echo ('</div>'."\n");
}
}
echo ('<p class="cadre_prix_total">'.$langs->trans("Total").' : '.price(price2num($total_ttc, 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'<br></p>'."\n");
?></div>
</div>

View File

@ -1,90 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
/*if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))
{
$company=new Societe($db);
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}*/
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$bankcash = new Account($db);
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
$bankcash->label = $bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$bankcb = new Account($db);
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
$bankcbLink = $bankcb->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$bankcheque = new Account($db);
$bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]);
$bankchequeLink = $bankcheque->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) {
$warehouse = new Entrepot($db);
$warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]);
$warehouseLink = $warehouse->getNomUrl(1);
}
// Load translation files required by the page
$langs->loadLangs(array("main", "cashdesk"));
print "\n".'<!-- menu.tpl.php -->'."\n";
print '<div class="menu_bloc">';
print '<ul class="menu">';
// Link to new sell
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span class="hideonsmartphone">'.$langs->trans("NewSell").'</span></a></li>';
// Open new tab on backoffice (this is not a disconnect from POS)
print '<li class="menu_choix2"><a href=".." target="backoffice"><span class="hideonsmartphone">'.$langs->trans("BackOffice").'</span></a></li>';
// Disconnect
print '<li class="menu_choix0"><div class="cashdeskloginuser marginbottomonly valignmiddle"><div class="inline-block valignmiddle">'.$langs->trans("User").': '.$_SESSION['firstname'].' '.$_SESSION['lastname'].'</div>';
print '<div class="inline-block valignmiddle"> <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a></div></div>';
print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">';
print $langs->trans("CashDeskThirdParty").': ';
print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', '(s.client IN (1,3) AND s.status = 1)', '', 0, 0, null, 0, 'valignmiddle inline-block');
print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">';
//print $companyLink;
print '<br>';
print '</form>';
/*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
print '<div class="clearboth">';
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
}
print '</div></li></ul>';
print '</div>';
print "\n".'<!-- menu.tpl.php end -->'."\n";

View File

@ -1,119 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array("main", "cashdesk"));
top_httphead('text/html');
$facid = GETPOST('facid', 'int');
$object = new Facture($db);
$object->fetch($facid);
?>
<html>
<head>
<title><?php echo $langs->trans('PrintTicket') ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT; ?>/cashdesk/css/ticket.css">
</head>
<body>
<div class="entete">
<div class="logo">
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
</div>
<div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br>
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
</p>
<p class="date_heure"><?php
// Recuperation et affichage de la date et de l'heure
$now = dol_now();
print dol_print_date($now, 'dayhourtext').'<br>';
print $object->ref;
?></p>
</div>
</div>
<br>
<table class="liste_articles">
<thead>
<tr class="titres">
<th><?php print $langs->trans("Code"); ?></th>
<th><?php print $langs->trans("Label"); ?></th>
<th><?php print $langs->trans("Qty"); ?></th>
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
<th><?php print $langs->trans("TotalHT"); ?></th>
</tr>
</thead>
<tbody>
<?php
$tab = array();
$tab = $_SESSION['poscart'];
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
$remise = $tab[$i]['remise'];
?>
<tr>
<td><?php echo $tab[$i]['ref']; ?></td>
<td><?php echo $tab[$i]['label']; ?></td>
<td><?php echo $tab[$i]['qte']; ?></td>
<td><?php echo $tab[$i]['remise_percent']; ?></td>
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<table class="totaux">
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
<td class="nowrap"><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
</table>
<script type="text/javascript">
window.print();
</script>
<a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
</body>
</html>

View File

@ -1,118 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "banks"));
// Object $form must de defined
?>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Summary"); ?></legend>
<table class="table_resume">
<tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<?php
// Affichage de la tva par taux
if ($obj_facturation->amountVat()) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->amountVat(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
}
?>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
<?php
switch ($obj_facturation->getSetPaymentMode()) {
case 'ESP':
echo $langs->trans("Cash");
$filtre = 'courant=2';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
}
break;
case 'CB':
echo $langs->trans("CreditCard");
$filtre = 'courant=1';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
}
break;
case 'CHQ':
echo $langs->trans("Cheque");
$filtre = 'courant=1';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
}
break;
case 'DIF':
echo $langs->trans("Reported");
$filtre = 'courant=1 OR courant=2';
$selected = '';
break;
default:
$filtre = 'courant=1 OR courant=2';
$selected = '';
}
?>
</td></tr>
<?php
// Affichage des infos en fonction du mode de paiement
if ($obj_facturation->getsetPaymentMode() == 'DIF') {
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->amountCollected(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
// Affichage du montant rendu (reglement en especes)
if ($obj_facturation->amountReturned()) {
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->amountReturned(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
?>
</table>
<form id="frmValidation" class="formulaire2" method="post" action="validation_verif.php?action=validate_invoice">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<p class="note_label">
<?php
echo $langs->trans("BankToPay")."<br>";
$form->select_comptes($selected, 'cashdeskbank', 0, $filtre);
?>
</p>
<p class="note_label"><?php echo $langs->trans("Notes"); ?><br><textarea class="textarea_note" name="txtaNotes"></textarea></p>
<div class="center"><input class="button" type="submit" name="btnValider" value="<?php echo $langs->trans("ValidateInvoice"); ?>" /><br>
<br><a class="lien1" href="affIndex.php?menutpl=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
</div>
</form>
</fieldset>

View File

@ -1,57 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills"));
?>
<div class="blocksellfinished">
<div class="cadre_facturation">
<h3 class="titre1"><?php echo $langs->trans("SellFinished"); ?></h3><br>
<script type="text/javascript">
function popupTicket(id,name)
{
largeur = 600;
hauteur = 500;
opt = 'width='+largeur+', height='+hauteur+', left='+(screen.width - largeur)/2+', top='+(screen.height-hauteur)/2+'';
window.open('validation_ticket.php?facid='+id,name, opt);
}
popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>');
</script>
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo GETPOST('facid', 'int'); ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
<br>
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>'); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
</div>
</div>
<br>

View File

@ -1,27 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation.php
* \ingroup cashdesk
* \brief validation.php
*/
$form = new Form($db);
// Affichage des templates
require 'tpl/validation1.tpl.php';

View File

@ -1,25 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_ok.php
* \ingroup cashdesk
* \brief validation_ok.php
*/
// Affichage des templates
require 'tpl/validation2.tpl.php';

View File

@ -1,50 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_ticket.php
* \ingroup cashdesk
* \brief validation_ticket.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* Actions
*/
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
$hookmanager->initHooks(array('cashdeskTplTicket'));
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj_facturation);
if (empty($reshook)) {
require 'tpl/ticket.tpl.php';
}
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -1,361 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.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
* the Free Software Foundation; either version 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_verif.php
* \ingroup cashdesk
* \brief validation_verif.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
$action = GETPOST('action', 'aZ09');
$bankaccountid = GETPOST('cashdeskbank');
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* Actions
*/
switch ($action) {
default:
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
break;
case 'validate_sell':
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$company = new Societe($db);
$company->fetch($thirdpartyid);
$invoice = new Facture($db);
$invoice->date = dol_now();
$invoice->type = Facture::TYPE_STANDARD;
// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
// and restore values just after
$sav_FACTURE_ADDON = '';
if (!empty($conf->global->POS_ADDON)) {
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
$conf->global->FACTURE_ADDON = $conf->global->POS_ADDON;
// To force prefix only for POS with terre module
if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) {
$conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
}
// To force prefix only for POS with mars module
if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) {
$conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
}
// To force rule only for POS with mercure
//...
}
$num = $invoice->getNextNumRef($company);
// Restore save values
if (!empty($sav_FACTURE_ADDON)) {
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
}
$obj_facturation->numInvoice($num);
$obj_facturation->getSetPaymentMode($_POST['hdnChoix']);
// Si paiement autre qu'en especes, montant encaisse = prix total
$mode_reglement = $obj_facturation->getSetPaymentMode();
if ($mode_reglement != 'ESP') {
$montant = $obj_facturation->amountWithTax();
} else {
$montant = $_POST['txtEncaisse'];
}
if ($mode_reglement != 'DIF') {
$obj_facturation->amountCollected($montant);
//Determination de la somme rendue
$total = $obj_facturation->amountWithTax();
$encaisse = $obj_facturation->amountCollected();
$obj_facturation->amountReturned($encaisse - $total);
} else {
//$txtDatePaiement=$_POST['txtDatePaiement'];
$datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']);
$txtDatePaiement = dol_print_date($datePaiement, 'dayrfc');
$obj_facturation->paiementLe($txtDatePaiement);
}
$redirection = 'affIndex.php?menutpl=validation';
break;
case 'retour':
$redirection = 'affIndex.php?menutpl=facturation';
break;
case 'validate_invoice':
$now = dol_now();
// Recuperation de la date et de l'heure
$date = dol_print_date($now, 'day');
$heure = dol_print_date($now, 'hour');
$note = '';
if (!is_object($obj_facturation)) {
dol_print_error('', 'Empty context');
exit;
}
switch ($obj_facturation->getSetPaymentMode()) {
case 'DIF':
$mode_reglement_id = 0;
//$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid')
$cond_reglement_id = 0;
break;
case 'ESP':
$mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
$note .= $langs->trans("Cash")."\n";
$note .= $langs->trans("Received").' : '.$obj_facturation->amountCollected()." ".$conf->currency."\n";
$note .= $langs->trans("Rendu").' : '.$obj_facturation->amountReturned()." ".$conf->currency."\n";
$note .= "\n";
$note .= '--------------------------------------'."\n\n";
break;
case 'CB':
$mode_reglement_id = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
break;
case 'CHQ':
$mode_reglement_id = dol_getIdFromCode($db, 'CHQ', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
break;
}
if (empty($mode_reglement_id)) {
$mode_reglement_id = 0; // If mode_reglement_id not found
}
if (empty($cond_reglement_id)) {
$cond_reglement_id = 0; // If cond_reglement_id not found
}
$note .= GETPOST('txtaNotes', 'alphanohtml');
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
$error = 0;
$db->begin();
$user->fetch($_SESSION['uid']);
$user->getrights();
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$invoice = new Facture($db);
// Get content of cart
$tab_liste = $_SESSION['poscart'];
// Loop on each line into cart
$tab_liste_size = count($tab_liste);
for ($i = 0; $i < $tab_liste_size; $i++) {
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
$vat_rate = $tmp['rate'];
$vat_npr = $tmp['npr'];
$vat_src_code = $tmp['code'];
$invoiceline = new FactureLigne($db);
$invoiceline->fk_product = $tab_liste[$i]['fk_article'];
$invoiceline->desc = $tab_liste[$i]['label'];
$invoiceline->qty = $tab_liste[$i]['qte'];
$invoiceline->remise_percent = $tab_liste[$i]['remise_percent'];
$invoiceline->price = $tab_liste[$i]['price'];
$invoiceline->subprice = $tab_liste[$i]['price'];
$invoiceline->tva_tx = empty($vat_rate) ? 0 : $vat_rate; // works even if vat_rate is ''
$invoiceline->info_bits = empty($vat_npr) ? 0 : $vat_npr;
$invoiceline->vat_src_code = $vat_src_code;
$invoiceline->total_ht = $tab_liste[$i]['total_ht'];
$invoiceline->total_ttc = $tab_liste[$i]['total_ttc'];
$invoiceline->total_tva = $tab_liste[$i]['total_vat'];
$invoiceline->total_localtax1 = $tab_liste[$i]['total_localtax1'];
$invoiceline->total_localtax2 = $tab_liste[$i]['total_localtax2'];
$invoice->lines[] = $invoiceline;
}
$invoice->socid = $conf_fksoc;
$invoice->date_creation = $now;
$invoice->date = $now;
$invoice->date_lim_reglement = 0;
$invoice->total_ht = $obj_facturation->amountWithoutTax();
$invoice->total_tva = $obj_facturation->amountVat();
$invoice->total_ttc = $obj_facturation->amountWithTax();
$invoice->note_private = $note;
$invoice->cond_reglement_id = $cond_reglement_id;
$invoice->mode_reglement_id = $mode_reglement_id;
$invoice->module_source = 'cashdesk';
$invoice->pos_source = '0';
//print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit;
// Si paiement differe ...
if ($obj_facturation->getSetPaymentMode() == 'DIF') {
$resultcreate = $invoice->create($user, 0, dol_stringtotime($obj_facturation->paiementLe()));
if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
}
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
for ($i = 0; $i < $cpt; $i++) {
if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
} else {
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
}
if ($result < 0) {
$error++;
}
}
}
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
$id = $invoice->id;
} else {
$resultcreate = $invoice->create($user, 0, 0);
if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
}
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
for ($i = 0; $i < $cpt; $i++) {
if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
} else {
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
}
if ($result < 0) {
setEventMessages($mouvP->error, $mouvP->errors, 'errors');
$error++;
}
}
}
}
$id = $invoice->id;
// Add the payment
$payment = new Paiement($db);
$payment->datepaye = $now;
$payment->amounts[$invoice->id] = $obj_facturation->amountWithTax();
$payment->note_public = $langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice();
$payment->paiementid = $invoice->mode_reglement_id;
$payment->num_paiement = '';
$payment->num_payment = '';
$paiement_id = $payment->create($user);
if ($paiement_id > 0) {
if (!$error) {
$result = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccountid, '', '');
if (!$result > 0) {
$errmsg = $paiement->error;
$error++;
}
}
if (!$error) {
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF') {
// We set status to paid
$result = $invoice->setPaid($user);
//print 'set paid';exit;
}
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
if (!$error) {
$db->commit();
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
} else {
$db->rollback();
$redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
}
break;
// End of case: validate_invoice
}
unset($_SESSION['serObjFacturation']);
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
header('Location: '.$redirection);
exit;

View File

@ -3869,7 +3869,7 @@ class Facture extends CommonInvoice
global $conf, $langs;
if ($this->module_source == 'takepos') {
$langs->load('cashdesk@cashdesk');
$langs->load('cashdesk');
$moduleName = 'takepos';
$moduleSourceName = 'Takepos';

View File

@ -1,145 +0,0 @@
<?php
/* Copyright (C) 2008-2011 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 3 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, see <https://www.gnu.org/licenses/>.
*/
/**
* \defgroup pos Module points of sale
* \brief Module to manage points of sale
* \file htdocs/core/modules/modCashDesk.class.php
* \ingroup pos
* \brief Description and activation file for the module Point Of Sales
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
/**
* Class to describe and enable module Point Of Sales
*/
class modCashDesk extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
$this->numero = 50100;
// Key text used to identify module (for permission, menus, etc...)
$this->rights_class = 'cashdesk';
$this->family = "portal";
$this->module_position = '59';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "CashDesk module";
$this->version = 'deprecated';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto = 'cash-register';
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("cashdesk.php@cashdesk");
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'FR'=>'modBlockedLog'); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2, 4); // Minimum version of Dolibarr required by module
$this->langfiles = array("cashdesk");
$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
//$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
// Constants
$this->const = array();
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$r = 0;
$r++;
$this->rights[$r][0] = 50101;
$this->rights[$r][1] = 'Use Point of sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
// Main menu entries
$this->menus = array(); // List of menus to add
$r = 0;
// This is to declare the Top Menu entry:
$this->menu[$r] = array('fk_menu'=>0, // Put 0 if this is a top menu
'type'=>'top', // This is a Top menu entry
'titre'=>'PointOfSaleShort',
'mainmenu'=>'cashdesk',
'leftmenu'=>'',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'url'=>'/cashdesk/index.php?user=__USER_LOGIN__',
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>900,
'enabled'=>'$conf->cashdesk->enabled',
'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++;
// This is to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the top menu entry
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'Title left menu',
// 'mainmenu'=>'mymodule',
// 'url'=>'/comm/action/index2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'$user->rights->mymodule->level1->level2', // Use 'perms'=>'1' if you want your menu with no permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
$sql = array();
// Remove permissions and default values
$this->remove($options);
return $this->_init($sql, $options);
}
}

View File

@ -62,3 +62,7 @@ ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13);
ALTER TABLE llx_product ADD COLUMN fk_default_bom integer DEFAULT NULL;
DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = 'cashdesk';