Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //simpan parent
- public function simpan()
- {
- $data = array(
- 'id_pembelian' => $this->input->post('id'),
- 'tgl' => $this->input->post('tanggal'),
- 'tgl_pembelian' => $this->input->post('tanggal_bayar'),
- 'status' => $this->input->post('status'),
- 'id_suplier' => $this->input->post('kode_suplier'),
- 'refrensi' => $this->input->post('refrensi'),
- 'total_bayar' => $this->input->post('total_price'),
- 'rabat' => $this->input->post('rabat'),
- 'bayar_bersih' => $this->input->post('bersih'),
- );
- $this->db->insert('tabel_pembelian',$data);
- }
- //simpan anak child
- public function simpan_banyak()
- {
- $result = array();
- foreach($_POST['itemNo'] AS $key => $val){
- $result[] = array(
- "id_barang" => $_POST['itemNo'][$key]
- ,"harga_satuan" => $_POST['price'][$key]
- //,"id_pembelian" => $_POST['id'][$key]
- ,"jumlah_item" => $_POST['quantity'][$key]
- ,"harga_satuan" => $_POST['price'][$key]
- ,"jumlah_bayar" => $_POST['total'][$key]
- );
- }
- $res = $this->db->insert_batch('tabel_pembelian_child', $result); // fungsi dari codeigniter untuk menyimpan multi array
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement