<file_sep> <!-- Content Wrapper. Contains page content -->
 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0"><?= $title ?></h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active"><?= $title ?></li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">

      <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">Daftar Pemasukan yang Telah Terdaftar</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table id="table_list_pemasukan" class="table table-bordered table-striped table-sm">
                  <thead>
                  <tr>
                    <th>No</th>
                    <th>Keterangan</th>
                    <th>Jumlah</th>
                    <th>Tanggal</th>
                  </tr>
                  </thead>
                  <tbody>
                    <?php
                        // pembayaran
                        $no = 1;
                        foreach ($pembayaran as $pmbyrn) {
                    ?>
                        <tr>
                            <td><?= $no ?></td>
                            <td><?= $pmbyrn->tipe_bayar.' - '.$pmbyrn->nama_asset.' - '.$pmbyrn->block_kavling.' '.$pmbyrn->nama_lengkap?></td>
                            <td><?= $pmbyrn->jml_bayar?></td>
                            <td><?= $pmbyrn->tgl_pembayaran?></td>
                        </tr>
                    <?php
                            $no = $no+1;
                        }
                        
                        // pemasukan
                        foreach ($pemasukan as $pmskn) {
                    ?>
                        <tr>
                            <td><?= $no ?></td>
                            <td><?= $pmskn->keterangan ?></td>
                            <td><?= $pmskn->jumlah ?></td>
                            <td><?= $pmskn->tgl_pemasukan ?></td>
                        </tr>
                    <?php
                        }
                    ?>
                  </tbody>
                  <tfoot>
                  <tr>
                    <th>No</th>
                    <th>Keterangan</th>
                    <th>Jumlah</th>
                    <th>Tanggal</th>
                  </tr>
                  </tfoot>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->


      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper --><file_sep><?php
    class Konsumen extends CI_Controller
    {
        function __construct(){
            parent::__construct();
            $this->load->model('m_konsumen','konsumen');
        }
        function json() {
            header('Content-Type: application/json');
            echo $this->konsumen->json();
        }
    }
    
?><file_sep><?php
    class Admin extends CI_Controller
    {
        function __construct(){
            parent::__construct();
            $this->load->model('m_pemasukan','pemasukan');
        }
        public function index(){
            $this->load->view('admin/templates/header');
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/dashboard_page');
            $this->load->view('admin/templates/footer');
        }
        public function konsumen(){
            $data['script'] = 'konsumen';
            $data['title'] = 'Daftar Konsumen';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/konsumen/list_konsumen');
            $this->load->view('admin/templates/footer');
        }
        public function asset(){
            $data['script'] = 'asset';
            $data['title'] = 'Daftar Asset';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/asset/list_asset');
            $this->load->view('admin/templates/footer');
        }
        public function blok(){
            $data['script'] = 'blok';
            $data['title'] = 'Daftar Blok';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/blok/list_blok');
            $this->load->view('admin/templates/footer');
        }
        public function kepemilikan(){
            $data['script'] = 'kepemilikan';
            $data['title'] = 'Daftar Kepemilikan';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/kepemilikan/list_kepemilikan');
            $this->load->view('admin/templates/footer');
        }
        public function pembayaran(){
            $data['script'] = 'pembayaran';
            $data['title'] = 'Daftar Pembayaran';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/pembayaran/list_pembayaran');
            $this->load->view('admin/templates/footer');
        }
        public function pemasukan(){
            $data['pembayaran'] = $this->pemasukan->get_all_pembayaran();
            $data['pemasukan'] = $this->pemasukan->get_all_pemasukan();
            $data['script'] = 'pemasukan';
            $data['title'] = 'Daftar Pembayaran';
            $this->load->view('admin/templates/header', $data);
            $this->load->view('admin/templates/sidebar');
            $this->load->view('admin/pages/pemasukan/list_pemasukan');
            $this->load->view('admin/templates/footer');
        }
    }
    
