close cashier pdf and receipt bill pdf changes for credit payment
This commit is contained in:
@@ -178,4 +178,11 @@ class ShiftSale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_shift_sales_with_credit_payment(shift_id)
|
||||
query = SalePayment.select("(CASE WHEN SUM(sale_payments.payment_amount) > 0 THEN SUM(sale_payments.payment_amount) ELSE 0 END) as total_credit_payments")
|
||||
.joins(" JOIN sale_audits sa ON SUBSTRING_INDEX(sa.remark,'||',1)=sale_payments.sale_payment_id")
|
||||
.where("SUBSTRING_INDEX(SUBSTRING_INDEX(sa.remark,'||',-1),' -> ',1) = #{shift_id}")
|
||||
.first()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user