예제 #1
0
function newTable()
{
    $query = "insert into rp_base_tables(table_name, description) values(?,?)";
    PdoDataAccess::runquery($query, array($_POST["table_name"], $_POST["description"]));
    echo "true";
    die;
}
 function change_state()
 {
     $whereParams = array();
     $whereParams[":py"] = $this->PayYear;
     $whereParams[":pm"] = $this->PayMonth;
     if ($this->PersonType == 102) {
         $pt = " in ( 1,2,3) ";
     } else {
         if ($this->PersonType == 100) {
             $pt = " in ( 1,2,3,5,100 ) ";
         } else {
             $pt = $this->PersonType;
         }
     }
     $query = " update SalaryItemReport\r\n                                  set state = " . $this->state . "\r\n                                                 where PayYear = :py and PayMonth = :pm and PersonType {$pt}  ";
     $result = parent::runquery($query, $whereParams);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_update;
     $daObj->MainObjectID = $this->PayMonth;
     $daObj->SubObjectID = $this->state;
     $daObj->TableName = "SalaryItemReport";
     $daObj->execute();
     return true;
 }
예제 #3
0
function changePass()
{
    require_once '../../../header.inc.php';
    require_once inc_response;
    require_once inc_dataReader;
    $pdoAcc = PdoDataAccess::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
    $dt = PdoDataAccess::runquery("select * from AccountSpecs \n\t\t\t\t\t\t\t\t\t\twhere personID=:psid", array(":psid" => $_SESSION['PersonID']), $pdoAcc);
    if (count($dt) == 0) {
        echo "false";
        die;
    }
    $password = md5($_POST["cur_pass"]);
    $stored_seed = substr($dt[0]["pswd1"], 40, 10);
    if (sha1($stored_seed . $password . $stored_seed) . $stored_seed != $dt[0]["pswd1"]) {
        echo "CurPassError";
        die;
    }
    $seed = '';
    $password2 = md5($_POST["new_pass"]);
    for ($i = 1; $i <= 10; $i++) {
        $seed .= substr('0123456789abcdef', rand(0, 15), 1);
    }
    PdoDataAccess::RUNQUERY("update AccountSpecs set pswd1=:pswd where personID=:psid", array(":pswd" => sha1($seed . $password2 . $seed) . $seed, ":psid" => $_SESSION['PersonID']), $pdoAcc);
    if (ExceptionHandler::GetExceptionCount() != 0) {
        echo "CurPassError";
        die;
    }
    //PdoDataAccess::AUDIT("AccountSpecs","تغییر رمز عبور", "");
    echo "true";
    die;
}
예제 #4
0
 static function CountMiscDoc($where = "", $whereParam = array())
 {
     $query = " select count(*) from person_misc_docs ";
     $query .= $where != "" ? " where " . $where : "";
     $temp = parent::runquery($query, $whereParam);
     return $temp[0][0];
 }
