mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-02 17:24:41 +02:00
dashboard only show plan who have voucher
This commit is contained in:
parent
492ea5985c
commit
718b47ac49
1 changed files with 12 additions and 8 deletions
|
@ -67,16 +67,20 @@ $plans = array();
|
|||
$stocks = array("used" => 0, "unused" => 0);
|
||||
$n = 0;
|
||||
foreach ($tmp as $plan) {
|
||||
$plans[$n]['name_plan'] = $plan['name_plan'];
|
||||
$plans[$n]['unused'] = ORM::for_table('tbl_voucher')
|
||||
$unused = ORM::for_table('tbl_voucher')
|
||||
->where('id_plan', $plan['id'])
|
||||
->where('status', 0)->count();;
|
||||
$stocks["unused"] += $plans[$n]['unused'];
|
||||
$plans[$n]['used'] = ORM::for_table('tbl_voucher')
|
||||
->where('status', 0)->count();
|
||||
$used = ORM::for_table('tbl_voucher')
|
||||
->where('id_plan', $plan['id'])
|
||||
->where('status', 1)->count();;
|
||||
$stocks["used"] += $plans[$n]['used'];
|
||||
$n++;
|
||||
->where('status', 1)->count();
|
||||
if($unused>0 || $used>0){
|
||||
$plans[$n]['name_plan'] = $plan['name_plan'];
|
||||
$plans[$n]['unused'] = $unused;
|
||||
$plans[$n]['used'] = $used;
|
||||
$stocks["unused"] += $unused;
|
||||
$stocks["used"] += $used;
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
|
||||
$ui->assign('stocks', $stocks);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue