Merge branch 'r-1902001-01' into customer_report

This commit is contained in:
Thein Lin Kyaw
2020-09-10 10:07:18 +06:30
209 changed files with 2277 additions and 1920 deletions

View File

@@ -18,7 +18,7 @@ gem 'pg'
gem 'mysql2', '~> 0.5.2' gem 'mysql2', '~> 0.5.2'
#Use PosgreSQL #Use PosgreSQL
gem "select2-rails"
# redis server for cable # redis server for cable
gem 'redis', '~> 3.0' gem 'redis', '~> 3.0'

View File

@@ -264,6 +264,7 @@ GEM
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
schema_to_scaffold (0.8.0) schema_to_scaffold (0.8.0)
activesupport (>= 3.2.1) activesupport (>= 3.2.1)
select2-rails (4.0.13)
shoulda-matchers (3.1.3) shoulda-matchers (3.1.3)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
sidekiq (5.2.7) sidekiq (5.2.7)
@@ -367,6 +368,7 @@ DEPENDENCIES
rubyzip (= 1.0.0) rubyzip (= 1.0.0)
sass-rails (~> 5.0) sass-rails (~> 5.0)
schema_to_scaffold schema_to_scaffold
select2-rails
shoulda-matchers (~> 3.1) shoulda-matchers (~> 3.1)
sidekiq sidekiq
simple_form simple_form

View File

@@ -77,6 +77,9 @@ For Using Star Printer
**_ Need to change these print settings 1) settings/print_settings/unique_code => OrderItemStarPdf 2) settings/print_settings/unique_code => ReceiptBillStarPdf 3) settings/print_settings/unique_code => SaleItemsStarPdf **_ Need to change these print settings 1) settings/print_settings/unique_code => OrderItemStarPdf 2) settings/print_settings/unique_code => ReceiptBillStarPdf 3) settings/print_settings/unique_code => SaleItemsStarPdf
_** Other print settings aren't need to change. _** Other print settings aren't need to change.
For Cloud ActionCable Print
settings/lookups => { type: print_settings, name: ActionCable, value: 1 }
For Show Sale Items Summary at CloseCashierPrint 1) settings/print_settings For Show Sale Items Summary at CloseCashierPrint 1) settings/print_settings
a) Check => Shift Sale Items a) Check => Shift Sale Items

View File

@@ -402,17 +402,17 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/print/print/'+assigned_item_id, url: '/oqs/print/print/'+assigned_item_id,
data: params, data: params,
success: function(result){ success: function(result){
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
} code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
location.reload(); }
}
location.reload();
} }
}); });
}); });
// Print Order Summary // Print Order Summary
@@ -428,13 +428,15 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/print/print_order_summary/'+assigned_item_id, url: '/oqs/print/print_order_summary/'+assigned_item_id,
data: params, data: params,
success: function(result){ success: function(result){
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
} code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
location.reload(); }
}
location.reload();
} }
}); });
}); });

View File

@@ -36,6 +36,7 @@
//= require custom.js //= require custom.js
//= require jquery-fileupload/basic //= require jquery-fileupload/basic
//= require induties/induties.js //= require induties/induties.js
//= require select2
$(document).ready(function() { $(document).ready(function() {
$('.count-to').countTo(); $('.count-to').countTo();
@@ -65,7 +66,7 @@ $(document).ready(function() {
clearButton: true, clearButton: true,
date: false date: false
}); });
// Image Upload // Image Upload
$("#simple_menu_item_image_path").fileinput({ $("#simple_menu_item_image_path").fileinput({
previewFileType: "image", previewFileType: "image",
@@ -148,7 +149,7 @@ $(document).ready(function() {
'</div>\n', '</div>\n',
} }
}); });
$("#commissioner_image_path").fileinput({ $("#commissioner_image_path").fileinput({
previewFileType: "image", previewFileType: "image",
allowedFileExtensions: ["jpg", "gif", "png"], allowedFileExtensions: ["jpg", "gif", "png"],
@@ -167,7 +168,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' + ' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n', '</div>\n',
} }
}); });
$("#employee_image_path").fileinput({ $("#employee_image_path").fileinput({
previewFileType: "image", previewFileType: "image",
@@ -187,7 +188,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' + ' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n', '</div>\n',
} }
}); });
$("#shop_image").fileinput({ $("#shop_image").fileinput({
previewFileType: "image", previewFileType: "image",
@@ -227,7 +228,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' + ' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n', '</div>\n',
} }
}); });
// first input focus for all form // first input focus for all form
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus(); $('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
@@ -252,4 +253,4 @@ Chart.scaleService.updateScaleDefaults('linear', {
} }
} }
}); });
/* chartkick js YAxis value override */ /* chartkick js YAxis value override */

View File

@@ -1,6 +1,6 @@
//= require custom.js //= require custom.js
$(function() { $(function() {
$("#discount").hide(); $("#discount").hide();
$(".expected_time").hide(); $(".expected_time").hide();
$('#accepted').hide(); $('#accepted').hide();
@@ -11,7 +11,7 @@ $(function() {
$(".accepted_time").hide(); $(".accepted_time").hide();
$(".kitchen_time").hide(); $(".kitchen_time").hide();
$(".ready_time").hide(); $(".ready_time").hide();
$(function() { $(function() {
$('.first-1').click(); $('.first-1').click();
}); });
@@ -213,8 +213,8 @@ $(function() {
function warnBeforeRedirect(linkURL) { function warnBeforeRedirect(linkURL) {
swal({ swal({
title: "Alert!", title: "Alert!",
text: "Are you sure you want to close cashier?", text: "Are you sure you want to close cashier?",
type: "warning", type: "warning",
showCancelButton: true showCancelButton: true
}, function() { }, function() {
@@ -278,13 +278,13 @@ function refreshDetailData(){
$("#payment_type").text(""); $("#payment_type").text("");
} }
//show order list //show order list
function show_order_detail(url,sr_no){ function show_order_detail(url,sr_no){
// $('.summary-items').html(""); // $('.summary-items').html("");
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
@@ -334,12 +334,12 @@ function show_order_detail(url,sr_no){
$("#ready_delivery_time").html(ready_time); $("#ready_delivery_time").html(ready_time);
} }
} }
var newDate = new Date(data.requested_time); var newDate = new Date(data.requested_time);
var time = timeFormat(newDate); var time = timeFormat(newDate);
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time; // var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time; var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){ if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
// var expDate = new Date(data.expected_waiting_time); // var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate); // var exptime = timeFormat(expDate);
@@ -367,7 +367,7 @@ function show_order_detail(url,sr_no){
if(items!=undefined && items!=""){ if(items!=undefined && items!=""){
if(items.length > 0){ if(items.length > 0){
for(var i in items) { for(var i in items) {
var item_price = 0; var item_price = 0;
if(items[i].price > 0){ if(items[i].price > 0){
item_price = items[i].price; item_price = items[i].price;
@@ -378,7 +378,7 @@ function show_order_detail(url,sr_no){
var check_mobile =document.getElementsByName("summary_items_mobile")[0].value; var check_mobile =document.getElementsByName("summary_items_mobile")[0].value;
if (check_mobile == "true"){ if (check_mobile == "true"){
if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){ if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
row = row =
'<tr>' '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name +'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br>' +' <br>'
@@ -417,8 +417,8 @@ function show_order_detail(url,sr_no){
} }
} }
$('.summary-items').append(row); $('.summary-items').append(row);
} }
@@ -452,7 +452,7 @@ function show_order_detail(url,sr_no){
}else if(data.payment_type == "dinga"){ }else if(data.payment_type == "dinga"){
$("#payment_type").text("DINGA"); $("#payment_type").text("DINGA");
} }
$('#ref_no').text(data.transaction_ref); $('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url); $('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id); $('#order_id').text(data.order_reservation_id);
@@ -494,16 +494,16 @@ function show_order_detail(url,sr_no){
}else{ }else{
$("#invoice_no").text(data["order_reservation_id"]); $("#invoice_no").text(data["order_reservation_id"]);
} }
} }
} }
} }
}); });
//end Ajax //end Ajax
} }
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
var url = 'order_reservation/update'; var url = 'order_reservation/update';
var post_url = "order_reservation/send_status"; var post_url = "order_reservation/send_status";
var waiting_time = ""; var waiting_time = "";
@@ -527,16 +527,16 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
access_code = approved_code; access_code = approved_code;
} }
// $.ajax({ // $.ajax({
// type: "POST", // type: "POST",
// url: post_url, // url: post_url,
// data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason}, // data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
// dataType: "json", // dataType: "json",
// success: function(data) { // success: function(data) {
// if(data.status){ // if(data.status){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: url,
data: {order_id: order_id, ref_no: ref_no, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code}, data: {order_id: order_id, ref_no: ref_no, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
@@ -711,7 +711,7 @@ function getOrderDay(day){
function timeFormat(date){ function timeFormat(date){
var isPM = date.getHours() >= 12; var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12; var isMidday = date.getHours() == 12;
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0), var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') + (date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM'); (isPM ? ' PM' : ' AM');
return time; return time;
@@ -722,8 +722,8 @@ function timeFormat(date){
function getOnlineOrderCount(){ function getOnlineOrderCount(){
var count = 0; var count = 0;
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
async: false, async: false,
type: "GET", type: "GET",
url: "/origami/get_order_info", url: "/origami/get_order_info",
dataType: "json", dataType: "json",
@@ -733,7 +733,7 @@ function getOnlineOrderCount(){
} }
} }
}); });
//end Ajax //end Ajax
// alert(count); // alert(count);
return count; return count;
} }
@@ -748,31 +748,33 @@ function print_receipt(){
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name }; var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
console.log(params); console.log(params);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/sale/"+sale_id+"/doemal_order/payment/print", url: "/origami/sale/"+sale_id+"/doemal_order/payment/print",
data: params, data: params,
success:function(result){ success:function(result){
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/order_reservation';
}
else{
swal({
title: "Print Success",
text: "Complete Order",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
} }
window.location.href = '/origami/order_reservation';
}
else{
swal({
title: "Print Success",
text: "Complete Order",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
} }
} }
}); });
} }
/* pdf print out */ /* pdf print out */

View File

@@ -12,6 +12,8 @@
@import "BSBMaterial/themes/all-themes"; @import "BSBMaterial/themes/all-themes";
@import "reset"; @import "reset";
@import "induties/assign_in_duties"; @import "induties/assign_in_duties";
@import "select2";
@import "select2-material";
/*@import "bootstrap-select/css/bootstrap-select.min";*/ /*@import "bootstrap-select/css/bootstrap-select.min";*/

View File

@@ -0,0 +1,231 @@
.select2-container--material {
width: 100% !important; }
.select2-container--material .select2-selection--single {
background-color: transparent;
border: none;
border-bottom: 1px solid rgba(0,0,0,0.26);
border-radius: 0;
box-shadow: none;
box-sizing: content-box;
height: auto;
margin: 0;
outline: none;
padding: 0.46875rem 0 0.40625rem 0;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.select2-container--material .select2-selection--single .select2-selection__rendered {
color: #444;
font-size: 1rem;
line-height: 18px;
padding-left: 0; }
.select2-container--material .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--material .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--material .select2-selection--single .select2-selection__arrow {
height: 20px;
margin: 0.5rem 0 0.2rem 0;
position: absolute;
line-height: 1rem;
top: 1px;
right: 1px;
width: 20px; }
.select2-container--material .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--material[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--material[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto; }
.select2-container--material.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--material.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; }
.select2-container--material.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--material .select2-selection--multiple {
background-color: transparent;
border: none;
border-bottom: 1px solid #ced4da;
border-radius: 0;
box-shadow: none;
box-sizing: content-box;
cursor: text;
height: auto;
margin: 0;
outline: none;
padding: 5px 0 0 0;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.select2-container--material .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--material .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--material .select2-selection--multiple .select2-selection__placeholder {
color: #999;
margin-top: 5px;
float: left; }
.select2-container--material .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice {
background-color: #ffca28;
border-radius: 16px;
color: rgba(0, 0, 0, 0.6);
cursor: default;
float: left;
margin-right: 5px;
margin-top: 6px;
padding: 0 12px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice__remove {
cursor: pointer;
display: inline-block;
font-weight: bold;
float: right;
margin-left: 5px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--material[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--material.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--material.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--material.select2-container--open.select2-container--above .select2-selection--single, .select2-container--material.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--material.select2-container--open.select2-container--below .select2-selection--single, .select2-container--material.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--material.select2-container--focus .select2-selection--single {
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
outline: 0; }
.select2-container--material.select2-container--focus .select2-selection--multiple {
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
outline: 0; }
.select2-container--material .select2-search--dropdown .select2-search__field {
border: none;
border-bottom: 1px solid #ced4da;
border-radius: 0;
outline: none; }
.select2-container--material .select2-search--dropdown .select2-search__field:focus:not([readonly]) {
box-shadow: 0 1px 0 0 #ced4da;
border-bottom: 1px solid #ced4da; }
.select2-container--material .select2-search--inline .select2-search__field {
background: transparent;
border: none !important;
outline: 0;
box-shadow: none !important;
-webkit-appearance: textfield; }
.select2-container--material .select2-results > .select2-results__options {
overflow-y: auto; }
.select2-container--material .select2-results__option[role=group] {
padding: 0; }
.select2-container--material .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--material .select2-results__option[aria-selected=true] {
background-color: #ddd; }
.select2-container--material .select2-results__option .select2-results__option {
padding-left: 1em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em; }
.select2-container--material .select2-results__option--highlighted[aria-selected] {
background-color: #3f729b;
color: white; }
.select2-container--material .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-dropdown {
background-color: white;
border: 1px solid #ced4da;
border-radius: 4px;
box-sizing: border-box;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051;
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); }
.select2-results {
display: block; }
.select2-results__options {
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0; }
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }

View File

@@ -0,0 +1,10 @@
class PrintChannel < ApplicationCable::Channel
def subscribed
stream_from "print_channel_#{params[:shop_code]}"
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
stop_all_streams
end
end

View File

@@ -28,6 +28,4 @@ class Api::CallWaitersController < Api::ApiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_call_waiter(print_settings,@table,@time,@shop) printer.print_call_waiter(print_settings,@table,@time,@shop)
end end
end end

View File

@@ -27,7 +27,7 @@ private
crm_root_path crm_root_path
elsif current_user.role == "account" elsif current_user.role == "account"
reports_dailysale_index_path reports_dailysale_index_path
elsif @current_user.role == "kitchen" elsif current_user.role == "kitchen"
oqs_root_path oqs_root_path
else else
login_path login_path

View File

@@ -51,7 +51,6 @@ class Oqs::PrintController < ApplicationController
ai.save ai.save
end end
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud" if ENV["SERVER_MODE"] == "cloud"
result = { result = {
:filepath => filename, :filepath => filename,
@@ -119,7 +118,6 @@ class Oqs::PrintController < ApplicationController
ai.save ai.save
end end
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud" if ENV["SERVER_MODE"] == "cloud"
result = { result = {
:filepath => filename, :filepath => filename,

View File

@@ -30,45 +30,40 @@ class Origami::HomeController < BaseOrigamiController
@status_order = "" @status_order = ""
@status_sale = "" @status_sale = ""
@sale_array = Array.new
@shop = shop_detail @shop = shop_detail
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@dining_booking = @dining.current_bookings
@order_items = Array.new @sale_array = @dining.current_sales
@dining_booking.each do |booking| if (booking = @dining.current_checkin_booking)
if @obj_sale || @booking.blank? @booking = booking
@booking = booking @order_items = booking.order_items
end @obj_order = booking.orders.first
end
if booking.sale_id if (booking = @dining.current_checkout_booking)
@obj_sale = booking.sale @booking = booking
@sale_array.push(@obj_sale) @obj_sale = booking.sale
@sale_taxes = @obj_sale.sale_taxes @sale_taxes = @obj_sale.sale_taxes
@status_sale = 'sale' @status_sale = 'sale'
else end
@order_items += booking.order_items
@obj_order = booking.orders.first
end
if @obj_sale || @customer.blank? if @obj_sale || @customer.blank?
if obj = @obj_sale || @obj_order if obj = @obj_sale || @obj_order
@customer = obj.customer @customer = obj.customer
@date = obj.created_at @date = obj.created_at
end
end end
end
if @obj_sale if @obj_sale
@status_order = 'sale' @status_order = 'sale'
else elsif @obj_order
@status_order = 'order' @status_order = 'order'
end end
if (@obj_sale || @account_arr.blank?) && @customer if (@obj_sale || @account_arr.blank?) && @customer
@account_arr = TaxProfile.find_by(id: @customer.tax_profiles) @account_arr = TaxProfile.find_by(id: @customer.tax_profiles)
end
end end
#for bank integration #for bank integration

View File

@@ -132,14 +132,6 @@ class Origami::PaymentsController < BaseOrigamiController
) )
end end
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillA5Pdf"
else
unique_code = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code
end
customer = saleObj.customer customer = saleObj.customer
# get member information # get member information
@@ -197,12 +189,17 @@ class Origami::PaymentsController < BaseOrigamiController
card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id) card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id)
# get printer info # get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code) if type.strip.downcase == 'doemal_order'
print_settings = PrintSetting.where(unique_code: 'ReceiptBillOrderPdf').first
else
print_settings = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first
end
# Calculate Food and Beverage Total # Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
other_amount = SaleItem.calculate_other_charges(sale_items) other_amount = SaleItem.calculate_other_charges(sale_items)
credit_pdf = Lookup.find_by_lookup_type("credit_pdf") credit_pdf = Lookup.find_by_lookup_type("credit_pdf")
if (path.include? ("credit_payment")) && !credit_pdf.nil? && credit_pdf.value.to_i == 1 if (path.include? ("credit_payment")) && !credit_pdf.nil? && credit_pdf.value.to_i == 1
printed_status = 'credit_payment' printed_status = 'credit_payment'
else else
@@ -211,13 +208,10 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, printed_status,current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, printed_status,current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
# if !saleObj.nil?
#end # InventoryJob.perform_now(self.id)
# InventoryDefinition.calculate_product_count(saleObj)
if !saleObj.nil? # end
# InventoryJob.perform_now(self.id)
# InventoryDefinition.calculate_product_count(saleObj)
end
end end
# status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, nil, nil) # status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, nil, nil)
@@ -275,7 +269,7 @@ class Origami::PaymentsController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.where(is_active: true).pluck(:payment_method) @payment_methods = PaymentMethodSetting.where(is_active: true).pluck(:payment_method)
@cash = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'cash' } @cash = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'cash' }
@credit = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'creditnote' } @credit = payments.inject(0) { |sum, payment| payment[0] == 'creditnote' ? sum + payment[1] : sum }
@other_payments = payments.select { |payment| !['cash', 'creditnote', 'foc'].include? payment[0] }.map { |method, amount| [ @payment_methods.find { |payment_method| payment_method.parameterize == method }, amount ] } @other_payments = payments.select { |payment| !['cash', 'creditnote', 'foc'].include? payment[0] }.map { |method, amount| [ @payment_methods.find { |payment_method| payment_method.parameterize == method }, amount ] }
@other_payment = @other_payments.sum { |payment| payment[1] } @other_payment = @other_payments.sum { |payment| payment[1] }
@@ -610,34 +604,13 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_type = params[:type] cashier_type = params[:type]
if cashier_type.strip.downcase == "doemal_order" if cashier_type.strip.downcase == "doemal_order"
unique_code = "ReceiptBillOrderPdf" print_settings = PrintSetting.where(unique_code: 'ReceiptBillOrderPdf').first
else else
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf print_settings = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first
unique_code = "ReceiptBillPdf"
print_settings = PrintSetting.all
if !print_settings.nil?
print_settings.each do |setting|
if setting.unique_code == 'ReceiptBillPdf'
unique_code = "ReceiptBillPdf"
elsif setting.unique_code == 'ReceiptBillStarPdf'
unique_code = "ReceiptBillStarPdf"
end
end
end
if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1'
unique_code = "ReceiptBillA5Pdf"
# else
# unique_code = "ReceiptBillPdf"
end
end
end
end
end end
# get printer info # get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name) printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)

View File

@@ -67,10 +67,7 @@ class Origami::ShiftsController < BaseOrigamiController
end end
end end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# if !close_cashier_print[0].nil? # if !close_cashier_print[0].nil?
# @close_cashier_print = close_cashier_print[0][1] # @close_cashier_print = close_cashier_print[0][1]
# end # end
@@ -90,13 +87,11 @@ class Origami::ShiftsController < BaseOrigamiController
end end
shop_details = shop_detail shop_details = shop_detail
#get tax #get tax
shift_obj = ShiftSale.where('id =?',@shift.id) shift_obj = ShiftSale.where('id = ?', @shift.id)
sale_items = ''
@lookup = Lookup.shift_sale_items_lookup_value @lookup = Lookup.shift_sale_items_lookup_value
if @lookup.to_i == 1 if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id) @sale_items = Sale.get_shift_sale_items(@shift.id)
other_charges = Sale.get_other_charges() @total_other_charges_info = ShiftSale.get_other_charges(@shift)
@total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift)
end end
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total) @total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@@ -118,16 +113,11 @@ class Origami::ShiftsController < BaseOrigamiController
printer = Printer::CashierStationPrinter.new(print_settings) printer = Printer::CashierStationPrinter.new(print_settings)
# print close cashier setting # print close cashier setting
close_cashier_print = Lookup.collection_of('close_cashier_print') if Lookup.collection_of('close_cashier_print').any? { |l| l == ['CloseCashierPrint', '1'] }
if close_cashier_print.empty? printer.print_close_cashier(print_settings, cashier_terminal, @shift, @sale_items, @total_other_charges_info, shop_details, @sale_taxes, @other_payment, @total_amount_by_account, @total_discount_by_account, @total_member_discount, @total_dinein, @total_takeway, @total_other_charges, @total_waste, @total_spoile, @total_credit_payments, @payment_methods)
@settings_lookup = Lookup.new(lookup_type: "close_cashier_print", name: "CloseCashierPrint", value: "1") end
@settings_lookup.save # end
end
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
if find_close_cashier_print[0][1].to_i > 0
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,@payment_methods)
end
end
end end
Employee.logout(session[:session_token]) Employee.logout(session[:session_token])
session[:session_token] = nil session[:session_token] = nil

View File

@@ -53,28 +53,31 @@ class Reports::ShiftsaleController < BaseReportController
@shift = ShiftSale.find_by_id(shift_id) @shift = ShiftSale.find_by_id(shift_id)
shift_obj = ShiftSale.where('id =?',shift_id) shift_obj = ShiftSale.where('id =?',shift_id)
close_cashier_pdf = Lookup.collection_of("print_settings")
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server unique_code = "CloseCashierPdf"
close_cashier_pdf = Lookup.collection_of("print_settings") if !close_cashier_pdf.empty?
close_cashier_pdf.each do |close_cashier|
unique_code = "CloseCashierPdf" if close_cashier[0] == 'CloseCashierCustomisePdf'
if close_cashier[1] == '1'
if !close_cashier_pdf.empty? unique_code="CloseCashierCustomisePdf"
close_cashier_pdf.each do |close_cashier| else
if close_cashier[0] == 'CloseCashierCustomisePdf' unique_code="CloseCashierPdf"
if close_cashier[1] == '1'
unique_code="CloseCashierCustomisePdf"
else
unique_code="CloseCashierPdf"
end
end end
end end
end end
end
shop_details = shop_detail shop_details = shop_detail
cashier_terminal = @shift.cashier_terminal cashier_terminal = @shift.cashier_terminal
@lookup = Lookup.shift_sale_items_lookup_value
if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id)
@total_other_charges_info = ShiftSale.get_other_charges(@shift)
end
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total) @total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total) @total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
@@ -96,14 +99,10 @@ class Reports::ShiftsaleController < BaseReportController
printer = Printer::CashierStationPrinter.new(print_settings) printer = Printer::CashierStationPrinter.new(print_settings)
# printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) # printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,@payment_methods) printer.print_close_cashier(print_settings, cashier_terminal, @shift, @sale_items, @total_other_charges_info, shop_details, @sale_taxes, @other_payment, @total_amount_by_account, @total_discount_by_account, @total_member_discount, @total_dinein, @total_takeway, @total_other_charges, @total_waste, @total_spoile, @total_credit_payments, @payment_methods)
respond_to do |format| respond_to do |format|
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'} format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
format
end
end end
end end
end end

View File

@@ -1,2 +1,5 @@
module PrintSettingsHelper module PrintSettingsHelper
def print_settings
tag.div id: 'print_settings', class: 'hidden', data: { action_cable: Lookup.collection_of('print_settings').any? { |x| x == ["ActionCable", "1"] } }
end
end end

View File

@@ -58,9 +58,9 @@ class Booking < ApplicationRecord
end end
end end
scope :active, -> {where("booking_status != 'moved'")} scope :active, -> { where('booking_status != ?', 'moved') }
scope :today, -> {where("created_at >= #{Time.now.utc}")} scope :today, -> { where('created_at >= ?', Time.now) }
scope :assign, -> { where(booking_status: 'assign')} scope :assign, -> { where(booking_status: 'assign') }
def self.sync_booking_records(bookings) def self.sync_booking_records(bookings)
if !bookings.nil? if !bookings.nil?
@@ -171,6 +171,15 @@ class Booking < ApplicationRecord
return @orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales return @orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales
end end
def self.get_booking_id(order_no)
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
.joins(" JOIN orders o ON o.order_id=bo.order_id")
.where("o.order_id='#{order_no}'")
.first()
return booking.booking_id
end
private private
def generate_custom_id def generate_custom_id
if self.booking_id.nil? if self.booking_id.nil?

View File

@@ -176,7 +176,7 @@ class OrderQueueStation < ApplicationRecord
end end
def move_print_pdf(change_to,current_user,change_from,order_items,oqs) def move_print_pdf(change_to,current_user,change_from,order_items,oqs)
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# get printer info # get printer info
@from = (DiningFacility.find(change_from)).name @from = (DiningFacility.find(change_from)).name
@to = (DiningFacility.find(change_to)).name @to = (DiningFacility.find(change_to)).name
@@ -197,6 +197,6 @@ class OrderQueueStation < ApplicationRecord
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items,oqs) printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items,oqs)
# end # end
# end # end
end # end
end end
end end

View File

@@ -38,66 +38,108 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
# self.print(filename, cashier_terminal.printer_name) # self.print(filename, cashier_terminal.printer_name)
# end # end
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items, total_other_charges_info,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,payment_methods) def print_close_cashier(printer_settings, cashier_terminal, shift_sale, sale_items, total_other_charges_info, shop_details, sale_taxes, other_payment, amount, discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments, payment_methods)
if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
if !sale_items.blank? or !sale_items.nil?
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
sale_items.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
if !sale_items.blank? or !sale_items.nil? @menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
@account_cate_count = Hash.new {|hash, key| hash[key] = 0} sale_items.each {|cate| @menu_cate_count[cate.menu_category_id] += 1}
sale_items.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
sale_items.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
end
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0} #Use CUPS service
sale_items.each {|cate| @menu_cate_count[cate.menu_category_id] += 1} #Generate PDF
#Print
cashier = shift_sale.employee.name
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
pdf = CloseCashierPdf.new(printer_settings, shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details, sale_taxes, other_payment, amount, discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments, payment_methods)
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
if !close_cashier_pdf.empty?
@totalByAccount = Hash.new {|hash, key| hash[key] = 0} close_cashier_pdf.each do |close_cashier|
sale_items.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total} if close_cashier[0] == 'CloseCashierCustomisePdf'
end if close_cashier[1] == '1'
pdf = CloseCashierCustomisePdf.new(printer_settings, shift_sale, shop_details, sale_taxes, other_payment, amount, discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments)
#Use CUPS service else
#Generate PDF pdf = CloseCashierPdf.new(printer_settings, shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details, sale_taxes, other_payment, amount,discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments, payment_methods)
#Print end
cashier = shift_sale.employee.name
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,payment_methods)
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
if !close_cashier_pdf.empty?
close_cashier_pdf.each do |close_cashier|
if close_cashier[0] == 'CloseCashierCustomisePdf'
if close_cashier[1] == '1'
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
else
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,payment_methods)
end end
end end
end end
end
pdf.render_file filename
#no print in cloud server pdf.render_file filename
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
self.print(filename, cashier_terminal.printer_name) if ENV["SERVER_MODE"] != "cloud"
self.print(filename, cashier_terminal.printer_name)
end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: cashier_terminal.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
shop_details: shop_details.as_json,
shift_sale: shift_sale,
cashier_terminal: cashier_terminal,
shift_employee: shift_sale.employee,
sale_items: sale_items,
other_charges: total_other_charges_info,
sale_taxes: sale_taxes,
other_payment: other_payment,
total_amount_by_account: amount,
total_discount_by_account: discount,
total_member_discount: member_discount,
total_waste: total_waste,
total_spoile: total_spoile,
total_other_charges: total_other_charges,
total_credit_payments: total_credit_payments
}
)
end end
end end
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges) def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
filename = "tmp/reports_sale_items.pdf" if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
filename = "tmp/reports_sale_items.pdf"
if print_settings.unique_code == "SaleItemsPdf" if print_settings.unique_code == "SaleItemsPdf"
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges) pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
puts 'Printing!!!!' end
end
if print_settings.unique_code == "SaleItemsStarPdf"
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
puts 'PrintingStar!!!!'
end
pdf.render_file filename if print_settings.unique_code == "SaleItemsStarPdf"
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
end
#no print in cloud server pdf.render_file filename
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, print_settings.printer_name) #no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, print_settings.printer_name)
end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: print_settings.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
sale_items: sale_items.as_json,
total_other_charges: total_other_charges,
shop_details:shop_details.as_json,
sale_details: {
period: period_name,
type: type,
account: account,
from_date: from_date,
to_date: to_date,
shift: shift_name,
},
}
)
end end
end end
#sqa #sqa

View File

@@ -1,80 +1,66 @@
class Printer::OrderQueuePrinter < Printer::PrinterWorker class Printer::OrderQueuePrinter < Printer::PrinterWorker
def print_order_item(print_settings, oqs, order_id, order_item_id, print_status, before_updated_qty="", options="") def print_order_item(print_settings, oqs, order_id, order_item_id, print_status, before_updated_qty="", options="")
# Must be one print booking_id = Booking.get_booking_id(order_id)
if print_settings.print_copies == 0 order_item = print_query('order_item', order_item_id).first #OrderItem.find_by_item_code(item_code)
print_settings.print_copies = 1
print_settings.save! if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
# Must be one print
if print_settings.print_copies == 0
print_settings.print_copies = 1
print_settings.save!
end
options = order_item.options
# check for item not to show
pdf = print_settings.unique_code.constantize.new(print_settings, order_item, print_status, options, oqs.use_alternate_name, before_updated_qty)
shop = Shop.current_shop
directory_name = "public/orders_#{shop.shop_code}"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
filename = directory_name + "/order_item_#{order_id}_#{order_item_id}" + ".pdf"
pdf.render_file filename
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: oqs.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
order_item: order_item.as_json(methods: :type),
print_status: print_status.gsub(/[()]/, ""),
booking_id: booking_id,
precision: print_settings.precision
}
)
end end
order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code)
options = order_item[0].options
# check for item not to show
# if order_item[0].price != 0
pdf = print_settings.unique_code.constantize.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
# end
shop = Shop.current_shop
directory_name = 'public/orders_'+shop.shop_code
Dir.mkdir(directory_name) unless File.exists?(directory_name)
filename = directory_name + "/order_item_#{order_id}_#{order_item_id}" + ".pdf"
pdf.render_file filename
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
#For print copy
# pdf.render_file filename.gsub(".","-copy.")
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
return filename, order_id, oqs.printer_name return filename, order_id, oqs.printer_name
end end
# Query for per order # Query for per order
def print_order_summary(print_settings, oqs, order_id, order_items, print_status, before_updated_qty="", options="") def print_order_summary(print_settings, oqs, order_id, order_items, print_status, before_updated_qty="", options="")
#Use CUPS service booking_id = Booking.get_booking_id(order_id) #order[0].order_id
#Generate PDF order = print_query('order_summary', order_id)
#Print
# Must be one print
if print_settings.print_copies == 0
print_settings.print_copies = 1
print_settings.save!
end
shop = Shop.current_shop if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
directory_name = "public/orders_#{shop.shop_code}" #Use CUPS service
Dir.mkdir(directory_name) unless File.exists?(directory_name) #Generate PDF
#Print
# For Print Per Item # Must be one print
if oqs.cut_per_item if print_settings.print_copies == 0
print_settings.print_copies = 1
order_items.each do |odi| print_settings.save!
odi_item = print_query('order_item', odi.order_items_id)
filename = directory_name + "/order_item_#{order_id}.pdf"
# filename = "tmp/order_item_#{order_id}" + ".pdf"
# For Item Options
options = odi.options == "[]" ? "" : odi.options
# check for item not to show
#if odi.price != 0
pdf = print_settings.unique_code.constantize.new(print_settings, odi_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
end
#end
end end
# For Print Order Summary
else shop = Shop.current_shop
order = print_query('order_summary', order_id) directory_name = "public/orders_#{shop.shop_code}"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
filename = directory_name + "/order_summary_#{order_id}.pdf" filename = directory_name + "/order_summary_#{order_id}.pdf"
# filename = "tmp/order_summary_#{order_id}" + ".pdf" # filename = "tmp/order_summary_#{order_id}" + ".pdf"
@@ -85,15 +71,26 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
if ENV["SERVER_MODE"] != "cloud" if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name) self.print(filename, oqs.printer_name)
end end
#For print copy else
# pdf.render_file filename.gsub(".","-copy.") ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
# self.print(filename.gsub(".","-copy."), oqs.printer_name) queue: oqs.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
order_item: order_items,
order: order.as_json(methods: :type),
print_status: "",
booking_id: booking_id,
precision: print_settings.precision
}
)
end end
return filename, order_id, oqs.printer_name return filename, order_id, oqs.printer_name
end end
# Print for orders in booking # Print for orders in booking
def print_booking_summary(print_settings, oqs, booking_id, print_status,before_updated_qty="") def print_booking_summary(print_settings, oqs, booking_id, print_status, before_updated_qty="")
# Must be one print # Must be one print
if print_settings.print_copies == 0 if print_settings.print_copies == 0
print_settings.print_copies = 1 print_settings.print_copies = 1
@@ -173,37 +170,51 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# Check in-out time # Check in-out time
def print_check_in_out(print_settings, cashier_terminal, booking, table) def print_check_in_out(print_settings, cashier_terminal, booking, table)
#Use CUPS service if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
#Generate PDF #Use CUPS service
#Print #Generate PDF
sale_id = booking.sale_id #Print
filename = "tmp/check_in_out_#{sale_id}" + ".pdf" sale_id = booking.sale_id
filename = "tmp/check_in_out_#{sale_id}" + ".pdf"
pdf = CheckInOutPdf.new(print_settings,booking, table) pdf = CheckInOutPdf.new(print_settings,booking, table)
print_setting = PrintSetting.all
# if order_item[0].price != 0 print_setting = PrintSetting.all
if !print_setting.empty?
print_setting.each do |print_settings| # if order_item[0].price != 0
if print_settings.unique_code == 'CheckInOutPdf' if !print_setting.empty?
pdf = CheckInOutPdf.new(print_settings,booking, table) print_setting.each do |print_settings|
if print_settings.unique_code == 'CheckInOutPdf'
pdf = CheckInOutPdf.new(print_settings,booking, table)
end
end end
end end
end
pdf.render_file filename pdf.render_file filename
# Must be one print # Must be one print
if print_settings.print_copies == 0 if print_settings.print_copies == 0
print_settings.print_copies = 1 print_settings.print_copies = 1
print_settings.save! print_settings.save!
end end
# print_settings.print_copies = 1 # print_settings.print_copies = 1
# print_settings.save! # print_settings.save!
#no print in cloud server #no print in cloud server
if ENV["SERVER_MODE"] != "cloud" if ENV["SERVER_MODE"] != "cloud"
self.print(filename, print_settings.printer_name) self.print(filename, print_settings.printer_name)
end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: cashier_terminal.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
booking: booking,
table: table,
table_type: table.type,
}
)
end end
end end
end end