예제 #5
0
 public static function simulate_bime($pay_year, $pay_month, $payment_type = NULL)
 {
     $e_date = "31-" . $pay_month . "-" . $pay_year;
     $end_month_date = DateModules::shamsi_to_miladi($e_date);
     $s_date = "1-" . $pay_month . "-" . $pay_year;
     $start_month_date = DateModules::shamsi_to_miladi($s_date);
     $worker_month_day = 30;
     $actual_month_day = DateModules::get_month_dayno($pay_year, $pay_month);
     //...................................
     PdoDataAccess::runquery("DROP TABLE IF EXISTS temp_insure_include_sum ");
     PdoDataAccess::runquery(" DROP TABLE IF EXISTS temp_limit_staff ");
     PdoDataAccess::runquery(" CREATE TEMPORARY TABLE temp_limit_staff AS\r\n\t\t\t\t\t\t\t\tSELECT DISTINCT s.staff_id , s.person_type\r\n\t\t\t\t\t\t\t\tFROM staff s\r\n\t\t\t\t\t\t\t\t\tINNER JOIN staff_include_history si\r\n\t\t\t\t\t\t\t\t\t\tON (s.staff_id = si.staff_id AND si.start_date <= ('{$end_month_date}') AND (si.end_date IS NULL OR si.end_date >= ('{$end_month_date}'))) \r\n\t\t\t\t\t\t\t\tWHERE si.insure_include = 1 ");
     PdoDataAccess::runquery("ALTER TABLE temp_limit_staff ADD INDEX (staff_id)");
     PdoDataAccess::runquery(" CREATE TEMPORARY table temp_insure_include_sum AS\r\n\t\t\t\t\t\t\t\tSELECT s.staff_id ,\r\n\t\t\t\t\t\t\t\t\t\t0 value,\r\n\t\t\t\t\t\t\t\t\t\tsum(pi.pay_value) + CASE WHEN sum(pi.diff_pay_value * pi.diff_value_coef) < 0 THEN 0 ELSE sum(pi.diff_pay_value * pi.diff_value_coef) END param1 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param2 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param3 , \r\n\t\t\t\t\t\t\t\t\t\tCASE WHEN s.person_type = " . HR_WORKER . " THEN {$worker_month_day} ELSE {$actual_month_day} END month_days\r\n\t\t\t\t\t\t\t\tFROM payment_items pi\r\n\t\t\t\t\t\t\t\tINNER JOIN salary_item_types sit\r\n\t\t\t\t\t\t\t\t\tON (pi.salary_item_type_id = sit.salary_item_type_id AND \r\n\t\t\t\t\t\t\t\t\t\tsit.credit_topic = " . CREDIT_TOPIC_1 . " AND \r\n\t\t\t\t\t\t\t\t\t\tsit.insure_include = 1)\r\n\t\t\t\t\t\t\t\tINNER JOIN temp_limit_staff s\r\n\t\t\t\t\t\t\t\t\tON (s.staff_id = pi.staff_id)\r\n\t\t\t\t\t\t\t\tWHERE pi.pay_year = ({$pay_year}) AND \r\n\t\t\t\t\t\t\t\t\tpi.pay_month = ({$pay_month}) AND \r\n\t\t\t\t\t\t\t\t\tpi.payment_type = 1\r\n\t\t\t\t\t\t\t\t\t{$payment_type_where}\r\n\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tstaff_id; ");
     PdoDataAccess::runquery("ALTER TABLE temp_insure_include_sum ADD INDEX (staff_id)");
     $max_daily_salary_insure_include = manage_salary_params::get_salaryParam_value("", 100, SPT_MAX_DAILY_SALARY_INSURE_INCLUDE, $start_month_date);
     PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t  SET param1 = {$max_daily_salary_insure_include} * {$worker_month_day} \r\n\t\t\t\t\t\t\t  WHERE param1 > {$max_daily_salary_insure_include} * {$worker_month_day} ");
     //استخراج درصد بیمه بیکاری سهم کارفرما
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_UNEMPLOYMENT_INSURANCE_VALUE);
     $unemployment_insurance_value = $res[0]['value'];
     //استخراج درصد بیمه سهم شخص
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_PERSON_VALUE);
     $person_value = $res[0]['value'];
     //استخراج درصد بیمه سهم کارفرما
     $res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_EMPLOYER_VALUE);
     $employmer_value = $res[0]['value'];
     PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t\tSET value =  param1 * {$person_value} ,\r\n\t\t\t\t\t\t\t\t\tparam2 = param1 * {$employmer_value} ,\r\n\t\t\t\t\t\t\t\t\tparam3 = param1 * {$unemployment_insurance_value} \r\n\t\t\t\t\t\t\t\tWHERE (1=1)");
 }
예제 #6
0
 /**
  * این تابع پایه استاد را بر می گرداند
  * @param miladiDate $ToDate : اگر این پارامتر به تابع فرستاده شود تابع پایه استاد تا قبل این تاریخ را بر می گرداند
  */
 static function get_base($PersonID, $ToDate = "")
 {
     $base = 1;
     $education_level_rec = manage_person_education::GetEducationLevelByDate($PersonID, $ToDate);
     if ($education_level_rec['university_id'] == 4) {
         $base = 3;
     }
     if ($education_level_rec['max_education_level'] == EDUCATION_LEVEL_MS && $education_level_rec['burse'] == 1) {
         $base += 1;
     }
     if ($education_level_rec['max_education_level'] == EDUCATION_LEVEL_PHD && $education_level_rec['burse'] == 1) {
         $base += 3;
     }
     $query = "\r\n\t\t\tSELECT  PersonID,\r\n\t\t            personel_relation,\r\n\t\t            devotion_type,\r\n\t\t            sum(amount) sum_amount\r\n\t\t\r\n\t\t    FROM \tperson_devotions\r\n\t\t\r\n\t\t    WHERE PersonID = {$PersonID} AND\r\n\t\t          personel_relation = 1 AND\r\n\t\t          devotion_type = 4\r\n\t\t\r\n\t\t    GROUP BY PersonID, personel_relation, devotion_type";
     $temp = PdoDataAccess::runquery($query);
     if (count($temp) != 0) {
         $base += floor($temp[0]['sum_amount'] / 360);
     }
     $query = "\r\n\t\t\tSELECT  PersonID,\r\n\t\t            military_type\r\n\t\t    FROM \tpersons\r\n\t\t    WHERE PersonID = {$PersonID}";
     $temp = PdoDataAccess::runquery($query);
     if (count($temp) != 0 && $temp[0]['military_type'] == 12) {
         $base += 1;
     }
     return $base;
 }
