Add mobile number from mobile session to warranty raffle report. #719

This commit is contained in:
Korina Cordero 2022-11-21 07:01:55 +00:00
parent 8776d69a92
commit 5b6b090257

View file

@ -1269,6 +1269,7 @@ class ReportController extends Controller
'First Name', 'First Name',
'Last Name', 'Last Name',
'Contact Number', 'Contact Number',
'Mobile Number', // number with mobile app
'Address', 'Address',
'Email', 'Email',
'Action Taken', 'Action Taken',
@ -2731,7 +2732,7 @@ class ReportController extends Controller
wrl.date_create AS date_create, wrl.plate_number AS plate_number, wrl.date_create AS date_create, wrl.plate_number AS plate_number,
wrl.first_name AS first_name, wrl.last_name AS last_name, wrl.first_name AS first_name, wrl.last_name AS last_name,
wrl.contact_num AS contact_num, wrl.address AS address, wrl.email AS email, wrl.contact_num AS contact_num, wrl.address AS address, wrl.email AS email,
wrl.action AS action wrl.action AS action, wrl.api_user AS api_user_id
FROM warranty_raffle_log wrl FROM warranty_raffle_log wrl
WHERE wrl.date_create >= :date_start WHERE wrl.date_create >= :date_start
AND wrl.date_create <= :date_end'; AND wrl.date_create <= :date_end';
@ -2770,6 +2771,26 @@ class ReportController extends Controller
} }
} }
// get the mobile number of the api user using api_user_id
$api_user_id = $row['api_user_id'];
$mobile_num = '';
if ($api_user_id != null)
{
$api_sql = 'SELECT ms.phone_number AS mobile_number
FROM mobile_session ms
WHERE ms.id = :api_user_id';
$api_stmt = $db->prepare($api_sql);
$api_stmt->bindValue('api_user_id', $api_user_id);
$api_result = $api_stmt->executeQuery();
while ($api_row = $api_result->fetchAssociative())
{
$mobile_num = $api_row['mobile_number'];
}
}
$raffle_number = ''; $raffle_number = '';
$hub = ''; $hub = '';
$battery_name = $row['model_name'] . ' / ' . $row['size_name']; $battery_name = $row['model_name'] . ' / ' . $row['size_name'];
@ -2790,6 +2811,7 @@ class ReportController extends Controller
'first_name' => $row['first_name'], 'first_name' => $row['first_name'],
'last_name' => $row['last_name'], 'last_name' => $row['last_name'],
'contact_number' => $row['contact_num'], 'contact_number' => $row['contact_num'],
'mobile_number' => $mobile_num,
'address' => $row['address'], 'address' => $row['address'],
'email' => $row['email'], 'email' => $row['email'],
'action' => $row['action'], 'action' => $row['action'],