first commit
This commit is contained in:
1170
application/controllers/Admin.php
Normal file
1170
application/controllers/Admin.php
Normal file
File diff suppressed because it is too large
Load Diff
349
application/controllers/Home.php
Normal file
349
application/controllers/Home.php
Normal file
@ -0,0 +1,349 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Home extends CI_Controller {
|
||||
|
||||
// var $table = $this->mhome->;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// $this->load->helper('form');
|
||||
// $this->load->library('form_validation');
|
||||
|
||||
$this->load->model('mhome');
|
||||
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
|
||||
if ($this->uri->segment(2) == '') {
|
||||
$main['main']='home/main';
|
||||
$main['header']='Halaman Utama';
|
||||
$main['kecamatan'] = $this->mhome->tampil_data_keseluruhan('tb_kecamatan');
|
||||
$main['lahan'] = $this->mhome->tampil_data_keseluruhan('tb_lahan');
|
||||
$main['cek_hasil'] = $this->mhome->tampil_data_keseluruhan('tb_hasil_produksi');
|
||||
|
||||
$this->load->view('home/index',$main);
|
||||
|
||||
// echo $this->uri->segment(2);
|
||||
// echo "string";
|
||||
}else{
|
||||
redirect('/home');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function data_petambak()
|
||||
{
|
||||
if ($this->uri->segment(3) == 'lihat') {
|
||||
if (is_numeric($this->uri->segment(4))) {
|
||||
$id = $this->uri->segment(4);
|
||||
$cek_lahan = $this->mhome->tampil_data_where('tb_lahan',array('id_lahan' => $id));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
|
||||
// echo "sini";
|
||||
$array = explode('-',$this->uri->segment(5));
|
||||
$data_transaksi_produksi = $this->mhome->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
|
||||
if (count($data_transaksi_produksi->result())>0) {
|
||||
foreach ($data_transaksi_produksi->result() as $key => $value) ;
|
||||
$ket = json_decode($value->ket,true);
|
||||
// print_r(count($ket));
|
||||
$ada = 0;
|
||||
$array_ket = null;
|
||||
foreach ($ket as $key1 => $value1) {
|
||||
if ($value1['tahun'] == $array[0] and $value1['musim'] == $array[1]) {
|
||||
$ada = 1;
|
||||
$array_ket = $value1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ada == 1) {
|
||||
// echo "sini tampilan";
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['elemen_produksi'] = $this->mhome->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['data_transaksi_produksi'] = $this->mhome->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
$main['kode_lahan'] = $id;
|
||||
$main['ket_nya'] = $array_ket;
|
||||
$main['main']='home/menu/data_lahan_lihat_detail';
|
||||
$this->load->view('home/index',$main);
|
||||
// print_r($main['ket']);
|
||||
}elseif ($ada == 0) {
|
||||
redirect('/home');
|
||||
}
|
||||
}else{
|
||||
redirect('/home');
|
||||
}
|
||||
}else{
|
||||
// $this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
// redirect('/penyuluh');
|
||||
redirect('/home');
|
||||
}
|
||||
}else{
|
||||
echo "bukan";
|
||||
}
|
||||
}elseif (is_numeric($this->uri->segment(3))) {
|
||||
// echo "sini";
|
||||
$id = $this->uri->segment(3);
|
||||
$cek_lahan = $this->mhome->tampil_data_where('tb_lahan',array('id_lahan' => $id));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
$main['header']='Halaman Utama Lahan';
|
||||
$main['kecamatan'] = $this->mhome->tampil_data_keseluruhan('tb_kecamatan');
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['data_transaksi_produksi'] = $this->mhome->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
$main['elemen_produksi'] = $this->mhome->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['main']='home/menu/data_lahan_lihat';
|
||||
$this->load->view('home/index',$main);
|
||||
|
||||
}else{
|
||||
// $this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
redirect('/home');
|
||||
}
|
||||
}else{
|
||||
redirect('/home');
|
||||
}
|
||||
}
|
||||
|
||||
function json_hasil()
|
||||
{
|
||||
$cek_data = $this->mhome->tampil_data_keseluruhan('tb_hasil_produksi');
|
||||
$kira = count($cek_data->result());
|
||||
|
||||
$i = 1;
|
||||
$coba = null;
|
||||
$teks= '['; /// idperlukan untuk teks JSON
|
||||
foreach ($cek_data->result() as $key => $value) {
|
||||
|
||||
|
||||
$hasil[$i] = $value->hasil;
|
||||
// if ($i!=1) {
|
||||
// $array_baru = array_merge($array_baru,$array);
|
||||
// }
|
||||
|
||||
/////// batas awal kalau pakai teks di php ////////
|
||||
if ($i != 1 and $i !=2 and $i != 3) {
|
||||
$jumlah = ($hasil[$i-3] + $hasil[$i-2] + $hasil[$i-1])/3;
|
||||
|
||||
// print_r($jumlah);print_r('<br>');
|
||||
$teks .= '{"tahun":"'.$value->tahun.'-'.$value->musim.'","produksi":'. $value->hasil.',"prediksi":'. round($jumlah,2).'},';
|
||||
}else{
|
||||
$kosong = 0;
|
||||
$teks .= '{"tahun":"'.$value->tahun.'-'.$value->musim.'","produksi":'. $value->hasil.',"prediksi":'.$kosong.'},';
|
||||
}
|
||||
////// batas akhir kalau pakai teks di php //////
|
||||
|
||||
///// batas awal kalo pakai array php ////////
|
||||
if ($i != 1 and $i !=2 and $i != 3) {
|
||||
$jumlah = ($hasil[$i-3] + $hasil[$i-2] + $hasil[$i-1])/3;
|
||||
$arraycoba[$i]= array(array('tahun' => $value->tahun.'-'.$value->musim, 'produksi' => $value->hasil,'prediksi' => round($jumlah,0)));
|
||||
$coba = array_merge($coba,$arraycoba[$i-1]);
|
||||
|
||||
}else{
|
||||
$arraycoba[$i]= array(array('tahun' => $value->tahun.'-'.$value->musim, 'produksi' => $value->hasil,'prediksi' => 0));
|
||||
if ($i == 1) {
|
||||
|
||||
}elseif ($i == 2) {
|
||||
$coba = array_merge($arraycoba[$i-1],$arraycoba[$i]);
|
||||
}elseif ($i ==3 ){
|
||||
$coba = array_merge($coba,$arraycoba[$i-1]);
|
||||
}
|
||||
|
||||
}
|
||||
///// batas akhir kalo pakai array php /////
|
||||
$i++;
|
||||
}
|
||||
|
||||
/////// ini untuk tampung array last /////
|
||||
$coba = array_merge($coba,$arraycoba[$kira]);
|
||||
/////// ini untuk tampung array last /////
|
||||
// print_r($kira);
|
||||
|
||||
$teks = mb_substr($teks, 0, -1); /// diperlukan untuk teks JSON
|
||||
$teks.= ']'; /// diperlukan untuk teks JSON
|
||||
|
||||
// print_r($coba);
|
||||
// print_r($teks);
|
||||
// unset($array_baru[0]);
|
||||
// print_r(json_encode($coba));
|
||||
// $array_baru =(object) $array_baru;
|
||||
|
||||
|
||||
// $array_baru = json_encode($array_baru);
|
||||
// $array_baru = json_decode($array_baru,true);
|
||||
// print_r(json_encode($array_baru));
|
||||
// print_r('<br><br>');
|
||||
|
||||
|
||||
|
||||
// $data = '[{"tahun":2008,"produksi":20,"prediksi":25},{"tahun":2009,"produksi":10,"prediksi":19},{"tahun":2010,"produksi":5,"prediksi":17},{"tahun":2011,"produksi":5,"prediksi":14},{"tahun":2012,"produksi":20,"prediksi":10}]';
|
||||
|
||||
$array_baru11 = array('tahun' => 'tahun');
|
||||
// $array_baru1 = array('ket' => $coba);
|
||||
|
||||
// print_r(json_encode($array_baru1));
|
||||
|
||||
// print_r(json_decode($data,true));
|
||||
|
||||
print_r(json_encode(array_merge($array_baru11,array('ket' => $coba))));
|
||||
|
||||
}
|
||||
|
||||
function pendaftaran()
|
||||
{
|
||||
|
||||
$main['header']='Halaman Pendaftaran';
|
||||
$main['kecamatan'] = $this->mhome->tampil_data_keseluruhan('tb_kecamatan');
|
||||
if ($this->uri->segment(3) != '' or $this->uri->segment(3) != null) {
|
||||
$id_kecamatan = $this->uri->segment(3);
|
||||
$cek_kecamatan = $this->mhome->tampil_data_where('tb_kecamatan',array('id_kecamatan' => $id_kecamatan));
|
||||
if (count($cek_kecamatan->result())>0) {
|
||||
|
||||
$main['kecamatan_terpilih'] = $cek_kecamatan;
|
||||
$main['kelurahan'] = $this->mhome->tampil_data_where('tb_kelurahan',array('id_kecamatan' => $id_kecamatan));
|
||||
if ($this->uri->segment(4) != '' or $this->uri->segment(4) != null) {
|
||||
$id_kelurahan = $this->uri->segment(4);
|
||||
$cek_kelurahan = $this->mhome->tampil_data_where('tb_kelurahan',array('id_kecamatan' => $id_kecamatan,'id_kelurahan' => $id_kelurahan));
|
||||
if (count($cek_kelurahan->result())>0) {
|
||||
$main['main']='home/menu/pendaftaran_kelurahan';
|
||||
$main['kelurahan_terpilih'] = $cek_kelurahan;
|
||||
$main['tambak'] = $this->mhome->tampil_data_keseluruhan('tb_tambak');;
|
||||
$this->load->view('home/index',$main);
|
||||
}else{
|
||||
echo "tiada kelurahan";
|
||||
}
|
||||
}else{
|
||||
$main['main']='home/menu/pendaftaran_kecamatan';
|
||||
$this->load->view('home/index',$main);
|
||||
}
|
||||
}else{
|
||||
echo "tiada";
|
||||
}
|
||||
}else{
|
||||
$main['main']='home/menu/pendaftaran';
|
||||
$this->load->view('home/index',$main);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pendaftaran_tambak()
|
||||
{
|
||||
$kecamatan = $this->input->post('kecamatan');
|
||||
$kelurahan = $this->input->post('kelurahan');
|
||||
$nik = $this->input->post('nik');
|
||||
$nama = $this->input->post('nama');
|
||||
$pbb = $this->input->post('pbb');
|
||||
$tambak = $this->input->post('tambak');
|
||||
$point = $this->input->post('point');
|
||||
$luas_lahan = $this->input->post('luas_lahan');
|
||||
|
||||
$cek_nik = $this->mhome->tampil_data_where('tb_petambak',array('nik' => $nik));
|
||||
$cek_pbb = $this->mhome->tampil_data_where('tb_lahan',array('no_pbb' => $pbb));
|
||||
|
||||
if (count($cek_nik->result()) > 0) {
|
||||
|
||||
echo "true1";
|
||||
}elseif (count($cek_pbb->result()) > 0) {
|
||||
|
||||
echo "true2";
|
||||
}else{
|
||||
$this->mhome->insert('tb_petambak',array('nik' => $nik, 'nama' => $nama));
|
||||
$this->mhome->insert('tb_user',array('nik_user' => $nik, 'username' => $nik, 'password' => '12345678', 'level' => 'petambak'));
|
||||
$this->mhome->insert('tb_lahan',array('nik_petambak' => $nik, 'no_pbb' => $pbb ,'tek_tambak' => $tambak, 'point' => $point, 'kecamatan' => $kecamatan , 'kelurahan' => $kelurahan, 'luas_lahan' => $luas_lahan));
|
||||
$this->session->set_flashdata('success', '<b>Success</b><br>Anda Berhasil Terdaftar Dalam Sistem<br>Silakan Login Ke Sistem Dengan NIK Menjadi Username dan Password Default = 12345678');
|
||||
echo "false";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function login()
|
||||
{
|
||||
if ($this->input->post('login')) {
|
||||
$username = $this->input->post('username');
|
||||
$password = $this->input->post('password');
|
||||
|
||||
$cek_data = $this->mhome->tampil_data_where('tb_user',array('username' => $username,'password' => $password));
|
||||
|
||||
if (count($cek_data->result()) > 0) {
|
||||
// echo "username ada";
|
||||
foreach ($cek_data->result() as $key => $value);
|
||||
if ($value->level == 'admin') {
|
||||
$cek_data_admin = $this->mhome->tampil_data_where('tb_admin',array('nik_admin' => $value->nik_admin));
|
||||
foreach ($cek_data_admin->result() as $key2 => $value2);
|
||||
$nik_admin = $value2->nik_admin;
|
||||
$nama_admin = $value2->nama;
|
||||
$jabatan_admin = $value2->jabatan;
|
||||
$this->session->set_userdata(array('nik' => $nik_admin,'nama'=>$nama_admin,'jabatan'=>$jabatan_admin,'level'=>'Admin'));
|
||||
$this->session->set_flashdata('success', '<b>SELAMAT DATANG</b><br>Admin '.$nama_admin.' telah berhasil login');
|
||||
redirect('/admin');
|
||||
}elseif ($value->level == 'petambak') {
|
||||
$cek_data_petambak = $this->mhome->tampil_data_where('tb_petambak',array('nik' => $value->nik_user));
|
||||
foreach ($cek_data_petambak->result() as $key2 => $value2);
|
||||
$nik_petambak = $value2->nik;
|
||||
$nama_petambak = $value2->nama;
|
||||
$this->session->set_userdata(array('nik' => $nik_petambak,'nama'=>$nama_petambak,'level'=>'Petambak'));
|
||||
$this->session->set_flashdata('success', '<b>SELAMAT DATANG</b><br>Petambak '.$nama_petambak.' telah berhasil login');
|
||||
redirect('/petambak');
|
||||
}elseif($value->level == 'penyuluh') {
|
||||
$cek_data_penyuluh = $this->mhome->tampil_data_where('tb_penyuluh',array('nik' => $value->nik_penyuluh));
|
||||
// print_r(count($cek_data_penyuluh->result()));
|
||||
foreach ($cek_data_penyuluh->result() as $key2 => $value2);
|
||||
$nik_penyuluh = $value2->nik;
|
||||
$nama_penyuluh = $value2->nama;
|
||||
|
||||
// echo $nama_peyuluh;
|
||||
$this->session->set_userdata('penyuluh', array('nik' => $nik_penyuluh,'nama'=>$nama_penyuluh,'kecamatan'=> $value2->kecamatan,'level'=>'Petambak'));
|
||||
$this->session->set_flashdata('success', '<b>SELAMAT DATANG</b><br>Penyuluh '.$nama_penyuluh.' telah berhasil login');
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
// $this->session->set_userdata('nik',)
|
||||
}else{
|
||||
$this->session->set_flashdata('warning', '<b>Error</b><br>Username dan Password Yang Dimasukkan Salah');
|
||||
redirect('/home/login');
|
||||
}
|
||||
}else{
|
||||
$main['header']='Halaman Pendaftaran';
|
||||
$this->load->view('home/login',$main);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function kecamatan()
|
||||
{
|
||||
if ($this->uri->segment(2) == 'kecamatan') {
|
||||
// $kecamatan = $this->uri->segment(3);
|
||||
$main['main']='home/menu/kecamatan';
|
||||
$main['header']='Halaman Utama';
|
||||
$main['kecamatan'] = $this->mhome->tampil_data_where('tb_kecamatan', array('id_kecamatan' => $this->uri->segment(3)));
|
||||
$main['lahan'] = $this->mhome->tampil_data_where('tb_lahan',array('kecamatan' => $this->uri->segment(3)));
|
||||
$main['cek_hasil'] = $this->mhome->tampil_data_keseluruhan('tb_hasil_produksi');
|
||||
|
||||
$this->load->view('home/index',$main);
|
||||
}else{
|
||||
redirect('/home');
|
||||
}
|
||||
}
|
||||
|
||||
function destroy_segala()
|
||||
{
|
||||
// $this->session->sess_destroy();
|
||||
$this->session->set_userdata('nik',1234);
|
||||
$this->session->set_userdata('nama','asdasdas');
|
||||
$this->session->set_userdata('level','Petambak');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// function petanya() {
|
||||
// $peta = '';
|
||||
|
||||
// $peta = json_decode($peta);
|
||||
// print_r($peta[0]->kordinat);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
19
application/controllers/My404.php
Normal file
19
application/controllers/My404.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class My404 extends CI_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
// $this->session->sess_destroy();
|
||||
$this->load->view('home/404');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
791
application/controllers/Penyuluh.php
Normal file
791
application/controllers/Penyuluh.php
Normal file
@ -0,0 +1,791 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Penyuluh extends CI_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// $this->load->helper('form');
|
||||
// $this->load->library('form_validation');
|
||||
|
||||
$this->load->model('mpenyuluh');
|
||||
|
||||
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$cek_data_dulu = $this->mpenyuluh->tampil_data_where('tb_penyuluh',array('nik'=>$penyuluh['nik'], 'nama' => $penyuluh['nama']));
|
||||
|
||||
if ($penyuluh != '' and $penyuluh != null) {
|
||||
if (count($cek_data_dulu->result()) > 0) {
|
||||
foreach ($cek_data_dulu->result() as $key => $value) ;
|
||||
$kecamatan = $value->kecamatan;
|
||||
// redirect('/petambak');
|
||||
// echo "<script>console.log('heheheh')</script>";
|
||||
}else{
|
||||
$this->session->set_flashdata('error', '<b>Error</b><br>Halaman Yang Diakses Tiada Dalam Sistem');
|
||||
redirect('/home');
|
||||
}
|
||||
}else{
|
||||
$this->session->set_flashdata('error', '<b>Error</b><br>Halaman Yang Diakses Tiada Dalam Sistem');
|
||||
redirect('/home');
|
||||
}
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
if ($this->uri->segment(2) == '') {
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$cek_kecamatan = $this->mpenyuluh->tampil_data_where('tb_kecamatan',array('id_kecamatan' => $penyuluh['kecamatan']));
|
||||
foreach ($cek_kecamatan->result() as $key => $value) ;
|
||||
$main['nama_kecamatan'] = $value->kecamatan;
|
||||
$main['no_kecamatan'] = $value->id_kecamatan;
|
||||
$main['cek_lahan_kecamatan'] = $this->mpenyuluh->tampil_data_where('tb_lahan', array('kecamatan' => $penyuluh['kecamatan']));
|
||||
$main['main']='penyuluh/main';
|
||||
$main['header']='Halaman Utama Penyuluh';
|
||||
$main['kecamatan'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_kecamatan');
|
||||
// $main['lahan'] = $this->mpenyuluh->tampil_data_where('tb_lahan',array('nik_petambak' => $nik));
|
||||
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
}else{
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function analisa()
|
||||
{
|
||||
$main['header']='Halaman Analisa Penyuluh';
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$elemen_produksi = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
if ($this->input->post('hari')!= '' and $this->input->post('hari') != null and $this->input->post('kode') != '' and $this->input->post('kode') != null) {
|
||||
$id = $this->input->post('kode');
|
||||
$hari = $this->input->post('hari');
|
||||
$cari = $this->mpenyuluh->cari_data($id,$hari);
|
||||
|
||||
if ($this->input->post('id') == 1) { ?>
|
||||
<table id="tabel-data" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bahan</th>
|
||||
<th>Harga</th>
|
||||
<th>Satuan</th>
|
||||
<th width="20%">Jumlah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php
|
||||
// $r = 1;
|
||||
// print_r($satuan->$r);
|
||||
foreach ($elemen_produksi->result() as $key2 => $value2):?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><?=$value2->nama_elemen?></td>
|
||||
<td>Rp. <?=$cari['harga'.$value2->id_elemen]?></td>
|
||||
<td><?=number_format($cari['satuan'.$value2->id_elemen])?> <?=$value2->satuan?></td>
|
||||
<td>Rp. <?=number_format($cari['jumlahbahan'.$value2->id_elemen])?></td>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#tabel-data').DataTable({
|
||||
"pageLength": 10,
|
||||
"searching": false,
|
||||
"paging": false,
|
||||
"ordering": false,
|
||||
"info": false,
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php }elseif ($this->input->post('id') == 2) {?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-4 control-label">Biaya Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="Rp. <?=number_format($cari['biayaproduksi'])?>" title="Biaya Produksi" disabled="" name="biaya">
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-4 control-label">Biaya Persiapan Lahan</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="Rp. <?=number_format($cari['biayapersiapanlahan'])?>" title="Biaya Produksi" disabled="" name="biaya">
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-4 control-label">Jumlah Hasil Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="<?=number_format($cari['jumlahproduksi'])?> kg" title="Jumlah Hasil Produksi" disabled="">
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
}elseif ($this->uri->segment(3) != '' or $this->uri->segment(3) != null) {
|
||||
$id = $this->uri->segment(3);
|
||||
$cek_lahan = $this->mpenyuluh->tampil_data_where('tb_lahan',array('id_lahan' => $id, 'kecamatan' => $penyuluh['kecamatan']));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['elemen_produksi'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['main']='penyuluh/menu/analisa_lahan';
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
|
||||
}else{
|
||||
$this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
|
||||
}elseif ($this->uri->segment(3) == '') {
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$cek_kecamatan = $this->mpenyuluh->tampil_data_where('tb_kecamatan',array('id_kecamatan' => $penyuluh['kecamatan']));
|
||||
foreach ($cek_kecamatan->result() as $key => $value) ;
|
||||
$main['nama_kecamatan'] = $value->kecamatan;
|
||||
$main['no_kecamatan'] = $value->id_kecamatan;
|
||||
$main['cek_lahan_kecamatan'] = $this->mpenyuluh->tampil_data_where('tb_lahan', array('kecamatan' => $penyuluh['kecamatan']));
|
||||
$main['main']='penyuluh/menu/analisa';
|
||||
|
||||
$main['kecamatan'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_kecamatan');
|
||||
// $main['lahan'] = $this->mpenyuluh->tampil_data_where('tb_lahan',array('nik_petambak' => $nik));
|
||||
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
}else{
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function perkiraan_produksi()
|
||||
{
|
||||
$main['header']='Halaman Perkiraan Produksi Penyuluh';
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$elemen_produksi = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
if ($this->input->post('hari')!= '' and $this->input->post('hari') != null and $this->input->post('kode') != '' and $this->input->post('kode') != null) {
|
||||
$id = $this->input->post('kode');
|
||||
$hari = $this->input->post('hari');
|
||||
$cari = $this->mpenyuluh->cari_data($id,$hari);
|
||||
if ($this->input->post('no') == 'tabel') { ?>
|
||||
<div class="form-horizontal" style="overflow-x: auto">
|
||||
<table id="tabel-data" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bahan</th>
|
||||
<th>Harga</th>
|
||||
<th>Satuan</th>
|
||||
<th>Jumlah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php foreach ($elemen_produksi->result() as $key => $value):?>
|
||||
<tr>
|
||||
<td><?=$value->nama_elemen?></td>
|
||||
<td>Rp. <?=$cari['harga'.$value->id_elemen]?></td>
|
||||
<td><?=number_format($cari['satuan'.$value->id_elemen])?> <?=$value->satuan?></td>
|
||||
<td>Rp. <?=number_format($cari['jumlahbahan'.$value->id_elemen])?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-5 control-label">Jumlah Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="<?=$cari['jumlahproduksi']?> kg" title="Jumlah Produksi" disabled="">
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}elseif ($this->input->post('tanggal')) {
|
||||
$tanggal = $this->input->post('tanggal');
|
||||
$tanggal = date('Y-m-d', strtotime($tanggal. ' + '.$hari.' days'));
|
||||
$tanggal = date("d/m/Y", strtotime($tanggal));
|
||||
|
||||
?>
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<!-- /.box-title -->
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-3 control-label">Panen</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Panen" value="<?=$tanggal?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Saiz</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Saiz" value="+- <?=$cari['saiz']?> ekor/kg" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Total Biaya</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Jumlah" value="Rp . <?=number_format($cari['totalbiaya'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-content -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-lg-6 col-xs-12 -->
|
||||
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-3 control-label">Harga Jual</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" placeholder="Enter your email" title="Harga Jual" value="Rp. <?=number_format($cari['hargajual'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Nilai Produksi</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Nilai" value="Rp. <?=number_format($cari['nilaiproduksi'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Keuntungan</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Keuntungan" value="Rp. <?=number_format($cari['keuntungan'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-5 control-label">Status Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="<?=$cari['status']?>" title="Status Produksi" disabled="">
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}elseif ($this->uri->segment(3) != '' or $this->uri->segment(3) != null) {
|
||||
$id = $this->uri->segment(3);
|
||||
$cek_lahan = $this->mpenyuluh->tampil_data_where('tb_lahan',array('id_lahan' => $id, 'kecamatan' => $penyuluh['kecamatan']));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['elemen_produksi'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['main']='penyuluh/menu/perkiraan_produksi_proses';
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
}else{
|
||||
$this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
}elseif ($this->uri->segment(3) == '') {
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$cek_kecamatan = $this->mpenyuluh->tampil_data_where('tb_kecamatan',array('id_kecamatan' => $penyuluh['kecamatan']));
|
||||
foreach ($cek_kecamatan->result() as $key => $value) ;
|
||||
$main['nama_kecamatan'] = $value->kecamatan;
|
||||
$main['no_kecamatan'] = $value->id_kecamatan;
|
||||
$main['cek_lahan_kecamatan'] = $this->mpenyuluh->tampil_data_where('tb_lahan', array('kecamatan' => $penyuluh['kecamatan']));
|
||||
$main['main']='penyuluh/menu/perkiraan_produksi';
|
||||
|
||||
$main['kecamatan'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_kecamatan');
|
||||
// $main['lahan'] = $this->mpenyuluh->tampil_data_where('tb_lahan',array('nik_petambak' => $nik));
|
||||
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
}else{
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function transaksi()
|
||||
{
|
||||
$main['header']='Halaman Transaksi Penyuluh';
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$elemen_produksi = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
if ($this->input->post('hari') != '' and $this->input->post('hari') != null and $this->input->post('data') != '' and $this->input->post('data') != null and $this->input->post('kode') != '' and $this->input->post('kode') != null and $this->input->post('tanggal') != '' and $this->input->post('tanggal') != null) {
|
||||
$elemen_produksi = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$kode = $this->input->post('kode');
|
||||
|
||||
$hari = $this->input->post('hari');
|
||||
$tanggal = $this->input->post('tanggal');
|
||||
$data = $this->input->post('data');
|
||||
$keys = array_column($this->input->post('data'),'name');
|
||||
$values = array_column($this->input->post('data'),'value');
|
||||
$data = array_combine($keys, $values);
|
||||
$cari_data_harga = $this->mpenyuluh->tampil_data_where('tb_tambak',array('id_tambak' =>1));
|
||||
foreach ($cari_data_harga->result() as $key3 => $value3);
|
||||
$ket = json_decode($value3->ket);
|
||||
$cari = $this->mpenyuluh->kira_data($kode,$hari,$tanggal,$data);
|
||||
|
||||
$tanggal_selesai = new DateTime($tanggal);
|
||||
$tanggal_selesai->modify('+'.$hari.' day');
|
||||
$tanggal_selesai =date('Y-m-d', strtotime($tanggal_selesai->format('Y-m-d')));
|
||||
|
||||
$nama_elemen_coba;
|
||||
$nama_elemen = array();
|
||||
$jumlah_elemen_coba;
|
||||
$jumlah_elemen = array();
|
||||
foreach ($elemen_produksi->result() as $key4 => $value4) {
|
||||
$nama_elemen_coba = array($key4 => $value4->id_elemen);
|
||||
$nama_elemen = array_merge($nama_elemen,$nama_elemen_coba);
|
||||
|
||||
$jumlahnya = str_replace( ',', '', $values[$key4]);
|
||||
$jumlah_elemen_coba = array($key4 => $jumlahnya);
|
||||
$jumlah_elemen = array_merge($jumlah_elemen,$jumlah_elemen_coba);
|
||||
}
|
||||
$array_elemen = array_combine($nama_elemen, $jumlah_elemen);
|
||||
$tahun_selesai = date('Y', strtotime($tanggal_selesai));
|
||||
|
||||
if ($tanggal_selesai > date('Y-m-d',strtotime($tahun_selesai.'-06-30')) and $tanggal_selesai <= date('Y-m-d',strtotime($tahun_selesai.'-12-31'))) {
|
||||
|
||||
$musim = 2;
|
||||
$array_full = array('tahun' => date($tahun_selesai),'musim'=> 2,'waktu_tebar' => $tanggal, 'masa_tumbuh' => $hari , 'masa_panen' => $tanggal_selesai ,'jumlah_produksi' => $cari['jumlahproduksi'], 'nilai_produksi' => $cari['nilaiproduksi'],'ket_elemen_produksi' => $array_elemen);
|
||||
}elseif ($tanggal_selesai >= date('Y-m-d',strtotime($tahun_selesai.'-01-31')) and $tanggal_selesai <= date('Y-m-d',strtotime($tahun_selesai.'-06-30'))) {
|
||||
|
||||
$musim = 1;
|
||||
$array_full = array('tahun' => date($tahun_selesai),'musim'=> 1,'waktu_tebar' => $tanggal, 'masa_tumbuh' => $hari,'masa_panen' => $tanggal_selesai ,'jumlah_produksi' => $cari['jumlahproduksi'], 'nilai_produksi' => $cari['nilaiproduksi'], 'ket_elemen_produksi' => $array_elemen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $key = array_keys($array_info_1);
|
||||
// $val = array_values($array_info_1);
|
||||
|
||||
// $new_key = array_merge($key, array_keys($array_elemen));
|
||||
// $new_val = array_merge($val, array_values($array_elemen));
|
||||
|
||||
// $array_full = array(array_combine($new_key, $new_val));
|
||||
|
||||
|
||||
|
||||
if ($this->input->post('no') == 'tabel') {
|
||||
$cek_tabel_produksi = $this->mpenyuluh->tampil_data_where('tb_data_produksi_lahan',array("no_lahan" => $kode));
|
||||
|
||||
if (count($cek_tabel_produksi->result()) > 0) {
|
||||
|
||||
foreach ($cek_tabel_produksi->result() as $key5 => $value5) ;
|
||||
$ket = json_decode($value5->ket,true);
|
||||
|
||||
// print_r($ket);
|
||||
// print_r('<br><br><br>');
|
||||
$array_baru_ini = null;
|
||||
$jika_ada = "tiada";
|
||||
foreach ($ket as $key6 => $value6) {
|
||||
// print_r($key6);
|
||||
if ($value6['tahun'] == $tahun_selesai and $value6['musim'] == $musim) {
|
||||
$ket[$key6]['waktu_tebar'] = $tanggal;
|
||||
$ket[$key6]['masa_tumbuh'] = $hari;
|
||||
$ket[$key6]['masa_panen'] = $tanggal_selesai;
|
||||
$ket[$key6]['jumlah_produksi'] = $cari['jumlahproduksi'];
|
||||
$ket[$key6]['nilai_produksi'] = $cari['nilaiproduksi'];
|
||||
$ket[$key6]['ket_elemen_produksi'] = $array_elemen;
|
||||
$jika_ada = 'ada';
|
||||
// unset($ket[$key6]);
|
||||
// $array_baru_ini = $ket;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($jika_ada == 'ada') {
|
||||
$array_baru_ini = $ket;
|
||||
}elseif ($jika_ada == 'tiada') {
|
||||
$array_baru_ini = array_merge(array($array_full),$ket);
|
||||
}
|
||||
// print_r($jika_ada);
|
||||
// print_r($array_baru_ini);
|
||||
// print_r(count($array_baru_ini));
|
||||
$this->mpenyuluh->update('tb_data_produksi_lahan',array("no_lahan" => $kode),array('ket'=> json_encode($array_baru_ini)));
|
||||
}else{
|
||||
$this->mpenyuluh->insert('tb_data_produksi_lahan',array("no_lahan" => $kode,'ket'=> json_encode(array($array_full))));
|
||||
}
|
||||
|
||||
// print_r($tahun_selesai);
|
||||
// print_r($cari['jumlahproduksi']);
|
||||
|
||||
$cek_tabel_hasil = $this->mpenyuluh->tampil_data_where('tb_hasil_produksi',array('tahun' => $tahun_selesai, 'musim' => $musim));
|
||||
// print_r(count($cek_tabel_hasil->result()));
|
||||
|
||||
if (count($cek_tabel_hasil->result()) > 0) {
|
||||
$tampil_semua_produksi = $this->mpenyuluh->tampil_data_keseluruhan('tb_data_produksi_lahan');
|
||||
$hasil = 0;
|
||||
foreach ($tampil_semua_produksi->result() as $key => $value) {
|
||||
$ket = json_decode($value->ket);
|
||||
foreach ($ket as $key1 => $value1) {
|
||||
if ($value1->tahun == $tahun_selesai and $value1->musim == $musim) {
|
||||
$hasil = $hasil + $value1->jumlah_produksi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->mpenyuluh->update('tb_hasil_produksi',array('tahun' => $tahun_selesai, 'musim' => $musim) , array('hasil' => $hasil));
|
||||
// print_r($hasil);
|
||||
}else{
|
||||
$this->mpenyuluh->insert('tb_hasil_produksi',array('tahun' => $tahun_selesai, 'musim' => $musim, 'hasil' => $cari['jumlahproduksi']));
|
||||
}
|
||||
|
||||
// print_r($musim);
|
||||
?>
|
||||
<form class="form-horizontal" style="overflow-x: auto" id="elemen_produksi">
|
||||
<table id="tabel-data" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bahan</th>
|
||||
<th>Harga</th>
|
||||
<th width="20%">Satuan</th>
|
||||
<th>Jumlah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php
|
||||
$ket = json_decode($value3->ket);
|
||||
$satuan = json_decode($value3->satuan);
|
||||
$r = 1;
|
||||
// print_r($satuan->$r);
|
||||
foreach ($elemen_produksi->result() as $key2 => $value2):
|
||||
$no = $value2->id_elemen;
|
||||
$satu = $satuan->$no;
|
||||
$harga = $ket->$no;
|
||||
|
||||
if ($harga == '' and $harga == null) {
|
||||
$harga = '';
|
||||
}else{
|
||||
$harga = number_format($harga);
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?=$value2->nama_elemen?></td>
|
||||
<td>Rp. <?=$harga?> </td>
|
||||
<td>
|
||||
<input type="text" style="width: 200px;" class="form-control" id="inputan<?=$value2->id_elemen?>" placeholder="Jumlah <?=$value2->nama_elemen?>" name="<?=$value2->id_elemen?>" value="<?=$data[$no]?>" minlegth='5' maxlength='10'>
|
||||
</td>
|
||||
<td>Rp . <?=number_format($cari['jumlah'.$no])?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-5 control-label">Jumlah Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="<?=number_format($cari['jumlahproduksi'])?> kg" title="Jumlah Produksi" disabled="">
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#tabel-data').DataTable({
|
||||
"pageLength": 10,
|
||||
"searching": false,
|
||||
"paging": false,
|
||||
"ordering": false,
|
||||
"info": false,
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
<?php foreach ($elemen_produksi->result() as $key => $value): ?>
|
||||
|
||||
var elem = document.getElementById("inputan<?=$value->id_elemen?>");
|
||||
|
||||
elem.addEventListener("keydown",function(event){
|
||||
var key = event.which;
|
||||
if((key<48 || key>57) && key != 8) event.preventDefault();
|
||||
});
|
||||
|
||||
elem.addEventListener("keyup",function(event){
|
||||
var value = this.value.replace(/,/g,"");
|
||||
this.dataset.currentValue=parseInt(value);
|
||||
var caret = value.length-1;
|
||||
while((caret-3)>-1)
|
||||
{
|
||||
caret -= 3;
|
||||
value = value.split('');
|
||||
value.splice(caret+1,0,",");
|
||||
value = value.join('');
|
||||
}
|
||||
this.value = value;
|
||||
});
|
||||
|
||||
|
||||
<?php endforeach ?>
|
||||
</script>
|
||||
<?php
|
||||
}elseif ($this->input->post('no') == 'detail') {
|
||||
$tanggal = $this->input->post('tanggal');
|
||||
$tanggal = date('Y-m-d', strtotime($tanggal. ' + '.$hari.' days'));
|
||||
$tanggal = date("d/m/Y", strtotime($tanggal));
|
||||
|
||||
?>
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<!-- /.box-title -->
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-3 control-label">Panen</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Panen" value="<?=$tanggal?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Saiz</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Saiz" value="+- <?=$cari['saiz']?> ekor/kg" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Total Biaya</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Jumlah" value="Rp . <?=number_format($cari['totalbiaya'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-content -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-lg-6 col-xs-12 -->
|
||||
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-3 control-label">Harga Jual</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" placeholder="Enter your email" title="Harga Jual" value="Rp. <?=number_format($cari['hargajual'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Nilai Produksi</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Nilai" value="Rp. <?=number_format($cari['nilaiproduksi'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">Keuntungan</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" title="Keuntungan" value="Rp. <?=number_format($cari['keuntungan'])?>" disabled="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<div class="card-content">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-5 control-label">Status Produksi</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" value="<?=$cari['status']?>" title="Status Produksi" disabled="">
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}elseif ($this->input->post('no') == 'tabel_transaksi') {
|
||||
|
||||
$data_transaksi_produksi = $this->mpenyuluh->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $kode));
|
||||
?>
|
||||
<table id="tabel-data1" class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Tahun</th>
|
||||
<th>Musim</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($data_transaksi_produksi->result())>0): ?>
|
||||
<?php foreach ($data_transaksi_produksi->result() as $key => $value):
|
||||
$ket = json_decode($value->ket);
|
||||
?>
|
||||
<?php $i=1; foreach ($ket as $key1 => $value1): ?>
|
||||
<tr>
|
||||
<td><?=$i?></td>
|
||||
<td><?=$value1->tahun?></td>
|
||||
<td><?=$value1->musim?></td>
|
||||
<td align="center">
|
||||
<a href=""><button type="button" title="Lihat Transaksi Produksi" class="btn btn-info btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-list-alt"></i></button></a>
|
||||
<a href=""><button type="button" title="Edit Transaksi Produksi" class="btn btn-warning btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-file-text"></i></button></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i++; endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#tabel-data1').DataTable({
|
||||
"pageLength": 10,
|
||||
"searching": true,
|
||||
"paging": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
swal({
|
||||
title: "Transaksi Produksi Berhasil Diupdate",
|
||||
text: "Anda Bisa Mengeditnya Pada Tabel Yang Tersedia",
|
||||
icon: "success",
|
||||
// buttons: false,
|
||||
dangerMode: true,
|
||||
confirmButtonText: 'Save',
|
||||
showLoaderOnConfirm: true,
|
||||
|
||||
})
|
||||
.then((logout) => {
|
||||
if (logout) {
|
||||
window.location.replace("<?=base_url()?>penyuluh/transaksi/lihat/<?=$kode?>/<?=$tahun_selesai?>-<?=$musim?>");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}elseif ($this->uri->segment(3) == 'lihat') {
|
||||
if (is_numeric($this->uri->segment(4))) {
|
||||
$id = $this->uri->segment(4);
|
||||
$cek_lahan = $this->mpenyuluh->tampil_data_where('tb_lahan',array('id_lahan' => $id, 'kecamatan' => $penyuluh['kecamatan']));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
|
||||
// echo "sini";
|
||||
$array = explode('-',$this->uri->segment(5));
|
||||
$data_transaksi_produksi = $this->mpenyuluh->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
|
||||
if (count($data_transaksi_produksi->result())>0) {
|
||||
foreach ($data_transaksi_produksi->result() as $key => $value) ;
|
||||
$ket = json_decode($value->ket,true);
|
||||
// print_r(count($ket));
|
||||
$ada = 0;
|
||||
$array_ket = null;
|
||||
foreach ($ket as $key1 => $value1) {
|
||||
if ($value1['tahun'] == $array[0] and $value1['musim'] == $array[1]) {
|
||||
$ada = 1;
|
||||
$array_ket = $value1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ada == 1) {
|
||||
// echo "sini tampilan";
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['elemen_produksi'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['data_transaksi_produksi'] = $this->mpenyuluh->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
$main['kode_lahan'] = $id;
|
||||
$main['ket_nya'] = $array_ket;
|
||||
$main['main']='penyuluh/menu/transaksi_lihat';
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
// print_r($main['ket']);
|
||||
}elseif ($ada == 0) {
|
||||
echo "bukan tampilan";
|
||||
}
|
||||
}else{
|
||||
echo "tiada";
|
||||
}
|
||||
}else{
|
||||
// $this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
// redirect('/penyuluh');
|
||||
echo "bukan";
|
||||
}
|
||||
}else{
|
||||
echo "bukan";
|
||||
}
|
||||
}elseif (is_numeric($this->uri->segment(3))) {
|
||||
$id = $this->uri->segment(3);
|
||||
$cek_lahan = $this->mpenyuluh->tampil_data_where('tb_lahan',array('id_lahan' => $id, 'kecamatan' => $penyuluh['kecamatan']));
|
||||
if (count($cek_lahan->result())>0) {
|
||||
$main['kode_lahan'] = $id;
|
||||
$main['lahan'] = $cek_lahan;
|
||||
$main['elemen_produksi'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_elemen_produksi');
|
||||
$main['data_transaksi_produksi'] = $this->mpenyuluh->tampil_data_where('tb_data_produksi_lahan', array('no_lahan' => $id));
|
||||
$main['main']='penyuluh/menu/transaksi_proses';
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
|
||||
}else{
|
||||
$this->session->set_flashdata('error','<b>Error</b><br>Halaman Yang Diakses Tiada Dalam');
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
}elseif ($this->uri->segment(3) == '') {
|
||||
$penyuluh = $this->session->userdata('penyuluh');
|
||||
$cek_kecamatan = $this->mpenyuluh->tampil_data_where('tb_kecamatan',array('id_kecamatan' => $penyuluh['kecamatan']));
|
||||
foreach ($cek_kecamatan->result() as $key => $value) ;
|
||||
$main['nama_kecamatan'] = $value->kecamatan;
|
||||
$main['no_kecamatan'] = $value->id_kecamatan;
|
||||
$main['cek_lahan_kecamatan'] = $this->mpenyuluh->tampil_data_where('tb_lahan', array('kecamatan' => $penyuluh['kecamatan']));
|
||||
$main['main']='penyuluh/menu/transaksi';
|
||||
|
||||
$main['kecamatan'] = $this->mpenyuluh->tampil_data_keseluruhan('tb_kecamatan');
|
||||
// $main['lahan'] = $this->mpenyuluh->tampil_data_where('tb_lahan',array('nik_petambak' => $nik));
|
||||
|
||||
$this->load->view('penyuluh/index',$main);
|
||||
}else{
|
||||
redirect('/penyuluh');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function logout()
|
||||
{
|
||||
$this->session->unset_userdata('penyuluh');
|
||||
$this->session->unset_userdata(array('nama','nik','level'));
|
||||
$this->session->set_flashdata('success', '<b>Anda Berhasil Logout</b><br>Terima Kasih Telah Menggunakan Sistem Ini');
|
||||
redirect('/home');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
1080
application/controllers/Petambak.php
Normal file
1080
application/controllers/Petambak.php
Normal file
File diff suppressed because it is too large
Load Diff
25
application/controllers/Welcome.php
Normal file
25
application/controllers/Welcome.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
}
|
||||
11
application/controllers/index.html
Normal file
11
application/controllers/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user