feat: add mmqr in shift sale report
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user