Merge branch 'adminbsb_material_ui'
This commit is contained in:
@@ -164,10 +164,10 @@ class SaleItem < ApplicationRecord
|
|||||||
def self.get_all_sale_items(sale_id)
|
def self.get_all_sale_items(sale_id)
|
||||||
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
||||||
product_name,product_alt_name,account_id,status,remark,
|
product_name,product_alt_name,account_id,status,remark,
|
||||||
(CASE WHEN (qty > 0 AND remark IS NULL) THEN SUM(qty) ELSE qty END) as qty,
|
(CASE WHEN (qty > 0 AND remark IS NULL) OR (status='promotion' AND (remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(abs(qty)) ELSE qty END) as qty,
|
||||||
unit_price,
|
unit_price,
|
||||||
taxable_price,
|
taxable_price,
|
||||||
(CASE WHEN (price > 0 AND remark IS NULL) THEN SUM(price) ELSE price END) as price,
|
(CASE WHEN (price > 0 AND remark IS NULL) OR (status='promotion' AND (remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(abs(price)) ELSE price END) as price,
|
||||||
is_taxable")
|
is_taxable")
|
||||||
.where("sale_id = ?",sale_id)
|
.where("sale_id = ?",sale_id)
|
||||||
.order("product_name asc")
|
.order("product_name asc")
|
||||||
|
|||||||
@@ -203,14 +203,25 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# check for item not to show
|
# check for item not to show
|
||||||
show_price = Lookup.find_by_lookup_type("show_price")
|
show_price = Lookup.find_by_lookup_type("show_price")
|
||||||
|
|
||||||
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
|
||||||
total_qty += item.qty
|
total_qty += item.qty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
product_name = item.product_name
|
||||||
|
|
||||||
|
if item.status = 'promotion' && (item.remark =='promotion nett price' || item.remark == 'promotion discount')
|
||||||
|
sub_total += -item.price #(item.qty*item.unit_price) - comment for room charges
|
||||||
|
qty = -item.qty
|
||||||
|
total_price = -item.price #item.qty*item.unit_price - comment for room charges
|
||||||
|
price = -item.unit_price
|
||||||
|
else
|
||||||
|
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||||
qty = item.qty
|
qty = item.qty
|
||||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||||
price = item.unit_price
|
price = item.unit_price
|
||||||
product_name = item.product_name
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if !show_price.nil? && show_price.value.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)
|
||||||
|
|||||||
Reference in New Issue
Block a user