Class: HrLite::StatutoryRateCardRecord
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- HrLite::StatutoryRateCardRecord
- Includes:
- Audited
- Defined in:
- app/models/hr_lite/statutory_rate_card_record.rb
Overview
A financial year's statutory figures, as data. Named for the table rather than the lookup module (HrLite::StatutoryRateCard) that reads it — hosts and specs call the module, not this.
Constant Summary
Constants included from Audited
Audited::REDACTED, Audited::SKIPPED_ATTRIBUTES
Class Method Summary collapse
Instance Method Summary collapse
- #financial_year ⇒ Object
-
#to_card ⇒ Object
The shape SlipBuilder and the calculators expect: symbol keys and BigDecimal everywhere, because JSON gives back strings and floats and a float has no business in a PF calculation.
- #verified? ⇒ Boolean
Class Method Details
.effective_for(period_month) ⇒ Object
16 17 18 19 |
# File 'app/models/hr_lite/statutory_rate_card_record.rb', line 16 def self.effective_for(period_month) where(effective_from: ..period_month).order(effective_from: :desc).first || chronological.first end |
Instance Method Details
#financial_year ⇒ Object
21 |
# File 'app/models/hr_lite/statutory_rate_card_record.rb', line 21 def financial_year = FinancialYear.label(effective_from) |
#to_card ⇒ Object
The shape SlipBuilder and the calculators expect: symbol keys and BigDecimal everywhere, because JSON gives back strings and floats and a float has no business in a PF calculation.
28 29 30 31 32 33 34 35 |
# File 'app/models/hr_lite/statutory_rate_card_record.rb', line 28 def to_card { pf: deep_decimalize(pf).symbolize_keys, esi: deep_decimalize(esi).symbolize_keys, pt: {}, # slabs live in their own table — resolved by state at use income_tax: income_tax.transform_values { |regime| decimalize_regime(regime) } } end |
#verified? ⇒ Boolean
23 |
# File 'app/models/hr_lite/statutory_rate_card_record.rb', line 23 def verified? = verified_by.present? && verified_on.present? |