Praise be to Allah.Praise be to Allah.
Working in the field of metals, extracting gold and silver and trading them, is a permissible kind of work. Therefore there is nothing wrong with buying shares in this company.
But you have to make sure that this company does not sell gold or silver for late payment (on credit), because one of the conditions of selling gold or silver for cash is that the exchange is to be completed in the sitting in which the contract is drawn up, and it is not permissible to delay or postpone the exchange. This has been discussed in the answer to question no. 150841 and 182364.
If it is clear that this company is one that sells on credit, then in that case it is a “mixed company” (i.e., some of its income is halaal and some is haraam). We have previously discussed the prohibition on buying shares in such companies. Please see the answer to question no. 112445
The basic principle with regard to distribution of profits is that it should be connected to how much one has invested in the company and the rate of profits that the company has earned from sales each month. As this company deals in gold and silver, it is natural that the rate of profit will vary according to fluctuations in the price of gold.
Hence there is nothing wrong with what you mentioned about the amount of profit varying from one month to another, according to the price of gold in the market.
But there is a difference between variations in the amount of profit, which is what we understood from your question, and variations in the percentage. The shareholder’s percentage of the profit must be fixed in each contract and agreed upon from the outset, so that the percentage of the share (capital) will be known and distinct from the profits made by the company. Then the profits should be divided according to the capital that the shareholder has invested, each according to his share of the company’s capital.
In such matters it is preferable to send us the text of the contract so that we may understand the nature of the contract and give a precise ruling.
And Allah knows best.