?><file_sep><?php
    class M_kepemilikan extends CI_Model
    {
        // untuk menampilkan data ke dtatables dengan serverside
		function json() {
			// jangan pakai bintang nanti tidak bisa search
			$this->datatables->select('tb_kepemilikan.id, tb_konsumen.nama_lengkap, tb_block_kavling.block_kavling, tb_block_kavling.harga_jual, tb_block_kavling.luas_tanah, tb_asset.nama_asset, tb_kepemilikan.status');
			$this->datatables->from('tb_kepemilikan');
            $this->datatables->join('tb_konsumen', 'tb_kepemilikan.id_pemilik = tb_konsumen.id');
            $this->datatables->join('tb_block_kavling', 'tb_kepemilikan.id_block_kavling = tb_block_kavling.id');
            $this->datatables->join('tb_asset', 'tb_block_kavling.id_asset = tb_asset.id');
            $this->datatables->add_column('block_lengkap' ,'$1 - $2','nama_asset, block_kavling');
			$this->datatables->add_column('aksi', '
			<a href="javascript:void(0);" class="edit_record badge badge-info"><i class="fas fa-edit lead"></i> Edit</a>
			<a href="javascript:void(0);" class="hapus_record badge badge-danger"><i class="fas fa-trash-alt lead"></i> Hapus</a>
			','tb_block_kavling.id');
			return $this->datatables->generate();
		}
    }
    
?><file_sep><?php
    class M_pemasukan extends CI_Model
    {
        public function get_all_pembayaran(){
            $this->db->select('tb_pembayaran.id, tb_pembayaran.keterangan, tipe_bayar, jml_bayar, tgl_pembayaran, tb_konsumen.nama_lengkap, tb_block_kavling.block_kavling, tb_asset.nama_asset');
            $this->db->from('tb_pembayaran');
            $this->db->join('tb_kepemilikan', 'tb_kepemilikan.id = tb_pembayaran.id_kepemilikan');
            $this->db->join('tb_konsumen', 'tb_konsumen.id = tb_kepemilikan.id_pemilik');
            $this->db->join('tb_block_kavling', 'tb_block_kavling.id = tb_kepemilikan.id_block_kavling');
            $this->db->join('tb_asset', 'tb_asset.id = tb_block_kavling.id_asset');
            return $this->db->get()->result();
        }
        public function get_all_pemasukan(){
            return $this->db->get('tb_pemasukan')->result();
        }
    }
    
?><file_sep><?php
    class M_asset extends CI_Model
    {
        // untuk menampilkan data ke dtatables dengan serverside
		function json() {
			// jangan pakai bintang nanti tidak bisa search
			$this->datatables->select('id, nama_asset, lokasi_asset, foto, tgl_created, jml_blok, sisa_blok');
			$this->datatables->from('tb_asset');
			$this->datatables->add_column('aksi', '
			<a href="javascript:void(0);" class="edit_record badge badge-info"><i class="fas fa-edit lead"></i> Edit</a>
			<a href="javascript:void(0);" class="hapus_record badge badge-danger"><i class="fas fa-trash-alt lead"></i> Hapus</a>
			','nama_asset');
			return $this->datatables->generate();
		}
    }
?><file_sep><?php
    class M_pembayaran extends CI_Model
    {
        // untuk menampilkan data ke dtatables dengan serverside
		function json() {
			// jangan pakai bintang nanti tidak bisa search
			$this->datatables->select('tb_pembayaran.id, tb_pembayaran.keterangan, tipe_bayar, jml_bayar, tgl_pembayaran, tb_konsumen.nama_lengkap, tb_block_kavling.block_kavling, tb_asset.nama_asset');
			$this->datatables->from('tb_pembayaran');
            $this->datatables->join('tb_kepemilikan', 'tb_pembayaran.id_kepemilikan = tb_kepemilikan.id');
            $this->datatables->join('tb_konsumen', 'tb_kepemilikan.id_pemilik = tb_konsumen.id');
            $this->datatables->join('tb_block_kavling', 'tb_block_kavling.id = tb_kepemilikan.id_block_kavling');
            $this->datatables->join('tb_asset', 'tb_asset.id = tb_block_kavling.id_asset');
            $this->datatables->add_column('block_lengkap' ,'$1 - $2','nama_asset, block_kavling');
			$this->datatables->add_column('aksi', '
			<a href="javascript:void(0);" class="edit_record badge badge-info"><i class="fas fa-edit lead"></i> Edit</a>
			<a href="javascript:void(0);" class="hapus_record badge badge-danger"><i class="fas fa-trash-alt lead"></i> Hapus</a>
			','tipe_bayar');
			return $this->datatables->generate();
		}
    }
    
?><file_sep><?php
    class M_konsumen extends CI_Model 
    {
        // untuk menampilkan data ke dtatables dengan serverside
		function json() {
			// jangan pakai bintang nanti tidak bisa search
			$this->datatables->select('id, nama_lengkap, alamat_diri, telp_diri, kartu_identitas, no_identitas, email, tgl_created');
			$this->datatables->from('tb_konsumen');
			$this->datatables->add_column('nama','<p><b>$1</b><br>$2</p>','kartu_identitas, no_identitas');
			$this->datatables->add_column('aksi', '
			<a href="javascript:void(0);" class="edit_record badge badge-info"><i class="fas fa-edit lead"></i> Edit</a>
			<a href="javascript:void(0);" class="hapus_record badge badge-danger"><i class="fas fa-trash-alt lead"></i> Hapus</a>
			','nama_lengkap');
			return $this->datatables->generate();
		}
    }
    
?><file_sep><?php
    class M_pengeluaran extends CI_Model
    {
        // untuk menampilkan data ke dtatables dengan serverside
		function json() {
			// jangan pakai bintang nanti tidak bisa search
			$this->datatables->select('id, tgl_pengeluaran, keterangan, jumlah');
			$this->datatables->from('tb_pengeluaran');
			return $this->datatables->generate();
		}
    }
    
?><file_sep><?php
    class Pemasukan extends CI_Controller
    {
        function __construct(){
            parent::__construct();
            $this->load->model('m_pemasukan','pemasukan');
        }
        function json() {
            header('Content-Type: application/json');
            echo $this->pemasukan->json();
        }
    }
    
?>