Merge branch 'printservice_dev' into r-1902001-01

This commit is contained in:
Thein Lin Kyaw
2020-08-26 10:38:00 +06:30
41 changed files with 1441 additions and 1044 deletions

View File

@@ -152,7 +152,7 @@ class ShiftSale < ApplicationRecord
def self.get_by_shift_other_payment(shift)
payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method)
shift_other_payments = Sale.select("sales.sale_id,sale_payments.payment_method as name")
shift_other_payments = Sale.select("sales.sale_id, sale_payments.payment_method as name")
if payment_methods.present?
shift_other_payments = shift_other_payments.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.join(', ')}")
end
@@ -210,6 +210,11 @@ class ShiftSale < ApplicationRecord
.first()
end
def self.get_other_charges(shift)
query = SaleItem.joins("JOIN sales as s ON s.sale_id = sale_items.sale_id")
.where('shift_sale_id =? and s.sale_status = "completed" and sale_items.product_code = "Other Charges" and sale_items.item_instance_code is null',shift.id)
end
def self.search(filter,from,to)
if filter.blank?
keyword = ''