fix conflit

This commit is contained in:
Zin Lin Phyo
2017-08-25 13:46:50 +06:30
116 changed files with 2373 additions and 111 deletions

View File

@@ -0,0 +1,2 @@
class InventoryDefinition < ApplicationRecord
end

View File

@@ -3,7 +3,7 @@ class Promotion < ApplicationRecord
has_many :promotion_products
accepts_nested_attributes_for :promotion_products , :allow_destroy => true
accepts_nested_attributes_for :promotion_products , :allow_destroy => true , update_only: true
PROMO_TYPE1 = "Quantity"
PROMO_TYPE2 = "Net_off" # 3000 => - 500 => 2500 [total]
@@ -120,6 +120,10 @@ class Promotion < ApplicationRecord
def self.give_promotion_second_product(orderitem_count, foc_min_qty, promo_product, orderitem, sale_id)
puts "..... orderitem_count: " + orderitem_count.to_s + " / foc_min_qty: " + foc_min_qty.to_s + " /promo_product: " + promo_product + " orderitem: " + orderitem.to_s
promotion_qty = orderitem_count.to_i / foc_min_qty.to_i # get foc item qty
foc_qty = find_second_item_qty(sale_id, promo_product)
if (foc_qty < promotion_qty)
promotion_qty = foc_qty
end
item = OrderItem.find_by_item_code(promo_product)
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price)
end
@@ -135,13 +139,15 @@ class Promotion < ApplicationRecord
sale_item.qty = foc_qty * (-1)
sale_item.unit_price = item_price * (-1)
sale_item.taxable_price = item_price
sale_item.taxable_price = item_price * (-1)
sale_item.price = foc_qty * item_price * (-1)
sale_item.is_taxable = item.taxable
sale_item.is_taxable = false
sale_item.sale_id = sale_id
sale_item.save
sale = Sale.find(sale_id).
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount)
end
@@ -204,6 +210,6 @@ class Promotion < ApplicationRecord
end
def self.calculate_discount(total, discount)
self (total.to_i * discount.to_i) / 100
return (total.to_i * discount.to_i) / 100
end
end

View File

@@ -1,3 +1,4 @@
class PromotionProduct < ApplicationRecord
validates_presence_of :item_code
belongs_to :promotion
end

View File

@@ -184,6 +184,7 @@ class Sale < ApplicationRecord
sale_item.sale_id = self.id
sale_item.price = diningprice
sale_item.save
self.compute
end
def update_item (item)
@@ -215,10 +216,11 @@ class Sale < ApplicationRecord
sales_items.each do |item|
#compute each item and added to total
puts "item.sales_item_id ddd"
puts item.sale_item_id
subtotal_price = subtotal_price + item.price
total_taxable = total_taxable + (item.taxable_price * item.qty)
end
apply_tax (total_taxable)
self.total_amount = subtotal_price
self.total_discount = total_discount

View File

@@ -0,0 +1,2 @@
class StockCheck < ApplicationRecord
end

View File

@@ -0,0 +1,2 @@
class StockCheckItem < ApplicationRecord
end

View File

@@ -0,0 +1,2 @@
class StockJournal < ApplicationRecord
end