Example #1
0
function writ_print_list($transcript_no, $last_writ_flag)
{
    $staff_onclause = $last_writ_flag ? "s.staff_id=w.staff_id AND s.last_writ_id=w.writ_id AND s.last_writ_ver=w.writ_ver" : "s.staff_id=w.staff_id";
    $title = $transcript_no == "all" ? 'wts.title transcripts_title,wts.transcript_id , tbl1.mtid,' : "";
    $writ_transcripts_join = $transcript_no == "all" ? '
			LEFT OUTER JOIN HRM_writ_transcripts wts ON(w.person_type = wts.person_type AND w.emp_state = wts.emp_state)
			LEFT OUTER JOIN (select max(transcript_id) mtid ,person_type , emp_state
							 from HRM_writ_transcripts group by person_type , emp_state) tbl1
				ON(tbl1.person_type = w.person_type AND tbl1.emp_state = w.emp_state)' : "";
    $order = $transcript_no == "all" ? '    wts.transcript_id ASC' : "";
    $query = " select\n\t\t\t\ts.staff_id,\n\t\t\t\tw.writ_id,\n\t\t\t\tw.writ_ver,\n\t\t\t\tw.staff_id,\n\t\t\t\tw.person_type,\n\t\t\t\tw.onduty_year,\n\t\t\t\tw.onduty_month,\n\t\t\t\tw.onduty_day,\n\t\t\t\tw.writ_type_id,\n\t\t\t\tw.emp_state,\n\t\t\t\tw.emp_mode,\n\t\t\t\tw.ref_letter_date,\n\t\t\t\tw.ref_letter_no,\n\t\t\t\tw.send_letter_no,\n\t\t\t\tw.contract_start_date,\n\t\t\t\tw.contract_end_date,\n\t\t\t\tw.corrective,\n\t\t\t\tw.issue_date,\n\t\t\t\tw.execute_date ,\n\t\t\t\twst.time_limited,\n\t\t\t\tp.sex sex ,w.marital_status , \n\t\t\t\tw.notes,w.family_responsible , \n\t\t\t\tw.pay_date pay_date,\n                                w.MissionPlace , \n\t\t\t\tmsts.Title marital_status_title,\n\t\t\t\tedulv.Title education_level_title,\n\n\t\t\t\t(w.cur_group-jf.start_group)+1 old_grup,\n\t\t\t\t(w.cur_group - 4) new_grup,\n\t\t\t\tw.cur_group ,\n\t\t\t\tw.description description,\n\t\t\t\tw.included_children_count,\n\t\t\t\tw.children_count,\n\t\t\t\tmiltype.Title as military,miltype.InfoID as militaryID , \n\t\t\t\tw.job_id,\n\t\t\t\tsinclv.Title snc_level,\n\t\t\t\tw.base,\n\t\t\t\tw.ouid,\n\t\t\t\tempstt.Title emp_st,\n\t\t\t\tworktime.Title worktime,\n\t\t\t\tp.sex gnd,\n\t\t\t\tp.pfname ps_pfname,\n\t\t\t\tp.birth_place ps_birth_place,\n\t\t\t\tp.issue_place,\n\t\t\t\tp.plname ps_plname,\n\t\t\t\tp.idcard_no ps_idcard_no,\n\t\t\t\tp.father_name ps_father_name,\n\t\t\t\tp.birth_date ps_birth_date,\n\t\t\t\tp.national_code,\n\t\t\t\tp.military_from_date,\n\t\t\t\tp.military_to_date,\n\t\t\t\tp.military_type,\n\t\t\t\tp.military_duration_day, \n\t\t\t\tp.military_duration ,\n\t\t\t\to.ptitle o_ptitle,\n\t\t\t\to.ouid o_ouid,\n\t\t\t\tparentu.ouid ou_ouid ,\n\t\t\t\tparentu.ptitle ou_ptitle ,\n\t\t\t\to.org_unit_type org_sub_unit_type ,\n\t\t\t\to.ptitle os_ptitle ,\n\t\t\t\tpunit.ouid po_ouid,\n\t\t\t\tpunit.ptitle po_ptitle,\n\t\t\t\tpsubunit.ptitle pos_ptitle ,\n\t\t\t\tpsubunit.ouid pos_ouid ,\n\t\t\t\tj.title j_title,\n\t\t\t\tj.job_group,\n\t\t\t\tsf.ptitle sf_title,\n\t\t\t\tsbs.ptitle sbs_title,\n\t\t\t\twst.print_title wst_title,\n\t\t\t\tpo.title p_title,\n\t\t\t\tpo.post_no p_post_no,\n\t\t\t\tpo.post_id ,\n\t\t\t\tpo.ouid pouid ,\n\t\t\t\tposttype.Title post_type,\n\t\t\t\tcw.ptitle cw_ptitle,\n\t\t\t\tcb.ptitle cb_ptitle,\n\t\t\t\tci.ptitle ci_ptitle,\t\t\n\t\t\t\tsi.ptitle si_ptitle,\n\t\t\t\tsw.ptitle sw_ptitle,\n\t\t\t\tjf.title jf_title,\n\t\t\t\tjsc.title jsc_title,\n\t\t\t\tjc.title jc_title,\n\t\t\t\ts.personel_no,\n\t\t\t\ts.work_start_date,\n\t\t\t\tc.ptitle country_title,\n\t\t\t\tsbs.ptitle sbs_title,\n\t\t\t\tsf.ptitle sf_ptitle,\n\t\t\t\tsf.sfid , s.unitCode ,\n\t\t\t\tj.job_id ,\n\t\t\t\tj.title j_title,\n\t\t\t\twt.title writ_type,\n\t\t\t\t" . $title . "\n\t\t\t\tp.PersonID ,\n\t\t\t\tw.writ_signature_post_title,\n\t\t\t\tw.writ_signature_post_owner ,w.grade ,\n\t\t\t\thistory_only,\n\t\t\t\twst.req_staff_signature, \n\t\t\t\twsi.param8 E_base,                                 \n\t\t\t\twsi.param5 ComputeGrade, \n\t\t\t\tba.SBase S_base, \n\t\t\t\tba.IsarValue I_base ,\n\t\t\t\tba.TashvighiValue T_base ";
    $query .= " from staff s\n\t\t\t INNER JOIN HRM_writs w ON (" . $staff_onclause . ")\n\n\t\t\t LEFT OUTER JOIN HRM_writ_subtypes wst\n\t\t\t\t  ON ((w.person_type = wst.person_type) AND (w.writ_type_id = wst.writ_type_id) AND (w.writ_subtype_id=wst.writ_subtype_id))\n\t\t\t LEFT OUTER JOIN HRM_writ_types wt\n\t\t\t\t  ON ((w.person_type = wt.person_type) AND (w.writ_type_id = wt.writ_type_id))\n\t\t\t LEFT OUTER JOIN HRM_person_educations pe1\n\t\t\t\t  ON ((w.education_level = pe1.education_level) AND (w.sfid = pe1.sfid) AND (w.sbid = pe1.sbid) AND (pe1.PersonID = s.PersonID))\n\t\t\t LEFT OUTER JOIN HRM_countries c ON (pe1.country_id = c.country_id)\n\t\t\t LEFT OUTER JOIN HRM_universities u ON ((pe1.university_id = u.university_id) AND (pe1.country_id = u.country_id))\n\t\t\t LEFT OUTER JOIN HRM_study_fields sf ON ((w.sfid = sf.sfid))\n\t\t\t LEFT OUTER JOIN HRM_study_branchs sbs ON ((w.sfid = sbs.sfid)AND(w.sbid=sbs.sbid))\n\t\t\t LEFT OUTER JOIN HRM_persons p ON (s.PersonID = p.PersonID)\n\t\t\t LEFT OUTER JOIN HRM_cities cw ON ((w.work_city_id = cw.city_id) AND (w.work_state_id = cw.state_id))\n\t\t\t " . $writ_transcripts_join . "\n\t\t\t LEFT OUTER JOIN HRM_states sw ON (cw.state_id=sw.state_id)\n\t\t\t LEFT OUTER JOIN HRM_cities cb ON ((p.birth_city_id = cb.city_id) AND (p.birth_state_id = cb.state_id))\n\t\t\t LEFT OUTER JOIN HRM_cities ci ON ((p.issue_city_id=ci.city_id) AND (p.issue_state_id = ci.state_id))\n\t\t\t LEFT OUTER JOIN HRM_states si ON (ci.state_id=si.state_id)\n\t\t\t LEFT OUTER JOIN HRM_position po ON (w.post_id = po.post_id)\n\t\t\t LEFT OUTER JOIN HRM_org_new_units psubunit ON (psubunit.ouid = po.ouid)\n\t\t\t LEFT OUTER JOIN HRM_org_new_units punit ON (punit.ouid = psubunit.parent_ouid)\n\t\t\t LEFT OUTER JOIN HRM_job_fields jf ON (po.jfid = jf.jfid)\n\t\t\t LEFT OUTER JOIN HRM_job_subcategory jsc ON ((jf.jsid = jsc.jsid) AND (jf.jcid=jsc.jcid))\n\t\t\t LEFT OUTER JOIN HRM_job_category jc ON (jsc.jcid = jc.jcid)\n\t\t\t LEFT OUTER JOIN HRM_org_new_units o ON (w.ouid = o.ouid)\n\t\t\t LEFT OUTER JOIN HRM_org_new_units parentu ON (parentu.ouid = o.parent_ouid)\n\t\t\t LEFT OUTER JOIN HRM_jobs j ON (w.job_id = j.job_id) \n\t\t\t \n\t\t\t LEFT OUTER JOIN HRM_writ_salary_items wsi ON w.writ_id = wsi.writ_id AND \n\t\t\t\t\t\t\t\tw.writ_ver = wsi.writ_ver AND w.staff_id = wsi.staff_id AND wsi.salary_item_type_id = 10364 \n\t\t\t\t\t\t\t\t\n\t\t\t LEFT OUTER JOIN (select    PersonID , sum(if(ba.BaseType in (6,2,20,21,22,23,24,25,26,27) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0))  TashvighiValue ,\n\t\t\t\t\t\t\t\t\t\tsum(if(ba.BaseType in (3,4,5,7) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0))  IsarValue ,\n\t\t\t\t\t\t\t\t\t\tsum(if(ba.BaseType in (1 ) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0)) SBase\n\n\t\t\t\t\t\t\t\t\tfrom bases ba\n\n\t\t\t\t\t\t\t  group by PersonID) ba \n\t\t\t\t\t\t\t  ON ba.PersonID = s.PersonID " . QueryHelper::makeBasicInfoJoin(15, "msts", "w.marital_status") . QueryHelper::makeBasicInfoJoin(6, "edulv", "w.education_level") . QueryHelper::makeBasicInfoJoin(10, "miltype", "p.military_type") . QueryHelper::makeBasicInfoJoin(8, "sinclv", "w.science_level") . QueryHelper::makeBasicInfoJoin(3, "empstt", "w.emp_state") . QueryHelper::makeBasicInfoJoin(14, "worktime", "w.worktime_type") . QueryHelper::makeBasicInfoJoin(27, "posttype", "po.post_type");
    $where = "1=1";
    $whereParam = array();
    require_once '../data/writ.data.php';
    echo "****";
    die;
    MakeAdvanceSearchWhere($where, $whereParam);
    if (!empty($_REQUEST["writ_id"]) && !empty($_REQUEST["writ_ver"]) && !empty($_REQUEST["staff_id"])) {
        $where .= " AND w.writ_id = :wid AND w.writ_ver=:wver AND w.staff_id=:stid";
        $whereParam[":wid"] = $_REQUEST["writ_id"];
        $whereParam[":wver"] = $_REQUEST["writ_ver"];
        $whereParam[":stid"] = $_REQUEST["staff_id"];
    } else {
        if ($last_writ_flag == 1) {
            $where .= " AND w.writ_id = s.last_writ_id AND w.writ_ver=s.last_writ_ver";
        }
    }
    if (!empty($_REQUEST["ouid"])) {
        $return = QueryHelper::MK_org_units($_REQUEST["ouid"]);
        $where .= " AND " . $return["where"];
        $whereParam = array_merge($whereParam, $return["param"]);
    }
    if ($transcript_no != 1 && $transcript_no != 2) {
        $transcript_no = 2;
    }
    //--------------------------------------------------------------------------
    if ($_REQUEST['transcript_no'] == "all") {
        $where .= " AND wts.transcript_id not in (117 , 123 , 127 , 44 , 9 , 114 ) ";
    }
    $query .= " where " . $where;
    $query .= " order by p.plname , p.pfname ";
    $dt = PdoDataAccess::runquery_fetchMode($query, $whereParam);
    echo PdoDataAccess::GetLatestQueryString();
    die;
    return $dt;
}
Example #2
0
 case "DATE":
     if (!empty($_POST["FDATE:" . $column_id])) {
         $QUERY_WHERE .= " AND " . $field_name . ">= :f" . $column_id;
         $whereParam[":f" . $column_id] = DateModules::Shamsi_to_Miladi($_POST["FDATE:" . $column_id]);
     }
     if (!empty($_POST["TDATE:" . $column_id])) {
         $QUERY_WHERE .= " AND " . $field_name . "<= :t" . $column_id;
         $whereParam[":t" . $column_id] = DateModules::Shamsi_to_Miladi($_POST["TDATE:" . $column_id]);
     }
     break;
 case "SELECT":
     if (isset($_POST["SELECT:" . $column_id]) && $_POST["SELECT:" . $column_id] != -1) {
         if (strpos($base_field, "ouid") !== false) {
             preg_match_all('/tbl[0-9]*/', $columns[$i]["field"], $prefix);
             $prefix = $prefix[0][count($prefix[0]) - 1];
             $org = QueryHelper::MK_org_units($_POST["SELECT:" . $columns[$i]["column_id"]], true, $prefix);
             if ($org["where"] != "") {
                 $QUERY_WHERE .= " AND " . $org["where"];
                 $whereParam = array_merge($whereParam, $org["param"]);
             }
         } else {
             $QUERY_WHERE .= " AND " . $base_field . " = :f" . $i;
             $whereParam[":f" . $i] = $_POST["SELECT:" . $column_id];
         }
     }
     break;
 case "CHECK":
     if ($_POST["CHECK:" . $column_id] != "-1") {
         $QUERY_WHERE .= " AND " . $field_name . " = :t" . $column_id;
         $whereParam[":t" . $column_id] = $_POST["CHECK:" . $column_id];
     }