예제 #7
0
 function DatesAreValid()
 {
     $dt = PdoDataAccess::runquery("select * from ATN_PersonShifts\r\n\t\t\twhere PersonID=:p \r\n\t\t\tAND ( :f between FromDate AND ToDate OR :t between FromDate AND ToDate ) AND RowID <> :r", array(":p" => $this->PersonID, ":r" => $this->RowID, ":f" => DateModules::shamsi_to_miladi($this->FromDate, "-"), ":t" => DateModules::shamsi_to_miladi($this->ToDate, "-")));
     if (count($dt) > 0) {
         ExceptionHandler::PushException("شیفت انتخاب شده دارای تداخل زمانی میباشد");
         return false;
     }
     /*$ShiftObj = new ATN_shifts($this->ShiftID);
     		
     		$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts join ATN_shifts using(ShiftID)
     			where PersonID=:p 
     			AND ( (:s between FromTime AND ToTime) OR (:e between FromTime AND ToTime) ) AND RowID <> :r 
     			AND ( (:f between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) 
     				OR (:t between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) )", 
     			array(":p" => $this->PersonID, ":s" => $ShiftObj->FromTime, 
     				  ":e" => $ShiftObj->ToTime, ":r" => $this->RowID,
     				  ":f" => DateModules::shamsi_to_miladi($this->FromDate), 
     				  ":t" => DateModules::shamsi_to_miladi($this->ToDate)));
     
     		if(count($dt) > 0)
     		{
     			ExceptionHandler::PushException("شیفت های این فرد با یکدیگر دارای تداخل ساعتی می باشند");;
     			return false;
     		}		*/
     return true;
 }
 function Remove($All = "")
 {
     $query = " select * from evaluation_lists where list_id = " . $this->list_id . " and doc_state = 3 ";
     $tmp2 = parent::runquery($query);
     if (count($tmp2) > 0) {
         parent::PushException("این لیست تایید واحد مرکزی می باشد .");
         return false;
     } else {
         if ($All == "true") {
             $result = parent::delete("evaluation_list_items", "list_id=?", array($this->list_id));
         } else {
             $result = parent::delete("evaluation_list_items", "list_id =? and ListItemID=? ", array($this->list_id, $this->ListItemID));
         }
     }
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $this->list_id;
     $daObj->SubObjectID = $this->ListItemID;
     $daObj->TableName = "evaluation_list_items";
     $daObj->execute();
     return true;
 }
예제 #9
0
 static function CountPersonJob($where = "", $whereParam = array())
 {
     $query = " select count(*)                               \r\n\t\t\t\t\t\tfrom PersonJobs \r\n\t\t\t\t\t\t\t\twhere (1=1) ";
     $query .= $where != "" ? " AND " . $where : "";
     $temp = parent::runquery($query, $whereParam);
     return $temp[0][0];
 }
예제 #10
0
 function Remove()
 {
     if ($this->list_type == 9) {
         $tblName = "mission_list_items";
     } else {
         $tblName = "pay_get_list_items";
     }
     $query = " select * from " . $tblName . " where list_id = " . $this->list_id;
     $tmp = parent::runquery($query);
     $query = " select * from pay_get_lists where list_id = " . $this->list_id . " and doc_state = 3 ";
     $tmp2 = parent::runquery($query);
     if (count($tmp) > 0) {
         parent::PushException("این لیست شامل مجموعه ای از افراد می باشد .");
         return false;
     } else {
         if (count($tmp2) > 0) {
             parent::PushException("این لیست تایید واحد مرکزی می باشد .");
             return false;
         } else {
             $result = parent::delete("pay_get_lists", "list_id=?", array($this->list_id));
         }
     }
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $this->list_id;
     $daObj->TableName = "pay_get_lists";
     $daObj->execute();
     return true;
 }
