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

@ -379,7 +379,18 @@ switch ($action) {
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
$d->routers = $router['name'];
$d->price = ($plan['price'] + $add_cost);
if ($plan['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $id_customer);
if (empty ($add_inv) or $add_inv == 0) {
$d->price = ($plan['price'] + $add_cost);
} else {
$d->price = ($add_inv + $add_cost);
}
} else {
$d->price = ($plan['price'] + $add_cost);
}
//$d->price = ($plan['price'] + $add_cost);
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();
@ -391,7 +402,18 @@ switch ($action) {
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
$d->routers = $router['name'];
$d->price = ($plan['price'] + $add_cost);
if ($plan['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $id_customer);
if (empty ($add_inv) or $add_inv == 0) {
$d->price = ($plan['price'] + $add_cost);
} else {
$d->price = ($add_inv + $add_cost);
}
} else {
$d->price = ($plan['price'] + $add_cost);
}
//$d->price = ($plan['price'] + $add_cost);
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();