View File

@@ -91,10 +91,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Bill Receipt Print #Bill Receipt Print
def print_receipt_bill(printer_settings, kbz_pay_status, qr_code, cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation) def print_receipt_bill(printer_settings, kbz_pay_status, qr_code, cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
#Use CUPS service if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
#Generate PDF #Use CUPS service
#Print #Generate PDF
if printer_settings #Print
if !printer_settings.unique_code.match?(/receiptbillorder/i) if !printer_settings.unique_code.match?(/receiptbillorder/i)
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount) pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
@@ -109,48 +109,97 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
# print as print copies in printer setting # print as print copies in printer setting
count = printer_settings.print_copies count = printer_settings.print_copies
# override print copies for print worker loop directory_name = 'public/receipts'
# print_settings.print_copies = 1 Dir.mkdir(directory_name) unless File.exists?(directory_name)
# print_settings.save! Rails.logger.debug "############## dir::" + directory_name
end
directory_name = 'public/receipts' filename = "#{directory_name}/receipt_bill_#{sale_data.receipt_no}#{count != 1 ? "_#{count}" : ''}.pdf"
Dir.mkdir(directory_name) unless File.exists?(directory_name) pdf.render_file filename
Rails.logger.debug "############## dir::" + directory_name
if count == 1 if printed_status != 'Paid' || !Lookup.where(lookup_type: "ReceiptPdfView").pluck(:value).include?('1')
filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf" #no print in cloud server
pdf.render_file filename puts "SERVER_MODE #{ENV["SERVER_MODE"]}"
if printed_status != 'Paid' && printed_status != 'credit_payment' if ENV["SERVER_MODE"] != "cloud"
#no print in cloud server self.print(filename, cashier_terminal.printer_name)
if ENV["SERVER_MODE"] != "cloud"
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
end
elsif printed_status == 'credit_payment'
filename = directory_name + "/receipt_bill_credit_#{sale_data.receipt_no}.pdf"
pdf.render_file filename
self.print(directory_name + "/receipt_bill_credit_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
end
else
filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
pdf.render_file filename
if printed_status != 'Paid'
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
end
end end
end end
Rails.logger.debug "############## filename::" + filename
return filename, sale_data.receipt_no, cashier_terminal.printer_name Rails.logger.debug "############## filename::" + filename
else
if printed_status != 'Paid' || !Lookup.where(lookup_type: "ReceiptPdfView").pluck(:value).include?('1')
sale_payments = SalePayment
.select(:payment_method, 'SUM(`sale_payments`.`payment_amount`) AS `payment_amount`')
.where(sale_id: sale_data.sale_id).group(:payment_method)
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: cashier_terminal.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
shop_details: shop_details.as_json,
body: { sale_data: sale_data,
booking: sale_data.bookings,
dining_facility: sale_data.booking.dining_facility.as_json(methods: :type),
sale_taxes: sale_data.sale_taxes,
latest_order_no: latest_order_no,
sale_items: sale_items,
precision: print_settings.precision,
delimiter: print_settings.delimiter,
member_info: member_info,
customer_name: customer_name,
rebate_amount: rebate_amount,
current_balance: balance,
card_data: card_data,
card_balance_amount: card_balance_amount,
discount_price_by_accounts: discount_price_by_accounts,
item_price_by_accounts: item_price_by_accounts,
sale_payments: sale_payments.as_json
},
footer: {
printed_status: printed_status, footer_text: "Thank You! See you Again"
}
}
)
end
end
return filename || '', sale_data.receipt_no, cashier_terminal.printer_name
end end
# stock check # stock check
def print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker_name, shop_details) def print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker_name, shop_details)
pdf = StockResultPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details) stock_items= []
pdf.render_file "tmp/print_stock_check_result.pdf" if stockcheck_items.length > 0
#no print in cloud server stockcheck_items.each do |sc|
if ENV["SERVER_MODE"] != "cloud" stock_item= {
self.print("tmp/print_stock_check_result.pdf") count: sc.stock_count.to_s,
item_name: MenuItemInstance.get_item_name(sc.item_code)
}
stock_items.push(stock_item)
end
end
if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
pdf = StockCheckPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
pdf.render_file "tmp/print_stock_check_result.pdf"
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_stock_check_result.pdf")
end end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: print_settings.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
stockcheck: stockcheck,
stockcheck_items: stock_items,
checker_name: checker_name,
shop_details: shop_details,
}
)
end
end end
#Queue No Print #Queue No Print
@@ -167,21 +216,40 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end end
#Move Table Print #Move Table Print
def print_move_table(printer_settings,to,from,shop_detail,date,type,moved_by,order_items,oqs) def print_move_table(printer_settings, to, from, shop_detail, date, type, moved_by, order_items, oqs)
#Use CUPS service if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
#Generate PDF #Use CUPS service
#Print #Generate PDF
#Print
pdf = MoveTablePdf.new(printer_settings, to, from, shop_detail, date, type, moved_by, order_items)
pdf.render_file "tmp/print_move_table.pdf"
pdf = MoveTablePdf.new(printer_settings,to,from,shop_detail,date,type,moved_by,order_items) if ENV["SERVER_MODE"] != "cloud"
pdf.render_file "tmp/print_move_table.pdf" if oqs.print_copy
self.print("tmp/print_move_table.pdf",oqs.printer_name)
if oqs.print_copy else
self.print("tmp/print_move_table.pdf",oqs.printer_name) print_settings.print_copies = 1
print_settings.save!
#no print in cloud server
self.print("tmp/print_move_table.pdf", oqs.printer_name)
end
end
else else
print_settings.print_copies = 1 ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
print_settings.save! queue: oqs.station_name,
#no print in cloud server unique_code: print_settings.unique_code,
self.print("tmp/print_move_table.pdf", oqs.printer_name) print_copies: print_settings.print_copies,
data: {
type: type,
body: {
to: to,
from: from,
date: date,
moved_by: moved_by,
order_items: order_items.as_json,
},
}
)
end end
end end
@@ -200,14 +268,29 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Queue No Print #Queue No Print
def print_call_waiter(printer_settings,table,time,shop_detail) def print_call_waiter(printer_settings,table,time,shop_detail)
#Use CUPS service if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
#Generate PDF #Use CUPS service
#Print #Generate PDF
pdf = CallWaiterPdf.new(printer_settings,table,time,shop_detail) #Print
pdf.render_file "tmp/print_call_waiter.pdf" pdf = CallWaiterPdf.new(printer_settings,table,time,shop_detail)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud" pdf.render_file "tmp/print_call_waiter.pdf"
self.print("tmp/print_call_waiter.pdf") #no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_call_waiter.pdf")
end
else
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: print_settings.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
shop_name: shop_detail.name,
name: print_settings.name,
table: table.name,
time: time,
}
)
end end
end end
@@ -217,18 +300,18 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
# if count == 0 # if count == 0
# self.print(filename, printer_name) # self.print(filename, printer_name)
# else # else
if count == 1 if count == 1
#no print in cloud server #no print in cloud server
if ENV["SERVER_MODE"] != "cloud" if ENV["SERVER_MODE"] != "cloud"
self.print(filename, printer_name) self.print(filename, printer_name)
end end
else else
filename = "public/receipts/receipt_bill_#{receipt_no}_#{count}.pdf" filename = "public/receipts/receipt_bill_#{receipt_no}_#{count}.pdf"
# no print in cloud server # no print in cloud server
if ENV["SERVER_MODE"] != "cloud" if ENV["SERVER_MODE"] != "cloud"
self.print(filename, printer_name) self.print(filename, printer_name)
end end
end end
# end # end
end end

View File

@@ -764,7 +764,7 @@ class Sale < ApplicationRecord
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
.sale_payments_with_audit_except_void_between(from, to) .sale_payments_with_audit_except_void_between(from, to)
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to) .where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
.group("sale_id").to_sql .group("sale_id")
sale_taxes = Sale.select('sales.sale_id, sale_taxes.tax_name') sale_taxes = Sale.select('sales.sale_id, sale_taxes.tax_name')
.joins(:sale_taxes) .joins(:sale_taxes)
@@ -789,13 +789,13 @@ class Sale < ApplicationRecord
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale, (IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date, CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
#{payment_methods.map { |method| pm = method == 'paypar' ? 'redeem' : method; "SUM(`#{pm}`) as `#{pm}`"}.push('').join(', ')} #{payment_methods.map { |method| pm = method == 'paypar' ? 'redeem' : method; "SUM(`#{pm}`) as `#{pm}`"}.push('').join(', ')}
SUM(cash_amount) as cash_amount, SUM(`cash_amount`) as `cash_amount`,
SUM(credit_amount) as credit_amount, SUM(`credit_amount`) as `credit_amount`,
SUM(foc_amount) as foc_amount SUM(`foc_amount`) as `foc_amount`
FROM ( FROM (
#{sales} #{sales.to_sql}
) as s ) as s
JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id LEFT JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys) GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
return daily_total return daily_total
end end
@@ -974,7 +974,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,accou
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -997,7 +997,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,accou
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -1021,7 +1021,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,accou
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount) discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed) change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -1080,7 +1080,7 @@ def self.get_staff_meal_items(shift_sale_range, shift, from, to, status, account
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -1103,7 +1103,7 @@ def self.get_staff_meal_items(shift_sale_range, shift, from, to, status, account
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
@@ -1127,7 +1127,7 @@ def self.get_staff_meal_items(shift_sale_range, shift, from, to, status, account
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount) discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed) change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = select(Sale.column_names).select("SUM(case when (sale_payments.payment_method IN (#{payment_methods.empty? ? '""' : payment_methods.map{ |pm| "\"#{pm}\"" }.join(', ') })) then (sale_payments.payment_amount) else 0 end) as card_amount,
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount, SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount") SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")

View File

@@ -1,14 +1,12 @@
class SeedGenerator < ApplicationRecord class SeedGenerator < ApplicationRecord
# Generate ID for Tables # Generate ID for Tables
def self.generate_id(model, prefix) def self.generate_id(model, prefix)
model_name = self.get_model_name(model)
prefix ||= '' prefix ||= ''
prefix << '-' if prefix.present? prefix << '-' if prefix.present?
if ENV["SERVER_MODE"] == 'cloud' if ENV["SERVER_MODE"] == 'cloud'
prefix << 'C' prefix << 'C'
else # else
prefix << 'L' prefix << 'L'
end end
@@ -16,14 +14,12 @@ class SeedGenerator < ApplicationRecord
prefix << shop.shop_code prefix << shop.shop_code
end end
seed = self.update_seed(model_name) seed = self.update_seed(model)
length = 16 - prefix.length length = 16 - prefix.length
prefix + seed.to_s.rjust(length, '0') prefix + seed.to_s.rjust(length, '0')
end end
def self.generate_ids(model, prefix, count = 1) def self.generate_ids(model, prefix, count = 1)
model_name = self.get_model_name(model)
prefix ||= '' prefix ||= ''
prefix << '-' if prefix.present? prefix << '-' if prefix.present?
@@ -37,7 +33,7 @@ class SeedGenerator < ApplicationRecord
prefix << shop.shop_code prefix << shop.shop_code
end end
start = self.update_seed(model_name, count) start = self.update_seed(model, count)
stop = start + count - 1 stop = start + count - 1
length = 16 - prefix.length length = 16 - prefix.length
(start..stop).map { |c| prefix + c.to_s.rjust(length, '0') } (start..stop).map { |c| prefix + c.to_s.rjust(length, '0') }
@@ -127,7 +123,8 @@ class SeedGenerator < ApplicationRecord
def self.update_seed(model, count = 1) def self.update_seed(model, count = 1)
SeedGenerator.transaction do SeedGenerator.transaction do
seed = SeedGenerator.lock.find_by_model(model) seed = SeedGenerator.lock.find_by_model(get_model_name(model)) ||
SeedGenerator.lock.find_by_model(model)
seed.next = seed.next + (count * seed.increase_by) seed.next = seed.next + (count * seed.increase_by)
seed.current = seed.next - seed.increase_by seed.current = seed.next - seed.increase_by
seed.save! seed.save!

View File

@@ -152,7 +152,7 @@ class ShiftSale < ApplicationRecord
def self.get_by_shift_other_payment(shift) def self.get_by_shift_other_payment(shift)
payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method) payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method)
shift_other_payments = Sale.select("sales.sale_id,sale_payments.payment_method as name") shift_other_payments = Sale.select("sales.sale_id, sale_payments.payment_method as name")
if payment_methods.present? if payment_methods.present?
shift_other_payments = shift_other_payments.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.join(', ')}") shift_other_payments = shift_other_payments.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.join(', ')}")
end end
@@ -210,6 +210,11 @@ class ShiftSale < ApplicationRecord
.first() .first()
end end
def self.get_other_charges(shift)
query = SaleItem.joins("JOIN sales as s ON s.sale_id = sale_items.sale_id")
.where('shift_sale_id =? and s.sale_status = "completed" and sale_items.product_code = "Other Charges" and sale_items.item_instance_code is null',shift.id)
end
def self.search(filter,from,to) def self.search(filter,from,to)
if filter.blank? if filter.blank?
keyword = '' keyword = ''

View File

@@ -8,7 +8,7 @@ class Shop < ApplicationRecord
accepts_nested_attributes_for :display_images accepts_nested_attributes_for :display_images
def file_data=(input_data) def file_data=(input_data)
self.data = input_data.read self.data = input_data.read
end end
def self.current_shop def self.current_shop

View File

@@ -597,7 +597,8 @@ class CloseCashierPdf < Prawn::Document
def other_charges_detail(total_other_charges) def other_charges_detail(total_other_charges)
total_charges = 0 total_charges = 0
total_charges_items = 0 total_charges_items = 0
p "total other charges<========================="
p total_other_charges
unless total_other_charges.nil? unless total_other_charges.nil?
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.page_width - 10, :height => 20) do bounding_box([0,y_position], :width =>self.page_width - 10, :height => 20) do
@@ -611,6 +612,7 @@ class CloseCashierPdf < Prawn::Document
total_other_charges.each do |charges| total_other_charges.each do |charges|
move_down 3 move_down 3
p charges['product_name']
add_item_line(charges['product_name'], charges['unit_price'].to_i, charges['total_item'].to_i, charges['grand_total'].to_i) add_item_line(charges['product_name'], charges['unit_price'].to_i, charges['total_item'].to_i, charges['grand_total'].to_i)
total_charges_items += charges['total_item'].to_i total_charges_items += charges['total_item'].to_i

View File

