hi
the 5v for pic and 12v for realy must share same ground.
to calculate the the resistor for the base of transistor
in first measure the coil resistance using ohm meter ....
to get realy current use I=12v/Rcoil I here mean IC
then find IB=IC/hfe....
the vcc for pic 5v then RB=5v-0.6v/IB
but in practice u must use double of that IB to saturate transistor....
u can use compelete driver for relay like ULN2003,ULN2804
Your formulas for the base resistor do not make sense:
1) The resistance of the relay coil means nothing if you don't calculate how much current it needs.
2) The hFE of a transistor is not used when it is a switch.
The datasheet for every little transistor shows its max saturation voltage when its base current is 1/10th the collector current.
We don't know the collector current because we don't know how much current the relay coil uses.
The base current is about 5.1mA since the base resistor is 820 ohms from 4.9V.