예제 #11
0
function GetTreeNodes()
{
    $LetterID = $_REQUEST["LetterID"];
    $creator = PdoDataAccess::runquery("\r\n\t\tselect PersonID,\r\n\t\t\tconcat_ws(' ',fname, lname,CompanyName) text, \r\n\t\t\t'true' as leaf, 'true' expanded,'user' iconCls,\r\n\t\t\tl.RegDate\r\n\t\tfrom OFC_letters l join BSC_persons p using(PersonID) where LetterID=?", array($LetterID));
    $index = 1;
    $returnArray = array();
    $refArray = array();
    $creator[0]["id"] = $index++;
    $creator[0]["text"] .= " [ " . substr($creator[0]["RegDate"], 10, 6) . " &nbsp;&nbsp; " . DateModules::miladi_to_shamsi($creator[0]["RegDate"]) . "\t]";
    $returnArray[] = $creator[0];
    $refArray[$creator[0]["PersonID"]] =& $returnArray[count($returnArray) - 1];
    $nodes = PdoDataAccess::runquery("\r\n\t\tselect FromPersonID ,ToPersonID, SendDate,\r\n\t\t\tconcat_ws(' ',fname, lname,CompanyName,' - ',InfoDesc) text, \r\n\t\t\tconcat('<b>توضیحات ارجاع : </b>' ,replace(SendComment,'\n','<br>')) qtip,\r\n\t\t\t'true' as leaf, 'true' expanded,'user' iconCls\r\n\t\tfrom OFC_send \r\n\t\t\tjoin BSC_persons p on(ToPersonID=PersonID) \r\n\t\t\tjoin BaseInfo bf on(bf.TypeID=12 AND SendType=InfoID)\r\n\t\twhere LetterID=?\r\n\t\torder by SendID", array($LetterID));
    foreach ($nodes as $row) {
        $row["id"] = $index++;
        $row["text"] .= " [ " . substr($row["SendDate"], 10, 6) . " &nbsp;&nbsp; " . DateModules::miladi_to_shamsi($row["SendDate"]) . " ]";
        $parentNode =& $refArray[$row["FromPersonID"]];
        if (!isset($parentNode["children"])) {
            $parentNode["children"] = array();
            $parentNode["leaf"] = "false";
        }
        $lastIndex = count($parentNode["children"]);
        $parentNode["children"][$lastIndex] = $row;
        $refArray[$row["ToPersonID"]] =& $parentNode["children"][$lastIndex];
    }
    $str = json_encode($returnArray);
    $str = str_replace('"children"', 'children', $str);
    $str = str_replace('"leaf"', 'leaf', $str);
    $str = str_replace('"iconCls"', 'iconCls', $str);
    $str = str_replace('"text"', 'text', $str);
    $str = str_replace('"id"', 'id', $str);
    $str = str_replace('"true"', 'true', $str);
    $str = str_replace('"false"', 'false', $str);
    echo $str;
    die;
}
예제 #12
0
 function GetAccDoc($pdo = null)
 {
     $dt = PdoDataAccess::runquery("\r\n\t\t\tselect DocID from ACC_DocItems where SourceType=" . DOCTYPE_WARRENTY . " \r\n\t\t\tAND SourceID=? AND SourceID2=?", array($this->RequestID, $this->ReqVersion), $pdo);
     if (count($dt) == 0) {
         return 0;
     }
     return $dt[0][0];
 }
예제 #13
0
 static function getCityName($city_id)
 {
     $query = "select * from cities where city_id=" . $city_id;
     $dt = parent::runquery($query);
     if (count($dt) != 0) {
         return $dt[0]["ptitle"];
     }
     return "";
 }
예제 #14
0
 static function DeleteWST($id)
 {
     $arr = explode('-', $id);
     PdoDataAccess::runquery("delete from writ_subtypes where person_type=" . $arr[3] . " and writ_type_id=" . $arr[4] . " and writ_subtype_id=" . $arr[5]);
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $_POST["id"];
     $daObj->TableName = "writ_subtypes";
     $daObj->execute();
 }
