prepare for payment bill

This commit is contained in:
Yan
2017-06-14 18:15:01 +06:30
parent ac7d99362d
commit dd9863025f
4 changed files with 29 additions and 25 deletions

View File

@@ -19,10 +19,10 @@
//= require bootstrap-datepicker //= require bootstrap-datepicker
$(document).ready(function(){ $(document).ready(function(){
// auto refresh every 10 seconds // auto refresh every 60 seconds
setTimeout(function(){ setTimeout(function(){
window.location.reload(1); window.location.reload(1);
}, 10000); }, 60000);
// For selected order return // For selected order return
var order_status = ""; var order_status = "";

View File

@@ -11,6 +11,21 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash") sale_payment.process_payment(saleObj, @user, cash, "cash")
unique_code = "ReceiptBillPdf"
customer= Customer.where('customer_id=' + saleObj.customer_id)
# get member information
response = get_member_information(customer, "get_all_member_account")
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
end end
end end
@@ -25,19 +40,8 @@ class Origami::PaymentsController < BaseOrigamiController
#get customer amount #get customer amount
@customer = Customer.find(@sale_data.customer_id) @customer = Customer.find(@sale_data.customer_id)
membership = MembershipSetting.find_by_membership_type("paypar_url") # get member information
response = get_member_information(@customer, "get_all_member_account")
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
@balance = 0.00 @balance = 0.00
@accountable_type = '' @accountable_type = ''
@@ -64,5 +68,4 @@ class Origami::PaymentsController < BaseOrigamiController
end end
end end
end end
end end

View File

@@ -1,6 +1,5 @@
class Origami::RequestBillsController < BaseOrigamiController class Origami::RequestBillsController < BaseOrigamiController
# Print Request Bill and add to sale tables
def print def print
@sale = Sale.new @sale = Sale.new
sale_order=SaleOrder.new sale_order=SaleOrder.new
@@ -20,10 +19,11 @@ class Origami::RequestBillsController < BaseOrigamiController
unique_code = "ReceiptBillPdf" unique_code = "ReceiptBillPdf"
customer= Customer.where('customer_id=' + @sale_data.customer_id) customer= Customer.where('customer_id=' + @sale_data.customer_id)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)
# find order id by sale id # find order id by sale id
sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id) # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# Calculate Food and Beverage Total # Calculate Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items) food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)

View File

@@ -167,16 +167,17 @@
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"> <a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-arrow-left fa-lg"></i> Back <i class="fa fa-arrow-left fa-lg"></i> Back
</a> </a>
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"> <!-- Temporary No Needs -->
<!-- <a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-trash fa-lg"></i> Void Sale <i class="fa fa-trash fa-lg"></i> Void Sale
</a> </a>
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"> <a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale <i class="fa fa-invoice fa-lg"></i> Complete Sale
</a> </a> -->
</div> </div>
</div> </div>