update instanc code unique receipt bill and sale item
This commit is contained in:
@@ -70,7 +70,8 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||||
else
|
else
|
||||||
format.html { render :new }
|
flash[:instance_code_error] = @settings_menu_item_instances.errors
|
||||||
|
format.html { redirect_to new_settings_simple_menu_item_menu_item_instance_path }
|
||||||
format.json { render json: @settings_menu_item_instances.errors, status: :unprocessable_entity }
|
format.json { render json: @settings_menu_item_instances.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ class MenuItemInstance < ApplicationRecord
|
|||||||
has_many :menu_instance_item_sets
|
has_many :menu_instance_item_sets
|
||||||
has_many :item_sets, through: :menu_instance_item_sets
|
has_many :item_sets, through: :menu_instance_item_sets
|
||||||
# before_create :generate_menu_item_instance_code
|
# before_create :generate_menu_item_instance_code
|
||||||
validates_presence_of :item_instance_code
|
# validates_presence_of :item_instance_code
|
||||||
# validates_uniqueness_of :item_instance_code
|
|
||||||
|
validates_uniqueness_of :item_instance_code
|
||||||
|
|
||||||
def self.findParentCategory(item)
|
def self.findParentCategory(item)
|
||||||
if item.menu_category_id
|
if item.menu_category_id
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class SaleItem < ApplicationRecord
|
|||||||
sale_item.product_alt_name = item.product_alt_name
|
sale_item.product_alt_name = item.product_alt_name
|
||||||
sale_item.account_id = item.account_id
|
sale_item.account_id = item.account_id
|
||||||
sale_item.remark = type
|
sale_item.remark = type
|
||||||
if type == "foc" || type == "promotion" || type == "void"
|
if type == "FOC" || type == "promotion" || type == "void"
|
||||||
sale_item.qty = qty * (-1)
|
sale_item.qty = qty * (-1)
|
||||||
else
|
else
|
||||||
sale_item.qty = qty
|
sale_item.qty = qty
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class SalePayment < ApplicationRecord
|
|||||||
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
|
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
|
||||||
|
|
||||||
sale_items.each do|item|
|
sale_items.each do|item|
|
||||||
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "FOC", item.unit_price, item.price)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.payment_method = "foc"
|
self.payment_method = "foc"
|
||||||
|
|||||||
@@ -125,6 +125,7 @@
|
|||||||
<!-- end sub total -->
|
<!-- end sub total -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--Other Charges -->
|
<!--Other Charges -->
|
||||||
|
<%if @otehr_charges.present?%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Other Charges</b></td>
|
<td><b>Other Charges</b></td>
|
||||||
<td colspan="4"> </td>
|
<td colspan="4"> </td>
|
||||||
@@ -154,6 +155,7 @@
|
|||||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||||
<td ><span class="underline"><%= other_sub_total %></span></td>
|
<td ><span class="underline"><%= other_sub_total %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<%end%>
|
||||||
<!-- End Other Charges -->
|
<!-- End Other Charges -->
|
||||||
<tr style="border-top:2px solid grey;">
|
<tr style="border-top:2px solid grey;">
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
|
|||||||
@@ -3,11 +3,22 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<%= simple_form_for([:settings,@item, @settings_menu_item_instances]) do |f| %>
|
<%= simple_form_for([:settings,@item, @settings_menu_item_instances]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<% if(flash["instance_code_error"]) %>
|
||||||
|
<div class="alert alert-danger">Please review the problems below:</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="col-md- panel">
|
<div class="col-md- panel">
|
||||||
<div class="form-group p-l-15">
|
<div class="form-group p-l-15">
|
||||||
<%= f.input :item_instance_code %>
|
<%= f.input :item_instance_code ,:input_html=>{:class=>""},:required=>true %>
|
||||||
|
|
||||||
|
<% flash.each do |test, msg| %>
|
||||||
|
<% str="[\"#{msg['item_instance_code']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '')
|
||||||
|
%>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= f.input :item_instance_name %>
|
<%= f.input :item_instance_name %>
|
||||||
<%= f.input :price %>
|
<%= f.input :price %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user