After all pleadings have been presented, but within such time as not to delay the trial, any party may move for judgment on the pleadings. If on such a motion matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment, shall be subject to Rule 36 until final disposition, and all parties shall be given reasonable opportunity to present all material pertinent to such motion under said rule.