feat: add mmqr in shift sale report

This commit is contained in:
Pyae Bhone Zaw
2025-06-26 11:09:11 +06:30
parent ba57516cda
commit 82b6474bc7
3 changed files with 16 additions and 2 deletions

View File

@@ -152,6 +152,15 @@ class ShiftSale < ApplicationRecord
return closing_balance
end
def self.get_by_shift_mmqr_payment(shift)
Sale.joins(:sale_payments)
.where(shift_sale_id: shift, sale_status: 'completed')
.where(sale_payments: { payment_method: 'mmqr' })
.where.not(sale_payments: { payment_status: 'cancelled' })
.where.not(sale_payments: { payment_amount: 0 })
.sum("sale_payments.payment_amount")
end
def self.get_by_shift_other_payment(shift)
payment_methods = SalePayment.where.not(payment_method: ['cash', 'creditnote', 'foc']).distinct.pluck(:payment_method)