Guest User

Untitled

a guest
Feb 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. public function admin_debit()
  2. {
  3. $date= date('Y-m-d H:i:s');
  4. $trans_type=2;
  5. $amount=$this->input->post('amount');
  6. $total_amount = array_sum($amount);
  7. $json=json_encode($_POST);
  8. $user=$this->session->userdata('sess_pt_userid');
  9. $data=array(
  10. 'dated_on'=>$date,
  11. 'amount'=>$total_amount,
  12. 'userid'=>$user,
  13. 'purpose'=>$json,
  14. 'trans_type'=>$trans_type
  15. );
  16. $response = $this->Petty_model->debit_insert($data);
  17. //add flash data
  18. if($response)
  19. {
  20. $this->session->set_flashdata('success', 'Cash Debited Successfully ');
  21. redirect('Petty_controller/debitview');
  22. }
  23. else
  24. {
  25. $this->session->set_flashdata('error', 'Something worng. Error!!');
  26. redirect('Petty_controller/debitview');
  27. }
  28. }
  29.  
  30. $amount=$this->input->post('amount');
  31. $total_amount = array_sum($amount);
  32.  
  33. $total_amount=0;
  34. if($this->input->post('amount') && is_array($this->input->post('amount')){
  35. $total_amount = array_sum($this->input->post('amount'));
  36. }
  37. $date= date('Y-m-d H:i:s');
  38. $trans_type=2;
  39. $json=json_encode($_POST);
  40. $user=$this->session->userdata('sess_pt_userid');
  41. $data=array(
  42. 'dated_on'=>$date,
  43. 'amount'=>$total_amount,
  44. 'userid'=>$user,
  45. 'purpose'=>$json,
  46. 'trans_type'=>$trans_type
  47. );
  48. $response = $this->Petty_model->debit_insert($data);
Add Comment
Please, Sign In to add comment