コード例 #1
0
ファイル: change_pass.php プロジェクト: jafarkhani/rtfund
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;
}
コード例 #2
0
 function make_success_row($person_rec)
 {
     if (ExceptionHandler::GetExceptionCount() == 0) {
         $this->s_count++;
         fwrite($this->s_content, "\r\n\t\t\t<tr style='font-family:tahoma;font-size:11px;font-weight:bold;color:#1A58A6;border-bottom:solid 1px #1A58A6;'>\r\n\t            <td height=21px>شماره شناسايي :{$person_rec['staff_id']}</td>\r\n\t            <td>نام : {$person_rec['pfname']}</td>\r\n\t            <td>نام خانوادگي : {$person_rec['plname']}</td>\r\n\t            <td>شماره حکم : {$person_rec['writ_id']}</td>\r\n\t            </tr>");
     } else {
         self::make_unsuccess_rows($person_rec);
     }
 }
コード例 #3
0
ファイル: templates.class.php プロジェクト: jafarkhani/rtfund
 public function Remove($pdo = null)
 {
     $res = parent::runquery("select count(*) from CNT_contracts where TemplateID = ? limit 1", array($this->TemplateID), $pdo);
     if ($res[0]['count(*)'] > 0) {
         parent::runquery("update " . static::TableName . " set IsActive='NO' where TemplateID=?", array($this->TemplateID));
         return ExceptionHandler::GetExceptionCount() == 0;
     }
     parent::runquery("delete from CNT_TemplateItems where TemplateID=?", array($this->TemplateID), $pdo);
     return parent::Remove($pdo);
 }
コード例 #4
0
ファイル: staff_detasils.php プロジェクト: jafarkhani/rtfund
 static function remove($staff_id, $PersonID = "")
 {
     if ($staff_id != "") {
         $whereParam = array(":staff_id" => $staff_id);
         $return = PdoDataAccess::delete("staff_details", "staff_id=:staff_id", $whereParam);
         if ($return == "0") {
             return false;
         }
         $daObj = new DataAudit();
         $daObj->ActionType = DataAudit::Action_delete;
         $daObj->MainObjectID = $staff_id;
         $daObj->TableName = "staff_details";
         $daObj->execute();
         return true;
     }
     if ($PersonID != "") {
         $query = "delete sd\n\t\t\t\t\t\tfrom staff_details sd join staff s using(staff_id) where s.PersonID=?";
         PdoDataAccess::runquery($query, array($PersonID));
         if (ExceptionHandler::GetExceptionCount() != 0) {
             return false;
         }
         return true;
     }
 }
