update sale_payment database

This commit is contained in:
Nweni
2017-06-07 14:45:03 +06:30
parent 9a23716c23
commit 810a6d8afc
5 changed files with 52 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
class SaleAudit < ApplicationRecord
self.primary_key = "sale_audit_id"
#primary key - need to be unique generated for SaleAudit
before_create :generate_custom_id
@@ -44,13 +44,14 @@ class SaleAudit < ApplicationRecord
sale_audit.save!
end
def record_payment(sale_id, remark, action_by)
def self.record_payment(sale_id, remark, action_by)
sale_audit = SaleAudit.new()
sale_audit.sale_id = sale_id
sale_audit.action = "SALEPAYMENT"
sale_audit.action_at = DateTime.now.utc
sale_audit.action_by = action_by
sale_audit.remark = remark
sale_audit.approved_by = Time.now
sale_audit.save!
end