ZnNH4PO4 is a neutral compound and hence, the sum of oxidation numbers of the elements will be equal to 0.
This complex is formed of Zn element, NH4 ions and PO4 ions.
Zn forms ZnO in which oxygen has a -2 oxidation state, so Zn will have a +2 oxidation charge.
NH4 forms NH4OH where OH has -1 oxidation state, so NH4 will have a +1 oxidation state.
Now, NH4 has +1 oxidation state and hydrogen always has +1 oxidation state (with non-metals).
So, oxidation state of N+(+1×4)=+1
Oxidation state of N = -3
Now, PO4 forms H3PO4 which is a neutral compound. Again H has +1 charge,
So, oxidation state of PO4+(+1×3)=0
Or, oxidation state of PO4=−3
Since the oxidation state of oxygen is -2 (with less electronegative elements),
Oxidation state of P+(−2×4)=−3
Or, oxidation state of P = +5