Sheikh Hânî al-Jubayr, judge at the Jeddah Supreme Court
Zakâh is levied upon the trade goods that a manufacturer, wholesaler, or retailer owns and has on offer for sale.
In the situation that you describe, the medicines are not owned by the pharmacy, but are rather being held on consignment. The pharmacy is simply acting as a distributor for the medicines and taking a percentage of the sale price as a commission. The pharmacy in this case is merely a sales agent for the pharmaceutical companies. Medicines that are left unsold, therefore, are duly returned to the companies that own them.
The pharmaceutical companies are responsible to pay the Zakâh in this case, not the pharmacy, since the medicines are actually the the trade goods of those companies.
As for the other goods being sold by the pharmacy – goods that the pharmacy purchases and resells like any other retailer – the Zakâh on these goods is determined as follows:
The total retail price of these goods is first determined. The money that the pharmacy possesses is added to this amount. Then, any outstanding debts that the pharmacy has are deducted from the total. From the amount that remains, 2.5% must be paid as Zakâh.
The formula is as follows:
(Retail value of goods + cash – debts) X 0.025 = Zakâh owed.
And Allah knows best.
Source: Islam Today