314 lines
12 KiB
Smarty
314 lines
12 KiB
Smarty
{extends "../frame.tpl"}
|
|
|
|
{block body_class}class="panel_frame"{/block}
|
|
|
|
{block title}
|
|
Pokladna
|
|
{/block}
|
|
|
|
{block tabs}
|
|
{windowTab id='flapStat' label="Statistiky"}
|
|
{/block}
|
|
|
|
{block css append}
|
|
<style>
|
|
.ui-widget-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.ui-front {
|
|
z-index: 100;
|
|
}
|
|
</style>
|
|
{/block}
|
|
|
|
{block js append}
|
|
<script type="text/javascript" src="./static/js/qwebchannel.js?v4"></script>
|
|
{/block}
|
|
|
|
{block content}
|
|
<div class="container-fluid">
|
|
|
|
<input type="hidden" class="err-str" value="{$err_str}">
|
|
|
|
<div id="dialog_list_money" title="Platby">
|
|
<iframe id="list_money" class='on-demand boxFlex' style="height:480px; width:750px;"
|
|
src="launch.php?s=list.php&type=pos&order=1d&pagedivide=10"></iframe>
|
|
</div>
|
|
|
|
<div id="dialog_print_iframe" title="Tisk">
|
|
<iframe id="print_iframe" class='on-demand boxFlex' style="height:500px; width:800px;"
|
|
src="about:blank"></iframe>
|
|
<div class="form-group">
|
|
<div class="col-md-12 text-center">
|
|
<input type="button" class="btn btn-block btn-danger order_finish" style="display:none"
|
|
value="Dokončeno">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row bottom-space">
|
|
<div class="col-md-11">
|
|
<h1 class="h4 main-panel-title">Denní tržby pokladny {$admin_name}</h1>
|
|
</div>
|
|
|
|
<div class="col-md-1">
|
|
<a class="btn btn-success" id="refresh_stats">
|
|
<i class="glyphicon glyphicon-refresh"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="row" id="stats-table">
|
|
<div class="col-md-12" id="stats">
|
|
<table class="table table-striped" style="margin-bottom:0;">
|
|
{block payments}
|
|
{foreach $stats as $payment_id => $payment}
|
|
{if is_array($payment)}
|
|
<tr>
|
|
<th>{Pos::getMethodDescr($payment_id)}</th>
|
|
</tr>
|
|
{foreach $payment as $vat => $payment_vat}
|
|
{$with_dph = calcPrice($payment_vat, $vat)}
|
|
<tr>
|
|
<th class="text-right">Celkem s DPH {$vat}%</th>
|
|
<td class="text-right">{calcPrice($payment_vat, $vat)|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-right">DPH {$vat}%</th>
|
|
<td class="text-right">{$with_dph->sub(toDecimal($payment_vat))|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
{/foreach}
|
|
{else}
|
|
<tr>
|
|
<th>{Pos::getMethodDescr($payment_id)}</th>
|
|
<td class="text-right">{$payment|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
{/if}
|
|
{/foreach}
|
|
{/block}
|
|
<tr>
|
|
<th>Slevy</th>
|
|
<td class="text-right">{$discounts|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>Tržba</th>
|
|
<td class="text-right">{$today_sales|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="item-top">Zůstatek v pokladně</th>
|
|
<td class="text-right">{$actually_in_pos|format_price:'ceil=false'}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<a href="#" class="btn btn-primary" id="print_stats" style="width: 100%;">
|
|
Tisk
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<div class="well">
|
|
<div class="row" style="margin-bottom: 5px;">
|
|
<div class="col-md-12 control-label text-center">
|
|
<label>Vyrovnání pokladny</label>
|
|
</div>
|
|
</div>
|
|
<div class="row" style="margin-bottom: 5px;">
|
|
<div class="col-md-12">
|
|
<input type="text" class="form-control input-sm" id="compensation_value">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<input type="button" id='compensation' class="btn btn-block" value="Vyrovnat">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{* <div class="col-md-2 text-right">
|
|
<a class="btn btn-success">
|
|
<i class="glyphicon glyphicon-refresh">
|
|
Pohyby v pokladně
|
|
</i>
|
|
</a>
|
|
</div>*}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/block}
|
|
|
|
{block windowButtons}
|
|
{/block}
|
|
|
|
{*{if !empty($display)}*}
|
|
<script type="text/javascript">
|
|
{block onready append}
|
|
function showErrorFromResponse(response) {
|
|
showInfoPanel($(response).find('.err-str').val(), 'danger');
|
|
}
|
|
|
|
function showOkFromResponse(response) {
|
|
showInfoPanel($(response).find('.err-str').val(), 'success');
|
|
}
|
|
|
|
function showInfoPanel(str, type) {
|
|
var infoRow =
|
|
"<div class=\"row static\">" +
|
|
" <div class=\"alert autoclose alert-" + type + " alert-dismissable fade in\">" +
|
|
" <button type=\"button\" class=\"close\" data-dismiss=\"alert\">" +
|
|
"<span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>" +
|
|
"<span class=\"glyphicon glyphicon-" + ((type == "success") ? "ok" : "remove") + "\"></span>" +
|
|
"<strong>" + str + "</strong>" +
|
|
"</div>" +
|
|
"</div>";
|
|
|
|
$(".container-fluid").prepend(infoRow);
|
|
|
|
setTimeout(function () {
|
|
$(".alert.autoclose").alert("close")
|
|
}, 2000);
|
|
}
|
|
|
|
$("#dialog_list_money").dialog(
|
|
{
|
|
autoOpen: false,
|
|
width: 800,
|
|
height: 550,
|
|
title: "Seznam pohybů peněz v kase",
|
|
resizable: false,
|
|
modal: true,
|
|
draggable: false
|
|
}
|
|
);
|
|
|
|
$("#dialog_print_iframe").dialog(
|
|
{
|
|
autoOpen: false,
|
|
width: 850,
|
|
height: 620,
|
|
title: "Tisk faktury",
|
|
resizable: false,
|
|
modal: true,
|
|
draggable: false
|
|
}
|
|
);
|
|
|
|
$(document).on('click', '#print_stats', function () {
|
|
printClosure();
|
|
});
|
|
|
|
$(document).on('click', '#compensation', function () {
|
|
var compensation_value = $(document).find('#compensation_value').val();
|
|
|
|
if (compensation_value != '') {
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'launch.php?s=pos.stats.php&acn=compensation',
|
|
data: {
|
|
'compensation_value': compensation_value
|
|
},
|
|
success: function (msg) {
|
|
clearTimeout(reload_timer);
|
|
reload();
|
|
showInfoPanel('Vloženo', 'success');
|
|
},
|
|
error: function () {
|
|
showInfoPanel("Chyba, zkuste to za okamžik znovu", 'danger');
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).find('#compensation_value').val('');
|
|
});
|
|
|
|
$(document).on('click', '#print_stats', function () {
|
|
$("#list_money")[0].reload();
|
|
$("#dialog_print_iframe").dialog('open');
|
|
});
|
|
|
|
function printClosure() {
|
|
if (typeof codereader !== 'undefined') {
|
|
codereader.printOrderRequest("{$cfg.Addr.full}admin/launch.php?s=printCenter/printCenter.POSClosure.php&specific_pos={$adminID}");
|
|
}
|
|
else {
|
|
$("#print_iframe")[0].contentWindow.location.href = "./launch.php?s=printCenter/printCenter.POSClosure.php&specific_pos={$adminID}&now=1";
|
|
$("#dialog_print_iframe").dialog('open');
|
|
}
|
|
}
|
|
|
|
$(document).on('click', '#refresh_stats', function () {
|
|
$('#stats-table').load('launch.php?s=pos.stats.php #stats', '', function (response, status, xhr) {
|
|
if (status == "success") {
|
|
showOkFromResponse(response);
|
|
}
|
|
if (status == "error")
|
|
showErrorFromResponse("Časový limit odpověďi vypršel, zkuste to prosím za okamžik znovu", "danger");
|
|
});
|
|
return false;
|
|
});
|
|
|
|
var reload_timer;
|
|
timeout_reload();
|
|
|
|
function reload() {
|
|
clearTimeout(reload_timer);
|
|
|
|
$('#stats-table').load('launch.php?s=pos.stats.php #stats', {}, function (response, status) {
|
|
timeout_reload();
|
|
});
|
|
}
|
|
|
|
function timeout_reload() {
|
|
reload_timer = setTimeout(function () {
|
|
reload();
|
|
}, 60 * 1000);
|
|
}
|
|
|
|
/*
|
|
WEBCHANNELS
|
|
*/
|
|
|
|
window.onload = function () {
|
|
let triedsReconnect = false;
|
|
|
|
function connectSocket(url){
|
|
let socket = new WebSocket(url);
|
|
|
|
socket.onclose = function () {
|
|
console.error("web channel closed");
|
|
};
|
|
socket.onerror = function (error) {
|
|
if (!triedsReconnect) {
|
|
socket = null;
|
|
triedsReconnect = true;
|
|
connectSocket("ws://localhost:12345");
|
|
return;
|
|
}
|
|
console.error("web channel error: " + error);
|
|
};
|
|
socket.onopen = function () {
|
|
new QWebChannel(socket, function (channel) {
|
|
// make dialog object accessible globally
|
|
window.codereader = channel.objects.codereader;
|
|
});
|
|
}
|
|
}
|
|
|
|
connectSocket("ws://localhost:13458");
|
|
};
|
|
{/block}
|
|
</script>
|
|
{*{/if}*}
|