I have one problem..
I using model with parameter to generate report. like this
<?php
class Report_model extends CI_Model {
function get_list($company_id,$year)
{
$progress=$this->db->query("
select descrip,
max(case when bulan_laporan = '01-Januari' then value else 0 end) jan,
max(case when bulan_laporan = '02-Februari' then value else 0 end) feb,
max(case when bulan_laporan = '03-Maret' then value else 0 end) mar,
max(case when bulan_laporan = '04-April' then value else 0 end) apr,
max(case when bulan_laporan = '05-Mei' then value else 0 end) mei,
max(case when bulan_laporan = '06-Juni' then value else 0 end) jun,
max(case when bulan_laporan = '07-Juli' then value else 0 end) jul,
max(case when bulan_laporan = '08-Agustus' then value else 0 end) agu,
max(case when bulan_laporan = '09-September' then value else 0 end) sep,
max(case when bulan_laporan = '10-Oktober' then value else 0 end) okt,
max(case when bulan_laporan = '11-November' then value else 0 end) nov,
max(case when bulan_laporan = '12-Desember' then value else 0 end) des
from
(
select id_perusahaan,bulan_laporan,tahun_laporan,jml_tablet_fe1 value,'1. Jumlah Ibu Hamil mendapat Tablet Fe 1' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_tablet_fe3 value,'2. Jumlah Ibu Hamil mendapat Tablet Fe 3' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_nifas_fe value,'3. Jumlah Ibu Nifas mendapat Fe' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_nifas_vit_a value,'4. Jumlah Ibu Nifas mendapat vitamin A' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_ibu_hamil_kek value,'5. Jumlah Ibu Hamil KEK' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_bayi_asi_ekslusif value,'6. Jumlah Bayi mendapatkan ASI Eksklusif' descrip
from tbl_lbgizi
union all
select id_perusahaan,bulan_laporan,tahun_laporan,jml_ibu_menyusui value,'7. Jumlah Ibu Menyusui' descrip
from tbl_lbgizi
) src
WHERE id_perusahaan = $company_id AND tahun_laporan = $year
group by descrip ");
$results_array=$progress->result();
return $results_array;
}
}
The question. how we use it on controller to generate table. in view