Fixed reports
This commit is contained in:
miroman-afk
2023-05-02 15:21:54 +03:00
parent 70120653f7
commit fb46c8e739
78 changed files with 21233 additions and 1892 deletions

View File

@@ -116,12 +116,10 @@
};
$scope.editClient = function (client, group) {
$scope.contextElement = client;
$scope.contextGroup = group;
$('#edit-client').modal('toggle');
console.log(client);
console.log($scope.contextGroup);
};
$scope.updateClient = function (group) {
@@ -135,6 +133,8 @@
address: $scope.contextElement.address,
email: $scope.contextElement.email,
barcode: $scope.contextElement.barcode,
is_special_price: $scope.contextElement.special_price,
is_employee: $scope.contextElement.employee,
task: 'update'
}, function (data) {
if (data.status == 'success') {
@@ -147,12 +147,11 @@
});
};
$scope.removeClient = function () {
$scope.removeClient = function (client) {
$('#client-confirm-delete').modal('toggle');
$('#edit-client').modal('toggle');
smartRequest.post('v1/client', {
id: $scope.contextElement.id,
id: client.id,
task: 'delete'
}, function (data) {
$scope.getGroups();
@@ -166,6 +165,40 @@
});
};
$scope.lockClient = function (client) {
smartRequest.post('v1/client', {
id: client.id,
task: 'lock'
}, function (data) {
//$scope.getGroups();
//$scope.openGroup($scope.currentGroup);
if (data.message) {
Notification.success(data.message);
$scope.openClientInfo(client);
}
if (data.error_message) {
Notification.error(data.error_message);
}
});
};
$scope.unlockClient = function (client) {
smartRequest.post('v1/client', {
id: client.id,
task: 'unlock'
}, function (data) {
//$scope.getGroups();
//$scope.openGroup($scope.currentGroup);
if (data.message) {
Notification.success(data.message);
$scope.openClientInfo(client);
}
if (data.error_message) {
Notification.error(data.error_message);
}
});
};
$scope.pager = function (currentPage) {
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function (data) {
$scope.clients = data.clients;
@@ -179,11 +212,17 @@
if ($scope.search.query.length === 0) {
$scope.openGroup({id: $scope.currentGroupId});
} else {
smartRequest.post('client/search', {
smartRequest.post('v1/client', {
task: 'search',
name: $scope.search.query
},
function (data) {
$scope.clients = data.clients;
if (data.clients.length > 0) {
Notification.success(data.message);
} else {
Notification.error(data.message);
}
});
}
};
@@ -229,7 +268,8 @@
address: $scope.newClient.address,
email: $scope.newClient.email,
barcode: $scope.newClient.barcode,
is_special_price: $scope.newClient.special_price
is_special_price: $scope.newClient.special_price,
is_employee: $scope.newClient.employee
}, function (data) {
$scope.pager($scope.currentGroup);
$scope.closeCard();
@@ -256,6 +296,7 @@
};
$scope.openClientInfo = function (client) {
$('#actions_tab').tab('show')
$scope.currentClientId = client.id;
$scope.isCreateNewGroup = false;
$scope.isCreateNewClient = false;

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +1,248 @@
(function() {
'use strict';
angular
.module('app')
.controller('ReportsCtrl', ReportsCtrl);
(function () {
'use strict';
angular
.module('app', ['ui.bootstrap', 'ui.utils'])
.controller('ReportsCtrl', ReportsCtrl);
ReportsCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
function ReportsCtrl($scope, smartRequest, Notification) {
var date = new Date();
ReportsCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
var formatted = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
function ReportsCtrl($scope, smartRequest, Notification) {
Number.prototype.toDivide = function () {
var float = String(this.toFixed(2));
if (float.length <= 6) return float;
var space = 0;
var number = '';
date.setDate(date.getDate() - 1);
for (var i = float.length - 1; i >= 0; i--) {
if (space == 3) {
number = ' ' + number;
space = 0;
}
number = float.charAt(i) + number;
space++;
}
var formatted_yesterday = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
return number;
};
var date = new Date();
$scope.report_delete = [];
$scope.report_realisation = [];
$scope.start_date = formatted_yesterday;
$scope.end_date = formatted;
$scope.report_id = 'realisation';
$scope.history = [];
$scope.statistic = {};
$scope.staffs = [];
$scope.printers = [];
var formatted = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
$scope.update = function() {
smartRequest.get('v1/reports', function(data) {
$scope.history = data.reports;
});
smartRequest.get('v1/settings?code=11', function (data) {
$scope.delete_shift_value = data.value;
});
};
date.setDate(date.getDate() - 1);
$scope.deleteReport = function (report) {
$('#preload-modal').modal();
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
smartRequest.post('v1/deletedata', {
value: 'delete_report',
report_id: report.id
}, function (data) {
$scope.status = data.status;
$scope.message = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function() {
//location.reload();
$scope.update();
$('#preload-modal').modal('hide');
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
var formatted_yesterday = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
$scope.reportDelete = function() {
smartRequest.get('v1/datareport?type=deleted&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.report_delete = data.deleted;
$scope.report_delete.total_sum = data.total_sum;
$scope.report_delete.total_count = data.total_count;
$('#report-delete').modal();
}, function(data) {
$scope.update();
});
};
$scope.report_delete = [];
$scope.report_realisation = [];
$scope.start_date = formatted_yesterday;
$scope.end_date = formatted;
$scope.report_id = 'realisation';
$scope.history = [];
$scope.statistic = {};
$scope.staffs = [];
$scope.printers = [];
$scope.dataTableOpt = {
"aoSearchCols": [
null
],
"oLanguage": {
"sUrl": 'https://cdn.datatables.net/plug-ins/1.13.3/i18n/ru.json'
},
"searching": false,
"paging": false,
"info": false,
"order": [[1, 'desc']],
};
$scope.update = function () {
smartRequest.get('v1/reports', function (data) {
$scope.history = data.reports;
$('.modal-body').scrollTop(0);
});
smartRequest.get('v1/settings?code=11', function (data) {
$scope.delete_shift_value = data.value;
});
};
$scope.reportRealisation = function() {
smartRequest.get('report/realisation?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.report_realisation = data.printers;
$scope.return_printers = data.ret_prints;
$scope.report_realisation.total_count = data.total_count;
$scope.report_realisation.total_sum = data.total_sum;
$('#report-realisation').modal();
}, function(data) {
$scope.update();
});
};
$scope.deleteReport = function (report) {
$('#preload-modal').modal();
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
smartRequest.post('v1/deletedata', {
value: 'delete_report',
report_id: report.id
}, function (data) {
$scope.status = data.status;
$scope.message = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function () {
//location.reload();
$scope.update();
$('#preload-modal').modal('hide');
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
$scope.reportStatistic = function() {
smartRequest.get('report/statistics?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.statistic = data.statistic;
$('#report-statistic').modal();
}, function(data) {
$scope.update();
});
};
$scope.closeModal = function (modalName) {
$scope.modalName = '#' + modalName;
$('.modal-body').scrollTop(0);
$($scope.modalName).modal('dispose');
return true;
};
$scope.reportStaff = function() {
smartRequest.get('v1/datareport?type=staff&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.staffs = data.staffs;
$('#report-staff').modal();
}, function(data) {
$scope.update();
});
};
$scope.prevModal = function (modalFromName, modalToName) {
$scope.modal_from = '#' + modalFromName;
$scope.modal_to = '#' + modalToName;
$($scope.modal_from).modal('hide');
$($scope.modal_to).modal('toggle');
};
$scope.reportPay = function() {
smartRequest.get('report/payment?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.printers = data.printers;
$('#report-payment').modal();
}, function(data) {
$scope.update();
});
};
$scope.reportOut = function () {
smartRequest.get('v1/outorders?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.orders = data.orders;
$scope.total = data.total;
$('#report-out').modal();
}, function (data) {
$scope.update();
});
};
$scope.nextModal = function (modalFromName, modalToName) {
$scope.modal_from = '#' + modalFromName;
$scope.modal_to = '#' + modalToName;
$($scope.modal_from).modal('hide');
$($scope.modal_to).modal('toggle');
};
$scope.createReport = function() {
switch ($scope.report_id) {
case 'deleted': $scope.reportDelete(); break;
case 'realisation': $scope.reportRealisation(); break;
case 'statistics': $scope.reportStatistic(); break;
case 'staff': $scope.reportStaff(); break;
case 'pay': $scope.reportPay(); break;
case 'out': $scope.reportOut(); break;
}
};
$scope.getOrders = function (discount_id, modalFromName, modalToName) {
$scope.discount_id = discount_id;
$scope.orders_list = $scope.orders_info[discount_id].orders;
$scope.nextModal(modalFromName, modalToName);
};
$scope.archiveReport = function(type, start_date, end_date) {
$scope.report_id = type;
$scope.start_date = start_date;
$scope.end_date = end_date;
$scope.createReport();
};
$scope.getItems = function (order_id, opened, closed, modalFromName, modalToName) {
smartRequest.get('v1/clientorderinfo?order_id=' + order_id + '&opened=' + opened + '&closed=' + closed, function (data) {
$scope.order_info = data.info;
$scope.nextModal(modalFromName, modalToName);
});
};
$scope.popup = function(data) {
var mywindow = window.open();
mywindow.document.write(data);
mywindow.print();
mywindow.close();
};
$scope.reportDiscounts = function () {
$('#preload-modal').modal();
Notification.primary('Отчет формируется. Ожидайте.');
smartRequest.get('v1/datareport?type=discounts&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.orders_info = data.orders_info;
$scope.orders_count = data.orders_count;
$scope.orders_full_sum = data.orders_full_sum;
$scope.orders_sale_sum = data.orders_sale_sum;
$scope.orders_order_sum = data.orders_order_sum;
$('#preload-modal').modal('hide');
$('#report-discounts').modal();
$scope.update();
});
};
$scope.printElem = function(elem) {
$scope.popup($('<div/>').append($(elem).clone()).html());
};
$scope.reportDelete = function () {
$('#preload-modal').modal();
Notification.primary('Отчет формируется. Ожидайте.');
smartRequest.get('v1/datareport?type=deleted&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.report_delete = data.orders;
$scope.totalSum = data.totalSum;
$scope.totalCount = data.totalCount;
$('#preload-modal').modal('hide');
$('#report-delete').modal();
$scope.update();
});
};
$scope.update();
}
$scope.reportRealisation = function () {
smartRequest.get('v1/datareport?type=realisation&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.update();
$scope.report_realisation = data.printers;
$scope.return_printers = data.ret_prints;
$scope.report_realisation.total_count = data.total_count;
$scope.report_realisation.total_sum = data.total_sum;
$('#report-realisation').modal();
});
};
$scope.reportStatistic = function () {
smartRequest.get('v1/datareport?type=statistic&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.fiscal = data.fiscal;
$scope.realisation = data.realisation;
$scope.returns = data.returns;
$scope.cancellations = data.cancellations;
$scope.statistic = data.statistic;
$scope.presales = data.presales;
$scope.payments = data.payments;
$('#report-statistic').modal();
$scope.update();
});
};
$scope.reportStaff = function () {
smartRequest.get('v1/datareport?type=staff&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.staffs = data.staffs;
$('#report-staff').modal();
$scope.update();
});
};
$scope.reportPay = function () {
smartRequest.get('report/payment?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.printers = data.printers;
$('#report-payment').modal();
$scope.update();
});
};
$scope.reportOut = function () {
smartRequest.get('v1/outorders?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
$scope.orders = data.orders;
$scope.total = data.total;
$('#report-out').modal();
$scope.update();
});
};
$scope.createReport = function () {
switch ($scope.report_id) {
case 'deleted':
$scope.reportDelete();
break;
case 'realisation':
$scope.reportRealisation();
break;
case 'statistics':
$scope.reportStatistic();
break;
case 'staff':
$scope.reportStaff();
break;
case 'pay':
$scope.reportPay();
break;
case 'out':
$scope.reportOut();
break;
case 'discounts':
$scope.reportDiscounts();
break;
}
};
$scope.archiveReport = function (type, start_date, end_date) {
$scope.report_id = type;
$scope.start_date = start_date;
$scope.end_date = end_date;
$scope.createReport();
};
$scope.popup = function (data) {
var mywindow = window.open();
mywindow.document.write(data);
mywindow.print();
mywindow.close();
};
$scope.printElem = function (elem) {
console.log(elem);
$scope.popup($('<div/>').append($(elem).clone()).html());
};
$scope.update();
}
})();

View File

@@ -1,246 +1,345 @@
(function () {
'use strict';
angular
.module('app')
.controller('ShiftsCtrl', ShiftsCtrl);
'use strict';
angular
.module('app')
.filter('curr', function () { //maybe we should take it to the filter folder
return function (input) {
if (typeof input == 'string') {
input = parseFloat(input.replace(/,/g, '.'));
}
var outputValue = input;
if (typeof outputValue !== 'undefined') {
return outputValue.toFixed(2);
} else {
return 0.00;
}
};
})
.controller('ShiftsCtrl', ShiftsCtrl);
ShiftsCtrl.$inject = ['$scope', '$filter', 'smartRequest', 'Notification'];
function ShiftsCtrl($scope, $filter, smartRequest, Notification) {
var date = new Date();
var formatted = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
date.setDate(date.getDate() - 1);
var formatted_yesterday = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
ShiftsCtrl.$inject = ['$scope', '$filter', 'smartRequest', 'Notification'];
$scope.start_date = formatted;
$scope.end_date = formatted_yesterday;
$scope.response = false;
$scope.shifts = [];
$scope.report_delete = [];
$scope.countOfPages = 1;
$scope.currentPage = 1;
$scope.statistic = {};
$scope.staffs = [];
$scope.parseFloat = parseFloat;
function ShiftsCtrl($scope, $filter, smartRequest, Notification) {
Number.prototype.toDivide = function() {
var float = String(this.toFixed(2));
if(float.length <= 6) return float;
var space = 0;
var number = '';
$scope.add = function() {
$scope.reImport = {};
$('#reImport').modal();
};
for(var i = float.length - 1; i >= 0; i--) {
if(space == 3) {
number = ' ' + number;
space = 0;
}
number = float.charAt(i) + number;
space++;
}
$scope.create = function() {
var start_date = document.getElementById("startDate").value;
var end_date = document.getElementById("endDate").value;
console.log(start_date, end_date);
smartRequest.get('v1/import?start_date=' + encodeURIComponent(start_date) + '&end_date=' + encodeURIComponent(end_date), function(data) {
$scope.response = data.message;
if (data.message == 'shifts not found') {
Notification.error('Смены не найдены');
} else {
Notification.success('Задача создана');
$scope.update();
}
});
$('#reImport').modal('toggle');
};
$scope.update = function () {
smartRequest.get('shift/list?page=' + $scope.currentPage, function (data) {
$scope.shifts = data.shifts;
$scope.countOfPages = data.pages;
$scope.pages = $scope.makePages();
});
smartRequest.get('v1/settings?code=11', function (data) {
$scope.delete_shift_value = data.value;
});
};
return number;
};
var date = new Date();
var formatted = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
date.setDate(date.getDate() - 1);
var formatted_yesterday = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
$scope.deleteShift = function (shift) {
$('#preload-modal').modal();
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
smartRequest.post('v1/deletedata', {
value: 'delete_shift',
shift_id: shift.id
}, function (data) {
$scope.status = data.status;
$scope.message = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function() {
//location.reload();
$scope.update();
$('#preload-modal').modal('hide');
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
$scope.start_date = formatted;
$scope.end_date = formatted_yesterday;
$scope.response = false;
$scope.shifts = [];
$scope.report_delete = [];
$scope.countOfPages = 1;
$scope.currentPage = 1;
$scope.statistic = {};
$scope.staffs = [];
$scope.parseFloat = parseFloat;
$scope.dataTableOpt = {
"aoSearchCols": [
null
],
"oLanguage": {
"sUrl": 'https://cdn.datatables.net/plug-ins/1.13.3/i18n/ru.json'
},
"searching": false,
"paging": false,
"info": false,
"order": [[1, 'desc']],
};
$scope.reportMerged = function (shift) {
smartRequest.get('v1/datareport?type=merge&shift_id=' + shift.id, function (data) {
$scope.report_merge = data.data;
$scope.report_merge.count = data.count;
$scope.report_merge.shift_id = data.shift_id;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-merge').modal();
});
};
$scope.add = function () {
$scope.reImport = {};
$('#reImport').modal();
};
$scope.create = function () {
var start_date = document.getElementById("startDate").value;
var end_date = document.getElementById("endDate").value;
console.log(start_date, end_date);
smartRequest.get('v1/import?start_date=' + encodeURIComponent(start_date) + '&end_date=' + encodeURIComponent(end_date), function (data) {
$scope.response = data.message;
if (data.message == 'shifts not found') {
Notification.error('Смены не найдены');
} else {
Notification.success('Задача создана');
$scope.update();
}
});
$('#reImport').modal('toggle');
};
$scope.closeModal = function (modalName) {
$scope.modalName = '#' + modalName;
$($scope.modalName).modal('dispose');
};
$scope.update = function () {
smartRequest.get('shift/list?page=' + $scope.currentPage, function (data) {
$scope.shifts = data.shifts;
$scope.countOfPages = data.pages;
$scope.pages = $scope.makePages();
$('.modal-body').scrollTop(0);
});
smartRequest.get('v1/settings?code=11', function (data) {
$scope.delete_shift_value = data.value;
});
};
$scope.deleteShift = function (shift) {
$('#preload-modal').modal();
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
smartRequest.post('v1/deletedata', {
value: 'delete_shift',
shift_id: shift.id
}, function (data) {
$scope.status = data.status;
$scope.message = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function () {
//location.reload();
$scope.update();
$('#preload-modal').modal('hide');
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
$scope.prevModal = function (modalFromName, modalToName) {
$scope.modal_from = '#' + modalFromName;
$scope.modal_to = '#' + modalToName;
$($scope.modal_from).modal('hide');
$($scope.modal_to).modal('toggle');
};
$scope.nextModal = function (modalFromName, modalToName) {
$scope.modal_from = '#' + modalFromName;
$scope.modal_to = '#' + modalToName;
$($scope.modal_from).modal('hide');
$($scope.modal_to).modal('toggle');
};
$scope.getOrders = function (discount_id, modalFromName, modalToName) {
$scope.discount_id = discount_id;
$scope.orders_list = $scope.orders_info[discount_id].orders;
$scope.nextModal(modalFromName, modalToName);
};
$scope.getItems = function (order_id, opened, closed, modalFromName, modalToName) {
smartRequest.get('v1/clientorderinfo?order_id=' + order_id + '&opened=' + opened + '&closed=' + closed, function (data) {
$scope.order_info = data.info;
$scope.nextModal(modalFromName, modalToName);
});
};
$scope.reportDiscounts = function (shift) {
smartRequest.get('v1/datareport?type=discounts&shift_id=' + shift.id, function (data) {
$scope.orders_info = data.orders_info;
$scope.orders_count = data.orders_count;
$scope.orders_full_sum = data.orders_full_sum;
$scope.orders_sale_sum = data.orders_sale_sum;
$scope.orders_order_sum = data.orders_order_sum;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-discounts').modal();
$scope.update();
});
};
$scope.reportMerged = function (shift) {
smartRequest.get('v1/datareport?type=merge&shift_id=' + shift.id, function (data) {
$scope.report_merge = data.data;
$scope.report_merge.count = data.count;
$scope.report_merge.shift_id = data.shift_id;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-merge').modal();
});
};
$scope.reportMoved = function (shift) {
smartRequest.get('v1/datareport?type=move&shift_id=' + shift.id, function (data) {
$scope.report_move = data.data;
$scope.report_move.count = data.count;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-move').modal();
});
};
$scope.reportMoved = function (shift) {
smartRequest.get('v1/datareport?type=move&shift_id=' + shift.id, function (data) {
$scope.report_move = data.data;
$scope.report_move.count = data.count;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-move').modal();
});
};
$scope.reportSliced = function (shift) {
smartRequest.get('v1/datareport?type=slice&shift_id=' + shift.id, function (data) {
$scope.report_slice = data.data;
$scope.report_slice.count = data.count;
$scope.report_slice.shift_id = data.shift_id;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-slice').modal();
});
};
$scope.reportSliced = function (shift) {
smartRequest.get('v1/datareport?type=slice&shift_id=' + shift.id, function (data) {
$scope.report_slice = data.data;
$scope.report_slice.count = data.count;
$scope.report_slice.shift_id = data.shift_id;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-slice').modal();
});
};
$scope.reportDelete = function (shift) {
smartRequest.get('v1/datareport?type=deleted&shift_id=' + shift.id, function (data) {
$scope.report_delete = data.deleted;
$scope.report_delete.total_sum = data.total_sum;
$scope.report_delete.total_count = data.total_count;
$scope.reportDelete = function (shift) {
smartRequest.get('v1/datareport?type=deleted&shift_id=' + shift.id, function (data) {
if (data.totalCount > 0) {
$scope.report_delete = data.orders;
$scope.total_sum = data.totalSum;
$scope.total_count = data.totalCount;
$scope.shift_id = shift.id;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.update();
$('#shift-delete').modal();
$('#report-delete').modal();
});
};
} else {
Notification.error(data.message);
}
$scope.reportRealisation = function (shift) {
smartRequest.get('report/realisation?shift_id=' + shift.id, function (data) {
});
};
$scope.report_realisation = data.printers;
$scope.return_printers = data.ret_prints;
$scope.reportRealisation = function (shift) {
smartRequest.get('v1/datareport?type=realisation&shift_id=' + shift.id, function (data) {
$scope.report_realisation = data.printers;
$scope.return_printers = data.ret_prints;
$scope.report_realisation.total_count = data.total_count;
$scope.report_realisation.total_sum = data.total_sum;
$scope.report_realisation.total_count = data.total_count;
$scope.report_realisation.total_sum = data.total_sum;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.update();
$('#report-realisation').modal();
});
};
$('#report-realisation').modal();
});
};
$scope.reportStatistic = function (shift) {
smartRequest.get('v1/datareport?type=statistic&shift_id=' + shift.id, function (data) {
$scope.fiscal = data.fiscal;
$scope.realisation = data.realisation;
$scope.returns = data.returns;
$scope.cancellations = data.cancellations;
$scope.statistic = data.statistic;
$scope.presales = data.presales;
$scope.payments = data.payments;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.update();
$('#report-statistic').modal();
});
};
$scope.reportStatistic = function (shift) {
smartRequest.get('report/statistics?shift_id=' + shift.id, function (data) {
$scope.statistic = data.statistic;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.reportStaff = function (shift) {
smartRequest.get('v1/datareport?type=staff&shift_id=' + shift.id, function (data) {
$scope.staffs = data.staffs;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-statistic').modal();
});
};
$scope.update();
$('#report-staff').modal();
});
};
$scope.reportStaff = function (shift) {
smartRequest.get('v1/datareport?type=staff&shift_id=' + shift.id, function (data) {
$scope.staffs = data.staffs;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.reportPay = function (shift) {
smartRequest.get('report/payment?shift_id=' + shift.id, function (data) {
$scope.printers = data.printers;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$('#report-staff').modal();
});
};
$scope.update();
$('#report-payment').modal();
});
};
$scope.reportPay = function (shift) {
smartRequest.get('report/payment?shift_id=' + shift.id, function (data) {
$scope.reportOut = function (shift) {
smartRequest.get('v1/outorders?shift_id=' + shift.id, function (data) {
$scope.response = data.message;
if (data.message == 'false') {
Notification.error('Внешние заказы не найдены');
} else {
$scope.orders = data.orders;
$scope.shift = data.shift;
$scope.total = data.total;
$scope.printers = data.printers;
$scope.start_date = shift.opened;
$scope.end_date = shift.closed;
$scope.update();
$('#report-out').modal();
}
});
};
$('#report-payment').modal();
}, function (data) {
$scope.update();
});
};
$scope.reportOut = function (shift) {
smartRequest.get('v1/outorders?shift_id=' + shift.id, function (data) {
$scope.response = data.message;
if (data.message == 'false') {
Notification.error('Внешние заказы не найдены');
} else {
$scope.orders = data.orders;
$scope.shift = data.shift;
$scope.total = data.total;
$scope.restoreShift = function (shift) {
$('#preload-modal').modal();
Notification.primary('Дождитесь загрузки! Страница обновится автоматически.');
smartRequest.post('v1/restoreshift', {
shift_id: shift.id
}, function (data) {
$scope.status = data.status;
$scope.response = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function () {
location.reload();
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
$('#report-out').modal();
}
$scope.popup = function (data) {
var mywindow = window.open();
mywindow.document.write(data);
}, function (data) {
$scope.update();
});
};
mywindow.print();
mywindow.close();
};
$scope.restoreShift = function (shift) {
$('#preload-modal').modal();
Notification.primary('Дождитесь загрузки! Страница обновится автоматически.');
smartRequest.post('v1/restoreshift', {
shift_id: shift.id
}, function (data) {
$scope.status = data.status;
$scope.response = data.message;
if (data.status == 'success') {
Notification.success(data.message);
setTimeout(function() {
location.reload();
}, 1000);
}
if ($scope.status == 'error') {
Notification.error(data.message);
}
});
};
$scope.printElem = function (elem) {
$scope.popup($('<div/>').append($(elem).clone()).html());
};
$scope.popup = function(data) {
var mywindow = window.open();
mywindow.document.write(data);
$scope.makePages = function () {
return Array.from({length: $scope.countOfPages}, (v, k) => k + 1);
};
mywindow.print();
mywindow.close();
};
$scope.showPage = function (index) {
$scope.currentPage = index;
$scope.update();
};
$scope.printElem = function(elem) {
$scope.popup($('<div/>').append($(elem).clone()).html());
};
$scope.nextPage = function () {
$scope.currentPage++;
$scope.update();
};
$scope.makePages = function () {
return Array.from({ length: $scope.countOfPages }, (v, k) => k + 1);
};
$scope.prevPage = function () {
$scope.currentPage--;
$scope.update();
};
$scope.showPage = function (index) {
$scope.currentPage = index;
$scope.update();
};
$scope.nextPage = function () {
$scope.currentPage++;
$scope.update();
};
$scope.prevPage = function () {
$scope.currentPage--;
$scope.update();
};
$scope.update();
}
$scope.update();
}
})();

271
web/controllers/staff.js Normal file
View File

@@ -0,0 +1,271 @@
(function() {
'use strict';
angular
.module('app')
.controller('StaffCtrl', StaffCtrl);
StaffCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$timeout'];
function StaffCtrl($scope, smartRequest, Notification, $timeout) {
$scope.groups = [];
$scope.personals = [];
$scope.parentGroup = 0;
$scope.parentGroupCode = '';
$scope.search = {
query: ''
};
$scope.interfaces = [];
$scope.rights = [];
$scope.currentPersonalObject = {
id: 0
};
$scope.currentGroupObject = {
id: 0
};
var promise = 0;
smartRequest.get('v1/clearcache?folder=staff', function () {});
$scope.update = function() {
smartRequest.get('staff/group/list', function(data) {
$scope.groups = data.groups;
});
};
$scope.updateGroups = function (callback, id) {
smartRequest.get('staff/group/list', function(data) {
$scope.groups = data.groups;
if (callback) {
var newGroup = $scope.getItemById($scope.groups, id);
callback(newGroup);
}
});
};
$scope.updatePersonals = function (callback, id) {
smartRequest.get('staff/list?group_code=' + $scope.parentGroupCode, function(data) {
$scope.personals = data.staff;
if (callback) {
var newStaff = $scope.getItemById($scope.personals, id);
callback(newStaff);
}
});
};
$scope.addGroup = function() {
smartRequest.post('staff/group/store', {
name: 'Новая группа'
}, function(data) {
var groupId = data.group_id;
$scope.updateGroups($scope.showGroup, groupId);
});
};
$scope.addPersonal = function() {
smartRequest.post('staff/store', {
name: 'Новый персонал',
group_code: $scope.parentGroupCode
}, function(data) {
var staffId = data.staff_id;
$scope.updatePersonals($scope.showPersonal, staffId);
});
};
$scope.openGroup = function(group) {
$scope.currentGroupObject = {
id: 0
};
$scope.parentGroup = group.id;
$scope.parentGroupCode = group.code;
$scope.personals = [];
$scope.updatePersonal();
};
$scope.showPersonal = function(personal) {
$scope.currentGroupObject = {
id: 0
};
$scope.currentPersonalObject = personal;
};
$scope.showGroup = function(group) {
$scope.currentPersonalObject = {
id: 0
};
$scope.currentGroupObject = group;
for(var i = 0; i < $scope.rights.length; i++) {
$scope.rights[i].is_active = false;
}
smartRequest.get('staff/right/list?group_code=' + $scope.currentGroupObject.code, function(data) {
for(var i = 0; i < data.rights.length; i++) {
for(var j = 0; j < $scope.rights.length; j++) {
if(data.rights[i].code === $scope.rights[j].code) {
$scope.rights[j].is_active = true;
break;
}
}
}
});
};
$scope.updatePersonal = function() {
smartRequest.get('staff/list?group_code=' + $scope.parentGroupCode, function(data) {
$scope.personals = data.staff;
});
};
$scope.closeCard = function() {
$scope.currentPersonalObject = {
id: 0
};
$scope.currentGroupObject = {
id: 0
};
};
$scope.getItemById = function(list, id) {
var res;
list.forEach(function (item) {
if (item.id == id) {
res = item;
return;
}
});
return res;
};
$scope.savePersonal = function() {
smartRequest.post('staff/update', {
id: $scope.currentPersonalObject.id,
name: $scope.currentPersonalObject.name,
password: $scope.currentPersonalObject.password,
interface_code: $scope.currentPersonalObject.interface_code,
group_code: $scope.currentPersonalObject.group_code
},
function(data) {
Notification.success('Персонал сохранен');
$scope.closeCard();
});
};
$scope.saveGroup = function() {
var activeRights = $scope.rights.filter(right => right.is_active);
smartRequest.post('staff/group/update', {
id: $scope.currentGroupObject.id,
name: $scope.currentGroupObject.name,
interface_code: $scope.currentGroupObject.interface_code,
sub_interface_code: $scope.currentGroupObject.sub_interface_code,
rights: JSON.stringify(activeRights.map(activeRight => activeRight.code))
}, function(data) {
Notification.success('Группа сохранена');
$scope.closeCard();
});
};
$scope.upFolder = function() {
$scope.currentPersonalObject = {
id: 0
};
$scope.currentGroupObject = {
id: 0
};
$scope.parentGroup = 0;
$scope.update();
};
$scope.removePersonal = function() {
$('#personal-confirm-delete').modal('toggle');
smartRequest.post('staff/delete', {
id: $scope.currentPersonalObject.id
}, function(data) {
$scope.currentPersonalObject = {
id: 0
};
$scope.updatePersonal();
});
};
$scope.removeGroup = function() {
$('#group-confirm-delete').modal('toggle');
smartRequest.post('staff/group/delete', {
id: $scope.currentGroupObject.id
}, function(data) {
$scope.currentGroupObject = {
id: 0
};
$scope.update();
});
};
$scope.personalSearch = function() {
if(promise){
$timeout.cancel(promise);
}
promise = $timeout(function() {
if($scope.search.query.length > 0) {
smartRequest.post('staff/search', {
name: $scope.search.query
},
function (data) {
$scope.personals = data.staff;
});
}
else {
$scope.upFolder();
}
}, 300);
};
$scope.setRights = function() {
$scope.removeActiveToggle();
$scope.onRightsByTemplate();
};
$scope.removeActiveToggle = function() {
$scope.rights.forEach(function (item) {
if (item.is_active) {
item.is_active = false;
}
});
};
$scope.onRightsByTemplate = function() {
smartRequest.get('staff/rights/template?code=' + $scope.currentGroupObject.interface_code + '&sub_code=' + $scope.currentGroupObject.sub_interface_code, function (data) {
for(var i = 0; i < data.rights.length; i++) {
for(var j = 0; j < $scope.rights.length; j++) {
if(data.rights[i].code === $scope.rights[j].code) {
$scope.rights[j].is_active = true;
break;
}
}
}
});
};
$scope.update();
smartRequest.get('staff/interface/list', function(data) {
$scope.interfaces = data.interfaces;
});
smartRequest.get('staff/right/all', function(data) {
$scope.rights = data.rights;
});
}
})();

View File

@@ -23,7 +23,7 @@
$scope.terminalLogs = [];
$scope.update = function () {
smartRequest.get('settings/terminals', function (data) {
smartRequest.get('v1/settings?method=terminals', function (data) {
$scope.terminals = data.terminals;
});
};

View File

@@ -35,6 +35,13 @@ item: [
order: 40
},
{
name: 'Персонал',
acl: 'staff',
url: 'app.staff',
icon: 'business',
order: 50
},
{
name: 'Реализация',
acl: 'shifts,report',
icon: 'library_books',

View File

@@ -46,6 +46,14 @@
controller: 'ClientsCtrl',
resolve: ['scripts/controllers/clients.js']
},
{
code: 'app.staff',
url: '/staff',
templateUrl: '../views/staff/index.html',
data: {title: 'Персонал'},
controller: 'StaffCtrl',
resolve: ['scripts/controllers/staff.js']
},
{
code: 'app.shifts',
url: '/shifts',

View File

@@ -4,26 +4,49 @@
<h5 class="modal-title">Редактирование клиента</h5>
</div>
<div class="modal-body p-lg">
<form role="form" class="ng-pristine ng-valid container">
<form role="form" class="ng-pristine ng-valid container" ng-submit="updateClient(contextGroup)">
<div class="form-group row">
<div class="col-sm-12">
<span>Группа: </span>
<select name="group" class="form-control input-c" ng-options="opt.id as opt.name for opt in groups" ng-model="contextGroup"></select>
<span>Имя: </span><input class="form-control" placeholder="Название" type="text" ng-model="contextElement.name">
<span>Телефон: </span><input class="form-control" type="text" ng-model="contextElement.phone" ui-mask="+375 (99) 999-99-99">
<span>Адрес: </span><input class="form-control" placeholder="Введите email" type="text" ng-model="contextElement.address">
<span>Email: </span><input class="form-control" placeholder="Введите адрес" type="text" ng-model="contextElement.email">
<span>Штрих код: </span><input class="form-control" placeholder="Введите штрих код" type="text" ng-model="contextElement.barcode">
</div>
<span>Группа: </span>
<select name="group" class="form-control input-c"
ng-options="opt.id as opt.name for opt in groups" ng-model="contextGroup"></select>
<span>Имя: </span><input class="form-control" placeholder="Название" type="text"
ng-model="contextElement.name">
<span>Телефон: </span><input class="form-control" type="text" ng-model="contextElement.phone"
ui-mask="+375 (99) 999-99-99">
<span>Адрес: </span><input class="form-control" placeholder="Введите email" type="text"
ng-model="contextElement.address">
<span>Email: </span><input class="form-control" placeholder="Введите адрес" type="text"
ng-model="contextElement.email">
<span>Штрих код: </span><input class="form-control" placeholder="Введите штрих код" type="text"
ng-model="contextElement.barcode">
<p>
<div class="form-group form-group-inline row">
<label class="col-sm-3 form-group-label" for="specialPriceCheck">Скидка по
себестоимости </label>
<div class="col-sm-9">
<input class="form-group-input" type="checkbox" value="" id="specialPriceCheck"
ng-model="contextElement.special_price" ng-checked="contextElement.special_price">
</div>
</div>
<div class="form-group form-group-inline row">
<label class="col-sm-3 form-group-label" for="employeeCheck">Сотрудник</label>
<div class="col-sm-9">
<input class="form-group-input" type="checkbox" value="" id="employeeCheck"
ng-model="contextElement.employee" ng-checked="contextElement.employee">
</div>
</div>
</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
<button type="submit" class="btn success p-x-md">Сохранить</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn danger p-x-md pull-left" data-toggle="modal" data-target="#client-confirm-delete"><i class="material-icons">&#xE872;</i></button>
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
<button type="button" class="btn success p-x-md" ng-click="updateClient(contextGroup)">Сохранить</button>
</div>
</div>
</div>

View File

@@ -103,44 +103,57 @@
<div class="p-a-md">
<div class="row m-t">
<div class="col-sm-12">
<a href="" class="pull-left m-r-md">
<div class="col-sm-11">
<a href="" class="pull-left m-r-md">
<span class="avatar w-96">
<img src="../views/clients/images/client.png">
<i class="on b-white"></i>
</span>
</a>
<div class="clear m-b">
<h3 class="m-0 m-b-xs">{{currentClient.name}}</h3>
<p class="text-muted">
</a>
<div class="clear m-b">
<h3 class="m-0 m-b-xs">{{currentClient.name}} <span ng-if="currentClient.info.is_block">(КЛИЕНТ ЗАБЛОКИРОВАН)</span></h3>
<p class="text-muted">
<span class="m-r">
<i class="fa fa-phone m-r-sm text-muted"></i>{{currentClient.info.phone}}
</span>
<small>
<i class="fa fa-map-marker m-r-xs"></i>{{currentClient.info.address}}
</small>
</p>
<small>
<i class="fa fa-map-marker m-r-xs"></i>{{currentClient.info.address}}
</small>
</p>
</div>
</div>
<div class="p-y text-center text-sm-center col-sm-12">
<a href="" class="inline p-x text-center">
<span class="h5 block m-0">{{currentClient.info.order_sum | curr}} BYN</span>
<small class="text-xs text-muted">Сумма заказов</small>
</a>
<a href="" class="inline p-x b-l text-center">
<span class="h5 block m-0">{{currentClient.info.order_count}}</span>
<small class="text-xs text-muted">Кол-во заказов</small>
</a>
<a href="" class="inline p-x b-l b-r text-center"
ng-if="currentClient.info.presale > 0">
<span class="h5 block m-0">{{currentClient.info.presale | curr}} BYN</span>
<small class="text-xs text-muted">Аванс</small>
</a>
<a href="" class="inline p-x text-center" ng-if="currentClient.info.bonus > 0">
<span class="h5 block m-0">{{currentClient.info.bonus}}</span>
<small class="text-xs text-muted">Бонусы</small>
</a>
<div class="col-sm-1">
<div class="dropdown inline">
<button class="btn white dropdown-toggle" data-toggle="dropdown"
aria-expanded="true"><i class="fa fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-scale pull-right">
<a class="dropdown-item" href="" ng-if="!currentClient.info.is_block" ng-click="lockClient(currentClient)">Заблокировать</a>
<a class="dropdown-item" href="" ng-if="currentClient.info.is_block" ng-click="unlockClient(currentClient)">Разблокировать</a>
<a class="dropdown-item" data-toggle="modal"
data-target="#client-confirm-delete">Удалить</a>
</div>
</div>
</div>
</div>
<div class="p-y text-center text-sm-center col-sm-12">
<a href="" class="inline p-x text-center">
<span class="h5 block m-0">{{currentClient.info.order_sum | curr}} BYN</span>
<small class="text-xs text-muted">Сумма заказов</small>
</a>
<a href="" class="inline p-x b-l text-center">
<span class="h5 block m-0">{{currentClient.info.order_count}}</span>
<small class="text-xs text-muted">Кол-во заказов</small>
</a>
<a href="" class="inline p-x b-l b-r text-center"
ng-if="currentClient.info.presale > 0">
<span class="h5 block m-0">{{currentClient.info.presale | curr}} BYN</span>
<small class="text-xs text-muted">Аванс</small>
</a>
<a href="" class="inline p-x text-center" ng-if="currentClient.info.bonus > 0">
<span class="h5 block m-0">{{currentClient.info.bonus}}</span>
<small class="text-xs text-muted">Бонусы</small>
</a>
</div>
</div>
</div>
</div>
@@ -148,17 +161,17 @@
<div class="row">
<div class="col-lg-12 col-sm-9">
<div class="p-y-md clearfix nav-active-primary">
<ul class="nav nav-pills nav-sm">
<ul class="nav nav-pills nav-sm" id="client_tab">
<li class="nav-item">
<a class="nav-link active" href="" data-toggle="tab" data-target="#tab_1"
<a class="nav-link active" id="actions_tab" href="" data-toggle="tab" data-target="#actions"
aria-expanded="true">Журнал действий</a>
</li>
<li class="nav-item">
<a class="nav-link" href="" data-toggle="tab" data-target="#tab_2"
<a class="nav-link" id="orders_tab" href="" data-toggle="tab" data-target="#orders"
aria-expanded="false" ng-click="getOrders(currentClient.id)">Заказы</a>
</li>
<li class="nav-item">
<a class="nav-link" href="" data-toggle="tab" data-target="#tab_3"
<a class="nav-link" id="info_tab" href="" data-toggle="tab" data-target="#info"
aria-expanded="false">Информация</a>
</li>
</ul>
@@ -170,19 +183,14 @@
<div class="row">
<div class="col-sm-8 col-lg-12">
<div class="tab-content">
<div class="tab-pane p-v-sm active" id="tab_1" aria-expanded="true">
<div class="tab-pane p-v-sm active" id="actions" aria-expanded="true">
<div class="streamline b-l m-b m-l"
style="width:auto;max-height:350px;overflow-y: auto;"
ng-if="clientLogs.length > 0">
<div class="sl-item b-success" ng-repeat="clientLog in clientLogs">
<div class="sl-content" ng-if="clientLog.type == 2">
<div class="sl-content">
<div class="sl-date text-muted">{{clientLog.time}}</div>
<p>{{clientLog.action}} на сумму {{clientLog.value | curr}} BYN
пользователем {{clientLog.who}}</p>
</div>
<div class="sl-content" ng-if="clientLog.type == 1">
<div class="sl-date text-muted">{{clientLog.time}}</div>
<p>{{clientLog.action}} в количестве {{clientLog.value}} шт</p>
<p>{{clientLog.action}}</p>
</div>
</div>
</div>
@@ -195,7 +203,7 @@
</div>
</div>
</div>
<div class="tab-pane p-v-sm" id="tab_2" aria-expanded="true">
<div class="tab-pane p-v-sm" id="orders" aria-expanded="true">
<div class="streamline b-l m-b m-l"
style="width:auto;max-height:350px;overflow-y: auto;"
ng-if="orders.length > 0">
@@ -231,7 +239,7 @@
</div>
</div>
</div>
<div class="tab-pane p-v-sm" id="tab_3">
<div class="tab-pane p-v-sm" id="info">
<div class="row m-b">
<div class="col-xs-10">
<small class="text-muted">Телефон:</small>
@@ -418,6 +426,14 @@
ng-model="newClient.special_price">
</div>
</div>
<div class="form-group form-group-inline row">
<label class="col-sm-3 form-group-label" for="employeeCheck">Сотрудник</label>
<div class="col-sm-9">
<input class="form-group-input" type="checkbox" value="" id="employeeCheck"
ng-model="newClient.employee">
</div>
</div>
</div>
<div class="dker p-a">
@@ -466,7 +482,7 @@
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
<button type="button" class="btn danger p-x-md" ng-click="removeClient()">Да</button>
<button type="button" class="btn danger p-x-md" ng-click="removeClient(currentClient)">Да</button>
</div>
</div>
</div>

View File

@@ -16,12 +16,29 @@
<div class="padding">
<div class="margin">
<h5 class="m-b-0 _300">{{update_time}}
<i title="Данные о текущей смене скоро обновятся. Обновите страницу через несколько минут" class="fa fa-spinner fa-spin text-success" ng-if="need_update"></i>
</h5>
<small class="text-muted">Данные по филиалу
<strong>{{globals.currentUser.organization.name}}</strong>
</small>
<div class="row">
<div class="col-sm-9">
<h5 id="currentTime" class="m-b-0 _300">{{ currentDate | date:'dd.MM.yyyy HH:mm:ss' }}
</h5>
<small class="text-muted">Данные по филиалу
<strong>{{globals.currentUser.organization.name}}</strong>
</small>
</div>
<div class="col-sm-3">
<label class="md-switch">
<input id="timerCheckbox" type="checkbox" ng-model="timerEnabled" ng-change="toggleTimer()">
<i class="blue"></i>
<span ng-show="timerEnabled">
Автоматическое обновление через: {{ timeRemaining | date:'mm:ss' }}
</span>
<span ng-show="!timerEnabled">
Обновление данных отключено!
</span>
</label>
</div>
</div>
</div>
<div class="row">
@@ -113,7 +130,7 @@
<div class="box-tool box-tool-white">
<ul class="nav">
<li class="nav-item">
<a ng-click="getMore('delete')">
<a ng-click="getMoreDeleted()">
<i class="fa fa-eye"></i>
</a>
</li>
@@ -171,7 +188,7 @@
<div class="box-tool box-tool-white">
<ul class="nav">
<li class="nav-item">
<a ng-click="getMore('guests')">
<a ng-click="getMoreGuests()">
<i class="fa fa-eye"></i>
</a>
</li>
@@ -402,7 +419,7 @@
</div>
<div class="row">
<div class="col-md-12 col-xl-8" style="max-height: 620px; overflow-y: hidden;">
<div class="col-md-12 col-xl-8" style="max-height: 620px; "><!--overflow-y: hidden;-->
<div class="box">
<div class="box-header">
<h3>Топ продаваемых товаров</h3>
@@ -548,13 +565,13 @@
<div ui-include="'../views/dashboard/add.html'"></div>
</div>
<div class="modal fade" id="get-more-delete">
<div ui-include="'../views/dashboard/items/more-delete.html'"></div>
<div class="modal fade" id="get-more-deleted">
<div ui-include="'../views/dashboard/items/more-deleted.html'"></div>
</div>
<div class="modal my-modal fade" id="get-more-newyear">
<!--<div class="modal my-modal fade" id="get-more-newyear">
<div ui-include="'../views/dashboard/items/more-newyear.html'"></div>
</div>
</div>-->
<div class="modal fade" id="get-more-guests">
<div ui-include="'../views/dashboard/items/more-guests.html'"></div>
@@ -592,8 +609,8 @@
<div ui-include="'../views/dashboard/items/items-staff.html'"></div>
</div>
<div class="modal fade" id="items-delete">
<div ui-include="'../views/dashboard/items/items-delete.html'"></div>
<div class="modal fade" id="items-deleted">
<div ui-include="'../views/dashboard/items/items-deleted.html'"></div>
</div>
<div class="modal fade" id="preload-modal" data-backdrop="true">

View File

@@ -1,7 +1,7 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-toggle="modal" data-target="#items-delete" ng-click="returnModal('delete')">
<button type="button" class="close" data-toggle="modal" data-target="#items-deleted" ng-click="returnModal('deleted')">
<i class="material-icons md-24">arrow_back</i>
</button>
<h5 class="modal-title">Подробнее об удалениях в заказе № {{ order.code }}</h5>

View File

@@ -17,7 +17,7 @@
</thead>
<tbody>
<tr ng-repeat="deleted_order in moreData.deleted_orders" ng-click="getItems('delete', deleted_order)">
<tr ng-repeat="deleted_order in moreData.deleted_orders" ng-click="getItemsDeleted(deleted_order)">
<td class="text-right">{{ deleted_order.number }}</td>
<td class="text-right">{{ deleted_order.opened }}</td>
<td class="text-right">{{ getClosedDate(deleted_order.closed) }}</td>
@@ -36,4 +36,5 @@
<div class="text-muted">Удаленных позиций нет</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -27,8 +27,8 @@
<thead>
<tr>
<th>Всего: {{ discounts }} {{ GetCountTotalOrders(discounts) }}</th>
<th class="text-right">на сумму {{ moreData.amount | curr }}</th>
<th class="text-right">со скидой в: {{discounts_sum | curr }}</th>
<th class="text-right">на сумму: {{ moreData.amount | curr }}</th>
<th class="text-right">со скидкой: {{discounts_sum | curr }}</th>
<th class="text-right">Итого: {{ moreData.total_sum | curr }} BYN</th>
</tr>
</thead>
@@ -40,4 +40,5 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -15,12 +15,13 @@
</tr>
</thead>
<tbody>
<tr ng-click="getItems('guests', client)">
<td class="text-right" style="width: 20%;">Заказ № {{ client.number }}</td>
<td class="text-right" style="width: 30%;">Открыт {{ client.opened }}</td>
<td class="text-right" style="width: 30%;">{{ client.closed }}</td>
<td class="text-right" style="width: 20%;">{{ client.sum | curr }} BYN</td>
<tbody ng-repeat="order in client.orders">
<tr ng-click="getItems('guests', order)">
<td class="text-right" style="width: 20%;">Заказ № {{ order.number }}</td>
<td class="text-right" style="width: 30%;">Открыт {{ order.opened }}</td>
<td ng-if="order.closed" class="text-right" style="width: 30%;">Закрыт {{ order.closed }}</td>
<td ng-if="!order.closed" class="text-right" style="width: 30%;">Не закрыт</td>
<td class="text-right" style="width: 20%;">{{ order.sum | curr }} BYN</td>
</tr>
</tbody>
</table>
@@ -31,4 +32,5 @@
<div class="text-muted">Заказов от именованных гостей нет</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -24,7 +24,7 @@
</div>
</div>
<div ng-if="client_name && client_address" class="form-group row">
<div ng-if="client_name" class="form-group row">
<div class="col-sm-6">
<input placeholder="Имя" ng-model="client_name" class="form-control" value="client_name" disabled></input>
<p>

View File

@@ -12,6 +12,7 @@
<option value="deleted">По удалениям</option>
<option value="pay">По отделам и видам оплат</option>
<option value="staff">По персоналу</option>
<option value="discounts">По скидкам</option>
<option value="out">По внешним заказам</option>
</optgroup>
</select>
@@ -130,6 +131,10 @@
<div ui-include="'../views/reports/items/deleted.html'"></div>
</div>
<div class="modal fade" id="report-discounts" data-backdrop="true">
<div ui-include="'../views/reports/items/discounts.html'"></div>
</div>
<div class="modal fade" id="report-realisation" data-backdrop="true">
<div ui-include="'../views/reports/items/realisation.html'"></div>
</div>
@@ -154,6 +159,14 @@
<div ui-include="'../views/shifts/preload.html'"></div>
</div>
<div class="modal fade" id="report-order-info" data-backdrop="true">
<div ui-include="'../views/reports/items/order-info.html'"></div>
</div>
<div class="modal fade" id="report-orders-list" data-backdrop="true">
<div ui-include="'../views/reports/items/orders-list.html'"></div>
</div>
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
<script type="text/javascript">

View File

@@ -10,56 +10,84 @@
<span class="text-muted">{{start_date}} - {{end_date}}</span>
</div>
<div class="modal-body p-lg">
<div class="table-responsive" ng-if="report_delete.length > 0">
<table class="table table-bordered" ng-repeat="report in report_delete">
<thead>
<th>Смена#{{ report.shift_id }} Заказ #{{ report.order_code }}</th>
</thead>
<tbody>
<tr ng-repeat="item in report.items">
<td>
<h6>{{ item.dish_name }}
<small>
<p>Время удаления: <strong>{{item.time}}</strong></p>
<p>Цена товара: <strong>{{item.price}} BYN</strong></p>
<p>Количество: <strong>{{item.count}} шт</strong></p>
<p>На сумму: <strong>{{item.sum}} BYN</strong></p>
</small>
</h6>
<p>
Удалил:
<strong>{{ item.who }}</strong>
<br/> Подтвердил:
<strong>{{ item.approved }}</strong>
<br/> Причина:
<strong>{{ item.reason }}</strong>
</p>
</td>
</tr>
</tbody>
<hr>
</table>
<hr>
<table class="table table-bordered">
<tbody>
<tr>
<td>
<strong>Итого</strong>
</td>
<td style="text-align: right">
<strong>{{ report_delete.total_count }}</strong> удалений</td>
<td style="text-align: right">на сумму
<strong>{{ report_delete.total_sum | curr }} BYN</strong>
</td>
</tr>
</tbody>
</table>
<div ng-if="report_delete.length > 0">
<div class="m-b" id="shiftsAccordion">
<div class="panel box" ng-repeat="reportShift in report_delete">
<div class="box-header">
<span class="pull-right label text-sm">Удалено: {{reportShift.totalCount}} позиций. На сумму {{reportShift.totalSum | curr}} BYN</span>
<a data-toggle="collapse" data-parent="#accordion" data-target="#c_{{reportShift.shift_id}}"
class="collapsed" aria-expanded="false">
<h2>Смена №{{reportShift.shift_id}}</h2>
</a>
</div>
<div class="m-b" id="ordersAccordion">
<div id="c_{{reportShift.shift_id}}" class="panel box collapse" aria-expanded="false">
<div ng-repeat="reportOrder in reportShift.orders">
<div id="c_{{reportShift.shift_id}}_{{reportOrder.order_id}}" class="box-header">
<span class="pull-right label text-sm">Удалено: {{reportOrder.totalCount}} позиций. На сумму {{reportOrder.totalSum | curr}} BYN</span>
<a data-toggle="collapse" data-parent="#ordersAccordion"
data-target="#co_{{reportShift.shift_id}}_{{reportOrder.order_id}}"
class="collapsed" aria-expanded="false">
<h2>Заказ №{{reportOrder.order_id}}</h2>
</a>
</div>
<div id="co_{{reportShift.shift_id}}_{{reportOrder.order_id}}" class="collapse" aria-expanded="false">
<div class="box-body">
<div class="table-responsive-xl">
<table class="table table-bordered m-0">
<thead>
<tr>
<th>Имя</th>
<th>Время/Причина</th>
<th>Товар/цена</th>
<th>Кол-во</th>
<th>Итог</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in reportOrder.items">
<td>{{ item.who }}</td>
<td>
<ul class="list-unstyled">
<li>{{ item.time }}</li>
<li><small>{{ item.reason }}</small></li>
</ul>
</td>
<td>
<ul class="list-unstyled">
<li>{{ item.dish }}</li>
<li><small>{{ item.price | curr }} BYN</small></li>
</ul>
</td>
<td>{{ item.count }}</td>
<td>{{ item.total | curr}} BYN</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<table class="table table-bordered">
<tbody>
<tr>
<td>
<strong>Итого</strong>
</td>
<td style="text-align: right">
<strong>{{ totalCount }}</strong> удалений
</td>
<td style="text-align: right">на сумму
<strong>{{ totalSum | curr }} BYN</strong>
</td>
</tr>
</tbody>
</table>
<div ng-if="report_delete.length == 0">
<p>Удаления отсутствуют</p>
</div>

View File

@@ -0,0 +1,49 @@
<div class="modal-dialog modal-lg">
<div class="modal-content" id="report-discounts">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<button class="btn btn-icon white" ng-click="printElem('#report-discounts')">
<i class="fa fa-print"></i>
</button>
<h4 class="modal-title">{{globals.currentUser.organization.name}}</h4>
<h5 class="modal-title">Отчет по скидкам</h5>
<span class="text-muted">{{start_date}} - {{end_date}}</span>
</div>
<div class="modal-body p-lg">
<div class="table-responsive" ng-if="orders_count > 0">
<div class="table-responsive">
<p>Количество заказов со скидками: <strong>{{orders_count}}</strong><br>
Сумма заказов без скидок: <strong>{{orders_full_sum.toDivide()}} BYN</strong><br>
Сумма заказов со скидками: <strong>{{orders_order_sum.toDivide()}} BYN</strong><br>
Сумма скидок: <strong>{{orders_sale_sum.toDivide()}} BYN</strong>
</p>
<table class="table table-striped table-hover white b-a" ng-repeat="(discount_value, orders) in orders_info">
<thead>
<th>Скидка {{discount_value}}%</th>
</thead>
<thead>
<tr>
<th>Количество</th>
<th>Сумма заказов без скидки</th>
<th>Сумма заказов со скидкой</th>
<th>Сумма скидок</th>
</tr>
</thead>
<tbody>
<tr ng-click="getOrders(discount_value, 'report-discounts', 'report-orders-list')" data-toggle="tooltip" data-placement="bottom" title="Нажмите для просмотра списка заказов">
<td>{{orders.info.orders_count}}</td>
<td>{{orders.info.full_sum.toDivide()}} BYN</td>
<td>{{orders.info.order_sum.toDivide()}} BYN</td>
<td>{{orders.info.sale_sum.toDivide()}} BYN</td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-if="orders_count == 0">
<p>Заказы со скидками отсутствуют</p>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,78 @@
<div class="modal-dialog modal-lg">
<div class="modal-content" id="report-order-info">
<div class="modal-header">
<button type="button" class="close" ng-click="prevModal('report-order-info', 'report-orders-list')">
<i class="material-icons md-24">arrow_back</i>
</button>
<p>
Номер заказа: <strong>#{{order_info.order_id}}</strong><br>
Время закрытия: <strong>{{order_info.closed}}</strong><br>
Персонал: <strong>{{order_info.who_close}}</strong><br>
Статус заказа: <span class="label success">{{order_info.order_status}}</span><br>
</p>
</div>
<div class="modal-body p-lg">
<div class="table-responsive">
<table class="table table-striped white b-a">
<thead>
<tr>
<th>ID</th>
<th>Блюдо</th>
<th style="width: 80px">Кол-во</th>
<th style="width: 140px">Стоимость</th>
<th style="width: 180px">Итог</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in order_info.items">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.count * item.cof}}</td>
<td>{{item.price | curr}} BYN</td>
<td>{{item.amount | curr}} BYN <p ng-if="item.discount > 0">
<span>(Скидка: {{item.discount}}%)</span></p></td>
</tr>
<tr>
<td colspan="4" class="text-right"><strong>Итого</strong></td>
<td>{{order_info.amount | curr}} BYN</td>
</tr>
<tr>
<td colspan="4" class="text-right no-border"
ng-if="order_info.full_price - order_info.amount > 0">
<strong>Сумма скидки</strong></td>
<td ng-if="order_info.full_price - order_info.amount > 0">{{order_info.full_price -
order_info.amount | curr}} BYN
</td>
</tr>
<tr>
<td colspan="4" class="text-right no-border"><strong>Оплачено:</strong></td>
</tr>
<tr ng-if="order_info.cash > 0">
<td colspan="5" class="text-right no-border">Наличные: <strong>{{order_info.cash
| curr}} BYN</strong></td>
</tr>
<tr ng-if="order_info.credit > 0">
<td colspan="5" class="text-right no-border">Кред. карта: <strong>{{order_info.credit | curr}}
BYN</strong></td>
</tr>
<tr ng-if="order_info.clearing > 0">
<td colspan="5" class="text-right no-border">Питание штата: <strong>{{order_info.clearing |
curr}}
BYN</strong>
</tr>
<tr ng-if="order_info.presale > 0">
<td colspan="5" class="text-right no-border">Зачтен аванс: <strong>{{order_info.presale | curr}}
BYN</strong></td>
</tr>
<tr ng-if="order_info.self > 0">
<td colspan="5" class="text-right no-border">Безнал: <strong>{{order_info.self | curr}}
BYN</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,44 @@
<div class="modal-dialog modal-lg">
<div class="modal-content" id="report-orders-list">
<div class="modal-header">
<button type="button" class="close" ng-click="prevModal('report-orders-list', 'report-discounts')">
<i class="material-icons md-24">arrow_back</i>
</button>
<h5 class="modal-title">Список заказов со скидкой {{discount_id}}%:</h5>
</div>
<div class="modal-body p-lg">
<div class="table-responsive" ng-if="orders_count > 0">
<div class="table-responsive">
<table class="table table-striped table-hover white b-a">
<thead>
<tr>
<th>Смена №</th>
<th>Заказ №</th>
<th>Сумма без скидки</th>
<th>Сумма со скидкой</th>
<th>Сумма скидки</th>
<th>Открыт</th>
<th>Закрыт</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in orders_list" ng-click="getItems(order.code, order.opened, order.closed, 'report-orders-list', 'report-order-info')" data-toggle="tooltip" data-placement="bottom" title="Нажмите для просмотра информации о заказе">
<td>{{order.shift_id}}</td>
<td>{{order.code}}</td>
<td>{{order.full_sum | curr}} BYN</td>
<td>{{order.order_sum | curr}} BYN</td>
<td>{{order.sale_sum | curr}} BYN</td>
<td>{{order.opened}}</td>
<td>{{order.closed}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-if="orders_count == 0">
<p>Заказы со скидками отсутствуют</p>
</div>
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<div class="modal-dialog modal-lg">
<div class="modal-content" id="reportRealisation">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<button type="button" class="close" data-dismiss="modal" ng-click="closeModal('reportRealisation')">&times;</button>
<button class="btn btn-icon white" ng-click="printElem('#reportRealisation')">
<i class="fa fa-print"></i>
</button>
@@ -9,9 +9,9 @@
<h5 class="modal-title">Отчет по реализации</h5>
<span class="text-muted">{{start_date}} - {{end_date}}</span>
</div>
<div class="modal-body p-lg">
<div id="tableRealisation" class="modal-body p-lg">
<div class="table-responsive" ng-if="report_realisation.length > 0">
<table class="table table-bordered" ng-repeat="printer in report_realisation">
<table class="table table-bordered table-striped datatable" ui-jq="dataTable" ui-options="dataTableOpt" ng-repeat="printer in report_realisation">
<thead>
<th style="width: 70%">{{ printer.name }}</th>
<th style="width: 10%; text-align: right">{{ printer.count }}</th>
@@ -26,9 +26,7 @@
</tr>
</tbody>
</table>
<div ng-if="return_printers.length > 0">
<hr>
<table class="table table-bordered" ng-repeat="ret_print in return_printers">
<thead>
<th style="width: 70%">{{ ret_print.name }} (возврат)</th>
@@ -46,8 +44,6 @@
</table>
</div>
<hr>
<table class="table table-bordered">
<tbody>
<tr>

View File

@@ -13,120 +13,171 @@
<div class="table-responsive">
<table class="table table-bordered">
<tbody>
<tr>
<td colspan="2">
<strong>Реализация</strong>
</td>
</tr>
<tr>
<td>Количество заказов</td>
<td style="text-align: right">{{ statistic.orders_count }}</td>
</tr>
<tr>
<td>Сумма заказов (без скидки) <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.total_sum | curr}}</td>
</tr>
<tr>
<td>Скидка <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.discount_sum | curr}}</td>
</tr>
<tr>
<td colspan="2">
<strong>Операции внесения/изъятия</strong>
</td>
</tr>
<tr>
<td>Внесено наличными</td>
<td style="text-align: right">{{ fiscal.income_sum | curr }} BYN</td>
</tr>
<tr>
<td>Выплачено наличными</td>
<td style="text-align: right">{{ fiscal.outcome_sum | curr }} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Реализация</strong>
</td>
</tr>
<tr>
<td>Количество заказов</td>
<td style="text-align: right">{{ realisation.orders_count }}</td>
</tr>
<tr>
<td>Сумма заказов (без скидки)</td>
<td style="text-align: right">{{ realisation.orders_sum_without_sales | curr}} BYN</td>
</tr>
<tr>
<td>Скидка</td>
<td style="text-align: right">{{ realisation.sale_sum | curr}} BYN</td>
</tr>
<tr>
<td>Итоговоя сумма <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.orders_sum | curr}}</td>
</tr>
<tr>
<td>Отложенных заказы</td>
<td style="text-align: right">{{ statistic.wait_count }}</td>
</tr>
<tr>
<td>Отложено на сумму <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.wait_sum | curr}}</td>
</tr>
<tr>
<td>Итоговоя сумма</td>
<td style="text-align: right">{{ realisation.orders_sum_with_sales | curr}} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Возвраты</strong>
</td>
</tr>
<tr>
<td>Количество возвратов</td>
<td style="text-align: right">{{ statistic.return_count }}</td>
</tr>
<tr>
<td>Сумма возвратов <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.return_sum | curr }}</td>
</tr>
<tr>
<td colspan="2">
<strong>Возвраты</strong>
</td>
</tr>
<tr>
<td>Количество возвратов</td>
<td style="text-align: right">{{ returns.returned_orders_count }}</td>
</tr>
<tr>
<td>Сумма возвратов</td>
<td style="text-align: right">{{ returns.returned_items_sum | curr }} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Статистика</strong>
</td>
</tr>
<tr>
<td>Количество гостей</td>
<td style="text-align: right">{{ statistic.clients_count }}</td>
</tr>
<tr>
<td>Средний чек <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.avg_order_sum | curr}}</td>
</tr>
<tr>
<td>Средний чек на 1-го гостя <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.avg_order_client_sum | curr}}</td>
</tr>
<tr>
<td colspan="2">
<strong>Аннулирования</strong>
</td>
</tr>
<tr>
<td>Количество аннулирований</td>
<td style="text-align: right">{{ cancellations.cancellations_count }}</td>
</tr>
<tr>
<td>Сумма аннулирований</td>
<td style="text-align: right">{{ cancellations.cancellations_sum | curr }} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Авансы</strong>
</td>
</tr>
<tr>
<td>Количество авансов полученных</td>
<td style="text-align: right">{{ statistic.in_presale_count }}</td>
</tr>
<tr>
<td>Сумма авансов полученных <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.in_presale_sum | curr}}</td>
</tr>
<tr>
<td>Количество авансов возвращенных</td>
<td style="text-align: right">{{ statistic.out_presale_count }}</td>
</tr>
<tr>
<td>Сумма авансов возвращенных <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.out_presale_sum | curr}}</td>
</tr>
<tr>
<td colspan="2">
<strong>Статистика</strong>
</td>
</tr>
<tr>
<td>Количество гостей</td>
<td style="text-align: right">{{ statistic.clients_count }}</td>
</tr>
<tr>
<td>Средний чек</td>
<td style="text-align: right">{{ statistic.clients_average_sum | curr}} BYN</td>
</tr>
<tr>
<td>Средний чек на 1-го гостя</td>
<td style="text-align: right">{{ statistic.clients_average_sum_one | curr}} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Формы оплаты</strong>
</td>
</tr>
<tr>
<td>Наличный расчет <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.cash | curr}}</td>
</tr>
<tr>
<td>Наличный расчет (отложенные) <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.wait_sum | curr}}</td>
</tr>
<tr>
<td>Безналичный расчет <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.clearing | curr}}</td>
</tr>
<tr>
<td>Кредитными картами <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.credit | curr}}</td>
</tr>
<tr>
<td>Питание штата <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.self | curr}}</td>
</tr>
<tr>
<td>По ранее полученному авансу <strong>BYN</strong></td>
<td style="text-align: right">{{ statistic.presale | curr}}</td>
</tr>
<tr>
<td colspan="2">
<strong>Авансы</strong>
</td>
</tr>
<tr>
<td>Количество авансов полученных</td>
<td style="text-align: right">{{ presales.presales_income_count }}</td>
</tr>
<tr ng-if="presales.presales_income_cash_sum > 0">
<td>Сумма авансов полученных наличными</td>
<td style="text-align: right">{{ presales.presales_income_cash_sum | curr}} BYN</td>
</tr>
<tr ng-if="presales.presales_income_credit_sum > 0">
<td>Сумма авансов полученных кредитной картой</td>
<td style="text-align: right">{{ presales.presales_income_credit_sum | curr}} BYN</td>
</tr>
<tr ng-if="presales.presales_income_clearing_sum > 0">
<td>Сумма авансов полученных безналичным расчетом</td>
<td style="text-align: right">{{ presales.presales_income_clearing_sum | curr}} BYN</td>
</tr>
<tr ng-if="presales.presales_income_discount_sum > 0">
<td>Сумма авансов полученных через скидку</td>
<td style="text-align: right">{{ presales.presales_income_discount_sum | curr}} BYN</td>
</tr>
<tr>
<td>Количество авансов возвращенных</td>
<td style="text-align: right">{{ presales.presales_outcome_count }}</td>
</tr>
<tr ng-if="presales.presales_outcome_cash_sum > 0">
<td>Сумма авансов возвращенных наличными</td>
<td style="text-align: right">{{ presales.presales_outcome_cash_sum | curr}} BYN</td>
</tr>
<tr ng-if="presales.presales_outcome_credit_sum > 0">
<td>Сумма авансов возвращенных на кредитную карту</td>
<td style="text-align: right">{{ presales.presales_outcome_credit_sum | curr}} BYN</td>
</tr>
<tr ng-if="presales.presales_outcome_clearing_sum > 0">
<td>Сумма авансов возвращенных безналичным расчетом</td>
<td style="text-align: right">{{ presales.presales_outcome_clearing_sum | curr}} BYN</td>
</tr>
<tr>
<td colspan="2">
<strong>Формы оплаты</strong>
</td>
</tr>
<tr>
<td>Наличный расчет</td>
<td style="text-align: right">{{ payments.pay_cash | curr}} BYN</td>
</tr>
<tr>
<td>Кредитными картами</td>
<td style="text-align: right">{{ payments.pay_credit | curr}} BYN</td>
</tr>
<tr>
<td>Безналичный расчет</td>
<td style="text-align: right">{{ payments.pay_clearing | curr}} BYN</td>
</tr>
<tr>
<td>Питание штата</td>
<td style="text-align: right">{{ payments.pay_self | curr}} BYN</td>
</tr>
<tr>
<td>По ранее полученному авансу</td>
<td style="text-align: right">{{ payments.pay_presale | curr}} BYN</td>
</tr>
<tr>
<td>Онлайн</td>
<td style="text-align: right">{{ payments.pay_online | curr}} BYN</td>
</tr>
<tr>
<td>Иные способы оплаты</td>
<td style="text-align: right">{{ payments.pay_another | curr}} BYN</td>
</tr>
<tr ng-if="pay_delivery > 0">
<td>Доставка</td>
<td style="text-align: right">{{ payments.pay_delivery | curr}} BYN</td>
</tr>
<tr ng-if="pay_echeck > 0">
<td>Электронный чек</td>
<td style="text-align: right">{{ payments.pay_echeck | curr}} BYN</td>
</tr>
</tbody>
</table>

