diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index 5cacee2e..0439efcb 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -73,8 +73,9 @@ $(function() {
}
//end show list function
//click menu sidebar menu category
- $(".menu_category").on("click", function(){
- var menu_id = $(this).find(".menu-id").text();
+ // $(".menu_category").on("click", function(){
+ $(document).on('click', '.menu_category', function(event){
+ var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url);
});
@@ -918,6 +919,47 @@ $(function() {
}
});
+ //click menu sidebar menu category
+
+ $(".sub_click").on("click", function(){
+ var menu_id = $(this).attr("data-id");
+ var url = "get_menu_sub_category/"+menu_id;
+ sub_category = $(this).find('.sub_category_list');
+ show_sub_category_list(url,sub_category);
+ });
+ //End menu category Click
+
+ //show menu item list when click menu category
+ function show_sub_category_list(url,sub_category){
+
+ var menu_list = $('.sub_category_list');
+ menu_list.empty();
+ //Start Ajax
+ $.ajax({
+ type: "GET",
+ url: url,
+ data: {},
+ dataType: "json",
+ success: function(data) {
+ var sub_category_list = $('.sub_category_list');
+ sub_category_list.empty();
+ data = data.sub_category;
+
+ if (data.length>0) {
+ $(sub_category).removeClass('hidden');
+ for(var i in data) {
+
+ row = '
' ;
+ $(sub_category).append(row);
+ //end is_sub_item false
+ }
+ }
+ }
+ });
+ //end Ajax
+ }
/* $("input").keypress(function(){
$("span").text(i += 1);
});*/
diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss
index 03a13c06..bf09f726 100755
--- a/app/assets/stylesheets/addorder.scss
+++ b/app/assets/stylesheets/addorder.scss
@@ -69,7 +69,17 @@ section .content{
font-weight: bold;
border-color: #fff #fff #fff #54A5AF;
}
-
+.sub_category_list{
+ background:#fff;
+ margin-top:8px;
+}
+.sub_category_list > li{
+ list-style:none;
+ margin-left:-40px;
+}
+.sub_category_list > li > a.nav-link{
+ border-bottom:1px solid #eee;
+}
.custom-modal-dialog {
left:auto;
right: auto;
diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb
index e0739e88..f580a92f 100755
--- a/app/controllers/origami/discounts_controller.rb
+++ b/app/controllers/origami/discounts_controller.rb
@@ -180,6 +180,7 @@ class Origami::DiscountsController < BaseOrigamiController
end
generic_customer_id = sale.customer.membership_id
+ account_no = sale.customer.paypar_account_no
receipt_no = sale.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("member_discount")
diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb
index ae3d1073..51a1f7db 100755
--- a/app/controllers/origami/other_charges_controller.rb
+++ b/app/controllers/origami/other_charges_controller.rb
@@ -37,7 +37,7 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.qty = 1
sale_item.unit_price = di["price"]
sale_item.taxable_price = di["price"] * 1
- sale_item.is_taxable = 1
+ sale_item.is_taxable = di["is_taxable"]
sale_item.account_id = 0
sale_item.price = di["price"] * 1
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 5b0db19f..4225b3dd 100755
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -91,8 +91,9 @@ class Origami::PaymentsController < BaseOrigamiController
if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
+ current_balance = SaleAudit.paymal_search(sale_id)
end
-
+
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
@@ -100,7 +101,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
- printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
+ printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance)
end
end
@@ -212,6 +213,7 @@ class Origami::PaymentsController < BaseOrigamiController
if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
+ current_balance = SaleAudit.paymal_search(sale_id)
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -221,7 +223,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
- printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
+ printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance)
end
def foc
@@ -230,6 +232,7 @@ class Origami::PaymentsController < BaseOrigamiController
sub_total = params[:sub_total]
member_info = nil
rebate_amount = nil
+ current_balance = nil
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
diff --git a/app/models/license.rb b/app/models/license.rb
index 37ed5149..0f2fd0ed 100755
--- a/app/models/license.rb
+++ b/app/models/license.rb
@@ -18,39 +18,21 @@ class License
if (server != "")
self.class.base_uri server
end
-
- # @secret = ENV["aes_key"]
- # @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
end
+ # For Cloud
def detail_with_local_cache(lookup)
-
aes = MyAesCrypt.new
aes_key, aes_iv = aes.export_to_file(lookup)
- # flag = ENV["AES_IV"]
- # # Check Exists IV
- # if flag == "<%= ENV['AES_IV'] %>"
- # # Export for Key
- # aes = MyAesCrypt.new
- # aes_key, aes_iv = aes.export_key(lookup)
- # else
- # aes_key = ENV["AES_KEY"]
- # aes_iv = ENV["AES_IV"]
- # end
- ##Check from local redis - if available load local otherwise get from remote
- cache_key = "#{lookup}:license:#{aes_key}:hostname"
- # No Needs for current
- # @secret = key
+ ##Check from local redis - if available load local otherwise get from remote
+ cache_key = "#{lookup}:license:#{aes_key}:hostname"
cache_license = nil
##Get redis connection from connection pool
redis = Redis.new
- cache_license = redis.get(cache_key)
- # Redis.current do |conn|
- # cache_license = conn.get(cache_key)
- # end
+ cache_license = redis.get(cache_key)
Rails.logger.info "Cache key - " + cache_key.to_s
if cache_license.nil?
@@ -85,7 +67,7 @@ class License
end
end
-
+ # For Local System
def detail_with_local_file()
has_license = true # verify_license()
@@ -117,8 +99,7 @@ class License
end
def verify_license
- api_token = read_license_no_decrypt("api_token")
- puts api_token
+ api_token = read_license_no_decrypt("api_token")
@params = { query: {lookup_type: "application", api_token: api_token} }
response = self.class.get("/verify", @params)
@varified = response.parsed_response
diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb
index 40a60201..78aa204e 100755
--- a/app/models/printer/receipt_printer.rb
+++ b/app/models/printer/receipt_printer.rb
@@ -65,12 +65,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
#Bill Receipt Print
- def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status)
+ def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance)
#Use CUPS service
#Generate PDF
#Print
- pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status)
+ pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance)
# print as print copies in printer setting
count = printer_settings.print_copies
diff --git a/app/models/sale.rb b/app/models/sale.rb
index 3ea731e0..e92b1bb5 100755
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -979,7 +979,8 @@ end
def self.hourly_sales(today)
query= Sale.select("grand_total")
.where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
- .group("date_format(convert_tz(receipt_date,'+00:00','+06:30'), '%I:%p')")
+ .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')")
+ .order('receipt_date')
end
def self.employee_sales(today)
diff --git a/app/models/sale_audit.rb b/app/models/sale_audit.rb
index 2a986807..55541851 100755
--- a/app/models/sale_audit.rb
+++ b/app/models/sale_audit.rb
@@ -89,6 +89,25 @@ class SaleAudit < ApplicationRecord
sale_audit.save!
end
+ def self.paymal_search(sale_id)
+ paymal = SaleAudit.where("sale_id =? and action = 'PAYMAL'",sale_id)
+ remark = paymal[0].remark.split("}")
+ response = "["+remark[0]+'}]'
+ response = JSON.parse(response)
+ puts response
+ if response[0]["status"] == true
+ if response[0]["current_rebate_amount"].present?
+ amount = response[0]["current_rebate_amount"]
+ else
+ amount = response[0]["current_balance_amount"]
+ end
+ else
+ amount = nil
+ end
+ return amount
+
+ end
+
private
def generate_custom_id
self.sale_audit_id = SeedGenerator.generate_id(self.class.name, "SAI")
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index 40ec63ac..236606c6 100755
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -327,7 +327,7 @@ class SalePayment < ApplicationRecord
response = rebat(sObj)
#record an payment in sale-audit
- remark = "#{response} Redeem- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
+ remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
if !response.nil?
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index c48dfa7f..dfd67d89 100755
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -1,7 +1,7 @@
class ReceiptBillPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
- def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
+ def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance)
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 5
@@ -55,7 +55,7 @@ class ReceiptBillPdf < Prawn::Document
if member_info != nil
- member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter)
+ member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
end
customer(customer_name)
@@ -286,7 +286,7 @@ class ReceiptBillPdf < Prawn::Document
end
# show member information
- def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
+ def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
if rebate_amount != nil
if rebate_amount["status"] == true
stroke_horizontal_rule
@@ -342,22 +342,15 @@ class ReceiptBillPdf < Prawn::Document
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
-
- if redeem == 0
- old = total - rebate_balance
- else
- # if redeem_count == 0
- old = balance + redeem
- # end
- end
-
- move_down 5
+ if current_balance != nil
+ move_down 5
y_position = cursor
- bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
- text "Old Balance", :size => self.item_font_size,:align => :left
- end
- bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
- text "#{number_with_precision(old, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
+ text "Old Balance", :size => self.item_font_size,:align => :left
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
+ text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ end
end
end
@@ -371,7 +364,6 @@ class ReceiptBillPdf < Prawn::Document
total_balance = total_balance + res["balance"]
end
-
end
move_down 5
y_position = cursor
diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb
index 7511d1c4..a42bce49 100755
--- a/app/views/home/dashboard.html.erb
+++ b/app/views/home/dashboard.html.erb
@@ -227,7 +227,7 @@
<% if !@total_order.nil? %>
| <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : |
- <%= @total_order.total_order %> |
+ <%= @total_order.total_order %> |
<% end %>
@@ -235,7 +235,7 @@
<% @total_accounts.each do |account| %>
| <%= account.title %> (Account) : |
-
+ |
<% @account_data.each do |data| %>
<% acc = account.title %>
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
@@ -247,14 +247,14 @@
<% if !@top_items.nil? %>
|
| <%= t :top %> <%= t("views.right_panel.detail.item") %> : |
- <%= @top_items.item_name %>
+ | <%= @top_items.item_name %>
(<%= @top_items.item_total_price %>) |
<% end %>
<% if !@total_foc_items.nil? %>
| <%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : |
- <%= @total_foc_items %> |
+ <%= @total_foc_items %> |
<% end %>
diff --git a/app/views/layouts/login_dashboard.html.erb b/app/views/layouts/login_dashboard.html.erb
index 3c9de032..415856b9 100755
--- a/app/views/layouts/login_dashboard.html.erb
+++ b/app/views/layouts/login_dashboard.html.erb
@@ -65,13 +65,10 @@
-