From 1a5a7124f72b7cb49b0fcbaa5597e55d55418399 Mon Sep 17 00:00:00 2001 From: AGSTR <144728914+agstrxyz@users.noreply.github.com> Date: Sat, 4 Jan 2025 01:59:20 +0700 Subject: [PATCH] Update plan.php --- system/controllers/plan.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/system/controllers/plan.php b/system/controllers/plan.php index d10bf624..d48a269d 100644 --- a/system/controllers/plan.php +++ b/system/controllers/plan.php @@ -604,6 +604,17 @@ switch ($action) { ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0'); } + if (!empty($selected_datetime)) { + $v = ORM::for_table('tbl_plans') + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->where('tbl_voucher.status', '0') + ->where('tbl_voucher.created_at', $selected_datetime) + ->limit($limit); + $vc = ORM::for_table('tbl_plans') + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->where('tbl_voucher.status', '0'); + + } if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { $v = $v->find_many(); $vc = $vc->count(); @@ -617,11 +628,6 @@ switch ($action) { $v = $v->where_in('generated_by', $sales)->find_many(); $vc = $vc->where_in('generated_by', $sales)->count(); } - if (!empty($selected_datetime)) { - $v = ORM::for_table('tbl_voucher') - ->where('created_at', $selected_datetime) - ->find_many(); - } $template = file_get_contents("pages/Voucher.html"); $template = str_replace('[[company_name]]', $config['CompanyName'], $template);