update menu cateogry and myanmar font in xls

This commit is contained in:
Aung Myo
2018-05-21 15:30:15 +06:30
parent 073e054666
commit f5ad727c08
18 changed files with 139 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ class MenuCategory < ApplicationRecord
validates_presence_of :code, :name, :menu, :order_by validates_presence_of :code, :name, :menu, :order_by
validates_uniqueness_of :code validates_uniqueness_of :code
default_scope { order('name asc') } default_scope { order('order_by asc') }
scope :active, -> {where("is_available = 1")} scope :active, -> {where("is_available = 1")}
def self.destroyCategory(menu_category) def self.destroyCategory(menu_category)

View File

@@ -16,7 +16,7 @@ class MenuItem < ApplicationRecord
validates_presence_of :item_code, :name, :type, :min_qty,:account_id validates_presence_of :item_code, :name, :type, :min_qty,:account_id
validates_uniqueness_of :item_code validates_uniqueness_of :item_code
default_scope { order('name asc') } default_scope { order('item_code asc') }
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') } scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
scope :set_menu_item, -> { where(type: 'SetMenuItem') } scope :set_menu_item, -> { where(type: 'SetMenuItem') }

View File

@@ -205,7 +205,7 @@ class ReceiptBillA5Pdf < Prawn::Document
price = item.unit_price price = item.unit_price
product_name = item.product_name product_name = item.product_name
if show_price.to_i>0 if !show_price.nil? && show_price.value.to_i>0
item_row(item,precision,delimiter,product_name,price,qty ,total_price) item_row(item,precision,delimiter,product_name,price,qty ,total_price)
else else
if item.price != 0 if item.price != 0

View File

@@ -187,7 +187,7 @@ class ReceiptBillPdf < Prawn::Document
total_qty = 0.0 total_qty = 0.0
sale_items.each do |item| sale_items.each do |item|
# check for item not to show # check for item not to show
show_price = Lookup.find_by_lookup_type("show_price").value show_price = Lookup.find_by_lookup_type("show_price")
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
if item.status != 'Discount' && item.qty > 0 if item.status != 'Discount' && item.qty > 0
@@ -198,7 +198,7 @@ class ReceiptBillPdf < Prawn::Document
price = item.unit_price price = item.unit_price
product_name = item.product_name product_name = item.product_name
if show_price.to_i>0 if !show_price.nil? && show_price.value.to_i>0
item_row(item,precision,delimiter,product_name,price,qty ,total_price) item_row(item,precision,delimiter,product_name,price,qty ,total_price)
else else
if item.price != 0 if item.price != 0

View File

@@ -104,10 +104,12 @@ $(document).ready(function(){
$('#qty-update').on('click', function(){ $('#qty-update').on('click', function(){
var qty_weight = $("input[name='qty_weight']").val(); var qty_weight = $("input[name='qty_weight']").val();
if(parseInt(qty_weight) > parseInt(original_value)){ if(parseInt(qty_weight) >= parseInt(original_value)){
swal("Alert!", "Not allowed over quantity", "warning"); swal("Alert!", "Not allowed over quantity", "warning");
return; return;
} }
var remarks = $("textarea[name='remarks']").val(); var remarks = $("textarea[name='remarks']").val();
var order_items_id = $(this).attr('data-id'); var order_items_id = $(this).attr('data-id');

View File

@@ -5,7 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M") json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories) if (menu.menu_categories)
json.categories menu.menu_categories do |category| order_by = Lookup.find_by_lookup_type("order_by")
if !order_by.nil? && order_by.value == "name"
categories = MenuCategory.where("menu_id ='#{menu.id}'").order("name asc")
else
categories = menu.menu_categories
end
byebug
json.categories categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id) menu_category = MenuCategory.find_by_menu_category_id(category.id)
if !menu_category.nil? if !menu_category.nil?
@@ -25,10 +32,14 @@ if (menu.menu_categories)
json.parent_id category.menu_category_id json.parent_id category.menu_category_id
json.is_available category.is_available json.is_available category.is_available
if !order_by.nil? && order_by.value == "name"
menu_items = MenuItem.find_by_menu_category_id(category.id).order("name asc")
else
menu_items = category.menu_items
end
if category.menu_items if category.menu_items
json.items category.menu_items do |item| json.items menu_items do |item|
if item.is_available if item.is_available
json.partial! 'origami/addorders/menu_item', item: item json.partial! 'origami/addorders/menu_item', item: item
end end

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="container margin-top-20"> <div class="container margin-top-20">
<div class="card row"> <div class="card row">
<div class="table-responsive"> <div class="table-responsive">
@@ -50,3 +57,5 @@
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,4 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="margin-top-20"> <div class="margin-top-20">
<div class="card "> <div class="card ">
<% unless @sale_data.blank? %> <% unless @sale_data.blank? %>
@@ -38,3 +44,5 @@
<% end %> <% end %>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,4 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12 col-lg-12 col-sm-12 "> <div class="col-md-12 col-lg-12 col-sm-12 ">
@@ -147,4 +153,6 @@
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,4 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -129,4 +135,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="margin-top-20"> <div class="margin-top-20">
<div class="card"> <div class="card">
<table class="table table-bordered"> <table class="table table-bordered">
@@ -108,4 +115,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -81,4 +88,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,4 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -103,4 +109,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -223,4 +230,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -105,4 +112,6 @@
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="container margin-top-20"> <div class="container margin-top-20">
<div class="card row"> <div class="card row">
<div class="table-responsive"> <div class="table-responsive">
@@ -50,3 +57,5 @@
</div> </div>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,4 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -63,4 +69,6 @@
</table> </table>
<% end %> <% end %>
</div> </div>
</div> </div>
</body>
</html>

View File

@@ -1,3 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="margin-top-20"> <div class="margin-top-20">
@@ -80,4 +87,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body>
</html>