コード例 #5
0
ファイル: letter.data.php プロジェクト: jafarkhani/rtfund
function SaveMessage()
{
    $obj = new OFC_messages();
    PdoDataAccess::FillObjectByArray($obj, $_POST);
    $obj->PersonID = $_SESSION["USER"]["PersonID"];
    $obj->MsgDate = PDONOW;
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    if (!$obj->Add($pdo)) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "خطا در ایجاد پیام");
        die;
    }
    $receivers = json_decode($_POST["receivers"]);
    foreach ($receivers as $PersonID) {
        $obj2 = new OFC_MessageReceivers();
        $obj2->MessageID = $obj->MessageID;
        $obj2->PersonID = $PersonID;
        $obj2->Add($pdo);
    }
    if (ExceptionHandler::GetExceptionCount() != 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "خطا در ارسال پیام");
        die;
    }
    $pdo->commit();
    echo Response::createObjectiveResponse(true, "");
    die;
}
コード例 #6
0
ファイル: reportResult.php プロジェクト: jafarkhani/rtfund
$TotalQuery = $QUERY_SELECT;
$TotalQuery .= $rptobj->query;
$TotalQuery .= " where " . $QUERY_WHERE . " AND persons.person_type in(" . manage_access::getValidPersonTypes() . ")";
// bahar
$TotalQuery .= $QUERY_GROUP != "" ? " group by " . $QUERY_GROUP : "";
$TotalQuery .= $QUERY_ORDER != "" ? " order by " . $QUERY_ORDER : "";
if (!isset($_REQUEST["excel"])) {
    echo "<div style='display:none'>" . $TotalQuery . "<br>";
    print_r($whereParam);
    echo "</div>";
}
if (isset($_REQUEST["preview"])) {
    $TotalQuery .= " limit 10";
}
$statement = PdoDataAccess::runquery_fetchMode($TotalQuery, $whereParam);
if (ExceptionHandler::GetExceptionCount() != 0) {
    print_r(ExceptionHandler::PopAllExceptions());
}
if ($statement->rowCount() == 0) {
    $output = "<span  class='reportGenerator'>گزارش مورد نظر خالی می باشد.</span>";
} else {
    if ($rptobj->refer_page != "") {
        /*for($i=0; $i<count($data); $i++)
        		{
        			for($k=0; $k<count($columns); $k++)
        			{
        				if(in_array($columns[$k]["used_type"], array("group", "order", "separation", "formula_column", "condition", "filter")))
        					continue;
        
        				if($columns[$k]["renderer"] != "")
        				{
コード例 #7
0
ファイル: person.data.php プロジェクト: jafarkhani/rtfund
function importStudent()
{
    $dt = PdoDataAccess::runquery("select * from StudentPersonMap where StNo=?", array($_POST["StNo"]));
    if (count($dt) > 0) {
        echo Response::createObjectiveResponse(false, "Duplicate");
        die;
    }
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    $query = "insert into \n\t\tpersons(person_type,pfname,plname,efname,elname,father_name,idcard_no,birth_date,national_code,\n\t\t\t\tsex,address1,home_phone1,mobile_phone,email,comment)\n\t\tselect " . $_POST["person_type"] . ",PFName,PLName,EFName,ELName,DadName,BCN,BirthDate,NID,\n\t\t\t\tsex,address1,PhoneNo,mobile,EMail,concat('انتقال اطلاعات دانشجو با شماره دانشجویی', StNo)\n\t\tfrom students where StNo=?";
    PdoDataAccess::runquery($query, array($_POST["StNo"]), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "1");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    //--------------------------------------------------------------------------
    $personID = PdoDataAccess::InsertID();
    $staff_id = PdoDataAccess::GetLastID("staff", "staff_id", "", array(), $pdo) + 1;
    PdoDataAccess::runquery("insert into staff(staff_id,PersonID,person_type) \n\t\t\tvalues({$staff_id}, {$personID}, " . $_POST["person_type"] . ")", array(), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "2");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    //--------------------------------------------------------------------------
    $query = "insert into StudentPersonMap\tvalues({$personID}," . $_POST["StNo"] . ")";
    PdoDataAccess::runquery($query, array(), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        //print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "5");
        die;
    }
    //--------------------------------------------------------------------------
    $query = "select RFID from educ.StudentSpecs where StNo=?";
    $dt = PdoDataAccess::runquery($query, array($_POST["StNo"]), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "3");
        //print_r(ExceptionHandler::PopAllExceptions());
        die;
    }
    if (count($dt) > 0 && $dt[0][0] != "") {
        $id = PdoDataAccess::GetLastID("pas.PersonSettings", "PersonSettingsID");
        $query = "insert into pas.PersonSettings(PersonSettingsID,PersonID,CardStatus,CardNumber,WorkGroupID,CalendarID)\n\t\t\tvalues(" . ($id + 1) . ",{$personID},'ENABLE',NULL,0,0)";
        PdoDataAccess::runquery($query, array(), $pdo);
        if (ExceptionHandler::GetExceptionCount() > 0) {
            $pdo->rollBack();
            print_r(ExceptionHandler::PopAllExceptions());
            echo Response::createObjectiveResponse(false, "4");
            die;
        }
    }
    //--------------------------------------------------------------------------
    $pdo->commit();
    $result = ExceptionHandler::GetExceptionCount() == 0 ? "true" : "false";
    echo Response::createObjectiveResponse($result, "");
    die;
}
コード例 #8
0
ファイル: writ.class.php プロジェクト: jafarkhani/rtfund
 /**
  * اين تابع وضعيت حکم را تغيير مي دهد
  * اگر در تاريخ اجراي حکم، احکام ديگري با وضعيت جديد وجود داشته باشند ثبت سابقه می شوند
  * اگر در تاريخ اجراي حکم، احکام ديگري با وضعيت قبلي وجود داشته باشند که ثبت سابقه هستند فعال می شوند
  */
 static function change_writ_state($old_state, $new_state, $writ_id, $writ_ver, $staff_id, $execute_date, $DB = "")
 {
     if ($DB == "") {
         $pdo = PdoDataAccess::getPdoObject();
         /*@var $pdo PDO*/
         $pdo->beginTransaction();
     } else {
         $pdo = $DB;
     }
     if ($old_state > $new_state) {
         //_______________________________________________
         // تغيير وضعيت حکم
         $query = "UPDATE HRM_writs\n\t\t\t\t\t\tSET state = " . $new_state . "\n\t\t\t\t\t\tWHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
         PdoDataAccess::runquery($query, array());
         //..................................................
         if ($new_state == 2) {
             $qry = " UPDATE HRM_writs\n                                SET writ_recieve_date = NULL\n                        WHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
             PdoDataAccess::runquery($qry, array());
         }
         if ($new_state == 1) {
             $qry = " UPDATE HRM_writs\n                                SET writ_transfer_date = NULL\n                        WHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
             PdoDataAccess::runquery($qry, array());
         }
         //..................................................
         if (ExceptionHandler::GetExceptionCount() != 0) {
             if ($DB == "") {
                 $pdo->rollBack();
             }
             return false;
         }
         //_______________________________________________
         // فعال کردن نسخه قبلي حکم
         $query = "UPDATE HRM_writs\n\t\t\t\t\t\tSET history_only=0\n\t\t\t\t\t\tWHERE staff_id=" . $staff_id . "\n\t\t\t\t\t\t\t  AND execute_date='" . $execute_date . "'\n\t\t\t\t\t\t\t  AND state=" . $old_state . "\n\t\t\t\t\t\t\t  AND (writ_id=" . $writ_id . " OR writ_ver<" . $writ_ver . ")";
         PdoDataAccess::runquery($query, array());
         if (ExceptionHandler::GetExceptionCount() != 0) {
             if ($DB == "") {
                 $pdo->rollBack();
             }
             return false;
         }
         if (PdoDataAccess::AffectedRows() != 0) {
             if ($DB == "") {
                 $pdo->commit();
             }
             return true;
         }
         //_______________________________________________
         //پيدا کردن حکم قبلی و فعال کردن آن
         $query = "SELECT writ_id , writ_ver , staff_id\n\t\t\t\t\t\tFROM writs\n\t\t\t\t\t\tWHERE \tstaff_id = " . $staff_id . "\n\t\t\t\t\t\t\t\tAND execute_date = '" . $execute_date . "'\n\t\t\t\t\t\t\t\tAND corrective = 0\n\t\t\t\t\t\t\t\tAND state = " . $old_state . "\n\t\t\t\t\t\t\t\tAND (writ_id <> " . $writ_id . ")\n\t\t\t\t\t\tORDER BY writ_id DESC , writ_ver DESC";
         $temp = PdoDataAccess::runquery($query, array());
         if (count($temp) != 0) {
             $query = "UPDATE writs\n\t\t\t\t\t\t\tSET history_only = 0\n\t\t\t\t\t\t\tWHERE writ_id = :wid AND writ_ver = :wver AND staff_id = :stid";
             PdoDataAccess::runquery($query, array(":wid" => $temp[0]["writ_id"], ":wver" => $temp[0]["writ_ver"], ":stid" => $temp[0]["staff_id"]));
             if (ExceptionHandler::GetExceptionCount() != 0) {
                 if ($DB == "") {
                     $pdo->rollBack();
                 }
                 return false;
             }
         }
         if ($DB == "") {
             $pdo->commit();
         }
     } else {
         $temp = PdoDataAccess::runquery("SELECT staff_id , writ_id , writ_ver , execute_date\n\t\t\t\tFROM writs\n\t\t\t\tWHERE (history_only=0 OR history_only IS NULL)\n \t\t\t    \tAND (dont_transfer = 0 OR dont_transfer IS NULL)\n  \t\t\t    \tAND (correct_completed !=" . WRIT_CORRECTING . ")\n  \t\t\t     \tAND writ_id=" . $writ_id . " AND writ_ver=" . $writ_ver . " AND staff_id=" . $staff_id);
         if (count($temp) == 0) {
             if ($DB == "") {
                 $pdo->commit();
             }
             return true;
         }
         $return = PdoDataAccess::runquery("update writs set state=" . $new_state . " where writ_id=" . $writ_id . " AND writ_ver=" . $writ_ver . " AND staff_id=" . $staff_id);
         //..................................................
         if ($new_state == 2) {
             $qry = " UPDATE writs\n                                SET writ_transfer_date = now()\n                        WHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
             PdoDataAccess::runquery($qry, array());
         }
         if ($new_state == 3) {
             $qry = " UPDATE writs\n                                SET writ_recieve_date =  now()\n                        WHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
             PdoDataAccess::runquery($qry, array());
             //......................بررسی جهت خالی کردن مرکز هزینه ..............
             $obj = new manage_writ($writ_id, $writ_ver, $staff_id);
             $PrevItm = $obj->get_prior_writ("", true);
             if ($PrevItm == 0 && manage_writ_item::compute_writ_items_sum($writ_id, $writ_ver, $staff_id) > 0) {
                 $qry = " UPDATE writs\n                                SET cost_center_id = null\n                        WHERE writ_id=" . $writ_id . " AND\n\t\t\t\t\t\t\t  writ_ver=" . $writ_ver . " AND\n\t\t\t\t\t\t\t  staff_id=" . $staff_id;
                 PdoDataAccess::runquery($qry, array());
             }
             //......................
         }
         //..................................................
         if (ExceptionHandler::GetExceptionCount() != 0) {
             if ($DB == "") {
                 $pdo->rollBack();
             }
             return false;
         }
         $return = PdoDataAccess::runquery("UPDATE writs\n\t\t\t\tSET history_only=1\n\t\t\t\tWHERE staff_id = " . $temp[0]["staff_id"] . " AND\n\t\t\t\t\t\texecute_date = '" . $temp[0]["execute_date"] . "' AND\n\t\t\t\t\t\t((writ_id = " . $temp[0]["writ_id"] . " AND " . $temp[0]["writ_ver"] . ">writ_ver) OR\n\t\t\t\t\t\t\t" . $temp[0]["writ_id"] . ">writ_id) AND\n\t\t\t\t\t\t(history_only=0 OR history_only IS NULL) AND state =" . $new_state);
         if (ExceptionHandler::GetExceptionCount() != 0) {
             if ($DB == "") {
                 $pdo->rollBack();
             }
             return false;
         }
         if ($DB == "") {
             $pdo->commit();
         }
         return true;
     }
     return true;
 }
コード例 #9
0
ファイル: persons.data.php プロジェクト: jafarkhani/rtfund
function changePass()
{
    $dt = PdoDataAccess::runquery("select * from BSC_persons where PersonID=:p", array(":p" => $_SESSION['USER']["PersonID"]));
    if (count($dt) == 0) {
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    $hash_cost_log2 = 8;
    $hasher = new PasswordHash($hash_cost_log2, true);
    if (!$hasher->CheckPassword($_POST["cur_pass"], $dt[0]["UserPass"])) {
        echo Response::createObjectiveResponse(false, "CurPassError");
        die;
    }
    PdoDataAccess::RUNQUERY("update BSC_persons set UserPass=? where PersonID=?", array($hasher->HashPassword($_POST["new_pass"]), $_SESSION["USER"]["PersonID"]));
    if (ExceptionHandler::GetExceptionCount() != 0) {
        echo Response::createObjectiveResponse(false, "CurPassError");
        die;
    }
    echo Response::createObjectiveResponse(true, "");
    die;
}
コード例 #10
0
 function make_unsuccess_rows($person_rec)
 {
     $this->u_count++;
     fwrite($this->u_content, "\r\n\t\t\t<tr style='font-family:tahoma;font-size:11px;font-weight:bold;color:#1A58A6;border-bottom:solid 1px #1A58A6;'>\r\n\t            <td height=21px>شماره خطا </td>\r\n\t            <td>شماره شناسايي :{$person_rec['staff_id']}</td>\r\n\t            <td>نام : {$person_rec['pfname']}</td>\r\n\t            <td>نام خانوادگي : {$person_rec['plname']}</td>\r\n\t            <td>شماره حکم : {$person_rec['writ_id']}</td>\r\n\t            </tr>");
     $i = 0;
     while (ExceptionHandler::GetExceptionCount() != 0) {
         $i++;
         fwrite($this->u_content, "<tr>\r\n\t\t\t\t\t<td height=21px style='font-family:tahoma;font-size:11px;color:red'>{$i}</td>\r\n\t\t\t\t\t<td colspan='4' style='font-family:tahoma;font-size:12px;color:red'>" . ExceptionHandler::popExceptionDescription() . "</td>\r\n                  </tr>");
     }
 }
コード例 #11
0
ファイル: wfm.class.php プロジェクト: jafarkhani/rtfund
 static function EndObjectFlow($FlowID, $ObjectID, $pdo = null)
 {
     switch ($FlowID * 1) {
         case 3:
             $EndStepID = 105;
             PdoDataAccess::runquery("update PLN_plans set StepID=? where PlanID=?", array($EndStepID, $ObjectID), $pdo);
             return ExceptionHandler::GetExceptionCount() == 0;
         case 4:
             $EndStepID = 110;
             PdoDataAccess::runquery("update WAR_requests set StatusID=? where RequestID=?", array($EndStepID, $ObjectID), $pdo);
             return ExceptionHandler::GetExceptionCount() == 0;
     }
     return true;
 }
コード例 #12
0
ファイル: operation.data.php プロジェクト: jafarkhani/rtfund
function SaveOperation()
{
    $obj = new NTC_operations();
    PdoDataAccess::FillObjectByArray($obj, $_POST);
    $obj->GroupLetter = isset($_POST["GroupLetter"]) ? "YES" : "NO";
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    if (empty($obj->OperationID)) {
        $obj->OperationDate = PDONOW;
        $result = $obj->Add($pdo);
    } else {
        $result = $obj->Edit($pdo);
    }
    require_once "phpExcelReader.php";
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["PersonFile"]["tmp_name"]);
    for ($i = 0; $i < $data->sheets[0]['numRows']; $i++) {
        if (!empty($data->sheets[0]['cells'][$i][0])) {
            $PersonID = $data->sheets[0]['cells'][$i][0];
            $dt = PdoDataAccess::runquery("select PersonID from BSC_persons where PersonID=?", array($PersonID));
            if (count($dt) > 0) {
                $PersonObj = new NTC_persons();
                $PersonObj->OperationID = $obj->OperationID;
                $PersonObj->PersonID = $PersonID;
                for ($j = 1; $j < count($data->sheets[0]['cells'][$i]); $j++) {
                    eval("\$PersonObj->col{$j} = '" . $data->sheets[0]['cells'][$i][$j] . "';");
                }
                $PersonObj->Add($pdo);
            }
        }
    }
    $dt = NTC_persons::Get(" AND OperationID=?", array($obj->OperationID), $pdo);
    if ($dt->rowCount() == 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "در فایل ارسالی هیچ فرد معتبری یافت نشد");
        die;
    }
    $dt = $dt->fetchAll();
    //----------- create letter -------------
    if ($obj->SendType == "LETTER" && $obj->GroupLetter == "YES") {
        $LetterObj = new OFC_letters();
        $LetterObj->LetterType = "INNER";
        $LetterObj->LetterTitle = $obj->title;
        $LetterObj->LetterDate = PDONOW;
        $LetterObj->RegDate = PDONOW;
        $LetterObj->PersonID = $_SESSION["USER"]["PersonID"];
        $LetterObj->context = $obj->context;
        if (!$LetterObj->AddLetter($pdo)) {
            ExceptionHandler::PushException("خطا در ثبت  نامه");
        }
    }
    //---------------------------------------
    foreach ($dt as $row) {
        $context = $obj->context;
        for ($i = 1; $i < 10; $i++) {
            $context = preg_replace("/\\[col" . $i . "\\]/", $row["col" . $i], $context);
        }
        switch ($obj->SendType) {
            case "SMS":
                break;
                //------------------------------------------------------------------
            //------------------------------------------------------------------
            case "EMAIL":
                $email = $row["email"];
                if ($email == "") {
                    ExceptionHandler::PushException("فاقد ایمیل");
                    continue;
                }
                $result = SendEmail($email, $obj->title, $context);
                if (!$result) {
                    ExceptionHandler::PushException("خطا در ارسال ایمیل");
                }
                break;
                //------------------------------------------------------------------
            //------------------------------------------------------------------
            case "LETTER":
                if ($obj->GroupLetter == "NO") {
                    $LetterObj = new OFC_letters();
                    $LetterObj->LetterType = "INNER";
                    $LetterObj->LetterTitle = $obj->title;
                    $LetterObj->LetterDate = PDONOW;
                    $LetterObj->RegDate = PDONOW;
                    $LetterObj->PersonID = $_SESSION["USER"]["PersonID"];
                    $LetterObj->context = $context;
                    $LetterObj->AddLetter($pdo);
                    $SendObj = new OFC_send();
                    $SendObj->LetterID = $LetterObj->LetterID;
                    $SendObj->FromPersonID = $LetterObj->PersonID;
                    $SendObj->ToPersonID = $row["PersonID"];
                    $SendObj->SendDate = PDONOW;
                    $SendObj->SendType = 1;
                    if (!$SendObj->AddSend($pdo)) {
                        ExceptionHandler::PushException("خطا در ثبت  نامه");
                    }
                } else {
                    $Cobj = new OFC_LetterCustomers();
                    $Cobj->LetterID = $LetterObj->LetterID;
                    $Cobj->PersonID = $row["PersonID"];
                    $Cobj->IsHide = "NO";
                    $Cobj->LetterTitle = $obj->title;
                    if (!$Cobj->Add($pdo)) {
                        ExceptionHandler::PushException("خطا در ثبت ذینفع نامه");
                    }
                }
                break;
                //------------------------------------------------------------------
        }
        if (ExceptionHandler::GetExceptionCount() == 0) {
            $PObj = new NTC_persons();
            $PObj->RowID = $row["RowID"];
            $PObj->IsSuccess = "YES";
            if ($obj->SendType == "LETTER") {
                $PObj->LetterID = $LetterObj->LetterID;
            }
            $PObj->Edit($pdo);
        }
    }
    $pdo->commit();
    //print_r(ExceptionHandler::PopAllExceptions());
    echo Response::createObjectiveResponse($result, ExceptionHandler::GetExceptionsToString());
    die;
}
コード例 #13
0
ファイル: import.data.php プロジェクト: jafarkhani/rtfund
function EndWarrantyDoc($ReqObj, $pdo)
{
    /*@var $ReqObj WAR_requests */
    //------------- get CostCodes --------------------
    $CostCode_warrenty = FindCostID("300");
    $CostCode_warrenty_commitment = FindCostID("700");
    $CostCode_wage = FindCostID("750-07");
    $CostCode_FutureWage = FindCostID("760-07");
    $CostCode_fund = FindCostID("100");
    $CostCode_seporde = FindCostID("690");
    $CostCode_pasandaz = FindCostID("209-10");
    $CostCode_guaranteeAmount_zemanati = FindCostID("904-02");
    $CostCode_guaranteeAmount_daryafti = FindCostID("904-04");
    $CostCode_guaranteeAmount2_zemanati = FindCostID("905-02");
    $CostCode_guaranteeAmount2_daryafti = FindCostID("905-04");
    //------------------------------------------------
    $CycleID = substr(DateModules::miladi_to_shamsi($ReqObj->StartDate), 0, 4);
    //------------------ find tafsilis ---------------
    $PersonTafsili = FindTafsiliID($ReqObj->PersonID, TAFTYPE_PERSONS);
    if (!$PersonTafsili) {
        ExceptionHandler::PushException("تفصیلی مربوطه یافت نشد.[" . $ReqObj->PersonID . "]");
        return false;
    }
    //---------------- add doc header --------------------
    $DocObj = new ACC_docs();
    $DocObj->RegDate = PDONOW;
    $DocObj->regPersonID = $_SESSION['USER']["PersonID"];
    $DocObj->DocDate = PDONOW;
    $DocObj->CycleID = $CycleID;
    $DocObj->BranchID = $ReqObj->BranchID;
    $DocObj->DocType = DOCTYPE_WARRENTY_END;
    $DocObj->description = "خاتمه ضمانت نامه " . $ReqObj->_TypeDesc . " به شماره " . $ReqObj->RequestID . " به نام " . $ReqObj->_fullname;
    if (!$DocObj->Add($pdo)) {
        ExceptionHandler::PushException("خطا در ایجاد سند");
        return false;
    }
    //----------------- add Doc items ------------------------
    $itemObj = new ACC_DocItems();
    $itemObj->DocID = $DocObj->DocID;
    $itemObj->TafsiliType = TAFTYPE_PERSONS;
    $itemObj->TafsiliID = $PersonTafsili;
    $itemObj->SourceType = DOCTYPE_WARRENTY_END;
    $itemObj->SourceID = $ReqObj->RequestID;
    $itemObj->SourceID2 = $ReqObj->ReqVersion;
    $itemObj->locked = "YES";
    $itemObj->CostID = $CostCode_warrenty;
    $itemObj->CreditorAmount = $ReqObj->amount;
    $itemObj->DebtorAmount = 0;
    if (!$itemObj->Add($pdo)) {
        ExceptionHandler::PushException("خطا در ثبت ردیف ضمانت نامه");
        return false;
    }
    unset($itemObj->ItemID);
    $itemObj->CostID = $CostCode_warrenty_commitment;
    $itemObj->CreditorAmount = 0;
    $itemObj->DebtorAmount = $ReqObj->amount;
    if (!$itemObj->Add($pdo)) {
        ExceptionHandler::PushException("خطا در ثبت ردیف تعهد ضمانت نامه");
        return false;
    }
    //---------------------------- block Cost ----------------------------
    if ($ReqObj->IsBlock == "YES") {
        $dt = PdoDataAccess::runquery("select * from ACC_blocks where SourceType=? AND SourceID=?", array(DOCTYPE_WARRENTY, $ReqObj->RequestID));
        if (count($dt) > 0) {
            $blockObj = new ACC_CostBlocks($dt[0]["BlockID"]);
            $blockObj->IsActive = "NO";
            $blockObj->Edit($pdo);
        }
    }
    //---------- ردیف های تضمین  ----------
    $SumAmount = 0;
    $countAmount = 0;
    $dt = PdoDataAccess::runquery("\r\n\t\tSELECT DocumentID, ParamValue, InfoDesc as DocTypeDesc\r\n\t\t\tFROM DMS_DocParamValues\r\n\t\t\tjoin DMS_DocParams using(ParamID)\r\n\t\t\tjoin DMS_documents d using(DocumentID)\r\n\t\t\tjoin BaseInfo b on(InfoID=d.DocType AND TypeID=8)\r\n\t\t\tleft join ACC_DocItems on(SourceType=" . DOCTYPE_DOCUMENT . " AND SourceID=DocumentID)\r\n\t\twhere ItemID is null AND b.param1=1 AND \r\n\t\t\tparamType='currencyfield' AND ObjectType='warrenty' AND ObjectID=?", array($ReqObj->RequestID), $pdo);
    foreach ($dt as $row) {
        unset($itemObj->ItemID);
        $itemObj->CostID = $CostCode_guaranteeAmount_zemanati;
        $itemObj->DebtorAmount = 0;
        $itemObj->CreditorAmount = $row["ParamValue"];
        $itemObj->TafsiliType = TAFTYPE_PERSONS;
        $itemObj->TafsiliID = $PersonTafsili;
        $itemObj->SourceType = DOCTYPE_DOCUMENT;
        $itemObj->SourceID = $row["DocumentID"];
        $itemObj->details = $row["DocTypeDesc"];
        $itemObj->Add($pdo);
        $SumAmount += $row["ParamValue"] * 1;
        $countAmount++;
    }
    if ($SumAmount > 0) {
        unset($itemObj->ItemID);
        unset($itemObj->TafsiliType);
        unset($itemObj->TafsiliID);
        unset($itemObj->details);
        $itemObj->CostID = $CostCode_guaranteeAmount2_zemanati;
        $itemObj->DebtorAmount = $SumAmount;
        $itemObj->CreditorAmount = 0;
        $itemObj->Add($pdo);
    }
    if (ExceptionHandler::GetExceptionCount() > 0) {
        return false;
    }
    return $DocObj->DocID;
}
コード例 #14
0
ファイル: payment.data.php プロジェクト: jafarkhani/rtfund
function registerDoc()
{
    require_once '../../../../accountancy/import/salary/salary.class.php';
    $AccDocObj = new ImportSalary($_POST["pay_year"], $_POST["pay_month"]);
    if ($AccDocObj->InitialImportance($_POST["PersonType"] == "contract") === false) {
        echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("<br>"));
        die;
    }
    $query = "\t\n\t\tselect  c.CostCenterID,\n\t\t\t\tc.Title,\n\t\t\t\tsit.CostID,\n\t\t\t\tsit.CostType,\n\t\t\t\tcase s.person_type when 1 then if(w.emp_state=11, 'ConditionalProf', 'Prof')\n\t\t\t\t\t\t\t\t   when 2 then 'Staff'\n\t\t\t\t\t\t\t\t   when 3 then 'Worker'\n\t\t\t\t\t\t\t\t   when 5 then 'Contract' end PersonType, \n\t\t\t\ts.last_retired_pay,\n\t\t\t\tw.emp_state,\n\t\t\t\tc.AccUnitID,\t\t\t\t\n\t\t\t\tpit.salary_item_type_id,\n\t\t\t\tsum(pit.pay_value) pay_value,\n\t\t\t\tsum(pit.diff_value_coef * pit.diff_pay_value) diff_pay_value,\n\t\t\t\tsum(param7) param7,\n\t\t\t\tsum(diff_param7_coef * diff_param7) diff_param7,\n\t\t\t\tsum(param2) param2,\n\t\t\t\tsum(diff_param2_coef * diff_param2) diff_param2,\n\t\t\t\tsum(param3) param3,\n\t\t\t\tsum(diff_param3_coef * diff_param3) diff_param3\n\t\t\t\t\n\t\tFROM payments p \n\t\t\tJOIN staff s ON s.staff_id = p.staff_id\n\t\t\tJOIN writs w\n\t\t\t\tON(p.writ_id = w.writ_id AND\n\t\t\t\t   p.writ_ver = w.writ_ver AND\n\t\t\t\t   p.staff_id = w.staff_id AND w.state=3)\n\n\t\t\tJOIN payment_items pit \n\t\t\t\tON(p.pay_year = pit.pay_year AND p.pay_month = pit.pay_month AND\n\t\t\t\t   p.staff_id = pit.staff_id AND p.payment_type = pit.payment_type)\n\n\t\t\tJOIN persons per ON (per.personid = s.personid )\n\t\t\tJOIN banks b ON b.bank_id = p.bank_id\n\t\t\tJOIN CostCenterPlan c ON c.CostCenterID = w.CostCenterID\n\t\t\tJOIN salary_item_types sit using(salary_item_type_id)\n\t\t\t\n\t\tWHERE p.pay_year = :py and p.pay_month = :pm and p.payment_type = 1 \n\t\t\tand s.person_type in(" . ($_POST["PersonType"] == "contract" ? "5" : "1,2,3") . ") AND sit.CostID>0\n\n\t\tgroup by c.CostCenterID , s.person_type , p.payment_type , pit.salary_item_type_id\n\t\torder by c.CostCenterID,pit.salary_item_type_id";
    $dt = PdoDataAccess::runquery_fetchMode($query, array(":py" => $_POST["pay_year"], ":pm" => $_POST["pay_month"]));
    $AccError = "";
    while ($row = $dt->fetch()) {
        $amount = 0;
        switch ($row["salary_item_type_id"]) {
            case 44:
                if ($row["PersonType"] == "ConditionalProf") {
                    $row["CostID"] = 19023;
                }
                $amount = $row["pay_value"] + $row["diff_pay_value"];
                break;
                //..................................................................
            //..................................................................
            case 143:
            case 38:
                $coef_dolat = 1.7 / 1.65;
                $amount = $row["param7"] + $row["diff_param7"] + ($row["param7"] + $row["diff_param7"]) * $coef_dolat;
                break;
                //..................................................................
            //..................................................................
            case 9920:
            case 144:
                $amount = $row["param2"] + $row["diff_param2"];
                break;
            case 145:
                $amount = $row["param2"] + $row["diff_param2"] + $row["param3"] + $row["diff_param3"];
                break;
            case 744:
                $amount = $row["param2"] + $row["diff_param2"];
                break;
                //..................................................................
            //..................................................................
            case 149:
            case 150:
            case 750:
                $amount = $row["param3"] + $row["diff_param3"];
                break;
                //..................................................................
            //..................................................................
            case 9931:
                if ($row["PersonType"] == "Staff" || $row["PersonType"] == "Contract") {
                    $row["CostID"] = 341;
                }
                if ($row["PersonType"] == "Worker") {
                    $row["CostID"] = 342;
                }
                $amount = $row["pay_value"] + $row["diff_pay_value"];
                break;
                //..................................................................
            //..................................................................
            default:
                $amount = $row["pay_value"] + $row["diff_pay_value"];
        }
        $AccDocObj->AddItem($row["AccUnitID"], $row["CostID"], $amount, $row["PersonType"]);
        if (ExceptionHandler::GetExceptionCount() > 0) {
            $AccError .= "مرکز هزینه : " . $row["Title"] . "<br><hr><br>";
            $AccError .= "<span style=color:red><h3>" . ExceptionHandler::GetExceptionsToString("<br>") . "</h3></span>";
        }
        ExceptionHandler::PopAllExceptions();
    }
    $AccDocObj->CommitImportance();
    echo Response::createObjectiveResponse($AccError == "", $AccError);
    die;
}
コード例 #15
0
ファイル: vote.data.php プロジェクト: jafarkhani/rtfund
function SaveFilledForm()
{
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    PdoDataAccess::runquery("insert into VOT_FilledForms values(?,?," . PDONOW . ")", array($_POST["FormID"], $_SESSION["USER"]["PersonID"]), $pdo);
    $arr = array_keys($_POST);
    for ($i = 0; $i < count($arr); $i++) {
        if (strpos($arr[$i], "elem_") === false) {
            continue;
        }
        $ItemID = str_replace("elem_", "", $arr[$i]);
        $value = $_POST[$arr[$i]];
        PdoDataAccess::runquery("insert into VOT_FilledItems values(?,?,?,?)", array($_POST["FormID"], $_SESSION["USER"]["PersonID"], $ItemID, $value), $pdo);
    }
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    $pdo->commit();
    echo Response::createObjectiveResponse(true, "");
    die;
}
コード例 #16
0
ファイル: cheques.data.php プロジェクト: jafarkhani/rtfund
function ReturnLatestOperation($returnMode = false)
{
    $OuterObj = new ACC_IncomeCheques($_POST["IncomeChequeID"]);
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    $dt = PdoDataAccess::runquery("select max(DocID) docID from ACC_DocItems di\r\n\t\twhere SourceType=" . DOCTYPE_INCOMERCHEQUE . " AND SourceID=?", array($OuterObj->IncomeChequeID), $pdo);
    $DocID = $dt[0][0];
    if ($DocID > 0) {
        $temp = PdoDataAccess::runquery("select TafsiliID2 from ACC_DocItems where DocID<>? AND \r\n\t\tSourceType=? AND SourceID=? order by DocID desc", array($DocID, DOCTYPE_INCOMERCHEQUE, $OuterObj->IncomeChequeID));
        $OuterObj->ChequeStatus = count($temp) > 0 ? $temp[0][0] : INCOMECHEQUE_NOTVOSUL;
        PdoDataAccess::runquery("delete from ACC_DocItems \r\n\t\t\twhere DocID=? AND SourceType=" . DOCTYPE_INCOMERCHEQUE . " AND SourceID=?", array($DocID, $OuterObj->IncomeChequeID), $pdo);
        PdoDataAccess::runquery("delete from ACC_DocItems \r\n\t\t\twhere DocID=? AND CostID=?", array($DocID, COSTID_Bank), $pdo);
        PdoDataAccess::runquery("delete d from ACC_docs d left join ACC_DocItems using(DocID)\r\n\t\t\twhere DocID=? AND ItemID is null", array($DocID), $pdo);
    } else {
        $OuterObj->ChequeStatus = INCOMECHEQUE_NOTVOSUL;
    }
    $OuterObj->Edit($pdo);
    //..................................................
    ACC_IncomeCheques::AddToHistory($OuterObj->IncomeChequeID, $OuterObj->ChequeStatus, $pdo);
    //..................................................
    $dt = $OuterObj->GetBackPays($pdo);
    foreach ($dt as $row) {
        $PayObj = new LON_BackPays($row["BackPayID"]);
        ReturnCustomerPayDoc($PayObj, $pdo);
    }
    //..................................................
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "خطا در برگشت");
        die;
    }
    $pdo->commit();
    if ($returnMode) {
        return true;
    }
    echo Response::createObjectiveResponse(true, "");
    die;
}
コード例 #17
0
ファイル: plan_report.php プロジェクト: jafarkhani/rtfund
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["OrgInsurance"], round($r_bimeh_dastgah), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["GovInsurance"], $r_bimeh_dolat, $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["27"], ($r_made_kharej_Az_shomool27 + $ExtraRoozMozd), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["38"], ($r_made_kharej_Az_shomool38 + $ExtraRoozMozd), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["extra"], $r_jazb_omana, $ACC_pt);

		$ACC_pt = ImportSalary::PERSON_TYPE_Contract;
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["salary"], $gh_hoghoogh, $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["overtime"], $gh_ezafeKar + $OverTimeGharardadi, $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["OrgInsurance"], round($gh_bimeh_dastgah), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["GovInsurance"], $gh_bimeh_dolat, $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["27"], ($gh_made_kharej_Az_shomool27 + $ExtraGharardadi), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["38"], ($gh_made_kharej_Az_shomool38 + $ExtraGharardadi), $ACC_pt);
		$AccDocObj->AddItem($ACC_UnitID, $CostCodesArray[$ACC_pt]["extra"], $gh_jazb_omana, $ACC_pt);

		if(ExceptionHandler::GetExceptionCount() > 0)
		{
			echo "مرکز هزینه : " . $title . "<br><hr><br>";
			echo "<span style=color:red><h3>" . ExceptionHandler::GetExceptionsToString ("<br>") . "</h3></span>";
			$AccError = true;
		}
		ExceptionHandler::PopAllExceptions();
	}
	//</editor-fold>

	echo '<tr>
			<td>علمی مشروط</td>
			<td>' . $mp_hoghoogh . '</td>
			<td>' . ($mp_ezafeKar + $OverTimeMProf) . '</td>
			<td>' . round($mp_bimeh_dastgah) . '</td>
			<td>' . $mp_bimeh_dolat . '</td>
