You can buy your ticket from 3 months to 2 days before departure, depending on each PO's policy and ticket availability.
Specifically for Pahala Kencana, you can still buy your ticket 6 hours before departure.