How to generate report based on php session user login

This public forum is for user-to-user discussions of PHP Report Maker. Note that this is not support forum.

How to generate report based on php session user login

Postby cijo » Mon Sep 25, 2017 3:49 pm

i created a view in MySQL and generated a report with PHP Report Maker trail. this report generating based on the job location rights and session login user id.

how to integrate or change the code.

CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`localhost`
SQL SECURITY DEFINER
VIEW `view_progress` AS
SELECT
`tbl_project_sub_progress`.`prog_sub_id` AS `prog_sub_id`,
`tbl_project_sub_progress`.`project_erp_id` AS `project_erp_id`,
`tbl_project_sub_progress`.`cwr_no` AS `cwr_no`,
`tbl_project_sub_progress`.`updatedon` AS `updatedon`,
`tbl_project_sub_progress`.`status` AS `status`,
`tbl_project_sub_progress`.`updatedby` AS `updatedby`,
`tbl_project_sub_progress`.`boq_client_parent_code` AS `boq_client_parent_code`,
`tbl_project_sub_progress`.`cli_parent_ite_code` AS `cli_parent_ite_code`,
`tbl_project_sub_progress`.`boq_s_id` AS `boq_s_id`,
`tbl_project_sub_progress`.`boq_parent_unit` AS `boq_parent_unit`,
`tbl_project_sub_progress`.`boq_parent_id` AS `boq_parent_id`,
`tbl_project_sub_progress`.`ite_qty` AS `ite_qty`,
`tbl_project_sub_progress`.`activity_id` AS `activity_id`,
`tbl_project_sub_progress`.`parent_act_id` AS `parent_act_id`,
`tbl_project_sub_progress`.`sub_act_id` AS `sub_act_id`,
`tbl_project_sub_progress`.`x_qty` AS `x_qty`,
`tbl_project_sub_progress`.`is_deleted` AS `is_deleted`,
`tbl_project_sub_progress`.`app_ind` AS `app_ind`,
`tbl_project_sub_progress`.`x_supervisor` AS `x_supervisor`,
`tbl_project_sub_progress`.`x_date` AS `x_date`,
`tbl_project_sub_progress`.`trc_code` AS `trc_code`,
`tp`.`status` AS `projectstatus`,
`tbl_activity`.`acvt_name` AS `acvt_name`,
LEFT(`tbl_project_boq`.`boq_line_item`,
40) AS `line_item`,
`tbl_project_sub`.`is_deleted` AS `is_sub_job_del`,
`tbl_project_sub`.`client_cwr_no` AS `client_cwr_no`,
`tbl_project_sub`.`source_ss` AS `source_ss`,
`tbl_project_sub`.`destination_ss` AS `destination_ss`,
`ta1`.`ss_name` AS `s_sub_name`,
`ta2`.`ss_name` AS `d_sub_name`
FROM
((((((`tbl_project_sub_progress`
LEFT JOIN `tbl_project` `tp` ON ((`tbl_project_sub_progress`.`project_erp_id` = `tp`.`project_erp_id`)))
LEFT JOIN `tbl_project_sub` ON ((`tbl_project_sub_progress`.`cwr_no` = `tbl_project_sub`.`cwr_no`)))
LEFT JOIN `tbl_project_boq` ON ((`tbl_project_sub_progress`.`boq_parent_id` = `tbl_project_boq`.`boq_id`)))
LEFT JOIN `tbl_activity` ON ((`tbl_project_sub_progress`.`activity_id` = `tbl_activity`.`acvt_id`)))
LEFT JOIN `tbl_ss` `ta1` ON ((`tbl_project_sub`.`source_ss` = `ta1`.`ss_id`)))
LEFT JOIN `tbl_ss` `ta2` ON ((`tbl_project_sub`.`destination_ss` = `ta2`.`ss_id`)))
WHERE
((`tbl_project_sub_progress`.`project_erp_id` , '" . $_SESSION["login_user_no"] . "') IN (SELECT
`tbl_role_job`.`project_erp_id`,
`tbl_role_job`.`employee_no`
FROM
`tbl_role_job`)
AND (`tp`.`status` = 'active')
AND (`tbl_project_sub`.`is_deleted` = 0)
AND (`tbl_project_sub_progress`.`is_deleted` = 0))
cijo
 
Posts: 4
Joined: Wed Sep 20, 2017 6:27 pm

Re: How to generate report based on php session user login

Postby Webmaster » Tue Sep 26, 2017 9:49 am

In general, to filter a report based on a run time variable:
- create the report without the filter first
- add the run time filter in Table -> Filter, OR the Page_Selecting server event
Webmaster
 
Posts: 10731
Joined: Fri Aug 06, 2004 5:59 pm


Return to General Discussion (PHP Report Maker)