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

This commit is contained in:
phyusin
2018-05-15 17:36:05 +06:30
8 changed files with 126 additions and 95 deletions

View File

@@ -24,7 +24,7 @@ class Reports::SaleitemController < BaseReportController
end end
@type = params[:sale_type] @type = params[:sale_type]
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type) @sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil) @sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@@ -62,7 +62,6 @@ class Reports::SaleitemController < BaseReportController
def show def show
from, to, report_type = get_date_range_from_params from, to, report_type = get_date_range_from_params
puts "aaaaaaaaaaaaaaaaaaaaaaaaaa"
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new date_arr = Array.new

View File

@@ -99,7 +99,7 @@ class Settings::MenusController < ApplicationController
sheet.add_row ["Name",menu.name], :style=>title sheet.add_row ["Name",menu.name], :style=>title
sheet.add_row sheet.add_row
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Price", "Is Default"], :style=>header_text sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Instance Attribute", "Price", "Is Default"], :style=>header_text
menu.menu_categories.each do |mc| menu.menu_categories.each do |mc|
mc.menu_items.each do |mi| mc.menu_items.each do |mi|
attributes = "" attributes = ""
@@ -119,8 +119,8 @@ class Settings::MenusController < ApplicationController
options = "" options = ""
i=0 i=0
if mi.item_options.length > 0 if mi.item_options.length > 0
mi.item_options.each do |mia| mi.item_options.each do |mio|
option = MenuItemOption.find(mia) option = MenuItemOption.find(mio)
if i == mi.item_options.length - 1 if i == mi.item_options.length - 1
options = options + option.name options = options + option.name
else else
@@ -131,68 +131,15 @@ class Settings::MenusController < ApplicationController
end end
mi.menu_item_instances.each do |mii| mi.menu_item_instances.each do |mii|
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, attributes, options, mii.item_instance_code, mii.item_instance_name, mii.price, mii.is_default], :style=>wrap_text attribute = ""
if mii.item_attributes.length > 0
attribute = MenuItemAttribute.find(mii.item_attributes[0]).name
end
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, attributes, options, mii.item_instance_code, mii.item_instance_name, attribute, mii.price, mii.is_default], :style=>wrap_text
end end
end end
end end
# # Category
# menu.menu_categories.each do |mc|
# sheet.add_row ["Category"], :style=>wrap_text
# sheet.add_row %w(id menu_id code name alt_name order_by created_by menu_category_id is_available), :style=>header_text
# sheet.add_row [mc.id, mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available], :style=>wrap_text
# sheet.add_row
# # Menu Item
# mc.menu_items.each do |mi|
# sheet.add_row ["Menu Item"], :style=>wrap_text
# sheet.add_row %w(id item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id min_qty taxable is_sub_item is_available created_by), :style=>header_text
# sheet.add_row [mi.id,mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by], :style=>wrap_text
# sheet.add_row
# # Menu Item Instance
# sheet.add_row ["Menu Item Instance"], :style=>wrap_text
# sheet.add_row %w(id menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default), :style=>header_text
# mi.menu_item_instances.each do |mii|
# sheet.add_row [mii.id, mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default], :style=>wrap_text
# end
# sheet.add_row
# end
# end
end end
# # Account
# wb.add_worksheet(name: "Account") do |sheet|
# sheet.add_row %w(id title account_type discount point bonus rebate), :style=>header_text
# Account.all.each do |acc|
# sheet.add_row [acc.id, acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate], :style=>wrap_text
# end
# end
# # Item set
# wb.add_worksheet(name: "Item Set") do |sheet|
# sheet.add_row %w(id name alt_name min_selectable_qty max_selectable_qty), :style=>header_text
# ItemSet.all.each do |set|
# sheet.add_row [set.id,set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty], :style=>wrap_text
# end
# end
# # Item Options
# wb.add_worksheet(name: "Menu Item Options") do |sheet|
# sheet.add_row %w(id option_type name value), :style=>header_text
# MenuItemOption.all.each do |option|
# sheet.add_row [option.id, option.option_type, option.name, option.value], :style=>wrap_text
# end
# end
# # Item Attributes
# wb.add_worksheet(name: "Menu Item Attributes") do |sheet|
# sheet.add_row %w(id attribute_type name value), :style=>header_text
# MenuItemAttribute.all.each do |attr|
# sheet.add_row [attr.id, attr.attribute_type,attr.name,attr.value], :style=>wrap_text
# end
# end
end end
directory_name = "public/menus" directory_name = "public/menus"