@@ -96,7 +96,7 @@ class ReceiptBillPdf < Prawn::Document
if kbz_pay_status if kbz_pay_status
if printed_status == 'credit_payment' if printed_status == 'credit_payment'
printed_status = 'Paid' printed_status = 'Paid'
end end
kbzpay_qr_generator(printed_status, qr_code) kbzpay_qr_generator(printed_status, qr_code)
end end
@@ -309,146 +309,144 @@ class ReceiptBillPdf < Prawn::Document
end end
def all_total(sale_data,precision,delimiter,printed_status) def all_total(sale_data,precision,delimiter,printed_status)
move_down line_move move_down line_move
item_name_width = self.item_width item_name_width = self.item_width
y_position = cursor y_position = cursor
if sale_data.discount_type == 'member_discount' if sale_data.discount_type == 'member_discount'
dis_type = "Member Discount:" dis_type = "Member Discount:"
else
dis_type = "Overall Discount:"
end
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ dis_type }", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "( #{number_format(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
end
service_tax_desc = ""
service_tax_amount = 0
service_tax_rate = 0
com_tax_desc = ""
com_tax_amount = 0
com_tax_rate = 0
if sale_data.sale_taxes.length > 0
incl_tax = ""
if sale_data.tax_type == "inclusive"
incl_tax = "Incl."
end
find_lookup = Lookup.find_by_lookup_type('show_total_before_tax')
if find_lookup.nil? || find_lookup == nil
lookup = Lookup.new(lookup_type: 'show_total_before_tax', name: 'Show Total Before Tax', value: '0')
lookup.save
end
check_lookup_type = Lookup.find_by_lookup_type('show_total_before_tax')
if check_lookup_type.value == '1'
sale_data.sale_taxes.each do |st|
if (st.tax_name.include? "Service")
service_tax_desc = st.tax_name
service_tax_amount = st.tax_payable_amount
if incl_tax
service_tax_rate = st.tax_rate.to_i
end
end
if (st.tax_name.include? "Commercial")
com_tax_desc = st.tax_name
com_tax_amount = st.tax_payable_amount
if incl_tax
com_tax_rate = st.tax_rate.to_i
end
end
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ service_tax_desc } (#{incl_tax} #{ service_tax_rate }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(service_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
stroke_horizontal_rule
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Total Before Tax", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{service_tax_amount.to_i + @sub_total.to_i}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ com_tax_desc } (#{incl_tax} #{ com_tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(com_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
else else
dis_type = "Overall Discount:" sale_data.sale_taxes.each do |st|
end move_down line_move
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ dis_type }", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "( #{number_format(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
end
service_tax_desc = ""
service_tax_amount = 0
service_tax_rate = 0
com_tax_desc = ""
com_tax_amount = 0
com_tax_rate = 0
if sale_data.sale_taxes.length > 0
incl_tax = ""
if sale_data.tax_type == "inclusive"
incl_tax = "Incl."
end
find_lookup = Lookup.find_by_lookup_type('show_total_before_tax')
if find_lookup.nil? || find_lookup == nil
lookup = Lookup.new(lookup_type: 'show_total_before_tax', name: 'Show Total Before Tax', value: '0')
lookup.save
end
check_lookup_type = Lookup.find_by_lookup_type('show_total_before_tax')
if check_lookup_type.value == '1'
sale_data.sale_taxes.each do |st|
if (st.tax_name.include? "Service")
service_tax_desc = st.tax_name
service_tax_amount = st.tax_payable_amount
if incl_tax
service_tax_rate = st.tax_rate.to_i
end
end
if (st.tax_name.include? "Commercial")
com_tax_desc = st.tax_name
com_tax_amount = st.tax_payable_amount
if incl_tax
com_tax_rate = st.tax_rate.to_i
end
end
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ service_tax_desc } (#{incl_tax} #{ service_tax_rate }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(service_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
stroke_horizontal_rule
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Total Before Tax", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{service_tax_amount.to_i + @sub_total.to_i}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ com_tax_desc } (#{incl_tax} #{ com_tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(com_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
else
sale_data.sale_taxes.each do |st|
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
end
end
else
end
# move_down 5
# y_position = cursor
# bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
# text "Total Tax", :size => self.item_font_size,:align => :left
# end
# bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
# text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
# end
if sale_data.rounding_adjustment != 0.0
move_down line_move
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Rounding Adjustment", :size => self.item_font_size,:align => :left text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right text "#{number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end end
end
end end
end
# move_down 5
# y_position = cursor
# bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
# text "Total Tax", :size => self.item_font_size,:align => :left
# end
# bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
# text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
# end
if sale_data.rounding_adjustment != 0.0
move_down line_move move_down line_move
y_position = cursor y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.item_description_width) do bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left text "Rounding Adjustment", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right
end end
move_down line_move end
sale_payment(sale_data,precision,delimiter,printed_status) move_down line_move
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.item_description_width) do
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
end
move_down line_move
sale_payment(sale_data,precision,delimiter,printed_status)
end end
def sale_payment(sale_data,precision,delimiter,printed_status) def sale_payment(sale_data,precision,delimiter,printed_status)
stroke_horizontal_rule stroke_horizontal_rule
#move_down line_move #move_down line_move
# sql = "SELECT SUM(payment_amount) # sql = "SELECT SUM(payment_amount)
# FROM sale_payments where payment_method='creditnote' # FROM sale_payments where payment_method='creditnote'
# and sale_id='#{sale_data.sale_id}'" # and sale_id='#{sale_data.sale_id}'"
if printed_status == 'credit_payment' if printed_status == 'credit_payment'
sale_payments = SalePayment.select(:payment_amount, :payment_method, :updated_at) sale_payments = SalePayment.select(:payment_amount, :payment_method, :updated_at)
.where("sale_id = '#{sale_data.sale_id}' AND payment_method != 'creditnote'") .where("sale_id = '#{sale_data.sale_id}' AND payment_method != 'creditnote'")
else else
sql = SalePayment.select("(SUM(payment_amount))").where("payment_method='creditnote' and sale_id='#{sale_data.sale_id}'").to_sql sql = SalePayment.select("(SUM(payment_amount))").where("payment_method='creditnote' and sale_id='#{sale_data.sale_id}'").to_sql
# sql1 = "SELECT CASE WHEN s.amount_changed > 0 and (s.amount_received - s.amount_changed) = s.grand_total THEN ( SELECT SUM(payment_amount) # sql1 = "SELECT CASE WHEN s.amount_changed > 0 and (s.amount_received - s.amount_changed) = s.grand_total THEN ( SELECT SUM(payment_amount)
# FROM sale_payments where payment_method='creditnote' # FROM sale_payments where payment_method='creditnote'
@@ -466,38 +464,38 @@ class ReceiptBillPdf < Prawn::Document
where sa.sale_id='#{sale_data.sale_id}')) = 0 where sa.sale_id='#{sale_data.sale_id}')) = 0
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id) THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id)
.group("payment_method") .group("payment_method")
end end
sale_payments.each do |payment|
y_position = cursor
if payment.payment_method == "paypar"
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
elsif printed_status == 'credit_payment'
text "#{payment.payment_method.capitalize} Payment on #{payment.updated_at.strftime('%d-%m-%Y')}", :left_margin => -10, :size => self.item_font_size,:align => :left
else
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do sale_payments.each do |payment|
text "#{number_format(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right y_position = cursor
end if payment.payment_method == "paypar"
move_down line_move bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
elsif printed_status == 'credit_payment'
text "#{payment.payment_method.capitalize} Payment on #{payment.updated_at.strftime('%d-%m-%Y')}", :left_margin => -10, :size => self.item_font_size,:align => :left
else
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end
end end
if sale_data.amount_received > 0
y_position = cursor bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
move_down line_move text "#{number_format(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Change Amount", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
# move_down line_move
end end
move_down line_move
end
if sale_data.amount_received > 0
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Change Amount", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_format(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
# move_down line_move
end
end end
# show member information # show member information
@@ -677,7 +675,7 @@ class ReceiptBillPdf < Prawn::Document
query = sale_data.sale_payments query = sale_data.sale_payments
.merge(SalePayment.where.not(payment_method: 'creditnote') .merge(SalePayment.where.not(payment_method: 'creditnote')
.or(SalePayment.where.not(SalePayment.arel_table[:payment_amount].lteq(sale_data.sale_payments.joins(:sale_audit).sum(:payment_amount))))) .or(SalePayment.where.not(SalePayment.arel_table[:payment_amount].lteq(sale_data.sale_payments.joins(:sale_audit).sum(:payment_amount)))))
query.each do |payment| query.each do |payment|
if payment.payment_method == "creditnote" if payment.payment_method == "creditnote"

View File

@@ -1,4 +1,4 @@
class StockResultPdf < Prawn::Document class StockCheckPdf < Prawn::Document
attr_accessor :label_width, :price_column_width, :page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size, :item_height, :qty_width, :total_width, :item_description_width, :text_width attr_accessor :label_width, :price_column_width, :page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size, :item_height, :qty_width, :total_width, :item_description_width, :text_width
def initialize(printer_settings, stockcheck, stockcheck_items, checker_name, shop_details) def initialize(printer_settings, stockcheck, stockcheck_items, checker_name, shop_details)

View File

@@ -57,7 +57,7 @@
<div class="col-sm-12 col-md-12 col-lg-12"> <div class="col-sm-12 col-md-12 col-lg-12">
<%= f.input :name, :class => "form-control name", :required => true %> <%= f.input :name, :class => "form-control name", :required => true %>
<% flash.each do |test, msg| %> <% flash.each do |test, msg| %>
<% <%
str="[\"#{msg['name']}\"]" str="[\"#{msg['name']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
@@ -94,7 +94,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-12 col-md-12 col-lg-12" align="right"> <div class="col-sm-12 col-md-12 col-lg-12" align="right">
<button type="button" class="btn btn-md bg-blue btn-info-full next-step">Next</button> <button type="button" class="btn btn-md bg-blue btn-info-full next-step">Next</button>
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane" role="tabpanel" id="complete"> <div class="tab-pane" role="tabpanel" id="complete">
@@ -107,12 +107,12 @@
<% if f.object.image_path? %> <% if f.object.image_path? %>
<p><%= f.object.name %></p> <p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %> <%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %> <% else %>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %> <%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %> <% end %>
</div> </div>
<%= f.file_field :image_path, :class => "img-thumbnail" %> <%= f.file_field :image_path, :class => "img-thumbnail" %>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -160,7 +160,7 @@
<option value="<%= ct.value %>"> <option value="<%= ct.value %>">
<%= ct.name %></option> <%= ct.name %></option>
<%end %> <%end %>
</select> </select>
</div> </div>
</div> </div>
@@ -185,7 +185,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-12 col-md-12 col-lg-12"> <div class="col-sm-12 col-md-12 col-lg-12">
<label class="control-label"><%= t("views.right_panel.detail.paypar_account_no") %>:</label> <label class="control-label"><%= t("views.right_panel.detail.paypar_account_no") %>:</label>
<div class="-group"> <div class="-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/> <input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div> <div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div> </div>
@@ -201,7 +201,7 @@
<option value="<%= member.value %>"> <option value="<%= member.value %>">
<%= member.name %></option> <%= member.name %></option>
<%end %> <%end %>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -212,7 +212,7 @@
<button type="submit" class="btn btn-primary" id="submit_customer"><%= t("views.btn.submit") %></button> <button type="submit" class="btn btn-primary" id="submit_customer"><%= t("views.btn.submit") %></button>
<button type="submit" class="btn btn-info" disabled id="update_customer"><%= t("views.btn.update") %></button> <button type="submit" class="btn btn-info" disabled id="update_customer"><%= t("views.btn.update") %></button>
<button type="button" class="btn btn-danger" id="reset"><%= t("views.btn.reset") %></button> <button type="button" class="btn btn-danger" id="reset"><%= t("views.btn.reset") %></button>
</div> </div>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
@@ -259,13 +259,10 @@
console.log(paypar_account_no); console.log(paypar_account_no);
// Read Card Reader // Read Card Reader
$("#paypar_account_no").on('focus', function(e){ $("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){ if($(this).val() == ''){
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
},100);
} }
}); });
@@ -289,6 +286,7 @@
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
$("#search").val(cardNo); $("#search").val(cardNo);
$("#type").val("card"); $("#type").val("card");
$("#filter_form").submit();
}else{ }else{
if($.inArray(cardNo, paypar_account_no) !== -1){ if($.inArray(cardNo, paypar_account_no) !== -1){
swal({ swal({
@@ -309,9 +307,10 @@
} }
} }
} }
$("#sxModal").hide();
} }
$("#sxModal .btn_cancel").on('click',function(){ $("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide(); $("#sxModal").hide();
}); });
</script> </script>

View File

