A model for analytical description of magnetic field effects and losses in a planar undulator radiation