I know that Ramadan is well and truly over for another year, but I'd like to bring a useful solution to the forum.
Sun Position Calculator is a rigorous calculation of sunset/sunrise times, including the difference between lower and upper limb of the sun and also including a correction for refraction and aircraft altitude.
Note that the QNH or QFE needs to be in kPa form, ie a tenth of QNH (or QFE) in milliBars.
Of course you'll have to iterate to converge of the solution for where the aircraft will be at local sunset, but that's simply a matter of making a wild-arsed guess and then retrying with the position that your FMS shows for that time; rinse and repeat.
Remember that for your Islamic customers the relevant time is the local time that the sun's upper limb appears or disappears at the local horizon from their viewpoint.