Merge develop branch
This commit is contained in:
commit
2834262010
@ -1199,9 +1199,10 @@ class Facture extends CommonInvoice
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $addlinktonotes 1=Add link to notes
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param string $target Target of link ('', '_self', '_blank', '_parent', '_backoffice', ...)
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '')
|
||||
{
|
||||
global $langs, $conf, $user, $form;
|
||||
|
||||
@ -1254,7 +1255,7 @@ class Facture extends CommonInvoice
|
||||
if ($moretitle) $label.=' - '.$moretitle;
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
$linkclose=($target?' target="'.$target.'"':'');
|
||||
if (empty($notooltip) && $user->rights->facture->lire)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
@ -2720,7 +2721,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
@ -2929,7 +2930,7 @@ class Facture extends CommonInvoice
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
|
||||
@ -53,6 +53,7 @@ if (empty($conf->dol_no_mouse_hover))
|
||||
hide: { delay: 50 },
|
||||
tooltipClass: "mytooltip",
|
||||
content: function () {
|
||||
console.log("Return title for popup");
|
||||
return $(this).prop(\'title\'); /* To force to get title as is */
|
||||
}
|
||||
});'."\n";
|
||||
|
||||
@ -1009,6 +1009,23 @@ function getParameterByName(name, valueifnotfound)
|
||||
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
|
||||
|
||||
|
||||
/**
|
||||
* Function similar to PHP price()
|
||||
*
|
||||
* @param {number|string} amount The amount to show
|
||||
* @param {string} mode 'MT' or 'MU'
|
||||
* @return {string} The amount with digits
|
||||
*/
|
||||
function pricejs(amount, mode) {
|
||||
var main_max_dec_shown = <?php echo (int) str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>;
|
||||
var main_rounding_unit = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
|
||||
var main_rounding_tot = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
|
||||
|
||||
if (mode == 'MU') return amount.toFixed(main_rounding_unit);
|
||||
if (mode == 'MT') return amount.toFixed(main_rounding_tot);
|
||||
return 'Bad value for parameter mode';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function similar to PHP price2num()
|
||||
*
|
||||
|
||||
@ -50,13 +50,14 @@ TheoricalAmount=Theorical amount
|
||||
RealAmount=Real amount
|
||||
CashFenceDone=Cash fence done for the period
|
||||
NbOfInvoices=Nb of invoices
|
||||
Paymentnumpad=Payment Num Pad
|
||||
Paymentnumpad=Type of Pad to enter payment
|
||||
Numberspad=Numbers Pad
|
||||
BillsCoinsPad=Bills and Coins Pad
|
||||
BillsCoinsPad=Coins and banknotes Pad
|
||||
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
|
||||
TakeposNeedsCategories=TakePOS needs product categories to work
|
||||
OrderNotes=Order Notes
|
||||
CashDeskBankAccountFor=Default account to use for payments in
|
||||
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration
|
||||
TicketVatGrouped=Group VAT by rate in tickets
|
||||
AutoPrintTickets=Automatically print tickets
|
||||
AutoPrintTickets=Automatically print tickets
|
||||
EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant
|
||||
@ -64,7 +64,7 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
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);
|
||||
@ -177,7 +177,8 @@ if ($conf->global->TAKEPOSCONNECTOR){
|
||||
|
||||
// Bar Restaurant mode
|
||||
print '<tr class="oddeven"><td>';
|
||||
print 'Bar Restaurant';
|
||||
print $langs->trans("EnableBarOrRestaurantFeatures");
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1);
|
||||
print "</td></tr>\n";
|
||||
@ -276,7 +277,7 @@ if (! empty($conf->banque->enabled))
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
foreach($paiements as $modep) {
|
||||
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue;
|
||||
$name="CASHDESK_ID_BANKACCOUNT_".$modep->code;
|
||||
|
||||
@ -48,12 +48,11 @@ if ($action=="getProducts") {
|
||||
$prods = $object->getObjectsInCateg("product");
|
||||
echo json_encode($prods);
|
||||
}
|
||||
|
||||
elseif ($action=="search") {
|
||||
elseif ($action=="search" && $term != '') {
|
||||
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product';
|
||||
$sql .= ' WHERE entity IN ('.getEntity('product').')';
|
||||
$sql .= ' AND tosell = 1';
|
||||
$sql .= natural_search(array('label','barcode'), $term);
|
||||
$sql.= ' WHERE entity IN ('.getEntity('product').')';
|
||||
$sql.= ' AND tosell = 1';
|
||||
$sql.= natural_search(array('label','barcode'), $term);
|
||||
$resql = $db->query($sql);
|
||||
$rows = array();
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
|
||||
@ -46,7 +46,7 @@ button.calcbutton3 {
|
||||
text-align: center;
|
||||
font-size:120%;
|
||||
overflow: visible; /* removes extra width in IE */
|
||||
width:12%;
|
||||
width:24%;
|
||||
height:24%;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ button.actionbutton {
|
||||
text-align: center;
|
||||
overflow: visible; /* removes extra width in IE */
|
||||
width:33%;
|
||||
height:33%;
|
||||
height:24%;
|
||||
}
|
||||
|
||||
div.wrapper{
|
||||
@ -103,7 +103,6 @@ div.description{
|
||||
width:100%;
|
||||
/* styling below */
|
||||
background-color:black;
|
||||
font-family: 'tahoma';
|
||||
color:white;
|
||||
opacity:0.8; /* transparency */
|
||||
filter:alpha(opacity=80); /* IE transparency */
|
||||
@ -209,6 +208,22 @@ div.catwatermark{
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.selected {
|
||||
font-weight: bold;
|
||||
}
|
||||
.order {
|
||||
color: limegreen;
|
||||
}
|
||||
|
||||
.colorwhite {
|
||||
color: white;
|
||||
}
|
||||
.colorred {
|
||||
color: red;
|
||||
}
|
||||
.colorgreen {
|
||||
color: green;
|
||||
}
|
||||
p.description_content{
|
||||
padding:10px;
|
||||
margin:0px;
|
||||
|
||||
@ -45,7 +45,8 @@ $show_files=GETPOST('show_files', 'int');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$idcustomer = GETPOST('idcustomer', 'int');
|
||||
$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):0);
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$_GET['optioncss'] = 'print';
|
||||
|
||||
@ -60,7 +61,7 @@ if ($action=="change") {
|
||||
?>
|
||||
<script>
|
||||
parent.$("#poslines").load("invoice.php?place="+<?php print $place;?>, function() {
|
||||
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -25,24 +25,26 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS
|
||||
|
||||
require '../main.inc.php'; // Load $user and permissions
|
||||
|
||||
$langs->loadLangs(array("bills","orders","commercial","cashdesk"));
|
||||
|
||||
$floor=GETPOST('floor', 'alpha');
|
||||
$floor=GETPOST('floor', 'int');
|
||||
if ($floor=="") $floor=1;
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$left = GETPOST('left', 'alpha');
|
||||
$top = GETPOST('top', 'alpha');
|
||||
$place = GETPOST('place', 'int');
|
||||
$newname = GETPOST('newname');
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$newname = GETPOST('newname', 'alpha');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
if ($action=="getTables"){
|
||||
$sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor;
|
||||
if ($action=="getTables")
|
||||
{
|
||||
$sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor;
|
||||
$resql = $db->query($sql);
|
||||
$rows = array();
|
||||
while($row = $db->fetch_array($resql)){
|
||||
@ -56,20 +58,21 @@ if ($action=="update")
|
||||
{
|
||||
if ($left>95) $left=95;
|
||||
if ($top>95) $top=95;
|
||||
if ($left>3 or $top>4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'");
|
||||
else $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'");
|
||||
if ($left>3 or $top>4) $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=".$left.", toppos=".$top." WHERE rowid='".$place."'");
|
||||
else $db->query("DELETE from ".MAIN_DB_PREFIX."takepos_floor_tables where rowid='".$place."'");
|
||||
}
|
||||
|
||||
if ($action=="updatename")
|
||||
{
|
||||
$newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars
|
||||
if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars
|
||||
$db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'");
|
||||
$db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid='".$place."'");
|
||||
}
|
||||
|
||||
if ($action=="add")
|
||||
{
|
||||
$asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)");
|
||||
$sql="INSERT INTO ".MAIN_DB_PREFIX."takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.", '', '45', '45', ".$floor.")";
|
||||
$asdf=$db->query($sql);
|
||||
$db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names
|
||||
}
|
||||
|
||||
@ -101,6 +104,7 @@ height: 100%;
|
||||
var DragDrop='<?php echo $langs->trans("DragDrop"); ?>';
|
||||
|
||||
function updateplace(idplace, left, top) {
|
||||
console.log("updateplace idplace="+idplace+" left="+left+" top="+top);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "floors.php",
|
||||
@ -110,12 +114,13 @@ function updateplace(idplace, left, top) {
|
||||
});
|
||||
}
|
||||
|
||||
function updatename(before) {
|
||||
var after=$("#"+before).text();
|
||||
function updatename(rowid) {
|
||||
var after=$("#tablename"+rowid).text();
|
||||
console.log("updatename rowid="+rowid+" after="+after);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "floors.php",
|
||||
data: { action: "updatename", place: before, newname: after }
|
||||
data: { action: "updatename", place: rowid, newname: after }
|
||||
}).done(function( msg ) {
|
||||
window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>';
|
||||
});
|
||||
@ -130,8 +135,8 @@ $( document ).ready(function() {
|
||||
$.getJSON('./floors.php?action=getTables&floor=<?php echo $floor; ?>', function(data) {
|
||||
$.each(data, function(key, val) {
|
||||
<?php if ($mode=="edit"){?>
|
||||
$('body').append('<div class="tablediv" contenteditable onblur="updatename('+val.label+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="'+val.label+'">'+val.label+'</div>');
|
||||
$( "#"+val.label ).draggable(
|
||||
$('body').append('<div class="tablediv" contenteditable onblur="updatename('+val.rowid+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="tablename'+val.rowid+'">'+val.label+'</div>');
|
||||
$( "#tablename"+val.rowid ).draggable(
|
||||
{
|
||||
start: function() {
|
||||
$("#add").html("<?php echo $langs->trans("Delete"); ?>");
|
||||
@ -139,7 +144,7 @@ $( document ).ready(function() {
|
||||
stop: function() {
|
||||
var left=$(this).offset().left*100/$(window).width();
|
||||
var top=$(this).offset().top*100/$(window).height();
|
||||
updateplace($(this).attr('id'), left, top);
|
||||
updateplace($(this).attr('id').substr(9), left, top);
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -149,7 +154,7 @@ $( document ).ready(function() {
|
||||
})
|
||||
<?php }
|
||||
else {?>
|
||||
$('body').append('<div class="tablediv" onclick="LoadPlace('+val.label+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="'+val.label+'">'+val.label+'</div>');
|
||||
$('body').append('<div class="tablediv" onclick="LoadPlace('+val.rowid+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="tablename'+val.rowid+'">'+val.label+'</div>');
|
||||
<?php } ?>
|
||||
});
|
||||
});
|
||||
@ -171,7 +176,13 @@ $( document ).ready(function() {
|
||||
|
||||
<div style="position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;">
|
||||
<center>
|
||||
<h1><img src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor>1) { $floor--; echo $floor; $floor++;} else echo "1"; ?>';"><?php echo $langs->trans("Floor")." ".$floor; ?><img src="./img/arrow-next.png" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';"></h1>
|
||||
<h1>
|
||||
<?php if ($floor>1) { ?>
|
||||
<img class="valignmiddle" src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor>1) { $floor--; echo $floor; $floor++;} else echo "1"; ?>';">
|
||||
<?php } ?>
|
||||
<span class="valignmiddle"><?php echo $langs->trans("Floor")." ".$floor; ?></span>
|
||||
<img src="./img/arrow-next.png" class="valignmiddle" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';">
|
||||
</h1>
|
||||
</center>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -29,7 +29,9 @@ require '../main.inc.php'; // Load $user and permissions
|
||||
|
||||
$langs->loadLangs(array("bills", "cashdesk"));
|
||||
|
||||
$place = GETPOST('place', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$idline = GETPOST('idline', 'int');
|
||||
$action = GETPOST('action');
|
||||
|
||||
@ -60,7 +62,7 @@ if ($action=="freezone") echo '<input type="text" id="number" name="number" styl
|
||||
if ($action=="addnote") echo '<input type="hidden" id="number" name="number" value="'.$idline.'">';
|
||||
?>
|
||||
<input type="hidden" name="place" value="<?php echo $place;?>">
|
||||
<input type="button" style="width:15%;font-size: 200%;" value="OK" onclick="Save();">
|
||||
<input type="button" class="button" style="width:15%; font-size: 200%;" value="OK" onclick="Save();">
|
||||
</center>
|
||||
|
||||
</body>
|
||||
|
||||
@ -35,11 +35,8 @@ $langs->loadLangs(array("bills", "cashdesk"));
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):0); // $place is id of POS
|
||||
$number = GETPOST('number');
|
||||
$idline = GETPOST('idline');
|
||||
$desc = GETPOST('desc', 'alpha');
|
||||
$pay = GETPOST('pay');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
/**
|
||||
* Abort invoice creationg with a given error message
|
||||
@ -57,32 +54,52 @@ function fail($message)
|
||||
|
||||
$placeid = 0; // $placeid is id of invoice
|
||||
|
||||
$invoice = new Facture($db);
|
||||
$ret = $invoice->fetch('', '(PROV-POS-'.$place.')');
|
||||
if ($ret > 0) $placeid = $invoice->id;
|
||||
$number = GETPOST('number', 'alpha');
|
||||
$idline = GETPOST('idline', 'int');
|
||||
$desc = GETPOST('desc', 'alpha');
|
||||
$pay = GETPOST('pay', 'alpha');
|
||||
$amountofpayment = price2num(GETPOST('amount', 'alpha'));
|
||||
|
||||
$invoiceid = GETPOST('invoiceid', 'int');
|
||||
|
||||
$paycode = $pay;
|
||||
if ($pay == 'cash') $paycode = 'LIQ';
|
||||
if ($pay == 'card') $paycode = 'CB';
|
||||
if ($pay == 'cheque') $paycode = 'CHQ';
|
||||
|
||||
if ($pay == 'cash') $paycode = 'LIQ'; // For backward compatibility
|
||||
if ($pay == 'card') $paycode = 'CB'; // For backward compatibility
|
||||
if ($pay == 'cheque') $paycode = 'CHQ'; // For backward compatibility
|
||||
|
||||
// Retrieve paiementid
|
||||
$sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND code = '".$paycode."'";
|
||||
$sql.= " AND code = '".$db->escape($paycode)."'";
|
||||
$resql = $db->query($sql);
|
||||
$codes = $db->fetch_array($resql);
|
||||
$paiementid=$codes[0];
|
||||
|
||||
|
||||
$invoice = new Facture($db);
|
||||
if ($invoiceid > 0)
|
||||
{
|
||||
$ret = $invoice->fetch($invoiceid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $invoice->fetch('', '(PROV-POS-'.$place.')');
|
||||
}
|
||||
if ($ret > 0)
|
||||
{
|
||||
$placeid = $invoice->id;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'valid' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($pay == "cash") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
|
||||
elseif ($pay == "card") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
|
||||
elseif ($pay == "cheque") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
|
||||
if ($pay == "cash") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH; // For backward compatibility
|
||||
elseif ($pay == "card") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CB; // For backward compatibility
|
||||
elseif ($pay == "cheque") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; // For backward compatibility
|
||||
else
|
||||
{
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$pay;
|
||||
@ -113,22 +130,38 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
$invoice->update($user);
|
||||
}
|
||||
|
||||
if (! empty($conf->stock->enabled) and $conf->global->CASHDESK_NO_DECREASE_STOCK!="1") $invoice->validate($user, '', $conf->global->CASHDESK_ID_WAREHOUSE);
|
||||
else $invoice->validate($user);
|
||||
if (! empty($conf->stock->enabled) && $conf->global->CASHDESK_NO_DECREASE_STOCK != "1")
|
||||
{
|
||||
$invoice->validate($user, '', $conf->global->CASHDESK_ID_WAREHOUSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$invoice->validate($user);
|
||||
}
|
||||
|
||||
// Add the payment
|
||||
$payment=new Paiement($db);
|
||||
$payment->datepaye = $now;
|
||||
$payment->bank_account = $bankaccount;
|
||||
$payment->amounts[$invoice->id] = $invoice->total_ttc;
|
||||
$payment->fk_account = $bankaccount;
|
||||
$payment->amounts[$invoice->id] = $amountofpayment;
|
||||
|
||||
$payment->paiementid=$paiementid;
|
||||
$payment->num_paiement=$invoice->ref;
|
||||
$payment->num_payment=$invoice->ref;
|
||||
|
||||
$payment->create($user);
|
||||
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
|
||||
|
||||
$invoice->set_paid($user);
|
||||
$remaintopay = $invoice->getRemainToPay();
|
||||
if ($remaintopay == 0)
|
||||
{
|
||||
dol_syslog("Invoice is paid, so we set it to pay");
|
||||
$result = $invoice->set_paid($user);
|
||||
if ($result > 0) $invoice->paye = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Invoice is not paid, remain to pay = ".$remaintopay);
|
||||
}
|
||||
}
|
||||
|
||||
if (($action=="addline" || $action=="freezone") && $placeid == 0)
|
||||
@ -136,15 +169,15 @@ if (($action=="addline" || $action=="freezone") && $placeid == 0)
|
||||
$invoice->socid = $conf->global->CASHDESK_ID_THIRDPARTY;
|
||||
$invoice->date = dol_now();
|
||||
$invoice->module_source = 'takepos';
|
||||
$invoice->pos_source = (string) $place;
|
||||
$invoice->pos_source = (string) $posnb;
|
||||
|
||||
$placeid = $invoice->create($user);
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS-".$place.")' where rowid=".$placeid;
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == "addline") {
|
||||
|
||||
if ($action == "addline")
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idproduct);
|
||||
|
||||
@ -190,8 +223,8 @@ if ($action == "deleteline") {
|
||||
$invoice->deleteline($idline);
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
elseif ($placeid > 0) { //If exist invoice, but no line selected, proced to delete last line
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='$placeid' order by rowid DESC";
|
||||
elseif ($placeid > 0) { //If exist invoice, but no line selected, proceed to delete last line
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."' order by rowid DESC";
|
||||
$resql = $db->query($sql);
|
||||
$row = $db->fetch_array($resql);
|
||||
$deletelineid = $row[0];
|
||||
@ -276,20 +309,41 @@ if ($action == "order" and $placeid != 0) {
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
$sectionwithinvoicelink='';
|
||||
if ($action=="valid")
|
||||
{
|
||||
$sectionwithinvoicelink.='<!-- Section with invoice link -->'."\n";
|
||||
$sectionwithinvoicelink.='<input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">';
|
||||
$sectionwithinvoicelink.='<span style="font-size:120%;" class="center"><b>';
|
||||
$sectionwithinvoicelink.=$invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - ";
|
||||
if ($invoice->getRemainToPay() > 0)
|
||||
{
|
||||
$sectionwithinvoicelink.=$langs->trans('Generated');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($invoice->paye) $sectionwithinvoicelink.=$langs->trans("Payed");
|
||||
else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated');
|
||||
}
|
||||
$sectionwithinvoicelink.='</b></span>';
|
||||
if ($conf->global->TAKEPOSCONNECTOR) $sectionwithinvoicelink.=' <button type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
else $sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink.='<script language="javascript">$("#buttonprint").click();</script>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
?>
|
||||
<style>
|
||||
.selected {
|
||||
font-weight: bold;
|
||||
}
|
||||
.order {
|
||||
color: limegreen;
|
||||
}
|
||||
</style>
|
||||
<script language="javascript">
|
||||
var selectedline=0;
|
||||
var selectedtext="";
|
||||
var placeid=<?php echo $placeid;?>;
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
$('table tbody tr').click(function(){
|
||||
$('table tbody tr').removeClass("selected");
|
||||
$(this).addClass("selected");
|
||||
@ -328,18 +382,18 @@ if ($action == "search") {
|
||||
}
|
||||
|
||||
?>
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$('table tbody tr').click(function(){
|
||||
$('table tbody tr').click(function(){
|
||||
console.log("We click on a line");
|
||||
$('table tbody tr').removeClass("selected");
|
||||
$(this).addClass("selected");
|
||||
if (selectedline==this.id) return; // If is already selected
|
||||
else selectedline=this.id;
|
||||
else selectedline=this.id;
|
||||
selectedtext=$('#'+selectedline).find("td:first").html();
|
||||
});
|
||||
<?php
|
||||
|
||||
|
||||
if ($action == "temp" and $ticket_printer1 != "") {
|
||||
?>
|
||||
$.ajax({
|
||||
@ -358,6 +412,7 @@ if ($action == "search") {
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
});
|
||||
|
||||
function Print(id){
|
||||
@ -377,40 +432,92 @@ function TakeposPrinting(id){
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
// Add again js for footer because this content is injected into takepos.php page so all init
|
||||
// for tooltip and other js beautifiers must be reexecuted too.
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
|
||||
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext?'&'.$ext:'').'"></script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min invoice">';
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td class="linecoldescription">' . $langs->trans('Description') . '</td>';
|
||||
print '<td class="linecoldescription">';
|
||||
print '<span style="font-size:120%;" class="right">';
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
{
|
||||
$sql="SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place);
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$label = $obj->label;
|
||||
$floor = $obj->floor;
|
||||
}
|
||||
print $langs->trans('Place')." <b>".$label."</b> - ";
|
||||
print $langs->trans('Floor')." <b>".$floor."</b> - ";
|
||||
}
|
||||
print $langs->trans('TotalTTC');
|
||||
print ' : <b>'.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</b></span>';
|
||||
print '<br>'.$sectionwithinvoicelink;
|
||||
print '</td>';
|
||||
print '<td class="linecolqty right">' . $langs->trans('ReductionShort') . '</td>';
|
||||
print '<td class="linecolqty right">' . $langs->trans('Qty') . '</td>';
|
||||
print '<td class="linecolht right">' . $langs->trans('TotalHTShort') . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($placeid > 0) {
|
||||
foreach($invoice->lines as $line)
|
||||
if ($placeid > 0)
|
||||
{
|
||||
if (is_array($invoice->lines) && count($invoice->lines))
|
||||
{
|
||||
print '<tr class="drag drop oddeven';
|
||||
if ($line->special_code == "3") {
|
||||
print ' order';
|
||||
$tmplines = array_reverse($invoice->lines);
|
||||
foreach($tmplines as $line)
|
||||
{
|
||||
$htmlforlines = '';
|
||||
|
||||
$htmlforlines.= '<tr class="drag drop oddeven';
|
||||
if ($line->special_code == "3") {
|
||||
$htmlforlines.= ' order';
|
||||
}
|
||||
$htmlforlines.= '" id="' . $line->id . '">';
|
||||
$htmlforlines.= '<td class="left">';
|
||||
$htmlforlines.= $line->product_label;
|
||||
if ($line->product_label && $line->desc) $htmlforlines.= '<br>';
|
||||
if ($line->product_label != $line->desc)
|
||||
{
|
||||
$firstline = dolGetFirstLineOfText($line->desc);
|
||||
if ($firstline != $line->desc)
|
||||
{
|
||||
$htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlforlines.= $line->desc;
|
||||
}
|
||||
}
|
||||
if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "<br>(".$line->array_options['options_order_notes'].")";
|
||||
$htmlforlines.= '</td>';
|
||||
$htmlforlines.= '<td class="right">' . vatrate($line->remise_percent, true) . '</td>';
|
||||
$htmlforlines.= '<td class="right">' . $line->qty . '</td>';
|
||||
$htmlforlines.= '<td class="right">' . price($line->total_ttc) . '</td>';
|
||||
$htmlforlines.= '</tr>'."\n";
|
||||
|
||||
print $htmlforlines;
|
||||
}
|
||||
print '" id="' . $line->rowid . '">';
|
||||
print '<td class="left">' . $line->product_label . $line->desc;
|
||||
if (!empty($line->array_options['options_order_notes'])) echo "<br>(".$line->array_options['options_order_notes'].")";
|
||||
print '</td>';
|
||||
print '<td class="right">' . $line->qty . '</td>';
|
||||
print '<td class="right">' . price($line->total_ttc) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td></tr>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<p style="font-size:120%;" class="right"><b>'.$langs->trans('TotalTTC');
|
||||
|
||||
if($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place;
|
||||
|
||||
print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' </b></p>';
|
||||
|
||||
if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
@ -420,13 +527,6 @@ if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY)
|
||||
print $langs->trans("Customer").': '.$soc->name;
|
||||
print '</p>';
|
||||
}
|
||||
if ($action=="valid")
|
||||
{
|
||||
print '<p style="font-size:120%;" class="center"><b>'.$invoice->ref." ".$langs->trans('BillShortStatusValidated').'</b></p>';
|
||||
if ($conf->global->TAKEPOSCONNECTOR) print '<center><button type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button><center>';
|
||||
else print '<center><button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button><center>';
|
||||
if($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) print '<script language="javascript">$("#buttonprint").click();</script>';
|
||||
}
|
||||
|
||||
if ($action == "search")
|
||||
{
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
/* Copyright (C) 2018 Charles-FR BENKE <jove@bisquerra.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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -15,6 +15,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/takepos/pay.php
|
||||
* \ingroup takepos
|
||||
* \brief Page with the content of the popup to enter payments
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
@ -25,33 +31,48 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS
|
||||
|
||||
require '../main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$place = GETPOST('place', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$invoiceid = GETPOST('invoiceid', 'int');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$row = $db->fetch_array($resql);
|
||||
$placeid=$row[0];
|
||||
if (! $placeid) $placeid=0; // Invoice not exist
|
||||
else{
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($placeid);
|
||||
$invoice = new Facture($db);
|
||||
if ($invoiceid > 0)
|
||||
{
|
||||
$invoice->fetch($invoiceid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$invoiceid = $obj->rowid;
|
||||
}
|
||||
if (! $invoiceid)
|
||||
{
|
||||
$invoiceid=0; // Invoice does not exist yet
|
||||
}
|
||||
else
|
||||
{
|
||||
$invoice->fetch($invoiceid);
|
||||
}
|
||||
}
|
||||
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
$langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND active = 1";
|
||||
$sql.= " ORDER BY libelle";
|
||||
@ -70,62 +91,111 @@ if ($resql) {
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" href="css/pos.css">
|
||||
<script>
|
||||
<?php
|
||||
if ($conf->global->TAKEPOS_NUMPAD==0) print "var received='';";
|
||||
else print "var received=0;";
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
<?php
|
||||
$remaintopay = 0;
|
||||
if ($invoice->id > 0)
|
||||
{
|
||||
$remaintopay = $invoice->getRemainToPay();
|
||||
}
|
||||
$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
|
||||
|
||||
if ($conf->global->TAKEPOS_NUMPAD==0) print "var received='';";
|
||||
else print "var received=0;";
|
||||
|
||||
?>
|
||||
var alreadypayed = <?php echo $alreadypayed ?>;
|
||||
|
||||
function addreceived(price)
|
||||
{
|
||||
<?php
|
||||
if ($conf->global->TAKEPOS_NUMPAD==0) print 'received+=String(price);';
|
||||
else print 'received+=parseFloat(price);';
|
||||
?>
|
||||
$('#change1').html(parseFloat(received).toFixed(2));
|
||||
if (parseFloat(received) > <?php echo $invoice->total_ttc;?>)
|
||||
{
|
||||
var change=parseFloat(parseFloat(received)-(<?php echo $invoice->total_ttc;?>));
|
||||
$('#change2').html(change.toFixed(2));
|
||||
<?php
|
||||
if (empty($conf->global->TAKEPOS_NUMPAD)) print 'received+=String(price);'."\n";
|
||||
else print 'received+=parseFloat(price);'."\n";
|
||||
?>
|
||||
$('.change1').html(pricejs(parseFloat(received), 'MT'));
|
||||
$('.change1').val(parseFloat(received));
|
||||
if ((alreadypayed + parseFloat(received)) > <?php echo $invoice->total_ttc;?>)
|
||||
{
|
||||
var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc;?>);
|
||||
$('.change2').html(pricejs(change, 'MT'));
|
||||
$('.change2').val(change);
|
||||
$('.change1').removeClass('colorred');
|
||||
$('.change1').addClass('colorgreen');
|
||||
$('.change2').removeClass('colorwhite');
|
||||
$('.change2').addClass('colorred');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.change2').html(pricejs(0, 'MT'));
|
||||
$('.change2').val(0);
|
||||
if ((alreadypayed + parseFloat(received)) == <?php echo $invoice->total_ttc;?>)
|
||||
{
|
||||
$('.change1').removeClass('colorred');
|
||||
$('.change1').addClass('colorgreen');
|
||||
$('.change2').removeClass('colorred');
|
||||
$('.change2').addClass('colorwhite');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.change1').removeClass('colorgreen');
|
||||
$('.change1').addClass('colorred');
|
||||
$('.change2').removeClass('colorred');
|
||||
$('.change2').addClass('colorwhite');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
received=0;
|
||||
addreceived(0);
|
||||
$('#change2').html(received.toFixed(2));
|
||||
$('.change1').html(pricejs(received, 'MT'));
|
||||
$('.change1').val(price2numjs(received));
|
||||
$('.change2').html(pricejs(received, 'MT'));
|
||||
$('.change2').val(price2numjs(received));
|
||||
$('.change1').removeClass('colorgreen');
|
||||
$('.change1').addClass('colorred');
|
||||
$('.change2').removeClass('colorred');
|
||||
$('.change2').addClass('colorwhite');
|
||||
}
|
||||
|
||||
function Validate(payment){
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment, function(response, status, xhr) {
|
||||
if(status == "error"){
|
||||
alert(response);
|
||||
}else{
|
||||
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
parent.$.colorbox.close();
|
||||
}
|
||||
function Validate(payment)
|
||||
{
|
||||
var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
|
||||
var amountpayed = $("#change1").val();
|
||||
if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
|
||||
amountpayed = <?php echo $invoice->total_ttc; ?>;
|
||||
}
|
||||
console.log("We click on the payment mode to pay amount = "+amountpayed);
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid, function() {
|
||||
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div style="position:absolute; top:2%; left:5%; height:36%; width:91%;">
|
||||
<div style="position:absolute; top:2%; left:5%; height:30%; width:91%;">
|
||||
<center>
|
||||
<div style="width:40%; background-color:#222222; border-radius:8px; margin-bottom: 4px;">
|
||||
<center><span style='font-family: digital; font-size: 280%;'><font color="white"><?php echo $langs->trans('TotalTTC');?>: </font><font color="red"><span id="totaldisplay"><?php echo price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) ?></span></span></center>
|
||||
<center><span style='font-family: verdana,arial,helvetica; font-size: 200%;'><font color="white"><?php echo $langs->trans('TotalTTC');?>: </font><span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1) ?></span></font></span></center>
|
||||
</div>
|
||||
<?php if ($remaintopay != $invoice->total_ttc) { ?>
|
||||
<div style="width:40%; background-color:#222222; border-radius:8px; margin-bottom: 4px;">
|
||||
<center><span style='font-family: verdana,arial,helvetica; font-size: 200%;'><font color="white"><?php echo $langs->trans('RemainToPay');?>: </font><span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1) ?></span></font></span></center>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div style="width:40%; background-color:#333333; border-radius:8px; margin-bottom: 4px;">
|
||||
<center><span style='font-family: verdana,arial,helvetica; font-size: 200%;'><font color="white"><?php echo $langs->trans("Received"); ?>: </font><span class="change1 colorred"><?php echo price(0) ?></span><input type="hidden" id="change1" class="change1" value="0"></font></center>
|
||||
</div>
|
||||
<div style="width:40%; background-color:#333333; border-radius:8px; margin-bottom: 4px;">
|
||||
<center><span style='font-family: digital; font-size: 250%;'><font color="white"><?php echo $langs->trans("AlreadyPaid"); ?>: </font><font color="red"><span id="change1"><?php echo price(0) ?></span></center>
|
||||
</div>
|
||||
<div style="width:40%; background-color:#333333; border-radius:8px; margin-bottom: 4px;">
|
||||
<center><span style='font-family: digital; font-size: 250%;'><font color="white"><?php echo $langs->trans("Change"); ?>: </font><font color="red"><span id="change2"><?php echo price(0) ?></span></span></center>
|
||||
<center><span style='font-family: verdana,arial,helvetica; font-size: 200%;'><font color="white"><?php echo $langs->trans("Change"); ?>: </font><span class="change2 colorwhite"><?php echo price(0) ?></span><input type="hidden" id="change2" class="change2" value="0"></font></span></center>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div style="position:absolute; top:40%; left:5%; height:55%; width:91%;">
|
||||
<div style="position:absolute; top:33%; left:5%; height:55%; width:91%;">
|
||||
<?php
|
||||
$action_buttons = array(
|
||||
array(
|
||||
@ -136,7 +206,7 @@ $action_buttons = array(
|
||||
array(
|
||||
"function" => "parent.$.colorbox.close();",
|
||||
"span" => "id='printtext'",
|
||||
"text" => $langs->trans("GoBack"),
|
||||
"text" => $langs->trans("Cancel"),
|
||||
),
|
||||
);
|
||||
$numpad=$conf->global->TAKEPOS_NUMPAD;
|
||||
@ -150,7 +220,7 @@ $numpad=$conf->global->TAKEPOS_NUMPAD;
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[0]->libelle); ?></button>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[0]->label); ?></button>
|
||||
<?php } else { ?>
|
||||
<button type="button" class="calcbutton2"><?php echo $langs->trans("NoPaimementModesDefined");?></button>
|
||||
<?php } ?>
|
||||
@ -163,7 +233,7 @@ $numpad=$conf->global->TAKEPOS_NUMPAD;
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[1]->libelle); ?></button>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[1]->label); ?></button>
|
||||
<?php } else {
|
||||
$button = array_pop($action_buttons);
|
||||
?>
|
||||
@ -178,7 +248,7 @@ $button = array_pop($action_buttons);
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[2]->libelle); ?></button>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[2]->label); ?></button>
|
||||
<?php } else { ?>
|
||||
<?php
|
||||
$button = array_pop($action_buttons);
|
||||
@ -192,7 +262,7 @@ $button = array_pop($action_buttons);
|
||||
$i=3;
|
||||
while($i < count($paiements)){
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans($paiements[$i]->libelle); ?></button>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans($paiements[$i]->label); ?></button>
|
||||
<?php
|
||||
$i=$i+1;
|
||||
}
|
||||
|
||||
@ -24,19 +24,27 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$langs->loadLangs(array("main", "cashdesk"));
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$facid=GETPOST('facid', 'int');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
top_httphead('text/html');
|
||||
|
||||
$facid=GETPOST('facid', 'int');
|
||||
$place=GETPOST('place', 'int');
|
||||
if ($place>0){
|
||||
if ($place > 0)
|
||||
{
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$row = $db->fetch_array($resql);
|
||||
$facid=$row[0];
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$facid=$obj->rowid;
|
||||
}
|
||||
}
|
||||
$object=new Facture($db);
|
||||
$object->fetch($facid);
|
||||
|
||||
@ -26,24 +26,23 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS
|
||||
|
||||
require '../main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
$place = GETPOST('place', 'int');
|
||||
if ($place=="") $place="0";
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter"));
|
||||
|
||||
$categorie = new Categorie($db);
|
||||
|
||||
$MAXCATEG = 16;
|
||||
$MAXPRODUCT = 32;
|
||||
$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?16:$conf->global->TAKEPOS_NB_MAXCATEG);
|
||||
$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?32:$conf->global->TAKEPOS_NB_MAXPRODUCT);;
|
||||
|
||||
|
||||
/*
|
||||
@ -61,16 +60,15 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" href="css/pos.css">
|
||||
<script type="text/javascript" src="js/takepos.js" ></script>
|
||||
<link rel="stylesheet" href="css/colorbox.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
|
||||
<script language="javascript">
|
||||
<?php
|
||||
$categories = $categorie->get_full_arbo('product', 0, (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)?$conf->global->TAKEPOS_ROOT_CATEGORY_ID:0));
|
||||
|
||||
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
|
||||
|
||||
// Search root category to know its level
|
||||
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
|
||||
$levelofrootcategory=0;
|
||||
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
|
||||
{
|
||||
@ -113,8 +111,8 @@ var pageactions=0;
|
||||
var place="<?php echo $place;?>";
|
||||
var editaction="qty";
|
||||
var editnumber="";
|
||||
function PrintCategories(first){
|
||||
for (i = 0; i < 14; i++) {
|
||||
function PrintCategories(first) {
|
||||
for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
|
||||
if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") break;
|
||||
$("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']);
|
||||
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
|
||||
@ -123,38 +121,41 @@ function PrintCategories(first){
|
||||
}
|
||||
}
|
||||
|
||||
function MoreCategories(moreorless){
|
||||
if (moreorless=="more"){
|
||||
function MoreCategories(moreorless) {
|
||||
console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories);
|
||||
if (moreorless=="more") {
|
||||
$('#catimg15').animate({opacity: '0.5'}, 1);
|
||||
$('#catimg15').animate({opacity: '1'}, 100);
|
||||
pagecategories=pagecategories+1;
|
||||
}
|
||||
if (moreorless=="less"){
|
||||
if (moreorless=="less") {
|
||||
$('#catimg14').animate({opacity: '0.5'}, 1);
|
||||
$('#catimg14').animate({opacity: '1'}, 100);
|
||||
if (pagecategories==0) return; //Return if no less pages
|
||||
pagecategories=pagecategories-1;
|
||||
}
|
||||
if (typeof (categories[14*pagecategories] && moreorless=="more") == "undefined"){ // Return if no more pages
|
||||
if (typeof (categories[<?php echo ($MAXCATEG - 2); ?> * pagecategories] && moreorless=="more") == "undefined"){ // Return if no more pages
|
||||
pagecategories=pagecategories-1;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 14; i++) {
|
||||
if (typeof (categories[i+(14*pagecategories)]) == "undefined"){
|
||||
$("#catdesc"+i).text("");
|
||||
$("#catimg"+i).attr("src","genimg/empty.png");
|
||||
$("#catwatermark"+i).hide();
|
||||
continue;
|
||||
}
|
||||
$("#catdesc"+i).text(categories[i+(14*pagecategories)]['label']);
|
||||
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(14*pagecategories)]['rowid']);
|
||||
$("#catdiv"+i).data("rowid",categories[i+(14*pagecategories)]['rowid']);
|
||||
for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
|
||||
if (typeof (categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]) == "undefined") {
|
||||
$("#catdesc"+i).text("");
|
||||
$("#catimg"+i).attr("src","genimg/empty.png");
|
||||
$("#catwatermark"+i).hide();
|
||||
continue;
|
||||
}
|
||||
$("#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label']);
|
||||
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
|
||||
$("#catdiv"+i).data("rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
|
||||
$("#catwatermark"+i).show();
|
||||
}
|
||||
}
|
||||
|
||||
function LoadProducts(position, issubcat=false){
|
||||
$('#catimg'+position).animate({opacity: '0.5'}, 1);
|
||||
function LoadProducts(position, issubcat=false) {
|
||||
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
|
||||
|
||||
$('#catimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#catimg'+position).animate({opacity: '1'}, 100);
|
||||
if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
|
||||
else currentcat=$('#catdiv'+position).data('rowid');
|
||||
@ -163,7 +164,7 @@ function LoadProducts(position, issubcat=false){
|
||||
ishow=0; //product to show counter
|
||||
|
||||
jQuery.each(subcategories, function(i, val) {
|
||||
if (currentcat==val.fk_parent){
|
||||
if (currentcat==val.fk_parent) {
|
||||
$("#prodesc"+ishow).text(val.label);
|
||||
$("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
|
||||
$("#prodiv"+ishow).data("rowid",val.rowid);
|
||||
@ -175,28 +176,35 @@ function LoadProducts(position, issubcat=false){
|
||||
|
||||
idata=0; //product data counter
|
||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||
while (ishow < 30) {
|
||||
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat);
|
||||
|
||||
while (ishow < maxproduct) {
|
||||
//console.log("ishow"+ishow+" idata="+idata);
|
||||
//console.log(data[idata]);
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodesc"+ishow).text("");
|
||||
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
||||
$("#prodiv"+ishow).data("rowid","");
|
||||
$("#prowatermark"+ishow).hide();
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
else if ((data[idata]['status']) == "1") {
|
||||
//Only show products with status=1 (for sell)
|
||||
else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell)
|
||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
$("#prowatermark"+ishow).hide();
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
$("#prowatermark"+ishow).hide();
|
||||
//console.log("Hide the prowatermark for ishow="+ishow);
|
||||
idata++; //Next data everytime
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function MoreProducts(moreorless){
|
||||
function MoreProducts(moreorless) {
|
||||
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
|
||||
|
||||
if (moreorless=="more"){
|
||||
$('#proimg31').animate({opacity: '0.5'}, 1);
|
||||
$('#proimg31').animate({opacity: '1'}, 100);
|
||||
@ -209,13 +217,16 @@ function MoreProducts(moreorless){
|
||||
pageproducts=pageproducts-1;
|
||||
}
|
||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||
if (typeof (data[(30*pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
||||
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
|
||||
|
||||
if (typeof (data[(maxproduct * pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
||||
pageproducts=pageproducts-1;
|
||||
return;
|
||||
}
|
||||
idata=30*pageproducts; //product data counter
|
||||
idata=<?php echo ($MAXPRODUCT - 2); ?> * pageproducts; //product data counter
|
||||
ishow=0; //product to show counter
|
||||
while (ishow < 30) {
|
||||
|
||||
while (ishow < maxproduct) {
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodesc"+ishow).text("");
|
||||
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
||||
@ -236,60 +247,65 @@ function MoreProducts(moreorless){
|
||||
});
|
||||
}
|
||||
|
||||
function ClickProduct(position){
|
||||
function ClickProduct(position) {
|
||||
$('#proimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#proimg'+position).animate({opacity: '1'}, 100);
|
||||
if ($('#prodiv'+position).data('iscat')==1){
|
||||
console.log("Click on a category at position "+position);
|
||||
LoadProducts(position, true);
|
||||
}
|
||||
else{
|
||||
idproduct=$('#prodiv'+position).data('rowid');
|
||||
console.log("Click on product at position "+position+" for idproduct "+idproduct);
|
||||
if (idproduct=="") return;
|
||||
// Call page invoice.php to generate the section with product lines
|
||||
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteline(){
|
||||
function deleteline() {
|
||||
$("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
function Customer(){
|
||||
function Customer() {
|
||||
$.colorbox({href:"customers.php?nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer");?>"});
|
||||
}
|
||||
|
||||
function CloseBill(){
|
||||
$.colorbox({href:"pay.php?place="+place, width:"80%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CloseBill");?>"});
|
||||
function CloseBill() {
|
||||
invoiceid = $("#invoiceid").val();
|
||||
console.log("Open popup to enter payment on invoiceid="+invoiceid);
|
||||
$.colorbox({href:"pay.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
|
||||
}
|
||||
|
||||
function Floors(){
|
||||
function Floors() {
|
||||
$.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors");?>"});
|
||||
}
|
||||
|
||||
function FreeZone(){
|
||||
function FreeZone() {
|
||||
$.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone");?>"});
|
||||
}
|
||||
|
||||
function TakeposOrderNotes(){
|
||||
function TakeposOrderNotes() {
|
||||
$.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("OrderNotes");?>"});
|
||||
}
|
||||
|
||||
function Refresh(){
|
||||
function Refresh() {
|
||||
$("#poslines").load("invoice.php?place="+place, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
function Search(){
|
||||
function Search() {
|
||||
$("#poslines").load("invoice.php?action=search&place="+place, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
function Search2(){
|
||||
function Search2() {
|
||||
pageproducts=0;
|
||||
$.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) {
|
||||
for (i = 0; i < 30; i++) {
|
||||
@ -318,7 +334,7 @@ function Edit(number){
|
||||
if (editaction=='qty' && editnumber!=""){
|
||||
$("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
$("#qty").html("<?php echo $langs->trans("Qty"); ?>");
|
||||
});
|
||||
return;
|
||||
@ -331,7 +347,7 @@ function Edit(number){
|
||||
if (editaction=='p' && editnumber!=""){
|
||||
$("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
$("#price").html("<?php echo $langs->trans("Price"); ?>");
|
||||
});
|
||||
return;
|
||||
@ -344,7 +360,7 @@ function Edit(number){
|
||||
if (editaction=='r' && editnumber!=""){
|
||||
$("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
$("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>");
|
||||
});
|
||||
return;
|
||||
@ -379,13 +395,13 @@ function Edit(number){
|
||||
|
||||
function TakeposPrintingOrder(){
|
||||
$("#poslines").load("invoice.php?action=order&place="+place, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
function TakeposPrintingTemp(){
|
||||
$("#poslines").load("invoice.php?action=temp&place="+place, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
@ -449,7 +465,7 @@ $( document ).ready(function() {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
// TakePOS setup check
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
@ -463,7 +479,7 @@ if ($resql){
|
||||
if ($paycode == 'LIQ') $paycode = 'CASH';
|
||||
if ($paycode == 'CB') $paycode = 'CARD';
|
||||
if ($paycode == 'CHQ') $paycode = 'CHEQUE';
|
||||
|
||||
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$paycode;
|
||||
if (! empty($conf->global->$accountname) && $conf->global->$accountname > 0) array_push($paiementsModes, $obj);
|
||||
}
|
||||
@ -484,16 +500,15 @@ $menus[$r++]=array('title'=>$langs->trans("FreeZone"),
|
||||
$menus[$r++]=array('title'=>$langs->trans("Customer"),
|
||||
'action'=>'Customer();');
|
||||
$menus[$r++]=array('title'=>$langs->trans("BackOffice"),
|
||||
'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_self\');');
|
||||
$menus[$r++]=array('title'=>$langs->trans("ValidateBill"),
|
||||
'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');');
|
||||
$menus[$r++]=array('title'=>$langs->trans("DoPayment"),
|
||||
'action'=>'CloseBill();');
|
||||
$menus[$r++]=array('title'=>$langs->trans("Logout"),
|
||||
'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';');
|
||||
|
||||
//BAR RESTAURANT specified menu
|
||||
// BAR RESTAURANT specific menu
|
||||
if($conf->global->TAKEPOS_BAR_RESTAURANT){
|
||||
$menus[$r++]=array('title'=>$langs->trans("Floors"),
|
||||
'action'=>'Floors();');
|
||||
$menus[$r++]=array('title'=>$langs->trans("Floors"), 'action'=>'Floors();');
|
||||
if ($conf->global->TAKEPOS_ORDER_PRINTERS){
|
||||
$menus[$r++]=array('title'=>$langs->trans("Order"),
|
||||
'action'=>'TakeposPrintingOrder();');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user