View File

@@ -149,8 +149,6 @@ class Menu < ApplicationRecord
menu_cat = MenuCategory.find_by_code(row["Category Code"]) menu_cat = MenuCategory.find_by_code(row["Category Code"])
if !menu_cat if !menu_cat
menu_cat = MenuCategory.create({menu_id: imported_menu.id, code: row["Category Code"], name: row["Category Name"], alt_name: '', order_by: (ii - 3), created_by: created_by, menu_category_id: nil, is_available: 1}) menu_cat = MenuCategory.create({menu_id: imported_menu.id, code: row["Category Code"], name: row["Category Name"], alt_name: '', order_by: (ii - 3), created_by: created_by, menu_category_id: nil, is_available: 1})
# else
# status = status + "Category Code already exists."
end end
# Menu Item Attributes # Menu Item Attributes
@@ -191,15 +189,32 @@ class Menu < ApplicationRecord
# status = status + "Item Code already exists for " + row["Item Name"] + "." # status = status + "Item Code already exists for " + row["Item Name"] + "."
end end
instance_attr = []
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"]) menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
if !menu_inst if !menu_inst
instance_name = '' instance_name = ''
if !row["Instance Name"].nil? if !row["Instance Name"].nil?
instance_name = row["Instance Name"] instance_name = row["Instance Name"]
end end
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
# else if !row["Attributes"].nil?
# status = status + "Instance Code already exists for " + row["Instance Name"] + "." if !row["Instance Attribute"].nil?
attributes = row["Attributes"].split(',')
instance_attributes = row["Instance Attribute"].split(',')
attributes.each do |attr|
if attr == instance_attributes[0]
ins_attr = MenuItemAttribute.find_by_name(attr)
instance_attr.push(ins_attr.id)
end
end
end
end
is_default = 0
if !row["Is Default"].nil?
is_default = row["Is Default"]
end
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: instance_attr, price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: is_default)
end end
end end
end end

View File

@@ -942,10 +942,12 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
total_grand_total = 0 total_grand_total = 0
other_charges = self.get_other_charges() other_charges = self.get_other_charges()
product = self.get_product_sale()
if shift.present? if shift.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -966,6 +968,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
elsif shift_sale_range.present? elsif shift_sale_range.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -986,6 +989,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
else else
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to) query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to) other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount) discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed) change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount, sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -1004,7 +1008,17 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
end end
return query,other_charges, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount return query,other_charges, product, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
end
def self.get_product_sale()
query = Sale.select("i.account_id as account_id, " +
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item," +
"i.status as status_type,"+
" i.unit_price as unit_price,i.product_name as product_name,i.product_code as product_code")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id")
query = query.joins("JOIN products p ON p.`item_code` = i.product_code")
query = query.group("i.product_code")
end end
#product sale report query #product sale report query

View File

@@ -44,9 +44,10 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th> <th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th> <th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th> <th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> <!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th> <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
</tr> </tr>
</thead> </thead>
<% if @print_settings.precision.to_i > 0 <% if @print_settings.precision.to_i > 0
@@ -121,9 +122,10 @@
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td> <td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr> </tr>
<% count = count + 1 %> <% count = count + 1 %>
<% end %> <% end %>
@@ -144,12 +146,13 @@
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td> <td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr> <td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% total_tax = 0 %> <% total_tax = 0 %>
<% net = 0 %>
<% unless @tax.empty? %> <% unless @tax.empty? %>
<% @tax.each do |tax| %> <% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %> <% total_tax += tax.tax_amount.to_f %>
@@ -161,7 +164,16 @@
<% end %> <% end %>
<% end %> <% end %>
<% net = total - total_tax %> <tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'>Discount </td>
<td style='text-align:right;'><%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% net = grand_total%>
<% net = grand_total- discount%>
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;"> <tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td> <td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> <td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>

