function update()
 {
     $chart_acc = MAc_charts::get_by_id($this->input->post('ac_chart_id'));
     $data = array('user_id' => $this->session->userdata('user_id'), 'voucher_no' => $this->input->post('voucher_no'), 'voucher_date' => $this->input->post('voucher_date'), 'ac_chart_id' => $this->input->post('ac_chart_id'), 'emp_id' => $this->input->post('emp_id'), 'memo' => $this->input->post('memo'), 'amount' => $this->input->post('amount'), 'type' => $chart_acc['type']);
     $this->db->where('id', $this->input->post('id'));
     $this->db->update('ac_journal_voucher_details', $data);
 }
 function get_voucher($chart, $sdate, $edate)
 {
     $data = array();
     $edate = 'voucher_date BETWEEN "' . $sdate . '" AND "' . $edate . '"';
     $this->db->where($edate, NULL, FALSE);
     $q = $this->db->get('ac_journal_voucher_master');
     if ($q->num_rows() > 0) {
         foreach ($q->result_array() as $row) {
             $chart_acc = MAc_charts::get_by_id($row['ac_chart_id']);
             $row['name_acc'] = $chart_acc['name'];
             $data[] = $row;
         }
     }
     $q->free_result();
     return $data;
 }