print voucher, update dashboard, hide messages

This commit is contained in:
Ibnu Maksum
2017-03-15 02:37:15 +07:00
parent b6c55ff5a9
commit ab563e5005
12 changed files with 281 additions and 21 deletions

View File

@ -56,4 +56,25 @@ $ui->assign('dlog',$dlog);
$log = ORM::for_table('tbl_logs')->count();
$ui->assign('log',$log);
// Count stock
$tmp = $v = ORM::for_table('tbl_plans')->select('id')->select('name_plan')->find_many();
$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')
->where('id_plan',$plan['id'])
->where('status',0)->count();;
$stocks["unused"] += $plans[$n]['unused'];
$plans[$n]['used'] = ORM::for_table('tbl_voucher')
->where('id_plan',$plan['id'])
->where('status',1)->count();;
$stocks["used"] += $plans[$n]['used'];
$n++;
}
$ui->assign('stocks',$stocks);
$ui->assign('plans',$plans);
$ui->display('dashboard.tpl');

View File

@ -392,11 +392,20 @@ switch ($action) {
$code = _post('code');
if ($code != ''){
$ui->assign('code',$code);
$paginator = Paginator::bootstrap('tbl_voucher','code','%'.$code.'%');
$d = ORM::for_table('tbl_plans')->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))->where_like('tbl_plans.code','%'.$code.'%')->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
$d = ORM::for_table('tbl_plans')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->where_like('tbl_plans.code','%'.$code.'%')
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->find_many();
}else{
$paginator = Paginator::bootstrap('tbl_voucher');
$d = ORM::for_table('tbl_plans')->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))->offset($paginator['startpoint'])->limit($paginator['limit'])->find_many();
$d = ORM::for_table('tbl_plans')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->offset($paginator['startpoint'])
->limit($paginator['limit'])->find_many();
}
$ui->assign('d',$d);
@ -416,6 +425,32 @@ switch ($action) {
$ui->display('voucher-add.tpl');
break;
case 'print-voucher':
$from_id = _post('from_id')*1;
$pagebreak = _post('pagebreak');
if ($from_id != ''){
$v = ORM::for_table('tbl_plans')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->where('tbl_voucher.status','0')
->where_gt('tbl_voucher.id',$from_id)
->find_many();
}else{
$v = ORM::for_table('tbl_plans')
->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan'))
->where('tbl_voucher.status','0')
->find_many();
}
$ui->assign('_title', $_L['Voucher_Hotspot'].' - '. $config['CompanyName']);
$ui->assign('from_id',$from_id);
if($pagebreak<1) $pagebreak = 6;
$ui->assign('pagebreak',$pagebreak);
$ui->assign('v',$v);
//for counting pagebreak
$ui->assign('jml',0);
$ui->display('print-voucher.tpl');
break;
case 'voucher-post':
$type = _post('type');
$plan = _post('plan');

View File

@ -175,10 +175,12 @@ $_L['Number_of_Vouchers'] = 'Number of Vouchers';
$_L['Length_Code'] = 'Length Code';
$_L['Code_Voucher'] = 'Code Voucher';
$_L['Voucher'] = 'Voucher';
$_L['Voucher_Hotspot'] = 'Hotspot Voucher';
$_L['Status_Voucher'] = 'Status Voucher';
$_L['Add_Voucher'] = 'Add Vouchers';
$_L['Voucher_Successfully'] = 'Create Vouchers Successfully';
$_L['Generate'] = 'Generate';
$_L['Print_Info'] = 'Print side by side, it will easy to cut';
$_L['From_Date'] = 'From Date';
$_L['To_Date'] = 'To Date';

View File

@ -174,10 +174,12 @@ $_L['Number_of_Vouchers'] = 'Jumlah Voucher';
$_L['Length_Code'] = 'Panjang Kode';
$_L['Code_Voucher'] = 'Kode Voucher';
$_L['Voucher'] = 'Voucher';
$_L['Voucher_Hotspot'] = 'Voucher Hotspot';
$_L['Status_Voucher'] = 'Status Voucher';
$_L['Add_Voucher'] = 'Tambah Voucher';
$_L['Add_Voucher'] = 'Tambah';
$_L['Voucher_Successfully'] = 'Berhasil membuat Voucher baru';
$_L['Generate'] = 'Generate';
$_L['Print_Info'] = 'Print bolak balik, biar mudah dipotong dan hemat kertas';
$_L['From_Date'] = 'Dari Tanggal';
$_L['To_Date'] = 'Hingga Tanggal';