Merge branch 'r-1804001-01' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001
This commit is contained in:
0
app/controllers/crm/customers_controller.rb
Executable file → Normal file
0
app/controllers/crm/customers_controller.rb
Executable file → Normal file
0
app/controllers/origami/customers_controller.rb
Executable file → Normal file
0
app/controllers/origami/customers_controller.rb
Executable file → Normal file
@@ -456,28 +456,27 @@ class Sale < ApplicationRecord
|
|||||||
sale_tax.save
|
sale_tax.save
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_tax = SaleTax.new(:sale => sale)
|
sale_tax = SaleTax.new(:sale => sale)
|
||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
|
|
||||||
# substract , to give after discount
|
# substract , to give after discount
|
||||||
total_tax = total_taxable - total_discount
|
total_tax = total_taxable - total_discount
|
||||||
#include or execulive
|
#include or execulive
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
rate = tax.rate
|
rate = tax.rate
|
||||||
divided_value = (100 + rate)/rate
|
divided_value = (100 + rate)/rate
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
else
|
else
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||||
end
|
end
|
||||||
#new taxable amount is standard rule for step by step
|
#new taxable amount is standard rule for step by step
|
||||||
if shop.calc_tax_order
|
if shop.calc_tax_order
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
end
|
end
|
||||||
|
sale_tax.inclusive = tax.inclusive
|
||||||
sale_tax.inclusive = tax.inclusive
|
sale_tax.save
|
||||||
sale_tax.save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
@@ -2682,7 +2681,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.all_receipts
|
def self.all_receipts
|
||||||
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
query = Sale.select("sales.*,sale_payments.created_at as receipt_close_time,
|
||||||
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
||||||
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
||||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
|
|||||||
0
app/views/crm/customers/_card_read_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_card_read_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_crm_customer.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/_crm_customer.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_new_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/_new_form.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.html.erb
Executable file → Normal file
0
app/views/crm/customers/edit.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/edit.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/index.html.erb
Executable file → Normal file
0
app/views/crm/customers/index.html.erb
Executable file → Normal file
0
app/views/crm/customers/index.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/index.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/new.html.erb
Executable file → Normal file
0
app/views/crm/customers/new.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.html.erb
Executable file → Normal file
0
app/views/crm/customers/show.json.jbuilder
Executable file → Normal file
0
app/views/crm/customers/show.json.jbuilder
Executable file → Normal file
0
app/views/origami/customers/index.html.erb
Executable file → Normal file
0
app/views/origami/customers/index.html.erb
Executable file → Normal file
@@ -113,6 +113,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
<div class="m-r-20" align="right">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- customer light box -->
|
<!-- customer light box -->
|
||||||
@@ -256,6 +262,7 @@
|
|||||||
getCardNo();
|
getCardNo();
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
customer_mamber_card_no = $("#paypar_account_no").val();
|
customer_mamber_card_no = $("#paypar_account_no").val();
|
||||||
|
|
||||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -429,7 +436,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#sxModal .btn_cancel").on('click',function(){
|
$(".btn_cancel").on('click',function(){
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -108,6 +108,13 @@
|
|||||||
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
<div class="m-r-20" align="right">
|
||||||
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- customer light box -->
|
<!-- customer light box -->
|
||||||
|
|||||||
@@ -213,7 +213,6 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
|
||||||
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
|
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<% if current_login_employee.role == "cashier" %>
|
||||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
@@ -224,6 +223,30 @@
|
|||||||
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||||
@@ -344,7 +367,6 @@ $(document).on('click', '.access_modal', function(event){
|
|||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
|
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
|
||||||
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ test:
|
|||||||
# instead read values from the environment.
|
# instead read values from the environment.
|
||||||
production:
|
production:
|
||||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||||
sx_provision_url: connect.pos-myanmar.com/api #192.168.1.147:3002/api
|
sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api
|
||||||
server_mode: application
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ namespace :consolidate do
|
|||||||
task :receipt => :environment do
|
task :receipt => :environment do
|
||||||
# Receipt.delete_all
|
# Receipt.delete_all
|
||||||
sales = Sale.all_receipts
|
sales = Sale.all_receipts
|
||||||
puts sales.to_json
|
|
||||||
shop = Shop.find(1)
|
shop = Shop.find(1)
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
puts sale.to_json
|
|
||||||
shift = ShiftSale.find(sale.shift_sale_id)
|
if sale.shift_sale_id.present?
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
receipt = Receipt.new
|
receipt = Receipt.new
|
||||||
receipt.client_code = shop.client_code
|
receipt.client_code = shop.client_code
|
||||||
receipt.client_name = shop.client_name
|
receipt.client_name = shop.client_name
|
||||||
@@ -48,6 +48,7 @@ puts sales.to_json
|
|||||||
receipt.cancle = (sale.payment_status=="void") ? false : true # void is cancel
|
receipt.cancle = (sale.payment_status=="void") ? false : true # void is cancel
|
||||||
receipt.remarks = sale.remark
|
receipt.remarks = sale.remark
|
||||||
receipt.save
|
receipt.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,10 +69,10 @@ puts sales.to_json
|
|||||||
@item_sequence = 1
|
@item_sequence = 1
|
||||||
sale_count = sales.to_a.count
|
sale_count = sales.to_a.count
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
|
|
||||||
if sale.qty > 0
|
if sale.qty > 0
|
||||||
|
|
||||||
if sale.item_instance_code !=nil
|
if sale.item_instance_code !=nil
|
||||||
|
byebug
|
||||||
menu_category = MenuCategory.find(MenuItem.find_by_item_code(sale.product_code).menu_category_id)
|
menu_category = MenuCategory.find(MenuItem.find_by_item_code(sale.product_code).menu_category_id)
|
||||||
name = menu_category.name
|
name = menu_category.name
|
||||||
code = menu_category.code
|
code = menu_category.code
|
||||||
@@ -90,7 +91,9 @@ puts sales.to_json
|
|||||||
|
|
||||||
@receipt_no = sale.receipt_no
|
@receipt_no = sale.receipt_no
|
||||||
@requested_at = sale.requested_at
|
@requested_at = sale.requested_at
|
||||||
|
if @receipt_no == '20171130-10464'
|
||||||
|
byebug
|
||||||
|
end
|
||||||
if sale_id == sale.sale_id || count == 0 || @z ==0
|
if sale_id == sale.sale_id || count == 0 || @z ==0
|
||||||
@total_qty += sale.qty
|
@total_qty += sale.qty
|
||||||
@total_gross_sales += sale.price
|
@total_gross_sales += sale.price
|
||||||
@@ -109,14 +112,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = @requested_at #requet-at
|
receipt.receipt_date = @requested_at #requet-at
|
||||||
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = ''
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = ''
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = ''
|
receipt.item_code = (sale.product_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = ''
|
receipt.item_name = sale.product_name
|
||||||
receipt.qty = @total_qty
|
receipt.qty = @total_qty
|
||||||
receipt.transaction_type = "Tender"
|
receipt.transaction_type = "Tender"
|
||||||
receipt.gross_sales = @total_gross_sales
|
receipt.gross_sales = @total_gross_sales
|
||||||
@@ -158,14 +161,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = sale.requested_at #requet-at
|
receipt.receipt_date = sale.requested_at #requet-at
|
||||||
receipt.transaction_date = sale.requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = sale.requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = name
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = code
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = menu_name
|
receipt.item_code = (menu_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = menu_code
|
receipt.item_name = menu_name
|
||||||
receipt.qty = sale.qty
|
receipt.qty = sale.qty
|
||||||
receipt.transaction_type = (sale.status==nil) ? "Sales" : sale.status
|
receipt.transaction_type = (sale.status==nil) ? "Sales" : sale.status
|
||||||
receipt.gross_sales = sale.price
|
receipt.gross_sales = sale.price
|
||||||
@@ -208,14 +211,14 @@ puts sales.to_json
|
|||||||
receipt.receipt_date = @requested_at #requet-at
|
receipt.receipt_date = @requested_at #requet-at
|
||||||
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
receipt.transaction_date = @requested_at #before disco/after tax /after/ser_char
|
||||||
receipt.item_sequence = @item_sequence
|
receipt.item_sequence = @item_sequence
|
||||||
receipt.category_code = ''
|
receipt.category_code = sale.product_code
|
||||||
receipt.category_name = ''
|
receipt.category_name = sale.product_name
|
||||||
receipt.sub_category_code = 0
|
receipt.sub_category_code = 0
|
||||||
receipt.sub_category_name = 0
|
receipt.sub_category_name = 0
|
||||||
receipt.report_group_code = 0
|
receipt.report_group_code = 0
|
||||||
receipt.report_group_name = 0
|
receipt.report_group_name = 0
|
||||||
receipt.item_code = ''
|
receipt.item_code = (menu_code.to_s=="NULL") ? "0" : sale.product_code
|
||||||
receipt.item_name = ''
|
receipt.item_name = menu_name
|
||||||
receipt.qty = @total_qty
|
receipt.qty = @total_qty
|
||||||
receipt.transaction_type = "Tender"
|
receipt.transaction_type = "Tender"
|
||||||
receipt.gross_sales = @total_gross_sales
|
receipt.gross_sales = @total_gross_sales
|
||||||
|
|||||||
Reference in New Issue
Block a user