Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm
This commit is contained in:
@@ -8,6 +8,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
sale_id = params[:sale_id] # sale_id
|
sale_id = params[:sale_id] # sale_id
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||||
|
member_info = nil
|
||||||
|
|
||||||
# Print for First Bill to Customer
|
# Print for First Bill to Customer
|
||||||
|
|
||||||
@@ -17,7 +18,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
customer= Customer.find(sale_data.customer_id)
|
customer= Customer.find(sale_data.customer_id)
|
||||||
# get member information
|
# get member information
|
||||||
|
if customer.membership_id != nil
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
|
end
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
@@ -36,6 +39,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
member_info = nil
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@@ -46,11 +51,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop.find(1)
|
||||||
# get member information
|
# get member information
|
||||||
|
if customer.membership_id != nil
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
|
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||||
|
end
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
@@ -67,6 +75,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
@cash = 0.0
|
@cash = 0.0
|
||||||
@other = 0.0
|
@other = 0.0
|
||||||
@@ -76,15 +85,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@mastercount = 0.0
|
@mastercount = 0.0
|
||||||
@credit = 0.0
|
@credit = 0.0
|
||||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
@balance = 0.00
|
||||||
|
@accountable_type = ''
|
||||||
|
|
||||||
#get customer amount
|
#get customer amount
|
||||||
@customer = Customer.find(@sale_data.customer_id)
|
@customer = Customer.find(@sale_data.customer_id)
|
||||||
|
|
||||||
# get member information
|
# get member information
|
||||||
|
if @customer.membership_id != nil
|
||||||
response = Customer.get_member_account(@customer)
|
response = Customer.get_member_account(@customer)
|
||||||
|
|
||||||
@balance = 0.00
|
|
||||||
@accountable_type = ''
|
|
||||||
if response["status"]==true
|
if response["status"]==true
|
||||||
response["data"].each do |res|
|
response["data"].each do |res|
|
||||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||||
@@ -94,6 +103,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#end customer amount
|
#end customer amount
|
||||||
|
|
||||||
@@ -119,8 +129,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reprint
|
def reprint
|
||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
member_info = nil
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
@@ -130,8 +140,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop.find(1)
|
||||||
# get member information
|
# get member information
|
||||||
|
if customer.membership_id != nil
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||||
|
end
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ class OrderItemPdf < Prawn::Document
|
|||||||
include ActionView::Helpers::NumberHelper
|
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
|
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)
|
def initialize(print_settings,order_item, print_status, options, alt_name)
|
||||||
self.page_width = 180
|
self.page_width = 185
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
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.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_height = 15
|
||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=90
|
self.label_width=90
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
include ActionView::Helpers::NumberHelper
|
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
|
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)
|
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.page_height = 1450
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
self.price_width = 40 # No Need for item
|
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.total_width = 40 # No Need for item
|
||||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
|
|||||||
@@ -140,12 +140,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
pad_top(15) {
|
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 "#{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, :height =>self.item_height, :size => self.item_font_size, :align => :right, :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, :height =>self.item_height, :size => self.item_font_size, :align => :center, :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, :height =>self.item_height, :size => self.item_font_size, :align => :right, :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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user