コード例 #18
0
ファイル: dms.data.php プロジェクト: jafarkhani/rtfund
function DeleteDocType()
{
    PdoDataAccess::runquery("update BaseInfo set IsActive='NO' \r\n\t\twhere TypeID=? AND InfoID=?", array($_REQUEST["TypeID"], $_REQUEST["InfoID"]));
    echo Response::createObjectiveResponse(ExceptionHandler::GetExceptionCount() == 0, "");
    die;
}
コード例 #19
0
ファイル: baseinfo.class.php プロジェクト: jafarkhani/rtfund
 static function DeleteAccount($AccountID)
 {
     parent::runquery("update ACC_accounts set IsActive='NO' where AccountID=?", array($AccountID));
     if (ExceptionHandler::GetExceptionCount() != 0) {
         return false;
     }
     parent::runquery("update ACC_tafsilis set IsActive='NO' where TafsiliType=3 \n\t\t\tAND ObjectID=?", array($AccountID));
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_delete;
     $daObj->MainObjectID = $AccountID;
     $daObj->TableName = "ACC_accounts";
     $daObj->execute();
     return true;
 }
コード例 #20
0
ファイル: doc.data.php プロジェクト: jafarkhani/rtfund
function RegisterStartDoc()
{
    $dt = PdoDataAccess::runquery("select * from ACC_docs where DocType=" . DOCTYPE_STARTCYCLE . "\n\t\tAND BranchID=? AND CycleID=?", array($_SESSION["accounting"]["CycleID"], $_SESSION["accounting"]["BranchID"]));
    if (count($dt) > 0) {
        echo Response::createObjectiveResponse(false, "سند افتتاحیه در این دوره قبلا صادر شده است");
        die;
    }
    $LocalNo = $_POST["LocalNo"];
    if ($LocalNo != "") {
        $dt = PdoDataAccess::runquery("select * from ACC_docs \n\t\t\twhere BranchID=? AND CycleID=? AND LocalNo=?", array($_SESSION["accounting"]["BranchID"], $_SESSION["accounting"]["CycleID"], $LocalNo));
        if (count($dt) > 0) {
            echo Response::createObjectiveResponse(false, "شماره سند وارد شده موجود می باشد");
            die;
        }
    }
    $dt = PdoDataAccess::runquery("select * from ACC_cycles where CycleID<" . $_SESSION["accounting"]["CycleID"]);
    if (count($dt) == 0) {
        Response::createObjectiveResponse(false, "دوره ایی قبل این دوره برای صدور سند افتتاحیه موجود نمی باشد");
        die;
    }
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    //---------------- account header doc --------------------
    $obj = new ACC_docs();
    $obj->LocalNo = $LocalNo;
    $obj->RegDate = PDONOW;
    $obj->regPersonID = $_SESSION['USER']["PersonID"];
    $obj->DocDate = PDONOW;
    $obj->CycleID = $_SESSION["accounting"]["CycleID"];
    $obj->BranchID = $_SESSION["accounting"]["BranchID"];
    $obj->description = "سند افتتاحیه";
    $obj->DocType = DOCTYPE_STARTCYCLE;
    $result = $obj->Add($pdo);
    if (!$result) {
        $pdo->rollBack();
        print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    PdoDataAccess::runquery("\n\t\tinsert into ACC_DocItems(DocID,CostID,TafsiliType,TafsiliID,DebtorAmount,CreditorAmount,locked)\n\t\tselect {$obj->DocID},CostID,TafsiliType,TafsiliID,\n\t\t\tif( sum(DebtorAmount-CreditorAmount)>0, sum(DebtorAmount-CreditorAmount), 0 ),\n\t\t\tif( sum(CreditorAmount-DebtorAmount)>0, sum(CreditorAmount-DebtorAmount), 0 ),\n\t\t\t1\n\t\tfrom ACC_DocItems i\n\t\tjoin ACC_docs using(DocID)\n\t\twhere CycleID=" . $_SESSION["accounting"]["CycleID"] - 1 . "\n\t\t\tAND BranchID = " . $_SESSION["accounting"]["BranchID"] . "\n\t\tgroup by CostID,TafsiliID\t\n\t\thaving sum(CreditorAmount-DebtorAmount)<>0\n\t", array(), $pdo);
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    if (PdoDataAccess::AffectedRows($pdo) == 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "ردیفی برای صدور سند افتتاحیه یافت نشد");
        die;
    }
    $pdo->commit();
    echo Response::createObjectiveResponse(true, "");
    die;
}
コード例 #21
0
ファイル: staff.class.php プロジェクト: jafarkhani/rtfund
 static function Create_New_Staff($personid, $persontype)
 {
     $obj = new manage_staff($personid, $persontype);
     if ($persontype == 3 || $persontype == 5) {
         $obj->person_type = 2;
     } else {
         if ($persontype == 2) {
             $obj->person_type = 1;
         }
     }
     $old_staff_id = $obj->staff_id;
     $ret = $obj->AddStaff();
     if ($ret == true) {
         //--------------------------------------------------
         $qry = " select * from staff_tax_history where staff_id=" . $old_staff_id . " AND payed_tax_value IS NOT NULL ";
         $tmp = PdoDataAccess::runquery($qry);
         if (count($tmp) > 0) {
             $Newobj = new manage_staff_tax($old_staff_id);
             parent::FillObjectByArray($Newobj, $tmp[0]);
             $Newobj->staff_id = $obj->staff_id;
             $Newobj->tax_history_id = parent::GetLastID('staff_tax_history', 'tax_history_id') + 1;
             if (PdoDataAccess::insert("staff_tax_history", $Newobj) === false) {
                 return false;
             }
         }
         //................. آزاد کردن پست سازمانی شماره شناسایی قبلی ...................
         $qry = " update position set staff_id= null where staff_id = " . $old_staff_id;
         PdoDataAccess::runquery($qry);
         //..................................................
         $query = " update persons set person_type = " . $obj->person_type . " where  personid =" . $obj->PersonID;
         PdoDataAccess::runquery($query);
         if (ExceptionHandler::GetExceptionCount() == 0) {
             return $obj->staff_id;
         }
     }
     return false;
 }
