fixed conflictfile
This commit is contained in:
@@ -40,31 +40,36 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// complete for queue item
|
// complete for queue item
|
||||||
$('.order-complete').on('click',function(){
|
$('.order-complete').on('click',function(){
|
||||||
var _self= $(this);
|
var _self = $(this); // To know in ajax return
|
||||||
var assigned_item_id=$(this).attr('id').substr(15);
|
var assigned_item_id=$(this).attr('id').substr(15);
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
var station=$(this).parent().parent(".queue_station").parent().parent().attr('id');
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/oqs/update_delivery',
|
url: '/oqs/update_delivery',
|
||||||
data: params,
|
data: params,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data){
|
success: function(data){
|
||||||
var queue_station=_self.parent().parent(".queue_station");
|
for (i = 0; i < data.length; i++) {
|
||||||
|
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
|
||||||
|
var station = queue_station.parent().parent().attr('id');
|
||||||
|
|
||||||
// Remove a queue card from current station
|
// Remove a queue card from current station
|
||||||
queue_station.remove();
|
queue_station.remove();
|
||||||
|
|
||||||
// Remove a queue card from current station
|
// Remove a queue card from current station
|
||||||
queue_station.children('.card-footer').remove();
|
queue_station.children('.card-footer').remove();
|
||||||
|
|
||||||
// Add removed queue card from station to completed
|
// Add removed queue card from station to completed
|
||||||
$("#completed").children('.card-columns').append(queue_station);
|
$("#completed").children('.card-columns').append(queue_station);
|
||||||
|
|
||||||
// update queue item count in station
|
// update queue item count in each station
|
||||||
$("#"+station+"_count").text(parseInt($("#"+station+"_count").text())-1);
|
var station_count=parseInt($("#"+station+"_count").text()) - 1;
|
||||||
$("#completed_count").text(parseInt($("#completed_count").text())+1);
|
$("#"+station+"_count").text(station_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
// update queue item count in completed station
|
||||||
|
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
|
||||||
|
|
||||||
alert("updated!");
|
alert("updated!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,18 @@
|
|||||||
//= require cable
|
//= require cable
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
// Enable/Disable Button
|
||||||
|
control_button("disabled");
|
||||||
|
|
||||||
$(".orders").on('click', function(){
|
$(".orders").on('click', function(){
|
||||||
var zone_name=$(this).find(".orders-table").text();
|
$("#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 receipt_no=$(this).find(".orders-receipt-no").text();
|
||||||
var unique_id = $(this).find(".orders-id").text();
|
var unique_id = $(this).find(".orders-id").text();
|
||||||
var order_status=$(this).find(".orders-order-status").text().trim();
|
var order_status=$(this).find(".orders-order-status").text().trim();
|
||||||
@@ -47,10 +57,10 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// AJAX call for order
|
// AJAX call for order
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "POST",
|
||||||
url: "origami/" + unique_id,
|
url: "/origami/" + unique_id,
|
||||||
data: { 'id' : unique_id },
|
data: { 'booking_id' : unique_id },
|
||||||
success:function(result){
|
success:function(result){
|
||||||
for (i = 0; i < result.length; i++) {
|
for (i = 0; i < result.length; i++) {
|
||||||
var data = JSON.stringify(result[i]);
|
var data = JSON.stringify(result[i]);
|
||||||
var parse_data = JSON.parse(data);
|
var parse_data = JSON.parse(data);
|
||||||
@@ -61,19 +71,20 @@ $(document).ready(function(){
|
|||||||
receipt_date = result[i].receipt_date;
|
receipt_date = result[i].receipt_date;
|
||||||
|
|
||||||
$("#receipt_no").text(receipt_no);
|
$("#receipt_no").text(receipt_no);
|
||||||
$("#cashier").text(cashier==null?"":cashier);
|
$("#cashier").text(cashier == null ? "" : cashier);
|
||||||
$("#receipt_date").text(receipt_date);
|
$("#receipt_date").text(receipt_date);
|
||||||
|
|
||||||
|
|
||||||
//Receipt Charges
|
//Receipt Charges
|
||||||
sub_total += (parse_data.qty*parse_data.price);
|
sub_total += (parse_data.qty*parse_data.price);
|
||||||
discount_amount = parse_data.discount_amount;
|
|
||||||
|
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
|
||||||
tax_amount = parse_data.tax_amount;
|
tax_amount = parse_data.tax_amount;
|
||||||
grand_total_amount = parse_data.grand_total_amount;
|
grand_total_amount = parse_data.grand_total_amount;
|
||||||
|
|
||||||
$("#order-sub-total").text(sub_total);
|
$("#order-sub-total").text(sub_total);
|
||||||
$("#order-food").text('');
|
// $("#order-food").text('');
|
||||||
$("#order-beverage").text('');
|
// $("#order-beverage").text('');
|
||||||
$("#order-discount").text(discount_amount);
|
$("#order-discount").text(discount_amount);
|
||||||
$("#order-Tax").text(tax_amount);
|
$("#order-Tax").text(tax_amount);
|
||||||
$("#order-grand-total").text(grand_total_amount);
|
$("#order-grand-total").text(grand_total_amount);
|
||||||
@@ -99,7 +110,7 @@ $(document).ready(function(){
|
|||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
var order_id=$(".selected-item").find(".orders-id").text();
|
var order_id=$(".selected-item").find(".orders-id").text();
|
||||||
if(order_id!=""){
|
if(order_id!=""){
|
||||||
window.location.href = '/origami/request_bills/'+ order_id
|
window.location.href = '/origami/' + order_id + '/request_bills'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an order!");
|
alert("Please select an order!");
|
||||||
@@ -111,7 +122,7 @@ $(document).ready(function(){
|
|||||||
$('#discount').click(function() {
|
$('#discount').click(function() {
|
||||||
var order_id=$(".selected-item").find(".orders-id").text();
|
var order_id=$(".selected-item").find(".orders-id").text();
|
||||||
if(order_id!=""){
|
if(order_id!=""){
|
||||||
window.location.href = '/origami/discount/'+ order_id
|
window.location.href = '/origami/' + order_id + '/discount'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an order!");
|
alert("Please select an order!");
|
||||||
@@ -123,21 +134,27 @@ $(document).ready(function(){
|
|||||||
// Pay Discount for Payment
|
// Pay Discount for Payment
|
||||||
$("#pay-discount").on('click', function(){
|
$("#pay-discount").on('click', function(){
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
|
var sale_item_id = $('.selected-item').attr('id');
|
||||||
var sub_total = $('#order-sub-total').text();
|
var sub_total = $('#order-sub-total').text();
|
||||||
var grand_total = $('#order-grand-total').text();
|
var grand_total = $('#order-grand-total').text();
|
||||||
var discount_type = $('#discount-type').val();
|
var discount_type = $('#discount-type').val();
|
||||||
var discount_value = $('#discount-amount').val();
|
var discount_value = $('#discount-amount').val();
|
||||||
var discount_amount = discount_value;
|
var discount_amount = discount_value;
|
||||||
|
|
||||||
|
if(sale_item_id == null){
|
||||||
|
alert('Please select item row to discount!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// For Percentage Discount
|
// For Percentage Discount
|
||||||
if(discount_type == 1){
|
if(discount_type == 1){
|
||||||
discount_amount=(sub_total*discount_value)/100;
|
discount_amount=(sub_total*discount_value)/100;
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = {'sale_id': sale_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
|
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({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/discount",
|
url: "/origami/" + sale_item_id + "/discount",
|
||||||
data: params,
|
data: params,
|
||||||
success:function(result){ }
|
success:function(result){ }
|
||||||
});
|
});
|
||||||
@@ -171,33 +188,33 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
function show_customer_details(customer_id){
|
function show_customer_details(customer_id){
|
||||||
|
|
||||||
$('.customer_detail').removeClass('hide');
|
|
||||||
//Start Ajax
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "origami/"+customer_id+"/get_customer/",
|
|
||||||
data: {},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
$("#customer_name").text(data["customer"].name);
|
|
||||||
$.each(data["response_data"]["data"], function (i) {
|
|
||||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
|
||||||
var balance = data["response_data"]["data"][i]["balance"];
|
|
||||||
console.log(balance);
|
|
||||||
if (balance) {
|
|
||||||
$("#customer_amount").text(balance);
|
|
||||||
}else{
|
|
||||||
$("#customer_amount").text('00');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
$('.customer_detail').removeClass('hide');
|
||||||
});
|
//Start Ajax
|
||||||
}
|
$.ajax({
|
||||||
});
|
type: "GET",
|
||||||
//End Ajax
|
url: "origami/"+customer_id+"/get_customer/",
|
||||||
}
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
$("#customer_name").text(data["customer"].name);
|
||||||
|
$.each(data["response_data"]["data"], function (i) {
|
||||||
|
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
|
var balance = data["response_data"]["data"][i]["balance"];
|
||||||
|
console.log(balance);
|
||||||
|
if (balance) {
|
||||||
|
$("#customer_amount").text(balance);
|
||||||
|
}else{
|
||||||
|
$("#customer_amount").text('00');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//End Ajax
|
||||||
|
}
|
||||||
|
|
||||||
/* For Receipt - Calculate discount or tax */
|
/* For Receipt - Calculate discount or tax */
|
||||||
$('.cashier_number').on('click', function(event){
|
$('.cashier_number').on('click', function(event){
|
||||||
@@ -222,8 +239,9 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
case 'add':
|
case 'add':
|
||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
amount = parseInt(input_value) + parseInt(original_value);
|
amount = parseInt(input_value);
|
||||||
$('#discount-amount').val(amount);
|
$('#discount-amount').val(amount);
|
||||||
|
$('#discount-type').val(1);
|
||||||
update_balance();
|
update_balance();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -245,6 +263,11 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.discount-item-row').on('click',function(){
|
||||||
|
$('.discount-item-row').removeClass('selected-item');
|
||||||
|
$(this).addClass('selected-item');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Button Control by Status */
|
/* Button Control by Status */
|
||||||
@@ -259,6 +282,11 @@ function control_button(order_status){
|
|||||||
$("#discount").prop('disabled', true);
|
$("#discount").prop('disabled', true);
|
||||||
$("#pay-bill").prop('disabled', true);
|
$("#pay-bill").prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$("#request_bills").prop('disabled', true);
|
||||||
|
$("#discount").prop('disabled', true);
|
||||||
|
$("#pay-bill").prop('disabled', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For Receipt - Update Balance */
|
/* For Receipt - Update Balance */
|
||||||
|
|||||||
@@ -16,11 +16,14 @@
|
|||||||
font-size:18px;
|
font-size:18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cashier_number{
|
.orders-table {
|
||||||
width: 30%;
|
cursor: pointer;
|
||||||
height:71px;
|
}
|
||||||
line-height:71px;
|
|
||||||
|
|
||||||
|
.cashier_number{
|
||||||
|
width: 33%;
|
||||||
|
height:70px;
|
||||||
|
line-height:70px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
background:#54A5AF;
|
background:#54A5AF;
|
||||||
// float:left;
|
// float:left;
|
||||||
@@ -32,8 +35,8 @@
|
|||||||
|
|
||||||
.pay{
|
.pay{
|
||||||
width: 98%;
|
width: 98%;
|
||||||
height:210px;
|
height:211px;
|
||||||
line-height:210px;
|
line-height:211px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
font-size:20px;
|
font-size:20px;
|
||||||
color:white;
|
color:white;
|
||||||
@@ -44,15 +47,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.long{
|
.long{
|
||||||
width:49%
|
width:49%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sold {
|
.sold {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.paid {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
.selected-item {
|
.selected-item {
|
||||||
background-color: blue;
|
color: #fff !important;
|
||||||
|
background-color: blue !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reciept Style */
|
/* Reciept Style */
|
||||||
@@ -101,3 +109,17 @@
|
|||||||
select.form-control {
|
select.form-control {
|
||||||
height: inherit !important;
|
height: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-horizontal .form-group {
|
||||||
|
margin-right: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Discount */
|
||||||
|
|
||||||
|
.discount-item-row {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.discount-item-row:hover {
|
||||||
|
background-color: #e3e3e3 !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,9 +38,8 @@ class Api::OrdersController < Api::ApiController
|
|||||||
|
|
||||||
|
|
||||||
#Create Table Booking or Room Booking
|
#Create Table Booking or Room Booking
|
||||||
if !params["booking_id"].nil? && params[:booking_id].to_i > 0
|
if !params["booking_id"].nil?
|
||||||
#@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.new_booking = true
|
|
||||||
@order.booking_id = params[:booking_id]
|
@order.booking_id = params[:booking_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
8
app/controllers/base_report_controller.rb
Normal file
8
app/controllers/base_report_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class BaseReportController < ActionController::Base
|
||||||
|
include LoginVerification
|
||||||
|
|
||||||
|
#before_action :check_installation
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -94,13 +94,11 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
else
|
else
|
||||||
|
|
||||||
@crm_customers.destroy
|
@crm_customers.destroy
|
||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -110,7 +108,6 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
format.html { redirect_to crm_customers_path}
|
format.html { redirect_to crm_customers_path}
|
||||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,10 +27,18 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
|
|
||||||
# update delivery status when complete click
|
# update delivery status when complete click
|
||||||
def update_delivery_status
|
def update_delivery_status
|
||||||
|
removed_item = []
|
||||||
assigned_item_id = params[:id]
|
assigned_item_id = params[:id]
|
||||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
assigned_item.delivery_status=true
|
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||||
assigned_item.save
|
|
||||||
|
# update delivery status for completed same order items
|
||||||
|
assigned_items.each do |ai|
|
||||||
|
ai.delivery_status=true
|
||||||
|
ai.save
|
||||||
|
removed_item.push(ai.assigned_order_item_id)
|
||||||
|
end
|
||||||
|
render :json => removed_item.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
|
|||||||
@@ -1,31 +1,39 @@
|
|||||||
class Oqs::PrintController < ApplicationController
|
class Oqs::PrintController < ApplicationController
|
||||||
|
# Print Order Item
|
||||||
def print
|
def print
|
||||||
unique_code="OrderItemPdf"
|
unique_code="OrderItemPdf"
|
||||||
assigned_item_id=params[:id]
|
assigned_item_id=params[:id]
|
||||||
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where("assigned_order_item_id='" + assigned_item_id + "'")
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
|
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||||
|
|
||||||
|
# print when complete click
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(print_settings,assigned_order_item[0].order_id, assigned_order_item[0].item_code )
|
order_queue_printer.print_order_item(print_settings,assigned_item.order_id, assigned_item.item_code )
|
||||||
|
|
||||||
# update print status when complete click
|
# update print status for completed same order items
|
||||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
assigned_items.each do |ai|
|
||||||
assigned_item.print_status=true
|
ai.print_status=true
|
||||||
assigned_item.save
|
ai.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Print Order Details
|
||||||
def print_order_summary
|
def print_order_summary
|
||||||
unique_code="OrderSummaryPdf"
|
unique_code="OrderSummaryPdf"
|
||||||
assigned_item_id=params[:id]
|
assigned_item_id=params[:id]
|
||||||
assigned_order_item=AssignedOrderItem.select("order_id").where('assigned_order_item_id='+assigned_item_id)
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
|
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||||
|
|
||||||
|
# print when complete click
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_summary(print_settings,assigned_order_item[0].order_id)
|
order_queue_printer.print_order_summary(print_settings,assigned_item.order_id)
|
||||||
|
|
||||||
# update print status when complete click
|
# update print status for completed same order items
|
||||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
assigned_items.each do |ai|
|
||||||
assigned_item.print_status=true
|
ai.print_status=true
|
||||||
assigned_item.save
|
ai.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
#discount page show from origami index with selected order
|
#discount page show from origami index with selected order
|
||||||
def index
|
def index
|
||||||
sale_id = params[:id]
|
sale_id = params[:id]
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
@sale_data = Sale.find(sale_id)
|
@sale_data = Sale.find(sale_id)
|
||||||
end
|
end
|
||||||
@@ -11,30 +11,32 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
#discount for selected order
|
#discount for selected order
|
||||||
def create
|
def create
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
sale_item_id = params[:sale_item_id]
|
||||||
discount_type = params[:discount_type]
|
discount_type = params[:discount_type]
|
||||||
discount_value = params[:discount_value]
|
discount_value = params[:discount_value]
|
||||||
discount_amount = params[:discount_amount]
|
discount_amount = params[:discount_amount]
|
||||||
grand_total = params[:grand_total]
|
grand_total = params[:grand_total]
|
||||||
|
|
||||||
if discount_type == 0
|
if discount_type == 0
|
||||||
remark="Discount " + discount_amount + " as net"
|
remark="Discount " + discount_amount + " as net"
|
||||||
else
|
else
|
||||||
remark="Discount " + discount_amount + " as percentage"
|
remark="Discount " + discount_amount + " as percentage"
|
||||||
end
|
end
|
||||||
|
|
||||||
#update discount for sale
|
#update discount for sale
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
sale.total_discount = discount_amount
|
sale.total_discount = sale.total_discount + discount_amount.to_f
|
||||||
sale.grand_total = grand_total
|
sale.grand_total = grand_total
|
||||||
sale.save
|
sale.save
|
||||||
|
|
||||||
#save sale item for discount
|
#save sale item for discount
|
||||||
|
origin_sale_item = SaleItem.find(sale_item_id)
|
||||||
sale_item = SaleItem.new
|
sale_item = SaleItem.new
|
||||||
|
|
||||||
#pull
|
#pull
|
||||||
sale_item.sale_id = sale_id
|
sale_item.sale_id = sale_id
|
||||||
sale_item.product_code = 0
|
sale_item.product_code = origin_sale_item.product_code
|
||||||
sale_item.product_name = "Discount"
|
sale_item.product_name = origin_sale_item.product_name + " Discount"
|
||||||
sale_item.remark = remark
|
sale_item.remark = remark
|
||||||
|
|
||||||
sale_item.qty = 1
|
sale_item.qty = 1
|
||||||
@@ -45,7 +47,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
sale_item.price = sale_item.qty * sale_item.unit_price
|
sale_item.price = sale_item.qty * sale_item.unit_price
|
||||||
sale_item.save
|
sale_item.save
|
||||||
|
|
||||||
redirect_to origami_root_path
|
redirect_to origami_path(sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,30 +1,49 @@
|
|||||||
class Origami::HomeController < BaseOrigamiController
|
class Origami::HomeController < BaseOrigamiController
|
||||||
def index
|
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_orders = Order.get_booking_order_table()
|
||||||
@booking_rooms = Order.get_booking_order_rooms()
|
@booking_rooms = Order.get_booking_order_rooms()
|
||||||
@orders = Order.get_orders()
|
@orders = Order.get_orders()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
def item_show
|
||||||
|
selection(params[:booking_id],1)
|
||||||
def show
|
end
|
||||||
str = []
|
|
||||||
type=params[:id].split('-')[0];
|
|
||||||
|
|
||||||
|
def selection(selected_id, is_ajax)
|
||||||
|
str = []
|
||||||
|
type=selected_id.split('-')[0];
|
||||||
# Sale
|
# Sale
|
||||||
if type == "SAL"
|
if type == "SAL"
|
||||||
@order_details = SaleItem.get_order_items_details(params[:id])
|
@order_details = SaleItem.get_order_items_details(params[:booking_id])
|
||||||
@order_details.each do |ord_detail|
|
@order_details.each do |ord_detail|
|
||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
end
|
end
|
||||||
render :json => str.to_json
|
|
||||||
# Booking
|
# Booking
|
||||||
else
|
else
|
||||||
@order_details = OrderItem.get_order_items_details(params[:id])
|
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||||
@order_details.each do |ord_detail|
|
@order_details.each do |ord_detail|
|
||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
end
|
end
|
||||||
render :json => str.to_json
|
|
||||||
end
|
end
|
||||||
|
if is_ajax == 1
|
||||||
|
render :json => str.to_json
|
||||||
|
else
|
||||||
|
str
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_sale_by_customer
|
def update_sale_by_customer
|
||||||
|
|||||||
@@ -14,17 +14,23 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
else
|
else
|
||||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer_name = Customer.select("name").where('customer_id=' + @sale_data.customer_id)
|
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# find order id by sale id
|
||||||
|
sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
|
# Calculate Food and Beverage Total
|
||||||
|
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
|
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
|
||||||
redirect_to origami_root_path
|
redirect_to origami_path(sale_order.sale_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
9
app/controllers/reports/receipt_no_controller.rb
Normal file
9
app/controllers/reports/receipt_no_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Reports::ReceiptNoController < BaseReportController
|
||||||
|
def index
|
||||||
|
@hi = "hi"
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,10 +9,11 @@ class DiningFacility < ApplicationRecord
|
|||||||
scope :active, -> {where(is_active: true)}
|
scope :active, -> {where(is_active: true)}
|
||||||
|
|
||||||
def get_current_booking
|
def get_current_booking
|
||||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='occupied' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
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)
|
||||||
|
|
||||||
if booking.count > 0 then
|
if booking.count > 0 then
|
||||||
return booking[0]
|
return booking[0].booking_id
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,14 +25,15 @@ class Order < ApplicationRecord
|
|||||||
booking = nil
|
booking = nil
|
||||||
|
|
||||||
if self.new_booking
|
if self.new_booking
|
||||||
|
puts "a"
|
||||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||||
:booking_status => "assign" })
|
:booking_status => "assign" })
|
||||||
|
table = DiningFacility.find(self.table_id)
|
||||||
|
table.status = "occupied"
|
||||||
|
table.save
|
||||||
else
|
else
|
||||||
if (self.booking_id.to_i > 0 )
|
booking = Booking.find(self.booking_id)
|
||||||
booking = Booking.find(self.booking_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
booking.save!
|
booking.save!
|
||||||
@@ -227,11 +228,25 @@ class Order < ApplicationRecord
|
|||||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
#Origami: Cashier : to view booking order Table
|
||||||
|
def self.get_completed_order
|
||||||
|
completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||||
|
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
|
.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("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
@@ -245,8 +260,9 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
.where("sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name")
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
@@ -275,8 +291,8 @@ class Order < ApplicationRecord
|
|||||||
left join order_items on order_items.order_id = orders.order_id
|
left join order_items on order_items.order_id = orders.order_id
|
||||||
left join sale_orders on sale_orders.order_id = orders.order_id
|
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||||
left join sales on sales.sale_id = sale_orders.sale_id")
|
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
.where("sales.sale_status<>'complete' and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id")
|
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
.where("orders.order_id='" + code.to_s + "'")
|
.where("orders.order_id='" + code + "'")
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -63,12 +63,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
self.print(filename)
|
self.print(filename)
|
||||||
end
|
end
|
||||||
#Bill Receipt Print
|
|
||||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name)
|
#Bill Receipt Print
|
||||||
|
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
|
||||||
pdf.render_file "tmp/receipt_bill.pdf"
|
pdf.render_file "tmp/receipt_bill.pdf"
|
||||||
self.print("tmp/receipt_bill.pdf")
|
self.print("tmp/receipt_bill.pdf")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,6 +29,33 @@ class SaleItem < ApplicationRecord
|
|||||||
# return false
|
# return false
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.calculate_food_beverage(sale_items)
|
||||||
|
food_prices=0
|
||||||
|
beverage_prices=0
|
||||||
|
|
||||||
|
sale_items.each do |si|
|
||||||
|
food_price = self.get_food_price(si.sale_item_id)
|
||||||
|
beverage_price = self.get_beverage_price(si.sale_item_id)
|
||||||
|
food_prices = food_prices + food_price
|
||||||
|
beverage_prices = beverage_prices + beverage_price
|
||||||
|
end
|
||||||
|
return food_prices, beverage_prices
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_food_price(sale_item_id)
|
||||||
|
food=SaleItem.select("sale_items.price")
|
||||||
|
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
||||||
|
.where("sale_items.sale_item_id=? and menu_items.account_id=1", sale_item_id.to_s)
|
||||||
|
food_price = food[0].price rescue 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_beverage_price(sale_item_id)
|
||||||
|
beverage=SaleItem.select("sale_items.price")
|
||||||
|
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
||||||
|
.where("sale_items.sale_item_id=? and menu_items.account_id=2", sale_item_id.to_s)
|
||||||
|
beverage_price = beverage[0].price rescue 0
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -211,20 +211,24 @@ class SalePayment < ApplicationRecord
|
|||||||
sObj.sale_payments.each do |spay|
|
sObj.sale_payments.each do |spay|
|
||||||
all_received_amount += spay.payment_amount.to_f
|
all_received_amount += spay.payment_amount.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.sale.grand_total <= all_received_amount)
|
if (self.sale.grand_total <= all_received_amount)
|
||||||
self.sale.payment_status = "paid"
|
self.sale.payment_status = "paid"
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
self.sale.save!
|
self.sale.save!
|
||||||
|
table_update_status()
|
||||||
rebat()
|
rebat()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def rebat
|
def table_update_status
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rebat
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||||
|
|||||||
@@ -1,29 +1,46 @@
|
|||||||
class OrderItemPdf < Prawn::Document
|
class OrderItemPdf < Prawn::Document
|
||||||
|
attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width
|
||||||
def initialize(order_item, print_settings)
|
def initialize(order_item, print_settings)
|
||||||
super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
self.page_width = 300
|
||||||
|
self.page_height = 400
|
||||||
|
self.margin = 10
|
||||||
|
self.price_width = 50
|
||||||
|
self.qty_width = 50
|
||||||
|
self.item_width = self.page_width - (self.price_width + self.qty_width)
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width)
|
||||||
|
self.receipt_width=130
|
||||||
|
|
||||||
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
font_size 9
|
self.header_font_size = 12
|
||||||
text "#{order_item.dining}", :size => 15
|
self.item_font_size = 10
|
||||||
|
|
||||||
|
text "#{order_item.dining}", :size => self.header_font_size,:align => :center
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
#order_info
|
#order_info
|
||||||
order_info(order_item.order_by,order_item.order_at, order_item.customer)
|
order_info(order_item.order_by,order_item.order_at)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_items(order_item)
|
order_items(order_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
def order_info(order_by, order_at, customer)
|
def order_info(order_by, order_at)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => 200, :height => 15) do
|
bounding_box([0,y_position], :width => self.item_width - 50, :height => self.item_height) do
|
||||||
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.item_width - 50,y_position], :width => self.item_width + 50, :height => self.item_height) do
|
||||||
|
text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -35,12 +52,12 @@ class OrderItemPdf < Prawn::Document
|
|||||||
def order_items(order_item)
|
def order_items(order_item)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => 180, :height => 15) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "Item", :size => 7,:align => :left
|
text "Item", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([160,y_position], :width => 20, :height => 15) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
text "Qty", :size => 7,:align => :right
|
text "Qty", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -56,12 +73,12 @@ class OrderItemPdf < Prawn::Document
|
|||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => 180, :height => 20) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "#{order_item.item_name}", :size => 7,:align => :left
|
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([160,y_position], :width => 20, :height => 20) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
text "#{order_item.qty}", :size => 7,:align => :right
|
text "#{order_item.qty}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -1,19 +1,30 @@
|
|||||||
class OrderSummaryPdf < Prawn::Document
|
class OrderSummaryPdf < Prawn::Document
|
||||||
|
attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width
|
||||||
def initialize(order, print_settings)
|
def initialize(order, print_settings)
|
||||||
super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
self.page_width = 300
|
||||||
|
self.page_height = 400
|
||||||
|
self.margin = 10
|
||||||
|
self.price_width = 60
|
||||||
|
self.qty_width = 60
|
||||||
|
self.item_width = self.page_width - (self.price_width + self.qty_width)
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width)
|
||||||
|
self.receipt_width=130
|
||||||
|
|
||||||
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
|
self.header_font_size = 12
|
||||||
|
self.item_font_size = 10
|
||||||
|
|
||||||
font_size 9
|
text "#{order[0].dining}", :size => self.header_font_size,:align => :center
|
||||||
text "#{order[0].dining}", :size => 15
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
#order_info
|
#order_info
|
||||||
order_info(order[0].order_by,order[0].order_at, order[0].customer)
|
order_info(order[0].order_by,order[0].order_at)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_items(order)
|
order_items(order)
|
||||||
@@ -21,11 +32,15 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
def order_info(order_by, order_at, customer)
|
def order_info(order_by, order_at)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => 200, :height => 15) do
|
bounding_box([0,y_position], :width => self.item_width - 20, :height => self.item_height) do
|
||||||
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.item_width - 20,y_position], :width => self.item_width + 20, :height => self.item_height) do
|
||||||
|
text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -37,12 +52,12 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
def order_items(order_item)
|
def order_items(order_item)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => 180, :height => 15) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "Item", :size => 7,:align => :left
|
text "Item", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([160,y_position], :width => 20, :height => 15) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
text "Qty", :size => 7,:align => :right
|
text "Qty", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -59,13 +74,13 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
order_item.each do|odi|
|
order_item.each do|odi|
|
||||||
bounding_box([0,y_position], :width => 180, :height => 20) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "#{odi.item_name}", :size => 7,:align => :left
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([160,y_position], :width => 20, :height => 20) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
text "#{odi.qty}", :size => 7,:align => :right
|
text "#{odi.qty}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
|
attr_accessor :receipt_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)
|
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
|
||||||
self.p_width = 200
|
self.page_width = 300
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 10
|
self.margin = 10
|
||||||
# self.price_width = self.p_width / 2
|
self.price_width = 50
|
||||||
self.price_width=80
|
self.qty_width = 30
|
||||||
self.item_width = self.p_width - self.price_width
|
self.total_width = 50
|
||||||
self.item_height = self.item_height
|
self.item_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.qty_column_width = self.p_width / 2
|
self.item_height = 15
|
||||||
self.item_description_width=self.p_width - self.price_width
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.receipt_width=130
|
self.receipt_width=100
|
||||||
|
|
||||||
@item_width = self.p_width.to_i / 2
|
# @item_width = self.page_width.to_i / 2
|
||||||
@qty_width = @item_width.to_i / 3
|
# @qty_width = @item_width.to_i / 3
|
||||||
@double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
@half_qty = @qty_width / 2
|
# @half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
self.header_font_size = 10
|
|
||||||
self.item_font_size = 9
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
|
# font "public/fonts/padauk.ttf"
|
||||||
|
self.header_font_size = 12
|
||||||
|
self.item_font_size = 10
|
||||||
|
|
||||||
header( printer_settings.printer_name, printer_settings.name)
|
header( printer_settings.printer_name, printer_settings.name)
|
||||||
stroke_horizontal_rule
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
cashier_info(sale_data, customer_name)
|
cashier_info(sale_data, customer_name)
|
||||||
line_items(sale_items)
|
line_items(sale_items, food_total, beverage_total)
|
||||||
all_total(sale_data)
|
all_total(sale_data)
|
||||||
|
|
||||||
|
|
||||||
@@ -38,71 +44,66 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(sale_data, customer_name)
|
def cashier_info(sale_data, customer_name)
|
||||||
move_down 5
|
move_down 7
|
||||||
move_down 2
|
# move_down 2
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.receipt_width, :height => self.item_height) do
|
||||||
text "Receipt No:", :size => self.item_font_size,:align => :left
|
text "Receipt No:", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.price_width, y_position], :width =>self.receipt_width) do
|
bounding_box([self.receipt_width, y_position], :width =>self.receipt_width) do
|
||||||
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
|
text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.receipt_width, :height => self.item_height) do
|
||||||
text "Customer:", :size => self.item_font_size,:align => :left
|
text "Customer:", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([self.receipt_width,y_position], :width =>self.receipt_width) do
|
||||||
text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.receipt_width, :height => self.item_height) do
|
||||||
text "Date:", :size => self.item_font_size,:align => :left
|
text "Date:", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([self.receipt_width,y_position], :width =>self.receipt_width) do
|
||||||
text "#{sale_data.receipt_date.strftime('%Y %m %d %h:%m')}" , :size => self.item_font_size,:align => :left
|
text "#{sale_data.receipt_date.strftime('%Y %m %d %h:%m')}" , :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
# stroke_horizontal_rule
|
# stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
def line_items(sale_items)
|
def line_items(sale_items, food_total, beverage_total)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
qty_column_width = self.p_width * 0.2
|
|
||||||
item_description_width = self.p_width * 0.5
|
|
||||||
price_column_width = self.p_width * 0.3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
# @item_width.to_i + @half_qty.to_i
|
# @item_width.to_i + @half_qty.to_i
|
||||||
text_box "Items", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
text_box "Items", :at =>[0,y_position], :width => self.item_width - 20, :height =>self.item_height, :size => self.item_font_size
|
||||||
text_box "Price", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "Price", :at =>[self.item_width-20,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
|
||||||
text_box "Qty", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
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 => :right
|
||||||
text_box "Total", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "Total", :at =>[self.item_width+self.price_width+self.qty_width,y_position], :width => self.total_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
add_line_item_row(sale_items)
|
add_line_item_row(sale_items, food_total, beverage_total)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items)
|
def add_line_item_row(sale_items, food_total, beverage_total)
|
||||||
|
item_name_width = self.item_width-20
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
sub_total = 0.0
|
sub_total = 0.0
|
||||||
@@ -119,53 +120,67 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
# @item_width.to_i + @half_qty.to_i
|
# @item_width.to_i + @half_qty.to_i
|
||||||
text_box "#{product_name}", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
text_box "#{product_name}", :at =>[0,y_position], :width => item_name_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size
|
||||||
text_box "#{price}", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "#{price}", :at =>[item_name_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
|
||||||
text_box "#{qty.to_i}", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "#{qty.to_i}", :at =>[item_name_width+self.price_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
|
||||||
text_box "#{total_price}", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
text_box "#{total_price}", :at =>[item_name_width+self.price_width+self.qty_width,y_position], :width =>self.total_width, :height =>self.item_height, :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
}
|
}
|
||||||
move_down 3
|
move_down 3
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
|
||||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
|
||||||
text "#{sub_total}" , :size => self.item_font_size,:align => :right
|
text "#{sub_total}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Food and Beverage
|
||||||
|
food_beverage_total = food_total.to_s + '/' + beverage_total.to_s
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
|
||||||
|
text "Food/Beverage Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
|
||||||
|
text "#{ food_beverage_total }" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_total(sale_data)
|
def all_total(sale_data)
|
||||||
|
item_name_width = self.item_width-20
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position =cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
|
||||||
text "Discount", :size => self.item_font_size,:align => :left
|
text "Discount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
|
||||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position =cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
|
||||||
text "Total Tax", :size => self.item_font_size,:align => :left
|
text "Total Tax", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
|
||||||
text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
bounding_box([0,y_position], :width =>self.price_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>(item_name_width+self.price_width+self.qty_width), :height => self.item_height) do
|
||||||
text "Grand Total", :size => self.item_font_size,:align => :left
|
text "Grand Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.price_width,y_position], :width =>self.price_width) do
|
bounding_box([(item_name_width+self.price_width+self.qty_width),y_position], :width =>self.total_width) do
|
||||||
text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right
|
text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -4,22 +4,22 @@
|
|||||||
|
|
||||||
<!-- Order Details -->
|
<!-- Order Details -->
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<!-- <div class="card-header">
|
||||||
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
|
||||||
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row">
|
<div class="card-title row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||||
<p>Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
<p>Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||||
<p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p>
|
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
<table class="table table-striped" id="order-items-table">
|
<table class="table table-default" id="order-items-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="item-name">Items</th>
|
<th class="item-name">Items</th>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% @sale_data.sale_items.each do |sale_item| %>
|
<% @sale_data.sale_items.each do |sale_item| %>
|
||||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||||
<tr>
|
<tr class="discount-item-row" id=<%= sale_item.sale_item_id %> >
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||||
</td>
|
</td>
|
||||||
@@ -52,30 +52,30 @@
|
|||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<!-- <tr>
|
||||||
<td class="charges-name"><strong>Food:</strong></td>
|
<td class="charges-name"><strong>Food:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||||
</tr>
|
</tr> -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<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>
|
||||||
<tr>
|
<tr class="hidden">
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="hidden">
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
|
|
||||||
@@ -84,11 +84,11 @@
|
|||||||
<!-- Discount Amount -->
|
<!-- Discount Amount -->
|
||||||
<div class="card row">
|
<div class="card row">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">Pay Discount</strong></div>
|
<div><strong id="order-title">Overall Discount</strong></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<select name="discount_type" id="discount-type" class="form-control">
|
<select name="discount_type" id="discount-type" class="form-control">
|
||||||
@@ -97,82 +97,82 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button id="pay-discount" class="btn btn-primary long">Discount</button>
|
<button id="pay-discount" class="btn btn-primary long">Discount</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row">
|
<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="col-md-7">
|
||||||
<div class="row">
|
<div class="row bottom">
|
||||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||||
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||||
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="col-md-12 cashier_number long" data-value="500" data-type="add">500</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<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="col-md-7">
|
||||||
<div class="row">
|
<div class="row bottom">
|
||||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||||
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||||
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
|
||||||
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
|
||||||
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
<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>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-md-5">
|
||||||
<div class="row">
|
<div class="col-md-12 cashier_number long" data-value="30" data-type="add">30%</div>
|
||||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
|
||||||
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
|
||||||
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-7">
|
||||||
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
<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>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<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="col-md-7">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 cashier_number"></div>
|
<div class="col-md-3 cashier_number"></div>
|
||||||
<div class="col-md-3 cashier_number red" data-type="del">DEL</div>
|
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||||
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div>
|
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<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">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -16,34 +19,99 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<!-- Nav tabs - End -->
|
<!-- Nav tabs - End -->
|
||||||
|
|
||||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
|
<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=""
|
||||||
|
# For CSS- Class for Order? Sale?
|
||||||
|
sale_status=""
|
||||||
|
if cpo.order_status == 'new'
|
||||||
|
unique_id=cpo.booking_id
|
||||||
|
# check selected item and assign
|
||||||
|
if @selected_item != nil
|
||||||
|
if cpo.order_id == @selected_item.order_id
|
||||||
|
sale_status = sale_status + " selected-item"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
unique_id=cpo.sale_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"><%= bko.customer_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.order_status %>
|
||||||
|
</span>
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--- Panel 0 - Table Orders -->
|
<!--- Panel 1 - Table Orders -->
|
||||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<%
|
<%
|
||||||
@booking_orders.each do |bko|
|
@booking_orders.each do |bko|
|
||||||
# Assigned Id for new Order? Sale?
|
# Assigned Id for new Order? Sale?
|
||||||
unique_id=""
|
unique_id=""
|
||||||
customer_id=""
|
customer_id=""
|
||||||
# For CSS- Class for Order? Sale?
|
# For CSS- Class for Order? Sale?
|
||||||
sale_status=""
|
sale_status=""
|
||||||
if bko.order_status == 'new'
|
if bko.order_status == 'new'
|
||||||
unique_id=bko.booking_id
|
unique_id=bko.booking_id
|
||||||
customer_id=bko.order_customer_id
|
customer_id=bko.order_customer_id
|
||||||
else
|
# check selected item and assign
|
||||||
unique_id=bko.sale_id
|
if @selected_item != nil
|
||||||
customer_id=bko.sale_customer_id
|
if bko.order_id == @selected_item.order_id
|
||||||
sale_status="sold"
|
sale_status = sale_status + " selected-item"
|
||||||
|
end
|
||||||
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 orders <%= sale_status %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
<p class="hidden orders-id"><%= unique_id %></p>
|
||||||
<p class="hidden customer-id"><%= customer_id %></p>
|
<p class="hidden customer-id"><%= customer_id %></p>
|
||||||
<p class="hidden order-cid"><%= bko.order_id %></p>
|
<p class="hidden order-cid"><%= bko.order_id %></p>
|
||||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||||
|
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
Receipt No :
|
Receipt No :
|
||||||
<span class="orders-receipt-no">
|
<span class="orders-receipt-no">
|
||||||
@@ -65,30 +133,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--- Panel 1 - Room Orders -->
|
<!--- Panel 2 - Room Orders -->
|
||||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<%
|
<%
|
||||||
@booking_rooms.each do |rmo|
|
@booking_rooms.each do |rmo|
|
||||||
# Assigned Id for new Order? Sale?
|
# Assigned Id for new Order? Sale?
|
||||||
unique_id=""
|
unique_id=""
|
||||||
|
customer_id=""
|
||||||
# For CSS- Class for Order? Sale?
|
# For CSS- Class for Order? Sale?
|
||||||
sale_status=""
|
sale_status=""
|
||||||
if rmo.order_status == 'new'
|
|
||||||
|
if rmo.order_status == 'new'
|
||||||
unique_id=rmo.booking_id
|
unique_id=rmo.booking_id
|
||||||
customer_id=rmo.order_customer_id
|
customer_id=rmo.order_customer_id
|
||||||
else
|
# 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
|
unique_id=rmo.sale_id
|
||||||
customer_id=rmo.sale_customer_id
|
customer_id=rmo.sale_customer_id
|
||||||
sale_status="sold"
|
sale_status="sold"
|
||||||
end
|
# 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 orders <%= sale_status %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
<p class="hidden orders-id"><%= unique_id %></p>
|
||||||
<p class="hidden customer-id"><%= customer_id %></p>
|
<p class="hidden customer-id"><%= customer_id %></p>
|
||||||
<p class="hidden order-cid"><%= rmo.order_id %></p>
|
<p class="hidden order-cid"><%= rmo.order_id %></p>
|
||||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
Receipt No :
|
Receipt No :
|
||||||
<span class="orders-receipt-no">
|
<span class="orders-receipt-no">
|
||||||
@@ -110,22 +192,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--- Panel 2 - Orders -->
|
<!--- Panel 3 - Orders -->
|
||||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
<div class="tab-pane" id="orders" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<%
|
<%
|
||||||
@orders.each do |odr|
|
@orders.each do |odr|
|
||||||
# Assigned Id for new Order? Sale?
|
# Assigned Id for new Order? Sale?
|
||||||
unique_id=""
|
unique_id=""
|
||||||
|
customer_id=""
|
||||||
# For CSS- Class for Order? Sale?
|
# For CSS- Class for Order? Sale?
|
||||||
sale_status=""
|
sale_status=""
|
||||||
if odr.order_status == 'new'
|
|
||||||
|
if odr.order_status == 'new'
|
||||||
unique_id=odr.booking_id
|
unique_id=odr.booking_id
|
||||||
customer_id = odr.order_customer_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
|
else
|
||||||
unique_id=odr.sale_id
|
unique_id=odr.sale_id
|
||||||
customer_id = odr.sale_customer_id
|
customer_id = odr.sale_customer_id
|
||||||
sale_status="sold"
|
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
|
end
|
||||||
%>
|
%>
|
||||||
<div class="card orders <%= sale_status %>">
|
<div class="card orders <%= sale_status %>">
|
||||||
@@ -133,8 +228,8 @@
|
|||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
<p class="hidden orders-id"><%= unique_id %></p>
|
||||||
<p class="hidden customer-id"><%= customer_id %></p>
|
<p class="hidden customer-id"><%= customer_id %></p>
|
||||||
<p class="hidden order-cid"><%= odr.order_id %></p>
|
<p class="hidden order-cid"><%= odr.order_id %></p>
|
||||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
|
<h4 class="card-title orders-table"><%= odr.table_name %></h4
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
Receipt No :
|
Receipt No :
|
||||||
<span class="orders-receipt-no">
|
<span class="orders-receipt-no">
|
||||||
<%= odr.receipt_no %>
|
<%= odr.receipt_no %>
|
||||||
@@ -169,12 +264,12 @@
|
|||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row">
|
<div class="card-title row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<p>Receipt No: <span id="receipt_no"></span></p>
|
<p>Receipt No: <span id="receipt_no"><%=@selected_item.receipt_no rescue ' '%></span></p>
|
||||||
<p>Cashier: <span id="cashier"></span></p>
|
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<p>Date: <span id="receipt_date"></span></p>
|
<p>Date: <span id="receipt_date"><%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-title row customer_detail hide">
|
<div class="card-title row customer_detail hide">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
@@ -195,7 +290,39 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- Append Javascript Template -->
|
<%
|
||||||
|
# For Sale Items
|
||||||
|
sub_total = 0
|
||||||
|
if @selected_item_type == "Sale"
|
||||||
|
@selected_item.sale_items.each do |sale_item|
|
||||||
|
sub_total += sale_item.qty*sale_item.unit_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.qty*sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%
|
||||||
|
# For Order Items
|
||||||
|
sub_total = 0
|
||||||
|
if @selected_item_type == "Order"
|
||||||
|
@selected_item.order_items.each do |order_item|
|
||||||
|
sub_total += order_item.qty*order_item.unit_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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -203,27 +330,27 @@
|
|||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<!-- <tr>
|
||||||
<td class="charges-name"><strong>Food:</strong></td>
|
<td class="charges-name"><strong>Food:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||||
</tr>
|
</tr> -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-discount"></strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -243,7 +370,6 @@
|
|||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</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" disabled>Pay</button>
|
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block" disabled>Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Amount :
|
|||||||
var sale_id = "<%= @sale_id %>";
|
var sale_id = "<%= @sale_id %>";
|
||||||
|
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_create_mpu_payment_path %>",
|
url: "<%= origami_payment_mpu_path %>",
|
||||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
if(result){
|
if(result){
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class=" cashier_number"></div>
|
<div class=" cashier_number" data-type="nett">Nett</div>
|
||||||
<div class=" cashier_number red left" data-type="del">Del</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 green left" data-type="clr">Clr</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -195,6 +195,10 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
$('#cash').text("0.0");
|
$('#cash').text("0.0");
|
||||||
update_balance();
|
update_balance();
|
||||||
break;
|
break;
|
||||||
|
case 'nett':
|
||||||
|
$('#cash').text($('#amount_due').text());
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
event.handled = true;
|
event.handled = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -216,7 +220,6 @@ $( document ).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#pay').click(function() {
|
$('#pay').click(function() {
|
||||||
|
|
||||||
if($('#balance').text() > 0){
|
if($('#balance').text() > 0){
|
||||||
alert(" Insufficient Amount!")
|
alert(" Insufficient Amount!")
|
||||||
}else{
|
}else{
|
||||||
@@ -226,11 +229,11 @@ $( document ).ready(function() {
|
|||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_process_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
alert("Thank you")
|
alert("Thank you")
|
||||||
window.location.href = '/origami';
|
// window.location.href = '/origami';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
3
app/views/reports/receipt_no/index.html.erb
Normal file
3
app/views/reports/receipt_no/index.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="row">
|
||||||
|
<%= @hi %>
|
||||||
|
</div>
|
||||||
@@ -72,32 +72,36 @@ Rails.application.routes.draw do
|
|||||||
#--------- Cashier ------------#
|
#--------- Cashier ------------#
|
||||||
namespace :origami do
|
namespace :origami do
|
||||||
root "home#index"
|
root "home#index"
|
||||||
get "/:booking_id" => "home#show" do #origami/:booking_id will show
|
get "/:booking_id" => "home#index" do #origami/:booking_id will show
|
||||||
resources :discounts, only: [:index,:new, :create ] #add discount type
|
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||||
resources :customers #add customer type
|
resources :customers #add customer type
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/request_bills/:id" => "request_bills#print"
|
post '/:booking_id' => 'home#item_show'
|
||||||
get "/discount/:id" => "discounts#index"
|
|
||||||
post "/discount" => "discounts#create"
|
get "/:id/discount" => "discounts#index"
|
||||||
|
post "/:id/discount" => "discounts#create"
|
||||||
|
|
||||||
|
get "/:id/request_bills" => "request_bills#print"
|
||||||
|
|
||||||
#--------- Payment ------------#
|
#--------- Payment ------------#
|
||||||
get 'sale/:sale_id/payment' => 'payments#show'
|
get 'sale/:sale_id/payment' => 'payments#show'
|
||||||
post 'payment_process' => 'payments#create'
|
post 'payment/cash' => 'payments#create'
|
||||||
post 'paypar_payment_process' => 'paypar_payments#create'
|
post 'paypar_payment_process' => 'paypar_payments#create'
|
||||||
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||||
|
|
||||||
|
# get 'sale/:sale_id/payment/others_payment/:payment_method' => "redeem_payments#index"
|
||||||
|
|
||||||
|
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
||||||
|
post 'payment/mpu' => "mpu#create"
|
||||||
|
get 'sale/:sale_id/payment/others_payment/REDEEMREBATE' => "redeem_payments#index"
|
||||||
|
|
||||||
#---------Add Customer --------------#
|
#---------Add Customer --------------#
|
||||||
#resources :customers
|
#resources :customers
|
||||||
get '/:sale_id/add_customer', to: "customers#add_customer"
|
get '/:sale_id/add_customer', to: "customers#add_customer"
|
||||||
get '/:customer_id/get_customer' => 'home#get_customer'
|
get '/:customer_id/get_customer' => 'home#get_customer'
|
||||||
post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table
|
post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table
|
||||||
|
|
||||||
# get 'sale/:sale_id/payment/others_payment/:payment_method' => "redeem_payments#index"
|
|
||||||
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
|
||||||
post 'create_mpu_payment' => "mpu#create"
|
|
||||||
get 'sale/:sale_id/payment/others_payment/REDEEMREBATE' => "redeem_payments#index"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
@@ -164,7 +168,7 @@ Rails.application.routes.draw do
|
|||||||
resources :tax_profiles
|
resources :tax_profiles
|
||||||
#lookups
|
#lookups
|
||||||
resources :lookups
|
resources :lookups
|
||||||
#orders
|
#orders
|
||||||
resources :orders
|
resources :orders
|
||||||
#sales
|
#sales
|
||||||
resources :sales
|
resources :sales
|
||||||
@@ -196,12 +200,13 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
namespace :reports do
|
namespace :reports do
|
||||||
resources :sales, :only => [:index, :show]
|
resources :receipt_no, :only => [:index, :show]
|
||||||
resources :orders, :only => [:index, :show]
|
# resources :sales, :only => [:index, :show]
|
||||||
resources :customers, :only => [:index, :show]
|
# resources :orders, :only => [:index, :show]
|
||||||
resources :products, :only => [:index, :show]
|
# resources :customers, :only => [:index, :show]
|
||||||
resources :inventory, :only => [:index, :show]
|
# resources :products, :only => [:index, :show]
|
||||||
resources :employees, :only => [:index, :show]
|
# resources :inventory, :only => [:index, :show]
|
||||||
|
# resources :employees, :only => [:index, :show]
|
||||||
end
|
end
|
||||||
|
|
||||||
#mount_compendium at: '/report' #, controller: 'reports'
|
#mount_compendium at: '/report' #, controller: 'reports'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class CreateMembershipActions < ActiveRecord::Migration[5.1]
|
|||||||
t.string :auth_token
|
t.string :auth_token
|
||||||
t.string :merchant_account_id
|
t.string :merchant_account_id
|
||||||
t.string :created_by
|
t.string :created_by
|
||||||
t.string :additional_parameter,array: true, :default =>'{}'
|
t.json :additional_parameter
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
12
db/seeds.rb
12
db/seeds.rb
@@ -51,6 +51,10 @@ menu_item_type = Lookup.create([{lookup_type:'menu_item_type', name: 'SIMPLE', v
|
|||||||
{lookup_type:'menu_item_type', name: 'Set Menu', value: 'setMenu'},
|
{lookup_type:'menu_item_type', name: 'Set Menu', value: 'setMenu'},
|
||||||
{lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}])
|
{lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}])
|
||||||
|
|
||||||
|
member_group_type = Lookup.create([{lookup_type:'member_group_type', name: 'Platinum', value: '1'},
|
||||||
|
{lookup_type:'member_group_type', name: 'Silver', value: '2'}
|
||||||
|
])
|
||||||
|
|
||||||
#menu_item_attribute:[size|]
|
#menu_item_attribute:[size|]
|
||||||
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type', name: 'Size', value: 'size'}])
|
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type', name: 'Size', value: 'size'}])
|
||||||
# {lookup_type:'menu_item_attribute_type', name: 'Spicy', value: 'spicy'},
|
# {lookup_type:'menu_item_attribute_type', name: 'Spicy', value: 'spicy'},
|
||||||
@@ -136,15 +140,12 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o
|
|||||||
#Create Adminstrator employee
|
#Create Adminstrator employee
|
||||||
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
|
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
|
||||||
|
|
||||||
#Account for Menu Item Type (eg: Food, Beverage)
|
|
||||||
food = Account.create({title: "Food", account_type: "0"})
|
|
||||||
beverage = Account.create({title: "Beverage", account_type: "1"})
|
|
||||||
|
|
||||||
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
|
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
|
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
|
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
|
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
|
|
||||||
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "192.168.1."})
|
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http//192.168.1.47:3006"})
|
||||||
|
|
||||||
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1}},
|
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1}},
|
||||||
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1}},
|
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1}},
|
||||||
@@ -154,6 +155,7 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
|
|||||||
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1}},
|
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1}},
|
||||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data"}
|
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data"}
|
||||||
])
|
])
|
||||||
|
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEMREBATE",gateway_url: "http//192.168.1.47:3006"})
|
||||||
|
|
||||||
# shop = Shop.create(
|
# shop = Shop.create(
|
||||||
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
||||||
|
|||||||
Reference in New Issue
Block a user