예제 #15
0
function DeleteGroup()
{
    $dt = PdoDataAccess::runquery("select * from LON_loans where GroupID=?", array($_POST["GroupID"]));
    if (count($dt) > 0) {
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    PdoDataAccess::runquery("delete from BaseInfo where TypeID=1 AND InfoID=?", array($_POST["GroupID"]));
    echo Response::createObjectiveResponse(true, "");
    die;
}
예제 #16
0
 static function get_variable_info($varName, $param1 = "", $param2 = "")
 {
     $query = "select var_value\r\n\t\t\t\t  from variables\r\n\t\t\t\t  where var_name='" . $varName . "' ";
     $query .= $param1 != "" ? " AND param1='{$param1}'" : "";
     $query .= $param2 != "" ? " AND param2='{$param2}'" : "";
     $dt = PdoDataAccess::runquery($query);
     if (count($dt) == 0) {
         return false;
     }
     return $dt[0][0];
 }
예제 #17
0
function duty_year_month_day($staff_id = "", $personID = "", $toDate) {
    if ($staff_id == "" && $personID = "") {
        PdoDataAccess::PushException("يکي از دو پارامتر staff_id و PersonID بايد فرستاده شود");
        return false;                
    }
    $query = "select w.execute_date,
						w.contract_start_date ,
						w.contract_end_date ,
						w.person_type ,
						w.onduty_year ,
						w.onduty_month ,
						w.onduty_day ,
						w.annual_effect
			from writs as w";

    if ($personID != "")
        $query .= " join staff as s using(staff_id) where s.PersonID=" . $personID;

    else if ($staff_id != "")
        $query .= " where w.staff_id = $staff_id";

    $query .= " AND (w.history_only != " . HISTORY_ONLY . " OR w.history_only is null) AND w.execute_date <= '$toDate'
						order by w.execute_date DESC,w.writ_id DESC,w.writ_ver DESC
						limit 1";

    $temp = PdoDataAccess::runquery($query);

    if (count($temp) == 0)
        return array("year" => 0, "month" => 0, "day" => 0);

    $writ_rec = $temp[0];

    $temp_duration = 0;

    if (DateModules::CompareDate($toDate, $writ_rec['execute_date']) >= 0)
        $temp_duration = DateModules::GDateMinusGDate($toDate, $writ_rec['execute_date']);

    if ($writ_rec['annual_effect'] == HALF_COMPUTED)
        $temp_duration *= 0.5;
    else if ($writ_rec['annual_effect'] == DOUBLE_COMPUTED)
        $temp_duration *= 2;
    else if ($writ_rec['annual_effect'] == NOT_COMPUTED)
        $temp_duration = 0;

    $prev_writ_duration = DateModules::ymd_to_days($writ_rec['onduty_year'], $writ_rec['onduty_month'], $writ_rec['onduty_day']);

    $duration = $prev_writ_duration + $temp_duration;
    
       
    $return = array();
    DateModules::day_to_ymd($duration, $return['year'], $return['month'], $return['day']);

    return $return;
}
예제 #18
0
function BindCheckList($checkboxPrefix, $basicTypeId)
{
    $obj = new CHECKBOXLIST();
    $obj->datasource = PdoDataAccess::runquery("select * from Basic_Info where TypeID=" . $basicTypeId);
    $obj->idfield = $checkboxPrefix . "%InfoID%";
    $obj->valuefield = $checkboxPrefix . "%InfoID%";
    $obj->textfield = "%Title%";
    $obj->columnCount = 4;
    $obj->Allchecked = true;
    $obj->EnableCheckAllButton = true;
    return $obj->bind_checkboxlist();
}
예제 #19
0
 static function get_variable_info($varName = "", $person_type = "")
 {
     echo "eeeeeee";
     die;
     $query = "select * \r\n\t\t\t\t  from rapid.variables2 \r\n\t\t\t\t  where var_name='" . $varName . "' AND \r\n\t\t\t\t\t\tsysCode='" . $_SESSION["SystemCode"] . "' AND \r\n\t\t\t\t\t\tuname is NULL AND\r\n\t\t\t\t\t\tmname is Null";
     echo $query;
     $dt = PdoDataAccess::runquery($query);
     if (count($dt) == 0) {
         return false;
     }
     return $dt[0];
 }
예제 #20
0
 static function getValidPayments()
 {
     $DT = parent::runquery("select * from PaymentAccess where PersonID=?", array($_SESSION["PersonID"]));
     if (count($DT) == 0) {
         return "-1";
     }
     $str = "";
     for ($i = 0; $i < count($DT); $i++) {
         $str .= $DT[$i]["PaymentType"] . ",";
     }
     $str = substr($str, 0, strlen($str) - 1);
     return $str;
 }
예제 #21
0
function LoanReport()
{
    $BranchID = $_POST["BranchID"];
    $blockID = $_POST["BlockID"];
    $StartDate = $_POST["StartDate"];
    $EndDate = $_POST["EndDate"];
    $TafsiliID = $_POST["TafsiliID"];
    $where = "";
    $param = array($_SESSION["accounting"]["CycleID"], $blockID);
    if ($BranchID != "") {
        $where .= " AND BranchID =?";
        $param[] = $BranchID;
    }
    if ($TafsiliID != "") {
        $where .= " AND (TafsiliID=? or TafsiliID2=?)";
        $param[] = $TafsiliID;
        $param[] = $TafsiliID;
    }
    if ($StartDate != "") {
        $where .= " AND DocDate >=?";
        $param[] = DateModules::shamsi_to_miladi($StartDate, "-");
    }
    if ($EndDate != "") {
        $where .= " AND DocDate <=?";
        $param[] = DateModules::shamsi_to_miladi($EndDate, "-");
    }
    $dt = PdoDataAccess::runquery("\r\n\t\tselect cc.*,concat_ws(' - ',b1.BlockDesc,b2.BlockDesc,b3.BlockDesc) CostDesc,\r\n\t\t\t\tsum(CreditorAmount - DebtorAmount ) remain\r\n\t\tfrom ACC_DocItems di\r\n\t\t\tjoin ACC_docs using(DociD)\r\n\t\t\tjoin ACC_CostCodes cc using(CostID)\r\n\t\t\tjoin ACC_blocks b1 on(cc.level1=b1.BlockID)\r\n\t\t\tjoin ACC_blocks b2 on(cc.level2=b2.BlockID)\r\n\t\t\tleft join ACC_blocks b3 on(cc.level3=b3.BlockID)\r\n\t\t\t\r\n\t\twhere CycleID=? AND cc.level2 = ? " . $where . "\r\n\t\t\r\n\t\tgroup by di.CostID", $param);
    //print_r(ExceptionHandler::PopAllExceptions());
    function moneyRender($row, $val)
    {
        $BranchID = $_POST["BranchID"];
        $StartDate = $_POST["StartDate"];
        $EndDate = $_POST["EndDate"];
        $TafsiliID = $_POST["TafsiliID"];
        $params = "IncludeRaw=true&show=true";
        $params .= $BranchID != "" ? "&BranchID=" . $BranchID : "";
        $params .= $TafsiliID != "" ? "&TafsiliID=" . $TafsiliID : "";
        $params .= $row["level1"] != "" ? "&level1=" . $row["level1"] : "";
        $params .= $row["level2"] != "" ? "&level2=" . $row["level2"] : "";
        $params .= $row["level3"] != "" ? "&level3=" . $row["level3"] : "";
        $params .= $StartDate != "" ? "&fromDate=" . $StartDate : "";
        $params .= $EndDate != "" ? "&toDate=" . $EndDate : "";
        return "<a target=_blank href='../accounting/report/flow.php?" . $params . "'>" . number_format($val) . "</a>";
    }
    $rpg = new ReportGenerator();
    $rpg->mysql_resource = $dt;
    $col = $rpg->addColumn("کد حساب", "CostDesc");
    $col = $rpg->addColumn("مانده حساب", "remain", "moneyRender");
    $rpg->generateReport();
    die;
}
예제 #22
0
 function Edit()
 {
     $query = "update jobs set title = '" . $this->title . "' \n\t\t\t\t\t\t\t\twhere job_id= " . $this->job_id;
     $result = parent::runquery($query);
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_update;
     $daObj->MainObjectID = $this->job_id;
     $daObj->TableName = "jobs";
     $daObj->execute();
     return true;
 }
예제 #23
0
    static function GetAllDependencySupport($where = "", $whereParam = array(), $info = "")
    {
        $selectedItm = " ";
        $joinqry = " ";
        if ($info == "true") {
            $selectedItm = " , concat( bi4.title  ,' ',dsh.calc_year_from ) start_calc , concat(bi5.title ,' ',dsh.calc_year_to) end_calc ";
            $joinqry = "\tLEFT JOIN BaseInfo bi4 ON (dsh.calc_month_from = bi4.InfoID and bi4.TypeID = 41)\n\t\t\t\t\t\t    LEFT JOIN BaseInfo bi5 ON (dsh.calc_month_to = bi5.InfoID and bi5.TypeID = 41)\t";
            $where .= HRSystem == SalarySystem ? 'AND ( status=' . IN_SALARY . ' OR 
				                                           status=' . DELETE_IN_SALARY . ' OR status=' . DELETE_IN_EMPLOYEES . ')' : '';
        }
        $query = " SELECT \tdsh.PersonID,\n\t\t\t\t\t\t\t\t\tdsh.master_row_no,\n\t\t\t\t\t\t\t\t\tdsh.row_no,\n\t\t\t\t\t\t\t\t\tdsh.support_cause,\n\t\t\t\t\t\t\t\t\tbi1.InfoDesc support_cause_title ,\n\t\t\t\t\t\t\t\t\tbi2.InfoDesc insure_type_title,\n\t\t\t\t\t\t\t\t\tdsh.insure_type,\n\t\t\t\t\t\t\t\t\tdsh.from_date,\n\t\t\t\t\t\t\t\t\tdsh.to_date,\n\t\t\t\t\t\t\t\t\tdsh.status,\n\t\t\t\t\t\t\t\t\tdsh.calc_year_from,\n\t\t\t\t\t\t\t\t\tdsh.calc_year_to,\n\t\t\t\t\t\t\t\t\tdsh.calc_month_from,\n\t\t\t\t\t\t\t\t\tdsh.calc_month_to \n\t\t\t\t\t\t\t\t\t" . $selectedItm . "\n\n\t\t\t\t\t\t\t   from  HRM_person_dependent_supports dsh\n\t\t\t\t\t\t\t\t\t LEFT OUTER JOIN HRM_person_dependents pd ON (dsh.PersonID = pd.PersonID AND dsh.master_row_no = pd.row_no)\n\t\t\t\t\t\t\t\t\t LEFT OUTER JOIN HRM_persons p ON (pd.PersonID = p.PersonID)\n\t\t\t\t\t\t\t\t\t LEFT JOIN BaseInfo bi1 ON (dsh.support_cause = bi1.InfoID and bi1.TypeID = 63)\n\t\t\t\t\t\t\t\t\t LEFT JOIN BaseInfo bi2 ON (dsh.insure_type = bi2.InfoID and bi2.TypeID = 55)\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t " . $joinqry;
        $query .= $where != "" ? " where " . $where : "";
        $temp = PdoDataAccess::runquery($query, $whereParam);
        return $temp;
    }
