optimize for dashboards
This commit is contained in:
@@ -6,8 +6,13 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
has_one :sale_audit, -> { where "SUBSTRING_INDEX(sale_audits.remark,'||',1) = sale_payments.sale_payment_id" }, foreign_key: "sale_id", primary_key: "sale_id"
|
||||
|
||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status,:action_by
|
||||
|
||||
scope :credits, -> { where(payment_method: 'creditnote') }
|
||||
scope :cards, -> { where(payment_method: ['mpu', 'visa', 'master', 'jcb', 'unionpay', 'alipay', 'paymal', 'dinga', 'JunctionPay', 'giftvoucher']) }
|
||||
|
||||
def self.sync_sale_payment_records(sale_payments)
|
||||
if !sale_payments.nil?
|
||||
sale_payments.each do |sp|
|
||||
|
||||
Reference in New Issue
Block a user