function tambah_proses() { $date = $this->input->post('tanggal_masuk'); $tgl = dateinsert($date); $maks = $this->mi->maksinven(); foreach ($maks->result() as $row) { $nmax = $row->maks; $pmax = substr($nmax, 2); $fmax = sprintf("%'.03d\n", $pmax + 1); $idstok = "ST{$fmax}"; } $config['upload_path'] = 'asset/assets/upload/inventori'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '999999'; $config['max_width'] = '999999'; $config['max_height'] = '9999999'; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); if (!$this->upload->do_upload()) { $foto = 'no.jpg'; $data = array('id_stok' => $idstok, 'nama_barang' => $this->input->post('nama'), 'harga' => $this->input->post('harga'), 'stok' => $this->input->post('stok'), 'min_stok' => $this->input->post('min_stok'), 'min_pembelian' => $this->input->post('min_pembelian'), 'tanggal_masuk' => $tgl, 'id_kantor' => $this->input->post('id_kantor'), 'milik' => $this->input->post('milik'), 'kategori' => $this->input->post('kategori'), 'foto' => $foto); } else { $data = array('upload_data' => $this->upload->data()); $foto = $data['upload_data']['file_name']; $data = array('id_stok' => $idstok, 'nama_barang' => $this->input->post('nama'), 'harga' => $this->input->post('harga'), 'stok' => $this->input->post('stok'), 'min_stok' => $this->input->post('min_stok'), 'min_pembelian' => $this->input->post('min_pembelian'), 'tanggal_masuk' => $tgl, 'id_kantor' => $this->input->post('id_kantor'), 'milik' => $this->input->post('milik'), 'kategori' => $this->input->post('kategori'), 'foto' => $foto); } $this->mi->insert($data); redirect('c_inventori'); }
public function simpan_request2() { $date = $this->input->post('tanggal_event'); $tgl = dateinsert($date); $akhir = $this->input->post('tanggal_akhir'); $akhirnya = dateinsert($akhir); $maks = $this->mr->maks(); foreach ($maks->result() as $row) { $nmax = $row->maks; } $pmax = substr($nmax, 2); $fmax = sprintf("%'.03d\n", $pmax + 1); $idrequest = "RQ{$fmax}"; /*$id_stok = $this->input->post('id_stok'); $jabat=implode(',',$id_stok);*/ /* $request = $this->input->post('request'); $req=implode(',',$request); $total= $this->input->post('total'); $tot =implode(',',$total);*/ $config['upload_path'] = './asset/assets/upload/laporan/'; $config['allowed_types'] = 'pdf'; $config['max_size'] = '999999'; $config['max_width'] = '999999'; $config['max_height'] = '9999999'; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload()) { $data = array('upload_data' => $this->upload->data()); $laporan = $data['upload_data']['file_name']; $data = array('judul' => $this->input->post('judul'), 'konten' => $this->input->post('konten'), 'id_karyawan' => $this->input->post('id_karyawan'), 'tanggal' => date('Y-m-d'), 'id_request' => $idrequest, 'id_kantor' => $this->input->post('id_kantor'), 'tanggal_event' => $tgl, 'tanggal_akhir' => $akhirnya, 'EO' => $this->input->post('EO'), 'strategic' => $this->input->post('strategic'), 'segmenting' => $this->input->post('segmenting'), 'positioning' => $this->input->post('positioning'), 'targeting' => $this->input->post('targeting'), 'no' => $this->input->post('no')); //print_r($data); $sukses = $this->mr->simpanrequest($data); $id_kantor = $this->input->post('id_kantor'); echo json_encode($data); } else { $data = array('upload_data' => $this->upload->data()); $laporan = $data['upload_data']['file_name']; $data = array('judul' => $this->input->post('judul'), 'konten' => $this->input->post('konten'), 'id_karyawan' => $this->input->post('id_karyawan'), 'tanggal' => date('Y-m-d'), 'id_request' => $idrequest, 'id_kantor' => $this->input->post('id_kantor'), 'tanggal_akhir' => $akhirnya, 'tanggal_event' => $tgl, 'proposal' => $laporan, 'EO' => $this->input->post('EO'), 'no' => $this->input->post('no'), 'strategic' => $this->input->post('strategic'), 'segmenting' => $this->input->post('segmenting'), 'positioning' => $this->input->post('positioning'), 'targeting' => $this->input->post('targeting')); //print_r($data); $sukses = $this->mr->simpanrequest($data); $id_kantor = $this->input->post('id_kantor'); echo json_encode($data); } }
public function insert() { $date = $this->input->post('date'); echo dateinsert($date); }