dashboard only show plan who have voucher
This commit is contained in:
parent
492ea5985c
commit
718b47ac49
@ -67,16 +67,20 @@ $plans = array();
|
|||||||
$stocks = array("used" => 0, "unused" => 0);
|
$stocks = array("used" => 0, "unused" => 0);
|
||||||
$n = 0;
|
$n = 0;
|
||||||
foreach ($tmp as $plan) {
|
foreach ($tmp as $plan) {
|
||||||
|
$unused = ORM::for_table('tbl_voucher')
|
||||||
|
->where('id_plan', $plan['id'])
|
||||||
|
->where('status', 0)->count();
|
||||||
|
$used = ORM::for_table('tbl_voucher')
|
||||||
|
->where('id_plan', $plan['id'])
|
||||||
|
->where('status', 1)->count();
|
||||||
|
if($unused>0 || $used>0){
|
||||||
$plans[$n]['name_plan'] = $plan['name_plan'];
|
$plans[$n]['name_plan'] = $plan['name_plan'];
|
||||||
$plans[$n]['unused'] = ORM::for_table('tbl_voucher')
|
$plans[$n]['unused'] = $unused;
|
||||||
->where('id_plan', $plan['id'])
|
$plans[$n]['used'] = $used;
|
||||||
->where('status', 0)->count();;
|
$stocks["unused"] += $unused;
|
||||||
$stocks["unused"] += $plans[$n]['unused'];
|
$stocks["used"] += $used;
|
||||||
$plans[$n]['used'] = ORM::for_table('tbl_voucher')
|
|
||||||
->where('id_plan', $plan['id'])
|
|
||||||
->where('status', 1)->count();;
|
|
||||||
$stocks["used"] += $plans[$n]['used'];
|
|
||||||
$n++;
|
$n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ui->assign('stocks', $stocks);
|
$ui->assign('stocks', $stocks);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user