function summary_doc_list() { $query = " DROP TABLE if EXISTS tmp_doc_writs "; PdoDataAccess::runquery($query); $query = " CREATE TABLE tmp_doc_writs\r\n (\r\n auto_id int(11) NOT NULL auto_increment,\r\n writ_id int(11) default NULL,\r\n writ_ver smallint(6) default NULL,\r\n staff_id int(11) default NULL,\r\n annual_effect smallint(1) default NULL,\r\n show_in_summary_doc smallint(1) default NULL,\r\n execute_date datetime NULL ,\r\n PRIMARY KEY (auto_id)\r\n )type=MYISAM AS\r\n SELECT\r\n w.writ_id ,\r\n w.writ_ver ,\r\n w.staff_id ,\r\n w.annual_effect ,\r\n wst.show_in_summary_doc ,\r\n w.execute_date\r\n FROM writs w\r\n INNER JOIN writ_subtypes wst\r\n ON w.writ_type_id = wst.writ_type_id AND\r\n w.writ_subtype_id = wst.writ_subtype_id AND\r\n w.person_type = wst.person_type\r\n WHERE\r\n (w.history_only=0 OR w.history_only IS NULL) AND\r\n w.person_type in(" . manage_access::getValidPersonTypes() . ")\r\n ORDER BY staff_id , execute_date , writ_id , writ_ver' "; PdoDataAccess::runquery($query); $query = "ALTER TABLE tmp_doc_writs ADD INDEX(writ_id,writ_ver)"; PdoDataAccess::runquery($query); $query = "ALTER TABLE tmp_doc_writs ADD INDEX(staff_id,execute_date,writ_id,writ_ver)"; PdoDataAccess::runquery($query); $query = " DELETE tmp_doc_writs sw1\r\n FROM tmp_doc_writs sw1\r\n INNER JOIN tmp_doc_writs sw2\r\n ON sw1.staff_id = sw2.staff_id AND\r\n sw1.execute_date = sw2.execute_date\r\n WHERE (sw1.writ_id > sw2.writ_id OR (sw1.writ_id = sw2.writ_id AND sw1.writ_ver > sw2.writ_ver))"; PdoDataAccess::runquery($query); $query = "DROP TABLE if EXISTS tmp_sum_doc_writs"; PdoDataAccess::runquery($query); $query = " CREATE TABLE tmp_sum_doc_writs\r\n (\r\n auto_id int(11) NOT NULL auto_increment,\r\n writ_id int(11) default NULL,\r\n writ_ver smallint(6) default NULL,\r\n staff_id int null,\r\n execute_date datetime null ,\r\n annual_effect smallint null ,\r\n show_in_summary_doc smallint null ,\r\n PRIMARY KEY (auto_id)\r\n )type=MYISAM AS\r\n SELECT w1.writ_id , w1.writ_ver , w1.staff_id , w1.execute_date execute_date , w1.annual_effect , w1.show_in_summary_doc\r\n FROM tmp_doc_writs w1\r\n LEFT OUTER JOIN tmp_doc_writs w0\r\n ON w1.auto_id - 1 = w0.auto_id AND w1.staff_id = w0.staff_id\r\n LEFT OUTER JOIN tmp_doc_writs w2\r\n ON w1.auto_id + 1 = w2.auto_id AND w1.staff_id = w2.staff_id\r\n WHERE ((w1.annual_effect <> w0.annual_effect OR w0.writ_id is null)OR(w1.show_in_summary_doc=1))\r\n ORDER by w1.staff_id "; PdoDataAccess::runquery($query); $query = "DROP TABLE IF EXISTS temp_writs"; PdoDataAccess::runquery($query); $query = " CREATE TABLE temp_writs TYPE=MyIsam AS\r\n SELECT wa.writ_type_id ,\r\n wa.writ_subtype_id ,\r\n wa.staff_id,\r\n wa.emp_mode,\r\n wa.annual_effect,\r\n wa.science_level,\r\n wa.execute_date,\r\n dw2.execute_date end_date ,\r\n wa.writ_id,\r\n wa.writ_ver\r\n FROM staff s\r\n INNER JOIN writs w\r\n ON w.writ_id = s.last_writ_id AND w.writ_ver = s.last_writ_ver AND w.staff_id = s.staff_id \r\n INNER JOIN writs wa\r\n ON wa.staff_id = s.staff_id\r\n INNER JOIN tmp_sum_doc_writs dw\r\n ON(dw.writ_id = wa.writ_id AND dw.writ_ver = wa.writ_ver)\r\n LEFT OUTER JOIN tmp_sum_doc_writs dw2\r\n ON(dw2.auto_id -1 = dw.auto_id and dw2.staff_id = dw.staff_id)\r\n WHERE (wa.history_only = 0 OR wa.history_only IS NULL) AND\r\n s.person_type in(" . manage_access::getValidPersonTypes() . ") AND\r\n (dw.annual_effect <> " . ANNUAL_NOT_CALC . " OR dw.show_in_summary_doc=1 OR dw2.auto_id IS NOT NULL) AND\r\n '.sisSession('__sisReportWhereClause') "; PdoDataAccess::runquery($query); $query = " ALTER TABLE temp_writs ADD INDEX(writ_id,writ_ver) "; PdoDataAccess::runquery($query); $query = " ALTER TABLE temp_writs ADD INDEX(staff_id,execute_date,writ_id,writ_ver) "; PdoDataAccess::runquery($query); $query = " DELETE temp_writs tw1\r\n FROM temp_writs tw1\r\n INNER JOIN temp_writs tw2\r\n ON tw1.staff_id = tw2.staff_id AND\r\n tw1.execute_date = tw2.execute_date\r\n WHERE (tw1.writ_id > tw2.writ_id OR (tw1.writ_id = tw2.writ_id AND tw1.writ_ver > tw2.writ_ver)) "; PdoDataAccess::runquery($query); $query = "DROP TABLE IF EXISTS temp_person_doc"; PdoDataAccess::runquery($query); $query = "CREATE TABLE temp_person_doc TYPE=MyIsam AS\r\n SELECT w.staff_id,\r\n w.science_level,\r\n w.execute_date first_date,\r\n CASE\r\n WHEN w.end_date IS NULL THEN NOW()\r\n ELSE w.end_date\r\n END last_date,\r\n CASE w.annual_effect\r\n WHEN " . ANNUAL_NOT_CALC . " THEN 1\r\n ELSE 2\r\n END accept_id,\r\n writ_id twrit_id ,\r\n writ_ver twrit_ver\r\n FROM temp_writs w "; PdoDataAccess::runquery($query); $query = "ALTER TABLE temp_person_doc ADD INDEX(twrit_id)"; PdoDataAccess::runquery($query); $query = "DROP TABLE IF EXISTS temp_history"; PdoDataAccess::runquery($query); $query = " CREATE TABLE temp_history TYPE=MyIsam AS\r\n (SELECT 1 AS rowno,\r\n p.PersonID,\r\n NULL AS post_title,\r\n p.military_from_date AS from_date,\r\n p.military_to_date AS to_date,\r\n (p.military_duration DIV 12) AS d_year,\r\n (p.military_duration - ((p.military_duration DIV 12) * 12)) AS d_month,\r\n 0 AS d_day,\r\n \\'قابل قبول\\' AS accept_type,\r\n \\'سربازي\\' AS org_title,\r\n \\'سربازي\\' AS emp_state_title,\r\n NULL AS writ_id,\r\n NULL AS writ_date\r\n FROM persons p\r\n WHERE p.military_duration IS NOT NULL AND\r\n p.military_from_date IS NOT NULL AND\r\n p.military_to_date IS NOT NULL)\r\n\t\t\t\tUNION\r\n (SELECT 2 AS rowno,\r\n pe.PersonID,\r\n pe.title AS post_title,\r\n pe.from_date,\r\n pe.to_date,\r\n retired_duration_year AS d_year,\r\n retired_duration_month AS d_month,\r\n retired_duration_day AS d_day,\r\n \\'قابل قبول\\' AS accept_type,\r\n pe.organization AS org_title,\r\n emps.Title emp_state_title,\r\n NULL AS writ_id,\r\n NULL AS writ_date\r\n FROM person_employments pe " . QueryHelper::makeBasicInfoJoin(BINFTYPE_emp_state, "emps", "pe.emp_state") . " )\r\n\t\t\t\tUNION\r\n (SELECT 3 AS rowno,\r\n pe.PersonID,\r\n pe.title AS post_title,\r\n pe.from_date,\r\n pe.to_date,\r\n FLOOR(((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) / 365.25) AS d_year,\r\n FLOOR((((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) -FLOOR(((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) / 365.25)*365.25) / 30.4375) AS d_month ,\r\n (((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day))-\r\n FLOOR(((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) / 365.25) *365.25\r\n -ROUND(FLOOR((((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) -FLOOR(((duration_year - retired_duration_year)*365.25 + (duration_month - retired_duration_month)*30.4375 + (duration_day - retired_duration_day)) / 365.25)*365.25) / 30.4375)*30.4375)) AS d_day,\r\n \\'غير قابل قبول\\' AS accept_type,\r\n pe.organization AS org_title,\r\n emps.Title emp_state_title , \r\n NULL AS writ_id,\r\n NULL AS writ_date\r\n FROM person_employments pe " . QueryHelper::makeBasicInfoJoin(BINFTYPE_emp_state, "emps", "pe.emp_state") . " )\r\n\t\t\t\tUNION\r\n (SELECT\r\n 4 AS rowno,\r\n s.PersonID,\r\n CASE\r\n WHEN w.person_type =" . HR_PROFESSOR . " THEN slvl.Title\r\n WHEN w.person_type =" . HR_WORKER . " THEN j.title\r\n ELSE p.title\r\n END post_title ,\r\n pd.first_date AS from_date,\r\n pd.last_date AS to_date,\r\n FLOOR(DATEDIFF(pd.last_date,pd.first_date) / 365.25) AS d_year,\r\n FLOOR( ( DATEDIFF(pd.last_date,pd.first_date) - FLOOR(DATEDIFF(pd.last_date,pd.first_date) / 365.25)*365.25 ) / 30.4375 ) AS d_month,\r\n DATEDIFF(pd.last_date,pd.first_date) - FLOOR(DATEDIFF(pd.last_date,pd.first_date) / 365.25)*365.25 - FLOOR( ( DATEDIFF(pd.last_date,pd.first_date) - FLOOR(DATEDIFF(pd.last_date,pd.first_date) / 365.25)*365.25 ) / 30.4375 )*30.4375 AS d_day,\r\n CASE pd.accept_id\r\n WHEN 1 THEN \\'غير قابل قبول\\'\r\n ELSE \\'قابل قبول\\'\r\n END AS accept_type,\r\n CASE pd.accept_id\r\n WHEN 1 THEN empd.Title\r\n ELSE o.ptitle\r\n END AS org_title,\r\n emps.Title emp_state_title,\r\n w.send_letter_no AS writ_id,\r\n w.execute_date AS writ_date\r\n FROM temp_person_doc pd\r\n INNER JOIN writs w\r\n ON(w.writ_id = pd.twrit_id and w.writ_ver=pd.twrit_ver)\r\n INNER JOIN staff s\r\n ON(w.staff_id = s.staff_id)\r\n LEFT OUTER JOIN org_new_units o\r\n ON(w.ouid = o.ouid)\r\n LEFT OUTER JOIN position p\r\n ON p.post_id = w.post_id\r\n LEFT OUTER JOIN jobs j\r\n ON w.job_id = j.job_id " . QueryHelper::makeBasicInfoJoin(BINFTYPE_science_level, "slvl", "w.science_level") . QueryHelper::makeBasicInfoJoin(BINFTYPE_emp_mode, "empd", "w.emp_mode") . QueryHelper::makeBasicInfoJoin(BINFTYPE_emp_state, "emps", "w.emp_state") . " WHERE w.history_only = 0) "; //.............................................................................. $query = " DROP TABLE IF EXISTS temp_exe_post "; PdoDataAccess::runquery($query); $query = " CREATE TABLE temp_exe_post Type=MyIsam AS\r\n SELECT staff_id,SUBSTRING(MAX(CONCAT(from_date , row_no)),11) max_row\r\n FROM professor_exe_posts\r\n GROUP BY staff_id"; PdoDataAccess::runquery($query); $query = " ALTER TABLE temp_exe_post ADD INDEX(staff_id,max_row) "; PdoDataAccess::runquery($query); $query = "DROP TABLE IF EXISTS temp_devotion "; PdoDataAccess::runquery($query); $query = " CREATE TABLE temp_devotion Type=MyIsam AS\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t PersonID,\r\n\t\t\t\t\t SUM(CASE devotion_type\r\n\t\t\t\t\t WHEN " . FIGHTING_DEVOTION . " THEN amount\r\n\t\t\t\t\t ELSE 0\r\n\t\t\t\t\t END) razm,\r\n\t\t\t\t\t MAX(CASE devotion_type\r\n\t\t\t\t\t WHEN " . SACRIFICE_DEVOTION . " THEN amount\r\n\t\t\t\t\t ELSE 0\r\n\t\t\t\t\t END) janbaz\r\n\t\t\t\t\tFROM person_devotions\r\n\t\t\t\t\tWHERE devotion_type IN(" . FIGHTING_DEVOTION . "," . SACRIFICE_DEVOTION . ")\r\n\t\t\t\t\tGROUP BY PersonID "; PdoDataAccess::runquery($query); $query = "ALTER TABLE temp_devotion ADD INDEX(PersonID)"; PdoDataAccess::runquery($query); $query = " SELECT s.staff_id,\r\n p.plname,\r\n p.pfname,\r\n p.father_name ,\r\n p.birth_date ,\r\n idcard_no ,\r\n national_code ,\r\n concat(st.ptitle ,'-',ct.ptitle ) birth_place ,\r\n w.base ,\r\n sf.ptitle AS field_title,\r\n sb.ptitle AS branch_title,\r\n pe.doc_date,\r\n c.ptitle AS country_title,\r\n u.ptitle AS university_title,\r\n td.razm ,\r\n td.janbaz,\r\n o.ptitle AS unit_title,\r\n o.ouid ,\r\n po.post_no,\r\n po.title AS last_post_title,\r\n po2.title AS exe_post_title,\r\n pep.from_date AS exe_post_from,\r\n slvl.Title science_level_title ,\r\n wtt.Title worktime_type_title ,\r\n mlt.Title military_type_title ,\r\n edl.Title education_level_title ,\r\n emps.Title emp_state_title \r\n\r\n FROM staff s \r\n\t\t\t\t\t INNER JOIN persons p\r\n\t\t\t\t\t ON(s.PersonID = p.PersonID)\r\n\t\t\t\t\t LEFT OUTER JOIN states st\r\n\t\t\t\t\t \t\tON (st.state_id = p.birth_state_id)\r\n\t\t\t\t\t LEFT OUTER JOIN cities ct\r\n\t\t\t\t\t \t\tON (ct.city_id = p.birth_city_id)\r\n\t\t\t\t\t LEFT OUTER JOIN writs w\r\n\t\t\t\t\t ON(s.last_writ_ver = w.writ_ver AND s.last_writ_id = w.writ_id)\r\n\t\t\t\t\t LEFT OUTER JOIN person_educations pe\r\n\t\t\t\t\t ON(s.PersonID = pe.PersonID AND w.education_level = pe.education_level AND w.sfid = pe.sfid AND (w.sbid = pe.sbid OR w.sbid IS NULL))\r\n\t\t\t\t\t LEFT OUTER JOIN study_fields sf\r\n\t\t\t\t\t ON(w.sfid = sf.sfid)\r\n\t\t\t\t\t LEFT OUTER JOIN study_branchs sb\r\n\t\t\t\t\t ON(w.sfid = sb.sfid AND w.sbid = sb.sbid)\r\n\t\t\t\t\t LEFT OUTER JOIN countries c\r\n\t\t\t\t\t ON(pe.country_id = c.country_id)\r\n\t\t\t\t\t LEFT OUTER JOIN universities u\r\n\t\t\t\t\t ON(pe.country_id = u.country_id AND pe.university_id = u.university_id)\r\n\t\t\t\t\t LEFT OUTER JOIN org_new_units o\r\n\t\t\t\t\t ON(w.ouid = o.ouid)\r\n\t\t\t\t\t LEFT OUTER JOIN position po\r\n\t\t\t\t\t ON(w.post_id = po.post_id)\r\n\t\t\t\t\t LEFT OUTER JOIN temp_exe_post tep\r\n\t\t\t\t\t ON(s.staff_id = tep.staff_id)\r\n\t\t\t\t\t LEFT OUTER JOIN professor_exe_posts pep\r\n\t\t\t\t\t ON(tep.staff_id = pep.staff_id AND tep.max_row = pep.row_no AND (pep.to_date IS NULL OR pep.to_date>=CURDATE()))\r\n\t\t\t\t\t LEFT OUTER JOIN position po2\r\n\t\t\t\t\t ON(pep.post_id = po2.post_id)\r\n\t\t\t\t\t LEFT OUTER JOIN temp_devotion td\r\n\t\t\t\t\t ON(s.PersonID = td.PersonID) " . QueryHelper::makeBasicInfoJoin(BINFTYPE_science_level, "slvl", "w.science_level") . QueryHelper::makeBasicInfoJoin(BINFTYPE_worktime_type, "wtt", "w.worktime_type") . QueryHelper::makeBasicInfoJoin(BINFTYPE_military_type, "mlt", "w.military_type") . QueryHelper::makeBasicInfoJoin(BINFTYPE_education_level, "edl", "w.education_level") . QueryHelper::makeBasicInfoJoin(BINFTYPE_emp_state, "emps", "w.emp_state") . " WHERE ((th.d_year<>0 OR th.d_month<>0 OR th.d_day<>0)OR(w.emp_mode IN(11,12,13,14) AND\r\n th.writ_date = w.execute_date)) AND\r\n s.person_type in(" . manage_access::getValidPersonTypes() . ") AND\r\n s.last_cost_center_id in(" . manage_access::getValidCostCenters() . ") "; $dt = PdoDataAccess::runquery($query, $whereParam); return $dt; }
function selectArrearTransferWrits() { MakeAdvanceSearchWhere($where, $whereParam); $state; $state = isset($_REQUEST["return"]) ? "1" : "0"; $stateWhere = ""; $stateWhere = " w.arrear = " . $state . " AND "; $curYear = DateModules::GetYear(DateModules::miladi_to_shamsi(DateModules::Now())); $query = "select w.writ_id,\n w.writ_ver,\n w.staff_id,\n w.ouid,\n w.issue_date,\n w.history_only,\n w.corrective,\n w.execute_date,\n concat(wt.title,' - ', wst.title) as wt_title,\n bi_emp_state.title as emp_state_title,\n w.ref_letter_no,\n w.ref_letter_date,\n w.person_type,\n concat(p.pfname, ' ', p.plname) fullname,\n w.corrective_writ_id,\n w.correct_completed,\n\t\t\t\t\t w.view_flag\n\t\t\t\t\n\t\t\t\tfrom staff s\n \n \t\t LEFT OUTER JOIN writs w ON (w.staff_id = s.staff_id)\n LEFT OUTER JOIN writ_types wt ON ((w.writ_type_id = wt.writ_type_id) AND (w.person_type = wt.person_type))\n LEFT OUTER JOIN writ_subtypes wst ON (w.writ_subtype_id = wst.writ_subtype_id AND w.writ_type_id = wst.writ_type_id \n \t\t\t\t\t\t\t\t\t\t\tAND w.person_type = wst.person_type)\n LEFT OUTER JOIN persons p ON (s.PersonID = p.PersonID)\n LEFT OUTER JOIN org_new_units o ON (w.ouid = o.ouid)\n LEFT JOIN Basic_Info bi_emp_state on(bi_emp_state.TypeID=3 and w.emp_state=bi_emp_state.InfoID)\n LEFT JOIN payment_writs pw ON pw.writ_id = w.writ_id and pw.writ_ver = w.writ_ver and pw.staff_id = w.staff_id \n\t\t\t\t \n\t\t\twhere w.execute_date >= '" . TRANSFER_WRIT_EXE_DATE . "' AND w.state = 3 AND \n\t\t\t\t w.execute_date < '" . str_replace("/", "-", DateModules::shamsi_to_miladi($curYear . "/01/01")) . "' AND\t\t\t\t \n\t\t\t\t substr(g2j(w.execute_date),1,4) < substr(g2j(writ_recieve_date),1,4) AND \n\t\t\t\t {$stateWhere}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n s.person_type in (" . manage_access::getValidPersonTypes() . ") AND w.cost_center_id in (" . manage_access::getValidCostCenters() . ") AND\n\t\t\t\tw.emp_state <> 0 AND\n\t\t\t\t(w.history_only=0 OR w.history_only IS NULL) AND \n\t\t\t\t(w.dont_transfer = 0 OR w.dont_transfer IS NULL) AND\n ( pw.writ_id is null ) AND\n\t\t\t\t(w.correct_completed!=" . WRIT_CORRECTING . ") AND " . $where . "\n\t\t\t\n\t\t\torder by p.plname,p.pfname,s.staff_id,w.execute_date,w.writ_id,w.writ_ver"; $temp = PdoDataAccess::runquery($query, $whereParam); /*if($_SESSION['UserID'] == 'jafarkhani') { echo PdoDataAccess::GetLatestQueryString(); die(); }*/ for ($i = 0; $i < count($temp); $i++) { $temp[$i]['full_unit_title'] = manage_units::get_full_title($temp[$i]['ouid']); } echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]); die; }
private function exe_limit_staff() { //parent::runquery('DROP TABLE IF EXISTS limit_staff'); parent::runquery('TRUNCATE Arrear_limit_staff'); parent::runquery('/*CREATE TABLE limit_staff AS*/ insert into Arrear_limit_staff SELECT s.staff_id , s.personID , s.person_type FROM persons p INNER JOIN staff s ON(s.personID=p.PersonID AND s.person_type=p.person_type) INNER JOIN writs w ON(s.last_writ_id = w.writ_id AND s.last_writ_ver = w.writ_ver AND w.staff_id=s.staff_id AND w.person_type=s.person_type) INNER JOIN org_new_units o ON(w.ouid = o.ouid) WHERE p.person_type NOT IN(' . HR_RETIRED . ') AND s.staff_id in ( select staff_id from writs where execute_date <= "' . $this->last_month_end . '" and execute_date >= "' . $this->first_month_start . '" and arrear = 1 ) AND s.last_cost_center_id in(' . manage_access::getValidCostCenters() . ') AND ' . $this->__WHERE, $this->__WHEREPARAM); //parent::runquery('ALTER TABLE limit_staff ADD INDEX (staff_id)'); }
case "formula": $keys[$columns[$i]["row_id"]] = $columns[$i]["col_name"]; $columns[$i]["parent_path"] = str_replace("[", "[" . $columns[$i]["base_evaluate"] . ":", $columns[$i]["parent_path"]); $QUERY_SELECT .= stripcslashes($columns[$i]["parent_path"]) . " as '" . $columns[$i]["row_id"] . "',"; $header[] = $columns[$i]["col_name"]; $columnCount++; break; case "formula_column": $formula_columns[] = array($columns[$i]["parent_path"], $field, $base_field); break; case "condition": $QUERY_WHERE = str_replace("[" . $columns[$i]["parent_path"] . "]", $base_field, $QUERY_WHERE); break; } //-------------------------------------------------------------------------- $QUERY_WHERE = str_replace("CostFn", manage_access::getValidCostCenters(), $QUERY_WHERE); $QUERY_WHERE = str_replace("PersonFn", manage_access::getValidPersonTypes(), $QUERY_WHERE); //-------------------------------------------------------------------------- $column_id = $columns[$i]["column_id"]; $field_name = $field; //---------------------- make where of set params ------------------------------ if ($columns[$i]["used_type"] != "filter") { continue; } switch ($columns[$i]["search_mode"]) { case "INT": if (!empty($_POST["FINT:" . $column_id])) { $QUERY_WHERE .= " AND " . $field_name . ">= :f" . $column_id; $whereParam[":f" . $column_id] = $_POST["FINT:" . $column_id]; } if (!empty($_POST["TINT:" . $column_id])) {
static function GetAllWrits($where = "", $whereParam = array()) { /* $staff_group_join = ""; if(!empty($_REQUEST['staff_group_id'])) { $staff_group_join = " LEFT JOIN staff_group_members sgm ON sgm.staff_id = s.staff_id AND sgm.staff_group_id = ".$_REQUEST['staff_group_id']; } */ // PdoDataAccess::runquery("insert into temp_sum_item_writs select * from sum_items_writs i on duplicate key update sumValue=i.sumValue"); $whr = ""; /*if($_SESSION['UserID'] != 'jafarkhani' && $_SESSION['UserID'] != 'delkalaleh' && $_SESSION['UserID'] != 'nadaf' && $_SESSION['UserID'] != 'm-hakimi' && $_SESSION['UserID'] != 'shokri' ) { $whr = " AND w.execute_date < '2014-02-20' " ; } */ if (isset($_REQUEST['last_writ_view']) && (empty($_REQUEST['to_execute_date']) || $_REQUEST['to_execute_date'] == '0000-00-00')) { $query = " SELECT w.*,\n bi1.Title corrective_title ,\n\t\t bi2.Title history_only_title ,\n bi3.Title science_level_title ,\n p.pfname ,\n p.plname ,\n p.PersonID ,\n concat(p.pfname ,' ',p.plname) fullname ,\n wt.title MainWtitle,\n wst.title wst_title,\n wst.time_limited,\n concat(wt.title ,' ',wst.title) wt_title ,\n bi4.Title emp_state_title ,\n bi5.Title educTitle ,\n bi6.Title SPTitle ,\n bi7.Title AETitle ,\n o.ptitle o_ptitle,\n c.title c_title,\n c.cost_center_id ,\n sf.sfid,\n sf.ptitle sf_ptitle,\n sb.sbid,\n sb.ptitle sb_ptitle ,\n parentu.ouid ,\n parentu.ptitle parentTitle ,\n temp.sumValue\n\n\t\t FROM persons p\n JOIN staff s ON(p.personid = s.personid)\n " . $staff_group_join . "\n INNER JOIN writs w ON(s.staff_id = w.staff_id AND s.last_writ_id = w.writ_id AND s.last_writ_ver = w.writ_ver)\n LEFT JOIN sum_items_writs temp ON temp.writ_id = w.writ_id and\n temp.writ_ver = w.writ_ver and\n temp.staff_id = w.staff_id\n LEFT JOIN Basic_Info bi1 ON ( bi1.InfoID = w.corrective AND bi1.TypeID = 5)\n LEFT JOIN Basic_Info bi2 ON ( bi2.InfoID = w.history_only AND bi2.TypeID = 5)\n LEFT JOIN Basic_Info bi3 ON (bi3.InfoID = w.science_level AND bi3.TypeID = 8)\n LEFT JOIN Basic_Info bi4 ON (bi4.InfoID = w.emp_state AND bi4.TypeID = 3)\n LEFT JOIN Basic_Info bi5 ON (bi5.InfoID = w.education_level AND bi5.TypeID = 6 )\n LEFT JOIN Basic_Info bi6 ON (bi6.InfoID = w.salary_pay_proc AND bi6.TypeID = 12 )\n LEFT JOIN Basic_Info bi7 ON (bi7.InfoID = w.annual_effect AND bi7.TypeID = 13 )\n LEFT OUTER JOIN position po ON (w.post_id = po.post_id)\n LEFT OUTER JOIN writ_types wt ON (w.writ_type_id = wt.writ_type_id AND w.person_type = wt.person_type)\n LEFT OUTER JOIN writ_subtypes wst ON (w.writ_subtype_id = wst.writ_subtype_id AND\n w.writ_type_id = wst.writ_type_id AND w.person_type = wst.person_type)\n LEFT OUTER JOIN study_branchs sb ON ((w.sbid = sb.sbid) AND (w.sfid = sb.sfid))\n LEFT OUTER JOIN study_fields sf ON (w.sfid = sf.sfid)\n LEFT OUTER JOIN org_new_units o ON (o.ouid = w.ouid)\n LEFT OUTER JOIN org_new_units parentu ON (parentu.ouid = o.parent_ouid)\n LEFT OUTER JOIN cost_centers c ON (w.cost_center_id = c.cost_center_id)\n\n where (s.last_cost_center_id is null OR s.last_cost_center_id in(" . manage_access::getValidCostCenters() . "))\n\t\t\t\t\t\tAND s.person_type in(" . manage_access::getValidPersonTypes() . ") {$whr} "; } else { if (isset($_REQUEST['last_writ_view']) && (!empty($_REQUEST['to_execute_date']) && $_REQUEST['to_execute_date'] != '0000-00-00')) { $whereW = " AND w.execute_date >= '" . DateModules::shamsi_to_miladi($_REQUEST['from_execute_date']) . "'"; $whereW .= " AND w.execute_date <= '" . DateModules::shamsi_to_miladi($_REQUEST['to_execute_date']) . "'"; $query = " SELECT w.*,\n bi1.Title corrective_title ,\n\t\t bi2.Title history_only_title ,\n bi3.Title science_level_title ,\n p.pfname ,\n p.plname ,\n p.PersonID ,\n concat(p.pfname ,' ',p.plname) fullname ,\n wt.title MainWtitle,\n wst.title wst_title,\n wst.time_limited,\n concat(wt.title ,' ',wst.title) wt_title ,\n bi4.Title emp_state_title ,\n bi5.Title educTitle ,\n bi6.Title SPTitle ,\n bi7.Title AETitle ,\n o.ptitle o_ptitle,\n c.title c_title,\n c.cost_center_id ,\n sf.sfid,\n sf.ptitle sf_ptitle,\n sb.sbid,\n sb.ptitle sb_ptitle ,\n parentu.ouid ,\n parentu.ptitle parentTitle ,\n temp.sumValue\n\n\t\t FROM persons p\n JOIN staff s ON(p.personid = s.personid)\n " . $staff_group_join . "\n INNER JOIN (SELECT staff_id,\n SUBSTRING_INDEX(SUBSTRING(max_execute_date,11),'.',1) writ_id,\n SUBSTRING_INDEX(max_execute_date,'.',-1) writ_ver\n FROM (SELECT w.staff_id,\n max( CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver) ) max_execute_date\n FROM writs w\n INNER JOIN staff ls\n ON(w.staff_id = ls.staff_id)\n WHERE w.history_only = 0 " . $whereW . "\n GROUP BY w.staff_id)tbl2) tbl1\n on s.staff_id = tbl1.staff_id \n INNER JOIN writs w\n on tbl1.writ_id = w.writ_id and\n tbl1.writ_ver = w.writ_ver and\n tbl1.staff_id = w.staff_id \n LEFT JOIN sum_items_writs temp ON temp.writ_id = w.writ_id and\n temp.writ_ver = w.writ_ver and\n temp.staff_id = w.staff_id\n LEFT JOIN Basic_Info bi1 ON ( bi1.InfoID = w.corrective AND bi1.TypeID = 5)\n LEFT JOIN Basic_Info bi2 ON ( bi2.InfoID = w.history_only AND bi2.TypeID = 5)\n LEFT JOIN Basic_Info bi3 ON (bi3.InfoID = w.science_level AND bi3.TypeID = 8)\n LEFT JOIN Basic_Info bi4 ON (bi4.InfoID = w.emp_state AND bi4.TypeID = 3)\n LEFT JOIN Basic_Info bi5 ON (bi5.InfoID = w.education_level AND bi5.TypeID = 6 )\n LEFT JOIN Basic_Info bi6 ON (bi6.InfoID = w.salary_pay_proc AND bi6.TypeID = 12 )\n LEFT JOIN Basic_Info bi7 ON (bi7.InfoID = w.annual_effect AND bi7.TypeID = 13 )\n LEFT OUTER JOIN position po ON (w.post_id = po.post_id)\n LEFT OUTER JOIN writ_types wt ON (w.writ_type_id = wt.writ_type_id AND w.person_type = wt.person_type)\n LEFT OUTER JOIN writ_subtypes wst ON (w.writ_subtype_id = wst.writ_subtype_id AND\n w.writ_type_id = wst.writ_type_id AND w.person_type = wst.person_type)\n LEFT OUTER JOIN study_branchs sb ON ((w.sbid = sb.sbid) AND (w.sfid = sb.sfid))\n LEFT OUTER JOIN study_fields sf ON (w.sfid = sf.sfid)\n LEFT OUTER JOIN org_new_units o ON (o.ouid = w.ouid)\n LEFT OUTER JOIN org_new_units parentu ON (parentu.ouid = o.parent_ouid)\n LEFT OUTER JOIN cost_centers c ON (w.cost_center_id = c.cost_center_id)\n\n where (s.last_cost_center_id is null OR s.last_cost_center_id in(" . manage_access::getValidCostCenters() . "))\n\t\t\t\t\t\tAND s.person_type in(" . manage_access::getValidPersonTypes() . ") {$whr} "; } else { $query = " SELECT w.*, w.ouid sub_ouid ,\n\t bi1.InfoDesc corrective_title ,\n\t\t\t bi2.InfoDesc history_only_title ,\t \n\t p.pfname ,\n\t p.plname ,\n\t p.PersonID ,\n\t concat(p.pfname ,' ',p.plname) fullname ,\n\t wt.title MainWtitle,\n\t wst.title wst_title,\n\t wst.time_limited,\n\t concat(wt.title ,' ',wst.title) wt_title ,\n\t bi4.InfoDesc emp_state_title ,\n\t bi5.InfoDesc educTitle ,\n\t bi6.InfoDesc SPTitle ,\n\t bi7.InfoDesc AETitle ,\n\t bi8.InfoDesc ModeTitle ,\n\t o.ptitle o_ptitle,\t \n\t sf.sfid,\n\t sf.ptitle sf_ptitle,\n\t sb.sbid,\n\t sb.ptitle sb_ptitle ,\n\t parentu.ouid ,\n\t parentu.ptitle parentTitle ,\n\t po.title post_title ,\n\t po.post_no ,\n\t j.title job_title ,\n\t j.job_group ,\n\t \n\t\t\t\t\t\t\t (w.cur_group - jf.start_group) + 1 job_category \n\n\t\t\t FROM HRM_persons p\n\t JOIN HRM_staff s ON(p.personid = s.personid)\t \n\t INNER JOIN HRM_writs w ON (s.staff_id = w.staff_id )\n \n\t LEFT JOIN BaseInfo bi1 ON ( bi1.InfoID = w.corrective AND bi1.TypeID = 57)\n\t LEFT JOIN BaseInfo bi2 ON ( bi2.InfoID = w.history_only AND bi2.TypeID = 57)\t \n\t LEFT JOIN BaseInfo bi4 ON (bi4.InfoID = w.emp_state AND bi4.TypeID = 58)\n\t LEFT JOIN BaseInfo bi5 ON (bi5.InfoID = w.education_level AND bi5.TypeID = 56 )\n\t LEFT JOIN BaseInfo bi6 ON (bi6.InfoID = w.salary_pay_proc AND bi6.TypeID = 59 )\n\t LEFT JOIN BaseInfo bi7 ON (bi7.InfoID = w.annual_effect AND bi7.TypeID = 60 )\n\t LEFT OUTER JOIN BaseInfo bi8 ON ( bi8.InfoID = w.emp_mode AND bi8.TypeID = 61 )\n\t LEFT OUTER JOIN HRM_position po ON (w.post_id = po.post_id)\n\t\t\t\t\t\t\tLEFT OUTER JOIN HRM_job_fields jf ON (po.jfid = jf.jfid)\n\t LEFT OUTER JOIN HRM_writ_types wt ON ((w.writ_type_id = wt.writ_type_id) AND (w.person_type = wt.person_type))\n\t LEFT OUTER JOIN HRM_writ_subtypes wst ON ((w.writ_subtype_id = wst.writ_subtype_id) AND (w.writ_type_id = wst.writ_type_id) AND (w.person_type = wst.person_type))\n\t LEFT OUTER JOIN HRM_study_branchs sb ON ((w.sbid = sb.sbid) AND (w.sfid = sb.sfid))\n\t LEFT OUTER JOIN HRM_study_fields sf ON (w.sfid = sf.sfid)\n\t LEFT OUTER JOIN HRM_org_new_units o ON (o.ouid = w.ouid)\n\t LEFT OUTER JOIN HRM_org_new_units parentu ON (parentu.ouid = o.parent_ouid)\t \n\t LEFT OUTER JOIN HRM_jobs j ON ( w.job_id = j.job_id ) \n\n\n\t\t\t\t\twhere (1=1) {$whr}\n "; } } $query .= $where != "" ? " AND " . $where : ""; $temp = parent::runquery_fetchMode($query, $whereParam); return $temp; }
function searchCostCenter() { $dt = array(); if (!empty($_REQUEST["rep"]) && $_REQUEST["rep"] == 1) { $dt[] = array("cost_center_id" => "-1", "title" => "همه"); } $dt = array_merge($dt, PdoDataAccess::runquery(" SELECT cost_center_id,title FROM cost_centers\r\n where cost_center_id in (" . manage_access::getValidCostCenters() . ")")); echo dataReader::getJsonData($dt, count($dt), $_GET["callback"]); die; }
from payment_items pit inner join salary_item_types sit on pit.salary_item_type_id = sit.salary_item_type_id inner join staff s on pit.staff_id = s.staff_id inner join Basic_Info bi on bi.typeid = 16 and bi.InfoID = sit.person_type left join CostCenterException cce on pit.cost_center_id = cce.CostCenterID AND pit.salary_item_type_id = cce.SalaryItemTypeID AND cce.Fromdate <= '".$month_start."' AND ( cce.ToDate >= '".$month_end."' or cce.ToDate Is null or cce.ToDate = '0000-00-00') where cce.CostCenterID is null AND pit.cost_center_id in ( ". manage_access::getValidCostCenters() .") AND sit.effect_type = 2 AND pit.payment_type = 1 AND pit.salary_item_type_id in (144,145,9920,38,143,149,150,146,147,148,399,242,9915,9911,243,242,399,744,747) ".$whr." group by sit.salary_item_type_id , sit.person_type union all select pit.salary_item_type_id ,sit.full_title salary_item_title , bi.Title person_type , sum(pit.get_value + (pit.diff_get_value * pit.diff_value_coef )) get_value from payment_items pit left join SubtractItemInfo sii on pit.salary_item_type_id = sii.SalaryItemTypeID and sii.FromDate <='".$month_start."' and ( sii.ToDate iS NUll OR sii.ToDate >='".$month_end."' or sii.ToDate='0000-00-00') left join CostCenterException cc on pit.salary_item_type_id = cc.SalaryItemTypeID and pit.cost_center_id = cc.CostCenterID and cc.FromDate <='".$month_start."' and
static function Count($where, $whereParam) { $query = "select count(*) from persons p join staff s on(s.person_type=p.person_type and s.PersonID=p.PersonID)\n\t\t\twhhere (s.last_cost_center_id in(" . manage_access::getValidCostCenters() . ") OR s.last_cost_center_id is null)\n\t\t\t\t\t\tAND s.person_type in(" . manage_access::getValidPersonTypes() . ")"; $query .= $where != "" ? " AND " . $where : ""; $temp = parent::runquery($query, $whereParam); return $temp[0][0]; }
$sid = $_POST["SITID2"]; } } if ($_POST['RepFormat'] == 1 ) { $paramType = 'LOAN'; if(isset($_POST["SITID1"])){ $qry = "select count(*) cn from SalaryItemAccess where UserID='" . $_SESSION["UserID"] . "' AND SalaryItemTypeID in (" . $_POST["SITID1"] . ")"; $res = PdoDataAccess::runquery($qry); $sid = $_POST["SITID1"]; } } if( $res[0]['cn'] == 0 ) { $whr .= " AND c.cost_center_id in (" . manage_access::getValidCostCenters() . ") "; } if ($_POST['RepType'] == 0) $orderBy = " order by cost_center_id,itm.salary_item_type_id,p.plname,p.pfname "; elseif ($_POST['RepType'] == 1) $orderBy = " order by itm.salary_item_type_id,p.plname,p.pfname "; $SITMWHRE = " " ; if(( isset($_POST["SITID2"]) && $_POST["SITID2"] > 0 ) || (isset($_POST["SITID1"]) && $_POST["SITID1"] > 0 )) { $SITMWHRE = "AND itm.salary_item_type_id=" . $sid ;
static function Count($where, $whereParam) { $query = "select count(*) from staff\n\t\t\t where (last_cost_center_id is null OR last_cost_center_id in(" . manage_access::getValidCostCenters() . "))\n\t\t\t\tAND person_type in(" . manage_access::getValidPersonTypes() . ")"; $query .= $where != "" ? " AND " . $where : ""; $temp = PdoDataAccess::runquery($query, $whereParam); return $temp[0][0]; }
p.writ_ver = w.writ_ver AND p.staff_id = w.staff_id AND w.state=3) INNER JOIN payment_items pit ON(p.pay_year = pit.pay_year AND p.pay_month = pit.pay_month AND p.staff_id = pit.staff_id AND p.payment_type = pit.payment_type) INNER JOIN persons per ON (per.personid = s.personid ) INNER JOIN banks b ON b.bank_id = p.bank_id INNER JOIN CostCenterPlan c ON c.CostCenterID = w.CostCenterID WHERE p.pay_year = :py and p.pay_month = :pm and p.payment_type = :pty and w.emp_state = 11 and s.person_type = 1 and pit.cost_center_id in ( " . manage_access::getValidCostCenters() . ") and c.CostCenterID = $costCenter group by $costCenterGroup s.person_type , p.pay_month,p.pay_year,p.payment_type order by c.CostCenterID "; $dataMProf = PdoDataAccess::runquery($query, $whereParam); // هیئت علمی مشروط ............... $mp_hoghoogh = 0; $mp_ezafeKar = 0; $mp_bimeh_dastgah = 0; $mp_bimeh_dolat = 0; $mp_made_kharej_Az_shomool = 0;
} $query = " select pit.staff_id, p.pfname , p.plname , pit.salary_item_type_id , sit.full_title , (pit.get_value + (pit.diff_get_value * pit.diff_value_coef ) )getValue\r\n\r\n\t\t\tfrom payment_items pit inner join salary_item_types sit\r\n\t\t\t\t on pit.salary_item_type_id = sit.salary_item_type_id\r\n\t\t\t\t\t inner join staff s on pit.staff_id = s.staff_id\r\n\t\t\t\t\t left join CostCenterException cce\r\n\t\t\t\t\t\t on pit.cost_center_id = cce.CostCenterID AND\r\n\t\t\t\t\t\t\tpit.salary_item_type_id = cce.SalaryItemTypeID AND cce.Fromdate <= '" . $_POST['StartDate'] . "' AND\r\n\t\t\t\t\t\t ( cce.ToDate >= '" . $_POST['EndDate'] . "' or\r\n\t\t\t\t\t\t\tcce.ToDate Is null or cce.ToDate = '0000-00-00')\r\n\t\t\t\t\t\t\t\r\n\t\t\t\tleft join SubtractItemInfo sii \r\n\t\t\t\t\ton pit.salary_item_type_id = sii.SalaryItemTypeID AND sii.FromDate <= '" . $_POST['StartDate'] . "' AND \r\n\t\t\t\t\t ( sii.ToDate is null OR sii.ToDate = '0000-00-00' OR sii.ToDate >= '" . $_POST['EndDate'] . "' )\r\n\t\t\t\t\r\n\t\t\t\tinner join payments pa \r\n\t\t\t\t\t\t\ton pa.staff_id = pit.staff_id and pa.pay_year = pit.pay_year and\r\n pa.pay_month = pit.pay_month and pa.payment_type = pit.payment_type\r\n\t\t \r\n\t\t\t\tinner join persons p \r\n\t\t\t\t\ton p.personid = s.personid \r\n\t\t\t\t\r\n\t\t\twhere\tcce.CostCenterID is null AND pa.state = 2 AND \r\n\t\t\t\tpit.cost_center_id in ( " . manage_access::getValidCostCenters() . " ) AND\r\n\t\t\t\tsit.effect_type = 2 AND pit.payment_type = 1 AND pit.pay_month = " . $_POST['PM'] . " AND pit.pay_year=" . $_POST['PY'] . " AND \r\n\t\t\t\tpit.param2 not in (\r\n270376904\t,\r\n270376905\t,\r\n270376906\t,\r\n270376907\t,\r\n270376908\t,\r\n270376909\t,\r\n270376910\t,\r\n270376911\t,\r\n270376912\t,\r\n270376913\t,\r\n270376914\t,\r\n270376915\t,\r\n270376916\t,\r\n270376917\t,\r\n270376918\t,\r\n270376919\t,\r\n270376920\t,\r\n270376921\t,\r\n270376922\t,\r\n270376924\t,\r\n270376925\t,\r\n270376926\t,\r\n270376927\t,\r\n270376928\t,\r\n270376929\t,\r\n270376930\t,\r\n270376931\t,\r\n270376933\t,\r\n270376934\t,\r\n270376935\t,\r\n270376936\t,\r\n270376937\t,\r\n270376938\t,\r\n270376939\t,\r\n270376940\t,\r\n270376941\t,\r\n270376942\t,\r\n270376943\t,\r\n270376944\t,\r\n270376945\t,\r\n270376946\t,\r\n270376948\t,\r\n270376950\t,\r\n270376951\t,\r\n270376952\t,\r\n270376953\t,\r\n270376954\t,\r\n270376955\t,\r\n270376956\t,\r\n270376957\t,\r\n270376958\t,\r\n270376960\t,\r\n270376961\t,\r\n270376961\t,\r\n270376962\t,\r\n270376963\t,\r\n270376963\t,\r\n270376964\t,\r\n270376965\t,\r\n270376966\t\r\n)\r\n\t\t\t\tAND \r\n\t\t\t\ts.person_type in " . $_POST['PT'] . " AND\r\n\t\t\t\tsii.arrangement = " . $_GET['refArr'] . " " . $WBI . "\r\n\t\t\t\t\t\t\t\t\r\n\t\t\torder by pit.salary_item_type_id , p.plname , p.pfname "; $data = PdoDataAccess::runquery($query); if ($_SESSION['UserID'] == 'jafarkhani') { // echo PdoDataAccess::GetLatestQueryString() ; die() ; } //............................. $query = " select si.SalaryItemTypeID , sit.full_title \r\n\t\t\r\n\t\t\t from SubtractItemInfo si inner join salary_item_types sit \r\n\t\t\t\t\t\t\ton si.SalaryItemTypeID = sit.salary_item_type_id AND si.FromDate <= '" . $_POST['StartDate'] . "' AND \r\n\t\t\t\t\t\t\t ( si.ToDate is null OR si.ToDate = '0000-00-00' OR si.ToDate >= '" . $_POST['EndDate'] . "' )\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\twhere si.arrangement=" . $_GET['refArr']; $res = PdoDataAccess::runquery($query); for ($i = 0; $i < count($res); $i++) { $title .= $res[$i]['SalaryItemTypeID'] . " : " . $res[$i]['full_title'] . " ، "; $sit = $res[$i]['SalaryItemTypeID'] . ","; } } else { if ($_GET['refCC'] > 0) { $query = " SELECT pit.staff_id , p.pfname , p.plname , sit.full_title , \r\n\t\t\t (pit.get_value + (pit.diff_get_value * pit.diff_value_coef )) getValue\r\n\r\n\t\t\t FROM payment_items pit inner join CostCenterException cce \r\n\t\t\t\t\t\t\ton pit.cost_center_id = cce.CostCenterID AND pit.salary_item_type_id = cce.SalaryItemTypeID AND\r\n\t\t\t\t\t\t\t cce.Fromdate <= '" . $_POST['StartDate'] . "' AND ( cce.ToDate >= '" . $_POST['EndDate'] . "' or cce.ToDate Is null or \r\n\t\t\t\t\t\t\t cce.ToDate = '0000-00-00')\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\tinner join payments pa \r\n\t\t\t\t\t\t\t\ton pa.staff_id = pit.staff_id and pa.pay_year = pit.pay_year and\r\n\t\t\t\t\t\t\t\t\tpa.pay_month = pit.pay_month and pa.payment_type = pit.payment_type\r\n\r\n\t\t\t\t\t\t inner join cost_centers cc \r\n\t\t\t\t\t\t\ton cce.CostCenterID = cc.cost_center_id\r\n\t\t\t\t\t\t inner join staff s \r\n\t\t\t\t\t\t\ton pit.staff_id = s.staff_id\r\n\t\t\t\t\t\t inner join persons p \r\n\t\t\t\t\t\t\ton s.personid= p.personid\r\n\t\t\t\t\t\t inner join salary_item_types sit \r\n\t\t\t\t\t\t\ton pit.salary_item_type_id = sit.salary_item_type_id\r\n\r\n\t\t\twhere pit.payment_type = 1 AND pa.state = 2 AND pit.param2 not in (\r\n\t\t\t\r\n270376904\t,\r\n270376905\t,\r\n270376906\t,\r\n270376907\t,\r\n270376908\t,\r\n270376909\t,\r\n270376910\t,\r\n270376911\t,\r\n270376912\t,\r\n270376913\t,\r\n270376914\t,\r\n270376915\t,\r\n270376916\t,\r\n270376917\t,\r\n270376918\t,\r\n270376919\t,\r\n270376920\t,\r\n270376921\t,\r\n270376922\t,\r\n270376924\t,\r\n270376925\t,\r\n270376926\t,\r\n270376927\t,\r\n270376928\t,\r\n270376929\t,\r\n270376930\t,\r\n270376931\t,\r\n270376933\t,\r\n270376934\t,\r\n270376935\t,\r\n270376936\t,\r\n270376937\t,\r\n270376938\t,\r\n270376939\t,\r\n270376940\t,\r\n270376941\t,\r\n270376942\t,\r\n270376943\t,\r\n270376944\t,\r\n270376945\t,\r\n270376946\t,\r\n270376948\t,\r\n270376950\t,\r\n270376951\t,\r\n270376952\t,\r\n270376953\t,\r\n270376954\t,\r\n270376955\t,\r\n270376956\t,\r\n270376957\t,\r\n270376958\t,\r\n270376960\t,\r\n270376961\t,\r\n270376961\t,\r\n270376962\t,\r\n270376963\t,\r\n270376963\t,\r\n270376964\t,\r\n270376965\t,\r\n270376966\t\r\n\r\n\t\t\t) AND\r\n\t\t\t\t\tpit.cost_center_id in (" . manage_access::getValidCostCenters() . ") AND\r\n\t\t\t\t\tpit.pay_month = " . $_POST['PM'] . " AND pit.pay_year=" . $_POST['PY'] . " AND \r\n\t\t\t\t\ts.person_type in " . $_POST['PT'] . " and cce.CostCenterID = " . $_GET['refCC'] . " order by pit.salary_item_type_id "; $data = PdoDataAccess::runquery($query); //................................... $query = " select cce.SalaryItemTypeID , sit.full_title\r\n\t\t\t from CostCenterException cce inner join salary_item_types sit \r\n\t\t\t\t\t\t\t on cce.SalaryItemTypeID = sit.salary_item_type_id\r\n\t\t\t\t\t\twhere cce.CostCenterID =" . $_GET['refCC']; $res = PdoDataAccess::runquery($query); for ($i = 0; $i < count($res); $i++) { $title .= $res[$i]['SalaryItemTypeID'] . " : " . $res[$i]['full_title'] . " ، "; $sit = $res[$i]['SalaryItemTypeID'] . ","; } } } $qry = " select bi.Title month_title \r\n from Basic_Info bi \r\n where bi.typeid = 41 and InfoID = " . $_POST['PM']; $res = PdoDataAccess::runquery($qry); $month = $res[0]['month_title']; $sit = substr($sit, 0, strlen($sit) - 1); $title = substr($title, 0, strlen($title) - 3);