Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm

This commit is contained in:
Aung Myo
2017-07-05 18:28:55 +06:30
4 changed files with 34 additions and 22 deletions

View File

@@ -8,6 +8,7 @@ class Origami::PaymentsController < BaseOrigamiController
sale_id = params[:sale_id] # sale_id
sale_data = Sale.find_by_sale_id(sale_id)
sale_items = SaleItem.where("sale_id=?",sale_id)
member_info = nil
# Print for First Bill to Customer
@@ -17,7 +18,9 @@ class Origami::PaymentsController < BaseOrigamiController
# customer= Customer.where('customer_id=' +.customer_id)
customer= Customer.find(sale_data.customer_id)
# get member information
member_info = Customer.get_member_account(customer)
if customer.membership_id != nil
member_info = Customer.get_member_account(customer)
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -36,6 +39,8 @@ class Origami::PaymentsController < BaseOrigamiController
def create
cash = params[:cash]
sale_id = params[:sale_id]
member_info = nil
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
@@ -46,11 +51,14 @@ class Origami::PaymentsController < BaseOrigamiController
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
#shop detail
shop_details = Shop.find(1)
# get member information
member_info = Customer.get_member_account(customer)
if customer.membership_id != nil
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -67,6 +75,7 @@ class Origami::PaymentsController < BaseOrigamiController
def show
sale_id = params[:sale_id]
if Sale.exists?(sale_id)
@cash = 0.0
@other = 0.0
@@ -76,16 +85,16 @@ class Origami::PaymentsController < BaseOrigamiController
@mastercount = 0.0
@credit = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
@balance = 0.00
@accountable_type = ''
#get customer amount
@customer = Customer.find(@sale_data.customer_id)
# get member information
response = Customer.get_member_account(@customer)
@balance = 0.00
@accountable_type = ''
if response["status"]==true
if @customer.membership_id != nil
response = Customer.get_member_account(@customer)
if response["status"]==true
response["data"].each do |res|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
@balance += res["balance"]
@@ -93,7 +102,8 @@ class Origami::PaymentsController < BaseOrigamiController
@accountable_type = "Rebate Balance"
end
end
end
end
end
#end customer amount
@@ -119,8 +129,8 @@ class Origami::PaymentsController < BaseOrigamiController
end
def reprint
sale_id = params[:sale_id]
member_info = nil
saleObj = Sale.find(sale_id)
@@ -130,8 +140,10 @@ class Origami::PaymentsController < BaseOrigamiController
#shop detail
shop_details = Shop.find(1)
# get member information
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
if customer.membership_id != nil
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)

View File

@@ -2,13 +2,13 @@ class OrderItemPdf < 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
def initialize(print_settings,order_item, print_status, options, alt_name)
self.page_width = 180
self.page_width = 185
self.page_height = 1450
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 30
self.qty_width = 35
self.total_width = 40 # No Need for item
self.item_width = self.page_width - self.qty_width
self.item_width = self.page_width - (self.qty_width - self.margin)
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90

View File

@@ -2,11 +2,11 @@ class OrderSummaryPdf < 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
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
self.page_width = 180
self.page_width = 190
self.page_height = 1450
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 30
self.qty_width = 35
self.total_width = 40 # No Need for item
self.item_width = self.page_width - (self.qty_width - self.margin)
self.item_height = 15

View File

@@ -140,12 +140,12 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor
pad_top(15) {
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size, :overflow => :shrink_to_fix
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_name_width,y_position], :width => self.qty_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
move_down 1
move_down 5
end
end