After the pleadings are closed but within such time as not to delay the trial, any party may move for judgment on the pleadings. If, on a motion for judgment on the pleadings, matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in § 15-6-56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by § 15-6-56.
SDCL 15-6-12(c)