function copyBylaw()
{
    $obj = new management_extra_bylaw();
    PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]);
    $reference_bylaw_id = $obj->bylaw_id;
    $obj->bylaw_id = null;
    $return = $obj->ADD();
    if (!$return) {
        echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString());
        die;
    }
    $query = "insert into managmnt_extra_bylaw_items\n\t\tselect " . $obj->bylaw_id . ",post_id,value from managmnt_extra_bylaw_items where bylaw_id=" . $reference_bylaw_id;
    PdoDataAccess::runquery($query);
    echo Response::createObjectiveResponse(true, "");
    die;
}
예제 #25
0
    private static function RecursiveMakeNode($row)
    {
        $returnVal = '"id":"' . $row["ColumnID"] . '",
					"text":"' . $row["colName"] . '",
					"fieldName":"' . $row["fieldName"] . '",';
        $dt = parent::runquery("select * from rp_columns where parentID=" . $row["ColumnID"]);
        if (count($dt) != 0) {
            $returnVal .= '"children":[';
            for ($j = 0; $j < count($dt); $j++) {
                $returnVal .= "{" . ReportGenerator::RecursiveMakeNode($dt[$j]) . "},";
            }
            $returnVal = substr($returnVal, 0, strlen($returnVal) - 1) . "]";
        } else {
            $returnVal .= '"leaf":true';
        }
        return $returnVal;
    }