Example #3
0
function selectAllPosts()
{
    require_once inc_manage_post;
    $where = "1=1";
    $whereParam = array();
    //-----------------------
    if (!empty($_POST["post_no"])) {
        $where .= " AND p.post_no=:pno";
        $whereParam[":pno"] = $_POST["post_no"];
    }
    if (!empty($_POST["post_type"]) && $_POST["post_type"] != -1) {
        $where .= " AND p.post_type=:ptype";
        $whereParam[":ptype"] = $_POST["post_type"];
    }
    if (!empty($_POST["title"])) {
        $where .= " AND p.title like :title";
        $whereParam[":title"] = "%" . $_POST["title"] . "%";
    }
    if (!empty($_POST["ouid"]) && $_POST["ouid"] != -1) {
        $result = QueryHelper::MK_org_units($_POST["ouid"], isset($_POST["sub_units"]) ? true : false);
        $where .= " AND " . $result["where"];
        $whereParam = array_merge($whereParam, $result["param"]);
    }
    $where .= dataReader::makeOrder();
    $temp = manage_posts::GetAllPosts($where, $whereParam);
    $no = count($temp);
    $temp = array_slice($temp, $_GET["start"], $_GET["limit"]);
    for ($i = 0; $i < count($temp); $i++) {
        if ($temp[$i]["ouid"] != "") {
            $temp[$i]["full_unit_title"] = manage_units::get_full_title($temp[$i]["ouid"]);
        } else {
            $temp[$i]["full_unit_title"] = "";
        }
    }
    echo dataReader::getJsonData($temp, $no, $_GET["callback"]);
    die;
}
Example #4
0
function ProcessArrearPayment()
{
    $payArrCalcObj = new manage_arrear_pay_calculation();
    $payArrCalcObj->__YEAR = $_POST["pay_year"];
    $payArrCalcObj->__MONTH = 12;
    $start_date = $_POST["pay_year"] . "/01/01";
    $end_date = $_POST["pay_year"] . "/12/" . DateModules::DaysOfMonth($payArrCalcObj->__YEAR, 12);
    $payArrCalcObj->__CALC_NORMALIZE_TAX = isset($_POST['tax_normalize']) ? "1" : "0";
    $payArrCalcObj->__START_NORMALIZE_TAX_MONTH = 1;
    $payArrCalcObj->__START_NORMALIZE_TAX_YEAR = $_POST["pay_year"];
    $payArrCalcObj->__BACKPAY_BEGIN_FROM = 1;
    $payArrCalcObj->month_start = DateModules::shamsi_to_miladi($start_date);
    $payArrCalcObj->month_end = DateModules::shamsi_to_miladi($end_date);
    $payArrCalcObj->__MSG = $_POST["message"];
    // <editor-fold defaultstate="collapsed" desc="Create Where" >
    $where = "1=1";
    $whereParam = array();
    if (!empty($_POST["person_type"])) {
        $where .= " AND p.person_type=:ptype";
        $whereParam[":ptype"] = $_POST["person_type"];
    }
    if (!empty($_POST["from_staff_id"])) {
        $where .= " AND s.staff_id >= :fsid";
        $whereParam[":fsid"] = $_POST["from_staff_id"];
    }
    if (!empty($_POST["to_staff_id"])) {
        $where .= " AND s.staff_id <= :tsid";
        $whereParam[":tsid"] = $_POST["to_staff_id"];
    }
    if (!empty($_POST["from_cost_center_id"])) {
        $where .= " AND w.cost_center_id >= :fccid";
        $whereParam[":fccid"] = $_POST["from_cost_center_id"];
    }
    if (!empty($_POST["to_cost_center_id"])) {
        $where .= " AND w.cost_center_id <= :tccid";
        $whereParam[":tccid"] = $_POST["to_cost_center_id"];
    }
    if (!isset($_POST["ouid"])) {
        $result = QueryHelper::MK_org_units($_POST["ouid"], true);
        $where .= " AND " . $result["where"];
        $whereParams = array_merge($whereParam, $result["param"]);
    }
    // </editor-fold>
    $payArrCalcObj->__WHERE = $where;
    $payArrCalcObj->__WHEREPARAM = $whereParam;
    $res = $payArrCalcObj->run_back();
    if (!$res) {
        echo Response::createObjectiveResponse(false, ExceptionHandler::popExceptionDescription());
        die;
    } else {
        echo Response::createObjectiveResponse(true, $payArrCalcObj->success_counter . "_" . $payArrCalcObj->fail_counter);
        die;
    }
}