postpaid always zero for first time recharge and invoice atribute for next month

for postpaid customer invoice reminder and order get from invoice attribute
This commit is contained in:
gerandonk
2024-03-15 04:07:30 +07:00
parent 78d1634470
commit a15510e62a
3 changed files with 80 additions and 33 deletions

View File

@ -38,7 +38,18 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$price = Lang::moneyFormat($p['price']);
if ($p['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $ds['customer_id']);
if (empty ($add_inv) or $add_inv == 0) {
$price = Lang::moneyFormat($p['price']);
} else {
$price = Lang::moneyFormat($add_inv);
}
} else {
$price = Lang::moneyFormat($p['price']);
}
//$price = Lang::moneyFormat($p['price']);
if ($ds['expiration'] == $day7) {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) {