@@ -1,9 +1,9 @@
<!-- <div class="page-header"> <!-- <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t :crm %></li> --> <li class="breadcrumb-item active"><%= t :crm %></li> -->
<!-- <li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> --> <!-- <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li> -->
<!-- <span class="float-right"> <!-- <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>
</span> </span>
@@ -161,26 +161,13 @@
$(document).ready(function () { $(document).ready(function () {
$("#oqs_loading_wrapper").show(); $("#oqs_loading_wrapper").show();
localStorage.setItem("member_card",false); localStorage.setItem("member_card",false);
/*$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');*/
// Read Card Reader // Read Card Reader
$("#member_acc_no").on('click', function(e){ $("#member_acc_no").on('click', function(e){
localStorage.setItem("member_card",true); localStorage.setItem("member_card",true);
var cardNo = "";
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
$("#filter_form").submit();
},100);
}); });
// QR Code Reader // QR Code Reader
$("#qr_code").on('click', function(e){ $("#qr_code").on('click', function(e){
var code = ""; var code = "";
@@ -240,88 +227,85 @@
/*customer UI tab btn*/ /*customer UI tab btn*/
$(document).on('click',".customer_tr",function(){ $(document).on('click',".customer_tr",function(){
// if(this.checked){ // if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true ); $(this).closest('tr').find('.checkbox_check').prop( "checked", true );
//$( "#checkbox_check" ).prop( "checked", true ); //$( "#checkbox_check" ).prop( "checked", true );
var sale_id = $("#sale_id").val() || 0; var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).attr('data-ref'); var customer_id = $(this).attr('data-ref');
if(sale_id != 0){ if(sale_id != 0){
// var url = "/"+customer_id; // var url = "/"+customer_id;
update_sale(customer_id,sale_id); update_sale(customer_id,sale_id);
}else{ }else{
var url = "customers/" + customer_id + "/edit"; var url = "customers/" + customer_id + "/edit";
} }
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'}); $("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
// Selected for Taxes // Selected for Taxes
var taxes = JSON.stringify(data.tax_profiles); var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes); var parse_taxes = JSON.parse(taxes);
$.each(parse_taxes, function(i, value){ $.each(parse_taxes, function(i, value){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'}); $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
}); });
$('#customer_id').val(data.id); $('#customer_id').val(data.id);
$('#customer_name').val(data.name); $('#customer_name').val(data.name);
$('#customer_company').val(data.company); $('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no); $('#customer_contact_no').val(data.contact_no);
$('#customer_email').val(data.email); $('#customer_email').val(data.email);
$('#customer_salutation').val(data.salutation); $('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no); $('#customer_nrc_no').val(data.nrc_no);
$('#customer_card_no').val(data.card_no); $('#customer_card_no').val(data.card_no);
$('#customer_type').val(data.customer_type); $('#customer_type').val(data.customer_type);
$('#paypar_account_no').val(data.paypar_account_no); $('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address); $('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth); $('#customer_date_of_birth').val(data.date_of_birth);
if(data.image_path.url!=undefined && data.image_path.url!=null){ if(data.image_path.url!=undefined && data.image_path.url!=null){
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url); $('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
} }
$('#customer_membership_type').val(data.membership_type); $('#customer_membership_type').val(data.membership_type);
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected'); $('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
if (data.gender == 'Male') { if (data.gender == 'Male') {
$('.male').prop( "checked", true ) $('.male').prop( "checked", true )
}else{ }else{
$('.female').prop( "checked", true ) $('.female').prop( "checked", true )
} }
if(data.salutation == 'Mr') { if(data.salutation == 'Mr') {
$('.mr').prop( "checked", true ) $('.mr').prop( "checked", true )
}else if(data.salutation == 'Miss') { }else if(data.salutation == 'Miss') {
$('.miss').prop( "checked", true ) $('.miss').prop( "checked", true )
}else if(data.salutation == 'Mrs'){ }else if(data.salutation == 'Mrs'){
$('.mrs').prop( "checked", true ) $('.mrs').prop( "checked", true )
}else{ }else{
$('.mdm').prop( "checked", true ) $('.mdm').prop( "checked", true )
} }
$('.membership_authentication_code').val(data.membership_authentication_code); $('.membership_authentication_code').val(data.membership_authentication_code);
$('#update_customer').removeAttr('disabled').val(''); $('#update_customer').removeAttr('disabled').val('');
$('#update_customer').attr('value', 'Update'); $('#update_customer').attr('value', 'Update');
$('#submit_customer').attr('disabled','disabled'); $('#submit_customer').attr('disabled','disabled');
$("#new_customer").attr('class', 'simple_form edit_customer'); $("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+customer_id; var id = "edit_customer_"+customer_id;
$("#new_customer").attr('id', id); $("#new_customer").attr('id', id);
$(".edit_customer").attr('id', id); $(".edit_customer").attr('id', id);
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".patch_method").html('<input type="hidden" name="_method" value="patch">'); $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
//$(".edit_customer").attr('method', 'PATCH'); //$(".edit_customer").attr('method', 'PATCH');
} }
}); });
// }else{
// }
}) })
function update_sale(customer_id,sale_id) { function update_sale(customer_id,sale_id) {

View File

@@ -1,9 +1,9 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item active">CRM</li> <li class="breadcrumb-item active">CRM</li>
<!-- <li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> --> <!-- <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li> -->
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', crm_customers_path %> <%= link_to 'Back', crm_customers_path %>
</span> </span>
@@ -15,7 +15,7 @@
<!-- Column One --> <!-- Column One -->
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs tab-nav-right" role="tablist"> <ul class="nav nav-tabs tab-nav-right" role="tablist">
<li role="presentation" class="active nav-item"> <li role="presentation" class="active nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" ><%= t :customer_details %></a> <a class="nav-link" data-toggle="tab" href="#customer" ><%= t :customer_details %></a>
</li> </li>
@@ -70,10 +70,10 @@
<%else%> <%else%>
<td>-</td> <td>-</td>
<%end%> <%end%>
</tr> </tr>
<tr><th colspan="9"></th></tr> <tr><th colspan="9"></th></tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -89,7 +89,7 @@
<!-- <th>Balance</th> --> <!-- <th>Balance</th> -->
<th><%= t("views.right_panel.detail.status") %></th> <th><%= t("views.right_panel.detail.status") %></th>
<th><%= t("views.right_panel.detail.from_account") %></th> <th><%= t("views.right_panel.detail.from_account") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
</tr> </tr>
</thead> </thead>
@@ -104,7 +104,7 @@
<td>(<%= transaction["withdraw"] %>)</td> <td>(<%= transaction["withdraw"] %>)</td>
<% end %> <% end %>
<td><%= transaction["status"] %></td> <td><%= transaction["status"] %></td>
<td><%= transaction["account_status"] %></td> <td><%= transaction["account_status"] %></td>
<td><%= transaction["receipt_no"] %></td> <td><%= transaction["receipt_no"] %></td>
</tr> </tr>
<% end %> <% end %>
@@ -136,7 +136,7 @@
<h5><%= t :order_details %></h5> <h5><%= t :order_details %></h5>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th><%= t("views.right_panel.detail.order_id") %></th> <th><%= t("views.right_panel.detail.order_id") %></th>
@@ -160,13 +160,13 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="tab-pane" id="sale" role="tabpanel" style="min-height:670px; max-height:670px; "> <div class="tab-pane" id="sale" role="tabpanel" style="min-height:670px; max-height:670px; ">
<h5><%= t :sale_details %></h5> <h5><%= t :sale_details %></h5>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th><%= t("views.right_panel.detail.sale_id") %></th> <th><%= t("views.right_panel.detail.sale_id") %></th>
@@ -205,19 +205,19 @@
<th colspan="4"><%= add_grand_total %></th> <th colspan="4"><%= add_grand_total %></th>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="tab-pane" id="credit" role="tabpanel" style="min-height:670px; max-height:670px; "> <div class="tab-pane" id="credit" role="tabpanel" style="min-height:670px; max-height:670px; ">
<h5><%= t :credit %> <%= t :details %></h5> <h5><%= t :credit %> <%= t :details %></h5>
<table class="table table-responsive tbl_credit_lists"> <table class="table table-responsive tbl_credit_lists">
<thead> <thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th> <th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th> <th> <%= t :cashier %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th> <th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead> </thead>
<tbody> <tbody>
@@ -240,4 +240,3 @@
</div> </div>
</div> </div>

View File

@@ -1,11 +1,11 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item"><a href="<%= crm_dining_queues_path %>">Queue</a></li> <li class="breadcrumb-item"><a href="<%= crm_dining_queues_path %>">Queue</a></li>
<li class="breadcrumb-item active">Assign Queue <%=@queue.queue_no%></li> <li class="breadcrumb-item active">Assign Queue <%=@queue.queue_no%></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', root_path %>
</span> </span>
</ul> </ul>
</div> </div>

View File

@@ -1,10 +1,10 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("en.queue") %></li> <li class="breadcrumb-item active"><%= t("en.queue") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', root_path %>
</span> </span>
</ul> </ul>
</div> </div>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= crm_dining_queues_path %>"><%= t("en.queue") %></a></li> <li class="breadcrumb-item"><a href="<%= crm_dining_queues_path %>"><%= t("en.queue") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t :inventory %></li> <li class="breadcrumb-item active"><%= t :inventory %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t :inventory %></li> <li class="breadcrumb-item active"><%= t :inventory %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), inventory_path %> <%= link_to t('.back', :default => t("views.btn.back")), inventory_path %>

View File

@@ -1,6 +1,6 @@
<!-- <div class="page-header"> <!-- <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= inventory_path %>"><%= t :inventory %></a></li> <li class="breadcrumb-item"><a href="<%= inventory_path %>"><%= t :inventory %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.stock_check") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.stock_check") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), inventory_path %> <%= link_to t('.back', :default => t("views.btn.back")), inventory_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%=inventory_stock_checks_path%>"></a><%= t("views.right_panel.detail.stock_check") %></li> <li class="breadcrumb-item"><a href="<%=inventory_stock_checks_path%>"></a><%= t("views.right_panel.detail.stock_check") %></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -17,15 +17,9 @@
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> --> <!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
<%if current_login_employee.role !="waiter" %> <%if current_login_employee.role !="waiter" %>
<a href="javascript:void(0);" class="bars"></a> <a href="javascript:void(0);" class="bars"></a>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "account" %> <a class="navbar-brand mbl_view" href="<%= root_path %>" style="margin-left: 20px;">
<a class="navbar-brand mbl_view" href="<%=dashboard_path%>" style="margin-left: 20px;">
<% elsif current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<a class="navbar-brand mbl_view" href="<%=origami_dashboard_path%>" style="margin-left: 20px;">
<%else%>
<a class="navbar-brand mbl_view" href="" style="margin-left: 20px;">
<% end %>
<% else %> <% else %>
<a class="navbar-brand m-0 mbl_view" href="<%= origami_dashboard_path%>"> <a class="navbar-brand m-0 mbl_view" href="<%= root_path %>">
<%end%> <%end%>
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" /> <img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
<span class="navbar-brand-txt">SX Restaurant</span> <span class="navbar-brand-txt">SX Restaurant</span>

View File

@@ -1,7 +1,7 @@
<!-- <div class="page-header"> <!-- <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item active">OQS</li> <li class="breadcrumb-item active">OQS</li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', oqs_root_path %> <%= link_to 'Back', oqs_root_path %>

View File

@@ -1,6 +1,6 @@
<!-- Column One --> <!-- Column One -->
<div class="row clearfix m-top-100" style=""> <div class="row clearfix m-top-100" style="">
<div class="col-lg-7 col-md-7 col-sm-7"> <div class="col-lg-7 col-md-7 col-sm-7">
<p class="hidden filter"><%= @filter %></p> <p class="hidden filter"><%= @filter %></p>
<div class="card"> <div class="card">
<div class="card-block"> <div class="card-block">
@@ -20,7 +20,7 @@
<p class="hidden oqs-id"><%= qsi.id %></p> <p class="hidden oqs-id"><%= qsi.id %></p>
<option value="<%= qsi.id %>" data-id="<%= qsi.id %>" <%=selected%> style="padding:5px 20px !important;"> <%= qsi.station_name %></option> <option value="<%= qsi.id %>" data-id="<%= qsi.id %>" <%=selected%> style="padding:5px 20px !important;"> <%= qsi.station_name %></option>
<% end %> <% end %>
<% end %> <% end %>
</select> </select>
</div> </div>
@@ -38,8 +38,8 @@
<div class="tab-content" id="custom-slimscroll" style=""> <div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel"> <div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<% <%
@queue_completed_item.each do |qid| @queue_completed_item.each do |qid|
%> %>
<div class="card queue_station" data-order-no="<%= qid.order_id %>"> <div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block"> <div class="card-block">
@@ -52,38 +52,38 @@
<span class="order-zone hidden font-13"><%= qid.zone %></span> <span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span> <span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div> </div>
<p class="m-b--10"> <p class="m-b--10">
<span class="order-item font-16"> <span class="order-item font-16">
<%= qid.item_name %> <%= qid.item_name %>
</span> [x </span> [x
<span class="order-qty"> <span class="order-qty">
<%= qid.qty %> <%= qid.qty %>
</span> ] </span> ]
<% if !qid.set_menu_items.nil? %> <% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%> <% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12"> <br><span class="font-12">
<%= item_instance %> <%= item_instance %>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</p> </p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p> <br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text"> <span class="card-text">
<span class="text-muted">Order at - <span class="text-muted">Order at -
<span class="order-at font-13"> <span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> <%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br> </span> <br>
Order By - <span class="order-by font-13"> Order By - <span class="order-by font-13">
<%= qid.item_order_by %> <%= qid.item_order_by %>
</span> </span>
</span> </span>
</span> </span>
<p class="hidden order-status">completed</p> <p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p> <p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p> <p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div> </div>
<% if !qid.delivery_status %> <% if !qid.delivery_status %>
<div class="card-footer"> <div class="card-footer">
@@ -91,11 +91,11 @@
<button id="assigned_queue_<%= qid.assigned_order_item_id %>" class="btn btn-primary order-item order-complete">COMPLETE</button> <button id="assigned_queue_<%= qid.assigned_order_item_id %>" class="btn btn-primary order-item order-complete">COMPLETE</button>
</div> </div>
<%end%> <%end%>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div> </div>
</div> </div>
</div> </div>
@@ -127,7 +127,7 @@
<td id="order-customer" colspan="2"></td> <td id="order-customer" colspan="2"></td>
</tr> --> </tr> -->
<!-- </tbody> <!-- </tbody>
</table> </table>
</div> </div>
<div class="card-text" id="order-detail-slimscroll" style="min-height:; max-height:; overflow:"> <div class="card-text" id="order-detail-slimscroll" style="min-height:; max-height:; overflow:">
<table class="table" id="oqs-order-details-table"> <table class="table" id="oqs-order-details-table">
@@ -137,7 +137,7 @@
<th style="width:20%; text-align:right">QTY</th> <th style="width:20%; text-align:right">QTY</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -163,7 +163,7 @@
<div class="col-lg-4 col-md-4 col-sm-4 table-float"> <div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %> <br> <%= table.zone.name %></button> <button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %> <br> <%= table.zone.name %></button>
</div> </div>
<% end %> <% end %>
</div> </div>
<%if !@rooms.empty? %> <%if !@rooms.empty? %>
<div id="room" class="tab-pane fade"> <div id="room" class="tab-pane fade">
@@ -171,21 +171,21 @@
<div class="col-lg-4 col-md-4 col-sm-4 table-float"> <div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %> <br> <%= room.zone.name %></button> <button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %> <br> <%= room.zone.name %></button>
</div> </div>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons --> <!-- OQS Buttons -->
<!-- <br> --> <!-- <br> -->
<% if current_user.role != "kitchen" %> <% if current_user.role != "kitchen" %>
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a> <a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<%end%> <%end%>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a> <button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<!-- <button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> <!-- <button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
@@ -195,6 +195,8 @@
</div> </div>
<input type="hidden" id="server_mode" value="<%=ENV["SERVER_MODE"]%>"> <input type="hidden" id="server_mode" value="<%=ENV["SERVER_MODE"]%>">
<%= print_settings %>
<script type="text/javascript"> <script type="text/javascript">
$(document).on('turbolinks:load', function() { $(document).on('turbolinks:load', function() {
$('#back').on('click', function () { $('#back').on('click', function () {
@@ -202,12 +204,10 @@
}); });
}); });
document.getElementById("defaultOpen").click(); document.getElementById("defaultOpen").click();
</script> </script>
<style type="text/css"> <style type="text/css">
.oqs-btn { .oqs-btn {
padding: .46875rem 0.25rem;color: #fff !important;position: relative;margin-bottom: .3125rem;font-size: .875rem;text-decoration: none;text-transform: uppercase;letter-spacing: 0;cursor: pointer;border: 0; padding: .46875rem 0.25rem;color: #fff !important;position: relative;margin-bottom: .3125rem;font-size: .875rem;text-decoration: none;text-transform: uppercase;letter-spacing: 0;cursor: pointer;border: 0;
} }
</style> </style>

View File

@@ -1,15 +1,17 @@
<!-- <div class="container-fluid"> <!-- <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item active">CRM</li> --> <li class="breadcrumb-item active">CRM</li> -->
<!-- <li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> --> <!-- <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li> -->
<!-- <span class="float-right"> <!-- <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>
</span> </span>
</ul> </ul>
</div> --> </div> -->
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<div class="row"> <div class="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
@@ -80,7 +82,7 @@
<td> <td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td> <input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td> <td>
<% if crm_customer.customer_id != "" && crm_customer.customer_id != "" %> <% if crm_customer.customer_id != "" && crm_customer.customer_id != "" %>
<%= @i += 1 %> <%= @i += 1 %>
<%else%> <%else%>
- -
@@ -352,12 +354,12 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div id="sxModal"> <div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div> <div id="sxModal-Content"><h3>Card Tap</h3></div>
<div class="m-r-20" align="right"> <div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button> <button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div> </div>
</div> </div>
</div> </div>
@@ -366,6 +368,8 @@
var page = "<%= @page %>"; var page = "<%= @page %>";
var paypar_account_no = []; var paypar_account_no = [];
$(function() { $(function() {
setHeaderBreadCrumb(_CUSTOMERS_);
paypar_account_no = JSON.parse('<%= @paypar_accountno.to_json.html_safe %>', function (key, value) { paypar_account_no = JSON.parse('<%= @paypar_accountno.to_json.html_safe %>', function (key, value) {
var type; var type;
if (value && typeof value === 'object') { if (value && typeof value === 'object') {
@@ -376,7 +380,7 @@
} }
return value; return value;
}); });
console.log(paypar_account_no);
/* check webview loaded*/ /* check webview loaded*/
var webview = <%= @webview %>; var webview = <%= @webview %>;
showHideNavbar(webview); showHideNavbar(webview);
@@ -394,57 +398,15 @@
$("#paypar_account_no").on('focus', function(e){ $("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){ if($(this).val() == ''){
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
},100);
} }
}); });
$(document).ready(function () {
setHeaderBreadCrumb(_CUSTOMERS_);
});
// Read Card Reader // Read Card Reader
$("#member_acc_no").on('click', function(e){ $("#member_acc_no").on('click', function(e){
localStorage.setItem("member_card",true); localStorage.setItem("member_card",true);
var cardNo = "";
var customer_id = '';
var customer_name = '';
var sale_id = $("#sale_id").val() || 0;
var customer_mamber_card_no = 0;
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
// $.alert({
// title: 'Alert!',
// content: data[0].message,
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
}
});
}
},100);
}); });
/*new customer UI func:*/ /*new customer UI func:*/
@@ -453,7 +415,6 @@
//Wizard //Wizard
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) { $('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
var $target = $(e.target); var $target = $(e.target);
if ($target.parent().hasClass('disabled')) { if ($target.parent().hasClass('disabled')) {
@@ -467,6 +428,7 @@
nextTab($active); nextTab($active);
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0}); $('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
}); });
$(".prev-step").click(function (e) { $(".prev-step").click(function (e) {
var $active = $('.wizard .nav-tabs li a.active'); var $active = $('.wizard .nav-tabs li a.active');
@@ -478,17 +440,19 @@
/*customer UI tab btn*/ /*customer UI tab btn*/
function nextTab(elem) { function nextTab(elem) {
$(elem).parent().next().find('a[data-toggle="tab"]').click(); $(elem).parent().next().find('a[data-toggle="tab"]').click();
} }
function prevTab(elem) { function prevTab(elem) {
$(elem).parent().prev().find('a[data-toggle="tab"]').click(); $(elem).parent().prev().find('a[data-toggle="tab"]').click();
} }
/*customer UI tab btn*/ /*customer UI tab btn*/
// Read NFC card no from java // Read NFC card no from java
function getCardNo(){ function getCardNo(){
code2lab.readNFC(); if (typeof code2lab != 'undefined') {
code2lab.readNFC();
}
} }
// get CardNo from Java // get CardNo from Java
@@ -499,6 +463,7 @@
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
$("#search").val(cardNo); $("#search").val(cardNo);
$("#type").val("card"); $("#type").val("card");
get_customer();
}else{ }else{
if($.inArray(cardNo, paypar_account_no) !== -1){ if($.inArray(cardNo, paypar_account_no) !== -1){
swal({ swal({
@@ -519,47 +484,76 @@
} }
} }
} }
$("#sxModal").hide();
}
function get_customer() {
var cardNo = "";
var customer_id = '';
var customer_name = '';
var sale_id = $("#sale_id").val() || 0;
var customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$('#loading_wrapper').show();
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
$('#loading_wrapper').hide();
}
});
}
} }
// QR Code Reader // QR Code Reader
$("#qr_code").on('click', function(e){ $("#qr_code").on('click', function(e){
var code = ""; var code = "";
var customer_id = ''; var customer_id = '';
var customer_name = ''; var customer_name = '';
var sale_id = $("#sale_id").val() || 0; var sale_id = $("#sale_id").val() || 0;
var customer_mamber_card_no = 0; var customer_mamber_card_no = 0;
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
setQRCode(code); setQRCode(code);
}, 100); }, 100);
customer_mamber_card_no = $("#search").val(); customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){ if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/get_customer" , url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"}, data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
if (data[0].customer_id == false) { if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error"); swal("Alert!", data[0].message, "error");
// $.alert({ // $.alert({
// title: 'Alert!', // title: 'Alert!',
// content: data[0].message, // content: data[0].message,
// type: 'red', // type: 'red',
// typeAnimated: true, // typeAnimated: true,
// btnClass: 'btn-danger', // btnClass: 'btn-danger',
// }); // });
}else{ }else{
customer_id = data[0].customer_id; customer_id = data[0].customer_id;
customer_name = data[0].name; customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id); update_sale(customer_id, customer_name,sale_id);
}
} }
}); }
} });
}
}); });
// Read qrcode from java // Read qrcode from java
@@ -574,81 +568,75 @@
} }
$(document).on('click',".customer_tr",function(){ $(document).on('click',".customer_tr",function(){
// if(this.checked){ $(this).closest('tr').find('.checkbox_check').prop( "checked", true );
$(this).closest('tr').find('.checkbox_check').prop( "checked", true ); var sale_id = $("#sale_id").val() || 0;
var sale_id = $("#sale_id").val() || 0; var customer_id = $(this).attr('data-ref');
var customer_id = $(this).attr('data-ref'); var customer_name = $(this).children("td:nth-child(3)").text();
var customer_name = $(this).children("td:nth-child(3)").text();
console.log(sale_id);
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id, customer_name,sale_id);
}else{
var url = "customers/"+customer_id; if(sale_id != 0){
} update_sale(customer_id, customer_name,sale_id);
}else{
var url = "customers/"+customer_id;
}
// Need To Clean? // Need To Clean?
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
var taxes = JSON.stringify(data.tax_profiles); var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes); var parse_taxes = JSON.parse(taxes);
$.each(parse_taxes, function(i, value){ $.each(parse_taxes, function(i, value){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected"); $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
}); });
$('#customer_id').val(data.id); $('#customer_id').val(data.id);
$('#customer_name').val(data.name); $('#customer_name').val(data.name);
$('#customer_company').val(data.company); $('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no); $('#customer_contact_no').val(data.contact_no);
$('#customer_email').val(data.email); $('#customer_email').val(data.email);
$('#customer_date_of_birth').val(data.date_of_birth); $('#customer_date_of_birth').val(data.date_of_birth);
$('#customer_membership_type').val(data.membership_type); $('#customer_membership_type').val(data.membership_type);
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected'); $('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code); $('.membership_authentication_code').val(data.membership_authentication_code);
$('#customer_card_no').val(data.card_no); $('#customer_card_no').val(data.card_no);
$('#customer_type').val(data.customer_type); $('#customer_type').val(data.customer_type);
$('#customer_salutation').val(data.salutation); $('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no); $('#customer_nrc_no').val(data.nrc_no);
$('#paypar_account_no').val(data.paypar_account_no); $('#paypar_account_no').val(data.paypar_account_no);
if (data.gender == 'Male') { if (data.gender == 'Male') {
$('.male').prop( "checked", true ) $('.male').prop( "checked", true )
}else{ }else{
$('.female').prop( "checked", true ) $('.female').prop( "checked", true )
} }
if (data.salutation == 'Mr') { if (data.salutation == 'Mr') {
$('.mr').prop( "checked", true ) $('.mr').prop( "checked", true )
} else if(data.salutation == 'Miss') { } else if(data.salutation == 'Miss') {
$('.miss').prop( "checked", true ) $('.miss').prop( "checked", true )
}else if(data.salutation == 'Mrs'){ }else if(data.salutation == 'Mrs'){
$('.mrs').prop( "checked", true ) $('.mrs').prop( "checked", true )
}else{ }else{
$('.mdm').prop( "checked", true ) $('.mdm').prop( "checked", true )
} }
$('#update_customer').removeAttr('disabled').val(''); $('#update_customer').removeAttr('disabled').val('');
$('#update_customer').attr('value', 'Update'); $('#update_customer').attr('value', 'Update');
// $('#submit_customer').attr('disabled','disabled'); // $('#submit_customer').attr('disabled','disabled');
$("#new_customer").attr('class', 'simple_form edit_customer'); $("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+$('#customer_id').val(); var id = "edit_customer_"+$('#customer_id').val();
$("#new_customer").attr('id', id); $("#new_customer").attr('id', id);
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".patch_method").append('<input type="hidden" name="_method" value="patch">'); $(".patch_method").append('<input type="hidden" name="_method" value="patch">');
//$(".edit_customer").attr('method', 'PATCH'); //$(".edit_customer").attr('method', 'PATCH');
} }
}); });
// }else{ })
// }
})
function update_sale(customer_id, customer_name, sale_id) { function update_sale(customer_id, customer_name, sale_id) {
var customer=""; var customer="";
@@ -658,13 +646,14 @@
swal({ swal({
title: "Confirmation !", title: "Confirmation !",
text: 'Are You Sure to assign this customer' + customer + '!', text: 'Are you sure to assign this customer' + customer + '!',
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "green", confirmButtonColor: "green",
confirmButtonText: "Yes!", confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger', cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false, closeOnConfirm: true,
}, function () { }, function () {
$( "#loading_wrapper").show();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" , url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,

View File

@@ -106,19 +106,14 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button> <button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div> </div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
</div> </div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div> <div id="sxModal">
<div class="m-r-20" align="right"> <div id="sxModal-Content"><h3>Card Tap</h3></div>
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button> <div class="m-r-20" align="right">
</div> <button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div> </div>
</div>
</div> </div>
<!-- customer light box --> <!-- customer light box -->
@@ -145,10 +140,10 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
setHeaderBreadCrumb(_DINGA_); setHeaderBreadCrumb(_DINGA_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
@@ -251,76 +246,10 @@
}); });
// Read Card Reader // Read Card Reader
$(".btn_member").on('click', function(){ $(".btn_member").on('click', function(){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").text() || 0;
var customer_mamber_card_no = 0;
$("#is_paymemberModal").hide(); $("#is_paymemberModal").hide();
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
console.log(data)
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no :customer_mamber_card_no},
success: function(result){
console.log(result)
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Opps",result.message ,"warning" );
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
});
}
}
});
}
},100);
}); });
// Read NFC card no from java // Read NFC card no from java
@@ -332,21 +261,85 @@
function setCardNo(cardNo){ function setCardNo(cardNo){
if(cardNo.length == 16){ if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
send_account();
} }
$("#sxModal").hide();
}
function send_account() {
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").text() || 0;
var customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
console.log(data)
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no :customer_mamber_card_no},
success: function(result){
console.log(result)
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Opps",result.message ,"warning" );
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
});
}
}
});
}
} }
// QR Code Reader // QR Code Reader
$(".btn_qr_code").on('click', function(e){ $(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide(); $("#is_memberModal").hide();
var code = ""; var code = "";
var customer_id = ''; var customer_id = '';
var customer_name = ''; var customer_name = '';
var membership_id = ''; var membership_id = '';
var membership_type = ''; var membership_type = '';
var receipt_no = $("#receipt_no").text() || 0; var receipt_no = $("#receipt_no").text() || 0;
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
if(sale_id != 0 && code != ""){ if(sale_id != 0 && code != ""){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/send_account" , url: "/origami/"+sale_id+"/send_account" ,
@@ -394,15 +387,15 @@
}); });
} }
} }
}); });
} }
},100); },100);
}); });
// Read qrcode from java // Read qrcode from java
function getQRCode(){ function getQRCode(){
return code2lab.readQRCode(); return code2lab.readQRCode();
$("#qr_code").val(code); $("#qr_code").val(code);
} }
function update_sale(membership_id, customer_id, customer_name, sale_id) { function update_sale(membership_id, customer_id, customer_name, sale_id) {
@@ -437,7 +430,7 @@
location.reload(); location.reload();
} }
} }
}); });
}); });
} }

