Files
accounting_dev_v2/application/models/FiscalPeriodModel.php
T
2026-09-11 16:03:00 +07:00

32 lines
894 B
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class FiscalPeriodModel extends CI_Model
{
public function find($id)
{
return $this->db->get_where('accounting_periods', array('id' => (int) $id))->row();
}
public function findByDate($date)
{
return $this->db
->where('start_date <=', $date)
->where('end_date >=', $date)
->limit(1)
->get('accounting_periods')
->row();
}
public function allWithFiscalYear()
{
return $this->db
->select('accounting_periods.*, fiscal_years.name fiscal_year_name')
->from('accounting_periods')
->join('fiscal_years', 'fiscal_years.id = accounting_periods.fiscal_year_id')
->order_by('accounting_periods.start_date', 'DESC')
->get()
->result();
}
}