Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
605 B
2
Indexable
Never
$latest_ticket = $this->model_app->get_latest_ticket_pr();
                $cekskrng = date('Ymd');
                $cekdata_akhir = substr($latest_ticket, 3, -3);

                if (empty($latest_ticket) || $cekskrng != $cekdata_akhir) {
                    $new_number = 1;
                } else {
                    $last_number = number_format(substr($latest_ticket, -3));
                    $new_number = $last_number + 1;
                }

                $new_number_str = str_pad($new_number, 3, '0', STR_PAD_LEFT);
                $kd_pr = "PR-" . date('Ymd') . $new_number_str;