Invoice number not Random

This commit is contained in:
Ibnu Maksum 2024-03-12 12:12:36 +07:00
parent 23763ed308
commit ef85bdb02f
No known key found for this signature in database
GPG key ID: 7FC82848810579E5
2 changed files with 9 additions and 9 deletions

View file

@ -44,7 +44,7 @@ class Package
if ($router_name == 'balance') {
// insert table transactions
$inv = "INV-" . Package::_raid(5);
$inv = "INV-" . Package::_raid();
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = $inv;
$t->username = $c['username'];
@ -188,7 +188,7 @@ class Package
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->invoice = "INV-" . Package::_raid();
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
@ -260,7 +260,7 @@ class Package
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->invoice = "INV-" . Package::_raid();
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
if ($p['validity_unit'] == 'Period') {
@ -373,7 +373,7 @@ class Package
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->invoice = "INV-" . Package::_raid();
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
@ -444,7 +444,7 @@ class Package
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5);
$t->invoice = "INV-" . Package::_raid();
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
if ($p['validity_unit'] == 'Period') {
@ -588,9 +588,9 @@ class Package
}
public static function _raid($l)
public static function _raid()
{
return substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l);
return ORM::for_table('tbl_transactions')->max('id')+1;
}
/**

View file

@ -170,7 +170,7 @@ $style
$html
EOF;
$mpdf->WriteHTML($nhtml);
$mpdf->Output(date('Y-m-d') . Package::_raid(4) . '.pdf', 'D');
$mpdf->Output(date('Ymd_His') . '.pdf', 'D');
} else {
echo 'No Data';
}
@ -344,7 +344,7 @@ $style
$html
EOF;
$mpdf->WriteHTML($nhtml);
$mpdf->Output(date('Y-m-d') . Package::_raid(4) . '.pdf', 'D');
$mpdf->Output(date('Ymd_His') . '.pdf', 'D');
} else {
echo 'No Data';
}