예제 #26
0
 public function __construct($FacilityID, $ElementID = 0, $DeputyID = "", $ModuleID = "")
 {
     $db = parent::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
     if ($DeputyID != "" && $ModuleID != "") {
         $this->DeputyID = $DeputyID;
         $this->ModuleID = $ModuleID;
         $this->ElementID = $ElementID;
     } else {
         if (!empty($FacilityID)) {
             $query = "select * from SystemFacilities where FacilityID=?";
             $dt = parent::runquery($query, array($FacilityID), $db);
             if (parent::GetExceptionCount() != 0) {
                 return;
             }
             if (count($dt) == 0) {
                 return;
             }
             $this->DeputyID = $dt[0]["DeputyID"];
             $this->ModuleID = $dt[0]["ModuleID"];
             $this->ElementID = $ElementID;
         } else {
             return;
         }
     }
     $this->UserID = $_SESSION["User"]->UserID;
     $this->Roles = UserRole::GetUserRole($this->DeputyID, $this->UserID);
     if (parent::GetExceptionCount() != 0) {
         return;
     }
     $rolesStr = "-1";
     if (count($this->Roles) != 0) {
         for ($i = 0; $i < count($this->Roles); $i++) {
             $rolesStr .= "," . $this->Roles[$i]->UserRole;
         }
     }
     $query = "select DeputyID,ModuleID,ElementID,\r\n\t\t\t\t\t\tmax(AcInsert) as AcInsert,\r\n\t\t\t\t\t\tmax(AcFullUpdate) as AcFullUpdate,\r\n\t\t\t\t\t\tmax(AcUpdate) as AcUpdate,\r\n\t\t\t\t\t\tmax(AcFullDelete) as AcFullDelete,\r\n\t\t\t\t\t\tmax(AcDelete) as AcDelete\r\n\t\t\t\tfrom ModuleAccess\r\n\t\t\t\twhere (RoleID in({$rolesStr}) OR UserID=:uid)\r\n\t\t\t\t\tAND DeputyID=:did AND ModuleID=:mid AND ElementID=:eid\r\n\t\t\t\tgroup by DeputyID,ModuleID,ElementID";
     $dt = parent::runquery($query, array(":uid" => $this->UserID, ":did" => $this->DeputyID, ":mid" => $this->ModuleID, ":eid" => $this->ElementID), $db);
     if (parent::GetExceptionCount() != 0 || count($dt) == 0) {
         return;
     }
     $this->AcInsert = $dt[0]["AcInsert"] == 0 ? false : true;
     $this->AcFullUpdate = $dt[0]["AcFullUpdate"] == 0 ? false : true;
     $this->AcUpdate = $dt[0]["AcUpdate"] == 0 ? false : true;
     $this->AcFullDelete = $dt[0]["AcFullDelete"] == 0 ? false : true;
     $this->AcDelete = $dt[0]["AcDelete"] == 0 ? false : true;
 }