View File

@@ -57,6 +57,7 @@
<a class="dropdown-item" ng-click="reportDelete(shift)">По удалениям</a>
<a class="dropdown-item" ng-click="reportStaff(shift)">По персоналу</a>
<a class="dropdown-item" ng-click="reportPay(shift)">По отделам</a>
<a class="dropdown-item" ng-click="reportDiscounts(shift)">По скидкам</a>
<!-- <a class="dropdown-item" ng-click="reportOrders(shift)">По заказам</a> -->
<a class="dropdown-item" ng-click="reportMerged(shift)">По объединениям</a>
<a class="dropdown-item" ng-click="reportSliced(shift)">По разбиениям</a>
@@ -95,8 +96,8 @@
</div>
</div>
<div class="modal fade" id="report-delete" data-backdrop="true">
<div ui-include="'../views/reports/items/deleted.html'"></div>
<div class="modal fade" id="shift-delete" data-backdrop="true">
<div ui-include="'../views/shifts/items/deleted.html'"></div>
</div>
<div class="modal fade" id="report-realisation" data-backdrop="true">
@@ -137,4 +138,16 @@
<div class="modal fade" id="preload-modal" data-backdrop="true">
<div ui-include="'../views/shifts/preload.html'"></div>
</div>
<div class="modal fade" id="report-discounts" data-backdrop="true">
<div ui-include="'../views/reports/items/discounts.html'"></div>
</div>
<div class="modal fade" id="report-order-info" data-backdrop="true">
<div ui-include="'../views/reports/items/order-info.html'"></div>
</div>
<div class="modal fade" id="report-orders-list" data-backdrop="true">
<div ui-include="'../views/reports/items/orders-list.html'"></div>
</div>

