if you are thinking about that though the body travels a more than h on inclined plane , yet potential energy gained is mgh....
the force on the body is mgsin (along the slope...i.e. in the direction of displacement) ...the distance travelled is h/sin..(from the right angled triangle). potential energy gained is mgh....