View File

@@ -239,7 +239,7 @@
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Receipt No: <span id="receipt_no"> &nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %> <%= @obj_sale.receipt_no rescue '' %>
<% end %> <% end %>
</span> </span>
<br> <br>
@@ -266,8 +266,8 @@
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p> <p class="hidden customer-id"><%= @obj_sale.customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %> &nbsp; Customer : <%= @obj_sale.customer.name rescue '' %>
<% elsif @status_order == 'order' <% elsif @status_order == 'order'
%> %>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p> <p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
@@ -291,9 +291,9 @@
<% count = 0 <% count = 0
sub_total = 0 sub_total = 0
if @status_sale == "sale" if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item| @obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price%> sub_total = sub_total + sale_item.price%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>"> <input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<%count += 1 %> <%count += 1 %>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
@@ -455,7 +455,7 @@
<% end %> <% end %>
<% @sale_array.each do |sale| <% @sale_array.each do |sale|
if @sale_array.size > 1 if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no unless sale.receipt_no == @obj_sale.receipt_no
%> %>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
@@ -529,7 +529,7 @@
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button> <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %> <% if @split_bill == '1' && (@orde_items.present?) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %> <% end %>
<% end %> <% end %>
@@ -597,6 +597,8 @@
</div> </div>
</div> </div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -972,13 +974,15 @@
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,""); createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
} }
}); });
} }
@@ -1003,80 +1007,82 @@
$(".choose_payment").on('click', function () { $(".choose_payment").on('click', function () {
$( "#loading_wrapper").show(); $( "#loading_wrapper").show();
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
// type = $('.payment_method').val(); // type = $('.payment_method').val();
type = get_selected_attributes('selected-payment'); type = get_selected_attributes('selected-payment');
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all'; var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if(parseInt(jQuery.inArray("Credit", type)) == -1){ if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) { if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
if(!location.pathname.includes("credit_payment")){ if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Card",tax_type); calculate_member_discount(sale_id,"Card",tax_type);
} }
}else{ }else{
if(!location.pathname.includes("credit_payment")){ if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type); calculate_member_discount(sale_id,"Cash",tax_type);
}
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
} }
} }
var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; location.reload();
$.ajax({ }
type: "GET", });
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
});
}); });
function calculate_member_discount(sale_id,type,tax_type) { function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
if (type == "Cash") { if (type == "Cash") {
is_card = false is_card = false
}else{ } else {
is_card = true is_card = true
} }
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/" + sale_id + "/member_discount", url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type }, data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false, async: false,
success:function(result){ success:function(result){
} }
}); });
} }
$('#pay').on('click', function () { $('#pay').on('click', function () {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
var data_order = $(this).data("order"); var data_order = $(this).data("order");
if (data_order) { if (data_order) {
swal({ swal({
title: "Alert! This Receipt has another item", title: "Alert! This Receipt has another item",
text: "Are you sure want to pay this receipt !", text: "Are you sure want to pay this receipt !",
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#DD6B55", confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, Pay it !", confirmButtonText: "Yes, Pay it !",
closeOnConfirm: false closeOnConfirm: false
}, function (isConfirm) { }, function (isConfirm) {
if (isConfirm) { if (isConfirm) {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment"; window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
} }
}); });
}else{ } else {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment"; window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
} }
}); });
// $('#kbz_query').on('click', function(){ // $('#kbz_query').on('click', function(){
@@ -1105,33 +1111,33 @@
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count"); var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
localStorage.removeItem("current_checkin_induties_count"); localStorage.removeItem("current_checkin_induties_count");
if(order_id!=undefined && order_id!=null && order_id!=""){ if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bills').is(":visible")) { if ($('#request_bills').is(":visible")) {
$('#request_bills').prop("disabled",true); $('#request_bills').prop("disabled",true);
} }
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
data: {current_checkin_induties_count: current_checkin_induties_count}, data: {current_checkin_induties_count: current_checkin_induties_count},
success: function (result) { success: function (result) {
if (!result.status) { if (!result.status) {
swal({ swal({
title: 'Oops', title: 'Oops',
text: result.error_message, text: result.error_message,
type: 'error', type: 'error',
html: true, html: true,
closeOnConfirm: false, closeOnConfirm: false,
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function (isConfirm) { }, function (isConfirm) {
if(isConfirm){ if(isConfirm){
location.reload();
}
});
}
else {
location.reload(); location.reload();
} }
});
} }
else {
location.reload();
}
}
}); });
}else{ }else{
swal("Opps","There is no orders!","warning"); swal("Opps","There is no orders!","warning");
@@ -1167,24 +1173,24 @@
// var tax_type = localStorage.getItem("tax_type"); // var tax_type = localStorage.getItem("tax_type");
var tax_type = $("#check_tax").val(); var tax_type = $("#check_tax").val();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type, data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
success: function (result) { success: function (result) {
swal({ swal({
title: "Information!", title: "Information!",
text: "Invoice updated", text: "Invoice updated",
html: true, html: true,
closeOnConfirm: false, closeOnConfirm: false,
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
$("#first_bill").removeAttr('disabled'); $("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled'); $("#pay").removeAttr('disabled');
window.location.reload(); window.location.reload();
}); });
$("#loading_wrapper").hide(); $("#loading_wrapper").hide();
} }
}); });
}) })
@@ -1259,7 +1265,7 @@
closeOnConfirm: false closeOnConfirm: false
}, function (isConfirm) { }, function (isConfirm) {
if (isConfirm) { if (isConfirm) {
$('.confirm').prop("disabled",true); $('.confirm').prop("disabled", true);
var sale_id = $("#sale_id").val();//"<%= @obj_sale.sale_id rescue "" %>" var sale_id = $("#sale_id").val();//"<%= @obj_sale.sale_id rescue "" %>"
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var remark = $("#remark").val(); var remark = $("#remark").val();
@@ -1269,13 +1275,15 @@
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
} }
} window.location.href = '/origami/';
window.location.href = '/origami/';
} }
}); });
} }
@@ -1378,13 +1386,15 @@
data: "remark="+ remark + "&sale_id=" + sale_id, data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) { success: function (result) {
console.log(result) console.log(result)
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
} }
} window.location.href = '/origami/';
window.location.href = '/origami/';
} }
}); });
} }

View File

@@ -1,17 +1,17 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid m-top-100"> <div class="container-fluid m-top-100">
<!-- start count function --> <!-- start count function -->
<% <%
pending_count = 0 pending_count = 0
accepted_count = 0 accepted_count = 0
delivered_count = 0 delivered_count = 0
completed_count = 0 completed_count = 0
processed_count = 0 processed_count = 0
%> %>
<% if !@count_on_order.nil? <% if !@count_on_order.nil?
@count_on_order.each do |count_order| @count_on_order.each do |count_order|
if count_order.status == "new" if count_order.status == "new"
pending_count = count_order.count pending_count = count_order.count
elsif count_order.status == "accepted" elsif count_order.status == "accepted"
accepted_count = count_order.count accepted_count = count_order.count
@@ -19,16 +19,16 @@
delivered_count = count_order.count delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery" elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count completed_count = count_order.count
end end
end end
end end
if !@count_on_completed.nil? if !@count_on_completed.nil?
processed_count = @count_on_completed.count processed_count = @count_on_completed.count
end end
%> %>
<!-- end count function --> <!-- end count function -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<% if request.user_agent.include? "Mobile" %> <% if request.user_agent.include? "Mobile" %>
<div class="row m-t-10" style="margin-left: 0.2rem"> <div class="row m-t-10" style="margin-left: 0.2rem">
<% else %> <% else %>
@@ -125,7 +125,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<!--- Panel 3 - Orders --> <!--- Panel 3 - Orders -->
@@ -179,7 +179,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<!--- Panel 3 - Orders --> <!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="delivery" role="tabpanel"> <div class="tab-pane dining" id="delivery" role="tabpanel">
@@ -232,7 +232,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<!--- Panel 3 - Orders --> <!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="completed" role="tabpanel"> <div class="tab-pane dining" id="completed" role="tabpanel">
@@ -285,7 +285,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<!--- Panel 5 - processed --> <!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel"> <div class="tab-pane dining" id="processed" role="tabpanel">
@@ -338,7 +338,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -350,7 +350,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<td width ="10%" class="header-td align-left"> <td width ="10%" class="header-td align-left">
<b class="col-pink font-16"><span id="sr_number"></span></b> <b class="col-pink font-16"><span id="sr_number"></span></b>
</td> </td>
<td width="40%" class="header-td align-left"> <td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b> <b><span class="font-15" id="requested_date_time"></span></b>
@@ -378,7 +378,7 @@
<br><span class="font-13">2 <span class="col-blue">X700</span></span> <br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td> </td>
<td width ="30%" class="body-td align-right">1400.00</td> <td width ="30%" class="body-td align-right">1400.00</td>
</tr> --> </tr> -->
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -388,7 +388,7 @@
<tbody> <tbody>
<tr> <tr>
<td width ="70%" class="footer-td align-left" > <td width ="70%" class="footer-td align-left" >
SUB TOTAL SUB TOTAL
</td> </td>
<td width ="30%" class="footer-td align-right" id="sub_total">0.00</td> <td width ="30%" class="footer-td align-right" id="sub_total">0.00</td>
</tr> </tr>
@@ -419,19 +419,19 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<% if request.user_agent.include? "Mobile" %> <% if request.user_agent.include? "Mobile" %>
<div class="col-lg-3 col-md-3 col-sm-3" style="margin-right: 0.5rem"> <div class="col-lg-3 col-md-3 col-sm-3" style="margin-right: 0.5rem">
<% else %> <% else %>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<% end %> <% end %>
<div class="card m-b-5 p-t-5" style="background-color: #E8EAF6"> <div class="card m-b-5 p-t-5" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6"> <div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table"> <table class="table">
<tr> <tr>
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION <td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td> </td>
</tr> </tr>
</table> </table>
@@ -541,7 +541,7 @@
</button> </button>
</td> </td>
</tr> </tr>
<% if current_user.role != "waiter" %> <% if current_user.role != "waiter" %>
<tr class="order_close_cashier" style="display:none"> <tr class="order_close_cashier" style="display:none">
<td colspan="2" width="100%" class="footer-td align-right col-blue"> <td colspan="2" width="100%" class="footer-td align-right col-blue">
@@ -559,12 +559,16 @@
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div> <div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div> <div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
</div> </div>
<p id="ref_no" class="hidden"></p> <p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p> <p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p> <p id="order_id" class="hidden"></p>
<p id="status" class="hidden"></p> <p id="status" class="hidden"></p>
<%= print_settings %>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="modal fade" id="waiting_timeModal" tabindex="-1" role="dialog"> <div class="modal fade" id="waiting_timeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -656,7 +660,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4> <h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div> </div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important"> <div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 "> <input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div> <div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -675,12 +679,12 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div> <div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div> <div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div> <div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- pdf light box --> <!-- pdf light box -->
<div class="modal fade" id="receiptpdfModal" tabindex="-1" role="dialog" > <div class="modal fade" id="receiptpdfModal" tabindex="-1" role="dialog" >
@@ -696,13 +700,13 @@
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no"> <input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename"> <input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name"> <input type="hidden" name="printer_name" id="printer_name">
<div class="text-center"> <div class="text-center">
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe> <iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt_pdf" id="print_receipt_pdf"> Print <button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt_pdf" id="print_receipt_pdf"> Print
</button> </button>
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal"> <button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
CLOSE CLOSE
</button> </button>

View File

@@ -110,11 +110,11 @@
</div> </div>
<div id="sxModal"> <div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div> <div id="sxModal-Content"><h3>Card Tap</h3></div>
<div class="m-r-20" align="right"> <div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button> <button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div> </div>
</div> </div>
</div> </div>
<!-- customer light box --> <!-- customer light box -->
@@ -141,10 +141,10 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
setHeaderBreadCrumb(_PAYMAL_); setHeaderBreadCrumb(_PAYMAL_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
@@ -247,76 +247,10 @@
}); });
// Read Card Reader // Read Card Reader
$(".btn_member").on('click', function(){ $(".btn_member").on('click', function(){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || "";
var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#used_amount").text());
$("#is_paymemberModal").hide(); $("#is_paymemberModal").hide();
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Opps",result.message ,"warning" );
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
});
}
}
});
}else{
swal("Opp","Please Check Member","warning")
}
},100);
}); });
// Read NFC card no from java // Read NFC card no from java
@@ -329,18 +263,83 @@
if(cardNo.length == 16){ if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
} }
$("#sxModal").hide();
}
function send_account() {
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || "";
var payment_amount = parseFloat($("#used_amount").text());
var customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Opps",result.message ,"warning" );
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
});
}
}
});
}else{
swal("Opp","Please Check Member","warning")
}
} }
// QR Code Reader // QR Code Reader
$(".btn_qr_code").on('click', function(e){ $(".btn_qr_code").on('click', function(e){
$("#is_paymemberModal").hide(); $("#is_paymemberModal").hide();
var code = ""; var code = "";
var sale_id = $("#sale_id").text() || 0; var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || ""; var receipt_no = $("#receipt_no").val() || "";
var payment_amount = parseFloat($("#used_amount").text()); var payment_amount = parseFloat($("#used_amount").text());
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
if(sale_id != 0 && code != ""){ if(sale_id != 0 && code != ""){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/send_account" , url: "/origami/"+sale_id+"/send_account" ,
@@ -387,15 +386,15 @@
}); });
} }
} }
}); });
} }
},100); },100);
}); });
// Read qrcode from java // Read qrcode from java
function getQRCode(){ function getQRCode(){
return code2lab.readQRCode(); return code2lab.readQRCode();
$("#qr_code").val(code); $("#qr_code").val(code);
} }
$("#sxModal .btn_cancel").on('click',function(){ $("#sxModal .btn_cancel").on('click',function(){

View File

@@ -315,6 +315,9 @@
</div> </div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
</div> </div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -723,6 +726,7 @@ $(document).ready(function(){
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz, data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
success:function(result){ success:function(result){
/* start delete receipt no in first bill*/ /* start delete receipt no in first bill*/
console.log(result);
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim(); var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no); deleteReceiptNoInFirstBillData(receipt_no);
@@ -737,33 +741,29 @@ $(document).ready(function(){
var msg = ''; var msg = '';
} }
$("#loading_wrapper" ).hide(); $("#changed_amount").text("");
if(location.pathname.includes("credit_payment")){ if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if(location.pathname.includes("credit_payment") || pdf_view != 1){
payment_success_alert(); payment_success_alert();
}else{ } else {
//PDF lightbox data //PDF lightbox data;
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6); var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6)
$("#sale_receipt_no").val(result.receipt_no); $("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename); $("#filename").val(result.filename);
$("#printer_name").val(result.printer_name); $("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath); $("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text(""); $("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
if($('#balance').text() < 0){ $("#pdfModalLabel").text("Sale Completed");
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
} }
$("#loading_wrapper").hide();
} }
}); });
} }
@@ -1007,6 +1007,7 @@ $(document).ready(function(){
if($('#pay').is(":visible")) { if($('#pay').is(":visible")) {
$('#pay').prop("disabled",true); $('#pay').prop("disabled",true);
} }
$("#loading_wrapper" ).show();
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
var filename = $("#filename").val(); var filename = $("#filename").val();
@@ -1018,31 +1019,35 @@ $(document).ready(function(){
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print", url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
data: params, data: params,
success:function(result){ success:function(result){
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){ if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
} }
}
if (pdf_view ==1) { if (pdf_view ==1) {
var flag = localStorage.getItem("trans_flag"); var flag = localStorage.getItem("trans_flag");
localStorage.removeItem("trans_flag"); localStorage.removeItem("trans_flag");
if((flag!=null) && (flag != "true")){ if((flag!=null) && (flag != "true")){
window.location.href = "/transactions/sales/"+sale_id; window.location.href = "/transactions/sales/"+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{ }else{
if (cashier_type=="cashier") { window.location.href = '/origami/'+cashier_type;
window.location.href = '/origami'; if (cashier_type=="quick_service"){
}else{ customer_display_view(null,"reload");
window.location.href = '/origami/'+cashier_type;
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
} }
} }
}else{
payment_success_alert();
} }
}else{
payment_success_alert();
}
$("#loading_wrapper" ).hide();
} }
}); });
} }
@@ -1104,42 +1109,9 @@ $(document).ready(function(){
// Read Card Reader // Read Card Reader
$(".btn_member").on('click', function(){ $(".btn_member").on('click', function(){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var customer_mamber_card_no = 0;
$("#is_memberModal").hide(); $("#is_memberModal").hide();
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
membership_id = data[0].membership_id;
membership_type = data[0].membership_type;
update_sale(membership_id, customer_id, customer_name,sale_id);
}
}
});
}
},100);
}); });
// Read NFC card no from java // Read NFC card no from java
@@ -1153,6 +1125,132 @@ $(document).ready(function(){
function setCardNo(cardNo){ function setCardNo(cardNo){
if(cardNo.length == 16){ if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo); $("#paypar_account_no").val(cardNo);
if (cashier_type == "food_court") {
send_account();
} else {
get_customer();
}
}
$("#sxModal").hide();
}
function get_customer() {
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$('#loading_wrapper').show();
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
membership_id = data[0].membership_id;
membership_type = data[0].membership_type;
update_sale(membership_id, customer_id, customer_name,sale_id);
}
$('#loading_wrapper').hide();
}
});
}
}
function send_account() {
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var payment_amount = parseFloat($("#grand_total").text());
var customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
} }
} }
@@ -1211,6 +1309,7 @@ $(document).ready(function(){
cancelButtonClass: 'btn btn-danger', cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false, closeOnConfirm: false,
}, function () { }, function () {
$('#loading_wrapper').show();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" , url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
@@ -1322,11 +1421,13 @@ $(document).ready(function(){
swal({ swal({
title: "Information!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
}, function () { }, function () {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
var flag = localStorage.getItem("trans_flag"); var flag = localStorage.getItem("trans_flag");
@@ -1339,7 +1440,7 @@ $(document).ready(function(){
window.location.href = '/origami/'+cashier_type; window.location.href = '/origami/'+cashier_type;
} }
} }
}); });
} }
} }
}); });
@@ -1369,24 +1470,26 @@ $(document).ready(function(){
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {result success: function (result) {result
customer_display_view(null,"reload"); customer_display_view(null,"reload");
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
} code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
var flag = localStorage.getItem("trans_flag"); }
if((flag!=null) && (flag != "true")){ }
window.location.href = '/transactions/sales/'+sale_id; var flag = localStorage.getItem("trans_flag");
}else{ if((flag!=null) && (flag != "true")){
if (cashier_type=="cashier") { window.location.href = '/transactions/sales/'+sale_id;
window.location.href = '/origami'; }else{
}else{ if (cashier_type=="cashier") {
window.location.href = '/origami/'+cashier_type; window.location.href = '/origami';
} }else{
} window.location.href = '/origami/'+cashier_type;
} }
}) }
}
})
} }
}); });
}); });
@@ -1412,10 +1515,12 @@ $(document).ready(function(){
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
// console.log(result) // console.log(result)
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
var flag = localStorage.getItem("trans_flag"); var flag = localStorage.getItem("trans_flag");
@@ -1500,104 +1605,15 @@ $(document).ready(function(){
$("#customer_name").on("click",function(){ $("#customer_name").on("click",function(){
//start customer modal popup //start customer modal popup
if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
} }
}); });
// Read Card Reader - Paymal payment for FoodCourt // Read Card Reader - Paymal payment for FoodCourt
$(".btn_paymal_member").on('click', function (){ $(".btn_paymal_member").on('click', function (){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#grand_total").text());
$("#is_paymemberModal").hide(); $("#is_paymemberModal").hide();
$("#sxModal").show(); $("#sxModal").show();
setTimeout(function(){ getCardNo();
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
},100);
}); });
// QR Code Reader // QR Code Reader

View File

@@ -17,7 +17,7 @@
<% end %> <% end %>
</ul> </ul>
<div id="custom-slimscroll"> <div id="custom-slimscroll">
<div class="tab-content m-t-15"> <div class="tab-content m-t-15">
<div class="tab-pane active" id="completed" role="tabpanel"> <div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @completed.each do |sale| %> <% @completed.each do |sale| %>
@@ -26,7 +26,7 @@
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span> <%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div> </div>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
@@ -74,7 +74,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th> <th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th> <th> <%= t :cashier %></th>
<th> <%= t :customer %></th> <th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th> <th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead> </thead>
<tbody class="tbd_credit_lists"></tbody> <tbody class="tbd_credit_lists"></tbody>
@@ -97,7 +97,7 @@
</div> </div>
<div class="card-block"> <div class="card-block">
<div class="card-title row p-l-5 p-r-5"> <div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %> <% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no"> &nbsp; Receipt No: <span id="receipt_no">
@@ -110,8 +110,8 @@
<%= @bookings.booking_orders[0].order_id rescue '' %></span> <%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div> </div>
<% end%> <% end%>
<% if @status == 'sale' %> <% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> <div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span> Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
@@ -168,7 +168,7 @@
</tr> </tr>
<% end%> <% end%>
<% end%> <% end%>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -211,7 +211,7 @@
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if current_user.role != "waiter" %> <% if current_user.role != "waiter" %>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %> <% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_user.role == "cashier" %> <% if current_user.role == "cashier" %>
@@ -219,7 +219,7 @@
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a> <a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% end %> <% end %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a> <a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
<% else %> <% else %>
<% if @sale.payment_status != 'foc' %> <% if @sale.payment_status != 'foc' %>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button> <button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
@@ -234,6 +234,8 @@
</div> </div>
</div> </div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -252,7 +254,7 @@
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -265,7 +267,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4> <h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div> </div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important"> <div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 "> <input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div> <div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -284,7 +286,7 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div> <div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div> <div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div> <div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div> </div>
</div> </div>
</div> </div>
@@ -326,9 +328,11 @@ $(document).ready(function(){
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success: function (result) { success: function (result) {
if ($("#server_mode").val() == "cloud") { if (!$('#print_settings').data('action-cable')) {
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
@@ -338,7 +342,7 @@ $(document).ready(function(){
$('#back').on('click', function () { $('#back').on('click', function () {
window.location.href = '/origami/'+cashier_type+'/pending_order'; window.location.href = '/origami/'+cashier_type+'/pending_order';
}); });
$('#close_cashier').on('click',function(e){ $('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/'+cashier_type+'/close'; var linkURL = '/origami/shift/'+cashier_type+'/close';
@@ -348,15 +352,15 @@ $(document).ready(function(){
function warnBeforeRedirect(linkURL,occupied_count) { function warnBeforeRedirect(linkURL,occupied_count) {
if (occupied_count>0) { if (occupied_count>0) {
text = "<h5><span style=\"color: #CC0000\"> We have "+occupied_count+" pending orders and sales</span> </h5>.<br>Are you sure you want to close cashier? "; text = "<h5><span style=\"color: #CC0000\"> We have "+occupied_count+" pending orders and sales</span> </h5>.<br>Are you sure you want to close cashier? ";
}else{ }else{
text = "Are you sure you want to close cashier?"; text = "Are you sure you want to close cashier?";
} }
swal({ swal({
title: "Alert!", title: "Alert!",
text: text, text: text,
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
html: true html: true
@@ -396,15 +400,17 @@ $(document).ready(function(){
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
code2lab.printFile(result.filepath.substr(6), result.printer_url); if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
window.location.href = '/origami/'+cashier_type; window.location.href = '/origami/'+cashier_type;
} }
}); });
} }
}); });
}else{ }else{
swal("Opps","You are not authorized for void","warning") swal("Opps","You are not authorized for void","warning")
} }
@@ -437,9 +443,11 @@ function check_emp_access_code(access_code,type) {
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success: function (result) { success: function (result) {
if ($("#server_mode").val() == "cloud") { if (!$('#print_settings').data('action-cable')) {
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();

View File

@@ -45,12 +45,12 @@
<div class="card-columns"> <div class="card-columns">
<% @tables.each do |table| %> <% @tables.each do |table| %>
<% if table.status == 'occupied' %> <% if table.status == 'occupied' %>
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <br> <%= table.name %> <br>
<%= table.zone.name %> <%= table.zone.name %>
@@ -62,12 +62,12 @@
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span> <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
</div> </div>
</div> </div>
<% else %> <% else %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <br> <%= table.name %> <br>
<%= table.zone.name %> <%= table.zone.name %>
@@ -200,7 +200,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th> <th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th> <th> <%= t :cashier %></th>
<th> <%= t :customer %></th> <th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th> <th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead> </thead>
<tbody class="tbd_credit_lists"></tbody> <tbody class="tbd_credit_lists"></tbody>
@@ -356,9 +356,9 @@
<% end %> <% end %>
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? <% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance| JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %> set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br><span class="font-13"> <br><span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %> <% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -368,8 +368,8 @@
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<% end <% end
sub_total += set_item_prices sub_total += set_item_prices
end %> end %>
</td> </td>
@@ -463,9 +463,9 @@
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]' <% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance| JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%> %>
<br><span class="font-13"> <br><span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %> <% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -475,8 +475,8 @@
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<% end <% end
sub_total += set_item_prices sub_total += set_item_prices
end %> end %>
</td> </td>
@@ -489,7 +489,7 @@
%> %>
</table> </table>
<button class='btn bg-primary btn-block' id='add_invoice'> Add to existing invoice </button>--> <button class='btn bg-primary btn-block' id='add_invoice'> Add to existing invoice </button>-->
<% end %> <% end %>
<% if @sale_array.size > 1 %> <% if @sale_array.size > 1 %>
<br><br> <br><br>
Pending Payment Pending Payment
@@ -522,7 +522,7 @@
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button> <button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button> <button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% if @room.status != "available" %> <% if @room.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> --> <!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
<!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> --> <!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> -->
@@ -551,7 +551,7 @@
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button> <button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% if current_login_employee.role == "cashier" %> <% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a> <a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a> <a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %> <% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button> <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
@@ -561,7 +561,7 @@
<% end %> <% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button> <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button> <button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
<% if !@split_bill.nil? %> <% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button> <button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
@@ -592,7 +592,7 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"> <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<button class='btn btn-md waves-effect btn-link payment-btn-box payment_btn bg-green' data-type='Credit' data-value='Credit'>Credit</button> <button class='btn btn-md waves-effect btn-link payment-btn-box payment_btn bg-green' data-type='Credit' data-value='Credit'>Credit</button>
</div> </div>
<% @payment_methods.each_with_index do |pay, pay_index| %> <% @payment_methods.each_with_index do |pay, pay_index| %>
<%if (pay_index+1)%3 == 0 %> <%if (pay_index+1)%3 == 0 %>
<div class="row clearfix"></div> <div class="row clearfix"></div>
@@ -602,7 +602,7 @@
</div> </div>
<%end %> <%end %>
</div> </div>
</div> </div>
<div class="modal-footer p-r-30 pb-3"> <div class="modal-footer p-r-30 pb-3">
<button type="button" class="btn btn-md btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-md btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
@@ -624,6 +624,8 @@
</div> </div>
</div> </div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -642,7 +644,7 @@
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -653,7 +655,7 @@
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4> <h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row p-r-20"> <div class="row p-r-20">
<div class="col-md-3"> <div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button> <button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
@@ -679,7 +681,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4> <h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div> </div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important"> <div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 "> <input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div> <div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -698,7 +700,7 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div> <div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div> <div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div> <div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div> </div>
</div> </div>
</div> </div>
@@ -730,7 +732,7 @@
count += 1 %> count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'> <tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'> <td class='item-name'>
<%= order_item.item_name %> <%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %> <% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
@@ -741,10 +743,10 @@
<% end %> <% end %>
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? <% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance| JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%> %>
<br><span class="font-13"> <br><span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %> <% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -754,8 +756,8 @@
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<% end <% end
sub_total += set_item_prices sub_total += set_item_prices
end %> end %>
</td> </td>
@@ -956,7 +958,7 @@ $(document).ready(function(){
} else { } else {
var sale_id = "<%= @room.id %>"; var sale_id = "<%= @room.id %>";
} }
//var table_id = $('.tables').attr("data-id"); //var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys" window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
}); });
// bind customer to order or sale // bind customer to order or sale
@@ -1025,8 +1027,8 @@ $(document).ready(function(){
}); });
// click select option icon for add // click select option icon for add
$(document).on('click', '.payment_btn', function(event){ $(document).on('click', '.payment_btn', function(event){
active = $(this).hasClass('selected-payment'); active = $(this).hasClass('selected-payment');
value = $(this).data('value'); value = $(this).data('value');
type = $(this).data('type'); type = $(this).data('type');
@@ -1041,7 +1043,7 @@ $(document).ready(function(){
}); //End selecct attribute buttom }); //End selecct attribute buttom
// Print for first bill // Print for first bill
$("#first_bill").on('click', function(){ $("#first_bill").on('click', function(){
swal({ swal({
title: "Alert", title: "Alert",
@@ -1067,10 +1069,12 @@ $("#first_bill").on('click', function(){
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,""); createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
@@ -1095,7 +1099,7 @@ $(".choose_payment").on('click', function () {
if(!location.pathname.includes("credit_payment")){ if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type); calculate_member_discount(sale_id,"Cash",tax_type);
} }
} }
} }
var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({ $.ajax({
@@ -1107,16 +1111,17 @@ $(".choose_payment").on('click', function () {
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type); createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
} }
}); });
}); });
function calculate_member_discount(sale_id,type,tax_type) { function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
@@ -1130,7 +1135,7 @@ $.ajax({
url: "/origami/" + sale_id + "/member_discount", url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type }, data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false, async: false,
success:function(result){ success:function(result){
} }
}); });
} }
@@ -1142,11 +1147,11 @@ $('#pay').on('click',function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj", url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){ success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment"; window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
} }
}); });
}); });
// Bill Request // Bill Request
$('#request_bills').click(function() { $('#request_bills').click(function() {
@@ -1179,7 +1184,7 @@ $('#request_bills').click(function() {
} }
}); });
} }
else { else {
location.reload(); location.reload();
} }
} }
@@ -1187,7 +1192,7 @@ $('#request_bills').click(function() {
}else{ }else{
swal("Opps","There is no orders!","warning"); swal("Opps","There is no orders!","warning");
} }
}); });
//split bill process //split bill process
@@ -1350,17 +1355,19 @@ $('#add_invoice').on('click',function(){
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
} }
} window.location.href = '/origami/';
window.location.href = '/origami/';
} }
}); });
} }
}); });
}else{ }else{
swal("Opps","You are not authorized for void","warning"); swal("Opps","You are not authorized for void","warning");
} }
@@ -1442,17 +1449,19 @@ $('#add_invoice').on('click',function(){
data: "remark="+ remark + "&sale_id=" + sale_id, data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) { success: function (result) {
console.log(result) console.log(result)
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
} }
} window.location.href = '/origami/';
window.location.href = '/origami/';
} }
}); });
} }
}); });
} }
$(document).on('click', '.access_modal', function(event){ $(document).on('click', '.access_modal', function(event){
@@ -1490,7 +1499,7 @@ $('#add_invoice').on('click',function(){
}); });
} }
/* check in process */ /* check in process */
$('#check_in').on('click',function(){ $('#check_in').on('click',function(){
var room_id = "<%= @room.id %>"; var room_id = "<%= @room.id %>";
@@ -1541,12 +1550,12 @@ $('#add_invoice').on('click',function(){
type: "POST", type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax", url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type}, data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
success:function(data){ success:function(data){
if(data.status){ if(data.status){
// console.log(tax_type); // console.log(tax_type);
localStorage.setItem("tax_type", tax_type); localStorage.setItem("tax_type", tax_type);
window.location.href = '/origami/room/'+dining_id; window.location.href = '/origami/room/'+dining_id;
} }
} }
}); });
}else{ }else{

View File

@@ -46,9 +46,9 @@
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <br> <%= table.name %> <br>
<%= table.zone.name %> <%= table.zone.name %>
@@ -61,12 +61,12 @@
<div style="font-size:12px;"></div> <div style="font-size:12px;"></div>
</div> </div>
</div> </div>
<% else %> <% else %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <br> <%= table.name %> <br>
<%= table.zone.name %> <%= table.zone.name %>
@@ -129,7 +129,7 @@
<div class="card-block"> <div class="card-block">
<%= room.name %><br> <%= room.name %><br>
<%= room.zone.name %> <%= room.zone.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide"> <span class="float-right font-12 new_text_<%= room.id %> hide">
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -189,7 +189,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th> <th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th> <th> <%= t :cashier %></th>
<th> <%= t :customer %></th> <th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th> <th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead> </thead>
<tbody class="tbd_credit_lists"></tbody> <tbody class="tbd_credit_lists"></tbody>
@@ -303,17 +303,19 @@
<a class="btn btn-block bg-danger waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a> <a class="btn btn-block bg-danger waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% end %> <% end %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a> <a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
<% else %> <% else %>
<% if @sale.payment_status != 'foc' %> <% if @sale.payment_status != 'foc' %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button> <button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %> <% end %>
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button> <button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</div> </div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -332,7 +334,7 @@
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -346,7 +348,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4> <h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div> </div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important"> <div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 "> <input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10"> <div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div> <div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -365,12 +367,12 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div> <div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div> <div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div> <div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog"> <div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
@@ -390,7 +392,7 @@
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button> <button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -440,9 +442,11 @@ $('#reprint').on('click', function () {
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success: function (result) { success: function (result) {
if ($("#server_mode").val() == "cloud") { if (!$('#print_settings').data('action-cable')) {
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
@@ -474,35 +478,37 @@ $('#back').on('click',function(){
// }); // });
$(document).on('click', '.access_modal', function(event){ $(document).on('click', '.access_modal', function(event){
type = $(this).data("type"); type = $(this).data("type");
$(".ok").attr("data-action",type); $(".ok").attr("data-action",type);
$('#AccessCodeModal').modal('show'); $('#AccessCodeModal').modal('show');
}); });
$('#void').on('click', function () {
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code"); var access_code = localStorage.getItem("access_code");
swal({ swal({
title: "Alert", title: "Alert",
text: "Are you sure want to Void?", text: "Are you sure want to Void?",
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#DD6B55", confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!", confirmButtonText: "Yes, void it!",
closeOnConfirm: false closeOnConfirm: false
}, function (isConfirm) { }, function (isConfirm) {
if (isConfirm) { if (isConfirm) {
var sale_id = $('#sale_id').val(); $('.confirm').prop("disabled", true);
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void'; var sale_id = $('#sale_id').val();
$.ajax({ var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
type: 'POST', $.ajax({
url: ajax_url, type: 'POST',
data: {'access_code':access_code}, url: ajax_url,
success: function () { data: {'access_code':access_code},
window.location.href = '/origami/sale/'+sale_id; success: function () {
} window.location.href = '/origami/sale/'+sale_id;
});
} }
}); });
}); }
});
});
function check_emp_access_code(access_code,type) { function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ; var url = "/origami/check_emp_access_code/" + access_code ;
@@ -542,15 +548,17 @@ $(document).on('click', '.access_modal', function(event){
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success: function (result) { success: function (result) {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") { // For Server Print - from jade
if(typeof code2lab != 'undefined'){ if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
} }
}); });
}else if(type == "foc"){ }else if(type == "foc"){
$('#AccessCodeModal').modal('hide'); $('#AccessCodeModal').modal('hide');
$('#focModal').modal('show'); $('#focModal').modal('show');

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,7 +1,7 @@
<!-- --> <!-- -->
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -164,6 +164,8 @@
</div> </div>
</div> </div>
<%= print_settings %>
<!-- membership paymentmodal --> <!-- membership paymentmodal -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>"> <input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span> <span class="hidden" id="member_discount"><%= @membership.discount%></span>
@@ -243,7 +245,6 @@
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog"> <div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document"> <div class="modal-dialog modal-sm" role="document">
@@ -303,31 +304,6 @@ $(document).ready(function(){
}) })
}); });
// $('#pay').on('click',function() {
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
// });
// Print for first bill
// $("#first_bill").on('click', function () {
// var sale_id = '<%= @sale.id %>';
// var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
// $.ajax({
// type: "GET",
// url: ajax_url,
// success: function (result) {
// receipt_no = ($("#receipt_no").html()).trim();
// if((receipt_no!=undefined) && (receipt_no!=""))
// createReceiptNoInFirstBillData(receipt_no,"");
// // For Server Print - from jade
// if ($("#server_mode").val() == "cloud") {
// code2lab.printFile(result.filepath.substr(6), result.printer_url);
// }
// location.reload();
// }
// });
// });
// Print for first bill // Print for first bill
$("#first_bill").on('click', function () { $("#first_bill").on('click', function () {
swal({ swal({
@@ -353,11 +329,12 @@ $(document).ready(function(){
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,""); createReceiptNoInFirstBillData(receipt_no,"");
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){ if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
} }
} }
location.reload(); location.reload();
@@ -385,17 +362,20 @@ $(document).ready(function(){
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success: function (result) { success: function (result) {
$( "#loading_wrapper" ).hide(); $( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type); createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if (!$('#print_settings').data('action-cable')) {
if(typeof code2lab != 'undefined'){ // For Server Print - from jade
code2lab.printFile(result.filepath.substr(6), result.printer_url); if ($("#server_mode").val() == "cloud") {
} if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
location.reload(); }
}
location.reload();
} }
}); });
}); });
@@ -463,13 +443,15 @@ $('#void').on('click',function () {
url: ajax_url, url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code , data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function (result) { success: function (result) {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){ if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
} }
window.location.href = '/origami'; }
window.location.href = '/origami';
} }
}); });
} }
@@ -499,17 +481,19 @@ $('#foc').click(function() {
success:function(result){ success:function(result){
if (cash >= 0) { if (cash >= 0) {
swal({ swal({
title: "Information!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
}, function () { }, function () {
// For Server Print - from jade if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){ if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
} }
} }
window.location.href = '/origami'; }
}); window.location.href = '/origami';
});
} }
} }
}); });
@@ -531,31 +515,30 @@ $(document).on('click', '.access_modal', function(event){
url: url, url: url,
data: {}, data: {},
success: function (result) { success: function (result) {
console.log(result) if (result.status == true) {
if (result.status == true) {
createAccessCode(code); createAccessCode(code);
if (type == "edit") { if (type == "edit") {
}else if(type == "void"){ } else if(type == "void") {
$('#AccessCodeModal').modal('hide'); $('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show'); $('#voidModal').modal('show');
// overall_void(); // overall_void();
}else if(type == "waste") { } else if(type == "waste") {
// $('#AccessCodeModal').modal('hide'); // $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show'); // $('#focModal').modal('show');
waste_and_spoilage("waste") waste_and_spoilage("waste")
}else if(type == "spoile") { } else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide'); // $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show'); // $('#voidModal').modal('show');
waste_and_spoilage("spoile") waste_and_spoilage("spoile")
}else if(type == "foc"){ } else if(type == "foc") {
$('#AccessCodeModal').modal('hide'); $('#AccessCodeModal').modal('hide');
$('#focModal').modal('show'); $('#focModal').modal('show');
// overall_foc(); // overall_foc();
} }
}else{ } else {
swal("Opps",result.message,"warning") swal("Opps",result.message,"warning")
} }
} }
}); });
} }

