Merge branch '584-modify-warranty-details-report' into 'master-fix'

Resolve "Modify Warranty Details Report"

See merge request jankstudio/resq!699
This commit is contained in:
Kendrick Chan 2021-06-15 03:06:00 +00:00
commit 9c370802c7

View file

@ -692,24 +692,71 @@ class ReportController extends Controller
// csv output
$csv_handle = fopen('php://output', 'w+');
fputcsv($csv_handle, [
'Customer ID',
'Customer First Name',
'Customer Last Name',
'Customer Is Confirmed?',
'Customer Classification',
'Customer Has Mobile App?',
'Customer Title',
'Customer Is Active?',
'Customer Mobile Phone',
'Customer Landline Phone',
'Customer Office Phone',
'Customer Fax Phone',
'Customer Email Address',
'Customer Notes',
'Customer Has Third Party Privacy Policy?',
'Customer Has Promo Privacy Policy?',
'Customer Is CSAT',
'Customer Mobile App Privacy Policy ID',
'Customer Third Party Policy ID',
'Customer Promo Privacy ID',
'Customer DPA Consent',
'Customer Date Created',
'Customer SMS Research Flag',
'Customer Email Research Flag',
'Customer Create Source',
'Vehicle ID',
'Vehicle Manufacturer ID',
'Vehicle Make',
'Vehicle Model Year From',
'Vehicle Model Year To',
'Vehicle Mobile App Flag',
'Warranty ID',
'Serial',
'Battery Model',
'Battery Size',
'Warranty Battery Model ID',
'Warranty Battery Size ID',
'Warranty Serial',
'Warranty Class',
'Plate Number',
'Status',
'Date Created',
'Date Purchased',
'Expiry Date',
'Date Claimed',
'SAP Battery ID',
'Claim ID',
'Last Name',
'First Name',
'Mobile Number',
'Privacy Policy Number',
'Activated?',
'Warranty Plate Number',
'Warranty Status',
'Warranty Date Created',
'Warranty Date Purchased',
'Warranty Expiry Date',
'Warranty Date Claimed',
'Warranty SAP Battery ID',
'Warranty Claim ID',
'Warranty First Name',
'Warranty Last Name',
'Warranty Mobile Number',
'Warranty Is Activated?',
'Warranty Privacy Policy Number',
'Warranty Email Address',
'Warranty Vehicle ID',
'Warranty Customer ID',
'Warranty File Invoice',
'Warranty File Card',
'Warranty Vehicle Model Year',
'Warranty Odometer',
'Warranty Dealer Name',
'Warranty Dealer Address',
'Warranty Contact Number',
'Warranty Customer Address',
'Warranty Customer Date Purchase',
'Warranty Is Validated?',
'Warranty Province ID',
'Warranty Municipality ID',
'Warranty Create Source',
]);
foreach ($data as $row)
@ -1429,12 +1476,27 @@ class ReportController extends Controller
$results = [];
$conn = $em->getConnection();
$sql = 'SELECT w.id, w.serial, w.warranty_class, w.plate_number,
w.status, w.date_create, w.date_purchase, w.date_expire,
$sql = 'SELECT w.id AS w_id, w.serial, w.warranty_class, w.plate_number,
w.status, w.date_create as w_date_create, w.date_purchase, w.date_expire,
w.date_claim, w.sap_bty_id, w.claim_id, w.first_name,
w.last_name, w.mobile_number, w.flag_activated,
w.warranty_privacy_policy, w.bty_model_id, w.bty_size_id
FROM warranty w';
w.warranty_privacy_policy, w.bty_model_id, w.bty_size_id,
w.email as w_email, w.vehicle_id, w.customer_id, w.file_invoice,
w.file_warr_card, w.v_model_year, w.odometer, w.dealer_name,
w.dealer_address, w.contact_num, w.cust_address,
w.date_purchase_cust, w.flag_validated, w.province_id,
w.municipality_id, w.create_source AS w_create_source, c.id AS c_id,
c.first_name AS c_fname, c.last_name AS c_lname, c.flag_confirmed,
c.customer_classification, c.flag_mobile_app, c.title, c.flag_active,
c.phone_mobile, c.phone_landline, c.phone_office, c.phone_fax,
c.email AS c_email, c.customer_notes, c.priv_third_party, c.priv_promo,
c.flag_csat, c.policy_mobile_app_id, c.policy_third_party_id,
c.policy_promo_id, c.flag_dpa_consent, c.date_create AS c_date_create,
c.flag_research_sms, c.flag_research_email, c.create_source AS c_create_source,
v.id AS v_id, v.manufacturer_id, v.make, v.model_year_from,
v.model_year_to, v.flag_mobile
FROM warranty w JOIN customer c ON w.customer_id = c.id
JOIN vehicle v ON w.vehicle_id = v.id';
$stmt = $conn->prepare($sql);
$stmt->execute();
@ -1461,24 +1523,71 @@ class ReportController extends Controller
}
$results[] = [
'id' => $row['id'],
'serial' => $row['serial'],
'battery_model' => $bmodel_name,
'battery_size' => $bsize_name,
'warranty_class' => $row['warranty_class'],
'plate_number' => $row['plate_number'],
'status' => $row['status'],
'date_create' => $row['date_create'],
'date_purchase' => $row['date_purchase'],
'date_expire' => $row['date_expire'],
'date_claim' => $row['date_claim'],
'sap_bty_id' => $row['sap_bty_id'],
'claim_id' => $row['claim_id'],
'last_name' => $row['last_name'],
'first_name' => $row['first_name'],
'mobile_number' => $row['mobile_number'],
'privacy_policy' => $row['warranty_privacy_policy'],
'flag_activated' => (boolean) $row['flag_activated'],
'cust_id' => $row['c_id'],
'cust_first_name' => $row['c_fname'],
'cust_last_name' => $row['c_lname'],
'cust_flag_confirm' => $row['flag_confirmed'],
'cust_classification' => $row['customer_classification'],
'cust_flag_mobile_app' => $row['flag_mobile_app'],
'cust_title' => $row['title'],
'cust_flag_active' => $row['flag_active'],
'cust_phone_mobile' => $row['phone_mobile'],
'cust_phone_landline' => $row['phone_landline'],
'cust_phone_office' => $row['phone_office'],
'cust_phone_fax' => $row['phone_fax'],
'cust_email' => $row['c_email'],
'cust_notes' => $row['customer_notes'],
'cust_priv_third_party' => $row['priv_third_party'],
'cust_priv_promo' => $row['priv_promo'],
'cust_flag_csat' => $row['flag_csat'],
'cust_policy_mobile_app_id' => $row['policy_mobile_app_id'],
'cust_policy_third_party_id' => $row['policy_third_party_id'],
'cust_policy_promo_id' => $row['policy_promo_id'],
'cust_flag_dpa_consent' => $row['flag_dpa_consent'],
'cust_date_create' => $row['c_date_create'],
'cust_flag_research_sms' => $row['flag_research_sms'],
'cust_flag_research_email' => $row['flag_research_email'],
'cust_create_source' => $row['c_create_source'],
'v_id' => $row['v_id'],
'v_manufacturer_id' => $row['manufacturer_id'],
'v_make' => $row['make'],
'v_model_year_from' => $row['model_year_from'],
'v_model_year_to' => $row['model_year_to'],
'v.flag_mobile' => $row['flag_mobile'],
'warr_id' => $row['w_id'],
'warr_battery_model' => $bmodel_name,
'warr_battery_size' => $bsize_name,
'warr_serial' => $row['serial'],
'warr_class' => $row['warranty_class'],
'warr_plate_number' => $row['plate_number'],
'warr_status' => $row['status'],
'warr_date_create' => $row['w_date_create'],
'warr_date_purchase' => $row['date_purchase'],
'warr_date_expire' => $row['date_expire'],
'warr_date_claim' => $row['date_claim'],
'warr_sap_bty_id' => $row['sap_bty_id'],
'warr_claim_id' => $row['claim_id'],
'warr_first_name' => $row['first_name'],
'warr_last_name' => $row['last_name'],
'warr_mobile_number' => $row['mobile_number'],
'warr_flag_activated' => (boolean) $row['flag_activated'],
'warr_privacy_policy' => $row['warranty_privacy_policy'],
'warr_email' => $row['w_email'],
'warr_vehicle_id' =>$row['vehicle_id'],
'warr_customer_id' => $row['customer_id'],
'warr_file_invoice' => $row['file_invoice'],
'warr_file_warr_card' => $row['file_warr_card'],
'warr_v_model_year' => $row['v_model_year'],
'warr_odometer' => $row['odometer'],
'warr_dealer_name' => $row['dealer_name'],
'warr_dealer_address' => $row['dealer_address'],
'warr_contact_number' => $row['contact_num'],
'warr_customer_address' => $row['cust_address'],
'warr_customer_date_purchase' => $row['date_purchase_cust'],
'warr_flag_validated' => $row['flag_validated'],
'warr_province_id' => $row['province_id'],
'warr_municipality_id' => $row['municipality_id'],
'warr_create_source' => $row['w_create_source'],
];
}