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) . " " . 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) . " " . 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; }
function GetSavingLoanInfo() { if (isset($_SESSION["USER"]["portal"])) { $PersonID = $_SESSION["USER"]["PersonID"]; } else { $PersonID = $_REQUEST["PersonID"]; } //----------- check for all docs confirm -------------- /*$dt = PdoDataAccess::runquery("select group_concat(distinct LocalNo) from ACC_docs join ACC_DocItems using(DocID) join ACC_tafsilis t using(TafsiliType,TafsiliID) where TafsiliType=" . TAFTYPE_PERSONS . " AND ObjectID = ? AND CostID in(" . COSTID_saving . ") AND DocType not in(" . DOCTYPE_STARTCYCLE . "," . DOCTYPE_ENDCYCLE . ") AND DocStatus not in('CONFIRM','ARCHIVE')", array($PersonID)); if(count($dt) > 0 && $dt[0][0] != "") { $msg = "اسناد با شماره های [" . $dt[0][0] . "] تایید نشده اند."; echo dataReader::getJsonData(array(), 0, $_GET["callback"], $msg); die(); }*/ //------------ get sum of savings ---------------- $dt = PdoDataAccess::runquery("\n\t\tselect DocDate,sum(CreditorAmount-DebtorAmount) amount\n\t\tfrom ACC_DocItems di\n\t\t\tjoin ACC_docs d using(DocID)\n\t\t\tjoin ACC_tafsilis t using(TafsiliType,TafsiliID)\n\t\t\n\t\twhere TafsiliType=" . TAFTYPE_PERSONS . " \n\t\t\tAND ObjectID = ?\n\t\t\tAND CostID in(" . COSTID_saving . ")\n\t\t\tAND DocType not in(" . DOCTYPE_STARTCYCLE . "," . DOCTYPE_ENDCYCLE . ")\n\t\t\tAND BranchID=" . $_SESSION["accounting"]["BranchID"] . "\n\t\tgroup by DocDate\n\t\torder by DocDate", array($PersonID)); if (count($dt) == 0) { $msg = "شخص مورد نظر فاقد حساب پس انداز می باشد"; echo dataReader::getJsonData(array(), 0, $_GET["callback"], $msg); die; } //------------ get the Deposite amount ------------- $totalAmount = 0; $totalDays = 0; for ($i = 1; $i < count($dt); $i++) { $days = DateModules::GDateMinusGDate($dt[$i]["DocDate"], $dt[$i - 1]["DocDate"]); $totalDays += $days; $totalAmount += $dt[$i - 1]["amount"] * $days; } $days = DateModules::GDateMinusGDate(DateModules::Now(), $dt[$i - 1]["DocDate"]); $totalDays += $days; $totalAmount += $dt[$i - 1]["amount"] * $days; $average = round($totalAmount / $totalDays); $returnArray = array("PersonID" => $PersonID, "FirstDate" => DateModules::miladi_to_shamsi($dt[0]["DocDate"]), "AverageAmount" => $average, "TotalMonths" => floor($totalDays / 30.5)); echo dataReader::getJsonData($returnArray, 1, $_GET["callback"]); die; }
<?php //--------------------------- // programmer: Jafarkhani // create Date: 95.08 //--------------------------- include "../header.inc.php"; require_once inc_component; $IncomeChequeID = $_POST["IncomeChequeID"]; $query = "select h.*,\r\n\t\t\t\tconcat_ws(' ',fname, lname,CompanyName) fullname , \r\n\t\t\t\tt.TafsiliDesc StatusDesc\r\n\t\t\tfrom ACC_ChequeHistory h \r\n\t\t\t\tleft join ACC_tafsilis t on(t.TafsiliType=" . TAFTYPE_ChequeStatus . " AND StatusID=TafsiliID) \r\n\t\t\t\tjoin BSC_persons using(PersonID) \r\n\t\t\t\twhere h.IncomeChequeID=?\r\n\t\t\torder by RowID "; $Logs = PdoDataAccess::runquery($query, array($IncomeChequeID)); $tbl_content = ""; if (count($Logs) == 0) { $tbl_content = "<tr><td>فرم مورد نظر فاقد گردش می باشد</td></tr>"; } else { for ($i = 0; $i < count($Logs); $i++) { $tbl_content .= "<tr " . ($i % 2 == 1 ? "style='background-color:#efefef'" : "") . ">\r\n\t\t\t<td width=250px>[" . ($i + 1) . "]" . ($i + 1 < 10 ? " " : "") . " \r\n\t\t\t\t<img align='top' src='/generalUI/ext4/resources/themes/icons/user_comment.gif'> \r\n\t\t\t\t" . $Logs[$i]["StatusDesc"] . "</td>\r\n\t\t\t<td width=150px>" . $Logs[$i]["fullname"] . "</td>\r\n\t\t\t<td width=110px>" . substr($Logs[$i]["ATS"], 11) . " " . DateModules::miladi_to_shamsi($Logs[$i]["ATS"]) . "</td>\r\n\t\t</tr>"; } } ?> <style> .infotd td{border-bottom: solid 1px #e8e8e8;padding-right:4px; height: 21px;} </style> <div style="background-color:white;width: 100%; height: 100%"> <table class="infotd" width="100%" bgcolor="white" cellpadding="0" cellspacing="0"> <?php echo $tbl_content; ?> </table> </div>
} else echo "<td> </td>" ; if(!empty($res[$i]['contract_end_date']) && $res[$i]['contract_end_date'] !='0000-00-00' ){ list($year,$month,$day) = preg_split('/[\/]/',DateModules::miladi_to_shamsi($res[$i]['contract_end_date'])); if ($year * $month == $res[$i]['pay_year'] * $res[$i]['pay_month']){ $qry = " select count(*) cn from writs where execute_date > '".$res[$i]['contract_end_date']."' and staff_id = ".$res[$i]['staff_id']." order by execute_date limit 1 " ; $NWRes = PdoDataAccess::runquery($qry) ; if($NWRes[0]['cn'] == 0 && $res[$i]['salary_pay_proc'] == 1 ) echo "<td> ".DateModules::miladi_to_shamsi($res[$i]['contract_end_date'])." </td>" ; } else echo "<td> </td>" ; } else echo "<td> </td>" ; echo "<td>".$res[$i]['work_sheet']."</td> <td>".number_format(round($res[$i]['daily_fee']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['monthly_fee']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['monthly_premium']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['monthly_insure_include']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['pay']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['worker_insure_include']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['other_gets']), 0, '.', ',')."</td> <td>".number_format(round($res[$i]['pure_pay']), 0, '.', ',')."</td> <td>".$res[$i]['account_no']."</td>
function dateRender($row, $val) { return DateModules::miladi_to_shamsi($val); }
<?php //--------------------------- // programmer: Mahdipour // create Date: 91.04 //--------------------------- require_once '../header.inc.php'; require_once inc_dataReader; require_once inc_manage_unit; $whereDate = ""; $whereW = ""; if (!empty($_REQUEST['FDATE']) && $_REQUEST['FDATE'] != '0000-00-00') { $whereDate = " AND tbl2.execute_date>='" . $_REQUEST['FDATE'] . "'"; $whereW = " AND w.execute_date >= '" . $_REQUEST['FDATE'] . "' "; } if (!empty($_REQUEST['TDATE']) && $_REQUEST['TDATE'] != '0000-00-00') { $whereDate .= " AND tbl2.execute_date<='" . $_REQUEST['TDATE'] . "'"; $whereW .= " AND w.execute_date <= '" . $_REQUEST['TDATE'] . "'"; } $qry = " select tbl1.staff_id , tbl0.pfname , tbl0.plname , tbl0.national_code , tbl2.ouid , bi1.Title educatin_title , bi2.Title emp_state , tbl0.birth_date , \r\n bi3.Title marital_title , tbl2.children_count , sf.ptitle field_title , tbl1.work_start_date , wt.title writ_type_title , wst.title sub_writ_title ,\r\n tbl2.writ_id , tbl2.writ_ver , bi4.Title emp_mode_title \r\n \r\n from persons as tbl0\r\n left join staff as tbl1 on(tbl0.PersonID=tbl1.PersonID )\r\n left join (SELECT staff_id,\r\n SUBSTRING_INDEX(SUBSTRING(max_execute_date,11),'.',1) writ_id,\r\n SUBSTRING_INDEX(max_execute_date,'.',-1) writ_ver\r\n FROM (SELECT w.staff_id,\r\n max( CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver) ) max_execute_date\r\n FROM writs w\r\n INNER JOIN staff ls\r\n ON(w.staff_id = ls.staff_id)\r\n WHERE \r\n w.history_only = 0 and w.person_type = " . $_REQUEST['pt'] . " " . $whereW . " \r\n GROUP BY w.staff_id ) med) as mtbl2 on(tbl1.staff_id=mtbl2.staff_id)\r\n\r\n inner join writs as tbl2 on mtbl2.staff_id = tbl2.staff_id and\r\n mtbl2.writ_id = tbl2.writ_id and mtbl2.writ_ver = tbl2.writ_ver \r\n inner join Basic_Info bi1 on bi1.InfoID = tbl2.education_level and bi1.typeid = 6 \r\n inner join Basic_Info bi2 on bi2.InfoID = tbl2.emp_state and bi2.typeid = 3 \r\n inner join Basic_Info bi3 on bi3.InfoID = tbl2.marital_status and bi3.typeid = 15 \r\n inner join study_fields sf on sf.sfid = tbl2.sfid \r\n inner join writ_types wt on wt.writ_type_id = tbl2.writ_type_id and wt.person_type = tbl2.person_type\r\n inner join writ_subtypes wst on wst.person_type = tbl2.person_type and \r\n wst.writ_type_id = tbl2.writ_type_id and \r\n wst.writ_subtype_id = tbl2.writ_subtype_id \r\n inner join Basic_Info bi4 on bi4.InfoID = tbl2.emp_mode and bi4.typeid = 4\r\n \r\n\r\n\r\n \r\n\r\n where 1=1 AND tbl2.emp_mode = " . $_REQUEST['emp_mode'] . " \r\n AND tbl1.person_type = " . $_REQUEST['pt'] . " " . $whereDate . "\r\n \r\n \r\n \r\n"; $data = PdoDataAccess::runquery($qry); $record = ""; for ($i = 0; $i < count($data); $i++) { $record .= "<tr><td>" . $i . "</td><td>" . $data[$i]['staff_id'] . "</td><td>" . $data[$i]['pfname'] . "</td><td>" . $data[$i]['plname'] . "</td>\r\n <td>" . $data[$i]['national_code'] . "</td><td>" . manage_units::get_full_title($data[$i]['ouid']) . "</td><td>" . $data[$i]['educatin_title'] . "</td><td>" . $data[$i]['emp_state'] . "</td>\r\n <td>" . DateModules::miladi_to_shamsi($data[$i]['birth_date']) . "</td><td>" . $data[$i]['marital_title'] . "</td><td>" . $data[$i]['children_count'] . "</td><td>" . $data[$i]['field_title'] . "</td>\r\n <td>" . DateModules::miladi_to_shamsi($data[$i]['work_start_date']) . "</td><td>" . $data[$i]['writ_type_title'] . "</td><td>" . $data[$i]['sub_writ_title'] . "</td><td>" . $data[$i]['writ_id'] . "</td>\r\n <td>" . $data[$i]['writ_ver'] . "</td><td>" . $data[$i]['emp_mode_title'] . "</td>\r\n </tr>"; } $tags = array('<!--record-->' => $record, '<!--now-->' => DateModules::shNow()); $content = file_get_contents("FullInformation.htm"); $content = str_replace(array_keys($tags), array_values($tags), $content); echo $content;
private function compute_salary_item5_33($writ_rec) { //param1 : مبلغ فوق العاده تعديل سال قبل //param2 : ضريب $this_writ_year = substr(DateModules::miladi_to_shamsi($writ_rec['execute_date']), 0, 4); $one_year_ago = $this_writ_year - 1; $one_year_ago_last_day = $one_year_ago . "/12/29"; $Gone_year_ago_last_day = DateModules::shamsi_to_miladi($one_year_ago_last_day); //آخرين حکم قبل از سال شخص را استخراج مي کند. $prior_writObj = manage_writ::get_last_writ_by_date($writ_rec['staff_id'], $Gone_year_ago_last_day); //مقدار قلم فوق العاده تعديل آخرين حکم سال قبل را استخراج مي کند. //اين قلم بر اساس بخشنامه افزايش حقوق سال 87 اضافه شد. $this->param1 = manage_writ_item::get_writSalaryItem_value($prior_writObj->writ_id, $prior_writObj->writ_ver, $prior_writObj->staff_id, SIT5_STAFF_EXTRA_ADJUST); $this->param2 = 1.5; $value = $this->param1 * $this->param2; if (!($value > 0)) { return false; } return $value; }
$tbl_content = ""; if (count($Logs) == 0) { $tbl_content = "<tr><td>فرم مورد نظر فاقد گردش می باشد</td></tr>"; } else { for ($i = 0; $i < count($Logs); $i++) { $backgroundColor = $i % 2 == 1 ? "style='background-color:#efefef'" : ""; $backgroundColor = $Logs[$i]["ActionType"] == "REJECT" ? "style='background-color:#ffccd1'" : $backgroundColor; $StepDesc = $Logs[$i]["StepDesc"]; if ($Logs[$i]["ActionType"] == "CONFIRM") { $StepDesc = "تایید " . $StepDesc; } else { if ($Logs[$i]["ActionType"] == "REJECT") { $StepDesc = "رد " . $StepDesc; } } $tbl_content .= "<tr " . $backgroundColor . ">\r\n\t\t\t<td width=250px>[" . ($i + 1) . "]" . ($i + 1 < 10 ? " " : "") . " \r\n\t\t\t\t<img align='top' src='/generalUI/ext4/resources/themes/icons/user_comment.gif'> " . $StepDesc . " </td>\r\n\t\t\t<td width=150px>" . $Logs[$i]["fullname"] . "</td>\r\n\t\t\t<td width=110px>" . substr($Logs[$i]["ActionDate"], 11) . " " . DateModules::miladi_to_shamsi($Logs[$i]["ActionDate"]) . "</td>\r\n\t\t\t<td><div style='cursor:pointer' class='qtip-target' data-qtip='" . $Logs[$i]["ActionComment"] . "'>" . String::ellipsis($Logs[$i]["ActionComment"], 48) . "</div></td>\r\n\t\t</tr>"; } //------------------------ get next one ------------------------------------ if ($Logs[$i - 1]["StepRowID"] == "" || $Logs[$i - 1]["IsOuter"] == "NO") { $StepID = ($Logs[$i - 1]["StepID"] == "" ? 0 : $Logs[$i - 1]["StepID"]) + 1; $query = "select StepDesc,po.PostName,\r\n\t\t\t\t\tconcat_ws(' ',fname, lname,CompanyName) fullname\r\n\t\t\t\tfrom WFM_FlowSteps fs\r\n\t\t\t\tleft join BSC_posts po using(PostID)\r\n\t\t\t\tleft join BSC_persons p on(if(fs.PersonID>0,fs.PersonID=p.PersonID,po.PostID=p.PostID))\r\n\t\t\t\twhere fs.IsActive='YES' AND fs.FlowID=? AND fs.StepID=?"; $nextOne = PdoDataAccess::runquery($query, array($FlowID, $StepID)); if (count($nextOne) > 0) { $str = ""; foreach ($nextOne as $row) { $str .= $row["fullname"] . ($row["PostName"] != "" ? " [ پست : " . $row["PostName"] . " ]" : "") . " و "; } $str = substr($str, 0, strlen($str) - 3); $tbl_content .= "<tr style='background-color:#A9E8E8'>\r\n\t\t\t\t\t<td colspan=4 align=center>در حال حاضر فرم در مرحله <b>" . $nextOne[0]["StepDesc"] . "</b> در کارتابل <b>" . $str . "</b> می باشد.</td>\r\n\t\t\t\t</tr>"; } else { $tbl_content .= "<tr style='background-color:#A9E8E8'>\r\n\t\t\t\t<td colspan=4 align=center><b>گردش فرم پایان یافته است.</b></td>\r\n\t\t\t\t<tr>";
static function IsEditable($row_no) { $dt = PdoDataAccess::runquery("select * from person_subtracts join person_subtract_flows using(subtract_id) where row_no=?", array($row_no)); if ($dt[0]["IsFinished"] == "1") { return false; } $subtract_id = $dt[0]["subtract_id"]; $flow_date = DateModules::miladi_to_shamsi($dt[0]["flow_date"]); $year = DateModules::GetYear($flow_date); $month = DateModules::GetMonth($flow_date); $dt = PdoDataAccess::runquery("select * from payment_items join payments using(payment_type,staff_id,pay_year,pay_month)\n\t\t\t\twhere param1 in('LOAN','FIX_FRACTION','FIX_BENEFIT')\n\t\t\t\t\tAND param2 = {$subtract_id} \n\t\t\t\t\tAND pay_year>={$year} \n\t\t\t\t\tAND if(pay_year={$year}, pay_month>={$month}, 1=1) \n\t\t\t\t\tAND\tif(pay_year={$year} AND pay_month={$month}, calc_date > '" . $dt[0]["flow_date"] . "', 1=1)"); if (count($dt) > 0) { return false; } return true; }
} } } } } } } } } } } } } } if (!empty($_GET['item36']) && $_GET['item36'] == 1) { $query = " select s.staff_id , p.pfname , p.plname , bi1.Title emp_state_title,bi2.Title emp_mode_title , bi3.Title person_type_title ,w.ouid ,w.emp_mode\r\n \r\n from staff s inner join (SELECT staff_id,\r\n SUBSTRING_INDEX(SUBSTRING(max_execute_date,11),'.',1) writ_id,\r\n SUBSTRING_INDEX(max_execute_date,'.',-1) writ_ver\r\n FROM (SELECT w.staff_id,\r\n max( CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver) ) max_execute_date\r\n FROM writs w\r\n INNER JOIN staff ls\r\n ON(w.staff_id = ls.staff_id)\r\n WHERE w.history_only = 0 " . $whereW . "\r\n GROUP BY w.staff_id)tbl2) tbl1\r\n on s.staff_id = tbl1.staff_id \r\n inner join writs w\r\n on tbl1.writ_id = w.writ_id and\r\n tbl1.writ_ver = w.writ_ver and\r\n tbl1.staff_id = w.staff_id \r\n\r\n left join payments pa \r\n on pa.staff_id = s.staff_id and pa.payment_type = 1 and pa.pay_year = " . substr(DateModules::miladi_to_shamsi($salaryDate), 0, 4) . " and\r\n pa.pay_month = " . substr(DateModules::miladi_to_shamsi($salaryDate), 5, 2) . "\r\n \r\n inner join persons p on p.personid = s.personid\r\n inner join Basic_Info bi1 on bi1.typeid = 3 and w.emp_state = bi1.infoid\r\n inner join Basic_Info bi2 on bi2.typeid = 4 and w.emp_mode = bi2.infoid\r\n inner join Basic_Info bi3 on bi3.typeid = 16 and s.person_type = bi3.infoid\r\n\r\n where s.person_type in (2,3,5) and pa.staff_id is null " . $whereW . "\r\n \r\n "; $data = PdoDataAccess::runquery($query); } ?> <html dir='rtl'> <head> <style> .reportGenerator {border-collapse: collapse;border: 1px solid black;font-family: tahoma;font-size: 8pt; text-align: center;width: 70%;padding: 2px;} .reportGenerator .header {color: white;font-weight: bold;background-color:#3F5F96} .reportGenerator td {border: 1px solid #555555;height: 20px;} </style> <title>تعداد کل کارکنان رسمی قطعی شاغل </title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <link rel=stylesheet href="/HumanResources/css/writ.css"> </head>
function corrective_writ_detail($writ_id, $writ_ver, $staff_id, $execute_date) { ob_start(); // get corrected writs by a specfied writ $query = "SELECT w.* , wst.* , wsi.param3 \n\n FROM writs w\n \t LEFT OUTER JOIN writ_subtypes wst\n \t\tON ((w.writ_type_id = wst.writ_type_id) AND\n \t(w.writ_subtype_id = wst.writ_subtype_id) AND\n (w.person_type = wst.person_type))\n\t\t\t LEFT JOIN writ_salary_items wsi \n\t\t\t\t\tON w.staff_id = wsi.staff_id AND w.writ_id = wsi.writ_id AND w.writ_ver = wsi.writ_ver AND wsi.salary_item_type_id = 10364 \n\t\t\t\t\t\n WHERE w.corrective_writ_id = {$writ_id} AND\n w.corrective_writ_ver = {$writ_ver} AND\n\t\t\t w.staff_id = {$staff_id} AND\n w.writ_ver > 1\n ORDER BY execute_date"; $corrected_writs = PdoDataAccess::runquery($query); $writ_count = count($corrected_writs); if ($writ_count == 0) { return; } $persent = 75 / $writ_count; echo "<tr>\n\t\t\t<td style='border-top:1px solid black' colspan=2>نوع حکم</td>"; $width = round(400 / count($corrected_writs)); for ($i = 0; $i < count($corrected_writs); $i++) { echo "<td style='border-top:1px solid black;width:" . $width . "px'>" . $corrected_writs[$i]["print_title"] . "</td>"; } echo "</tr>"; //----------- get all writ salary items of specified person_type ----------- $minExecuteDate = $corrected_writs[0]["execute_date"]; $writs = ""; $prevwrit = ""; for ($i = 0; $i < count($corrected_writs); $i++) { $writs .= "'" . $corrected_writs[$i]["staff_id"] . "-" . $corrected_writs[$i]["writ_id"] . "-" . $corrected_writs[$i]["writ_ver"] . "',"; $prevwrit .= "'" . $corrected_writs[$i]["staff_id"] . "-" . $corrected_writs[$i]["writ_id"] . "-" . ($corrected_writs[$i]["writ_ver"] - 1) . "',"; /*$minExecuteDate = DateModules::CompareDate($corrected_writs[$i]["execute_date"], $minExecuteDate) < 0 ? $corrected_writs[$i]["execute_date"] : $minExecuteDate;*/ } /*$query = "SELECT * FROM salary_item_types sit WHERE person_type = " . $corrected_writs[0]["person_type"] . " AND compute_place = " . SALARY_ITEM_COMPUTE_PLACE_WRIT . " AND validity_start_date <= '" . $execute_date . "' AND (validity_end_date IS NULL OR validity_end_date = '0000-00-00' OR (validity_end_date >= '" . $minExecuteDate . "' AND validity_end_date >= '" . $execute_date . "')) ORDER BY print_order";*/ $writs = substr($writs, 0, strlen($writs) - 1); $prevwrit = substr($prevwrit, 0, strlen($prevwrit) - 1); $query = "select distinct sit.* from writ_salary_items si join salary_item_types sit using(salary_item_type_id)\n\t\t\t\twhere concat(si.staff_id,'-',si.writ_id,'-',si.writ_ver) in (" . $writs . "," . $prevwrit . ")\n\t\t\t\t\t\t\t\tAND compute_place = " . SALARY_ITEM_COMPUTE_PLACE_WRIT . "\n\t\t\t\t\t\t\t\tAND person_type in (" . $corrected_writs[0]["person_type"] . " , 101 ) ORDER BY print_order"; $salary_item_types = PdoDataAccess::runquery($query); //-------------------------------------------------------------------------- $current_execute_date = $prior_execute_date = $current_field = $prior_field = $field_title = ""; $current_writ_items = $prior_writ_items = array(); $current_item_sum = $prior_item_sum = ""; $field_title2 = ""; for ($i = 0; $i < count($corrected_writs); $i++) { $current_writ = $corrected_writs[$i]; if ($current_writ['writ_ver'] > 1) { $prior_writ = new manage_writ($current_writ["writ_id"], $current_writ["writ_ver"] - 1, $current_writ["staff_id"]); if ($current_writ["person_type"] != 1) { $qry = " select param3 from writ_salary_items\n\t\t\t\t\t\t\t\twhere writ_id= " . $current_writ["writ_id"] . " and \n\t\t\t\t\t\t\t\t\t\twrit_ver = " . ($current_writ["writ_ver"] - 1) . " and staff_id = " . $current_writ["staff_id"] . " and salary_item_type_id = 10364 "; $ResPrev = PdoDataAccess::runquery($qry); if (empty($ResPrev[0]['param3'])) { $ResPrev[0]['param3'] = ' '; } } $current_execute_date .= "<td>" . DateModules::miladi_to_shamsi($current_writ["execute_date"]) . "</td>"; $prior_execute_date .= "<td>" . DateModules::miladi_to_shamsi($prior_writ->execute_date) . "</td>"; if ($current_writ["person_type"] == HR_EMPLOYEE || $current_writ["person_type"] == HR_PROFESSOR) { if ($current_writ["person_type"] == HR_EMPLOYEE && DateModules::CompareDate($execute_date, "2009-03-21") >= 0 && (DateModules::CompareDate($execute_date, "2013-02-19") < 0 || DateModules::CompareDate($execute_date, "2013-03-20") > 0 && DateModules::CompareDate($execute_date, "2014-03-20") < 0)) { $field_title = 'طبقه'; $current_field .= "<td>" . ($current_writ["cur_group"] - 4) . "</td>"; $prior_field .= "<td>" . ($prior_writ->cur_group - 4) . "</td>"; } else { if ($current_writ["person_type"] == HR_EMPLOYEE && DateModules::CompareDate($execute_date, "2009-03-21") < 0) { $field_title = 'گروه'; $current_field .= "<td>" . $current_writ["cur_group"] . "</td>"; $prior_field .= "<td>" . $prior_writ->cur_group . "</td>"; } else { $field_title2 = ""; $field_title = 'پایه'; $current_writ["base"] = DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") >= 0 && $current_writ["person_type"] != 1 ? substr($current_writ["param3"], 0, 2) : $current_writ["base"]; $prior_writ_base = DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") >= 0 && $current_writ["person_type"] != 1 ? substr($ResPrev[0]['param3'], 0, 2) : $prior_writ->base; $cf = DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") < 0 && $current_writ["person_type"] == HR_EMPLOYEE ? "-" : $current_writ["base"]; $pf = DateModules::CompareDate($prior_writ->execute_date, "2013-02-19") < 0 && $current_writ["person_type"] == HR_EMPLOYEE ? "-" : $prior_writ_base; $current_field .= "<td>" . $cf . "</td>"; $prior_field .= "<td>" . $pf . "</td>"; if (DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") < 0 || DateModules::CompareDate($execute_date, "2013-03-20") > 0 && DateModules::CompareDate($execute_date, "2014-03-20") < 0) { $field_title2 = 'طبقه'; $cf2 = DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") < 0 || DateModules::CompareDate($execute_date, "2013-03-20") > 0 && DateModules::CompareDate($execute_date, "2014-03-20") < 0 ? $current_writ["cur_group"] - 4 : "-"; $pf2 = DateModules::CompareDate($prior_writ->execute_date, "2013-02-19") < 0 || DateModules::CompareDate($execute_date, "2013-03-20") > 0 && DateModules::CompareDate($execute_date, "2014-03-20") < 0 ? $prior_writ->cur_group - 4 : "-"; $current_field2 .= "<td>" . $cf2 . "</td>"; $prior_field2 .= "<td>" . $pf2 . "</td>"; } elseif ((DateModules::CompareDate($current_writ["execute_date"], "2013-02-19") >= 0 || DateModules::CompareDate($execute_date, "2013-03-21") < 0 || DateModules::CompareDate($execute_date, "2014-03-20") >= 0) && $field_title2 != "") { $current_field2 .= "<td>" . "-" . "</td>"; $prior_field2 .= "<td>" . "-" . "</td>"; } } } } else { $field_title = ""; $field_title2 = ""; } $sum1 = $sum2 = 0; $item46 = $item10374 = 0; $item10329 = $item10370 = $item51 = 0; $item10330 = $item10371 = $item50 = 0; foreach ($salary_item_types as $element) { if (in_array("46", $element)) { $item46 = 1; } if (in_array("10374", $element)) { $item10374 = 1; } if (in_array("10329", $element)) { $item10329 = 1; } if (in_array("10370", $element)) { $item10370 = 1; } if (in_array("51", $element)) { $item51 = 1; } if (in_array("10330", $element)) { $item10330 = 1; } if (in_array("10371", $element)) { $item10371 = 1; } if (in_array("50", $element)) { $item50 = 1; } } for ($j = 0; $j < count($salary_item_types); $j++) { if ($salary_item_types[$j]["salary_item_type_id"] == 10374 && $item46 == 1) { continue; } if ($salary_item_types[$j]["salary_item_type_id"] == 10370 && $item51 == 1) { continue; } if ($salary_item_types[$j]["salary_item_type_id"] == 10370 && $item10329 == 1) { continue; } if ($salary_item_types[$j]["salary_item_type_id"] == 10371 && $item50 == 1) { continue; } if ($salary_item_types[$j]["salary_item_type_id"] == 10371 && $item10330 == 1) { continue; } if (!isset($current_writ_items[$j])) { $current_writ_items[$j] = ""; $prior_writ_items[$j] = ""; } $val = manage_writ_item::get_writSalaryItem_value($current_writ["writ_id"], $current_writ["writ_ver"], $current_writ["staff_id"], $salary_item_types[$j]["salary_item_type_id"]); if ($item46 == 1 && $item10374 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 46 || $salary_item_types[$j]["salary_item_type_id"] == 10374)) { $val = manage_writ_item::get_writSalaryItem_value($current_writ["writ_id"], $current_writ["writ_ver"], $current_writ["staff_id"], 10374); } if ($item51 == 1 && $item10370 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 51 || $salary_item_types[$j]["salary_item_type_id"] == 10370)) { $val = manage_writ_item::get_writSalaryItem_value($current_writ["writ_id"], $current_writ["writ_ver"], $current_writ["staff_id"], 10370); } if ($item50 == 1 && $item10371 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 50 || $salary_item_types[$j]["salary_item_type_id"] == 10371)) { $val = manage_writ_item::get_writSalaryItem_value($current_writ["writ_id"], $current_writ["writ_ver"], $current_writ["staff_id"], 10371); } $current_writ_items[$j] .= "<td class='money'>" . ($val == 0 ? "-" : CurrencyModulesclass::toCurrency($val)) . "</td>"; $sum2 += $val; $val = manage_writ_item::get_writSalaryItem_value($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, $salary_item_types[$j]["salary_item_type_id"]); if ($item46 == 1 && $item10374 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 46 || $salary_item_types[$j]["salary_item_type_id"] == 10374)) { $val = manage_writ_item::get_writSalaryItem_value($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, 10374); } if ($item51 == 1 && $item10370 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 51 || $salary_item_types[$j]["salary_item_type_id"] == 10370)) { $val = manage_writ_item::get_writSalaryItem_value($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, 10370); } if ($item50 == 1 && $item10371 == 1 && !($val > 0) && ($salary_item_types[$j]["salary_item_type_id"] == 50 || $salary_item_types[$j]["salary_item_type_id"] == 10371)) { $val = manage_writ_item::get_writSalaryItem_value($prior_writ->writ_id, $prior_writ->writ_ver, $prior_writ->staff_id, 10371); } $prior_writ_items[$j] .= "<td class='money'>" . ($val == 0 ? "-" : CurrencyModulesclass::toCurrency($val)) . "</td>"; $sum1 += $val; } $current_item_sum .= "<td class='money'>" . CurrencyModulesclass::toCurrency($sum2) . "</td>"; $prior_item_sum .= "<td class='money'>" . CurrencyModulesclass::toCurrency($sum1) . "</td>"; } } echo "<tr>\n\t\t\t<td style='width:80px' rowspan=2>تاريخ اجراي حکم</td>\n\t\t\t<td style='width:20px'>قبلي</td>\n\t\t\t" . $prior_execute_date . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>فعلی</td>\n\t\t\t" . $current_execute_date . "\n\t\t</tr>"; if ($field_title != "") { echo "<tr>\n\t\t\t<td style='width:80px' rowspan=2> " . $field_title . "</td>\n\t\t\t<td>قبلی</td>\n\t\t\t" . $prior_field . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>فعلی</td>\n\t\t\t" . $current_field . "\n\t\t</tr>"; } if ($field_title2 != "" && $corrected_writs[0]["person_type"] != 1) { echo "<tr>\n\t\t\t<td style='width:80px' rowspan=2> " . $field_title2 . "</td>\n\t\t\t<td>قبلی</td>\n\t\t\t" . $prior_field2 . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>فعلی</td>\n\t\t\t" . $current_field2 . "\n\t\t</tr>"; } for ($i = 0; $i < count($salary_item_types); $i++) { if ($salary_item_types[$i]["salary_item_type_id"] == 10374 && $item46 == 1) { continue; } if ($salary_item_types[$i]["salary_item_type_id"] == 10370 && $item51 == 1) { continue; } if ($salary_item_types[$i]["salary_item_type_id"] == 10371 && $item50 == 1) { continue; } echo "\n\t\t<tr>\n\t\t\t<td style='width:80px' rowspan=2>" . $salary_item_types[$i]["print_title"] . "</td>\n\t\t\t<td>قبلي</td>\n\t\t\t" . $prior_writ_items[$i] . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>فعلی</td>\n\t\t\t" . $current_writ_items[$i] . "\n\t\t</tr>"; } echo "<tr>\n\t\t\t<td style='width:80px' rowspan=2>جمع کل</td>\n\t\t\t<td>قبلي</td>\n\t\t\t" . $prior_item_sum . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>فعلی</td>\n\t\t\t" . $current_item_sum . "\n\t\t</tr>"; $ret = ob_get_contents(); ob_end_clean(); return $ret; }
order by execute_date limit 1 " ; $resExe = PdoDataAccess::runquery($qry) ; $date = $resExe[0]['execute_date'] ; $result [$key]['staff_id'] =$rec['staff_id']; $result [$key]['writ_id'] =$rec['writ_id']; $result [$key]['emp_mode'] =$rec['emp_mode']; $result [$key]['pfname'] =$rec['pfname']; $result [$key]['plname'] =$rec['plname']; $result [$key]['unit_title'] =$rec['unit_title']; $result [$key]['sub_title'] =$rec['sub_title']; $result [$key]['ptitle'] =$rec['ptitle']; $result [$key]['pre_sience_level'] =$tp; $result [$key]['ouid'] =$rec['ouid']; $result [$key]['science_title'] =$rec['science_level_title']; $result [$key]['execute_date'] =DateModules::miladi_to_shamsi($date); $key++; } } ?> <html dir='rtl'> <head> <style> .reportGenerator {border-collapse: collapse;border: 1px solid black;font-family: tahoma;font-size: 8pt; text-align: center;width: 50%;padding: 2px;} .reportGenerator .header {color: white;font-weight: bold;background-color:#3F5F96}
function ShowReport($admin){ if($_POST["FromDate"] == "") { $StartDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] . "-01", "-"); $EndDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] ."-" . DateModules::DaysOfMonth($_POST["year"] ,$_POST["month"]), "-"); } else { $StartDate = DateModules::shamsi_to_miladi($_POST["FromDate"], "-"); $EndDate = DateModules::shamsi_to_miladi($_POST["ToDate"], "-"); } $holidays = ATN_holidays::Get(" AND TheDate between ? AND ? order by TheDate", array($StartDate, $EndDate)); $holidayRecord = $holidays->fetch(); $PersonID = $_SESSION["USER"]["PersonID"]; $PersonID = !empty($_POST["PersonID"]) ? $_POST["PersonID"] : $PersonID; $query = "select * from ( select 'normal' RecordType,'' ReqType, TrafficDate,TrafficTime,s.ShiftTitle,s.FromTime,s.ToTime ,ExceptFromTime,ExceptToTime from ATN_traffic t left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND TrafficDate between FromDate AND ToDate) left join ATN_shifts s on(ps.ShiftID=s.ShiftID) where t.IsActive='YES' AND t.PersonID=:p AND TrafficDate>= :sd AND TrafficDate <= :ed union All select 'start' RecordType,t.ReqType, t.FromDate,StartTime,s.ShiftTitle,s.FromTime,s.ToTime ,ExceptFromTime,ExceptToTime from ATN_requests t left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate) left join ATN_shifts s on(ps.ShiftID=s.ShiftID) where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd union all select 'end' RecordType,t.ReqType, t.FromDate,EndTime,s.ShiftTitle,s.FromTime,s.ToTime ,ExceptFromTime,ExceptToTime from ATN_requests t left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate) left join ATN_shifts s on(ps.ShiftID=s.ShiftID) where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd AND EndTime is not null )t2 order by TrafficDate,TrafficTime"; $dt = PdoDataAccess::runquery($query, array(":p" => $PersonID, ":sd" => $StartDate, ":ed" => $EndDate)); /*if($_SESSION["USER"]["UserName"] == "admin") { print_r(ExceptionHandler::PopAllExceptions()); echo PdoDataAccess::GetLatestQueryString(); }*/ //print_r($dt); //........................ create days array .................. $index = 0; $returnArr = array(); while($StartDate <= $EndDate) { if($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"]) { while($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"]) $returnArr[] = $dt[$index++]; $StartDate = DateModules::AddToGDate($StartDate, 1); continue; } $shiftRecord = ATN_PersonShifts::GetShiftOfDate($PersonID, $StartDate); $returnArr[] = array( "RecordType" => "normal", "TrafficID" => "", "TrafficDate" => $StartDate , "ShiftTitle" => $shiftRecord["ShiftTitle"], "FromTime" => $shiftRecord["FromTime"], "ToTime" => $shiftRecord["ToTime"], "ExceptFromTime" => $shiftRecord["ExceptFromTime"], "ExceptToTime" => $shiftRecord["ExceptToTime"], "TrafficTime" => ""); $StartDate = DateModules::AddToGDate($StartDate, 1); } //------------ holidays ------------------ for($i=0; $i<count($returnArr); $i++) { $holiday = false; $holidayTitle = "تعطیل"; if(FridayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "5") $holiday = true; if(ThursdayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "4") $holiday = true; if($holidayRecord && $holidayRecord["TheDate"] == $returnArr[$i]["TrafficDate"]) { $holidayTitle .= $holidayRecord["details"] != "" ? "(" . $holidayRecord["details"] . ")" : ""; $holiday = true; $holidayRecord = $holidays->fetch(); } $returnArr[$i]["holiday"] = $holiday; $returnArr[$i]["holidayTitle"] = $holidayTitle; } //........................................................... function ShowTime($arr){ if($arr[0] == "00" && $arr[1] == "00") return ""; return $arr[0] . ":" . $arr[1]; } $returnStr = ""; $SUM = array( "absence" => 0, "attend"=> 0, "firstAbsence" => 0, "lastAbsence" => 0, "extra" => 0, "Off" => 0, "mission" => 0, "DailyOff_1" => 0, "DailyOff_2" => 0, "DailyOff_3" => 0, "DailyMission" => 0, "DailyAbsence" => 0 ); for($i=0; $i < count($returnArr); $i++) { if(!$returnArr[$i]["holiday"]) { //........... Daily off and mission ................... $requests = PdoDataAccess::runquery(" select t.*, InfoDesc OffTypeDesc from ATN_requests t left join BaseInfo on(TypeID=20 AND InfoID=OffType) where ReqStatus=2 AND PersonID=:p AND FromDate <= :td AND if(ToDate is not null, ToDate >= :td, 1=1) order by ToDate desc,StartTime asc ", array( ":p" => $PersonID, ":td" => $returnArr[$i]["TrafficDate"] )); if(count($requests) > 0) { if($requests[0]["ReqType"] == "DayOFF") { $returnStr .= "<td>" . DateModules::$JWeekDays[ DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") ] . "</td> <td>" . DateModules::miladi_to_shamsi($returnArr[$i]["TrafficDate"]) . "</td> <td colspan=8> مرخصی " . $requests[0]["OffTypeDesc"] . "<td></tr>"; $SUM["DailyOff_" . $requests[0]["OffType"] ]++; $currentDay = $returnArr[$i]["TrafficDate"]; while($i < count($returnArr) && $currentDay == $returnArr[$i]["TrafficDate"]) $i++; $i--; continue; } if($requests[0]["ReqType"] == "DayMISSION") { $returnStr .= "<td>" . DateModules::$JWeekDays[ DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") ] . "</td> <td>" . DateModules::miladi_to_shamsi($returnArr[$i]["TrafficDate"]) . "</td> <td colspan=8> ماموریت " . $requests[0]["MissionSubject"] . "<td></tr>"; $SUM["DailyMission"]++; $currentDay = $returnArr[$i]["TrafficDate"]; while($i < count($returnArr) && $currentDay == $returnArr[$i]["TrafficDate"]) $i++; $i--; continue; } } } //.................................................... if( DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "l") == "Thursday") { $returnArr[$i]["FromTime"] = $returnArr[$i]["ExceptFromTime"]; $returnArr[$i]["ToTime"] = $returnArr[$i]["ExceptToTime"]; } //.................................................... $returnStr .= "<tr> <td>" . DateModules::$JWeekDays[ DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") ] . "</td>"; if($admin) $returnStr .= "<td><a class=link onclick=TraceTrafficObj.TrafficList('" . $returnArr[$i]["TrafficDate"] . "')>" . DateModules::miladi_to_shamsi($returnArr[$i]["TrafficDate"]) . "</a></td>"; else $returnStr .= "<td>" . DateModules::miladi_to_shamsi($returnArr[$i]["TrafficDate"]) . "</td>"; $returnStr .= "<td>" . ($returnArr[$i]["holiday"] ? $returnArr[$i]["holidayTitle"] : $returnArr[$i]["ShiftTitle"]) . "</td> <td>"; $firstAbsence = 0; $Off = 0; $mission = 0; $index = 1; $totalAttend = 0; $currentDay = $returnArr[$i]["TrafficDate"]; $startOff = 0; $endOff = 0; $extra = 0; if($returnArr[$i]["TrafficTime"] != "") { if(strtotime($returnArr[$i]["TrafficTime"]) > strtotime($returnArr[$i]["FromTime"])) $firstAbsence = strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i]["FromTime"]); else { if(strtotime($returnArr[$i+1]["TrafficTime"]) < strtotime($returnArr[$i]["FromTime"])) $extra += strtotime($returnArr[$i+1]["TrafficTime"]) - strtotime($returnArr[$i]["TrafficTime"]); else $extra += strtotime($returnArr[$i]["FromTime"]) - strtotime($returnArr[$i]["TrafficTime"]); } } while($i < count($returnArr) && $currentDay == $returnArr[$i]["TrafficDate"]) { //.................................................... if( DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "l") == "Thursday") { $returnArr[$i]["FromTime"] = $returnArr[$i]["ExceptFromTime"]; $returnArr[$i]["ToTime"] = $returnArr[$i]["ExceptToTime"]; } //.................................................... $returnStr .= substr($returnArr[$i]["TrafficTime"],0,5); $returnStr .= $index % 2 == 0 ? "<br>" : " - "; if($index % 2 == 0) { $totalAttend += strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i-1]["TrafficTime"]); if(strtotime($returnArr[$i]["TrafficTime"]) > strtotime($returnArr[$i]["ToTime"])) { if(strtotime($returnArr[$i-1]["TrafficTime"]) > strtotime($returnArr[$i]["ToTime"])) $extra += strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i-1]["TrafficTime"]); else $extra += strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i-1]["ToTime"]); } } if($returnArr[$i]["RecordType"] != "normal") { if($i>0 && $returnArr[$i-1]["TrafficDate"] == $currentDay && $returnArr[$i]["RecordType"] == "start") { if($i == 0 || $returnArr[$i-1]["TrafficDate"] != $currentDay) $startDiff = 0; else $startDiff = strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i-1]["TrafficTime"]); if($startDiff > Valid_Traffic_diff) $startOff = strtotime($returnArr[$i]["TrafficTime"]) - Valid_Traffic_diff; else $startOff = strtotime($returnArr[$i-1]["TrafficTime"]); } if( ($i==0 || $returnArr[$i-1]["TrafficDate"] != $currentDay) && $returnArr[$i]["RecordType"] == "start") { $startOff = strtotime($returnArr[$i]["TrafficTime"]); } if($returnArr[$i]["RecordType"] == "end") { if($i == count($returnArr)-1 || $returnArr[$i+1]["TrafficDate"] != $currentDay) $endDiff = 0; else $endDiff = strtotime($returnArr[$i+1]["TrafficTime"]) - strtotime($returnArr[$i]["TrafficTime"]); if($endDiff > Valid_Traffic_diff) $endOff = strtotime($returnArr[$i]["TrafficTime"]) - Valid_Traffic_diff; else $endOff = strtotime($returnArr[$i]["TrafficTime"]); if($returnArr[$i]["ReqType"] == "OFF") $Off += $endOff - $startOff; else $mission += $endOff - $startOff; } } $index++; $i++; } $i--; $lastAbsence = 0; if($returnArr[$i]["TrafficTime"] != "" && strtotime($returnArr[$i]["TrafficTime"]) < strtotime($returnArr[$i]["ToTime"])) $lastAbsence = strtotime($returnArr[$i]["ToTime"]) - strtotime($returnArr[$i]["TrafficTime"]); $ShiftDuration = strtotime($returnArr[$i]["ToTime"]) - strtotime($returnArr[$i]["FromTime"]); //$extra = ($totalAttend > $ShiftDuration) ? $totalAttend - $ShiftDuration : 0; $Absence = $totalAttend < $ShiftDuration ? $ShiftDuration - $totalAttend : 0; if($returnArr[$i]["holiday"]) { $extra = $totalAttend; $lastAbsence = 0; $firstAbsence = 0; $Absence = 0; $Off = 0; } if($Absence == $ShiftDuration) $SUM["DailyAbsence"]++; $SUM["absence"] += $Absence; $SUM["attend"] += $totalAttend; $SUM["firstAbsence"] += $firstAbsence; $SUM["lastAbsence"] += $lastAbsence; $SUM["extra"] += $extra; $SUM["Off"] += $Off; $SUM["mission"] += $mission; $totalAttend = TimeModules::SecondsToTime($totalAttend); $firstAbsence = TimeModules::SecondsToTime($firstAbsence); $lastAbsence = TimeModules::SecondsToTime($lastAbsence); $Absence = TimeModules::SecondsToTime($Absence); $extra = TimeModules::SecondsToTime($extra); $Off = TimeModules::SecondsToTime($Off); $mission = TimeModules::SecondsToTime($mission); $returnStr .= "</td><td class=attend>" . ShowTime($totalAttend) . "</td> <td class=extra>" . ShowTime($extra) . "</td> <td class=off>" . ShowTime($Off) . "</td> <td class=mission>" . ShowTime($mission) . "</td> <td class=sub>" . ShowTime($firstAbsence) . "</td> <td class=sub>" . ShowTime($lastAbsence) . "</td> <td class=sub>" . ShowTime($Absence) . "</td> </tr>"; } ?> <style> .reportTbl td {padding:4px;} .reportTbl th {padding:4px;text-align: center; background-color: #efefef; font-weight: bold} .reportTbl .attend { text-align:center} .reportTbl .extra { background-color: #D0F7E2; text-align:center} .reportTbl .off { background-color: #D7BAFF; text-align:center} .reportTbl .mission { text-align:center} .reportTbl .sub { background-color: #FFcfdd; text-align:center} .reportTbl .footer { background-color: #eee; text-align:center; line-height: 18px} </style> <table class="reportTbl" width="100%" border="1"> <tr class="blueText"> <th>روز</th> <th>تاریخ</th> <th>شیفت</th> <th style=width:70px>ورود/خروج</th> <th>حضور</th> <th class="extra">اضافه کار</th> <th class="off" >مرخصی</th> <th>ماموریت</th> <th class=sub>تاخیر</th> <th class=sub>تعجیل</th> <th class=sub>غیبت</th> </tr> <?= $returnStr ?> <tr class="footer"> <? $SUM["absence"] = TimeModules::SecondsToTime($SUM["absence"]); $SUM["attend"] = TimeModules::SecondsToTime($SUM["attend"] ); $SUM["firstAbsence"] = TimeModules::SecondsToTime($SUM["firstAbsence"]); $SUM["lastAbsence"] = TimeModules::SecondsToTime($SUM["lastAbsence"]); $SUM["extra"] = TimeModules::SecondsToTime($SUM["extra"]); $SUM["Off"] = TimeModules::SecondsToTime($SUM["Off"]); $SUM["mission"] = TimeModules::SecondsToTime($SUM["mission"]); ?> <td colspan="4"></td> <td><?= ShowTime($SUM["attend"]) ?></td> <td><?= ShowTime($SUM["extra"]) ?></td> <td><?= ShowTime($SUM["Off"]) ?></td> <td><?= ShowTime($SUM["mission"]) ?></td> <td><?= ShowTime($SUM["firstAbsence"]) ?></td> <td><?= ShowTime($SUM["lastAbsence"]) ?></td> <td><?= ShowTime($SUM["absence"]) ?></td> </tr> <tr class="footer"> <td colspan="4">مجموع عملکرد</td> <td colspan="3"> مجموع مرخصی استعلاجی : <?= $SUM["DailyOff_1"] ?><br> مجموع مرخصی استحقاقی : <?= $SUM["DailyOff_2"] ?><br> مجموع مرخصی بدون حقوق : <?= $SUM["DailyOff_3"] ?><br> </td> <td colspan="4"> مجموع ماموریت روزانه : <?= $SUM["DailyMission"] ?><br> مجموع غیبت روزانه : <?= $SUM["DailyAbsence"]?><br> </td> </tr> </table> <? die(); }
$FirstRec .= "," . "محمد"; $FirstRec .= "," . "کافی"; $FirstRec .= "," . "رئیس دانشگاه"; $FirstRec .= "," . "0932891608"; $FirstRec .= "," . "ابوالفضل"; $FirstRec .= "," . "باباخانی"; $FirstRec .= "," . "معاون اداری مالی" . "\r\n"; $Sitem_4 += $item_20 + $item_28; $Sitem_5 += $dataTable[$i]["item_32"]; $Sitem_6 += $dataTable[$i]["item_33"]; $Sitem_9 += $dataTable[$i]["item_34"]; $record .= $dataTable[$i]["item_1"] . "," . $dataTable[$i]["item_2"] . "," . $dataTable[$i]["item_3"] . "," . $dataTable[$i]["item_4"] . "," . $dataTable[$i]["item_5"] . "," . $dataTable[$i]["item_6"] . "," . $dataTable[$i]["item_7"] . "," . $dataTable[$i]["item_8"] . "," . $dataTable[$i]["item_9"] . "," . $dataTable[$i]["item_10"] . "," . $item_11 . "," . $dataTable[$i]["item_12"] . "," . $item_13 . "," . $item_14 . ", ," . $item_16 . "," . $dataTable[$i]["item_17"] . "," . $dataTable[$i]["item_18"] . ",0," . $item_20 . ",0," . $item_22 . ",0,0,0,0,0," . $item_28 . "," . $item_29 . "," . $item_30 . "," . $item_31 . "," . $item_32 . "," . $dataTable[$i]["item_33"] . ",0" . "\r\n"; } PdoDataAccess::runquery("SET NAMES 'utf8'"); if (isset($_REQUEST["summary"])) { list($eyear, $emonth, $eday) = preg_split('/[\\/]/', DateModules::miladi_to_shamsi($month_end)); list($cyear, $cmonth, $cday) = preg_split('/[\\/]/', $_POST["check_date"]); $SRec = "101902103472" . "," . $_POST["pay_year"] . "," . str_pad($_POST["pay_month"], 2, "0", STR_PAD_LEFT) . "," . $Sitem_4 . "," . $Sitem_5 . "," . $Sitem_6 . ",0,0," . $Sitem_9 . ",0,0,0,0,0,0," . $eyear . "" . $emonth . "" . $eday . "," . count($dataTable) . ",0,2," . $_POST["check-serial"] . "," . $cyear . "" . $cmonth . "" . $cday . "," . $_POST["BankCode"] . "," . $_POST["BankTitle"] . "," . $_POST["account_no"] . "," . $_POST["PayVal"]; $file = "WK" . $_POST["pay_year"] . str_pad($_POST["pay_month"], 2, "0", STR_PAD_LEFT) . ".TXT"; //$filename = "/mystorage/attachments/sadaf/HRProcess/".$file ; $filename = "../../../HRProcess/" . $file; $fp = fopen($filename, 'w'); fwrite($fp, $SRec); fclose($fp); header('Content-disposition: filename="' . $file . '"'); header('Content-type: application/file'); header('Pragma: no-cache'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo file_get_contents("../../../HRProcess/" . $file);
$col->align = "center"; $dg->emptyTextOfHiddenColumns = true; $dg->EnablePaging = false; $dg->height = 150; $dg->width = 790; $dg->EnablePaging = false; $dg->EnableSearch = false; $dg->autoExpandColumn = "fullname"; $grid = $dg->makeGrid_returnObjects(); //..................................................... $expertStr = ""; $dt = PLN_experts::Get(" AND e.PersonID=? AND StatusDesc='RAW'", array($_SESSION["USER"]["PersonID"])); if ($dt->rowCount() > 0) { $dt = $dt->fetchAll(); foreach ($dt as $row) { $expertStr .= "<div class=arrow_left style=width:16px;height:16px;float:right></div>" . "طرح شماره " . "<a href=javascript:void(1); onclick='framework.OpenPage\r\n\t\t\t\t(\"../plan/plan/PlanInfo.php\", \"جداول اطلاعاتی طرح\",{PlanID : " . $row["PlanID"] . "});'>[ " . $row["PlanID"] . " ]</a> جهت کارشناسی " . $row["ScopeDesc"] . " برای شما ارسال شده است و مهلت کارشناسی " . DateModules::miladi_to_shamsi($row["EndDate"]) . " می باشد." . "<br>"; } $expertStr .= "<br>"; } ?> <script> PlanStartPage.prototype = { TabID : '<?php echo $_REQUEST["ExtTabID"]; ?> ', address_prefix : "<?php echo $js_prefix_address; ?> ",
<tr> <td width="25%"> <img src="/framework/icons/logo.jpg" style="width:80px" /> </td> <td style="height: 60px;font-family: b titr;font-size:16px" align="center"> <br>سند حسابداری </td> <td width="20%" align="center" > شماره سند : <?php echo $DocObject->LocalNo; ?> <br> تاریخ سند : <?php echo DateModules::miladi_to_shamsi($DocObject->DocDate); ?> </td> </tr> <tr> <td colspan="3" align="center"> <table style="width:100%;border-collapse: collapse" border="1" cellspacing="0" cellpadding="2"> <tr class="header"> <td align="center" >کد حساب</td> <td align="center" >شرح ردیف</td> <td align="center" >تفصیلی</td> <td align="center" >تفصیلی2</td> <td align="center" >بدهکار</td> <td align="center" >بستانکار</td> </tr> <?
مطالبه شود به محض دریافت اولین تقاضانامه کتبی و بدون اینکه احتیاج به صدور اظهارنامه یا اقدامی از مجرای اداری، قضایی ویا مقام دیگری و یا ذکر علتی داشته باشد، مبلغ مورد درخواست <?php echo $ReqObj->_fullname; ?> را در وجه یا حواله کرد <?php echo $ReqObj->organization; ?> بپردازد. <br> این ضمانت نامه تا آخر ساعت اداری روز <?php echo DateModules::miladi_to_shamsi($ReqObj->EndDate); ?> ( <?php echo DateModules::DateToString(DateModules::miladi_to_shamsi($ReqObj->EndDate)); ?> ) معتبر بوده و بنا به درخواست <?php echo $ReqObj->organization; ?> برای مدتی که درخواست شود قابل تمدید خواهد بود و در صورتی که صندوق نتواند و یا نخواهد مدت ضمانت نامه را تمدید نماید و یا <?php echo $ReqObj->_fullname; ?> موجبات تمدید را قبل از انقضای مدت فوق نزد صندوق فراهم نسازد و صندوق را حاضر به تمدید ننماید، صندوق در اینصورت متعهد است بدون اینکه احتیاج به مطالبه مجدد باشد مبلغ مرقوم فوق را در وجه یا حواله کرد <?php echo $ReqObj->organization;
<td colspan="3"><?php echo $jfid; ?> </td> </tr> <tr> <td>تاریخ شروع اعتبار :</td> <td><input type="text" class="x-form-text x-form-field" name="validity_start" id="validity_start" value="<?php echo DateModules::miladi_to_shamsi($obj->validity_start); ?> "></td> <td>تاریخ پایان اعتبار :</td> <td><input type="text" class="x-form-text x-form-field" name="validity_end" id="validity_end" value="<?php echo DateModules::miladi_to_shamsi($obj->validity_end); ?> "></td> </tr> <tr> <td>توضیحات:</td> <td colspan="3"><textarea type="text" class="x-form-field" name="description" rows="3" style="width:90%" id="description" ><?php echo $obj->description; ?> </textarea></td> </tr> <tr> <td height="21px">داخل شمول :</td> <td colspan="3"><input type="checkbox" id="included" name="included" value="1" <?php echo $obj->included == "1" ? "checked" : "";
</tr> </table> <table style="text-align: right;" class="reportGenerator" cellpadding="4" cellspacing="0" > <? for($i=0 ; $i<count($res);$i++) { echo " <tr> <td width='4%'>".($i+1)."</td> <td width='10%'>".$res[$i]["staff_id"]."</td> <td width='12%'>".$res[$i]["plname"]."</td> <td width='8%'>".$res[$i]["pfname"]."</td> <td width='21%'>".$res[$i]["full_unit_title"]."</td> <td width='17%'>".$res[$i]["title"]."</td> <td width='8%'>".$res[$i]["from_date"]."</td> <td width='8%'>".DateModules::miladi_to_shamsi($res[$i]["to_date"])."</td>" ; if ($_POST['HavePost'] == 1) echo "<td width='12%'>".$res[$i]["mng_value"]."</td></tr>" ; } ?> </table> </center> </body> </html> <? die() ;
$temp[$i]['personel_relation'] = "خواهر شهيد"; } elseif($resIsar[$k]['devotion_type'] == 5 && $resIsar[$k]['personel_relation'] == 7 ) { $temp[$i]['personel_relation'] = "برادر شهيد"; } } $IsarTitle = substr($IsarTitle,0, -3 ) ; $temp[$i]['isar'] = $IsarTitle; if( $temp[$i]['min_execute_date']!="" && $temp[$i]['min_execute_date']!='0000-00-00') $temp[$i]['min_execute_date'] = DateModules::miladi_to_shamsi($temp[$i]['min_execute_date']); } $item17 = ($_POST['PersonType'] == 1 ) ? "مرتبه علمی" : "رتبه" ; $item32 = ($_POST['PersonType'] == 1 ) ? "حقوق ماهانه" : "حقوق پایه و مرتبه" ; $item36 = ($_POST['PersonType'] == 1 ) ? " فو ق العاده سختی شرایط محیط کار " : "فوق العاده مدیریت" ; $item38 = ($_POST['PersonType'] == 1 ) ? "فوق العاده کار با اشعه" : "ما به التفاوت مقامات" ; $item39 = ($_POST['PersonType'] == 1 ) ? " " : "<td>فوق العاده سختی کار</td><td>فوق العاده کار با اشعه</td>" ; //.............................................................................. if ($_GET['excel'] == 'true') { ini_set("display_errors", "On");
</table> <table style="text-align: right;" class="reportGenerator" cellpadding="4" cellspacing="0" > <? for($i=0 ; $i<count($temp);$i++) { echo " <tr> <td width='4%'>".($i+1)."</td> <td width='12%'>".$temp[$i]["lname"]."</td> <td width='8%'>".$temp[$i]["fname"]."</td> <td width='10%'>".$temp[$i]["Title"]."</td> <td width='21%'>".$temp[$i]["idcard_no"]."</td> <td width='17%'>".DateModules::miladi_to_shamsi($temp[$i]["birth_date"])."</td> <td width='8%'>".$temp[$i]["father_name"]."</td> <td width='8%'>".$temp[$i]["insure_type"]."</td> <td width='8%'>".DateModules::miladi_to_shamsi($temp[$i]["from_date"])."</td>". "</tr>" ; } ?> </table> </center> </body> </html> <? die() ; }
{ $tbl_content .= "<tr " . ($i%2 == 1 ? "style='background-color:#efefef'" : "") . "> <td width=250px>[" . ($i+1) . "]". ($i+1<10 ? " " : "") . " <img align='top' src='/generalUI/ext4/resources/themes/icons/user_comment.gif'> "; if($Logs[$i]["ActType"] == "CONFIRM") $tbl_content .= "تایید اطلاعات"; if($Logs[$i]["ActType"] == "REJECT") $tbl_content .= "رد اطلاعات"; if($Logs[$i]["ActType"] == "EDIT") $tbl_content .= "ویرایش اطلاعات"; $tbl_content .= "</td> <td width=150px>" . $Logs[$i]["fullname"] . "</td> <td width=110px>" . substr($Logs[$i]["ActDate"], 11) . " " . DateModules::miladi_to_shamsi($Logs[$i]["ActDate"]) . "</td> <td><div style='cursor:pointer' class='qtip-target' data-qtip='" . $Logs[$i]["ActDesc"] . "'>" . String::ellipsis($Logs[$i]["ActDesc"], 48). "</div></td> </tr>"; } } ?> <style> .infotd td{border-bottom: solid 1px #e8e8e8;padding-right:4px; height: 21px;} </style> <div style="background-color:white;width: 100%; height: 100%"> <table class="infotd" width="100%" bgcolor="white" cellpadding="0" cellspacing="0"> <?= $tbl_content ?> </table>
if ($index == $i) { if ($data[$i][military_from_date] != "" && $data[$i][military_to_date] != "" && $data[$i][military_duration] != "") { $history_row[DateModules::miladi_to_shamsi($data[$i][military_from_date]) . "_1"] = "<tr>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($data[$i][military_from_date]) . "</td>\n\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($data[$i][military_to_date]) . "</td>\n\t\t\t\t\t<td>" . floor($data[$i][military_duration] / 12) . "</td>\n\t\t\t\t\t<td>" . ($data[$i][military_duration] - floor($data[$i][military_duration] / 12) * 12) . "</td>\n\t\t\t\t\t<td>0</td>\n\t\t\t\t\t<td>قابل قبول</td>\n\t\t\t\t\t<td>سربازی</td>\n\t\t\t\t\t<td>سربازی</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>"; $total_year += floor($data[$i][military_duration] / 12); $total_month += $data[$i][military_duration] - floor($data[$i][military_duration] / 12) * 12; $total_day += 0; } //...................................................................... require_once "../../personal/persons/class/employment.class.php"; $temp = manage_person_employment::GetAllEmp("PersonID=" . $data[$i][PersonID]); $history2 = ""; for ($j = 0; $j < count($temp); $j++) { if ($temp[$j]["retired_duration_year"] != 0 || $temp[$j]["retired_duration_month"] != 0 || $temp[$j]["retired_duration_day"] != 0) { $history_row[DateModules::miladi_to_shamsi($temp[$j]["from_date"]) . "_2"] = "<tr>\n\t\t\t\t\t\t<td>" . $temp[$j]["title"] . "</td>\n\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($temp[$j]["from_date"]) . "</td>\n\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($temp[$j]["to_date"]) . "</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["retired_duration_year"] . "</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["retired_duration_month"] . "</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["retired_duration_day"] . "</td>\n\t\t\t\t\t\t<td>قابل قبول</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["organization"] . "</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["empstateTitle"] . "</td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t</tr>"; $total_year += $temp[$j]["retired_duration_year"]; $total_month += $temp[$j]["retired_duration_month"]; $total_day += $temp[$j]["retired_duration_day"]; } //------------------------------------------------------------------ $year = floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"])) / 365.25); $month = floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"]) - floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"])) / 365.25) * 365.25) / 30.4375); $day = ($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"]) - floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"])) / 365.25) * 365.25 - round(floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"]) - floor((($temp[$j]["duration_year"] - $temp[$j]["retired_duration_year"]) * 365.25 + ($temp[$j]["duration_month"] - $temp[$j]["retired_duration_month"]) * 30.4375 + ($temp[$j]["duration_day"] - $temp[$j]["retired_duration_day"])) / 365.25) * 365.25) / 30.4375) * 30.4375); if ($year != 0 || $month != 0 || $day != 0) { $history_row[DateModules::miladi_to_shamsi($temp[$j]["from_date"]) . "_3"] = "<tr>\n\t\t\t\t\t\t<td>" . $temp[$j]["title"] . "</td>\n\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($temp[$j]["from_date"]) . "</td>\n\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($temp[$j]["to_date"]) . "</td>\n\t\t\t\t\t\t<td>" . $year . "</td>\n\t\t\t\t\t\t<td>" . $month . "</td>\n\t\t\t\t\t\t<td>" . round($day) . "</td>\n\t\t\t\t\t\t<td>غیر قابل قبول</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["organization"] . "</td>\n\t\t\t\t\t\t<td>" . $temp[$j]["empstateTitle"] . "</td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t</tr>"; $total_non_year += $year; $total_non_month += $month; $total_non_day += $day; } } } }
require_once '../dms/dms.class.php'; $LetterID = !empty($_GET["LetterID"]) ? $_GET["LetterID"] : ""; if (empty($LetterID)) { die; } $LetterObj = new OFC_letters($LetterID); //.............................................................................. $letterYear = substr(DateModules::miladi_to_shamsi($LetterObj->LetterDate), 0, 4); $content = "<br><div style=margin-left:30px;float:left; >شماره نامه : " . "<span dir=ltr>" . $letterYear . "-" . $LetterObj->LetterID . "</span>" . "<br>تاریخ نامه : " . DateModules::miladi_to_shamsi($LetterObj->LetterDate); if ($LetterObj->LetterType == "INCOME") { $content .= "<br>شماره نامه وارده : " . $LetterObj->InnerLetterNo; $content .= "<br>تاریخ نامه وارده : " . DateModules::miladi_to_shamsi($LetterObj->InnerLetterDate); } if ($LetterObj->RefLetterID != "") { $refObj = new OFC_letters($LetterObj->RefLetterID); $RefletterYear = substr(DateModules::miladi_to_shamsi($refObj->LetterDate), 0, 4); $content .= "<br>عطف به نامه : <a href=javascript:void(0) onclick=LetterInfo.OpenRefLetter(" . $LetterObj->RefLetterID . ")>" . "<span dir=ltr>" . $RefletterYear . "-" . $LetterObj->RefLetterID . "</span></a>"; } $content .= "</div><br><br>"; $content .= "<b><br><div align=center>بسمه تعالی</div><br>"; $dt = PdoDataAccess::runquery("\r\n\tselect p2.sex,FromPersonID,p3.PersonSign signer, p1.PersonSign regSign,\r\n\t\tif(p1.IsReal='YES',concat(p1.fname, ' ', p1.lname),p1.CompanyName) RegPersonName ,\r\n\t\tif(p2.IsReal='YES',concat(p2.fname, ' ', p2.lname),p2.CompanyName) ToPersonName ,\r\n\t\tconcat(p3.fname, ' ', p3.lname) SignPersonName ,\r\n\t\tpo.PostName,\r\n\t\ts.IsCopy\r\n\tfrom OFC_send s\r\n\t\tjoin OFC_letters l using(LetterID)\r\n\t\tjoin BSC_persons p1 on(l.PersonID=p1.PersonID)\r\n\t\tjoin BSC_persons p2 on(s.ToPersonID=p2.PersonID)\r\n\t\tleft join BSC_persons p3 on(l.SignerPersonID=p3.PersonID)\r\n\t\tleft join BSC_posts po on(l.SignPostID=po.PostID)\r\n\twhere LetterID=? \r\n\torder by SendID\r\n\t", array($LetterID)); if ($LetterObj->LetterType == "INNER") { foreach ($dt as $row) { if ($row["FromPersonID"] != $LetterObj->PersonID || $row["IsCopy"] == "YES") { continue; } $content .= $row["sex"] == "MALE" ? "جناب آقای " : "سرکار خانم "; $content .= $row['ToPersonName'] . "<br>"; } $content .= "<br> موضوع : " . $LetterObj->LetterTitle . "<br><br></b>"; $content .= str_replace("\r\n", "", $LetterObj->context);
function selectArrearTransferWrits() { MakeAdvanceSearchWhere($where, $whereParam); $state; $state = isset($_REQUEST["return"]) ? "1" : "0"; $stateWhere = ""; $stateWhere = " w.arrear = " . $state . " AND "; $curYear = DateModules::GetYear(DateModules::miladi_to_shamsi(DateModules::Now())); $query = "select w.writ_id,\n w.writ_ver,\n w.staff_id,\n w.ouid,\n w.issue_date,\n w.history_only,\n w.corrective,\n w.execute_date,\n concat(wt.title,' - ', wst.title) as wt_title,\n bi_emp_state.title as emp_state_title,\n w.ref_letter_no,\n w.ref_letter_date,\n w.person_type,\n concat(p.pfname, ' ', p.plname) fullname,\n w.corrective_writ_id,\n w.correct_completed,\n\t\t\t\t\t w.view_flag\n\t\t\t\t\n\t\t\t\tfrom staff s\n \n \t\t LEFT OUTER JOIN writs w ON (w.staff_id = s.staff_id)\n LEFT OUTER JOIN writ_types wt ON ((w.writ_type_id = wt.writ_type_id) AND (w.person_type = wt.person_type))\n LEFT OUTER JOIN writ_subtypes wst ON (w.writ_subtype_id = wst.writ_subtype_id AND w.writ_type_id = wst.writ_type_id \n \t\t\t\t\t\t\t\t\t\t\tAND w.person_type = wst.person_type)\n LEFT OUTER JOIN persons p ON (s.PersonID = p.PersonID)\n LEFT OUTER JOIN org_new_units o ON (w.ouid = o.ouid)\n LEFT JOIN Basic_Info bi_emp_state on(bi_emp_state.TypeID=3 and w.emp_state=bi_emp_state.InfoID)\n LEFT JOIN payment_writs pw ON pw.writ_id = w.writ_id and pw.writ_ver = w.writ_ver and pw.staff_id = w.staff_id \n\t\t\t\t \n\t\t\twhere w.execute_date >= '" . TRANSFER_WRIT_EXE_DATE . "' AND w.state = 3 AND \n\t\t\t\t w.execute_date < '" . str_replace("/", "-", DateModules::shamsi_to_miladi($curYear . "/01/01")) . "' AND\t\t\t\t \n\t\t\t\t substr(g2j(w.execute_date),1,4) < substr(g2j(writ_recieve_date),1,4) AND \n\t\t\t\t {$stateWhere}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n s.person_type in (" . manage_access::getValidPersonTypes() . ") AND w.cost_center_id in (" . manage_access::getValidCostCenters() . ") AND\n\t\t\t\tw.emp_state <> 0 AND\n\t\t\t\t(w.history_only=0 OR w.history_only IS NULL) AND \n\t\t\t\t(w.dont_transfer = 0 OR w.dont_transfer IS NULL) AND\n ( pw.writ_id is null ) AND\n\t\t\t\t(w.correct_completed!=" . WRIT_CORRECTING . ") AND " . $where . "\n\t\t\t\n\t\t\torder by p.plname,p.pfname,s.staff_id,w.execute_date,w.writ_id,w.writ_ver"; $temp = PdoDataAccess::runquery($query, $whereParam); /*if($_SESSION['UserID'] == 'jafarkhani') { echo PdoDataAccess::GetLatestQueryString(); die(); }*/ for ($i = 0; $i < count($temp); $i++) { $temp[$i]['full_unit_title'] = manage_units::get_full_title($temp[$i]['ouid']); } echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]); die; }
public static function get_arrear_document($staff_id, $pay_year, $pay_month) { for ($t = $_POST['from_pay_year']; $t < $_POST['to_pay_year'] + 1; $t++) { $retCoef = 1; $qry = " select max(arrear_ver) MV\r\n\t\t\t\t\tfrom corrective_payment_writs \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . "\r\n\t\t "; $MaxVer = PdoDataAccess::runquery($qry); if (count($MaxVer) == 0 || $MaxVer[0]['MV'] == 0) { continue; } $qry = " select cpw.staff_id , cpw.writ_id , cpw.writ_ver , cpw.arrear_ver , w.execute_date, w.send_letter_no , w.salary_pay_proc\r\n\t\t\r\n\t\t\t\t from corrective_payment_writs cpw inner join writs w \r\n\t\t\t on cpw.staff_id = w.staff_id and \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpw.writ_id = w.writ_id and \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpw.writ_ver = w.writ_ver \r\n\r\n\t\t\t where cpw.pay_year = " . $t . " and cpw.staff_id = " . $SID . " and arrear_ver = " . $MaxVer[0]['MV'] . " and cpw.pay_month = 12 \r\n\t\t\t order by w.execute_date "; $res1 = PdoDataAccess::runquery($qry); //............................. پیدا کردن آخرین ماهی که فیش حقوقی در آن محاسبه شده است ................ $qry = " select max(pay_month) PM from payment_writs where staff_id = " . $SID . " AND pay_year= " . $t; $MaxMonth = PdoDataAccess::runquery($qry); if ($MaxMonth[0]['PM'] > 0 && $MaxMonth[0]['PM'] < 7) { $LastDate = $t . "/" . $MaxMonth[0]['PM'] . "/31"; } else { if ($MaxMonth[0]['PM'] > 6 && $MaxMonth[0]['PM'] < 12) { $LastDate = $t . "/" . $MaxMonth[0]['PM'] . "/30"; } else { if ($MaxMonth[0]['PM'] == 12) { $LastDate = $t . "/" . $MaxMonth[0]['PM'] . "/29"; } else { $LastDate = '0000-00-00'; } } } $LAST_PAY_DATE = date('Y-m-d', strtotime(DateModules::shamsi_to_miladi($LastDate) . "+1 days")); $LAST_PAY_DATE = DateModules::miladi_to_shamsi($LAST_PAY_DATE); if ($res1[count($res1) - 1]['salary_pay_proc'] == 1) { $LastDate = DateModules::miladi_to_shamsi($res1[count($res1) - 1]['execute_date']); $arr = preg_split('/\\//', $LastDate); $NewDate = date('Y-m-d', strtotime(DateModules::shamsi_to_miladi($LastDate) . "-1 days")); $LastDate = DateModules::miladi_to_shamsi($NewDate); $arr = preg_split('/\\//', $LastDate); } $LD = array(); //................................................................................................. for ($i = 0; $i < count($res1); $i++) { if ($LastDate != '0000-00-00' && DateModules::CompareDate($res1[$i]['execute_date'], str_replace("/", "-", DateModules::shamsi_to_miladi($LastDate))) >= 0) { $LD[$t]['lastDate'] = $LastDate; break; } $CDate = DateModules::miladi_to_shamsi($res1[$i]['execute_date']); $arr2 = preg_split('/\\//', $CDate); if (intval($arr2[1]) <= intval($MaxMonth[0]['PM'])) { $qry = " select t.staff_id,max_execute_date ,SUBSTRING(max_execute_date,1,10) execute_date ,\r\n\t\t\t\t\t\tSUBSTRING_INDEX(SUBSTRING(max_execute_date,11),'.',1) writ_id,\r\n\t\t\t\t\t\tSUBSTRING_INDEX(max_execute_date,'.',-1) writ_ver\r\n\r\n\t\t\t\t\tfrom (\r\n\t\t\t\t\t\t\tselect w.staff_id,max( CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver) ) max_execute_date\r\n\r\n\t\t\t\t\t\t\tfrom payment_writs cpw inner join writs w\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton cpw.staff_id = w.staff_id and\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpw.writ_id = w.writ_id and\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpw.writ_ver = w.writ_ver\r\n\t\t\t\t\t\t\twhere cpw.pay_year = " . $t . " and cpw.staff_id = " . $SID . " and\r\n\t\t\t\t\t\t\t /*cpw.pay_month = 12 and*/ execute_date <= '" . $res1[$i]['execute_date'] . "'\r\n\r\n\t\t\t\t\t\t\tgroup by w.staff_id\r\n\t\t\t\t\t\t) t\r\n\t\t\t\t\t\t\t"; // پرس و جو بالا هم بایستی union شود با ورژن های قبلی پرداخت تا احکام آنها هم دیده شود . $res2 = PdoDataAccess::runquery($qry); if (count($res2) == 0) { $res2[0]['execute_date'] = '0000-00-00'; $res2[0]['writ_id'] = 0; $res2[0]['writ_ver'] = 0; } } else { $res2[0]['execute_date'] = '0000-00-00'; $res2[0]['writ_id'] = 0; $res2[0]['writ_ver'] = 0; } /* PdoDataAccess::runquery(" insert compare_arrear_writs (staff_id ,current_execute_date , current_writ_id , current_writ_ver, prev_execute_date , prev_writ_id , prev_writ_ver , arrear_ver , pay_year ) values (" . $res1[$i]['staff_id'] . ",'" . $res1[$i]['execute_date'] . "'," . $res1[$i]['writ_id'] . "," . $res1[$i]['writ_ver'] . ",'" . $res2[0]['execute_date'] . "'," . $res2[0]['writ_id'] . "," . $res2[0]['writ_ver'] . "," . $res1[$i]['arrear_ver'] . "," . $t . " ) "); */ if ($res1[$i]['writ_id'] == $res2[0]['writ_id'] && $res1[$i]['writ_ver'] == $res2[0]['writ_ver']) { continue; } $writNo++; } //..................اگر برج 12 در دیون محاسبه می شود ولی در قبلی نبوده است بایستی به جدول compare افزوده شود.............................. /* if ($res1[(count($res1) - 1)]['salary_pay_proc'] != 1 && $MaxMonth[0]['PM'] < 12) { $qry = " select staff_id , execute_date , writ_id , writ_ver from writs where staff_id = " . $SID . " and salary_pay_proc = 1 and execute_date >= '" . DateModules::shamsi_to_miladi($t . '/01/01') . "' and execute_date <= '" . DateModules::shamsi_to_miladi($t . '/12/29') . "' and issue_date >= '" . $res1[$i - 1]['execute_date'] . "' and state = 3 "; $res3 = PdoDataAccess::runquery($qry); PdoDataAccess::runquery(" insert compare_arrear_writs ( staff_id ,current_execute_date , current_writ_id , current_writ_ver, prev_execute_date , prev_writ_id , prev_writ_ver , arrear_ver , pay_year ) values (" . $SID . ",'" . $res1[$i - 1]['execute_date'] . "'," . $res1[$i - 1]['writ_id'] . "," . $res1[$i - 1]['writ_ver'] . ",'" . $res3[0]['execute_date'] . "'," . $res3[0]['writ_id'] . "," . $res3[0]['writ_ver'] . "," . $res1[$i - 1]['arrear_ver'] . "," . $t . " ) "); } */ //....................we need this part...................... $res = PdoDataAccess::runquery(" select * \r\n\t\t\t\t\t\t\t\t\t\tfrom compare_arrear_writs \r\n\t\t\t\t\t\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year =" . $t . " and arrear_ver = " . $MaxVer[0]['MV']); for ($i = 0; $i < count($res); $i++) { $writsWhereClause .= ' (wsi.writ_id=' . $res[$i]['current_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['current_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ') OR (wsi.writ_id=' . $res[$i]['prev_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['prev_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ' ) OR '; $PrewritsWhereClause .= ' (wsi.writ_id=' . $res[$i]['prev_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['prev_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ' ) OR '; $CurrwritsWhereClause .= ' (wsi.writ_id=' . $res[$i]['current_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['current_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ') OR '; } //............................................................. } $writsWhereClause = substr($writsWhereClause, 0, strlen($writsWhereClause) - 4); $PrewritsWhereClause = substr($PrewritsWhereClause, 0, strlen($PrewritsWhereClause) - 4); $CurrwritsWhereClause = substr($CurrwritsWhereClause, 0, strlen($CurrwritsWhereClause) - 4); $ResITM2 = PdoDataAccess::runquery(" select distinct wsi.salary_item_type_id , sit.print_title ,sit.month_length_effect\r\n\t\t\t\t\t\t\t\t\t\t\t from writ_salary_items wsi \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join salary_item_types sit \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton wsi.salary_item_type_id = sit.salary_item_type_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere " . $writsWhereClause); //.............................................................................. $ResITM = array(); $diffVal = 0; for ($j = 0; $j < count($ResITM2); $j++) { $res6 = PdoDataAccess::runquery(" select wsi.salary_item_type_id , sit.print_title , sum(wsi.value) CurrVal \r\n\t\t\t\t\t\t\t\t\t\t\t from writ_salary_items wsi \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join salary_item_types sit \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton wsi.salary_item_type_id = sit.salary_item_type_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere wsi.must_pay = 1 and (" . $CurrwritsWhereClause . ") and wsi.salary_item_type_id =" . $ResITM2[$j]['salary_item_type_id']); $res7 = PdoDataAccess::runquery(" select wsi.salary_item_type_id , sit.print_title , sum(wsi.value) PreVal \r\n\t\t\t\t\t\t\t\t\t\t\t from writ_salary_items wsi \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join salary_item_types sit \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton wsi.salary_item_type_id = sit.salary_item_type_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere wsi.must_pay = 1 and (" . $PrewritsWhereClause . ") and wsi.salary_item_type_id =" . $ResITM2[$j]['salary_item_type_id']); $diffVal = $res6[0]['CurrVal'] - $res7[0]['PreVal']; if ($diffVal != 0) { $diffVal = 0; $ResITM[] = array('salary_item_type_id' => $ResITM2[$j]['salary_item_type_id'], 'print_title' => $ResITM2[$j]['print_title'], 'month_length_effect' => $ResITM2[$j]['month_length_effect']); } else { //.................................... چنانچه قلمی در حکم فعلی حذف شده باشد................. for ($i = 0; $i < count($res); $i++) { $res6 = PdoDataAccess::runquery(' select wsi.salary_item_type_id , sit.print_title , sum(wsi.value) CurrVal from writ_salary_items wsi inner join salary_item_types sit on wsi.salary_item_type_id = sit.salary_item_type_id where wsi.must_pay = 1 and (wsi.writ_id=' . $res[$i]['prev_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['prev_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ' ) and wsi.salary_item_type_id =' . $ResITM2[$j]['salary_item_type_id']); $res7 = PdoDataAccess::runquery(' select wsi.salary_item_type_id , sit.print_title , sum(wsi.value) PreVal from writ_salary_items wsi inner join salary_item_types sit on wsi.salary_item_type_id = sit.salary_item_type_id where wsi.must_pay = 1 and (wsi.writ_id=' . $res[$i]['current_writ_id'] . ' AND wsi.writ_ver=' . $res[$i]['current_writ_ver'] . ' AND wsi.staff_id=' . $res[$i]['staff_id'] . ') and wsi.salary_item_type_id =' . $ResITM2[$j]['salary_item_type_id']); if (count($res6) != count($res7) || $res6[0]['CurrVal'] != $res7[0]['PreVal']) { if (!in_array($ResITM2[$j]['salary_item_type_id'], $ResITM)) { $ResITM[] = array('salary_item_type_id' => $ResITM2[$j]['salary_item_type_id'], 'print_title' => $ResITM2[$j]['print_title'], 'month_length_effect' => $ResITM2[$j]['month_length_effect']); } } } } } //.......................................................................... $TotalsumDiff = $TotalMainVal = $TotalRowTax = $TotalRowIns = $TotalRowRet = $TotalPay = 0; for ($t = $_POST['from_pay_year']; $t < $_POST['to_pay_year'] + 1; $t++) { $retCoef = 1; $qry = " select max(arrear_ver) MV\r\n\t\t\t\t\tfrom corrective_payment_writs \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . "\r\n\t\t "; $MaxVer = PdoDataAccess::runquery($qry); if (count($MaxVer) == 0 || $MaxVer[0]['MV'] == 0) { continue; } $res = PdoDataAccess::runquery(" select * \r\n\t\t\t\t\t\t\t\t\t\tfrom compare_arrear_writs \r\n\t\t\t\t\t\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year =" . $t . " and arrear_ver = " . $MaxVer[0]['MV']); $prior_execute_date = $current_execute_date = $prior_writ_type = $current_writ_type = ''; $current_writ_items = $prior_writ_items = array(); $sdate = ""; for ($i = 0; $i < count($res); $i++) { if ($res[$i]['current_writ_id'] == $res[$i]['prev_writ_id'] && $res[$i]['current_writ_ver'] == $res[$i]['prev_writ_ver']) { continue; } if (!empty($LD[$t]['lastDate'])) { $toDate = $LD[$t]['lastDate']; } else { if ($LastDate == '0000-00-00') { $toDate = $t . "/12/30"; } else { $toDate = DateModules::CompareDate(str_replace("/", "-", DateModules::shamsi_to_miladi($t . "/12/30")), str_replace("/", "-", DateModules::shamsi_to_miladi($LastDate))) >= 0 ? $LastDate : $t . "/12/30"; } } /* if ($sdate != "" && $sdate > '0000-00-00') $Row .= "<td>" . $sdate . "</td>"; else $Row .= "<td>" .DateModules::miladi_to_shamsi($res[$i]['current_execute_date']). "</td>"; */ if ($res[$i]['current_execute_date'] == $res[$i + 1]['current_execute_date']) { //$Row .= "<td>" . DateModules::AddToJDate($toDate, 1) . "</td>"; $sdate = DateModules::AddToJDate($toDate, 1); } /*else if ($sdate != "" && $sdate > '0000-00-00' && empty($res[$i + 1]['current_execute_date'])) $Row .= "<td>" . $t . "/12/29" . "</td>"; elseif($res[$i + 1]['current_execute_date'] !='0000-00-00' && DateModules::CompareDate(DateModules::miladi_to_shamsi($res[$i + 1]['current_execute_date']),$LAST_PAY_DATE) == 1 ) { $Row .= "<td>" . $LAST_PAY_DATE . "</td>"; } else $Row .= "<td>" . ( empty($res[$i + 1]['current_execute_date']) ? $toDate : DateModules::miladi_to_shamsi($res[$i + 1]['current_execute_date']) ) . "</td>"; */ if (!empty($LD[$t]['lastDate'])) { $toDate2 = DateModules::shamsi_to_miladi(DateModules::AddToJDate($LD[$t]['lastDate'], 1)); } else { if ($LastDate == '0000-00-00') { $toDate2 = DateModules::shamsi_to_miladi($t + 1 . "/01/01"); } else { $toDate2 = DateModules::CompareDate(str_replace("/", "-", DateModules::shamsi_to_miladi($t . "/12/30")), str_replace("/", "-", DateModules::shamsi_to_miladi($LastDate))) >= 0 ? DateModules::AddToJDate($LastDate, 1) : DateModules::shamsi_to_miladi($t + 1 . "/01/01"); } } $endDate = empty($res[$i + 1]['current_execute_date']) ? $toDate2 : $res[$i + 1]['current_execute_date']; if ($res[$i]['current_execute_date'] == $res[$i + 1]['current_execute_date']) { $endDate = $toDate2; } if ($sdate != "" && $sdate > '0000-00-00' && empty($res[$i + 1]['current_execute_date'])) { $endDate = $t + 1 . "/1/01"; if ($resPerInfo[0]['person_type'] == 3) { $DayNo = round(DateModules::GDateMinusGDate(DateModules::shamsi_to_miladi($endDate), DateModules::shamsi_to_miladi($sdate))); $DayNo2 = calculate_duration($sdate, $endDate); } else { $DayNo = calculate_duration($sdate, $endDate); } } else { if ($resPerInfo[0]['person_type'] == 3) { $DayNo = round(DateModules::GDateMinusGDate(DateModules::shamsi_to_miladi($endDate), $res[$i]['current_execute_date'])); $DayNo2 = calculate_duration($res[$i]['current_execute_date'], $endDate); } else { $DayNo = calculate_duration($res[$i]['current_execute_date'], $endDate); } } if ($res[$i + 1]['current_execute_date'] != '0000-00-00' && DateModules::CompareDate(DateModules::miladi_to_shamsi($res[$i + 1]['current_execute_date']), $LAST_PAY_DATE) == 1) { $DayNo = calculate_duration($res[$i]['current_execute_date'], DateModules::shamsi_to_miladi($LAST_PAY_DATE)); } // $Row .= "<td>" . $DayNo . "</td>"; $sumDiff = $MainVal = 0; $RetInc = $TaxInc = $InsInc = 0; for ($j = 0; $j < count($ResITM); $j++) { $val1 = get_writSalaryItem_value($res[$i]["current_writ_id"], $res[$i]["current_writ_ver"], $res[$i]["staff_id"], $ResITM[$j]["salary_item_type_id"]); $val2 = get_writSalaryItem_value($res[$i]["prev_writ_id"], $res[$i]["prev_writ_ver"], $res[$i]["staff_id"], $ResITM[$j]["salary_item_type_id"]); $RetRes = PdoDataAccess::runquery(" select retired_include , tax_include , insure_include \r\n from salary_item_types where salary_item_type_id = " . $ResITM[$j]["salary_item_type_id"]); // $Row .= "<td>" . CurrencyModulesclass::toCurrency($val1 - $val2) . (($val1 - $val2) < 0 ? "- " : "" ) . "</td>"; $sumDiff += $val1 - $val2; if (empty($Itm[$j]['sumVal'])) { $Itm[$j]['sumVal'] = 0; $Itm[$j]['sumCol'] = 0; } $Itm[$j]['sumVal'] += $val1 - $val2; if ($ResITM[$j]["month_length_effect"] == 0 && $resPerInfo[0]['person_type'] == 3) { $Itm[$j]['sumCol'] += round(($val1 - $val2) * $DayNo2 / 30); $MainVal += round(($val1 - $val2) * $DayNo2 / 30); } elseif ($resPerInfo[0]['person_type'] == 5 && $_SESSION['UserID'] == 'jafarkhani') { // echo $endDate . "---<br>" ; // echo DateModules::miladi_to_shamsi($res[$i]['current_execute_date'])."***<br>" ; die(); $arr3 = preg_split('/\\//', DateModules::miladi_to_shamsi($res[$i]['current_execute_date'])); $arr4 = preg_split('/\\//', DateModules::miladi_to_shamsi($endDate)); if ($arr4[1] * 1 == 1 && $arr4[0] == $arr3[0] + 1) { $EP = 12; } else { $EP = $arr4[1] * 1; } //......................... $std = $res[$i]['current_execute_date']; $stMonth = $arr3[1] * 1; if ($stMonth < 7) { $endt = $arr3[0] . "/" . $arr3[1] . "/31"; } elseif (6 < $stMonth && $stMonth < 12) { $endt = $arr3[0] . "/" . $arr3[1] . "/30"; } elseif ($stMonth == 12) { $endt = $arr3[0] . "/" . $arr3[1] . "/29"; } for ($k = $arr3[1] * 1; $k < $EP + 1; $k++) { if (DateModules::CompareDate(DateModules::miladi_to_shamsi($endt), DateModules::miladi_to_shamsi($endDate)) < 1) { $DYNo = round(DateModules::GDateMinusGDate(DateModules::shamsi_to_miladi($endt), $std)) + 1; if ($stMonth < 7) { $mNO = 31; } elseif ($stMonth > 6 && $stMonth < 12) { $mNO = 30; } elseif ($stMonth == 12) { $mNO = 29; } $Itm[$j]['sumCol'] += round(($val1 - $val2) * $DYNo / $mNO); $MainVal += round(($val1 - $val2) * $DYNo / $mNO); $TaxInc += round(($val1 - $val2) * $DYNo / $mNO); //........................ $std = DateModules::shamsi_to_miladi($arr3[0] . "/" . ($k + 1) . "/01"); $stMonth = $k + 1; //$arr3[1] + 1; if ($stMonth < 7) { $endt = $arr3[0] . "/" . $stMonth . "/31"; } elseif (6 < $stMonth && $stMonth < 12) { $endt = $arr3[0] . "/" . $stMonth . "/30"; } elseif ($stMonth == 12) { $endt = $arr3[0] . "/" . $stMonth . "/29"; } } else { //echo "****"; // die(); $endt = $endDate; $DYNo = round(DateModules::GDateMinusGDate(DateModules::shamsi_to_miladi($endt), $std)); if ($stMonth < 7) { $mNO = 31; } elseif ($stMonth > 6 && $stMonth < 12) { $mNO = 30; } elseif ($stMonth == 12) { $mNO = 29; } $Itm[$j]['sumCol'] += round(($val1 - $val2) * $DYNo / $mNO); $MainVal += round(($val1 - $val2) * $DYNo / $mNO); $TaxInc += round(($val1 - $val2) * $DYNo / $mNO); break; } } } else { $Itm[$j]['sumCol'] += round(($val1 - $val2) * $DayNo / 30); $MainVal += round(($val1 - $val2) * $DayNo / 30); } //............................... if ($RetRes[0]['retired_include'] == 1) { $RetInc += $val1 - $val2; } if ($RetRes[0]['tax_include'] == 1 && $resPerInfo[0]['person_type'] != 5) { if ($ResITM[$j]["month_length_effect"] == 0 && $resPerInfo[0]['person_type'] == 3) { $TaxInc += round(($val1 - $val2) * $DayNo2 / 30); } else { $TaxInc += round(($val1 - $val2) * $DayNo / 30); } } if ($RetRes[0]['insure_include'] == 1) { $InsInc += $val1 - $val2; } } //$MainVal = round(($sumDiff) * $DayNo / 30); //....................مالیات........... $qry = " select count(*) cn \r\n\t\t\t\t\tfrom Arrear_payment_items \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . " and pay_month = 12 and salary_item_type_id in (146,147,148,747)"; $res4 = PdoDataAccess::runquery($qry); if ($res4[0]['cn'] > 0) { //......................................... $qry = " select count(*) cnp\r\n from payments \r\n where staff_id = " . $SID . " and pay_year = " . $t; $resE = PdoDataAccess::runquery($qry); if ($resE[0]['cnp'] == 0) { $sdatetax = DateModules::shamsi_to_miladi($t . "/12/29"); $qry = " SELECT tti.from_value\r\n FROM staff_tax_history sth\r\n inner join tax_tables tt on sth.tax_table_type_id = tt.tax_table_type_id\r\n inner join tax_table_items tti on tti.tax_table_id = tt.tax_table_id\r\n\r\n WHERE sth.staff_id = " . $SID . " and \r\n sth.start_date < '" . DateModules::Now() . "' and\r\n ( sth.end_date = '0000-00-00' or sth.end_date is null or \r\n sth.end_date > '" . DateModules::Now() . "' ) and\r\n tt.from_date < '" . $sdatetax . "' and\r\n ( tt.to_date = '0000-00-00' or tt.to_date is null or tt.to_date >= '" . $sdatetax . "' ) and coeficient = 0.1 "; $resFval = PdoDataAccess::runquery($qry); $TaxInc -= $resFval[0]['from_value']; } //......................................... $RowTax = $TaxInc * 0.1; //round(($TaxInc * $DayNo / 30) * 0.1); } else { $RowTax = 0; } //.................................. $qry = " select count(*) cn \r\n\t\t\t\t\tfrom Arrear_payment_items \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . " and pay_month = 12 and salary_item_type_id in (149 , 150)"; $res3 = PdoDataAccess::runquery($qry); if ($res3[0]['cn'] > 0) { $RowRet = round($RetInc * $DayNo / 30 * 0.09); } else { $RowRet = 0; } //.......................بیمه تامین اجتماعی........... $qry = " select count(*) cn \r\n\t\t\t\t\tfrom Arrear_payment_items \r\n\t\t\t\t\t\twhere staff_id = " . $SID . " and pay_year = " . $t . " and pay_month = 12 and salary_item_type_id in (144,145,744,9920)"; $res5 = PdoDataAccess::runquery($qry); if ($res5[0]['cn'] > 0) { $RowInsure = round($InsInc * $DayNo / 30 * 0.07000000000000001); } else { $RowInsure = 0; } //..................................... if ($resPerInfo[0]['last_retired_pay'] != NULL && $resPerInfo[0]['last_retired_pay'] != '0000-00-00' && DateModules::CompareDate($resPerInfo[0]['last_retired_pay'], DateModules::shamsi_to_miladi($t . "/01/01")) == -1) { $RowRet = $retCoef = 0; } $TotalsumDiff += $sumDiff; $TotalMainVal += $MainVal; $TotalRowTax += $RowTax; $TotalRowRet += $RowRet; $TotalRowIns += $RowInsure; $TotalPay += $MainVal - ($RowTax + $RowRet + $RowInsure); /* $Row .= "<td>" . ( ($sumDiff < 0 ) ? CurrencyModulesclass::toCurrency($sumDiff) . "-" : CurrencyModulesclass::toCurrency($sumDiff)) . "</td> <td>" . (($MainVal < 0 ) ? CurrencyModulesclass::toCurrency($MainVal) . "-" : CurrencyModulesclass::toCurrency($MainVal)) . "</td><td>" . (($RowTax < 0 ) ? CurrencyModulesclass::toCurrency($RowTax) . "-" : CurrencyModulesclass::toCurrency($RowTax)) . "</td><td>" . (($RowRet < 0 ) ? CurrencyModulesclass::toCurrency($RowRet) . "-" : CurrencyModulesclass::toCurrency($RowRet)) . "</td><td>" . (($RowInsure < 0 ) ? CurrencyModulesclass::toCurrency($RowInsure) . "-" : CurrencyModulesclass::toCurrency($RowInsure)) . "</td><td>" . ((($MainVal - ($RowTax + $RowRet + $RowInsure )) < 0 ) ? CurrencyModulesclass::toCurrency(($MainVal - ($RowTax + $RowRet + $RowInsure))) . "-" : CurrencyModulesclass::toCurrency(($MainVal - ($RowTax + $RowRet + $RowInsure)))) . "</td></tr>"; */ } // $Row .= "</tr>"; } }
</td> </tr> <tr> <td><font style="font-family:tahoma;font-weight: bold;font-size:8pt"> دوره آموزشی : </font> <?=$TrainScore2?> ساعت <font style="font-family:tahoma;font-weight: bold;font-size:8pt"> میانگین نمره ارزشیابی : </font> <?= round($MinEval) ?> </td> <td><font style="font-family:tahoma;font-weight: bold;font-size:8pt"> تاریخ اخذ آخرین رتبه(قانون خدمات کشوری): </font> <?= DateModules::miladi_to_shamsi($res2[0]['execute_date']); ?> </td> <td colspan="3"><font style="font-family:tahoma;font-weight: bold;font-size:8pt">رشته تحصیلی : </font> <?= $ResPInfo[0]['StudyTitle'] . '-' . $ResPInfo[0]['BranchTitle'] ?> <font style="font-family:tahoma;font-weight: bold;font-size:8pt"> مدرک تحصیلی : </font> <?= $ResPInfo[0]['EducTitle'] ?> <font style="font-family:tahoma;font-weight: bold;font-size:8pt">معدل مدرک : </font> <?= $ResPInfo[0]['grade'] ?> </td> </tr> <tr height='30px' ><td colspan ="4" style="font-family:tahoma;font-weight: bold;font-size:8pt" > سنوات تجربی لازم برای ارتقاء رتبه بالاتر </td></tr> <tr> <td>مدرک تحصیلی : <?= $resMadrak[0]['title'] ?> </td> <td >رتبه فعلی : <?= $ResPInfo[0]['GradeTitle'] ?></td> <td >مدت سنوات : <?= $totalYear ?> </td> <td> </td> </tr>
function Next_Corrective_Writ() { $query = " SELECT w.writ_id,\n w.writ_ver,\n w.staff_id,\n w.execute_date,\n w.corrective ,\n s.person_type ,\n w2.writ_ver upper_ver\n\n FROM staff s\n LEFT OUTER JOIN writs w\n ON (w.staff_id = s.staff_id )\n LEFT OUTER JOIN writs w2\n ON (w2.staff_id = s.staff_id AND w2.writ_id = w.writ_id AND w.writ_ver + 1 = w2.writ_ver )\n WHERE\n s.staff_id = {$this->staff_id} AND\n (w.execute_date > '{$this->execute_date}' OR (w.execute_date = '{$this->execute_date}' AND w.writ_id > {$this->writ_id}) ) AND\n ((w.history_only != " . HISTORY_ONLY . " OR w.history_only IS NULL)OR\n (w.writ_id={$this->corrective_writ_id} AND w.writ_ver={$this->corrective_writ_ver}))\n AND (w2.writ_ver IS NULL OR w.history_only != " . HISTORY_ONLY . " OR w.history_only IS NULL)\n ORDER BY s.staff_id , w.execute_date,w.writ_id , w.writ_ver "; $temp = parent::runquery($query); if (count($temp) > 0) { $state = 1; $next_writ_rec = $temp[0]; for ($i = 0; $i < count($temp); $i++) { if ($state == 2) { if ($temp[$i]['execute_date'] == $min_execute_date && $temp[$i]['corrective'] != 1) { $next_writ_rec = $temp[$i]; } else { break; } } if ($state == 1) { $min_execute_date = $temp[$i]['execute_date']; $next_writ_rec = $temp[$i]; $state = 2; } } } if (!$next_writ_rec) { return false; } $obj = new manage_writ($next_writ_rec['writ_id'], $next_writ_rec['writ_ver'], $next_writ_rec['staff_id']); if ($obj->writ_id > 0) { if ($this->corrective_writ_id != $obj->writ_id || $this->corrective_writ_ver != $obj->writ_ver || $obj->corrective == 0) { $obj->history_only = 1; $qry3 = " select writ_id , writ_ver\n from writs\n where writ_id = " . $obj->writ_id . " and writ_ver = " . $obj->writ_ver . " and\n staff_id =" . $obj->staff_id . " and state=" . WRIT_PERSONAL; $tmp3 = parent::runquery($qry3); if (count($tmp3) > 0) { $obj->EditWrit(); } //............ $qry1 = " SELECT issue_date\n \t\t\t\t\t FROM writs\n \t\t\t\t\t WHERE writ_id = " . $this->corrective_writ_id . " AND writ_ver= " . $this->corrective_writ_ver . " AND staff_id = " . $this->staff_id; $tmp1 = parent::runquery($qry1); $obj->issue_date = DateModules::shNow(); //$tmp1[0]['issue_date']; if ($obj->execute_date > $obj->issue_date) { $obj->pay_date = $obj->execute_date; } else { $obj->pay_date = $obj->issue_date; } $qry2 = " select last_writ_id , last_writ_ver\n from staff where staff_id =" . $obj->staff_id; $tmp2 = parent::runquery($qry2); //............. $obj->history_only = 0; //end if (!$next_writ_rec['upper_ver']) { $obj->writ_ver++; } else { $qry4 = " SELECT MAX(writ_ver) writ_ver\n FROM writs\n WHERE writ_id = " . $obj->writ_id; $tmp4 = parent::runquery($qry4); $obj->writ_ver = $tmp4[0]['writ_ver'] + 1; } $obj->state = 1; $obj->corrective = 0; $obj->corrective_date = $this->corrective_date; $obj->corrective_writ_id = $this->corrective_writ_id; $obj->corrective_writ_ver = $this->corrective_writ_ver; $obj->correct_completed = WRIT_CORRECTING; $qry5 = " select personid,staff_id from staff where staff_id =" . $obj->staff_id; $tmp5 = parent::runquery($qry5); $education_level_rec = manage_person_education::GetEducationLevelByDate($tmp5[0]['personid'], $obj->execute_date); $obj->education_level = $education_level_rec['max_education_level']; $obj->sfid = $education_level_rec['sfid']; $obj->sbid = $education_level_rec['sbid']; $where = " PersonID=" . $tmp5[0]['personid'] . " AND\n (dependency = 5 or dependency = 6) AND\n\t\t\t\t birth_date <='" . $obj->execute_date . "'"; $obj->children_count = manage_person_dependency::CountDependency($where); $obj->included_children_count = manage_person_dependency::bail_count($tmp5[0]['personid'], $obj->person_type, $obj->execute_date, $obj->execute_date); $person_obj = new manage_person($tmp5[0]['personid']); $obj->marital_status = $person_obj->marital_status; //...... if ($obj->person_type == HR_PROFESSOR && $obj->staff_id != '111551') { $obj->writ_signature_post_owner = 'محمد کافی'; $obj->writ_signature_post_title = ' رئیس دانشگاه'; //$this->writ_signature_post_title = ' رئیس دانشگاه '; } else { if ($obj->person_type == HR_PROFESSOR && $obj->staff_id == '111551') { //$this->writ_signature_post_owner = 'محمدجواد وریدی' ; $obj->writ_signature_post_owner = 'ابوالفضل باباخانی'; $obj->writ_signature_post_title = 'معاون اداری ومالی دانشگاه'; } else { $obj->writ_signature_post_owner = $obj->issue_date > '2014-02-01' ? 'ابوالقاسم ساقی' : WRIT_SIGNATURE_POST_OWNER; } } //....... //$obj->writ_signature_post_owner = ($obj->issue_date > '2014-02-01') ? 'ابوالقاسم ساقی' : WRIT_SIGNATURE_POST_OWNER ; $pdo = parent::getPdoObject(); $pdo->beginTransaction(); if (!$obj->onBeforeInsert()) { $pdo->rollBack(); return false; } $return = parent::insert("writs", $obj); if (!$return) { parent::PushException("ايجاد با شکست مواجه شد"); $pdo->rollBack(); return false; } if (!$obj->onAfterInsert()) { parent::PushException("ايجاد با شکست مواجه شد"); $pdo->rollBack(); return false; } $pdo->commit(); if (!manage_writ_item::compute_writ_items($obj->writ_id, $obj->writ_ver, $obj->staff_id)) { return false; } } else { $description = ""; $this->writ_id = $obj->writ_id; $this->writ_ver = $obj->writ_ver; $qry3 = " SELECT w.writ_id , w.writ_ver , w.execute_date , w.issue_date , ws.title\n FROM writs w\n INNER JOIN writ_subtypes ws ON ws.writ_type_id = w.writ_type_id\n AND ws.writ_subtype_id = w.writ_subtype_id AND w.person_type = ws.person_type\n AND w.staff_id = " . $obj->staff_id . "\n INNER JOIN\n (\n SELECT\n writ_id , writ_ver - 1 writ_ver2\n FROM writs\n WHERE\n corrective_writ_id = {$this->corrective_writ_id} AND corrective_writ_ver = {$this->corrective_writ_ver} AND staff_id = " . $obj->staff_id . "\n )\n w2\n ON w.writ_id = w2.writ_id AND w.writ_ver = w2.writ_ver2"; $tmp3 = parent::runquery($qry3); $qry4 = " SELECT w.writ_id , w.writ_ver , w.execute_date , w.issue_date , ws.title\n FROM writs w\n INNER JOIN writ_subtypes ws\n ON ws.writ_type_id = w.writ_type_id\n AND ws.writ_subtype_id = w.writ_subtype_id AND w.person_type = ws.person_type\n AND w.staff_id = {$obj->staff_id}\n WHERE\n corrective_writ_id = {$this->corrective_writ_id} AND corrective_writ_ver = {$this->corrective_writ_ver} AND\n w.writ_ver = 1 AND staff_id =" . $obj->staff_id; $tmp4 = parent::runquery($qry4); $i = 0; $j = 0; if (!empty($tmp4[0]['send_letter_no'])) { $description .= 'بر اساس حکم شماره ' . $tmp4[0]['send_letter_no'] . ' مورخه ' . DateModules::miladi_to_shamsi($tmp4[0]['issue_date']) . ' احکام ذيل اصلاح مي گردد : ' . chr(13); } else { $description .= 'ليست احکام اصلاح شده : ' . chr(13); } for ($i = 0; $i < count($tmp3); $i++) { $description .= $i + 1 . '- حکم ' . $tmp3[$i]['title'] . ' شماره ' . $tmp3[$i]['send_letter_no'] . ' مورخه ' . DateModules::miladi_to_shamsi($tmp3[$i]['issue_date']) . chr(13); } parent::runquery(" UPDATE writs\n SET correct_completed=" . WRIT_CORRECT_COMPLETED . "\n WHERE(\n (corrective_writ_id={$this->corrective_writ_id} AND corrective_writ_ver={$this->corrective_writ_ver})\n OR(writ_id={$this->corrective_writ_id} AND writ_ver={$this->corrective_writ_ver} AND staff_id = {$this->staff_id} )\n )"); parent::runquery(" UPDATE writs\n SET description = '" . $description . "'\n WHERE writ_id = {$this->writ_id} AND writ_ver={$this->writ_ver} AND description IS NULL AND staff_id =" . $this->staff_id); } return $obj; } }
function SplitYears($startDate, $endDate, $TotalAmount) { if (substr($startDate, 0, 1) == 2) { $startDate = DateModules::miladi_to_shamsi($startDate); } if (substr($endDate, 0, 1) == 2) { $endDate = DateModules::miladi_to_shamsi($endDate); } $arr = preg_split('/[\\-\\/]/', $startDate); $StartYear = $arr[0] * 1; $totalDays = 0; $yearDays = array(); $newStartDate = $startDate; while (DateModules::CompareDate($newStartDate, $endDate) < 0) { $arr = preg_split('/[\\-\\/]/', $newStartDate); $LastDayOfYear = DateModules::lastJDateOfYear($arr[0]); if (DateModules::CompareDate($LastDayOfYear, $endDate) > 0) { $LastDayOfYear = $endDate; } $yearDays[$StartYear] = DateModules::JDateMinusJDate($LastDayOfYear, $newStartDate) + 1; $totalDays += $yearDays[$StartYear]; $StartYear++; $newStartDate = DateModules::AddToJDate($LastDayOfYear, 1); } $TotalDays = DateModules::JDateMinusJDate($endDate, $startDate) + 1; $sum = 0; foreach ($yearDays as $year => $days) { $yearDays[$year] = round($days / $TotalDays * $TotalAmount); $sum += $yearDays[$year]; //echo $year . " " . $days . " " . $yearDays[$year] . "\n"; } if ($sum != $TotalAmount) { $yearDays[$year] += $TotalAmount - $sum; } return $yearDays; }
} } else { if ($i == 0) { $output .= $headerStr; } } //--------------------------------------------------- $output .= "<tr><td>" . ($i + 1) . "</td>"; for ($j = 0; $j < count($columns); $j++) { if (in_array($columns[$j]["used_type"], array("group", "order", "separation", "formula_column", "condition", "filter"))) { continue; } $row_id = $columns[$j]["row_id"]; $value = $row[$row_id]; if (DateModules::IsDate($value)) { $value = DateModules::miladi_to_shamsi($value); } if ($columns[$j]["renderer"] != "") { $tmpVal = isset($row[$row_id . "2"]) ? $row[$row_id . "2"] : $row[$row_id]; if ($tmpVal != "") { eval("\$value = " . $columns[$j]["renderer"] . "('" . $tmpVal . "');"); } else { $value = ""; } } $output .= "<td>" . $value . " </td>"; } $output .= "</tr>"; if (!empty($_POST["pp"]) && $index == $_POST["pp"] - 1) { $output .= "</table><div style='page-break-after: always;'> </div>"; $output .= $headerStr;