Welcome Guest, Not a member yet? Register   Sign In
RE:[help!!!] A PHP Error was encountered
#12

[eluser]maria clara[/eluser]
here's the code in the model:
Code:
function save_detail($id,$rows0,$rows1,$rows2,$rows3,$dt)
    //function save_detail($id,$rows0=array(),$rows1=array(),$rows2,$rows3,$dt)
    {
        $this->db->where('receipt_id', $id);
        $this->db->delete('ccm_receipt_t');        
        
        //print_r($rows0);
        foreach ($rows0 as $row0)
        {
            $rdata = explode('|', $row0);
            
            $data['receipt_id'] = $id;
            $data['si_id'] = $rdata[7];
            $data['inv_date'] = convertViewDate($rdata[2]);
            $data['inv_balance'] = $rdata[3];
            $data['applied'] = $rdata[4];
            $data['ewt'] = $rdata[5];
            $data['evat'] = $rdata[6];
            
            $this->db->insert('ccm_receipt_t', $data);
            
            $this->updateSalesBalance($data);    
        
        }
        
        
        $this->db->where('receipt_id', $id);
        $this->db->delete('ccm_receipt_c');        
        
        //print_r($rows1);    
        foreach ($rows1 as $row1)
        {
            $rdata = explode('|', $row1);
            
            $data1['receipt_id'] = $id;
            $data1['type_id'] = $rdata[6];
            $data1['bank_id'] = $rdata[7];
            $data1['check_no'] = $rdata[3];
            $data1['check_date'] = convertViewDate($rdata[4]);
            $data1['amount'] = $rdata[5];
            
            $this->db->insert('ccm_receipt_c', $data1);
            
            if ($data1['type_id']=='171')
            {
                $this->db->where('tran_id', $data1['receipt_id']);
                $this->db->delete('maint_cheque');
        
                $company = $this->session->userdata('company');
                $cheque['company_id'] = $company['company_id'];
                $cheque['cheque_no'] = $data1['check_no'];
                $cheque['cheque_date'] = $data1['check_date'];
                $cheque['amount'] = $data1['amount'];
                $cheque['client_id'] = $dt['client_id'];
                $cheque['bank_id'] = $data1['bank_id'];
                $cheque['type_id'] = $data1['type_id'];
                $cheque['tran_id'] = $data1['receipt_id'];
                $cheque['trans_type_id'] = '228';
                $cheque['cleared_date'] = $dt['date'];

                $this->db->insert('maint_cheque', $cheque);
            }
        }
        
        
        $this->db->where('receipt_id', $id);
        $this->db->delete('ccm_receipt_o');    
        
        if ($rows2)
        {        
            foreach ($rows2 as $row2)
            {
                $rdata = explode('|', $row2);
                
                $data2['receipt_id'] = $id;
                $data2['type_id'] = $rdata[6];
                $data2['accnt_id'] = $rdata[7];
                $data2['desc'] = $rdata[4];
                $data2['amount'] = $rdata[5];
                
                $this->db->insert('ccm_receipt_o', $data2);
            }
        }
        
        $this->db->where('receipt_id', $id);
        $this->db->delete('ccm_receipt_map');
        
        if ($rows3)
        {        
            foreach ($rows3 as $row3)
            {
                $rdata = explode('|', $row3);
                
                $data3['receipt_id'] = $id;
                $data3['bank_id'] = $rdata[5];
                $data3['check_no'] = $rdata[2];
                $data3['si_id'] = $rdata[6];
                $data3['amount'] = $rdata[4];
                
                $this->db->insert('ccm_receipt_map', $data3);
            }
        }
    }

and it is passing in the controller with this
Code:
foreach ($fields as $field)
                {
                    if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);
                }
                
                $item = $this->input->post("item");        
                $company = $this->session->userdata('company');
                $dt['company_id'] = $company['company_id'];
                //$dt['sales_date'] = convertDate($this->input->post("sales_date"));
                
                $rows = $this->input->post("row0");    
    
                $data['item'] = $this->CCM_receipt_db->save($dt,$item,$rows,'','','');


Messages In This Thread
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 09:49 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 09:55 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:08 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:13 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:24 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:28 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:37 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 10:59 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:03 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:06 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:08 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:11 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:21 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-11-2010, 11:26 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 12:22 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 12:32 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 12:37 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 12:45 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 12:50 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 01:07 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 01:14 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 01:25 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 01:37 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 08:47 AM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 07:26 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 07:31 PM
RE:[help!!!] A PHP Error was encountered - by El Forum - 01-12-2010, 07:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB