Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0'
|
||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||
|
||||
#Use PosgreSQL
|
||||
gem 'pg'
|
||||
# gem 'pg'
|
||||
|
||||
# redis server for cable
|
||||
# gem 'redis', '~> 3.0'
|
||||
@@ -66,6 +66,8 @@ gem 'kaminari', '~> 1.0.1'
|
||||
# Datatable
|
||||
gem 'filterrific'
|
||||
|
||||
gem 'cancancan', '~> 1.10'
|
||||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano-rails', group: :development
|
||||
|
||||
|
||||
12
Gemfile.lock
12
Gemfile.lock
@@ -39,7 +39,7 @@ GEM
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (8.0.0)
|
||||
autoprefixer-rails (7.1.1)
|
||||
autoprefixer-rails (7.1.1.2)
|
||||
execjs
|
||||
bcrypt (3.1.11)
|
||||
bindex (0.5.0)
|
||||
@@ -50,6 +50,7 @@ GEM
|
||||
railties (>= 3.0)
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
cancancan (1.17.0)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0)
|
||||
@@ -121,7 +122,6 @@ GEM
|
||||
nokogiri (1.8.0)
|
||||
mini_portile2 (~> 2.2.0)
|
||||
pdf-core (0.7.0)
|
||||
pg (0.20.0)
|
||||
prawn (2.2.2)
|
||||
pdf-core (~> 0.7.0)
|
||||
ttfunk (~> 1.5)
|
||||
@@ -159,8 +159,8 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (12.0.0)
|
||||
rb-fsevent (0.9.8)
|
||||
rb-inotify (0.9.8)
|
||||
ffi (>= 0.5.0)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
redis (3.3.3)
|
||||
rspec-core (3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
@@ -191,7 +191,7 @@ GEM
|
||||
activesupport (>= 3.2.1)
|
||||
shoulda-matchers (3.1.1)
|
||||
activesupport (>= 4.0.0)
|
||||
sidekiq (5.0.2)
|
||||
sidekiq (5.0.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
connection_pool (~> 2.2, >= 2.2.0)
|
||||
rack-protection (>= 1.5.0)
|
||||
@@ -245,6 +245,7 @@ DEPENDENCIES
|
||||
bootstrap (~> 4.0.0.alpha3)
|
||||
bootstrap-datepicker-rails
|
||||
byebug
|
||||
cancancan (~> 1.10)
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
database_cleaner
|
||||
@@ -259,7 +260,6 @@ DEPENDENCIES
|
||||
kaminari (~> 1.0.1)
|
||||
listen (~> 3.0.5)
|
||||
mysql2 (>= 0.3.18, < 0.5)
|
||||
pg
|
||||
prawn
|
||||
prawn-table
|
||||
puma (~> 3.0)
|
||||
|
||||
@@ -25,6 +25,12 @@ $(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
$('.dropdown-toggle').dropdown();
|
||||
});
|
||||
|
||||
function export_to(path)
|
||||
{
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
/*
|
||||
* ToDo Move to here from pages
|
||||
*
|
||||
|
||||
10
app/assets/javascripts/jquery-confirm.js
vendored
Normal file
10
app/assets/javascripts/jquery-confirm.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,15 +1,3 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
@@ -49,7 +37,7 @@ $(document).ready(function(){
|
||||
control_button(order_status);
|
||||
|
||||
var customer_id=$(this).find(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
//show_customer_details(customer_id);
|
||||
|
||||
$("#re-print").val(unique_id);
|
||||
|
||||
@@ -304,49 +292,9 @@ $(document).ready(function(){
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// $(".orders").on('click', function(){
|
||||
// var dining_id = $(this).attr("data-id");
|
||||
// window.location.href = '/origami/' + dining_id;
|
||||
// })
|
||||
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', false);
|
||||
$("#pay-bill").prop('disabled', false);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}else if(order_status=="completed"){
|
||||
$("#re-print").prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$("#customer").prop('disabled', true);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
|
||||
352
app/assets/javascripts/origami_bk.js
Normal file
352
app/assets/javascripts/origami_bk.js
Normal file
@@ -0,0 +1,352 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
$(document).ready(function(){
|
||||
// auto refresh every 60 seconds
|
||||
// setTimeout(function(){
|
||||
// window.location.reload(1);
|
||||
// }, 60000);
|
||||
|
||||
// For selected order return
|
||||
var order_status = "";
|
||||
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
|
||||
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
$(".orders").on('click', function(){
|
||||
$("#order-sub-total").text('');
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text('');
|
||||
$("#order-Tax").text('');
|
||||
$("#order-grand-total").text('');
|
||||
|
||||
var zone_name=$(this).find(".orders-table").text();
|
||||
var receipt_no=$(this).find(".orders-receipt-no").text();
|
||||
var unique_id = $(this).find(".orders-id").text();
|
||||
var order_status=$(this).find(".orders-order-status").text().trim();
|
||||
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
var customer_id=$(this).find(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
$("#re-print").val(unique_id);
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0.0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
|
||||
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||
// clear order items
|
||||
$("#order-items-table").children("tbody").empty();
|
||||
|
||||
// AJAX call for order
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + unique_id,
|
||||
data: { 'booking_id' : unique_id },
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var show_date = "";
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier = result[i].cashier_name;
|
||||
if(result[i].receipt_date != null){
|
||||
receipt_date = new Date(result[i].receipt_date);
|
||||
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
|
||||
}
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += parseFloat(parse_data.price);
|
||||
|
||||
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
|
||||
// Cashier Info
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier == null ? "" : cashier);
|
||||
$("#receipt_date").text(show_date);
|
||||
|
||||
// Payment Info
|
||||
$("#order-sub-total").text(sub_total);
|
||||
// $("#order-food").text('');
|
||||
// $("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
|
||||
$('.orders').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/' + order_id + '/request_bills'
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/' + order_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sale_item_id = $('.selected-item').attr('id').substr(0,16);
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var grand_total = $('#order-grand-total').text();
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_amount = discount_value;
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
if(sale_item_id != null){
|
||||
ajax_url = "/origami/" + sale_item_id + "/discount";
|
||||
sub_total = $("#"+sale_item_id).children().find("#item-total-price").text();
|
||||
}
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_value)/100;
|
||||
}
|
||||
|
||||
var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){ }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay-bill').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if(sale_id!=""){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#customer').click(function() {
|
||||
var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
if (sale.substring(0, 3)=="SAL") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $(".selected-item").find(".order-cid").text();
|
||||
}
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function show_customer_details(customer_id){
|
||||
|
||||
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
||||
var url = customer_id+"/get_customer/"
|
||||
}else{
|
||||
var url = "origami/"+customer_id+"/get_customer/"
|
||||
}
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#customer_name").text(data["customer"].name);
|
||||
if (data["response_data"]["data"].length) {
|
||||
$.each(data["response_data"]["data"], function (i) {
|
||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||
var balance = data["response_data"]["data"][i]["balance"];
|
||||
if (data["response_data"]["status"]==true) {
|
||||
$('.rebate_amount').removeClass('hide');
|
||||
row =
|
||||
'<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>'
|
||||
+'<td class="item-attr">' + balance + '</td>';
|
||||
|
||||
$(".rebate_amount").html(row);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$('.rebate_amount').addClass('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
//End Ajax
|
||||
}
|
||||
|
||||
/* For Receipt - Calculate discount or tax */
|
||||
$('.cashier_number').on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
update_balance();
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
update_balance();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
$('#discount-type').val(1);
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.discount-item-row').on('click',function(){
|
||||
$('.discount-item-row').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', false);
|
||||
$("#pay-bill").prop('disabled', false);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}else if(order_status=="completed"){
|
||||
$("#re-print").prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$("#customer").prop('disabled', true);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
$("#re-print").prop('disabled', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
@@ -23,3 +23,17 @@
|
||||
.assign .text-muted{
|
||||
color: #fff !important;
|
||||
}
|
||||
.red{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
}
|
||||
.green{
|
||||
color: #fff !important;
|
||||
background-color: green;
|
||||
}
|
||||
.required abbr{
|
||||
color: red !important;
|
||||
}
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
}
|
||||
10
app/assets/stylesheets/jquery-confirm.scss
Normal file
10
app/assets/stylesheets/jquery-confirm.scss
Normal file
File diff suppressed because one or more lines are too long
@@ -9,6 +9,7 @@
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
|
||||
.others-payment{
|
||||
line-height:100px;
|
||||
text-align:center;
|
||||
@@ -41,17 +42,50 @@
|
||||
|
||||
.pay{
|
||||
width: 98%;
|
||||
height:211px;
|
||||
height:211px;
|
||||
line-height:211px;
|
||||
text-align:center;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.payment{
|
||||
height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px;
|
||||
}
|
||||
|
||||
.cash-color{
|
||||
background-color:#80CBC4;
|
||||
}
|
||||
|
||||
.credit-color{
|
||||
background-color:#FFCCBC;
|
||||
}
|
||||
|
||||
.other-payment-color{
|
||||
background-color:#E1BEE7;
|
||||
}
|
||||
|
||||
.cashier_number:hover{
|
||||
background:#A9F5F2;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
height: 60px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.bottom-5 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fluid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.style2 {
|
||||
border-top: 3px double #8c8b8b;
|
||||
}
|
||||
|
||||
.long{
|
||||
width:49%;
|
||||
}
|
||||
@@ -69,6 +103,11 @@
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
.selected-account {
|
||||
color: #fff !important;
|
||||
background-color: blue !important;
|
||||
}
|
||||
|
||||
/* Reciept Style */
|
||||
#order-charges-table td {
|
||||
border-top: none !important;
|
||||
@@ -89,6 +128,13 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.display-none{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.text-white{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Colors */
|
||||
.purple {
|
||||
@@ -103,6 +149,10 @@
|
||||
background-color: #009900
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00
|
||||
}
|
||||
|
||||
.left{
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,17 @@ class Api::BillController < Api::ApiController
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
||||
|
||||
@@ -6,11 +6,9 @@ class Api::BookingsController < Api::ApiController
|
||||
end
|
||||
|
||||
def show
|
||||
@booking = Booking.find(params[:id])
|
||||
booking = Booking.find(params[:id])
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
@booking = booking
|
||||
end
|
||||
end
|
||||
|
||||
# private
|
||||
# def Bookings_params
|
||||
# params.permit(:id, :order_id)
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -7,11 +7,45 @@ class Api::OrdersController < Api::ApiController
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
end
|
||||
|
||||
def get_order
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
end
|
||||
|
||||
# API - This api will retrive current booking for android with table or room id
|
||||
def view_orders
|
||||
booking_id = params[:booking_id]
|
||||
table_id = params[:table_id]
|
||||
if Booking.exists?(booking_id)
|
||||
booking = Booking.find(booking_id)
|
||||
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == table_id.to_i
|
||||
@booking = booking
|
||||
else
|
||||
table = DiningFacility.find(table_id)
|
||||
booking = table.get_current_booking
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == table_id.to_i
|
||||
@booking = booking
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "only table"
|
||||
table = DiningFacility.find(table_id)
|
||||
booking = table.get_current_booking
|
||||
puts booking
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == table_id.to_i
|
||||
@booking = booking
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Description
|
||||
# This API allow new order creation
|
||||
# Input Params
|
||||
@@ -38,18 +72,50 @@ class Api::OrdersController < Api::ApiController
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
puts "booking sale is null"
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
# booking.table id not equal current table
|
||||
table = DiningFacility.find(params[:table_id])
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
if booking
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
puts "booking sale is null"
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
#no booking id
|
||||
table = DiningFacility.find(params[:table_id])
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
if booking
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
@@ -8,6 +8,16 @@ class ApplicationController < ActionController::Base
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
|
||||
# rescue_from CanCan::AccessDenied do |exception|
|
||||
# flash[:warning] = exception.message
|
||||
# redirect_to root_path
|
||||
# end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
def current_company
|
||||
begin
|
||||
return Company.first
|
||||
|
||||
@@ -7,23 +7,19 @@ class Crm::CustomersController < BaseCrmController
|
||||
filter = params[:filter]
|
||||
|
||||
if filter.nil?
|
||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
||||
#@products = Product.order("name").page(params[:page]).per(5)
|
||||
@crm_customers = Customer.all
|
||||
else
|
||||
@crm_customers = Customer.search(filter)
|
||||
|
||||
end
|
||||
#@crm_customers = Customer.all
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
# @membership = Customer.get_member_group
|
||||
# if @membership["status"] == true
|
||||
# @member_group = @membership["data"]
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
@@ -51,14 +47,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
#end customer amount
|
||||
|
||||
end
|
||||
@@ -87,6 +76,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
@@ -95,14 +86,18 @@ class Crm::CustomersController < BaseCrmController
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
@@ -151,6 +146,8 @@ end
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
@@ -159,22 +156,24 @@ end
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
|
||||
else
|
||||
|
||||
flash[:errors] = @crm_customers.errors
|
||||
flash[:errors] = @crm_customer.errors
|
||||
format.html { redirect_to crm_customers_path}
|
||||
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
@@ -201,6 +200,7 @@ end
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def customer_params
|
||||
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth)
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salution,:gender,:nrc_no,:address,:card_no)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,12 +84,15 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
queue = DiningQueue.find(params[:id])
|
||||
table_id = params[:table_id]
|
||||
|
||||
queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
status = queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
status = DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true , notice: 'Dining queue was successfully assigned .'})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ class Oqs::HomeController < BaseOqsController
|
||||
dining = DiningFacility.find_by_name(table_name);
|
||||
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||
# if status == ""
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# end
|
||||
# else
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||
# items.push(oi)
|
||||
# end
|
||||
# end
|
||||
|
||||
@@ -49,7 +49,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
end
|
||||
end
|
||||
|
||||
# booking_id = dining.get_new_booking
|
||||
# booking_id = dining.get_new_booking
|
||||
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
||||
# order=Order.find(bo.order_id);
|
||||
# order.order_items.each do |oi|
|
||||
@@ -81,6 +81,8 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Query for OQS with status
|
||||
def queue_items_query(status)
|
||||
puts status
|
||||
puts "put what is status"
|
||||
# AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||
# .joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
||||
# left join dining_facilities as df on df.zone_id = oqpz.zone_id
|
||||
@@ -88,9 +90,9 @@ class Oqs::HomeController < BaseOqsController
|
||||
# left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
# left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||
# left join customers as cus ON cus.customer_id = od.customer_id")
|
||||
# .where("assigned_order_items.delivery_status = #{status}")
|
||||
# .where("assigned_order_items.delivery_status = #{status}")
|
||||
# .group("assigned_order_items.assigned_order_item_id")
|
||||
# .order("odt.item_name DESC")
|
||||
# .order("odt.item_name DESC")
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
@@ -99,7 +101,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status}")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
.where("assigned_order_items.delivery_status = #{status}")
|
||||
.group("assigned_order_items.assigned_order_item_id,oqs.station_name,oqs.is_active,df.name,odt.item_code,odt.item_name,odt.price, odt.qty, odt.item_order_by,cus.name,odt.created_at")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,52 +6,91 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
@accounts = Account.all
|
||||
end
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
discount_items = JSON.parse(params[:discount_items])
|
||||
overall_discount = params[:overall_discount]
|
||||
sub_total = params[:sub_total]
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
sale.total_discount = overall_discount.to_f
|
||||
sale.total_amount = sub_total.to_f
|
||||
sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
sale.save
|
||||
if discount_items.length > 0
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
puts di
|
||||
origin_sale_item = SaleItem.find(di["id"])
|
||||
sale_item = SaleItem.new
|
||||
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = di["name"]
|
||||
sale_item.remark = "Discount"
|
||||
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = di["price"]
|
||||
sale_item.is_taxable = 0
|
||||
|
||||
sale_item.price = di["price"]
|
||||
sale_item.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
sale_item_id = params[:sale_item_id]
|
||||
discount_type = params[:discount_type]
|
||||
discount_value = params[:discount_value]
|
||||
discount_amount = params[:discount_amount]
|
||||
grand_total = params[:grand_total]
|
||||
product_name = "Overall Discount"
|
||||
# def create
|
||||
# sale_id = params[:sale_id]
|
||||
# sale_item_id = params[:sale_item_id]
|
||||
# discount_type = params[:discount_type]
|
||||
# discount_value = params[:discount_value]
|
||||
# discount_amount = params[:discount_amount]
|
||||
# grand_total = params[:grand_total]
|
||||
# product_name = "Overall Discount"
|
||||
|
||||
if discount_type == 0
|
||||
remark="Discount " + discount_amount + " as net"
|
||||
else
|
||||
remark="Discount " + discount_amount + " as percentage"
|
||||
end
|
||||
# if discount_type == 0
|
||||
# remark="Discount " + discount_amount + " as net"
|
||||
# else
|
||||
# remark="Discount " + discount_amount + " as percentage"
|
||||
# end
|
||||
|
||||
#update discount for sale
|
||||
sale = Sale.find(sale_id)
|
||||
sale.total_discount = sale.total_discount + discount_amount.to_f
|
||||
sale.grand_total = grand_total
|
||||
sale.save
|
||||
# #update discount for sale
|
||||
# sale = Sale.find(sale_id)
|
||||
# sale.total_discount = sale.total_discount + discount_amount.to_f
|
||||
# sale.grand_total = grand_total
|
||||
# sale.save
|
||||
|
||||
#save sale item for discount
|
||||
if sale_item_id != nil
|
||||
origin_sale_item = SaleItem.find(sale_item_id)
|
||||
product_name = origin_sale_item.product_name + "-Disocunt"
|
||||
end
|
||||
sale_item = SaleItem.new
|
||||
# #save sale item for discount
|
||||
# if sale_item_id != nil
|
||||
# origin_sale_item = SaleItem.find(sale_item_id)
|
||||
# product_name = origin_sale_item.product_name + "-Disocunt"
|
||||
# end
|
||||
# sale_item = SaleItem.new
|
||||
|
||||
#pull
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = product_name
|
||||
sale_item.remark = remark
|
||||
# #pull
|
||||
# sale_item.sale_id = sale_id
|
||||
# sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
# sale_item.product_name = product_name
|
||||
# sale_item.remark = remark
|
||||
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = (0-discount_amount.to_f)
|
||||
sale_item.taxable_price = discount_amount
|
||||
sale_item.is_taxable = 0
|
||||
# sale_item.qty = 1
|
||||
# sale_item.unit_price = (0-discount_amount.to_f)
|
||||
# sale_item.taxable_price = discount_amount
|
||||
# sale_item.is_taxable = 0
|
||||
|
||||
sale_item.price = sale_item.qty * sale_item.unit_price
|
||||
sale_item.save
|
||||
# sale_item.price = sale_item.qty * sale_item.unit_price
|
||||
# sale_item.save
|
||||
|
||||
redirect_to origami_path(sale_id)
|
||||
end
|
||||
# redirect_to origami_path(sale_id)
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,84 +1,54 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
before_action :set_dining, only: [:show]
|
||||
|
||||
def index
|
||||
if params[:booking_id] != nil
|
||||
type=params[:booking_id].split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@selected_item = Sale.find(params[:booking_id])
|
||||
@selected_item_type="Sale"
|
||||
# Booking
|
||||
else
|
||||
@selected_item = Order.find(params[:booking_id])
|
||||
@selected_item_type="Order"
|
||||
end
|
||||
end
|
||||
|
||||
@completed_orders = Order.get_completed_order()
|
||||
@booking_orders = Order.get_booking_order_table()
|
||||
@booking_rooms = Order.get_booking_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.complete_sale
|
||||
@orders = Order.all.order('date desc')
|
||||
end
|
||||
|
||||
def item_show
|
||||
selection(params[:booking_id],1)
|
||||
end
|
||||
# origami table detail
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.complete_sale
|
||||
@orders = Order.all.order('date desc')
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
@dining.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
|
||||
def selection(selected_id, is_ajax)
|
||||
str = []
|
||||
type=selected_id.split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
end
|
||||
|
||||
if is_ajax == 1
|
||||
render :json => str.to_json
|
||||
else
|
||||
str
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj_order = order
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
private
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
else
|
||||
sale = Order.find(params[:sale_id])
|
||||
end
|
||||
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def get_customer
|
||||
|
||||
@customer = Customer.find(params[:customer_id])
|
||||
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
respond_to do |format|
|
||||
format.js do
|
||||
render :json => {
|
||||
:response_data => response.as_json,
|
||||
:customer => @customer}
|
||||
end
|
||||
end
|
||||
end
|
||||
def set_dining
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
84
app/controllers/origami/home_controller_bk.rb
Normal file
84
app/controllers/origami/home_controller_bk.rb
Normal file
@@ -0,0 +1,84 @@
|
||||
class Origami::HomeController < BaseOrigamiController
|
||||
def index
|
||||
if params[:booking_id] != nil
|
||||
type=params[:booking_id].split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@selected_item = Sale.find(params[:booking_id])
|
||||
@selected_item_type="Sale"
|
||||
# Booking
|
||||
else
|
||||
@selected_item = Order.find(params[:booking_id])
|
||||
@selected_item_type="Order"
|
||||
end
|
||||
end
|
||||
|
||||
@completed_orders = Order.get_completed_order()
|
||||
@booking_orders = Order.get_booking_order_table()
|
||||
@booking_rooms = Order.get_booking_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
end
|
||||
|
||||
def item_show
|
||||
selection(params[:booking_id],1)
|
||||
end
|
||||
|
||||
def selection(selected_id, is_ajax)
|
||||
str = []
|
||||
type=selected_id.split('-')[0];
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
end
|
||||
|
||||
if is_ajax == 1
|
||||
render :json => str.to_json
|
||||
else
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
else
|
||||
sale = Order.find(params[:sale_id])
|
||||
end
|
||||
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def get_customer
|
||||
|
||||
@customer = Customer.find(params[:customer_id])
|
||||
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
respond_to do |format|
|
||||
format.js do
|
||||
render :json => {
|
||||
:response_data => response.as_json,
|
||||
:customer => @customer}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
37
app/controllers/origami/moveroom_controller.rb
Normal file
37
app/controllers/origami/moveroom_controller.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
|
||||
@status_order = ""
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
@dining.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj_order = order
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
53
app/controllers/origami/movetable_controller.rb
Normal file
53
app/controllers/origami/movetable_controller.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
@dining.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj_order = order
|
||||
@date = order.created_at
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def moving
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
booking_array = Array.new
|
||||
bookings.each do | booking |
|
||||
if booking.sale_id.nil? || booking.sale.sale_status != 'completed'
|
||||
booking_array.push(booking)
|
||||
end
|
||||
end
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
end
|
||||
end
|
||||
15
app/controllers/origami/orders_controller.rb
Normal file
15
app/controllers/origami/orders_controller.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class Origami::OrdersController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.complete_sale
|
||||
@orders = Order.all.order('status desc')
|
||||
@order = Order.find(params[:order_id])
|
||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||
if sale_order
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
@sale_status = sale.sale_status
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,11 +10,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
rebate_amount = nil
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
@@ -24,7 +26,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info,rebate_amount)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -88,7 +90,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
@@ -96,7 +98,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info,rebate_amount)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
booking_id = params[:id]
|
||||
check_booking = Booking.find_by_booking_id(booking_id)
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
puts "current_login_employee"
|
||||
@@ -19,8 +20,11 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
|
||||
customer= Customer.find( @sale_data.customer_id)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
@@ -31,7 +35,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
|
||||
redirect_to origami_path(@sale_data.sale_id)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total,member_info)
|
||||
# redirect_to origami_path(@sale_data.sale_id)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
32
app/controllers/origami/rooms_controller.rb
Normal file
32
app/controllers/origami/rooms_controller.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
class Origami::RoomsController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.complete_sale
|
||||
@orders = Order.all.order('date desc')
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@room.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj = order
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
@status = 'order'
|
||||
else
|
||||
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
@status = 'sale'
|
||||
@obj = sale
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
10
app/controllers/origami/sales_controller.rb
Normal file
10
app/controllers/origami/sales_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class Origami::SalesController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.complete_sale
|
||||
@orders = Order.all.order('date desc')
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
end
|
||||
end
|
||||
@@ -1,23 +1,11 @@
|
||||
class Reports::DailySaleController < BaseReportController
|
||||
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
end
|
||||
|
||||
# @locations = Location.all
|
||||
|
||||
# branch,from, to, report_type = get_date_range_from_params
|
||||
|
||||
# @location = Location.find_by_id(current_location)
|
||||
# @sale_data = Sale.daily_sales_report(current_location,from,to)
|
||||
# @tax = SaleT.get_tax(current_location,from,to)
|
||||
|
||||
# if @sale_data.blank? && @tax.blank? && request.post?
|
||||
# flash.now[:notice] = "No data available for selected filters"
|
||||
# end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Reports::ReceiptNoController < BaseReportController
|
||||
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
puts "from..."
|
||||
|
||||
14
app/controllers/reports/sale_item_controller.rb
Normal file
14
app/controllers/reports/sale_item_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class Reports::SaleItemController < BaseReportController
|
||||
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
class Settings::EmployeesController < ApplicationController
|
||||
# load_and_authorize_resource
|
||||
before_action :set_employee, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
# GET /employees
|
||||
# GET /employees.json
|
||||
def index
|
||||
|
||||
@@ -27,6 +27,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
def create
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
@settings_order_queue_station.created_by = current_login_employee.name
|
||||
@settings_order_queue_station.processing_items = "[]"
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.save
|
||||
format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' }
|
||||
|
||||
@@ -53,13 +53,7 @@ class Transactions::SalesController < ApplicationController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale.customer_id)
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
#end customer amount
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
33
app/models/ability.rb
Normal file
33
app/models/ability.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
class Ability
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
user ||= Employee.new
|
||||
|
||||
if user.role? :administrator
|
||||
|
||||
can :manage, :all
|
||||
|
||||
elsif user.role? :cashier
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
can :completed_order_item, Order
|
||||
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
|
||||
|
||||
elsif user.role? :accountant
|
||||
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
can :completed_order_item, Order
|
||||
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
can :manual_complete_sale, Sale
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -10,6 +10,19 @@ class Booking < ApplicationRecord
|
||||
has_many :booking_orders
|
||||
has_many :orders, :through => :booking_orders
|
||||
|
||||
def self.update_dining_facility(booking_arr, newd, old)
|
||||
booking_arr.each do |booking|
|
||||
booking.dining_facility_id = newd
|
||||
booking.save
|
||||
end
|
||||
new_dining = DiningFacility.find(newd)
|
||||
new_dining.make_occupied
|
||||
old_dining = DiningFacility.find(old)
|
||||
old_dining.make_available
|
||||
|
||||
return new_dining.type
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class BookingOrder < ApplicationRecord
|
||||
#primary key - need to be unique
|
||||
#primary key - need to be unique
|
||||
|
||||
belongs_to :booking
|
||||
belongs_to :order
|
||||
|
||||
@@ -6,9 +6,10 @@ class Customer < ApplicationRecord
|
||||
has_many :orders
|
||||
has_many :sales
|
||||
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates_presence_of :name, :contact_no, :email,:company,:card_no
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
validates :card_no, uniqueness: true
|
||||
|
||||
paginates_per 50
|
||||
|
||||
@@ -36,52 +37,52 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_membership_transactions(customer)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("get_member_transactions")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
begin
|
||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
||||
where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%",)
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
end
|
||||
|
||||
# require "net/http"
|
||||
# def self.url_exist?(url_string)
|
||||
# url = URI.parse(url_string)
|
||||
|
||||
|
||||
# req = Net::HTTP.new(url.host, url.port)
|
||||
# puts "hhhhhhhhhhhh"
|
||||
# puts req.to_json
|
||||
# req.use_ssl = (url.scheme == 'https')
|
||||
# puts "aaaaaaaaaaaa"
|
||||
# puts req.use_ssl?
|
||||
# path = url.path if url.path.present?
|
||||
# puts "bbbbbbbbbbbbb"
|
||||
# puts path
|
||||
# res = req.request_head(path || '/')
|
||||
# puts "cccccccccccccc"
|
||||
# puts res.to_json
|
||||
# puts "ddddddddd"
|
||||
# puts res.kind_of?(Net::HTTPRedirection)
|
||||
# if res.kind_of?(Net::HTTPRedirection)
|
||||
# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL
|
||||
# else
|
||||
# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families
|
||||
# end
|
||||
# rescue Errno::ENOENT
|
||||
# false #false if can't find the server
|
||||
# end
|
||||
|
||||
|
||||
# def self.search(search)
|
||||
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
||||
# end
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
def self.count_customer
|
||||
all = self.all.count+1
|
||||
count = all-2
|
||||
|
||||
end
|
||||
|
||||
WALKIN = "CUS-000000000001"
|
||||
TAKEAWAY = "CUS-000000000002"
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
||||
|
||||
@@ -8,12 +8,21 @@ class DiningFacility < ApplicationRecord
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
def make_available
|
||||
self.status = 'available'
|
||||
self.save
|
||||
end
|
||||
|
||||
def make_occupied
|
||||
self.status = 'occupied'
|
||||
self.save
|
||||
end
|
||||
|
||||
def get_current_booking
|
||||
puts "enter booking"
|
||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
||||
|
||||
if booking.count > 0 then
|
||||
return booking[0].booking_id
|
||||
return booking[0]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -21,10 +30,10 @@ class DiningFacility < ApplicationRecord
|
||||
|
||||
def get_new_booking
|
||||
# query for new
|
||||
# if status
|
||||
# if status
|
||||
# to ask when req bill booking_status?
|
||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is null").limit(1)
|
||||
# else
|
||||
# else
|
||||
# booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id not null").limit(1)
|
||||
# end
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class MenuItem < ApplicationRecord
|
||||
if (!mt_instance.nil?)
|
||||
menu_item = MenuItem.find(mt_instance.menu_item_id)
|
||||
menu_item_hash[:type] = menu_item.type
|
||||
menu_item_hash[:account_id] = menu_item.account_id
|
||||
menu_item_hash[:item_code] = menu_item.item_code
|
||||
menu_item_hash[:item_instance_code] = mt_instance.item_instance_code
|
||||
menu_item_hash[:name] = menu_item.name.to_s + " - " + mt_instance.item_instance_name.to_s
|
||||
|
||||
@@ -4,14 +4,14 @@ class Order < ApplicationRecord
|
||||
#primary key - need to be unique
|
||||
before_create :generate_custom_id
|
||||
before_create :set_order_date
|
||||
|
||||
has_many :sale_orders
|
||||
belongs_to :customer
|
||||
has_many :order_items, autosave: true , inverse_of: :order
|
||||
has_many :assigned_order_items
|
||||
|
||||
#internal references attributes for business logic control
|
||||
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id
|
||||
|
||||
scope :active, -> { where("date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
#Main Controller method to create new order - validate all inputs and generate new order
|
||||
# order_item : {
|
||||
# order_item_code : "",
|
||||
@@ -82,7 +82,7 @@ class Order < ApplicationRecord
|
||||
set_order_items
|
||||
end
|
||||
|
||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name],
|
||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id],
|
||||
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
||||
self.employee_name)
|
||||
|
||||
@@ -231,7 +231,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true)
|
||||
.group("bookings.booking_id")
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||
# For PG
|
||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true
|
||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||
@@ -246,7 +246,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("sales.sale_status='completed'")
|
||||
.group("sales.sale_id")
|
||||
.group("sales.sale_id,bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||
# For PG
|
||||
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||
end
|
||||
@@ -262,7 +262,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true)
|
||||
.group("bookings.booking_id")
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id")
|
||||
# For PG
|
||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true
|
||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id
|
||||
|
||||
@@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord
|
||||
# option_values : [],
|
||||
# sub_order_items : [],
|
||||
# }
|
||||
def self.processs_item (item_code, menu_name, qty,price, options, set_menu_items, order_id, item_order_by)
|
||||
def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
|
||||
|
||||
orderitem = OrderItem.create do |oitem|
|
||||
oitem.order_id = order_id
|
||||
oitem.item_code = item_code
|
||||
oitem.item_name = menu_name
|
||||
oitem.account_id = account_id
|
||||
oitem.qty = qty
|
||||
oitem.price = price
|
||||
oitem.options = options
|
||||
|
||||
@@ -65,11 +65,11 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total, member_info = nil)
|
||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total, member_info = nil,rebate_amount=nil)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info,rebate_amount)
|
||||
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class Room < DiningFacility
|
||||
|
||||
has_many :bookings, :foreign_key => 'dining_facility_id'
|
||||
end
|
||||
|
||||
@@ -15,6 +15,15 @@ class Sale < ApplicationRecord
|
||||
has_many :bookings
|
||||
|
||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
|
||||
REPORT_TYPE = {
|
||||
"daily" => 0,
|
||||
"monthly" => 1,
|
||||
"yearly" => 2
|
||||
}
|
||||
|
||||
SALE_STATUS_COMPLETED = "completed"
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by)
|
||||
booking = Booking.find(booking_id)
|
||||
@@ -23,7 +32,7 @@ class Sale < ApplicationRecord
|
||||
if (booking)
|
||||
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
||||
#get all order attached to this booking and combine into 1 invoice
|
||||
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
if booking.sale_id
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||
@@ -132,6 +141,7 @@ class Sale < ApplicationRecord
|
||||
#pull
|
||||
sale_item.product_code = item.item_code
|
||||
sale_item.product_name = item.item_name
|
||||
sale_item.account_id = item.account_id
|
||||
sale_item.remark = item.remark
|
||||
|
||||
sale_item.qty = item.qty
|
||||
@@ -281,15 +291,15 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.daily_sales_list(from,to)
|
||||
def self.daily_sales_list(from,to)
|
||||
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_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='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_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='credit') 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")
|
||||
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to)
|
||||
@@ -304,27 +314,27 @@ class Sale < ApplicationRecord
|
||||
from_date = sale_date.beginning_of_day.utc - diff
|
||||
to_date = sale_date.end_of_day.utc - diff
|
||||
|
||||
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
||||
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
||||
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
||||
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
||||
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
||||
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
||||
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
|
||||
.where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date)
|
||||
|
||||
|
||||
total_sale.each do |sale|
|
||||
grand_total = sale.grand_total
|
||||
total_discount = sale.total_discount
|
||||
void_amount = sale.void_amount
|
||||
total = {:sale_date => pay.sale_date,
|
||||
void_amount = sale.void_amount
|
||||
total = {:sale_date => pay.sale_date,
|
||||
:mpu_amount => pay.mpu_amount,
|
||||
:master_amount => pay.master_amount,
|
||||
:visa_amount => pay.visa_amount,
|
||||
:jcb_amount => pay.jcb_amount,
|
||||
:paypar_amount => pay.paypar_amount,
|
||||
:cash_amount => pay.cash_amount,
|
||||
:credit_amount => pay.credit_amount,
|
||||
:cash_amount => pay.cash_amount,
|
||||
:credit_amount => pay.credit_amount,
|
||||
:foc_amount => pay.foc_amount,
|
||||
:total_discount => total_discount,
|
||||
:grand_total => grand_total,
|
||||
:total_discount => total_discount,
|
||||
:grand_total => grand_total,
|
||||
:void_amount => void_amount,
|
||||
:rounding_adj => sale.rounding_adj}
|
||||
daily_total.push(total)
|
||||
@@ -334,6 +344,40 @@ class Sale < ApplicationRecord
|
||||
return daily_total
|
||||
end
|
||||
|
||||
def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
|
||||
query = Sale.select("
|
||||
mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total,
|
||||
SUM(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,
|
||||
mi.name as product_name,
|
||||
mc.name as menu_category_name,
|
||||
mc.id as menu_category_id ")
|
||||
.group('mi.id')
|
||||
.order("mi.menu_category_id")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||
|
||||
|
||||
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
||||
|
||||
|
||||
|
||||
case report_type.to_i
|
||||
when REPORT_TYPE["daily"]
|
||||
return query
|
||||
when REPORT_TYPE["monthly"]
|
||||
|
||||
return query.group("MONTH(date)")
|
||||
when REPORT_TYPE["yearly"]
|
||||
return query.group("YEAR(date)")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
@@ -54,8 +54,8 @@ class SalePayment < ApplicationRecord
|
||||
#record an payment in sale-audit
|
||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||
|
||||
return true, self.sale
|
||||
|
||||
return true, self.save
|
||||
else
|
||||
#record an payment in sale-audit
|
||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||
@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
||||
# Control for Paypar Cloud
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
@@ -84,21 +84,24 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
|
||||
if !membership_actions_data.nil?
|
||||
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
merchant_uid = membership_actions_data.merchant_account_id
|
||||
auth_token = membership_actions_data.auth_token
|
||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
if sale_data
|
||||
# Control for Paypar Cloud
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
@@ -199,6 +202,10 @@ class SalePayment < ApplicationRecord
|
||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||
puts 'mmmmmmmmmmmmmmmmmmmmmmmmmmm'
|
||||
puts membership_data.to_json
|
||||
puts "amountttttttttttttttttttttt"
|
||||
puts self.received_amount
|
||||
if membership_data["status"]==true
|
||||
self.payment_method = "paypar"
|
||||
self.payment_amount = self.received_amount
|
||||
@@ -238,10 +245,17 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def table_update_status(sale_obj)
|
||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||
status = true
|
||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||
if booking
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
if table
|
||||
bookings = table.bookings
|
||||
bookings.each do |tablebooking|
|
||||
if tablebooking.sale.sale_status != 'completed'
|
||||
status = false
|
||||
end
|
||||
end
|
||||
if status
|
||||
table.status = "available"
|
||||
table.save
|
||||
end
|
||||
@@ -250,7 +264,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def rebat(sObj)
|
||||
rebate_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||
puts "rebate_prices"
|
||||
puts "eeeeeeeeeeeeeeeeeeeeeeee"
|
||||
puts rebate_prices
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
@@ -274,7 +288,7 @@ class SalePayment < ApplicationRecord
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
# Control for Paypar Cloud
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||
@@ -285,8 +299,8 @@ class SalePayment < ApplicationRecord
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
# puts response.to_json
|
||||
return response
|
||||
# puts response.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Table < DiningFacility
|
||||
has_many :dining_ins
|
||||
|
||||
has_many :bookings, :foreign_key => 'dining_facility_id'
|
||||
end
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
class TableBooking < Booking
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ReceiptBillPdf < 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
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil)
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil,rebate_amount = nil)
|
||||
self.page_width = 210
|
||||
self.page_height = 2500
|
||||
self.margin = 5
|
||||
@@ -32,9 +32,13 @@ class ReceiptBillPdf < Prawn::Document
|
||||
line_items(sale_items, food_total, beverage_total)
|
||||
all_total(sale_data)
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info)
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
|
||||
footer
|
||||
end
|
||||
|
||||
@@ -60,6 +64,15 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
move_down 5
|
||||
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
# text "Customer:", :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
||||
# text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# move_down 5
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.item_width) do
|
||||
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||
@@ -98,7 +111,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "Price", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "Total", :at =>[(self.item_width+self.price_width),y_position], :width => self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "Total", :at =>[(self.item_width+self.price_width+4),y_position], :width => self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
}
|
||||
|
||||
@@ -128,7 +141,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{total_price}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
move_down 3
|
||||
end
|
||||
@@ -200,33 +213,111 @@ class ReceiptBillPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
move_down 5
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Grand Total", :size => self.item_font_size,:align => :left
|
||||
text "Grand Total", :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right
|
||||
text "#{sale_data.grand_total}" , :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
# stroke_horizontal_rule
|
||||
|
||||
sale_payment(sale_data)
|
||||
|
||||
end
|
||||
|
||||
def sale_payment(sale_data)
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
|
||||
y_position = cursor
|
||||
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
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ payment.payment_amount }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
end
|
||||
if sale_data.amount_received > 0
|
||||
y_position = cursor
|
||||
move_down 5
|
||||
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 "#{sale_data.amount_changed}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info)
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data)
|
||||
|
||||
move_down 7
|
||||
if rebate_amount != nil
|
||||
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
rebate_amount["data"].each do |res|
|
||||
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate"
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["redeem"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
if member_info["status"] == true
|
||||
member_info["data"].each do |res|
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ res["accountable_type"] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
|
||||
if res["accountable_type"]== "RebateAccount"
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def customer(customer_name)
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Customer Name", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
def footer
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if (@booking)
|
||||
json.success true
|
||||
json.id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
if Sale.exists?(@booking.sale_id)
|
||||
@@ -43,5 +44,6 @@ if (@booking)
|
||||
json.sub_total @total_amount
|
||||
json.commerical_tax @total_amount * 0.05
|
||||
json.total @total_amount + (@total_amount * 0.05)
|
||||
|
||||
else
|
||||
json.success false
|
||||
end
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
json.array! @customers, :id, :name, :company, :contact_no, :email, :membership_id, :membership_type
|
||||
json.array! @customers, :id, :name, :company, :contact_no,:salution,
|
||||
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||
:membership_id, :created_at
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
json.extract! @customer, :id, :name, :company, :contact_no, :membership_type, :membership_id, :created_at
|
||||
json.extract! @customer, :id, :name, :company, :contact_no,:salution,
|
||||
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||
:membership_id, :created_at
|
||||
json.invoices do
|
||||
json.array! @customer.lastest_invoices ,:id, :receipt_no, :receipt_date, :sale_status, :payment_status
|
||||
end
|
||||
|
||||
49
app/views/api/orders/view_orders.json.jbuilder
Normal file
49
app/views/api/orders/view_orders.json.jbuilder
Normal file
@@ -0,0 +1,49 @@
|
||||
if (@booking)
|
||||
json.success true
|
||||
json.booking_id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
if Sale.exists?(@booking.sale_id)
|
||||
json.sale_status Sale.find(@booking.sale_id).sale_status
|
||||
else
|
||||
json.sale_status ""
|
||||
end
|
||||
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||
json.checkin_by @booking.checkin_by
|
||||
json.table_name @booking.dining_facility.name
|
||||
|
||||
if @booking.type == "TableBooking"
|
||||
json.table_id @booking.dining_facility_id
|
||||
else
|
||||
json.room_id @booking.dining_facility_id
|
||||
end
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
#if (order.status == "new")
|
||||
order_items = order_items + order.order_items
|
||||
#end
|
||||
end
|
||||
|
||||
json.order_items order_items do |item|
|
||||
json.item_instance_code item.item_code
|
||||
json.item_name item.item_name
|
||||
json.price item.price
|
||||
json.qty item.qty
|
||||
json.options item.options
|
||||
json.remark item.remark
|
||||
json.item_status item.order_item_status
|
||||
@total_amount = @total_amount + (item.price * item.qty)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
json.sub_total @total_amount
|
||||
json.commerical_tax @total_amount * 0.05
|
||||
json.total @total_amount + (@total_amount * 0.05)
|
||||
else
|
||||
json.success false
|
||||
end
|
||||
@@ -8,7 +8,7 @@ if @zones
|
||||
json.name table.name
|
||||
json.status table.status
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking table.get_current_booking
|
||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||
end
|
||||
|
||||
json.rooms zone.rooms do |room|
|
||||
@@ -16,7 +16,7 @@ if @zones
|
||||
json.name room.name
|
||||
json.status room.status
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking room.get_current_booking
|
||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||
|
||||
end
|
||||
end
|
||||
@@ -26,7 +26,7 @@ else #list all tables and rooms with out zones
|
||||
json.name table.name
|
||||
json.status table.status
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking table.get_current_booking
|
||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ else #list all tables and rooms with out zones
|
||||
json.name room.name
|
||||
json.status room.status
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
json.current_booking room.get_current_booking
|
||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||
|
||||
|
||||
end
|
||||
|
||||
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog" style="margin-left:-180px">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Modal Header</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Some text in the modal.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="form-group">
|
||||
<select class="selectpicker form-control col-md-12" name="membership_id">
|
||||
<option>Select Member Group</option>
|
||||
<% @member_group.each do |member| %>
|
||||
<option value="<%= member["id"] %>">
|
||||
<%= member["name"] %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
122
app/views/crm/customers/_new_form.html.erb
Normal file
122
app/views/crm/customers/_new_form.html.erb
Normal file
@@ -0,0 +1,122 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gender :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
@@ -11,8 +11,6 @@
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
@@ -26,14 +24,18 @@
|
||||
<td colspan="6">
|
||||
<%= form_tag crm_customers_path, :method => :get do %>
|
||||
<div class="input-append col-md-12 form-group pull-left">
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-md">Search</button>
|
||||
<!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> -->
|
||||
|
||||
<!-- <button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#myModal">Open Modal</button> -->
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Sr.no</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
@@ -42,12 +44,13 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
@@ -57,9 +60,7 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%else%>
|
||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
@@ -67,85 +68,33 @@
|
||||
<%= paginate @crm_customers %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'card_read_form' %>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<%= render 'new_form', crm_customer: @crm_customer %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['name'] %></span>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['email'] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_customers_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
@@ -171,8 +120,28 @@ $(function() {
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_salution').val(data.salution);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
if(data.salution == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
}else if(data.salution == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salution == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
// $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
|
||||
@@ -1,61 +1,74 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= crm_root_path %>">Home</a></li>
|
||||
<li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li>
|
||||
<li><%= @customer.customer_id%></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<!-- Column One -->
|
||||
<div class="tab-pane active" id="queue" role="tabpanel"">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Customer Profile</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @crm_customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><%= @crm_customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact no</th>
|
||||
<td><%= @crm_customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td><%= @crm_customer.company %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Of Birth</th>
|
||||
<td><%= @crm_customer.date_of_birth %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Membership Detail</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<th><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card No</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:created_at, :updated_at,
|
||||
:salution, :gender,:nrc_no,:address,:card_no
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
@@ -1,44 +1,112 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= crm_dining_queues_path %>">Queue</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<%= form_tag crm_assign_table_path, :method => :post do %>
|
||||
<input type="hidden" name="id" value="<%=@queue.id%>">
|
||||
<div class="form-group">
|
||||
<label>Queue No</label>
|
||||
<input type="text" name="queue" class="form-control" readonly="true" value="<%=@queue.queue_no%>">
|
||||
|
||||
</div>
|
||||
<div class="form-inputs">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Table</label>
|
||||
<select class="selectpicker form-control col-md-12" name="table_id" style="height: 40px" >
|
||||
<% @tables.each do |table| %>
|
||||
<option value="<%= table.id %>">
|
||||
<%= table.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-default">Assign Table</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<li>Assign Queue <%=@queue.queue_no%></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
<% @i =0 %>
|
||||
<% DiningFacility.all.each do |table| %>
|
||||
<div class="card assign_table <%= table.status=="available" ? "green" : "red"%>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= @queue.id %></p>
|
||||
<p class="hidden queue-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_dining_queues_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script> -->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).on('click',".assign_table",function(){
|
||||
|
||||
var queue_id = $(this).find(".queue-id").text();
|
||||
var table_id = $(this).attr('data-id');
|
||||
url = '<%= crm_assign_table_path %>';
|
||||
var status = $(this).find(".queue-status").text()
|
||||
|
||||
if (status == "available") {
|
||||
assign_table(queue_id,table_id,url);
|
||||
} else {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'You cannot assign this table',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
function assign_table(id,table_id,url) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
cancel: function () {
|
||||
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url ,
|
||||
data: {id:id,table_id:table_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
window.location.href = '<%=crm_dining_queues_path%>'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,39 +9,41 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" style="max-height:670px; overflow-y:scroll">
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" role="tabpanel">
|
||||
<div class="tab-pane" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @i =0 %>
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<span class="card-title">
|
||||
<%= @i += 1 %> . Queue No </span>
|
||||
<p style="font-size: 30px ;text-align: center;">
|
||||
<strong><%= queue.queue_no %></strong>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
@@ -53,7 +55,7 @@ $(function(){
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
$("#assign").attr("disabled","disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
@@ -0,0 +1,69 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
$(".select-queue").on("click", function(){
|
||||
$('.select-queue').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var status = $(this).find(".queue-status").text();
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
|
||||
});
|
||||
$('#assign').click(function() {
|
||||
var id = $(this).val();
|
||||
window.location.href = "dining_queues/"+id + "/assign"
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
<%= stylesheet_link_tag 'CRM', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'CRM', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to "Daily Sale Report", reports_daily_sale_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", reports_sale_item_index_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid" style="min-height:30px; padding-left:0px !important; padding-right:0px !important; background:#54A5AF; margin-bottom:5px">
|
||||
<div style="padding-top:5px;padding-bottom:5px;margin-left:15px; margin-right:15px;">
|
||||
<div style="float:left;margin-top:3px;text-align:left; width:300px;color:#ffffff">
|
||||
<strong>CASHIER STATION 1 - CLOCK</strong>
|
||||
<div style="float:left;margin-top:3px;text-align:left;color:#ffffff">
|
||||
<strong>Cashier Station 1 - <span id="clockbox"></span></strong>
|
||||
</div>
|
||||
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">
|
||||
<% if current_login_employee %>
|
||||
@@ -10,3 +10,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
tday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
|
||||
tmonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
|
||||
function GetClock(){
|
||||
var d=new Date();
|
||||
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getFullYear();
|
||||
var nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds(),ap;
|
||||
|
||||
if(nhour==0){ap=" AM";nhour=12;}
|
||||
else if(nhour<12){ap=" AM";}
|
||||
else if(nhour==12){ap=" PM";}
|
||||
else if(nhour>12){ap=" PM";nhour-=12;}
|
||||
|
||||
if(nmin<=9) nmin="0"+nmin;
|
||||
if(nsec<=9) nsec="0"+nsec;
|
||||
|
||||
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
|
||||
}
|
||||
|
||||
window.onload=function(){
|
||||
GetClock();
|
||||
setInterval(GetClock,1000);
|
||||
}
|
||||
</script>
|
||||
<div id="clockbox"></div>
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -23,7 +25,7 @@
|
||||
<%=message%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= crm_root_path %>">Home</a></li>
|
||||
<!-- <li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li> -->
|
||||
<!-- <a href="<%= new_crm_customer_path%>" class="btn btn-primary pull-right">
|
||||
<i class="fa fa-plus-circle fa-lg"></i> Add Customer
|
||||
</a> -->
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@@ -15,11 +9,11 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
@@ -35,6 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Sr.no</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
@@ -44,17 +39,19 @@
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
<td><%= crm_customer.email %></td>
|
||||
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -64,7 +61,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
|
||||
<%= paginate @crm_customers %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,31 +76,85 @@
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['name'] %></span>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gender :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<span class="help-block"><%= msg['email'] %></span>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
@@ -116,7 +167,7 @@
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -133,8 +184,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
@@ -156,13 +205,13 @@
|
||||
// var url = "/"+customer_id;
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
|
||||
|
||||
var url = "customers/"+customer_id;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
@@ -176,6 +225,25 @@
|
||||
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
$('#customer_salution').val(data.salution);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
if (data.salution == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
} else if(data.salution == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salution == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
@@ -190,7 +258,7 @@
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
|
||||
|
||||
// }
|
||||
})
|
||||
|
||||
@@ -199,41 +267,36 @@
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
|
||||
cancel: function () {
|
||||
|
||||
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "update_sale" ,
|
||||
data: {customer_id:customer_id,sale_id:sale_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
window.location.href = '/origami'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Order Details -->
|
||||
<div class="card" >
|
||||
<!-- <div class="card-header">
|
||||
@@ -31,8 +30,9 @@
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||
<tr class="discount-item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
@@ -62,7 +62,7 @@
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@sale_data.total_discount rescue 0%>)</strong></td>
|
||||
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
@@ -75,104 +75,476 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<!-- Discount Amount -->
|
||||
<div class="card row">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Overall Discount</strong></div>
|
||||
<div><strong id="order-title">Discount Control</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
<select name="discount_type" id="discount-type" class="form-control">
|
||||
<option value=0 >Net</option>
|
||||
<option value=1 >Percentage</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<button id="pay-discount" class="btn btn-primary long">Discount</button>
|
||||
<div class="form-group">
|
||||
<%
|
||||
@accounts.each do |acc|
|
||||
%>
|
||||
<button id="account-<%= acc.id %>" class="accounts-type btn btn-default"><%= acc.title %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5" data-type="add">5%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="5" data-type="add">5%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10" data-type="add">10%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="10" data-type="add">10%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50" data-type="add">50%</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="50" data-type="add">50%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number"></div>
|
||||
<div class="col-md-4 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-4 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<button id="net" class="btn btn-warning fluid action-btn">Net</button>
|
||||
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
|
||||
<button id="pay-discount" class="btn btn-danger fluid action-btn">Enter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
// update_balance();
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
// update_balance();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
// update_balance();
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
// update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
// update_balance();
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Select Sale Item
|
||||
$('.item-row').on('click',function(){
|
||||
if($(this).hasClass('selected-item') == true){
|
||||
$(this).removeClass('selected-item');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-item');
|
||||
}
|
||||
});
|
||||
|
||||
// Select for account types
|
||||
$(".accounts-type").on('click', function(e){
|
||||
if($(this).hasClass('selected-account') == true){
|
||||
$(this).removeClass('selected-account');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-account');
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Net Discount for Payment
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(0, discount_value);
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Percentage Discount for Payment
|
||||
$("#percentage").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(1, discount_value);
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(1, discount_value, sale_items, account_types);
|
||||
}
|
||||
});
|
||||
|
||||
// Pay Discount
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_items = JSON.stringify(get_discount_item_rows());
|
||||
var overall_discount = $("#order-discount").text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
// var sale_item_id = $('.selected-item').attr('id').substr(0,16);
|
||||
// var sub_total = $('#order-sub-total').text();
|
||||
// var grand_total = $('#order-grand-total').text();
|
||||
// var discount_type = $('#discount-type').val();
|
||||
// var discount_value = $('#discount-amount').val();
|
||||
// var discount_amount = discount_value;
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
alert("Successfully Discount!");
|
||||
window.history.back();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
// if(discount_type == 1){
|
||||
// discount_amount=(sub_total*discount_amount)/100;
|
||||
// }
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
|
||||
/* Get Item rows but not discount*/
|
||||
function get_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.item-row').not('.discount-item-row').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get discount Item rows */
|
||||
function get_discount_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.discount-item-row').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id');
|
||||
sale_item.name = $(this).find('#item-name-price').text();
|
||||
sale_item.account_id = $(this).find('#item_account_type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
|
||||
/* Get Selected Sale Item's ID and Price */
|
||||
function get_selected_sale_items(){
|
||||
var sale_items = [];
|
||||
$('.selected-item').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get Selected Accounts ID and Price */
|
||||
function get_selected_account_types(){
|
||||
var account_types = [];
|
||||
|
||||
$('.selected-account').each(function(i){
|
||||
var account= {};
|
||||
account.id = $(this).attr('id').substr(8);
|
||||
account.name = $(this).text();
|
||||
account_types.push(account);
|
||||
});
|
||||
return account_types;
|
||||
}
|
||||
|
||||
/* Calculate Overall Discount*/
|
||||
function calculate_overall_discount(type, amount){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
total_discount = amount;
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
}
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
|
||||
$("#order-discount").text(total_discount);
|
||||
}
|
||||
|
||||
/* Calculate Items Discount*/
|
||||
function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total - total_discount;
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check account types exists
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
console.log(account_types);
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
}
|
||||
|
||||
function item_row_template(type, item, discount_amount, amount){
|
||||
var dis_str = "-discount";
|
||||
if(type == 1){
|
||||
dis_str = dis_str + "(" + amount + "%)"
|
||||
}
|
||||
var discount_item_row = "<tr class='item-row discount-item-row' id='" + item.id + "'>" +
|
||||
"<td style='width: 60%; text-align: left;'>" +
|
||||
"<span id='item_account_type' class='hidden'>" +
|
||||
item.account_id +
|
||||
"</span>" +
|
||||
"<span id='item-name-price'>" +
|
||||
item.name + dis_str +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-qty'>1</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-total-price'>" +
|
||||
discount_amount +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"</tr>";
|
||||
return discount_item_row;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,388 +1,186 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="Completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@completed_orders.each do |cpo|
|
||||
# ToDo no need check new
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id = ""
|
||||
customer_id = ""
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="Completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
# For CSS- Class for Order? Sale?
|
||||
# sale_status=""
|
||||
# if cpo.order_status == 'new'
|
||||
# unique_id=cpo.booking_id
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
Zone <%= table.zone_id %> <br>
|
||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
Zone <%= table.zone_id %> <br>
|
||||
Table <%= table.name %> ( <%= table.seater %> Seat )
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
# customer_id=cpo.order_customer_id
|
||||
# # check selected item and assign
|
||||
# if @selected_item_type == "Sale"
|
||||
# if cpo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
unique_id=cpo.sale_id
|
||||
customer_id=cpo.sale_customer_id
|
||||
sale_status="paid"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= cpo.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= cpo.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= cpo.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= cpo.sale_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.order_id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_orders.each do |bko|
|
||||
# No Show completed
|
||||
if bko.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if bko.order_status == 'new'
|
||||
unique_id=bko.booking_id
|
||||
customer_id=bko.order_customer_id
|
||||
# check selected item and assign
|
||||
# if @selected_item != nil
|
||||
# if bko.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=bko.sale_id
|
||||
customer_id=bko.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= bko.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= bko.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= bko.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_rooms.each do |rmo|
|
||||
# No Show completed
|
||||
if rmo.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
|
||||
if rmo.order_status == 'new'
|
||||
unique_id=rmo.booking_id
|
||||
customer_id=rmo.order_customer_id
|
||||
# check selected item and assign
|
||||
# if @selected_item != nil
|
||||
# if rmo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=rmo.sale_id
|
||||
customer_id=rmo.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= rmo.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= rmo.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= rmo.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
# No Show completed
|
||||
if odr.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
|
||||
if odr.order_status == 'new'
|
||||
unique_id=odr.booking_id
|
||||
customer_id = odr.order_customer_id
|
||||
# if @selected_item != nil
|
||||
# if odr.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=odr.sale_id
|
||||
customer_id = odr.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= odr.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= odr.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= odr.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS -</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Receipt No: <span id="receipt_no"><%=@selected_item.receipt_no rescue ' '%></span></p>
|
||||
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
# For Sale Items
|
||||
sub_total = 0
|
||||
if @selected_item_type == "Sale"
|
||||
@selected_item.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<%
|
||||
# For Order Items
|
||||
if @selected_item_type == "Order"
|
||||
@selected_item.order_items.each do |order_item|
|
||||
sub_total = sub_total + (order_item.qty*order_item.price)
|
||||
%>
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Food:</strong></td>
|
||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
|
||||
</tr> -->
|
||||
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
$(function() {
|
||||
var timer;
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-lg btn-block">Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block">Pay</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-lg btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
function start() {
|
||||
timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 30000); //10000
|
||||
};
|
||||
|
||||
function stop() {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
|
||||
if(localStorage.getItem("refreshflag") != null){
|
||||
if (localStorage.getItem("refreshflag") == 0) {
|
||||
$('#refreshbutton').html("Refresh off");
|
||||
$('#refreshbutton').css("background-color","red");
|
||||
stop();
|
||||
}
|
||||
else{
|
||||
$('#refreshbutton').html("Refresh on");
|
||||
$('#refreshbutton').css("background-color","green");
|
||||
start();
|
||||
}
|
||||
}
|
||||
else{
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
}
|
||||
var url = location.href;
|
||||
if (location.href.slice(-1) == "/"){
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
var arr = url.split("/");
|
||||
|
||||
if(arr[arr.length-1] != "origami"){
|
||||
stop();
|
||||
}
|
||||
$('#refreshbutton').bind("click", function(){
|
||||
if(localStorage.getItem("refreshflag") == "0"){
|
||||
localStorage.setItem("refreshflag", 1);
|
||||
$(this).html("Refresh on");
|
||||
$(this).css("background-color","green");
|
||||
// $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
|
||||
start();
|
||||
}
|
||||
else{
|
||||
stop();
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
$(this).html("Refresh off");
|
||||
$(this).css("background-color","red");
|
||||
}
|
||||
});
|
||||
function refreshing(){
|
||||
if(localStorage.getItem("refreshflag") == "0"){
|
||||
localStorage.setItem("refreshflag", 1);
|
||||
$(this).html("Refresh on");
|
||||
$(this).css("background-color","green");
|
||||
// $(this).html("Auto Refresh on<span class='glyphicon glyphicon-ok'></span>");
|
||||
start();
|
||||
}
|
||||
else{
|
||||
stop();
|
||||
localStorage.setItem("refreshflag", 0);
|
||||
$(this).html("Refresh off");
|
||||
$(this).css("background-color","red");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
388
app/views/origami/home/index_bk.html.erb
Normal file
388
app/views/origami/home/index_bk.html.erb
Normal file
@@ -0,0 +1,388 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="Completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@completed_orders.each do |cpo|
|
||||
# ToDo no need check new
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id = ""
|
||||
customer_id = ""
|
||||
|
||||
# For CSS- Class for Order? Sale?
|
||||
# sale_status=""
|
||||
# if cpo.order_status == 'new'
|
||||
# unique_id=cpo.booking_id
|
||||
|
||||
# customer_id=cpo.order_customer_id
|
||||
# # check selected item and assign
|
||||
# if @selected_item_type == "Sale"
|
||||
# if cpo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
unique_id=cpo.sale_id
|
||||
customer_id=cpo.sale_customer_id
|
||||
sale_status="paid"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= cpo.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= cpo.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= cpo.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= cpo.sale_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_orders.each do |bko|
|
||||
# No Show completed
|
||||
if bko.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if bko.order_status == 'new'
|
||||
unique_id=bko.booking_id
|
||||
customer_id=bko.order_customer_id
|
||||
# check selected item and assign
|
||||
# if @selected_item != nil
|
||||
# if bko.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=bko.sale_id
|
||||
customer_id=bko.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= bko.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= bko.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= bko.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_rooms.each do |rmo|
|
||||
# No Show completed
|
||||
if rmo.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
|
||||
if rmo.order_status == 'new'
|
||||
unique_id=rmo.booking_id
|
||||
customer_id=rmo.order_customer_id
|
||||
# check selected item and assign
|
||||
# if @selected_item != nil
|
||||
# if rmo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=rmo.sale_id
|
||||
customer_id=rmo.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= rmo.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= rmo.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= rmo.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
# No Show completed
|
||||
if odr.sale_status == 'completed'
|
||||
next
|
||||
end
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
customer_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
|
||||
if odr.order_status == 'new'
|
||||
unique_id=odr.booking_id
|
||||
customer_id = odr.order_customer_id
|
||||
# if @selected_item != nil
|
||||
# if odr.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=odr.sale_id
|
||||
customer_id = odr.sale_customer_id
|
||||
sale_status="sold"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<p class="hidden customer-id"><%= customer_id %></p>
|
||||
<p class="hidden order-cid"><%= odr.order_id %></p>
|
||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
<%= odr.receipt_no %>
|
||||
</span>
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status"><%= odr.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS -</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Receipt No: <span id="receipt_no"><%=@selected_item.receipt_no rescue ' '%></span></p>
|
||||
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
# For Sale Items
|
||||
sub_total = 0
|
||||
if @selected_item_type == "Sale"
|
||||
@selected_item.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<%
|
||||
# For Order Items
|
||||
if @selected_item_type == "Order"
|
||||
@selected_item.order_items.each do |order_item|
|
||||
sub_total = sub_total + (order_item.qty*order_item.price)
|
||||
%>
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Food:</strong></td>
|
||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
|
||||
</tr> -->
|
||||
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-lg btn-block">Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block">Pay</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-lg btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
363
app/views/origami/home/show.html.erb
Normal file
363
app/views/origami/home/show.html.erb
Normal file
@@ -0,0 +1,363 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.order_id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
puts @sale_array[0]
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
unless @order_items.nil?
|
||||
count = 0
|
||||
@order_items.each do |order_item |
|
||||
puts @order_items.size
|
||||
puts "view"
|
||||
count += 1
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price == 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<% if @status_sale == "sale" %>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<%
|
||||
if @status_sale == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Pending New Order
|
||||
<table class="table table-striped">
|
||||
<%
|
||||
@order_items.each do |order_item |
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary'> Add to existing invoice </button>
|
||||
<%
|
||||
else
|
||||
@sale_array.each do |sale|
|
||||
if @sale_array.size > 1
|
||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||
%>
|
||||
Pending New Invoice
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Receipt No - <%= sale.receipt_no %></td>
|
||||
<td><button class='btn btn-sm btn-primary '>Show Detail </button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<% if @dining.bookings.length >= 1 %>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||
<% if @status_order == 'order' %>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||
<% else %>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
});
|
||||
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
});
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
});
|
||||
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
});
|
||||
|
||||
// bind customer to order or sale
|
||||
$("#customer").on('click', function(){
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale!="") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale!="") {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
|
||||
if(sale_id!=""){
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
|
||||
$('#request_bills').click(function() {
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#move').on('click',function(){
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/movetable";
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
</script>
|
||||
@@ -68,9 +68,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"><i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -134,6 +134,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -133,6 +133,10 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
207
app/views/origami/moveroom/move_dining.html.erb
Normal file
207
app/views/origami/moveroom/move_dining.html.erb
Normal file
@@ -0,0 +1,207 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - s -->
|
||||
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title"> MOVE --> <span style='color:red'>' <%= @dining.name %>' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
||||
<input type='hidden' id="change_table_value" value="" />
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @obj_sale.receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
@obj_sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order'
|
||||
unless @order_items.nil?
|
||||
@order_items.each do |order_item |
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pay purple" id="move_table">MOVE TABLE</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
$('.tables').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
$('#moved').text(" ' " + dining_name + " ' ")
|
||||
$('#change_table_value').val(dining_id);
|
||||
})
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
$('.rooms').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
$('#moved').text(dining_name)
|
||||
$('#change_table_value').val(dining_id);
|
||||
})
|
||||
|
||||
$('#move_table').on('click',function(){
|
||||
change_to = $('#change_table_value').val();
|
||||
change_from = "<%= @dining.id %>";
|
||||
if (change_to == ""){
|
||||
alert("Please Select Room")
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_moving_path %>",
|
||||
data: "change_from="+ change_from + "&change_to=" + change_to,
|
||||
success:function(result){
|
||||
alert("Moving Success")
|
||||
if (result.get_type == 'Table'){
|
||||
window.location.href = '/origami/table/' + change_to;
|
||||
}else{
|
||||
window.location.href = '/origami/room/' + change_to;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
|
||||
})
|
||||
</script>
|
||||
258
app/views/origami/movetable/move_dining.html.erb
Normal file
258
app/views/origami/movetable/move_dining.html.erb
Normal file
@@ -0,0 +1,258 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - s -->
|
||||
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
||||
<input type='hidden' id="change_table_value" value="" />
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
puts @sale_array[0]
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
unless @order_items.nil?
|
||||
count = 0
|
||||
@order_items.each do |order_item |
|
||||
puts @order_items.size
|
||||
puts "view"
|
||||
count += 1
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%
|
||||
if @status_sale == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Pending New Order
|
||||
<table class="table table-striped">
|
||||
<%
|
||||
@order_items.each do |order_item |
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary'> Add to existing invoice </button>
|
||||
<%
|
||||
else
|
||||
@sale_array.each do |sale|
|
||||
if @sale_array.size > 1
|
||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||
%>
|
||||
Pending New Invoice
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>Receipt No - <%= sale.receipt_no %></td>
|
||||
<td><button class='btn btn-sm btn-primary '>Show Detail </button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pay purple" id="move_table">MOVE TABLE</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
$('.tables').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
$('#moved').text(" ' " + dining_name + " ' ")
|
||||
$('#change_table_value').val(dining_id);
|
||||
})
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
$('.rooms').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
$('#moved').text(dining_name)
|
||||
$('#change_table_value').val(dining_id);
|
||||
})
|
||||
|
||||
$('#move_table').on('click',function(){
|
||||
change_to = $('#change_table_value').val();
|
||||
change_from = "<%= @dining.id %>";
|
||||
if (change_to == ""){
|
||||
alert("Please Select Table")
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_moving_path %>",
|
||||
data: "change_from="+ change_from + "&change_to=" + change_to,
|
||||
success:function(result){
|
||||
alert("Moving Success")
|
||||
if (result.get_type == 'Table'){
|
||||
window.location.href = '/origami/table/' + change_to;
|
||||
}else{
|
||||
window.location.href = '/origami/room/' + change_to;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/table/'+ "<%= @dining.id %>";
|
||||
})
|
||||
</script>
|
||||
2
app/views/origami/movetable/moving.json.jbuilder
Normal file
2
app/views/origami/movetable/moving.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.status true
|
||||
json.get_type @get_type
|
||||
@@ -68,9 +68,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -133,6 +133,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
|
||||
214
app/views/origami/orders/show.html.erb
Normal file
214
app/views/origami/orders/show.html.erb
Normal file
@@ -0,0 +1,214 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane " id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
sale_order = SaleOrder.find_by_order_id(order)
|
||||
if sale_order
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
end
|
||||
else
|
||||
order_status = order.status
|
||||
end
|
||||
%>
|
||||
<%= order.order_id %> | <%= order_status %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDERS DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @order.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
@order.order_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.item_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
<% if @sale_status != 'completed' %>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move'>MOVE</button>
|
||||
<% end %>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
$('#move').on('click',function(){
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-11col-md-11 col-sm-11">
|
||||
<div >
|
||||
<div >
|
||||
<% @payment_method_setting.each do |payment_method|%>
|
||||
@@ -8,6 +8,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -16,4 +20,8 @@ $('.others-payment').on('click',function(){
|
||||
var sale_id = $(this).attr("data-sale-id");
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/" + input_type;
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/sale/<%= @sale_id %>/payment/';
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -90,31 +90,30 @@
|
||||
<div class="col-md-8"><strong style="font-size:18px;">Amount Due</strong></div>
|
||||
<div class="col-md-4"><strong><span id="amount_due" style="font-size:18px;"><%= @sale_data.grand_total %></span></strong></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<br>
|
||||
<div class="row payment cash-color">
|
||||
<div class="col-md-8">Cash</div>
|
||||
<div class="col-md-4" id="cash" ><%= @cash %></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" id="credit_payment">
|
||||
|
||||
<div class="row payment credit-color" id="credit_payment" >
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="row payment other-payment-color" id="card_payment" style="line-height:30px;height: 30px;margin-bottom: 0px;" >
|
||||
<div class="col-md-12">Other Payments</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- mpu -->
|
||||
<% if @other != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
@@ -128,7 +127,7 @@
|
||||
<% end %>
|
||||
<!-- paypar -->
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Paypar</div>
|
||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||
@@ -142,7 +141,7 @@
|
||||
<% end %>
|
||||
<!-- Visa -->
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Visa</div>
|
||||
<div class="col-md-4" id="visacount"><%= @visacount %></div>
|
||||
@@ -156,7 +155,7 @@
|
||||
<% end %>
|
||||
<!-- JCB -->
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= @jcbcount %></div>
|
||||
@@ -170,7 +169,7 @@
|
||||
<% end %>
|
||||
<!-- Master -->
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Master</div>
|
||||
<div class="col-md-4" id="mastercount"><%= @mastercount %></div>
|
||||
@@ -182,12 +181,12 @@
|
||||
<div class="col-md-4" id="mastercount">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<hr>
|
||||
<hr class="style2">
|
||||
<div class="row">
|
||||
<div class="col-md-8">Balance</div>
|
||||
<div class="col-md-4"><span id='balance'><%= @sale_data.grand_total %></span></div>
|
||||
</div>
|
||||
<hr>
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -212,9 +211,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number" data-type="nett">Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett">Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -235,7 +234,7 @@
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> <i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
||||
<button type="button" class="btn btn-primary btn-block"> Void </button>
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-type="nett">Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett">Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -129,6 +129,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
alert($('#valid_amount').text())
|
||||
$('#used_amount').text($('#valid_amount').text());
|
||||
|
||||
1
app/views/origami/request_bills/print.json.jbuilder
Normal file
1
app/views/origami/request_bills/print.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
274
app/views/origami/rooms/show.html.erb
Normal file
274
app/views/origami/rooms/show.html.erb
Normal file
@@ -0,0 +1,274 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.order_id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<% if @status == "order" %>
|
||||
<div><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<% else %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<% if @status == 'sale' %>
|
||||
<%= @obj.receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @obj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
if @status == "sale"
|
||||
@obj.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status == 'order'
|
||||
unless @order_items.nil?
|
||||
@order_items.each do |order_item |
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<% if @status == "sale" %>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @obj.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @obj.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<%
|
||||
if @status == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Added New Order
|
||||
<table class="table table-striped">
|
||||
<%
|
||||
@order_items.each do |order_item |
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary'> Add to existing invoice </button>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id="move">Move</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
$('#move').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/moveroom";
|
||||
})
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
</script>
|
||||
215
app/views/origami/sales/show.html.erb
Normal file
215
app/views/origami/sales/show.html.erb
Normal file
@@ -0,0 +1,215 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.order_id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p> Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
<button type="button" id="void" class="btn btn-primary btn-block">VOID</button>
|
||||
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
});
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
@@ -68,9 +68,9 @@
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number green" data-type="nett" >Nett</div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"><i class="fa fa-arrow-left fa-lg"></i> Back </button>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -133,6 +133,7 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
|
||||
@@ -145,68 +145,7 @@ $(function(){
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
$("#branch").val(<%=params[:branch]%>);
|
||||
$("#waiter").val("<%=params[:waiter]%>");
|
||||
$("#cashier").val(<%=params[:cashier]%>);
|
||||
$("#product").val(<%=params[:product]%>);
|
||||
$("#singer").val(<%=params[:singer]%>);
|
||||
$("#item").val('<%=params[:item]%>');
|
||||
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||
|
||||
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -32,16 +32,16 @@
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr.no</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily Discount)</th>
|
||||
<th style='text-align:center;'>Void Amount</th>
|
||||
<th style='text-align:center;'>Mpu Sales</th>
|
||||
<th style='text-align:center;'>Master Sales</th>
|
||||
<th style='text-align:center;'>Visa Sales</th>
|
||||
<th style='text-align:center;'>Jcb Sales</th>
|
||||
<th style='text-align:center;'>Paypar Sales</th>
|
||||
<th style='text-align:center;'>Cash Sales</th>
|
||||
<th style='text-align:center;'>Credit Sales</th>
|
||||
<th style='text-align:center;'>FOC Sales</th>
|
||||
<th style='text-align:center;'>(Discount)</th>
|
||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Grand Total</th>
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr.no</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily Discount)</th>
|
||||
<th style='text-align:center;'>Void Amount</th>
|
||||
<th style='text-align:center;'>Mpu Sales</th>
|
||||
<th style='text-align:center;'>Master Sales</th>
|
||||
<th style='text-align:center;'>Visa Sales</th>
|
||||
<th style='text-align:center;'>Jcb Sales</th>
|
||||
<th style='text-align:center;'>Paypar Sales</th>
|
||||
<th style='text-align:center;'>Cash Sales</th>
|
||||
<th style='text-align:center;'>Credit Sales</th>
|
||||
<th style='text-align:center;'>FOC Sales</th>
|
||||
<th style='text-align:center;'>(Discount)</th>
|
||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Grand Total</th>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,7 +30,9 @@
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<th style='text-align:center;'>CT</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -48,7 +50,10 @@
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<input type="hidden" name="report_type" value="sale_item" id="sel_sale_type">
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label>Select Type</label>
|
||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||
<option value="0">All Sale Type</option>
|
||||
@@ -28,7 +29,7 @@
|
||||
<option value="4">Taxes Only</option>
|
||||
<option value="5">Other Amount Only</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
@@ -143,69 +144,13 @@ $(function(){
|
||||
$('#frm_report').submit();
|
||||
// window.location = url;
|
||||
});
|
||||
|
||||
function export_to(path)
|
||||
{
|
||||
var form_params = $("#frm_report").serialize();
|
||||
window.location = path+"?"+ form_params;
|
||||
}
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
$("#branch").val(<%=params[:branch]%>);
|
||||
$("#waiter").val("<%=params[:waiter]%>");
|
||||
$("#cashier").val(<%=params[:cashier]%>);
|
||||
$("#product").val(<%=params[:product]%>);
|
||||
$("#singer").val(<%=params[:singer]%>);
|
||||
$("#item").val('<%=params[:item]%>');
|
||||
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||
|
||||
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
<% else %>
|
||||
$("#rd_period_type_0").attr("checked","checked");
|
||||
<% end %>
|
||||
$(".btn-group button").removeClass("active");
|
||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||
|
||||
$('#item').change(function(){
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
|
||||
if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
141
app/views/reports/sale_item/index.html.erb
Normal file
141
app/views/reports/sale_item/index.html.erb
Normal file
@@ -0,0 +1,141 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Daily Sale Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_item_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_sale_item_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th id="date"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Menu Category</th>
|
||||
<th>Code</th>
|
||||
<th>Product</th>
|
||||
<th>Total Item</th>
|
||||
<th>Unit Price</th>
|
||||
<th>Revenue</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
var cate = [];
|
||||
var y;
|
||||
var count = 0;
|
||||
var sub_total = 0;
|
||||
var sub_total_arr = [];
|
||||
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
count = count + 1;
|
||||
if(count == 1)
|
||||
$('#date').append('<%= result.date_name rescue '-'%>');
|
||||
|
||||
y = $.inArray(<%= result.menu_category_id %>, cate);
|
||||
if(y == -1){
|
||||
//add sub total row
|
||||
sub_total_arr.push(sub_total);
|
||||
var total_row = '<tr><td colspan="4"></td>'+
|
||||
'<td > Sub Total</td> ' +
|
||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
||||
'</tr>';
|
||||
|
||||
|
||||
if(count != 1){
|
||||
$('.table').append(total_row);
|
||||
sub_total = 0;
|
||||
}
|
||||
|
||||
cate.push(<%= result.menu_category_id %>);
|
||||
var th = '<tr><td colspan="6"><%= result.menu_category_name rescue '-'%></td></tr>';
|
||||
var tr = '<tr>'+
|
||||
'<td></td>'+
|
||||
'<td><%= result.code rescue '-'%></td>' +
|
||||
'<td><%= result.product_name rescue '-'%></td>' +
|
||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%>'+
|
||||
'</td>'+
|
||||
'</tr>';
|
||||
|
||||
|
||||
$('.table').append(th);
|
||||
$('.table').append(tr);
|
||||
|
||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
||||
}
|
||||
else{
|
||||
var tr = '<tr>'+
|
||||
'<td></td>'+
|
||||
'<td><%= result.code rescue '-'%></td>' +
|
||||
'<td><%= result.product_name rescue '-'%></td>' +
|
||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%></td></tr>';
|
||||
$('.table').append(tr);
|
||||
|
||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
||||
}
|
||||
|
||||
<% end %>
|
||||
|
||||
last_line_subtotal(sub_total);
|
||||
sub_total_arr.push(parseInt(sub_total));
|
||||
grand_total(sub_total_arr);
|
||||
})
|
||||
|
||||
function last_line_subtotal(sub_total){
|
||||
|
||||
var total_row = '<tr><td colspan="4"></td>'+
|
||||
'<td > Sub Total</td> ' +
|
||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
||||
'</tr>';
|
||||
|
||||
$('.table').append(total_row);
|
||||
}
|
||||
|
||||
function grand_total(sub_total_arr){
|
||||
|
||||
var total = 0;
|
||||
for(var i=0; i< sub_total_arr.length; i++){
|
||||
//total_1 = (total_1) + (sub_total_arr[i]);
|
||||
total = parseInt(total) + parseInt(sub_total_arr[i]);
|
||||
}
|
||||
var row = '<tr><td colspan="4"></td>'+
|
||||
'<td > Grand Total</td> ' +
|
||||
'<td><span class="double_underline">'+ total +'</span></td>'+
|
||||
'</tr>';
|
||||
$('.table').append(row);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
116
app/views/reports/sale_item/index.xls.erb
Normal file
116
app/views/reports/sale_item/index.xls.erb
Normal file
@@ -0,0 +1,116 @@
|
||||
<div class="card row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<% if params[:from]%>
|
||||
<tr>
|
||||
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Sr.no</th>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Daily Void Amount</th>
|
||||
<th style='text-align:center;'>Daily mpu Sales</th>
|
||||
<th style='text-align:center;'>Daily master Sales</th>
|
||||
<th style='text-align:center;'>Daily visa Sales</th>
|
||||
<th style='text-align:center;'>Daily jcb Sales</th>
|
||||
<th style='text-align:center;'>Daily paypar Sales</th>
|
||||
<th style='text-align:center;'>Daily Cash Sales</th>
|
||||
<th style='text-align:center;'>Daily Credit Sales</th>
|
||||
<th style='text-align:center;'>Daily FOC Sales</th>
|
||||
<th style='text-align:center;'>(Daily Discount)</th>
|
||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Rounding Adj.</th>
|
||||
<th style='text-align:center;'>Grand Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% unless @sale_data.empty? %>
|
||||
|
||||
<tbody>
|
||||
<% void = 0 %>
|
||||
<% mpu = 0 %>
|
||||
<% master = 0 %>
|
||||
<% visa = 0 %>
|
||||
<% jcb = 0 %>
|
||||
<% paypar = 0 %>
|
||||
<% cash = 0 %>
|
||||
<% credit = 0 %>
|
||||
<% foc = 0 %>
|
||||
<% discount = 0 %>
|
||||
<% total = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% count = 1 %> <% rounding_adj = 0 %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% void += sale[:void_amount] %>
|
||||
<% mpu += sale[:mpu_amount] %>
|
||||
<% master += sale[:master_amount] %>
|
||||
<% visa += sale[:visa_amount] %>
|
||||
<% jcb += sale[:jcb_amount] %>
|
||||
<% paypar += sale[:paypar_amount] %>
|
||||
<% cash += sale[:cash_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||
<% grand_total += sale[:grand_total].to_f %>
|
||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||
<tr>
|
||||
<td style='text-align:right;'><%= count %></td>
|
||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
<% end %>
|
||||
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="3" style='text-align:center;'>Total</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% net = total - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<td><%= @sale.receipt_no %></td>
|
||||
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= @sale.sale_status %> </td>
|
||||
<td> <%= @sale.requested_at %> </td>
|
||||
<td> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<th>Sale item name</th>
|
||||
@@ -175,63 +175,63 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
|
||||
<div class="table-responsive">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Customer Profile</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><%= @customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact no</th>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td><%= @customer.company %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Of Birth</th>
|
||||
<td><%= @customer.date_of_birth %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Membership Detail</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<th><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card No</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,3 +3,4 @@ require_relative 'application'
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# --- Waiter/ Cashier - Orgiami ----
|
||||
Rails.application.config.assets.precompile += %w( origami.css )
|
||||
Rails.application.config.assets.precompile += %w( origami.js )
|
||||
# Rails.application.config.assets.precompile += %w( origami.js )
|
||||
# -- Order Queue Station -----
|
||||
Rails.application.config.assets.precompile += %w( OQS.css )
|
||||
Rails.application.config.assets.precompile += %w( OQS.js )
|
||||
@@ -22,3 +22,7 @@ Rails.application.config.assets.precompile += %w( settings.css )
|
||||
# --- Customer/ Customer - Crm ----
|
||||
Rails.application.config.assets.precompile += %w( CRM.css )
|
||||
Rails.application.config.assets.precompile += %w( CRM.js )
|
||||
|
||||
# --- Customer/ Customer - Crm ----
|
||||
Rails.application.config.assets.precompile += %w( jquery-confirm.css )
|
||||
Rails.application.config.assets.precompile += %w( jquery-confirm.js )
|
||||
|
||||
@@ -44,10 +44,9 @@ Rails.application.routes.draw do
|
||||
|
||||
#Order Controller
|
||||
resources :orders, only: [:create, :show, :update] do
|
||||
|
||||
post "bill" => "bill#create"
|
||||
|
||||
end
|
||||
get 'view_orders' => "orders#view_orders"
|
||||
|
||||
#Current active bookings
|
||||
resources :bookings, only: [:index, :show, :create, :update]
|
||||
@@ -72,17 +71,24 @@ Rails.application.routes.draw do
|
||||
#--------- Cashier ------------#
|
||||
namespace :origami do
|
||||
root "home#index"
|
||||
get "/:booking_id" => "home#index" do #origami/:booking_id will show
|
||||
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
|
||||
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||
resources :customers #add customer type
|
||||
end
|
||||
post 'moving' => "movetable#moving"
|
||||
|
||||
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
||||
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
||||
get 'sale/:sale_id' => 'sales#show'
|
||||
get 'room/:room_id' => 'rooms#show'
|
||||
get 'order/:order_id' => "orders#show"
|
||||
|
||||
post '/:booking_id' => 'home#item_show'
|
||||
|
||||
get "/:id/discount" => "discounts#index"
|
||||
post "/:id/discount" => "discounts#create"
|
||||
|
||||
get "/:id/request_bills" => "request_bills#print"
|
||||
post "/:id/request_bills" => "request_bills#print" ,:defaults => { :format => 'json' }
|
||||
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
||||
#--------- Payment ------------#
|
||||
get 'sale/:sale_id/payment' => 'payments#show'
|
||||
@@ -212,6 +218,7 @@ Rails.application.routes.draw do
|
||||
namespace :reports do
|
||||
resources :receipt_no, :only => [:index, :show]
|
||||
resources :daily_sale, :only => [:index, :show]
|
||||
resources :sale_item, :only => [:index, :show]
|
||||
# resources :sales, :only => [:index, :show]
|
||||
# resources :orders, :only => [:index, :show]
|
||||
# resources :customers, :only => [:index, :show]
|
||||
|
||||
@@ -7,6 +7,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1]
|
||||
t.string :item_order_by #person who order this
|
||||
t.string :item_code, :null => false
|
||||
t.string :item_name, :null => false
|
||||
t.integer :account_id, :limit => 8, :null => false, :default => 1
|
||||
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :remark
|
||||
|
||||
@@ -5,6 +5,7 @@ class CreateSaleItems < ActiveRecord::Migration[5.1]
|
||||
t.string :sale_id, foreign_key: true, :limit => 16
|
||||
t.string :product_code, :null => false
|
||||
t.string :product_name, :null => false
|
||||
t.integer :account_id, :limit => 8, :null => false, :default => 1
|
||||
t.string :remark
|
||||
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
|
||||
@@ -10,6 +10,11 @@ class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||
t.string :membership_id
|
||||
t.string :membership_type
|
||||
t.string :membership_authentication_code
|
||||
t.string :salution
|
||||
t.string :gender
|
||||
t.string :nrc_no
|
||||
t.string :address
|
||||
t.string :card_no, :unique => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
@@ -83,8 +83,8 @@ void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manag
|
||||
{lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])
|
||||
|
||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000"})
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111"})
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000", card_no:'000' })
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111", card_no:'111' })
|
||||
|
||||
#Default ZOne
|
||||
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
||||
@@ -161,7 +161,8 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
|
||||
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}
|
||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}
|
||||
])
|
||||
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://192.168.1.47:3006"})
|
||||
|
||||
Reference in New Issue
Block a user