View File

@@ -72,6 +72,7 @@
<% grand_total = 0 %> <% grand_total = 0 %>
<% old_grand_total = 0 %> <% old_grand_total = 0 %>
<% after_rounding = 0 %>
<% total_tax = 0 %> <% total_tax = 0 %>
<% guest_count = 0 %> <% guest_count = 0 %>
<% total_sum = 0 %> <% total_sum = 0 %>
@@ -82,13 +83,15 @@
<%if @sale_data %> <%if @sale_data %>
<% @sale_data.each do |result| %> <% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f %> <% grand_total +=result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %> <% old_grand_total += result.grand_total_after_rounding() %>
<% total_tax += result.total_tax.to_f %> <% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %> <% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %> <% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %> <% rounding_adj += result.rounding_adjustment.to_f %>
<tr> <tr>
<td><%= result.receipt_no rescue '-' %> </td> <td><%= result.receipt_no rescue '-' %> </td>
@@ -101,12 +104,11 @@
<% result.sale_taxes.each do |tax| %> <% result.sale_taxes.each do |tax| %>
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<%end%> <%end%>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<% end %> <% end %>
<tr style="border-top:4px double #666;"> <tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
@@ -121,9 +123,10 @@
<td><b>0</b></td> <td><b>0</b></td>
<% end %> <% end %>
<% end %> <% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td> <td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td> <td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td> <td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
</tr> </tr>
<tr> <tr>
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>

View File

@@ -59,10 +59,11 @@
%> %>
<% acc_arr = Array.new %> <% acc_arr = Array.new %>
<% cate_arr = Array.new %> <% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %> <% sub_qty = 0 %>
<% sub_total = 0 %> <% sub_total = 0 %>
<% other_sub_total = 0 %> <% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %> <% count = 0 %>
<% total_price = 0 %> <% total_price = 0 %>
<% cate_count = 0 %> <% cate_count = 0 %>
@@ -161,8 +162,47 @@
<% end %> <% end %>
<!-- end sub total --> <!-- end sub total -->
<% end %> <% end %>
<!--Product Sale -->
<% if @product.present?%>
<tr>
<td><b>Product</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
<tr>
<td>&nbsp;</td>
<td>Product</td>
<td><%= product.product_code rescue '-' %></td>
<td><%= product.product_name rescue '-' %></td>
<td><%= product.total_item rescue '-' %></td>
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% product_sub_total += product.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total Product Qty </b> </td>
<td><b><%= p_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Product Sale -->
<!--Other Charges --> <!--Other Charges -->
<% if @type == "other"%> <% if @type == "other" || @other_charges.present?%>
<tr> <tr>
<td><b>Other Charges</b></td> <td><b>Other Charges</b></td>

View File

@@ -3,6 +3,7 @@ class CreateMenus < ActiveRecord::Migration[5.1]
create_table :menus do |t| create_table :menus do |t|
t.string :name t.string :name
t.boolean :is_active, :null => false, :deafult => true t.boolean :is_active, :null => false, :deafult => true
t.boolean :is_checksum, :default => false
t.string :valid_days, :null => false, :default => "1,2,3,4,5,6,7" t.string :valid_days, :null => false, :default => "1,2,3,4,5,6,7"
t.time :valid_time_from, :null => false, :default => "00:00:00" t.time :valid_time_from, :null => false, :default => "00:00:00"
t.time :valid_time_to, :null => false, :default => "23:59:59" t.time :valid_time_to, :null => false, :default => "23:59:59"