Merge branch 'crm' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -48,7 +48,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
end
|
||||
|
||||
@@ -52,6 +52,10 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
@@ -30,7 +30,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
cashier_info(sale_data, customer_name)
|
||||
line_items(sale_items)
|
||||
items_account(item_price_by_accounts)
|
||||
all_total(sale_data)
|
||||
|
||||
|
||||
@@ -39,6 +38,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
|
||||
items_account(item_price_by_accounts)
|
||||
|
||||
footer
|
||||
end
|
||||
@@ -61,19 +62,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
# text "Customer:", :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
||||
# text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# move_down 5
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.item_width) do
|
||||
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||
@@ -86,27 +78,26 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
move_down 5
|
||||
|
||||
# bounding_box([self.label_width,y_position], :width =>self.item_width) do
|
||||
# text "#{customer_name}" , :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# move_down 5
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Time In: #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "Time Out: #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right
|
||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
||||
text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
|
||||
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
|
||||
# :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
end
|
||||
|
||||
def line_items(sale_items)
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
pad_top(15) {
|
||||
# @item_width.to_i + @half_qty.to_i
|
||||
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
@@ -114,10 +105,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "Total", :at =>[(self.item_width+self.price_width+4),y_position], :width => self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
|
||||
move_down 5
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
|
||||
add_line_item_row(sale_items)
|
||||
end
|
||||
|
||||
@@ -142,7 +131,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text_box "#{qty}", :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 "#{total_price}", :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
|
||||
}
|
||||
move_down 3
|
||||
move_down 1
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -158,20 +147,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
end
|
||||
|
||||
def items_account(item_price_by_accounts)
|
||||
y_position = cursor
|
||||
item_price_by_accounts.each do |ipa|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
end
|
||||
end
|
||||
|
||||
def all_total(sale_data)
|
||||
item_name_width = self.item_width
|
||||
y_position = cursor
|
||||
@@ -267,7 +242,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Amount", :size => self.item_font_size,:align => :left
|
||||
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
|
||||
@@ -278,10 +253,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["redeem"] }" , :size => self.item_font_size,:align => :right
|
||||
text "(#{ res["redeem"] })" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -317,7 +292,23 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def items_account(item_price_by_accounts)
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
item_price_by_accounts.each do |ipa|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def footer
|
||||
@@ -331,3 +322,4 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<% if @response["status"] == true && $response["data"] != "[]"%>
|
||||
<% puts "'''''''''''''''''''"
|
||||
puts @response
|
||||
if @response["status"] == true %>
|
||||
<tr>
|
||||
<th colspan="5">Membership Transactions</th>
|
||||
<% if @response["status"] == true %>
|
||||
@@ -101,28 +103,22 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order ID</th>
|
||||
<th>Menu Item</th>
|
||||
<th>QTY</th>
|
||||
<th>Unit Price </th>
|
||||
<th>Option</th>
|
||||
<th>Status</th>
|
||||
<th>Waiter</th>
|
||||
<th>Created at </th>
|
||||
<th>Order ID </th>
|
||||
<th>Type</th>
|
||||
<th>Order status</th>
|
||||
<th>Order date</th>
|
||||
<th>Items Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<% @orders.each do |order| %>
|
||||
<tr>
|
||||
<td><%= order_item.order_id %></td>
|
||||
<td><%= order_item.item_name %></td>
|
||||
<td><%= order_item.qty %></td>
|
||||
<td><%= order_item.price %></td>
|
||||
<td><%= order_item.options %></td>
|
||||
<td><%= order_item.order_item_status %></td>
|
||||
<td><%= order_item.item_order_by %> </td>
|
||||
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
|
||||
<td><%= order.order_id %></td>
|
||||
<td><%= order.order_type %></td>
|
||||
<td><%= order.status %></td>
|
||||
<td><%= order.date.strftime("%d-%m-%Y") %> </td>
|
||||
<td><%= order.item_count %> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -137,62 +133,33 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sale ID </th>
|
||||
<th>Menu Item</th>
|
||||
<th>QTY</th>
|
||||
<th>Unit Price </th>
|
||||
<th>Tax Price</th>
|
||||
<th>Created At</th>
|
||||
<th>Sale Id </th>
|
||||
<th>Receipt no </th>
|
||||
<th>Grand total</th>
|
||||
<th>Tax amount</th>
|
||||
<th>Cashier</th>
|
||||
<th>Sales status</th>
|
||||
<th>Receipt Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @sale_items.each do |sale_item| %>
|
||||
<tr>
|
||||
<td><%= sale_item.sale_id %></td>
|
||||
<td><%= sale_item.product_name %></td>
|
||||
<td><%= sale_item.qty %></td>
|
||||
<td><%= sale_item.unit_price %></td>
|
||||
|
||||
<td><%= sale_item.taxable_price %></td>
|
||||
<td><%= sale_item.created_at %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% @sales.each do |sale| %>
|
||||
<tr>
|
||||
<td><%= sale.sale_id %></td>
|
||||
<td><%= sale.receipt_no %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
<td><%= sale.total_tax %></td>
|
||||
<td><%= sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= sale.sale_status %> </td>
|
||||
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
<h3>Sale Details</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sale ID </th>
|
||||
<th>Menu Item</th>
|
||||
<th>QTY</th>
|
||||
<th>Unit Price </th>
|
||||
<th>Tax Price</th>
|
||||
<th>Created At</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @sale_items.each do |sale_item| %>
|
||||
<tr>
|
||||
<td><%= sale_item.sale_id %></td>
|
||||
<td><%= sale_item.product_name %></td>
|
||||
<td><%= sale_item.qty %></td>
|
||||
<td><%= sale_item.unit_price %></td>
|
||||
|
||||
<td><%= sale_item.taxable_price %></td>
|
||||
<td><%= sale_item.created_at %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,10 +49,13 @@
|
||||
<% if current_login_employee %>
|
||||
<div class="right">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<li style="color: #959595"><%= current_login_employee.name %> </li>
|
||||
|
||||
<li style="padding-right:10px;padding-left:10px"> | </li>
|
||||
<li ><%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
</li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -131,7 +131,8 @@ menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size"
|
||||
menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"})
|
||||
menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"})
|
||||
|
||||
|
||||
shop = Shop.create({id:1, name: "Beauty In the Pot", address:'No.3, 23 street', township:"Yankin",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"09 99988888, 0912374734",reservation_no:"111",license:"123",
|
||||
activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111"})
|
||||
#Default Order Queue stations
|
||||
# order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
|
||||
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
|
||||
|
||||
Reference in New Issue
Block a user