He invented a product and sold it to a middleman to sell it to the company where he works without the company knowing
Question

                I have been working as an engineer in a petroleum services company for ten years. My basic job is maintaining the company’s equipment and providing technical support, but other tasks have been added to my job over the last ten years. My company treats me like anyone else, or less than that, because I do not demand increases in my salary as others do; rather I wait for the company to evaluate me, which has only happened once or twice. I began to invent things for my company and I was promised more than once that I would be rewarded, but this has not happened. On the contrary, I was rebuked because I asked to be rewarded. I have introduced many inventions and huge improvements. But that was to no avail; all I get is moral support and words of praise. Now I have invented something but this time I did not give it to my company directly; rather I gave it to an intermediary company to submit it in its name to my company in return for commission that I agreed to give to this intermediary company, after it gets the price for my invention when it sells it to my company. This invention already exists in America, but it is very expensive, at least 50% more. My company has benefited greatly from this product. My question is: is what I have done halaal or haraam?.
Praise be to Allah.
    Firstly: 

    Patents, inventions, copyright and so on belong to the 
    inventor or author, and he has the right to receive payment for them, 
    because it is customary that these rights have financial value in the 
    marketplace. 

    The Islamic Fiqh Council has issued a statement to this 
    effect, the text of which is as follows: 

    “The Islamic Fiqh Council, in its session held during its 
    fifth conference in Kuwait, 1-6 Jumaada al-Awwal 1409 AH/10-15 December 1988 
    CE, after studying the research presented by members and experts on the 
    topic of intangible rights, and listening to the discussions that were held 
    concerning this topic, has determined the following:

    Firstly: trade names, company names, trademarks, writings and 
    inventions are all the copyright of their owners or authors, which in modern 
    practice have acquired monetary value. These rights are respected by 
    sharee’ah and it is not permissible to transgress against them.   

    Secondly: 

    If your work to invent this thing did not involve using any 
    of the products belonging to the company, and you did not do it on company 
    time, meaning that you worked on it outside of working hours, or at times 
    when you were not required to work, then this is your exclusive right as 
    stated above, and there is nothing wrong with selling it to your company or 
    to an intermediate company who can sell it to your company. 

    But if that was at the expense of your work for the company, 
    or you used the company’s materials, products or laboratory, then you have 
    done wrong because you got distracted frin your work and because you used 
    the company’s resources for a purpose other than that for which they were 
    intended, and you have to compensate the company for what is their due. The 
    basic principle is that you should tell them and work out an agreement to be 
    paid for your efforts and invention. If you will be harmed by admitting this 
    or you think it most likely that the company will not give you anything, 
    then try to give them their due by any means possible after working out what 
    you owe them with the help of experts in that field. 

    This right of the company, if it is proven, does not make it 
    permissible to transgress against the company on the grounds that they did 
    not give you an increase in your salary or that they did not appreciate your 
    work and inventions, because two wrongs do not make a right. You should 
    strive to improve your standing in the company by proper means, such as 
    asking for it. 

    And Allah knows best.