Exemple #1
0
function SelectAll()
{
    $where = "1=1";
    $param = array();
    if (!empty($_REQUEST["ObjectType"])) {
        $where .= " AND ObjectType=:st";
        $param[":st"] = $_REQUEST["ObjectType"];
    }
    if (!empty($_REQUEST["ObjectID"])) {
        $where .= " AND ObjectID=:sid";
        $param[":sid"] = $_REQUEST["ObjectID"];
    }
    if (!empty($_REQUEST["ObjectID2"])) {
        $where .= " AND ObjectID2=:oid2";
        $param[":oid2"] = $_REQUEST["ObjectID2"];
    }
    if (isset($_REQUEST["checkRegPerson"]) && $_REQUEST["checkRegPerson"] == "true") {
        $where .= " AND RegPersonID=" . $_SESSION["USER"]["PersonID"];
    }
    $temp = DMS_documents::SelectAll($where, $param);
    for ($i = 0; $i < count($temp); $i++) {
        $temp[$i]["paramValues"] = "";
        $dt = PdoDataAccess::runquery("select * from DMS_DocParamValues join DMS_DocParams using(ParamID)\r\n\t\t\twhere DocumentID=?", array($temp[$i]["DocumentID"]));
        foreach ($dt as $row) {
            $value = $row["ParamValue"];
            if ($row["ParamType"] == "currencyfield") {
                $value = number_format($value * 1);
            }
            $temp[$i]["paramValues"] .= $row["ParamDesc"] . " : " . $value . "<br>";
        }
        if ($temp[$i]["paramValues"] != "") {
            $temp[$i]["paramValues"] = substr($temp[$i]["paramValues"], 0, strlen($temp[$i]["paramValues"]) - 4);
        }
    }
    //print_r(ExceptionHandler::PopAllExceptions());
    echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]);
    die;
}
Exemple #2
0
function SaveLetter($dieing = true)
{
    $Letter = new OFC_letters();
    pdoDataAccess::FillObjectByArray($Letter, $_POST);
    if ($Letter->RefLetterID != "") {
        $obj = new OFC_letters($Letter->RefLetterID);
        if (empty($obj->LetterID)) {
            Response::createObjectiveResponse(false, "شماره نامه عطف قابل بازیابی نمی باشد");
            die;
        }
    }
    if ($Letter->LetterID == '') {
        $Letter->PersonID = $_SESSION["USER"]["PersonID"];
        $Letter->LetterDate = PDONOW;
        $Letter->RegDate = PDONOW;
        $res = $Letter->AddLetter();
    } else {
        $res = $Letter->EditLetter();
    }
    if (!empty($_FILES["PageFile"]["tmp_name"])) {
        $st = preg_split("/\\./", $_FILES['PageFile']['name']);
        $extension = strtolower($st[count($st) - 1]);
        if (in_array($extension, array("jpg", "jpeg", "gif", "png", "pdf")) === false) {
            Response::createObjectiveResponse(false, "فرمت فایل ارسالی نامعتبر است");
            die;
        }
        $dt = DMS_documents::SelectAll("ObjectType='letter' AND ObjectID=?", array($Letter->LetterID));
        if (count($dt) == 0) {
            $obj = new DMS_documents();
            $obj->DocType = 0;
            $obj->ObjectType = "letter";
            $obj->ObjectID = $Letter->LetterID;
            $obj->AddDocument();
            $DocumentID = $obj->DocumentID;
        } else {
            $DocumentID = $dt[0]["DocumentID"];
        }
        //..............................................
        $obj2 = new DMS_DocFiles();
        $obj2->DocumentID = $DocumentID;
        $obj2->PageNo = PdoDataAccess::GetLastID("DMS_DocFiles", "PageNo", "DocumentID=?", array($DocumentID)) + 1;
        $obj2->FileType = $extension;
        $obj2->FileContent = substr(fread(fopen($_FILES['PageFile']['tmp_name'], 'r'), $_FILES['PageFile']['size']), 0, 200);
        $obj2->AddPage();
        $fp = fopen(getenv("DOCUMENT_ROOT") . "/storage/documents/" . $obj2->RowID . "." . $extension, "w");
        fwrite($fp, substr(fread(fopen($_FILES['PageFile']['tmp_name'], 'r'), $_FILES['PageFile']['size']), 200));
        fclose($fp);
    }
    if ($dieing) {
        Response::createObjectiveResponse($res, $Letter->GetExceptionCount() != 0 ? $Letter->popExceptionDescription() : $Letter->LetterID);
        die;
    }
    return true;
}
Exemple #3
0
    $sign = $LetterObj->IsSigned == "YES" && $dt[0]["signer"] != "" ? "background-image:url(\"" . data_uri($dt[0]["signer"], 'image/jpeg') . "\")" : "";
    $content .= "<table width=100%><tr><td><div class=signDiv style=" . $sign . "><b>" . $dt[0]["SignPersonName"] . "</b><br><br>" . $dt[0]["PostName"] . "</div></td></tr></table>";
}
foreach ($dt as $row) {
    if ($row["FromPersonID"] != $LetterObj->PersonID || $row["IsCopy"] == "NO") {
        continue;
    }
    $content .= "<b> رونوشت : " . ($row["sex"] == "MALE" ? "جناب آقای " : "سرکار خانم ") . $row['ToPersonName'] . "<br></b>";
}
if ($LetterObj->OuterCopies != "") {
    $LetterObj->OuterCopies = str_replace("\r\n", " , ", $LetterObj->OuterCopies);
    $content .= "<br><b> رونوشت خارج از سازمان : " . $LetterObj->OuterCopies . "</b><br>";
}
//..............................................................................
$imageslist = array();
$doc = DMS_documents::SelectAll("ObjectType='letter' AND ObjectID=?", array($LetterID));
if (count($doc) > 0) {
    $images = DMS_DocFiles::selectAll("DocumentID=?", array($doc[0]["DocumentID"]));
    foreach ($images as $img) {
        $imageslist[] = array("url" => "/office/dms/ShowFile.php?RowID=" . $img["RowID"] . "&DocumentID=" . $img["DocumentID"] . "&ObjectID=" . $LetterID, "fileType" => $img["FileType"]);
    }
}
$imageslist = json_encode($imageslist);
//..............................................................................
$editable = false;
if ($LetterObj->LetterType == "OUTCOME" && $LetterObj->IsSigned == "NO") {
    $dt = OFC_letters::SelectReceivedLetters(" AND l.LetterID=:lid", array(":lid" => $LetterID));
    if ($dt->rowCount() > 0) {
        $editable = true;
    }
}
Exemple #4
0
<?php

//-----------------------------
//	Programmer	:
//	Date		: 1395.08
//-----------------------------
require_once '../header.inc.php';
require_once '../../office/dms/dms.class.php';
require_once 'request.class.php';
require_once inc_reportGenerator;
$RequestID = $_REQUEST["RequestID"];
$ReqObj = new LON_requests($RequestID);
$temp = DMS_documents::SelectAll("ObjectType='loan' AND ObjectID=? AND b1.param1=1", array($RequestID));
$SumAmount = 0;
for ($i = 0; $i < count($temp); $i++) {
    $temp[$i]["paramValues"] = "";
    $dt = PdoDataAccess::runquery("select * from DMS_DocParamValues join DMS_DocParams using(ParamID)\r\n\t\twhere DocumentID=?", array($temp[$i]["DocumentID"]));
    foreach ($dt as $row) {
        $value = $row["ParamValue"];
        if ($row["ParamType"] == "currencyfield") {
            $value = number_format($value * 1);
        }
        $temp[$i]["paramValues"] .= $row["ParamDesc"] . " : " . $value . "<br>";
        if ($row["KeyTitle"] == "amount") {
            $SumAmount += $row["ParamValue"] * 1;
        }
    }
    if ($temp[$i]["paramValues"] != "") {
        $temp[$i]["paramValues"] = substr($temp[$i]["paramValues"], 0, strlen($temp[$i]["paramValues"]) - 4);
    }
}