public function reqGetInventory($idPoint) {
            
        $inventoriesArr = Inventories::all( array('idPoint'=>$idPoint) );
        
        $resultArr = array();
        
        foreach ($inventoriesArr as $inventory) {
                
            $rent = Rent::last( array('idInventory'=>$inventory->id) );
            $rentsResultArr = array();
            
            $comleted = null; 
            $rentId = -1;
            
            if ( !is_null($rent) && !is_null($rent->completed) ) {
                $comleted = $this->toBooleanType($rent->completed);
                $rentId = $rent->id;
            }
            
            $inventory->model = mb_convert_encoding($inventory->model, 'UTF-8', 'WINDOWS-1251');

            array_push( $rentsResultArr, array( 'id'=>$rentId, 'comleted'=>$comleted ) );                    
            array_push($resultArr, array('id'=>$inventory->id, 'model'=>$inventory->model, 'number'=>$inventory->number, 'rents'=>$rentsResultArr) );

        } 

        $jsonString = json_encode(array('inventories'=>$resultArr));
        //$jsonString = json_encode(array('inventories'=>$resultArr),JSON_UNESCAPED_UNICODE);
        echo $jsonString; 
        //echo mb_convert_encoding($jsonString, 'WINDOWS-1251', 'UTF-8');
    }