예제 #27
0
 static function Remove($bid)
 {
     $res = parent::runquery(" select count(*) cn from staff where bank_id = " . $bid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("حذف این رکورد امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("banks", "bank_id=:BID ", array(":BID" => $bid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $bid;
     $daObj->TableName = "banks";
     $daObj->execute();
     return true;
 }
예제 #28
0
 static function Remove($pid)
 {
     $res = parent::runquery(" select count(*) cn from SubtractItemInfo where arrangement = " . $pid);
     if ($res[0]['cn'] > 0) {
         parent::PushException("حذف این رکورد امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("priority", "PriorityID=:PID ", array(":PID" => $pid));
     if (!$result) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $pid;
     $daObj->TableName = "priority";
     $daObj->execute();
     return true;
 }
예제 #29
0
function not_assigned_items()
{
    $query = '
		SELECT s.salary_item_type_id,s.full_title
		FROM salary_item_types s
				LEFT OUTER JOIN writ_salary_items wsi ON(wsi.salary_item_type_id = s.salary_item_type_id AND wsi.writ_id = :wid AND wsi.writ_ver = :wver)
				,writs w 
		WHERE
			w.writ_id = :wid AND w.writ_ver = :wver AND w.staff_id = :stid AND
			(s.person_type = w.person_type OR s.person_type = ' . PERSON_TYPE_ALL . ' OR s.person_type = if(w.person_type != 1, 101,0)) AND
			s.compute_place = ' . SALARY_ITEM_COMPUTE_PLACE_WRIT . ' AND
			(s.user_data_entry = ' . USER_DATA_ENTRY . ' OR s.editable_value = 1) AND
			(s.validity_start_date IS NULL OR s.validity_start_date <= w.execute_date) AND
			(s.validity_end_date IS NULL OR s.validity_end_date = "0000-00-00" OR s.validity_end_date >= w.execute_date) AND
			wsi.salary_item_type_id IS NULL';
    $temp = PdoDataAccess::runquery($query, array(":wid" => $_GET["writ_id"], ":wver" => $_GET["writ_ver"], ":stid" => $_GET["staff_id"]));
    echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]);
    die;
}
예제 #30
0
 static function Remove($CostID)
 {
     $query = " select count(*) cn \r\n\t\t\t\tfrom writs \r\n\t\t\t\t    where  cost_center_id = " . $CostID;
     $res = parent::runquery($query);
     if ($res[0]['cn'] > 0) {
         parent::PushException("این مرکز هزینه در احکام ثبت گردیده است لذا حذف امکان پذیر نمی باشد.");
         return false;
     }
     $result = parent::delete("cost_centers", "cost_center_id=:CID ", array(":CID" => $CostID));
     if ($result === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $CostID;
     $daObj->TableName = "cost_centers";
     $daObj->execute();
     return true;
 }