<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Crone_Controller extends CI_Controller {

        public function __construct() {
        parent::__construct();
        $this->load->model('product_model');
        $this->load->model('common_model');
        $this->load->model('General');
     
    
         
        }
        
        function chk_credit_limit(){
    	    $detail = $this->General->credit_limit();
    	    echo $detail;
    	}
    	
    	function cust_credit_limit(){
    	    $detail = $this->General->cal_credit_limit(1862);
    	    echo $detail;
    	}
        
        function rem_temp_Item(){
            
            
            $this->db->select('*');
                    $this->db->from('temp_qto_items');
                   // $this->db->limit(1);
                    $hasil=$this->db->get();
                    $qto_itm= $hasil->result();
            $det = "a";
    	    
    	    for($i=0; $i<count($qto_itm); $i++){
                                $data = array(
                                    'temp_line_id' => $qto_itm[$i]->po_itm_id,
                                    'ref_id' => $qto_itm[$i]->po_user
                               );    
                                 
                                $rest_api_base_url = 'https://manchieedecoco.com/lumen/public';    
                                $post_endpoint = '/com_all_ret_item';
                                $request_data = $data;
                                $response = perform_http_request('POST', $rest_api_base_url . $post_endpoint, $request_data);    
                                 $dett = json_decode($response); 
                    if($det!=null){
                        $det = $qto_itm[$i]->po_user;
                    }else{
                        $det = "Please Retry";
                    }
    	    }
    	   
    	    echo $det;
    	}
    
}        