View File

@@ -0,0 +1,83 @@
<div class="modal-dialog modal-lg">
<div class="modal-content" id="reportDeleted">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<button class="btn btn-icon white" ng-click="printElem('#reportDeleted')">
<i class="fa fa-print"></i>
</button>
<h4 class="modal-title">{{globals.currentUser.organization.name}}</h4>
<h5 class="modal-title">Отчет по удалениям</h5>
<span class="text-muted">{{start_date}} - {{end_date}}</span>
</div>
<div class="modal-body p-lg">
<div ng-if="report_delete.length > 0">
<div class="m-b" id="accordion">
<div class="panel box" ng-repeat="report in report_delete">
<div class="box-header">
<span class="pull-right label text-sm">Удалено: {{report.orderTotalCount}} позиций. На сумму {{report.orderTotalSum | curr}} BYN</span>
<a data-toggle="collapse" data-parent="#accordion" data-target="#c_{{report.order_id}}"
class="collapsed" aria-expanded="false">
<h2>Заказ №{{report.order_id}}</h2>
</a>
</div>
<div id="c_{{report.order_id}}" class="collapse" aria-expanded="false">
<div class="box-body">
<div class="table-responsive-xl">
<table class="table table-bordered m-0">
<thead>
<tr>
<th>Имя</th>
<th>Время/Причина</th>
<th>Товар/цена</th>
<th>Кол-во</th>
<th>Итог</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in report.items">
<td>{{ item.who }}</td>
<td>
<ul class="list-unstyled">
<li>{{ item.time }}</li>
<li><small>{{ item.reason }}</small></li>
</ul>
</td>
<td>
<ul class="list-unstyled">
<li>{{ item.dish }}</li>
<li><small>{{ item.price | curr }} BYN</small></li>
</ul>
</td>
<td>{{ item.count }}</td>
<td>{{ item.total | curr}} BYN</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<table class="table table-bordered">
<tbody>
<tr>
<td>
<strong>Итого</strong>
</td>
<td style="text-align: right">
<strong>{{ total_count }}</strong> удалений
</td>
<td style="text-align: right">на сумму
<strong>{{ total_sum | curr }} BYN</strong>
</td>
</tr>
</tbody>
</table>
<div ng-if="report_delete.length == 0">
<p>Удаления отсутствуют</p>
</div>
</div>
</div>
</div>

237
web/views/staff/index.html Normal file
View File

@@ -0,0 +1,237 @@
<div class="app-body-inner">
<div class="row-col row-col-xs b-b">
<div class="col-sm-3 col-md-2 light bg b-r">
<div class="row-col">
<div class="p-a-xs b-b">
<div class="input-group">
<span class="input-group-addon no-border no-bg">
<i class="fa fa-search"></i>
</span>
<input type="text" class="form-control no-border no-bg" placeholder="Поиск персонала..." ng-keyup="personalSearch()" ng-model="search.query">
<span class="input-group-addon no-border no-bg search-clear" ng-click="search.query = ''">
<i class="fa fa-times"></i>
</span>
</div>
</div>
<div class="row-row">
<div class="row-body scrollable hover">
<div class="row-inner">
<div class="list inset">
<div class="list-item pointer no_selection" ng-if="parentGroup > 0 && search.query.length === 0" ios-dblclick="upFolder()">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE2C7;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">
...
</div>
</div>
<div class="list-item pointer no_selection" ng-repeat="group in groups" sglclick="showGroup(group)" ng-class="group.id == currentGroupObject.id ? 'active' : ''"
ios-dblclick="openGroup(group)" ng-if="parentGroup == 0 && search.query.length === 0">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE2C7;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">
{{ group.name }}
</div>
</div>
<div class="list-item pointer no_selection" ng-repeat="personal in personals" ng-click="showPersonal(personal)" ng-class="personal.id == currentPersonalObject.id ? 'active' : ''"
ng-if="parentGroup > 0 || search.query.length > 0">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE893;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">
{{ personal.name }}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="p-a b-t text-center">
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="addGroup()" ng-if="parentGroup == 0 && search.query.length === 0">
<i class="fa fa-plus fa-fw m-r-xs"></i>Группа
</a>
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="addPersonal()" ng-if="parentGroup > 0 && search.query.length === 0">
<i class="fa fa-plus fa-fw m-r-xs"></i>Персонал
</a>
</div>
</div>
</div>
<div class="col-sm-8 col-md-5">
<div class="row-col" ng-class="(currentGroupObject.id == 0)?'hide-object':''">
<div class="p-a-sm">
<div>
<a class="btn btn-sm white pull-right" ng-click="closeCard()">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="row-row">
<div class="row-body">
<div class="row-inner">
<div class="padding">
<div class="form-horizontal">
<div class="form-group row">
<label class="col-sm-3 form-control-label">Название</label>
<div class="col-sm-9">
<input type="text" class="form-control" ng-model="currentGroupObject.name">
</div>
</div>
<hr/>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Режим работы</label>
<div class="col-sm-9">
<select class="form-control" ng-model="currentGroupObject.interface_code" ng-change="setRights()">
<option ng-repeat="interface in interfaces" value="{{ interface.code }}">{{ interface.name }}</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<label class="form-control-label">Шаблоны прав</label>
</div>
<div class="col-sm-9">
<label class="radio-inline ui-check ui-check-md">
<input type="radio" name="sub-interface" ng-change="setRights()" ng-model="currentGroupObject.sub_interface_code" value="1" class="has-value">
<i class="dark-white"></i>Администратор
</label>
<label class="radio-inline ui-check ui-check-md">
<input type="radio" name="sub-interface" ng-change="setRights()" ng-model="currentGroupObject.sub_interface_code" value="2" class="has-value">
<i class="dark-white"></i>Официант
</label>
</div>
</div>
<div class="table-responsive" style="background-color: #fff">
<table class="table table-bordered table-hover">
<thead>
<th>Право</th>
<th>Статус</th>
</thead>
<tbody>
<tr ng-repeat="right in rights">
<td>{{ right.name }}</td>
<td style="width: 90px">
<label class="ui-switch ui-switch-md m-t-xs">
<input type="checkbox" ng-model="right.is_active">
<i></i>
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer-form">
<div class="padding" style="float: right; width: 100%; padding: 0.5rem 1.5rem">
<button class="btn danger p-x-md pull-left" data-toggle="modal" data-target="#group-confirm-delete">
<i class="fa fa-trash"></i>
</button>
<button class="btn success p-x-md pull-right" ng-click="saveGroup()" style="margin-right: 15px">Сохранить</button>
</div>
</div>
</div>
<div class="row-col" ng-class="(currentPersonalObject.id == 0)?'hide-object':''">
<div class="p-a-sm">
<div>
<a class="btn btn-sm white pull-right" ng-click="closeCard()">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="row-row">
<div class="row-body">
<div class="row-inner">
<div class="padding">
<div class="form-horizontal">
<div class="form-group row">
<label class="col-sm-3 form-control-label">Имя</label>
<div class="col-sm-9">
<input type="text" class="form-control" ng-model="currentPersonalObject.name">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label">Пароль</label>
<div class="col-sm-9">
<input type="text" class="form-control" ng-model="currentPersonalObject.password">
</div>
</div>
<!-- <div class="form-group row">
<label class="col-sm-3 form-control-label">Режим работы</label>
<div class="col-sm-9">
<select class="form-control" ng-model="currentPersonalObject.interface_code">
<option ng-repeat="interface in interfaces" value="{{ interface.code }}">{{ interface.name }}</option>
</select>
</div>
</div> -->
</div>
</div>
</div>
</div>
</div>
<div class="footer-form">
<div class="padding" style="float: right; width: 100%; padding: 0.5rem 1.5rem">
<button class="btn danger p-x-md pull-left" data-toggle="modal" data-target="#personal-confirm-delete">
<i class="fa fa-trash"></i>
</button>
<button class="btn success p-x-md pull-right" ng-click="savePersonal()" style="margin-right: 15px">Сохранить</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="personal-confirm-delete" class="modal confirm-box" data-backdrop="true">
<div class="bottom white b-b" style="height: 90px">
<div class="confirm-box-body p-lg">
<p>Вы действительно хотите удалить персонал?</p>
</div>
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
<button type="button" class="btn danger p-x-md" ng-click="removePersonal()">Да</button>
</div>
</div>
</div>
<div id="group-confirm-delete" class="modal confirm-box" data-backdrop="true">
<div class="bottom white b-b" style="height: 90px">
<div class="confirm-box-body p-lg">
<p>Вы действительно хотите удалить группу?</p>
</div>
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
<button type="button" class="btn danger p-x-md" ng-click="removeGroup()">Да</button>
</div>
</div>
</div>