コード例 #22
0
ファイル: dms.class.php プロジェクト: jafarkhani/rtfund
 static function DeletePage($RowID = "", $DocumentID = "")
 {
     if ($RowID != "") {
         $obj = new DMS_DocFiles($RowID);
         if (parent::delete("DMS_DocFiles", " RowID=?", array($RowID)) === false) {
             return false;
         }
         unlink(getenv("DOCUMENT_ROOT") . "/storage/documents/" . $RowID . "." . $obj->FileType);
         $daObj = new DataAudit();
         $daObj->ActionType = DataAudit::Action_delete;
         $daObj->MainObjectID = $RowID;
         $daObj->TableName = "DMS_DocFiles";
         $daObj->execute();
         return true;
     }
     if ($DocumentID != "") {
         $dt = PdoDataAccess::runquery("select RowID from DMS_DocFiles where DocumentID=?", array($DocumentID));
         foreach ($dt as $row) {
             self::DeletePage($row["RowID"]);
         }
         return ExceptionHandler::GetExceptionCount() == 0;
     }
 }
コード例 #23
0
ファイル: request.data.php プロジェクト: jafarkhani/rtfund
function DelayInstallments()
{
    $RequestID = $_POST["RequestID"];
    $InstallmentID = $_POST["InstallmentID"];
    $newDate = $_POST["newDate"];
    $PartObj = LON_ReqParts::GetValidPartObj($RequestID);
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    if ($_POST["IsRemainCompute"] == " 0") {
        $dt = LON_installments::SelectAll("r.RequestID=? AND InstallmentID>=?", array($RequestID, $InstallmentID));
        $days = 0;
        for ($i = 0; $i < count($dt); $i++) {
            $obj = new LON_installments();
            $obj->InstallmentID = $dt[$i]["InstallmentID"];
            $obj->IsDelayed = "YES";
            if (!$obj->EditInstallment($pdo)) {
                $pdo->rollBack();
                echo Response::createObjectiveResponse(false, "1");
                die;
            }
            //...........................................
            if ($days == 0) {
                $newDate = DateModules::shamsi_to_miladi($newDate, "-");
                $days = DateModules::GDateMinusGDate($newDate, $dt[$i]["InstallmentDate"]);
            }
            $obj = new LON_installments();
            $obj->RequestID = $RequestID;
            $obj->InstallmentDate = DateModules::AddToGDate($dt[$i]["InstallmentDate"], $days);
            $extraWage = round($dt[$i]["InstallmentAmount"] * $PartObj->CustomerWage * $days / 36500);
            $obj->InstallmentAmount = $dt[$i]["InstallmentAmount"] * 1 + $extraWage;
            if (!$obj->AddInstallment($pdo)) {
                $pdo->rollBack();
                echo Response::createObjectiveResponse(false, "2");
                die;
            }
        }
    } else {
        $dt = array();
        $dt2 = LON_requests::ComputePayments($RequestID, $dt);
        $index = 0;
        $ComputeRecord = $dt2[$index++];
        $days = 0;
        for ($i = 0; $i < count($dt); $i++) {
            if ($dt[$i]["InstallmentID"] < $InstallmentID) {
                while ($ComputeRecord["InstallmentID"] == $dt[$i]["InstallmentID"]) {
                    $ComputeRecord = $dt2[++$index];
                }
                continue;
            }
            $remain = 0;
            while ($ComputeRecord["InstallmentID"] == $dt[$i]["InstallmentID"]) {
                $remain = $ComputeRecord["remainder"];
                $ComputeRecord = $index + 1 < count($dt2) ? $dt2[++$index] : null;
            }
            $obj = new LON_installments();
            $obj->InstallmentID = $dt[$i]["InstallmentID"];
            $obj->IsDelayed = "YES";
            if (!$obj->EditInstallment($pdo)) {
                $pdo->rollBack();
                echo Response::createObjectiveResponse(false, "1");
                die;
            }
            //...........................................
            if ($days == 0) {
                $newDate = DateModules::shamsi_to_miladi($newDate, "-");
                $days = DateModules::GDateMinusGDate($newDate, $dt[$i]["InstallmentDate"]);
            }
            $obj = new LON_installments();
            $obj->RequestID = $RequestID;
            $obj->InstallmentDate = DateModules::AddToGDate($dt[$i]["InstallmentDate"], $days);
            $extraWage = round($remain * $PartObj->CustomerWage * $days / 36500);
            $obj->InstallmentAmount = $dt[$i]["InstallmentAmount"] * 1 + $extraWage;
            if (!$obj->AddInstallment($pdo)) {
                $pdo->rollBack();
                echo Response::createObjectiveResponse(false, "2");
                die;
            }
        }
    }
    if (ExceptionHandler::GetExceptionCount() > 0) {
        $pdo->rollBack();
        print_r(ExceptionHandler::PopAllExceptions());
        echo Response::createObjectiveResponse(false, "");
        die;
    }
    $pdo->commit();
    echo Response::createObjectiveResponse(true, "");
    die;
}