View File

@@ -5,7 +5,7 @@
<%= simple_form_for(@print_setting) do |f| %> <%= simple_form_for(@print_setting) do |f| %>
<%= f.error_notification %> <%= f.error_notification %>
<div class="form-inputs"> <div class="form-inputs p-l-10">
<%= f.input :name %> <%= f.input :name %>
<%= f.input :unique_code %> <%= f.input :unique_code %>
<%= f.input :template %> <%= f.input :template %>
@@ -13,11 +13,8 @@
<%= f.input :header_font_size %> <%= f.input :header_font_size %>
<%= f.input :item_font_size %> <%= f.input :item_font_size %>
<% if(@server_mode != 'cloud') %> <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select", class: "mdb-select md-form" %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select" %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: "Please Select" %>
<% end %>
<%= f.input :brand_name %> <%= f.input :brand_name %>
<%= f.input :printer_type %> <%= f.input :printer_type %>
<%= f.input :api_settings %> <%= f.input :api_settings %>
@@ -45,7 +42,7 @@
</div> </div>
<div class="form-actions"> <div class="form-actions p-l-10">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
</div> </div>
<% end %> <% end %>
@@ -80,38 +77,40 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <br> 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <br>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
var serverMode = "<%= @server_mode %>"; var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){ if(serverMode == 'cloud' && typeof code2lab != 'undefined'){
var printers = code2lab.getPrinters(); var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]); var printerInfo = JSON.parse([printers]);
var select = $("#print_setting_printer_name"); var select = $("#print_setting_printer_name");
$.each(printerInfo, function(key, value) { $.each(printerInfo, function(key, value) {
$('#print_setting_printer_name') $('#print_setting_printer_name')
.append($("<option></option>") .append($("<option></option>")
.attr("value",value.target) .attr("value",value.target)
.text(value.deviceName)); .text(value.deviceName));
}); });
} }
$('#print_setting_printer_name option:first').attr('disabled', true);
if ($('#sale_items').val() == '1') { if ($('#sale_items').val() == '1') {
$('#sale_items').prop('checked', true); $('#sale_items').prop('checked', true);
} }
// if selected printer change call and bind // if selected printer change call and bind
$("#print_setting_printer_name").on("change", function(){ $("#print_setting_printer_name").on("change", function(){
if(serverMode != 'cloud'){ if(serverMode != 'cloud'){
var printer_name = $(this).val(); var printer_name = $(this).val();
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/get_printer_options/"+printer_name, url: "/get_printer_options/"+printer_name,
success:function(result){ success:function(result){
$("#print_setting_brand_name").val(result.model); $("#print_setting_brand_name").val(result.model);
$("#print_setting_api_settings").val(result.url); $("#print_setting_api_settings").val(result.url);
} }
@@ -120,8 +119,13 @@
else { else {
$("#print_setting_api_settings").val($(this).val()); $("#print_setting_api_settings").val($(this).val());
} }
}); });
});
$("#print_setting_printer_name").select2({
theme: 'material',
tags: true
})
});
function isNumberKey(evt) { function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode; var charCode = (evt.which) ? evt.which : event.keyCode;
@@ -129,7 +133,7 @@
return false; return false;
} else { } else {
return true; return true;
} }
} }
function greaterThanOne(val){ function greaterThanOne(val){
@@ -147,4 +151,4 @@
$(ele).val(1) $(ele).val(1)
} }
} }
</script> </script>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li> <li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">
@@ -10,5 +10,3 @@
</div> </div>
<%= render 'form', print_setting: @print_setting %> <%= render 'form', print_setting: @print_setting %>

View File

@@ -2,7 +2,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.header.print_settings") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.header.print_settings") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li> <li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li> <li class="breadcrumb-item"><a href="<%= print_settings_path %>"><%= t("views.right_panel.header.print_settings") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.cb_payments") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.cb_payments") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.cb_payments") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.cb_payments") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.commission_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.commission_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.credit_payment_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.credit_payment_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.daily_sale_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.daily_sale_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.hourly_saleitem_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.hourly_saleitem_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.induty_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.induty_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.order_reservation_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.order_reservation_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active">Payment Method Report</li> <li class="breadcrumb-item active">Payment Method Report</li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.product_sale_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.product_sale_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %> Details</li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %> Details</li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.shift_sale_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.shift_sale_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.staff_meal_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.staff_meal_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item active">Stock Check Report</li> <li class="breadcrumb-item active">Stock Check Report</li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.void_sale_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.void_sale_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to 'Back', dashboard_path %> <%= link_to 'Back', dashboard_path %>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.account") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.detail.account") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), root_path %>
</span> </span>
</ol> </ol>
</div> </div>
@@ -38,7 +38,7 @@
<td><%= account.rebate %></td> <td><%= account.rebate %></td>
<td> <td>
<%= link_to t("views.btn.show"), settings_account_path(account),:class => 'btn btn-info btn-sm waves-effect' %> <%= link_to t("views.btn.show"), settings_account_path(account),:class => 'btn btn-info btn-sm waves-effect' %>
<%= link_to t("views.btn.edit"), edit_settings_account_path(account),:class => 'btn btn-primary btn-sm waves-effect' %> <%= link_to t("views.btn.edit"), edit_settings_account_path(account),:class => 'btn btn-primary btn-sm waves-effect' %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
@@ -71,7 +71,6 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %> <br> 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %> <br>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,7 +1,7 @@
<!-- --> <!-- -->
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissions_path %>">Commissions</a></li> <li class="breadcrumb-item"><a href="<%= settings_commissions_path %>">Commissions</a></li>
<li class="breadcrumb-item active"><%= @commission.name %></li> <li class="breadcrumb-item active"><%= @commission.name %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -12,11 +12,9 @@
<%= f.input :auto_print_receipt %> <%= f.input :auto_print_receipt %>
<%= f.label "Select Zones", :class => 'control-label' %> <%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%> <%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select", class: "mdb-select md-form" %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :font %> <%= f.input :font %>
<%= f.input :font_size %> <%= f.input :font_size %>
<%= f.input :show_tax %> <%= f.input :show_tax %>
@@ -24,7 +22,7 @@
<%= f.input :show_guest_info %> <%= f.input :show_guest_info %>
</div> </div>
<div class="form-actions"> <div class="form-actions p-l-10">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
</div> </div>
<% end %> <% end %>
@@ -58,24 +56,31 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.cashier_terminal_txt") %> <br> 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.cashier_terminal_txt") %> <br>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
var serverMode = "<%= @server_mode %>"; var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){ if(serverMode == 'cloud' && typeof code2lab != 'undefined'){
var printers = code2lab.getPrinters(); var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]); var printerInfo = JSON.parse([printers]);
var select = $("#cashier_terminal_printer_name"); var select = $("#cashier_terminal_printer_name");
$.each(printerInfo, function(key, value) { $.each(printerInfo, function(key, value) {
$('#cashier_terminal_printer_name') $('#cashier_terminal_printer_name')
.append($("<option></option>") .append($("<option></option>")
.attr("value",value.target) .attr("value",value.target)
.text(value.deviceName)); .text(value.deviceName));
}); });
} }
$('#cashier_terminal_printer_name option:first').attr('disabled', true);
$("#cashier_terminal_printer_name").select2({
theme: 'material',
tags: true
})
}); });
</script> </script>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.header.cashier_terminal") %></li> <li class="breadcrumb-item active"><%= t("views.right_panel.header.cashier_terminal") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), root_path %>
</span> </span>
</ol> </ol>
</div> </div>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_cashier_terminals_path %>"><%= t("views.right_panel.header.cashier_terminal") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,7 +1,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("en.commissioners") %></li> <li class="breadcrumb-item active"><%= t("en.commissioners") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), root_path %>
</span> </span>
</ol> </ol>
</div> </div>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_commissioners_path %>"><%= t("en.commissioners") %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li> <li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissions_path %>"><%= t("en.commissions") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_commissions_path %>"><%= t("en.commissions") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -1,9 +1,9 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("en.commissions") %></li> <li class="breadcrumb-item active"><%= t("en.commissions") %></li>
<span class="float-right"> <span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %> <%= link_to t('.back', :default => t("views.btn.back")), root_path %>
</span> </span>
</ol> </ol>
</div> </div>

View File

@@ -1,6 +1,6 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_commissions_path %>"><%= t("en.commissions") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_commissions_path %>"><%= t("en.commissions") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.new") %></li> <li class="breadcrumb-item active"><%= t("views.btn.new") %></li>
<span class="float-right"> <span class="float-right">

View File

@@ -2,7 +2,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<% if @table %> <% if @table %>
<li class="breadcrumb-item"><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li> <li class="breadcrumb-item"><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
<% elsif @room %> <% elsif @room %>

View File

@@ -1,7 +1,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li> <li class="breadcrumb-item"><a href="<%= root_path %>">Home</a></li>
<% if @table %> <% if @table %>
<li class="breadcrumb-item"><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li> <li class="breadcrumb-item"><a href="<%= edit_settings_zone_table_path(@zone,@settings_dining_facility) %>">Table / Room</a></li>
<% elsif @room %> <% elsif @room %>

View File

@@ -1,7 +1,7 @@
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li> <li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= settings_employees_path %>"><%= t("views.right_panel.detail.employees") %></a></li> <li class="breadcrumb-item"><a href="<%= settings_employees_path %>"><%= t("views.right_panel.detail.employees") %></a></li>
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li> <li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
<span class="float-right"> <span class="float-right">

Some files were not shown because too many files have changed in this diff Show More