Advertisement
freddy0512

deradada

Apr 1st, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. //simpan parent
  2. public function simpan()
  3. {
  4. $data = array(
  5. 'id_pembelian' => $this->input->post('id'),
  6. 'tgl' => $this->input->post('tanggal'),
  7. 'tgl_pembelian' => $this->input->post('tanggal_bayar'),
  8. 'status' => $this->input->post('status'),
  9. 'id_suplier' => $this->input->post('kode_suplier'),
  10. 'refrensi' => $this->input->post('refrensi'),
  11. 'total_bayar' => $this->input->post('total_price'),
  12. 'rabat' => $this->input->post('rabat'),
  13. 'bayar_bersih' => $this->input->post('bersih'),
  14. );
  15. $this->db->insert('tabel_pembelian',$data);
  16. }
  17.  
  18.  
  19. //simpan anak child
  20. public function simpan_banyak()
  21. {
  22. $result = array();
  23. foreach($_POST['itemNo'] AS $key => $val){
  24. $result[] = array(
  25. "id_barang" => $_POST['itemNo'][$key]
  26. ,"harga_satuan" => $_POST['price'][$key]
  27. //,"id_pembelian" => $_POST['id'][$key]
  28. ,"jumlah_item" => $_POST['quantity'][$key]
  29. ,"harga_satuan" => $_POST['price'][$key]
  30. ,"jumlah_bayar" => $_POST['total'][$key]
  31. );
  32. }
  33. $res = $this->db->insert_batch('tabel_pembelian_child', $result); // fungsi dari codeigniter untuk menyimpan multi array
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement