function AccDocFlow() { $CostID = $_REQUEST["CostID"]; $CurYear = substr(DateModules::shNow(), 0, 4); $temp = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect d.DocDate,\r\n\t\t\td.description,\r\n\t\t\tdi.DebtorAmount,\r\n\t\t\tdi.CreditorAmount,\r\n\t\t\tdi.details\r\n\t\tfrom ACC_DocItems di join ACC_docs d using(DocID)\r\n\t\tleft join ACC_tafsilis t1 on(t1.TafsiliType=1 AND di.TafsiliID=t1.TafsiliID)\r\n\t\tleft join ACC_tafsilis t2 on(t2.TafsiliType=1 AND di.TafsiliID2=t2.TafsiliID)\r\n\t\twhere CycleID=:year AND CostID=:cid AND (t1.ObjectID=:pid or t2.ObjectID=:pid)\r\n\t\t\tAND DocStatus in('CONFIRM','ARCHIVE')\r\n\t\torder by DocDate\r\n\t", array(":year" => $CurYear, ":pid" => $_SESSION["USER"]["PersonID"], ":cid" => $CostID)); //print_r(ExceptionHandler::PopAllExceptions()); $count = $temp->rowCount(); $temp = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]); echo dataReader::getJsonData($temp, $count, $_GET["callback"]); die; }
public static function MakeHeader($title, $fromDate = "", $toDate = "", $pageNumber = "", $returnMode = false, $excel = false) { $str = "\r\n\t\t\t<div style='text-align: right;float:right;width:20%;' align=right><img width='60px' style='padding:2px' \r\n\t\t\t\t" . ($excel ? "" : "src='/framework/icons/logo.jpg'") . "></div>" . "<div style='float:right;font-family:b titr;font-size:15px;width:60%' align=center>" . "<br>" . SoftwareName . "<br>" . $title . "</div>\r\n\r\n\t\t\t<div style='text-align: left;float:right;width:20%;font-family:tahoma;font-size:11px' align=left>\r\n\t\t\t<br>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; $str .= !empty($fromDate) ? "<br>گزارش از تاریخ : " . $fromDate . ($toDate != "" ? " - " . $toDate : "") : ""; $str .= $pageNumber != "" ? "<br>شماره صفحه :" . $pageNumber : ""; $str .= "</div>\r\n\t\t<br>"; if ($returnMode) { return $str; } else { echo $str; } }
function ShowReport(){ if($_POST["FromDate"] == "") { $OrigStartDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] . "-01", "-"); $OrigEndDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] ."-" . DateModules::DaysOfMonth($_POST["year"] ,$_POST["month"]), "-"); } else { $OrigStartDate = DateModules::shamsi_to_miladi($_POST["FromDate"], "-"); $OrigEndDate = DateModules::shamsi_to_miladi($_POST["ToDate"], "-"); } $holidays = ATN_holidays::Get(" AND TheDate between ? AND ? order by TheDate", array($OrigStartDate, $OrigEndDate)); $holidayIndex = 0; $holidays = $holidays->fetchAll(); $where = ""; $param = array(); if(!empty($_POST["PersonID"])) { $where .= " AND PersonID = ?"; $param[] = $_POST["PersonID"]; } $PersonsDT = PdoDataAccess::runquery("select PersonID, concat(fname,' ',lname) fullname from BSC_persons where IsStaff='YES' " . $where, $param); $returnStr = ""; foreach($PersonsDT as $personRecord) { $holidayIndex = 0; $holidayRecord = $holidayIndex < count($holidays) ? $holidays[$holidayIndex++] : null; $PersonID = $personRecord["PersonID"]; $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 ); $StartDate = $OrigStartDate; $EndDate = $OrigEndDate; $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)); //........................ 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; 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"]) { $holiday = true; $holidayRecord = $holidayIndex < count($holidays) ? $holidays[$holidayIndex++] : null; } $returnArr[$i]["holiday"] = $holiday; } //........................................................... 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") { $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") { $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"]; } //.................................................... $firstAbsence = 0; $Off = 0; $mission = 0; $index = 1; $totalAttend = 0; if($returnArr[$i]["TrafficTime"] != "" && strtotime($returnArr[$i]["TrafficTime"]) > strtotime($returnArr[$i]["FromTime"])) $firstAbsence = strtotime($returnArr[$i]["TrafficTime"]) - strtotime($returnArr[$i]["FromTime"]); $currentDay = $returnArr[$i]["TrafficDate"]; $startOff = 0; $endOff = 0; $extra = 0; 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"]; } //.................................................... 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"]); $Absence = $totalAttend < $ShiftDuration ? $ShiftDuration - $totalAttend : 0; if($returnArr[$i]["holiday"]) { $extra = $totalAttend + $mission; $lastAbsence = 0; $firstAbsence = 0; $Absence = 0; $Off = 0; } if($Absence == $ShiftDuration) { $SUM["DailyAbsence"]++; $Absence = 0; } $SUM["absence"] += $Absence; $SUM["attend"] += $totalAttend; $SUM["firstAbsence"] += $firstAbsence; $SUM["lastAbsence"] += $lastAbsence; $SUM["extra"] += $extra; $SUM["Off"] += $Off; $SUM["mission"] += $mission; } $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"]); $returnStr .= "<tr> <td>" . $personRecord["fullname"] . "</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> <td>" . $SUM["DailyOff_1"] . "</td> <td>" . $SUM["DailyOff_2"] . "</td> <td>" . $SUM["DailyOff_3"] . "</td> <td>" . $SUM["DailyMission"] . "</td> <td>" . $SUM["DailyAbsence"] . "</td> </tr>"; } ?> <META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl"> <link rel="stylesheet" type="text/css" href="/generalUI/fonts/fonts.css" /></head> <style> .reportTbl {border-collapse:collapse} .reportTbl td {padding:4px;font-family: nazanin; font-size:14px;} .reportTbl th {font-family: nazanin; font-size:14px;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 style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'> <tr> <td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td> <td align='center' style='height:100px;vertical-align:middle;font-family:b titr;font-size:15px'> گزارش خلاصه کارکرد پرسنل <br>از تاریخ <?= DateModules::miladi_to_shamsi($OrigStartDate) ?> تا تاریخ <?= DateModules::miladi_to_shamsi($OrigEndDate) ?> </td> <td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : <?= DateModules::shNow() ?> </td> </tr> </table> <table class="reportTbl" width="100%" border="1"> <tr class="blueText"> <th>نام و نام خانوادگی</th> <th>حضور</th> <th>اضافه کار</th> <th>مرخصی</th> <th>ماموریت</th> <th>تاخیر</th> <th>تعجیل</th> <th>غیبت</th> <th>مرخصی استعلاجی</th> <th>مرخصی استحقاقی</th> <th>مرخصی بدون حقوق</th> <th>ماموریت روزانه</th> <th>غیبت روزانه</th> </tr> <?= $returnStr ?> </table> <? die(); }
function ShowReport(){ $rpt = new ReportGenerator(); $rpt->mysql_resource = PrepareData(); ?> <html> <head> <META http-equiv=Content-Type content="text/html; charset=UTF-8" > </head> <body dir=rtl> <? $rpt->addColumn("شماره<br> شناسایی", "staff_id"); $rpt->addColumn("نام خانوادگي", "plname"); $rpt->addColumn("نام", "pfname"); $rpt->addColumn("واحد اصلی محل خدمت", "unit_title"); $rpt->addColumn("واحد فرعی محل خدمت", "sub_unit_title"); $rpt->addColumn("کارکرد", "work_time"); $rpt->header_alignment = "center"; $rpt->headerContent = " <table width=100% border=0 style='font-family:b nazanin;'> <tr> <td width=120px><img src='/HumanResources/img/fum_symbol.jpg'></td> <td align=center style='font-weight:bold'>گزارش کارکرد کارکنان</td> <td width=120px> شماره : <br> تاریخ : " . DateModules::shNow() . " </td> </tr> </table>"; $rpt->page_size = 30; $rpt->paging = true; $rpt->generateReport(); die(); ?> </body> </html> <? }
} else { $row["Sum"] = $prevRow["Sum"] + $row["CreditorAmount"] - $row["DebtorAmount"]; } return "<div style=direction:ltr>" . number_format($row["Sum"]) . "</div>"; } $col = $rpg->addColumn("مانده حساب", "CreditorAmount", "TotalRemainRender", $BeforeAmount); //$col->EnableSummary(true); $rpg->mysql_resource = $dataTable; $rpg->page_size = 12; $rpg->paging = true; if (!$rpg->excel) { BeginReport(); //if($_SESSION["USER"]["UserName"] == "admin") // echo PdoDataAccess::GetLatestQueryString (); echo "<div style=display:none>" . PdoDataAccess::GetLatestQueryString() . "</div>"; echo "<table style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'><tr>\r\n\t\t\t\t<td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td>\r\n\t\t\t\t<td align='center' style='height:100px;vertical-align:middle;font-family:b titr;font-size:15px'>\r\n\t\t\t\t\tگزارش گردش حساب ها \r\n\t\t\t\t\t <br> " . $_SESSION["accounting"]["BranchName"] . "<br>" . "دوره سال " . $_SESSION["accounting"]["CycleID"] . "</td>\r\n\t\t\t\t<td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; if (!empty($_POST["fromDate"])) { echo "<br>گزارش از تاریخ : " . $_POST["fromDate"] . ($_POST["toDate"] != "" ? " - " . $_POST["toDate"] : ""); } echo "</td></tr></table>"; } echo $BeforeRemaindar; $rpg->generateReport(); die; } ?> <script> AccReport_flow.prototype = { TabID : '<?php echo $_REQUEST["ExtTabID"]; ?>
$rpg->addColumn("تاریخ چک", "PayDate", "dateRender"); $rpg->addColumn("وضعیت چک", "ChequeStatusDesc"); $col = $rpg->addColumn("مبلغ چک", "PayAmount", "moneyRender"); $col->EnableSummary(); //echo PdoDataAccess::GetLatestQueryString(); $rpg->mysql_resource = $dataTable; if (!$rpg->excel) { echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">'; echo "<table style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'><tr>\r\n\t\t\t\t<td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td>\r\n\t\t\t\t<td align='center' style='font-family:b titr;font-size:15px'>اعتماد شما سرلوحه خدمت ماست<br>\r\n\t\t\t\t\tگزارش چک های دریافتی\r\n\t\t\t\t\t"; if (!empty($_POST["l_fromDate"])) { echo "<br>سررسید چک ها از تاریخ : " . $_POST["l_fromDate"] . ($_POST["l_toDate"] != "" ? " - " . $_POST["l_toDate"] : ""); } if (!empty($_POST["checkStatus"])) { echo "<br>وضعیت : " . $_POST["statusName"]; } echo "</td>\r\n\t\t\t\t<td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; if (!empty($_POST["fromDate"])) { echo "<br>گزارش از تاریخ : " . $_POST["fromDate"] . ($_POST["toDate"] != "" ? " - " . $_POST["toDate"] : ""); } echo "</td></tr></table>"; } $rpg->generateReport(); die; } ?> <script> AccReport_IncomeCheque.prototype = { TabID : '<?php echo $_REQUEST["ExtTabID"]; ?> ',
} echo "<div class='pageBreak'></div>"; } $prof1 = $prof2 = ""; if ($data[$i][person_type] == HR_PROFESSOR) { $prof1 = '<tr><td style="background-color:#F0F3FF">مرتبه :</td><td style="font-weight:bold">' . $data[$i][science_level_title] . '</td> <td style="background-color:#F0F3FF">پايه :</td><td style="font-weight:bold">' . $data[$i][base] . '</td></tr>'; if ($data[$i][exe_to_date] == "" || $data[$i][exe_to_date] == "0000-00-00" || DateModules::CompareDate($data[$i][exe_to_date], DateModules::Now()) > 0) { $prof2 = '<tr><td style="background-color:#F0F3FF">سمت اجرايي :</td><td style="font-weight:bold">' . $data[$i][exe_post_title] . '</td> <td style="background-color:#F0F3FF">تاريخ سمت اجرايي :</td><td style="font-weight:bold">' . DateModules::miladi_to_shamsi($data[$i][exe_from_date]) . '</td></tr>'; } else { $prof2 = '<tr><td style="background-color:#F0F3FF">سمت اجرايي :</td><td style="font-weight:bold"></td> <td style="background-color:#F0F3FF">تاريخ سمت اجرايي :</td><td style="font-weight:bold"></td></tr>'; } } $tags = array('<!--post_title-->' => $data[$i][person_type] == HR_WORKER ? 'عنوان شغل' : 'عنوان پست', '<!--fname-->' => $data[$i][pfname], '<!--lname-->' => $data[$i][plname], '<!--father_name-->' => $data[$i][father_name], '<!--staff_id-->' => $data[$i][staff_id], '<!--birth_date-->' => DateModules::miladi_to_shamsi($data[$i][birth_date]), '<!--birth_place-->' => $data[$i][birth_place], '<!--idcard_no-->' => $data[$i][idcard_no], '<!--national_code-->' => $data[$i][national_code], '<!--prof1-->' => $prof1, '<!--worktime_type-->' => $data[$i][worktime_type_title], '<!--military_type-->' => $data[$i][military_type_title], '<!--education_level-->' => $data[$i][education_level_title], '<!--field_title-->' => $data[$i][sf_sb_title], '<!--doc_date-->' => DateModules::miladi_to_shamsi($data[$i][doc_date]), '<!--studyPlace-->' => $data[$i][study_palce], '<!--razm-->' => $data[$i][razmAmount], '<!--janbaz-->' => $data[$i][janbazAmount], '<!--unit-->' => $data[$i][unitName], '<!--emp_state-->' => $data[$i][emp_state_title], '<!--post_no-->' => $data[$i][post_no], '<!--last_post_title-->' => $data[$i][post_title], '<!--prof2-->' => $prof2, '<!--now-->' => DateModules::shNow()); // مشخص کردن فایل template مربوط به خلاصه پرونده $content = file_get_contents("../../reports/summary_doc.htm"); $content = str_replace(array_keys($tags), array_values($tags), $content); $cur_staff = $data[$i][staff_id]; $index = $i; $row_index = $i; $history = ""; $i--; $valid_writs = array(); $total_year = 0; $total_month = 0; $total_day = 0; $total_non_year = 0; $total_non_month = 0; $total_non_day = 0;
this.YearFieldSet = new Ext.form.FieldSet({ title: "انتخاب سال", width: 400, renderTo : this.get("div_Years"), frame: true, items : [{ xtype : "combo", store: YearStore, labelWidth : 50, width : 220, fieldLabel : "سال", displayField: 'title', name : "year", valueField : "id", value : '<?php echo substr(DateModules::shNow(), 0, 4); ?> ', listeners : { select : function(){ me = HolidayObject; me.grid.getStore().proxy.extraParams = { Year : this.getValue() }; me.grid.getStore().load(); } } },{ xtype : "form", title : "ورود اطلاعات از طریق فایل excel", itemId : "excelForm",
$rpg->excel = !empty($_POST["excel"]); $rpg->mysql_resource = $dataTable; $rpg->addColumn("شماره تضمین", "RequestID"); $rpg->addColumn("نوع تضمین", "TypeDesc"); $rpg->addColumn("تاریخ شروع", "StartDate", "dateRender"); $rpg->addColumn("تاریخ پایان", "EndDate", "dateRender"); $rpg->addColumn("مبلغ", "amount", "moneyRender"); $rpg->addColumn("مشتری", "fullname"); $rpg->addColumn("سازمان مربوطه", "organization"); $rpg->addColumn("کارمزد", "wage"); $rpg->addColumn("شماره نامه معرفی", "LetterNo"); $rpg->addColumn("تاریخ نامه معرفی", "LetterDate"); if (!$rpg->excel) { echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">'; echo "<div style=display:none>" . PdoDataAccess::GetLatestQueryString() . "</div>"; echo "<table style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'><tr>\r\n\t\t\t\t<td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td>\r\n\t\t\t\t<td align='center' style='height:100px;vertical-align:middle;font-family:b titr;font-size:15px'>\r\n\t\t\t\t\tگزارش کلی تضمین ها\r\n\t\t\t\t</td>\r\n\t\t\t\t<td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; if (!empty($_POST["fromReqDate"])) { echo "<br>گزارش از تاریخ : " . $_POST["fromReqDate"] . ($_POST["toReqDate"] != "" ? " - " . $_POST["toReqDate"] : ""); } echo "</td></tr></table>"; } $rpg->generateReport(); die; } ?> <script> WarrentyReport_total.prototype = { TabID : '<?php echo $_REQUEST["ExtTabID"]; ?> ',
<?php //----------------------------- // Programmer : SH.Jafarkhani // Date : 1394.06 //----------------------------- require_once '../header.inc.php'; require_once inc_dataGrid; $COSTID_ShortDeposite = 66; $COSTID_LongDeposite = 119; $CurYear = substr(DateModules::shNow(), 0, 4); $temp = PdoDataAccess::runquery("\r\n\tselect CostID, sum(CreditorAmount-DebtorAmount) amount \r\n\tfrom ACC_DocItems di join ACC_docs d using(DocID)\r\n\tleft join ACC_tafsilis t1 on(t1.TafsiliType=1 AND di.TafsiliID=t1.TafsiliID)\r\n\tleft join ACC_tafsilis t2 on(t2.TafsiliType=1 AND di.TafsiliID2=t2.TafsiliID)\r\n\twhere CycleID=:year AND CostID in({$COSTID_ShortDeposite},{$COSTID_LongDeposite}) \r\n\t\tAND (t1.ObjectID=:pid or t2.ObjectID=:pid) \r\n\t\tAND DocStatus in('CONFIRM','ARCHIVE')\r\n\tgroup by CostID\r\n\torder by CostID\r\n", array(":year" => $CurYear, ":pid" => $_SESSION["USER"]["PersonID"])); $ShortDeposite = 0; $LongDeposite = 0; for ($i = 0; $i < count($temp); $i++) { $ShortDeposite = $temp[$i]["CostID"] == $COSTID_ShortDeposite ? $temp[$i]["amount"] : $ShortDeposite; $LongDeposite = $temp[$i]["CostID"] == $COSTID_LongDeposite ? $temp[$i]["amount"] : $LongDeposite; } //------------------------------------------------------------------------------ $dg = new sadaf_datagrid("dg", "global/global.data.php?task=AccDocFlow", ""); $col = $dg->addColumn("تاریخ", "DocDate", GridColumn::ColumnType_date); $col->width = 80; $col = $dg->addColumn("شرح سند", "description", ""); $col->width = 250; $col = $dg->addColumn("شرح ردیف", "details", ""); $col = $dg->addColumn("مبلغ بدهکار", "DebtorAmount", GridColumn::ColumnType_money); $col->width = 100; $col = $dg->addColumn("مبلغ بستانکار", "CreditorAmount", GridColumn::ColumnType_money); $col->width = 100; $dg->HeaderMenu = false; $dg->emptyTextOfHiddenColumns = true;
می باشد و سهام مذکور در دفتر ثبت سهام تحت شماره <b><u> " . $dataTable[$i]["ShareNo"] . "</u></b> ( " . CurrencyModulesclass::CurrencyToString($dataTable[$i]["ShareNo"]) . " ) ثبت گردیده است. <br><br> </td> </tr> <tr> <td style=padding-right:40px align=center>رسول عبدالهی<br> مدیر عامل</td> <td align=center>مهر صندوق</td> <td style=padding-left:40px align=center>دکتر جواد بهارآرا <br> رئیس هیئت مدیره</td> </tr> </table></div>"; echo "<div style='width:285mm;font-family:Homa;font-size:12px'> <center>با صدور این برگ اوراق صادره قبلی باطل اعلام می گردد.( تاریخ صدور : " . DateModules::shNow(). " )</center></div>"; if($i != count($dataTable)-1) echo Manage_Report::PageBreak(); } echo "</center></body></html>"; die(); } ?> <script> PrintShare.prototype = { TabID : '<?= $_REQUEST["ExtTabID"]?>', address_prefix : "<?= $js_prefix_address?>", DocID : "",
function ShowReport() { $query = "SELECT c.*,concat_ws(' ',p1.fname,p1.lname,p1.CompanyName) fullname,\r\n\t\t\tconcat_ws(' ',p2.fname,p2.lname,p2.CompanyName)fullname2,bf.InfoDesc ContractTypeDesc \r\n\t\tFROM CNT_contracts c \r\n\t\t\tjoin BaseInfo bf on(bf.TypeID=18 AND bf.InfoID=ContractType)\r\n\t\t\tleft join CNT_ContractItems ci using(ContractID)\r\n\t\t\tleft join BSC_persons p1 on(c.PersonID=p1.PersonID)\r\n\t\t\tleft join BSC_persons p2 on(c.PersonID2=p2.PersonID)\r\n\t\twhere 1=1\r\n\t"; $params = array(); $index = 0; $itemsWhere = "1=0 "; $keys = array_keys($_POST); foreach ($keys as $key) { if (empty($_POST[$key])) { continue; } switch ($key) { case "TemplateID": case "ContractType": case "PersonID": case "PersonID2": $query .= " AND c." . $key . "=:p" . $index; $params[":p" . $index++] = $_POST[$key]; break; case "FromContractAmount": case "FromStartDate": case "FromEndDate": $query .= " AND c." . $key . " <= :p" . $index; $params[":p" . $index++] = $_POST[$key]; break; case "ToContractAmount": case "ToStartDate": case "ToEndDate": $query .= " AND c." . $key . " >= :p" . $index; $params[":p" . $index++] = $_POST[$key]; break; case "description": $query .= " AND c." . $key . " like :p" . $index; $params[":p" . $index++] = "%" . $_POST[$key] . "%"; break; default: if (strpos($key, "TplItem_") !== false) { $key = substr($key, 8); $itemsWhere .= " OR if(ci.TemplateItemID=" . $key . ",ItemValue like :p" . $index . ",1=0)"; $params[":p" . $index++] = "%" . $_POST["TplItem_" . $key] . "%"; } } } $data = PdoDataAccess::runquery($query . " AND ({$itemsWhere})" . " group by c.ContractID", $params); //echo PdoDataAccess::GetLatestQueryString(); $rpg = new ReportGenerator(); $rpg->excel = !empty($_POST["excel"]); $rpg->mysql_resource = $data; function dateRender($row, $val) { return DateModules::miladi_to_shamsi($val); } function moneyRender($row, $value) { return number_format($value); } function ContractRender($row, $value) { return "<a target=blank href=../contract/PrintContract.php?ContractID=" . $value . ">" . $value . "</a>"; } $rpg->addColumn("شماره قرارداد", "ContractID", "ContractRender"); $rpg->addColumn("تاریخ شروع", "StartDate", "dateRender"); $rpg->addColumn("تاریخ پایان", "EndDate", "dateRender"); $rpg->addColumn("نوع قرارداد", "ContractTypeDesc"); $rpg->addColumn("طرف اول قرارداد", "fullname"); $rpg->addColumn("طرف دوم قرارداد", "fullname2"); $rpg->addColumn("مبلغ قرارداد", "ContractAmount", "moneyRender"); if (!$rpg->excel) { echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">'; echo "<table style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'><tr>\r\n\t\t\t\t<td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td>\r\n\t\t\t\t<td align='center' style='height:100px;vertical-align:middle;font-family:b titr;font-size:15px'>\r\n\t\t\t\t\tگزارش قرارداد ها\r\n\t\t\t\t</td>\r\n\t\t\t\t<td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; echo "</td></tr></table>"; } $rpg->generateReport(); die; die; }
$rpt->mysql_resource = $temp; $rpt->headerContent = "\r\n\t\t<table id=header width=100%>\r\n\t\t\t<tr>\r\n\t\t\t\t<td width=45%>کد وام : <b>" . $ReqObj->RequestID . "</b>\r\n\t\t\t\t\t<br>نوع وام : <b>" . $ReqObj->_LoanDesc . "</b>\r\n\t\t\t\t\t<br>وام گیرنده : <b>" . $ReqObj->_LoanPersonFullname . "</b>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td width=20% style='font-family:titr'>اسناد ضمانتی</td>\r\n\t\t\t\t<td width=45% align=left>تاریخ صدور قبض : <b>" . DateModules::shNow() . "</b></td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t"; $rpt->addColumn("نوع ضمانت", "DocTypeDesc"); $rpt->addColumn("اطلاعات ضمانت", "paramValues"); } //.............................................................................. $dt = PdoDataAccess::runquery("\r\n\tselect p.*,i.*,\r\n\t\t\tb.BankDesc, \r\n\t\t\tbi.InfoDesc PayTypeDesc, \r\n\t\t\tt.TafsiliDesc ChequeStatusDesc\r\n\t\t\t\r\n\t\tfrom LON_BackPays p\r\n\t\tleft join BaseInfo bi on(bi.TypeID=6 AND bi.InfoID=p.PayType)\r\n\t\tleft join ACC_IncomeCheques i using(IncomeChequeID)\r\n\t\tleft join ACC_banks b on(ChequeBank=BankID)\r\n\t\tleft join ACC_tafsilis t on(t.TafsiliType=" . TAFTYPE_ChequeStatus . " AND t.TafsiliID=i.ChequeStatus)\r\n\twhere p.RequestID=? AND PayType=9", array($ReqObj->RequestID)); //print_r(ExceptionHandler::PopAllExceptions()); $SumCheques = 0; foreach ($dt as $row) { $SumCheques += $row["PayAmount"] * 1; } if (count($dt) > 0) { $rpt2 = new ReportGenerator(); $rpt2->mysql_resource = $dt; $rpt2->headerContent = "\r\n\t\t<table id=header width=100%>\r\n\t\t\t<tr>\r\n\t\t\t\t<td width=45%></td>\r\n\t\t\t\t<td width=20% style='font-family:titr'>چک های اقساط</td>\r\n\t\t\t\t<td width=45% align=left>تاریخ صدور قبض : <b>" . DateModules::shNow() . "</b></td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t"; function dateRender($row, $value) { return DateModules::miladi_to_shamsi($value); } function amountRender($row, $value) { return number_format($value); } $rpt2->addColumn("تاریخ چک", "PayDate", "dateRender"); $rpt2->addColumn("نام بانک", "BankDesc"); $rpt2->addColumn("شعبه", "ChequeBranch"); $rpt2->addColumn("شماره چک", "ChequeNo"); $rpt2->addColumn("مبلغ چک", "PayAmount", "amountRender"); } ?>
function showReport(){ $levelsDescArr = array( "l1" => "کل", "l2" => "معین", "l3" => "جزء معین", "l4" => "گروه تفصیلی", "l5" => "گروه تفصیلی2", "l6" => "تفصیلی", "l7" => "تفصیلی2" ); global $level; $level = empty($_REQUEST["level"]) ? "l1" : $_REQUEST["level"]; $rpg = new ReportGenerator(); $whereParam = array(); $where = ""; $group = "cc.level1"; $select = "select sum(di.DebtorAmount) bdAmount, sum(di.CreditorAmount) bsAmount, b1.BlockDesc level1Desc, b2.BlockDesc level2Desc, b3.BlockDesc level3Desc, b.InfoDesc TafsiliTypeDesc, t.TafsiliDesc TafsiliDesc, bi2.InfoDesc TafsiliTypeDesc2, t2.TafsiliDesc TafsiliDesc2, cc.level1,cc.level2,cc.level3,di.TafsiliType,di.TafsiliType2,di.TafsiliID,di.TafsiliID2, t.StartCycleDebtor, t.StartCycleCreditor "; $from = " from ACC_DocItems di join ACC_docs d using(DocID) join ACC_CostCodes cc using(CostID) join ACC_blocks b1 on(level1=b1.BlockID) left join ACC_blocks b2 on(level2=b2.BlockID) left join ACC_blocks b3 on(level3=b3.BlockID) left join BaseInfo b on(TypeID=2 AND di.TafsiliType=InfoID) left join ACC_tafsilis t using(TafsiliID) left join BaseInfo bi2 on(bi2.TypeID=2 AND di.TafsiliType2=bi2.InfoID) left join ACC_tafsilis t2 on(t2.TafsiliID=di.TafsiliID2) left join ( select CycleID,CostID,sum(DebtorAmount) StartCycleDebtor, sum(CreditorAmount) StartCycleCreditor from ACC_DocItems join ACC_docs using(DocID) where DocType=1 group by CostID )t on(d.CycleID=t.CycleID AND di.CostID=t.CostID) "; if($level >= "l1") $rpg->addColumn("کل", "level1Desc",$level =="l1" ? "levelRender" : ""); if($level >= "l2") $rpg->addColumn("معین", "level2Desc", $level =="l2" ? "levelRender" : ""); if($level >= "l3") $rpg->addColumn("جزء معین", "level3Desc", $level =="l3" ? "levelRender" : ""); if($level == "l4" || $level == "l6") $rpg->addColumn("گروه تفصیلی", "TafsiliTypeDesc", $level =="l4" ? "levelRender" : ""); if($level == "l4" || $level == "l7") $rpg->addColumn("گروه تفصیلی2", "TafsiliTypeDesc2", $level == "l4" ? "levelRender2" : ""); if($level == "l6") $rpg->addColumn("تفصیلی", "TafsiliDesc", "showDocs"); if($level == "l7") $rpg->addColumn("تفصیلی2", "TafsiliDesc2", "showDocs2"); switch($level) { case "l2" : $group .= ",cc.level2"; break; case "l3" : $group .= ",cc.level3"; break; case "l4" : $group .= ",di.TafsiliType"; break; case "l5" : $group .= ",di.TafsiliType2"; break; case "l6" : $group .= ",di.TafsiliID"; break; case "l7" : $group .= ",di.TafsiliID2"; break; } function levelRender($row, $value){ global $level; if($value == "") $value = "-----"; return "<a onclick=changeLevel('" . $level . "','". ($level >= "l1" ? $row["level1"] : "") . "','" . ($level >= "l2" ? $row["level2"] : "") . "','" . ($level >= "l3" ? $row["level3"] : ""). "','" . ($level == "l4" ? $row["TafsiliType"] : ""). "','" . ($level == "l5" ? $row["TafsiliType2"] : ""). "') "." href='javascript:void(0);'>" . $value . "</a>"; } function levelRender2($row, $value){ global $level; return "<a onclick=changeLevel('l5','". ($level >= "l1" ? $row["level1"] : "") . "','" . ($level >= "l2" ? $row["level2"] : "") . "','" . ($level >= "l3" ? $row["level3"] : ""). "','" . ($level == "l4" ? $row["TafsiliType"] : ""). "','" . ($level == "l5" ? $row["TafsiliType2"] : ""). "') "." href='javascript:void(0);'>" . $value . "</a>"; } function showDocs($row, $value){ if($value == "") $value = "-----"; return "<a onclick=\"window.open('flow.php?show=true&taraz=true". "&level1=" . $row["level1"] . "&level2=" . $row["level2"] . "&level3=" . $row["level3"] . "&TafsiliType=" . $row["TafsiliType"] . "&TafsiliID=" . $row["TafsiliID"] . (!empty($_REQUEST["fromDate"]) ? "&fromDate=" . $_REQUEST["fromDate"] : "") . (!empty($_REQUEST["toDate"]) ? "&toDate=" . $_REQUEST["toDate"] : "") . (!empty($_REQUEST["fromLocalNo"]) ? "&fromLocalNo=" . $_REQUEST["fromLocalNo"] : "") . (!empty($_REQUEST["toLocalNo"]) ? "&toLocalNo=" . $_REQUEST["toLocalNo"] : "") . (!empty($_REQUEST["BranchID"]) ? "&BranchID=" . $_REQUEST["BranchID"] : "") . (!empty($_REQUEST["IncludeRaw"]) ? "&IncludeRaw=1" : "") . "');\" href=javascript:void(0)>" . $value . "</a>"; } function showDocs2($row, $value){ if($value == "") $value = "-----"; return "<a onclick=\"window.open('flow.php?taraz=true&show=true&taraz=true". "&level1=" . $row["level1"] . "&level2=" . $row["level2"] . "&level3=" . $row["level3"] . "&TafsiliID2=" . $row["TafsiliID2"] . (!empty($_POST["fromDate"]) ? "&fromDate=" . $_POST["fromDate"] : "") . (!empty($_POST["toDate"]) ? "&toDate=" . $_POST["toDate"] : "") . (!empty($_REQUEST["BranchID"]) ? "&BranchID=" . $_REQUEST["BranchID"] : "") . (!empty($_REQUEST["IncludeRaw"]) ? "&IncludeRaw=1" : "") . "');\" href=javascript:void(0)>" . $value . "</a>"; } function MakeWhere(&$where, &$whereParam){ if(!isset($_REQUEST["IncludeRaw"])) { $where .= " AND d.DocStatus != 'RAW'"; } if(isset($_REQUEST["level1"])) { if($_REQUEST["level1"] == "") $where .= " AND cc.level1 is null"; else { $where .= " AND cc.level1=:l1"; $whereParam[":l1"] = $_REQUEST["level1"]; } } if(isset($_REQUEST["level2"])) { if($_REQUEST["level2"] == "") $where .= " AND cc.level2 is null"; else { $where .= " AND cc.level2=:l2"; $whereParam[":l2"] = $_REQUEST["level2"]; } } if(isset($_REQUEST["level3"])) { if($_REQUEST["level3"] == "") $where .= " AND cc.level3 is null"; else { $where .= " AND cc.level3=:l3"; $whereParam[":l3"] = $_REQUEST["level3"]; } } if(isset($_REQUEST["tafsiligroup"])) { if($_REQUEST["tafsiligroup"] == "") $where .= " AND di.TafsiliType is null"; else { $where .= " AND di.TafsiliType=:tt"; $whereParam[":tt"] = $_REQUEST["tafsiligroup"]; } } //.............................................. if(!empty($_POST["level1s"])) { $level1s = preg_replace("/[^0-9,]+/", "", $_POST["level1s"]); $where .= " AND cc.level1 in( " . $level1s . ")"; } //---------------------------------------------- if(!empty($_POST["level2s"])) { $level2s = preg_replace("/[^0-9,]+/", "", $_POST["level2s"]); $level2s = substr($level2s, 0, strlen($level2s)-1); $where .= " AND cc.level2 in( " . $level2s . ")"; } //---------------------------------------------- if(!empty($_POST["level3s"])) { $level3s = preg_replace("/[^0-9,]+/", "", $_POST["level3s"]); $level3s = substr($level3s, 0, strlen($level3s)-1); $where .= " AND cc.level3 in( " . $level3s . ")"; } //---------------------------------------------- if(!empty($_POST["TafsiliGroup"])) { $where .= " AND (di.TafsiliType=:tt or di.TafsiliType2=:tt)"; $whereParam[":tt"] = $_POST["TafsiliGroup"]; } /*if(!empty($_POST["TafsiliGroup2"])) { $where .= " AND di.TafsiliType2=:tt2"; $whereParam[":tt2"] = $_POST["TafsiliGroup2"]; }*/ if(!empty($_POST["TafsiliID"])) { $where .= " AND (di.TafsiliID=:tid or di.TafsiliID2=:tid)"; $whereParam[":tid"] = $_POST["TafsiliID"]; } /*if(!empty($_POST["TafsiliID2"])) { $where .= " AND di.TafsiliID2=:tid2"; $whereParam[":tid2"] = $_POST["TafsiliID2"]; }*/ if(!empty($_REQUEST["fromLocalNo"])) { $where .= " AND d.LocalNo >= :lo1 "; $whereParam[":lo1"] = $_REQUEST["fromLocalNo"]; } if(!empty($_REQUEST["toLocalNo"])) { $where .= " AND d.LocalNo <= :lo2 "; $whereParam[":lo2"] = $_REQUEST["toLocalNo"]; } if(!empty($_POST["fromDate"])) { $where .= " AND d.DocDate >= :q1 "; $whereParam[":q1"] = DateModules::shamsi_to_miladi($_POST["fromDate"], "-"); } if(!empty($_POST["toDate"])) { $where .= " AND d.DocDate <= :q2 "; $whereParam[":q2"] = DateModules::shamsi_to_miladi($_POST["toDate"], "-"); } } $where = ""; $whereParam = array(); if(!empty($_POST["BranchID"])) { $where .= " AND d.BranchID=:b"; $whereParam[":b"] = $_POST["BranchID"]; } MakeWhere($where, $whereParam); $query = $select . $from . " where d.CycleID=" . $_SESSION["accounting"]["CycleID"] . $where; $query .= $group != "" ? " group by " . $group : ""; $query .= " order by b1.BlockCode,b2.BlockCode,b3.BlockCode"; $dataTable = PdoDataAccess::runquery($query, $whereParam); //.......................................................................... function dateRender($row, $val){ return DateModules::miladi_to_shamsi($val); } function moneyRender($row, $val) { return number_format($val, 0, '.', ','); } function bdremainRender($row){ $v = $row["bdAmount"] - $row["bsAmount"]; return $v < 0 ? 0 : number_format($v); } function bsremainRender($row){ $v = $row["bsAmount"] - $row["bdAmount"]; return $v < 0 ? 0 : number_format($v); } $col = $rpg->addColumn("بدهکار", "StartCycleDebtor", "moneyRender"); $col->GroupHeader = "حساب ابتدای دوره"; $col->EnableSummary(true); $col = $rpg->addColumn("بستانکار", "StartCycleCreditor", "moneyRender"); $col->GroupHeader = "حساب ابتدای دوره"; $col->EnableSummary(true); $col = $rpg->addColumn("بدهکار", "bdAmount" , "moneyRender"); $col->GroupHeader = "گردش طی دوره"; $col->EnableSummary(); $col = $rpg->addColumn("بستانکار", "bsAmount", "moneyRender"); $col->GroupHeader = "گردش طی دوره"; $col->EnableSummary(); $col = $rpg->addColumn("مانده بدهکار", "bdAmount", "bdremainRender"); $col->GroupHeader = "مانده پایان دوره"; $col->EnableSummary(true); $col = $rpg->addColumn("مانده بستانکار", "bsAmount", "bsremainRender"); $col->GroupHeader = "مانده پایان دوره"; $col->EnableSummary(true); if(!$rpg->excel) { BeginReport(); echo "<div style=display:none>" . PdoDataAccess::GetLatestQueryString() . "</div>"; echo "<table style='border:2px groove #9BB1CD;border-collapse:collapse;width:100%'><tr> <td width=60px><img src='/framework/icons/logo.jpg' style='width:120px'></td> <td align='center' style='height:100px;vertical-align:middle;font-family:b titr;font-size:15px'> تراز دفتر ".$levelsDescArr[$level]." <br> ". $_SESSION["accounting"]["BranchName"]. "<br>" . "دوره سال " . $_SESSION["accounting"]["CycleID"] . "</td> <td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; if(!empty($_POST["fromDate"])) { echo "<br>گزارش از تاریخ : " . $_POST["fromDate"] . ($_POST["toDate"] != "" ? " - " . $_POST["toDate"] : ""); } echo "</td></tr></table>"; } $rpg->mysql_resource = $dataTable; $rpg->generateReport(); ?> <script> function changeLevel(curlevel,level1,level2,level3,TafsiliGroup,TafsiliID) { nextLevel = (curlevel.substring(1)*1); nextLevel = (nextLevel == 4 || nextLevel == 5) ? nextLevel+2 : nextLevel+1 var form = document.getElementById("subForm"); form.action = "taraz.php?show=true&level=" + "l" + nextLevel; if(curlevel >= "l1") form.action += "&level1=" + level1; if(curlevel >= "l2") form.action += "&level2=" + level2; if(curlevel >= "l3") form.action += "&level3=" + level3; if(curlevel >= "l4") form.action += "&tafsiligroup=" + TafsiliGroup; if(curlevel >= "l5") form.action += "&TafsiliID=" + TafsiliID; form.submit(); return; } </script> <form id="subForm" method="POST" target="_blank"> <input type="hidden" name="fromDate" value="<?= !empty($_REQUEST["fromDate"]) ? $_REQUEST["fromDate"] : "" ?>"> <input type="hidden" name="toDate" value="<?= !empty($_REQUEST["toDate"]) ? $_REQUEST["toDate"] : "" ?>"> <input type="hidden" name="fromLocalNo" value="<?= !empty($_REQUEST["fromLocalNo"]) ? $_REQUEST["fromLocalNo"] : "" ?>"> <input type="hidden" name="toLocalNo" value="<?= !empty($_REQUEST["toLocalNo"]) ? $_REQUEST["toLocalNo"] : "" ?>"> <input type="hidden" name="IncludeRaw" value="<?= !empty($_REQUEST["IncludeRaw"]) ? $_REQUEST["IncludeRaw"] : "" ?>"> <input type="hidden" name="BranchID" value="<?= !empty($_REQUEST["BranchID"]) ? $_REQUEST["BranchID"] : "" ?>"> <input type="hidden" name="level1s" id="level1s" value="<?= $_POST["level1s"] ?>"> <input type="hidden" name="level2s" id="level2s" value="<?= $_POST["level2s"] ?>"> <input type="hidden" name="level3s" id="level3s" value="<?= $_POST["level3s"] ?>"> </form> <? die(); }
function RegisterOuterCheque($DocID, $InChequeObj, $pdo, $CostID = "", $TafsiliID = "", $TafsiliID2 = "", $CenterAccount = "", $BranchID = "", $FirstCostID = "", $SecondCostID = "") { /*@var $InChequeObj ACC_IncomeCheques */ $CycleID = substr(DateModules::shNow(), 0, 4); //------------- get CostCodes -------------------- $CostCode_guaranteeAmount_daryafti = FindCostID("904-04"); $CostCode_guaranteeAmount2_daryafti = FindCostID("905-04"); //-------------------- BranchID ----------------------- $BackPays = $InChequeObj->GetBackPays($pdo); if (count($BackPays) > 0) { $FirstBranchID = $BackPays[0]["BranchID"]; } else { $FirstBranchID = $_SESSION["accounting"]["BranchID"]; } //---------------- add doc header -------------------- if ($DocID == "") { $obj = new ACC_docs(); $obj->RegDate = PDONOW; $obj->regPersonID = $_SESSION['USER']["PersonID"]; $obj->DocDate = PDONOW; $obj->CycleID = $CycleID; $obj->BranchID = $FirstBranchID; $obj->DocType = DOCTYPE_INCOMERCHEQUE; $obj->description = "چک شماره " . $InChequeObj->ChequeNo; if (!$obj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } } else { $obj = new ACC_docs($DocID, $pdo); } //----------------- add Doc items ------------------------ $__ChequeAmount = $InChequeObj->ChequeAmount; $__ChequeID = $InChequeObj->IncomeChequeID; $__TafsiliID = $InChequeObj->TafsiliID; if ($__TafsiliID == "") { $dt = $InChequeObj->GetBackPays(); if (count($dt) == 1) { $__TafsiliID = $dt[0]["TafsiliID"]; } } $__SourceType = DOCTYPE_INCOMERCHEQUE; $itemObj = new ACC_DocItems(); $itemObj->DocID = $obj->DocID; $itemObj->locked = "YES"; $itemObj->TafsiliType = TAFTYPE_PERSONS; $itemObj->TafsiliID = $__TafsiliID; $itemObj->TafsiliType2 = TAFTYPE_ChequeStatus; $itemObj->TafsiliID2 = $InChequeObj->ChequeStatus; $itemObj->SourceType = $__SourceType; $itemObj->SourceID = $__ChequeID; $itemObj->details = "چک شماره " . $InChequeObj->ChequeNo; //............................................................ if ($InChequeObj->ChequeStatus == INCOMECHEQUE_NOTVOSUL) { unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount_daryafti; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->CreditorAmount = 0; $itemObj->Add($pdo); unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount2_daryafti; $itemObj->DebtorAmount = 0; $itemObj->CreditorAmount = $__ChequeAmount; $itemObj->Add($pdo); if (ExceptionHandler::GetExceptionCount() > 0) { return false; } return $obj->DocID; } //............................................................ if ($InChequeObj->ChequeStatus == INCOMECHEQUE_VOSUL) { unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount2_daryafti; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->CreditorAmount = 0; $itemObj->Add($pdo); unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount_daryafti; $itemObj->DebtorAmount = 0; $itemObj->CreditorAmount = $__ChequeAmount; $itemObj->Add($pdo); if (count($BackPays) > 0) { foreach ($BackPays as $row) { $BackPayObj = new LON_BackPays($row["BackPayID"]); $ReqObj = new LON_requests($BackPayObj->RequestID); $PersonObj = new BSC_persons($ReqObj->ReqPersonID); if ($PersonObj->IsSupporter == "YES") { $result = RegisterSHRTFUNDCustomerPayDoc($obj, $BackPayObj, $CostID, $TafsiliID, $TafsiliID2, $CenterAccount, $BranchID, $FirstCostID, $SecondCostID, $pdo); } else { $result = RegisterCustomerPayDoc($obj, $BackPayObj, $CostID, $TafsiliID, $TafsiliID2, $CenterAccount, $BranchID, $FirstCostID, $SecondCostID, $pdo); } } } else { if ($CenterAccount == "true") { unset($itemObj->ItemID); unset($itemObj->TafsiliType); unset($itemObj->TafsiliType2); unset($itemObj->TafsiliID2); unset($itemObj->TafsiliID); $itemObj->locked = "NO"; $itemObj->CostID = $FirstCostID; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->CreditorAmount = 0; if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } $Secobj = new ACC_docs(); $Secobj->RegDate = PDONOW; $Secobj->regPersonID = $_SESSION['USER']["PersonID"]; $Secobj->DocDate = PDONOW; $Secobj->CycleID = $CycleID; $Secobj->BranchID = $BranchID; $Secobj->DocType = $__SourceType; if (!$Secobj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } unset($itemObj->ItemID); unset($itemObj->TafsiliType); unset($itemObj->TafsiliType2); unset($itemObj->TafsiliID2); unset($itemObj->TafsiliID); $itemObj->DocID = $Secobj->DocID; $itemObj->CostID = $SecondCostID; $itemObj->DebtorAmount = 0; $itemObj->CreditorAmount = $__ChequeAmount; if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } unset($itemObj->ItemID); unset($itemObj->TafsiliType); unset($itemObj->TafsiliType2); unset($itemObj->TafsiliID2); unset($itemObj->TafsiliID); $CostObj = new ACC_CostCodes($CostID); $itemObj->CostID = $CostID; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->CreditorAmount = 0; $itemObj->TafsiliType = $CostObj->TafsiliType; if ($TafsiliID != "") { $itemObj->TafsiliID = $TafsiliID; } $itemObj->TafsiliType2 = $CostObj->TafsiliType2; if ($TafsiliID2 != "") { $itemObj->TafsiliID2 = $TafsiliID2; } if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } } else { unset($itemObj->ItemID); unset($itemObj->TafsiliType); unset($itemObj->TafsiliType2); unset($itemObj->TafsiliID2); unset($itemObj->TafsiliID); $itemObj->locked = "NO"; $CostObj = new ACC_CostCodes($CostID); $itemObj->CostID = $CostID; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->CreditorAmount = 0; $itemObj->TafsiliType = $CostObj->TafsiliType; if ($TafsiliID != "") { $itemObj->TafsiliID = $TafsiliID; } $itemObj->TafsiliType2 = $CostObj->TafsiliType2; if ($TafsiliID2 != "") { $itemObj->TafsiliID2 = $TafsiliID2; } if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } } unset($itemObj->ItemID); $itemObj->locked = "YES"; $itemObj->DocID = $obj->DocID; $itemObj->CostID = $InChequeObj->CostID; $itemObj->DebtorAmount = 0; $itemObj->CreditorAmount = $__ChequeAmount; $itemObj->TafsiliType = $InChequeObj->TafsiliType; $itemObj->TafsiliID = $InChequeObj->TafsiliID; $itemObj->TafsiliType2 = $InChequeObj->TafsiliType2; $itemObj->TafsiliID2 = $InChequeObj->TafsiliID2; if (!$itemObj->Add($pdo)) { ExceptionHandler::PushException("خطا در ایجاد سند"); return false; } } if (ExceptionHandler::GetExceptionCount() > 0) { return false; } return true; } //............................................................ if (array_search($InChequeObj->ChequeStatus, array(INCOMECHEQUE_EBTAL, INCOMECHEQUE_MOSTARAD, INCOMECHEQUE_BARGHASHTI_MOSTARAD, INCOMECHEQUE_MAKHDOOSH, INCOMECHEQUE_CHANGE)) !== false) { $itemObj->DocID = $obj->DocID; $itemObj->CostID = $CostCode_guaranteeAmount_daryafti; $itemObj->CreditorAmount = $__ChequeAmount; $itemObj->DebtorAmount = 0; $itemObj->TafsiliType = TAFTYPE_PERSONS; $itemObj->TafsiliID = $__TafsiliID; $itemObj->SourceType = $__SourceType; $itemObj->SourceID = $__ChequeID; $itemObj->details = "چک شماره " . $InChequeObj->ChequeNo; $itemObj->Add($pdo); unset($itemObj->ItemID); $itemObj->CostID = $CostCode_guaranteeAmount2_daryafti; $itemObj->CreditorAmount = 0; $itemObj->DebtorAmount = $__ChequeAmount; $itemObj->Add($pdo); //--------------------------------------------------------- if (ExceptionHandler::GetExceptionCount() > 0) { return false; } return true; } return true; }
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 . ".DAT"); die; } elseif ($_POST['RepFormat'] == 1) { $query = " select ps.loan_no,\r\n\t\t\t\t\t\t pa.pay_year,\r\n\t\t\t\t\t\t pa.pay_month,\r\n\t\t\t\t\t\t ba.branch_code,\r\n\t\t\t\t\t\t p.pfname,\r\n\t\t\t\t\t\t p.plname,\r\n\t\t\t\t\t\t pai.get_value + pai.diff_get_value * pai.diff_value_coef as amount\r\n\r\n\t\t\t\t\tfrom payment_items pai\r\n\t\t\t\t\t\t INNER JOIN payments pa\r\n\t\t\t\t\t\t\t ON ( pai.staff_id = pa.staff_id AND\r\n\t\t\t\t\t\t\t\t\tpai.pay_year = pa.pay_year AND\r\n\t\t\t\t\t\t\t\t\tpai.pay_month = pa.pay_month AND\r\n\t\t\t\t\t\t\t\t\tpai.payment_type = pa.payment_type)\r\n\t\t\t\t\t\t INNER JOIN person_subtracts ps\r\n\t\t\t\t\t\t\t ON (pai.param1 = 'LOAN' AND pai.param2 = ps.subtract_id AND ps.subtract_type = " . LOAN . ") \r\n\t\t\t\t\t\t INNER JOIN banks ba\r\n\t\t\t\t\t\t\t ON (ba.bank_id = ps.bank_id)\r\n\t\t\t\t\t\t INNER JOIN staff s \r\n\t\t\t\t\t\t\t ON pai.staff_id = s.staff_id \r\n\t\t\t\t\t\t INNER JOIN persons p\r\n\t\t\t\t\t\t\t ON(p.personID=s.personID)\r\n\t\t\t\t\t\t LEFT JOIN writs w\r\n\t\t\t\t\t\t\t ON s.last_writ_id = w.writ_id AND s.last_writ_ver = w.writ_ver AND s.staff_id = w.staff_id\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\twhere pai.pay_year = " . $_POST['pay_year'] . " AND\r\n\t\t\t\t\t\t pai.pay_month = " . $_POST['pay_month'] . " AND\r\n\t\t\t\t\t\t pai.payment_type = " . $_POST['PayType'] . " AND ps.bank_id IS NOT NULL \r\nAND pai.param2 not in ( \r\n270376904\t,\r\n270376908\t,\r\n270376909\t,\r\n270376911\t,\r\n270376912\t,\r\n270376914\t,\r\n270376915\t,\r\n270376916\t,\r\n270376917\t,\r\n270376929\t,\r\n270376930\t,\r\n270376931\t,\r\n270376933\t,\r\n270376934\t,\r\n270376935\t,\r\n270376936\t,\r\n270376937\t,\r\n270376938\t,\r\n270376939\t,\r\n270376940\t,\r\n270376941\t,\r\n270376942\t,\r\n270376944\t,\r\n270376945\t,\r\n270376946\t,\r\n270376948\t,\r\n270376950\t,\r\n270376958\t,\r\n270376960\t,\r\n270376961\t,\r\n270376962\t,\r\n270376963\t,\r\n270376965\t, 178519943 , 270366680 , 270377067 , 180021184 , 270374973 , 270374972 , 270379013 ) "; $query .= $staffID > 0 ? " AND pai.staff_id=" . $staffID : ""; $query .= $WhereCost != "" ? " AND pai.cost_center_id in (" . $WhereCost . ") " : ""; $query .= $WhereEmpstate != "" ? " AND w.emp_state in (" . $WhereEmpstate . ") " : ""; $query .= $WherePT != "" ? " AND s.person_type in (" . $WherePT . ") " : ""; $query .= $WhereBT != "" ? " AND ps.bank_id in (" . $WhereBT . ") " : ""; $dt = PdoDataAccess::runquery($query); //echo $query ; die(); list($year, $month, $day) = preg_split('/\\//', DateModules::shNow()); $date = substr($year, 2, 2) . $month . $day; for ($i = 0; $i < count($dt); $i++) { $record = array($dt[$i]['branch_code'], $dt[$i]['loan_no'], $dt[$i]['amount'], $date); $db_path = "../../../HRProcess/BMIPYR.DBF"; $dbi = dbase_open($db_path, 2); dbase_add_record($dbi, $record); dbase_close($dbi); } $file = "BMIPYR.DBF"; 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');
} </script> </head> <title><?php echo isset($_GET["Q1"]) ? $_GET["Q1"] : ""; ?> </title> <body dir=rtl> <center> <!--<input type="button" onclick="showResult();" class="big_button noprint" value="خروجی excel">--> <table width="98%" cellpadding="0" cellspacing="0"> <tr> <td width="20%"><img src="/HumanResources/img/fum_symbol.jpg" ></td> <td align="center" style="font-family:'b titr'"> <span style="font-family:tahoma; font-weight: bold;font-size: 9pt;"> <?php echo isset($_GET["Q1"]) ? $_GET["Q1"] : ""; ?> </span></td> <td width="20%" align="left" style="font-family:tahoma;font-size:8pt">تاریخ : <?php echo DateModules::shNow(); ?> </td> </tr> </table> <?php echo $output; ?> </center> </body> </html>
$from_science_level = 1; $to_science_level = 5; } else { $from_science_level = $_POST['SELECT:77']; $to_science_level = $_POST['SELECT:77']; } $work_state_id = !empty($_POST['SELECT:93']) && $_POST['SELECT:93'] != '-1' ? $_POST['SELECT:93'] : '19'; $work_city_id = !empty($_POST['SELECT:94']) && $_POST['SELECT:94'] != '-1' ? $_POST['SELECT:94'] : '11'; $emp_state = 4; $execute_date = !empty($_POST['FDATE:72']) ? DateModules::Shamsi_to_Miladi($_POST['FDATE:72']) : DateModules::Now(); $recordSet = compute_professors_salary_params($from_base, $to_base, $from_science_level, $to_science_level, $work_state_id, $work_city_id, $execute_date, $emp_state); $content = ""; for ($i = 0; $i < count($recordSet); $i++) { $content .= "<tr><td>" . ($i + 1) . "</td>" . "<td>" . number_format(round($recordSet[$i]['total_sum'])) . "</td>" . "<td>" . number_format(round($recordSet[$i]['vijeh_extra'])) . "</td>" . "<td>" . number_format(round($recordSet[$i]['special_extra'])) . "</td>" . "<td>" . number_format(round($recordSet[$i]['absorb_extra'])) . "</td>" . "<td>" . number_format(round($recordSet[$i]['weather_bad_extra'])) . "</td>" . "<td>" . number_format(round($recordSet[$i]['base_salary'])) . "</td>" . "<td>" . $recordSet[$i]['base'] . "</td>" . "<td>" . $recordSet[$i]['science_level'] . "</td></tr>"; } $tags = array('<!--data-->' => $content, '<!--now-->' => DateModules::shNow()); $content = file_get_contents("../../reports/proffesor_salary_param.html"); $content = str_replace(array_keys($tags), array_values($tags), $content); echo $content; die; function compute_professors_salary_params($from_base, $to_base, $from_science_level, $to_science_level, $work_state_id, $work_city_id, $execute_date, $emp_state = EMP_STATE_APPROVED_CEREMONIOUS, $compute_heiat_omana_absorb_extra = true) { $query = 'SELECT validity_start_date, validity_end_date, salary_item_type_id FROM salary_item_types WHERE salary_item_type_id IN ( ' . SIT_PROFESSOR_BASE_SALARY . ', ' . SIT_PROFESSOR_BAD_WEATHER_EXTRA . ', ' . SIT_PROFESSOR_ABSOPPTION_EXTRA . ', ' . SIT_PROFESSOR_SPECIAL_EXTRA . ', ' . SIT_PROFESSOR_PARTICULAR_EXTRA . ',
$prof2 = '<tr><td style="background-color:#F0F3FF">سمت اجرايي :</td><td style="font-weight:bold">' . $valid_writs[$k - 1][exe_post_title] . '</td> <td style="background-color:#F0F3FF">تاريخ سمت اجرايي :</td><td style="font-weight:bold">' . DateModules::miladi_to_shamsi($valid_writs[$k - 1][exe_from_date]) . '</td></tr>'; } else { $prof2 = '<tr><td style="background-color:#F0F3FF">سمت اجرايي :</td><td style="font-weight:bold"></td> <td style="background-color:#F0F3FF">تاريخ سمت اجرايي :</td><td style="font-weight:bold"></td></tr>'; } } $ptitle = ""; if ($valid_writs[$k - 1][person_type] == HR_WORKER) { $ptitle = 'عنوان شغل'; } elseif ($valid_writs[$k - 1][person_type] == HR_PROFESSOR) { $ptitle = 'عنوان پست'; } elseif ($valid_writs[$k - 1][person_type] == HR_EMPLOYEE) { $ptitle = 'عنوان حکم'; } $tags = array('<!--post_title-->' => $ptitle, '<!--fname-->' => $valid_writs[$k - 1][pfname], '<!--lname-->' => $valid_writs[$k - 1][plname], '<!--father_name-->' => $valid_writs[$k - 1][father_name], '<!--staff_id-->' => $valid_writs[$k - 1][staff_id], '<!--birth_date-->' => DateModules::miladi_to_shamsi($valid_writs[$k - 1][birth_date]), '<!--birth_place-->' => $valid_writs[$k - 1][birth_place], '<!--idcard_no-->' => $valid_writs[$k - 1][idcard_no], '<!--national_code-->' => $valid_writs[$k - 1][national_code], '<!--prof1-->' => $prof1, '<!--worktime_type-->' => $valid_writs[$k - 1][worktime_type_title], '<!--military_type-->' => $valid_writs[$k - 1][military_type_title], '<!--education_level-->' => $valid_writs[$k - 1][education_level_title], '<!--field_title-->' => $valid_writs[$k - 1][sf_sb_title], '<!--doc_date-->' => DateModules::miladi_to_shamsi($valid_writs[$k - 1][doc_date]), '<!--studyPlace-->' => $valid_writs[$k - 1][study_palce], '<!--razm-->' => $valid_writs[$k - 1][razmAmount], '<!--janbaz-->' => $valid_writs[$k - 1][janbazAmount], '<!--unit-->' => $valid_writs[$k - 1][unitName], '<!--emp_state-->' => $valid_writs[$k - 1][emp_state_title], '<!--post_no-->' => $valid_writs[$k - 1][post_no], '<!--last_post_title-->' => $valid_writs[$k - 1][post_title], '<!--prof2-->' => $prof2, '<!--unit_Title-->' => $valid_writs[$k - 1][Unit_Title], '<!--caption-->' => $valid_writs[$k - 1][person_type] == HR_EMPLOYEE ? "عنوان حکم :" : "عنوان پست :", '<!--now-->' => DateModules::shNow()); if (isset($_REQUEST['Param1']) && $_REQUEST['Param1'] == 2) { $TodayDate = DateModules::Now(); $totalDay = DateModules::getDateDiff($TodayDate, $valid_writs[$k - 1][birth_date]); $yAge = (int) ($totalDay / 365.25); $mAge = (int) (($totalDay - $yAge * 365.25) / 30.4375); $dAge = round($totalDay - $yAge * 365.25 - $mAge * 30.4375); $report .= "<tr>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][staff_id] . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][pfname] . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][plname] . "</td>\n\t\t\t\t\t\t\t<td>" . DateModules::miladi_to_shamsi($valid_writs[$k - 1][birth_date]) . "</td>\n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][Unit_Title] . "</td> \n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][science_level_title] . "</td> \n\t\t\t\t\t\t\t<td>" . $valid_writs[$k - 1][national_code] . "</td>\n\t\t\t\t\t\t\t<td>" . $yAge . " سال و " . $mAge . " ماه و " . $dAge . " روز" . "</td>\n\t\t\t\t\t\t"; } // مشخص کردن فایل template مربوط به خلاصه پرونده if (isset($_REQUEST['Param1']) && $_REQUEST['Param1'] == 2) { $content = file_get_contents("../../reports/employment_history.htm"); } else { $content = file_get_contents("../../reports/summary_doc.htm"); } $content = str_replace(array_keys($tags), array_values($tags), $content);
width : 120, fieldLabel : "سال", displayField: 'title', valueField : "id", hiddenName : "year", value : '<?= substr(DateModules::shNow(),0,4) ?>' },{ xtype : "combo", store: MonthStore, labelWidth : 30, width : 120, fieldLabel : "ماه", displayField: 'title', valueField : "id", hiddenName : "month", value : '<?= substr(DateModules::shNow(),5,2)*1 ?>' },{ xtype : "button", border : true, style : "margin-right:20px", text : "مشاهده گزارش", iconCls : "report", handler : function(){ TraceTrafficObj.LoadReport(); } },{ xtype : "shdatefield", name : "FromDate", hidden : !this.admin, fieldLabel : "از تاریخ" },{ xtype : "shdatefield", name : "ToDate",
private static function compute_professors_salary_params($from_base, $to_base, $from_science_level, $to_science_level, $work_state_id, $work_city_id, $execute_date, $emp_state = EMP_STATE_APPROVED_CEREMONIOUS, $compute_heiat_omana_absorb_extra = true) { if (!$execute_date) { $execute_date = DateModules::shNow(); } $sql = 'SELECT validity_start_date, validity_end_date, salary_item_type_id FROM salary_item_types WHERE salary_item_type_id IN (' . SIT_PROFESSOR_BASE_SALARY . ', ' . SIT_PROFESSOR_BAD_WEATHER_EXTRA . ', ' . SIT_PROFESSOR_ABSOPPTION_EXTRA . ', ' . SIT_PROFESSOR_SPECIAL_EXTRA . ', ' . SIT_PROFESSOR_PARTICULAR_EXTRA . ', ' . SIT_PROFESSOR_HEIAT_OMANA_SPECIAL_EXTRA . ' )'; $temp = PdoDataAccess::runquery($sql); foreach ($temp as $result) { switch ($result['salary_item_type_id']) { case SIT_PROFESSOR_BASE_SALARY : $is_valid_base_salary = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); break; case SIT_PROFESSOR_BAD_WEATHER_EXTRA : $is_valid_bad_weather_extra = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); ; break; case SIT_PROFESSOR_ABSOPPTION_EXTRA : $is_valid_absopption_extra = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); ; break; case SIT_PROFESSOR_SPECIAL_EXTRA : $is_valid_special_extra = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); ; break; case SIT_PROFESSOR_PARTICULAR_EXTRA : $is_valid_particular_extra = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); ; break; case SIT_PROFESSOR_HEIAT_OMANA_SPECIAL_EXTRA : $is_valid_heiat_omana_absorb_extera = self::validate_salary_item($result['validity_start_date'], $result['validity_end_date'], $execute_date); ; } } $counter = 0; for ($science_level = $to_science_level; $science_level >= $from_science_level; $science_level--) for ($base = $from_base; $base <= $to_base; $base++) { $writ_rec['base'] = $base; $writ_rec['science_level'] = $science_level; $writ_rec['work_city_id'] = $work_city_id; $writ_rec['work_state_id'] = $work_state_id; $writ_rec['execute_date'] = $execute_date; $writ_rec['emp_state'] = $emp_state; if ($compute_heiat_omana_absorb_extra && $is_valid_heiat_omana_absorb_extera) { //آخرين حكم سال قبل $base_writ_rec['base'] = $base; $base_writ_rec['science_level'] = $science_level; $base_writ_rec['work_city_id'] = $work_city_id; $base_writ_rec['work_state_id'] = $work_state_id; $base_writ_rec['emp_state'] = $emp_state; $this_writ_year = substr(DateModules::Miladi_to_Shamsi($execute_date), 0, 4); $one_year_ago = $this_writ_year - 1; $one_year_ago_last_day_writ = $one_year_ago . "/12/29"; $Gone_year_ago_last_day = DateModules::Shamsi_to_Miladi($one_year_ago_last_day_writ); $base_writ_rec['execute_date'] = $Gone_year_ago_last_day; if ($base_writ_rec) $rec = self::compute_professors_salary_params( $base_writ_rec['base'], $base_writ_rec['base'], $base_writ_rec['science_level'], $base_writ_rec['science_level'], $base_writ_rec['work_state_id'], $base_writ_rec['work_city_id'], $base_writ_rec['execute_date'], $base_writ_rec['emp_state'], false); $devotion_extra = 0; $param1 = $rec[0]['base_salary'] + $rec[0]['absorb_extra'] + $rec[0]['vijeh_extra'] + $rec[0]['special_extra'] + $devotion_extra; $heiat_omana_absorb_extra = $param1 * 0.02; } else $heiat_omana_absorb_extra = 0; //............................. if ($is_valid_base_salary == true) $base_salary = self::compute_salary_item1_01($writ_rec, $param1, $param2, $param3, $param4, $param5, $param6, $param7); else $base_salary = 0; //............................. if ($is_valid_absopption_extra == true) $absorb_extra = round($base_salary * manage_salary_params::get_salaryParam_value("", "1", SPT_PROFESSOR_ABSORB_COEF, $writ_rec['execute_date'], $writ_rec['science_level'], $writ_rec['work_city_id'], $writ_rec['work_state_id'])); else $absorb_extra = 0; //............................. if ($is_valid_bad_weather_extra == true) $weather_bad_extra = round($base_salary * manage_salary_params::get_salaryParam_value("", "1", SPT_PROFESSOR_WHEATHER_COEF, $writ_rec['execute_date'], $writ_rec['work_city_id'], $writ_rec['work_state_id'])); else $weather_bad_extra = 0; //............................. if ($is_valid_special_extra == true) $special_extra = round($base_salary * manage_salary_params::get_salaryParam_value("", "1", SPT_SPECIAL_EXTRA_COEF, $writ_rec['execute_date'], $writ_rec['science_level'])); else $special_extra = 0; //............................. if ($is_valid_particular_extra == true) $vijeh_extra = $base_salary * manage_salary_params::get_salaryParam_value("", "1", SPT_PARTICULAR_EXTRA, $writ_rec['execute_date'], $writ_rec['science_level']); else $vijeh_extra = 0; //............................. $salary_params[$counter]['base_salary'] = $base_salary; $salary_params[$counter]['absorb_extra'] = $absorb_extra; $salary_params[$counter]['weather_bad_extra'] = $weather_bad_extra; $salary_params[$counter]['special_extra'] = $special_extra; $salary_params[$counter]['heiat_omana_absorb_extra'] = $heiat_omana_absorb_extra; $salary_params[$counter]['vijeh_extra'] = $vijeh_extra; $salary_params[$counter]['total_sum'] = $base_salary + $absorb_extra + $weather_bad_extra + $special_extra + $vijeh_extra + $heiat_omana_absorb_extra; $salary_params[$counter]['base'] = $base; switch ($science_level) { case INSTRUCTOR_EDUCATOR : $salary_params[$counter]['science_level'] = 'مربي آموزشيار'; break; case EDUCATOR : $salary_params[$counter]['science_level'] = 'مربي'; break; case MASTERSTROKE : $salary_params[$counter]['science_level'] = 'استاديار'; break; case LECTURESHIP : $salary_params[$counter]['science_level'] = 'دانشيار'; break; case MASTERSHIP : $salary_params[$counter]['science_level'] = 'استاد'; break; } $counter++; } return $salary_params; }
function makeHeader($row, $person_count){ global $GroupCostCenter; global $GroupPersonType; $group = ""; $group = $GroupCostCenter ? $row["cost_center_id"] . "_" : "ALL_"; $group .= $GroupPersonType ? $row["person_type"] : "ALL"; $HedearTitle = '' ; if($_GET['RepType'] == 'TSummary' ) $HedearTitle = 'خلاصه لیست حقوق خزانه'; if($_GET['RepType'] == 'Summary' ) $HedearTitle = 'خلاصه لیست حقوق '; echo "<table width=100% border=0 style='font-family:b nazanin;'> <tr> <td width=120px><img src='/HumanResources/img/fum_symbol.jpg'></td> <td align=center style='font-weight:bold'>".$HedearTitle."</td> <td width=120px> شماره : <br> تاریخ : " . DateModules::shNow() . " </td> </tr> </table>"; echo "<table id=outer width=100% cellpadding=0 cellspacing=0> <tr> <td colspan=2 class=header> <table width=100%> <tr class=header> <td>مرکز هزینه : " . ($GroupCostCenter ? "[ " . $row["cost_center_id"] . " ] " . $row["cost_center_title"] : "همه") . "</td> <td>نوع پرسنل : " . ($GroupPersonType ? PersonTypeDesc($row["person_type"]) : "همه" ) . "</td> <td>تعداد افراد : " . $person_count[$group] . "</td> <td>مربوط به : " . $_POST["pay_year"] . "/" . $_POST["pay_month"] . "</td> </tr> </table> </td> </tr>"; }
<?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;
static function SelectEsMsg($where = "", $whereParam = array()) { $dateArr = preg_split("/\\//", DateModules::shNow()); $month = $dateArr[1] - 1 == 0 ? "12" : $dateArr[1] - 1; $startDate = DateModules::shamsi_to_miladi($dateArr[0] . "/" . $month . "/01"); if ($dateArr[1] < 7) { $endDate = DateModules::shamsi_to_miladi($dateArr[0] . "/" . $dateArr[1] . "/31"); } else { if ($dateArr[1] < 12) { $endDate = DateModules::shamsi_to_miladi($dateArr[0] . "/" . $dateArr[1] . "/30"); } else { if ($dateArr[1] == 12) { $endDate = DateModules::shamsi_to_miladi($dateArr[0] . "/" . $dateArr[1] . "/29"); } } } $query = " select s.staff_id , p.pfname , p.plname , w.ouid ,w.writ_id , w.writ_ver , w.issue_date ,bi.Title emp_state_title , w.execute_date ,w.state\n from persons p inner join staff s \n on p.personid = s.personid\n inner join writs w\n on s.staff_id = w.staff_id\n inner join org_new_units o \n on w.ouid = o.ouid \n inner join Basic_Info bi \n on bi.InfoID = w.emp_state and TypeID = 3\n \n where w.issue_date >='" . $startDate . "' and w.issue_date <= '" . $endDate . "' and \n w.emp_mode = 21 and w.emp_state not in (3,4) and w.state <> 1 and w.execute_date <='" . $endDate . "'"; $temp = PdoDataAccess::runquery($query, $whereParam); for ($i = 0; $i < count($temp); $i++) { $temp[$i]['full_unit_title'] = manage_units::get_full_title($temp[$i]['ouid']); } return $temp; }
function GroupIssueWrit() { ini_set('max_execution_time', 1000); //300 seconds = 5 minutes ini_set("memory_limit", '500M'); $where = "s.person_type=" . $_POST["person_type"]; $whereParams = array(); //------------------------ Make Where Clause ---------------------- if (!empty($_REQUEST["ouid"])) { $where .= " AND ( o.ouid = :ouid OR o.parent_path LIKE :ouid2 OR o.parent_path LIKE :ouid3 OR o.parent_path LIKE :ouid4 ) "; $whereParams[":ouid"] = $_REQUEST["ouid"]; $whereParams[":ouid2"] = "%," . $_REQUEST["ouid"] . ",%"; $whereParams[":ouid3"] = "%" . $_REQUEST["ouid"] . ",%"; $whereParams[":ouid4"] = "%," . $_REQUEST["ouid"] . "%"; } if (!empty($_POST["from_PersonID"])) { $where .= " AND s.staff_id >= :f_personid"; $whereParams[":f_personid"] = $_POST["from_PersonID"]; } if (!empty($_POST["to_PersonID"])) { $where .= " AND s.staff_id <= :t_personid"; $whereParams[":t_personid"] = $_POST["to_PersonID"]; } $where .= " AND " . QueryHelper::makeWhereOfCheckboxList("emp_state", "emp_state"); //----------------------------------------------------------------- //$execute_date = DateModules::Shamsi_to_Miladi($_POST["execute_date"]); //----------------------------------------------------------------- /*$sql = 'SELECT s.staff_id, s.last_writ_id, s.last_writ_ver, p.pfname , p.plname FROM staff s JOIN writs w ON (s.staff_id=w.staff_id AND s.last_writ_id = w.writ_id AND s.last_writ_ver = w.writ_ver) JOIN persons p ON(s.PersonID = p.PersonID and s.person_type=p.person_type)'; $sql .= (!empty($_REQUEST["ouid"])) ? "LEFT OUTER JOIN org_new_units o ON (s.ouid=o.ouid)" : ""; //JOIN Basic_Info bi ON bi.typeid = 6 and w.education_level = bi.InfoID and bi.MasterID = 1 $sql .= ' WHERE s.last_writ_id > 0 AND s.last_writ_ver > 0 AND w.cost_center_id != 46 AND w.emp_mode in('.EMP_MODE_PRACTITIONER.', '.EMP_MODE_EDUCATIONAL_MISSION.', '.EMP_MODE_INTERNAL_STUDY_OPPORTUNITY.', '.EMP_MODE_RUSTICATION_EXTERNAL_STUDY_OPPORTUNITY.', '.EMP_MODE_INTERNAL_STUDY_MISSION.', '.EMP_MODE_EXTERNAL_STUDY_MISSION.', '.EMP_MODE_ENGAGEMENT.') AND ' . $where; */ $whereParams = array(); $sql = " select s.staff_id,\n s.last_writ_id,\n s.last_writ_ver,\n p.pfname ,\n p.plname , writ_type_id, writ_subtype_id ,\n g2j(wr.execute_date) execute_date \n\n from writs w inner join staff s\n on s.staff_id=w.staff_id AND s.last_writ_id = w.writ_id AND\n s.last_writ_ver = w.writ_ver\n inner join writs wr on s.staff_id = wr.staff_id\ninner join persons p on s.personid = p.personid\n\n where w.emp_state =4 and\n wr.writ_type_id = 5 and\n wr.writ_subtype_id = 145 and\n wr.execute_date > '2014-08-22' and\n wr.execute_date < '2014-11-22' and\n wr.history_only = 0 "; $staff_dt = PdoDataAccess::runquery_fetchMode($sql, $whereParams); unset($sql); unset($where); unset($whereParams); if ($staff_dt->rowCount() == 0) { echo "موارد انتخابی شما هیج فردی را برای صدور حکم شامل نمی شود."; die; } $log_obj = new manage_writ_group_issue_log(); $send_letter_no = $_POST["send_letter_no"]; $unsuccess_count = 0; if (empty($_POST["step"])) { $_POST["step"] = 1; } $staff_count = $staff_dt->rowCount(); $writ_obj = ""; for ($index = 0; $index < $staff_count; $index++) { $staff_row = $staff_dt->fetch(); /*if(isset($_POST["prevent_two_writ_at_one_day"])) { if(count(PdoDataAccess::runquery(" select * from writs where staff_id=" . $staff_dt[$index]["staff_id"] . " and execute_date = '" . $execute_date . "'")) != 0) continue; }*/ //............................. if (!empty($_POST["to_send_letter_no"])) { if ($send_letter_no > $_POST["to_send_letter_no"]) { ExceptionHandler::PushException(EXCEED_OF_END_SEND_LETTER_NO_ERR); break; } } //............................. /*$writ_obj = manage_writ::IssueWrit($staff_row["staff_id"], $_POST["writ_type_id"], $_POST["writ_subtype_id"], $_POST["execute_date"], $_POST["person_type"], DateModules::Shamsi_to_Miladi($_POST["issue_date"]), false, false, $send_letter_no); */ $_POST["issue_date"] = DateModules::shNow(); $execute_date = $staff_row["execute_date"]; $arr = preg_split('/\\//', $execute_date); $execute_date = '1394/' . $arr[1] . "/" . $arr[2]; $writ_obj = manage_writ::IssueWrit($staff_row["staff_id"], $staff_row["writ_type_id"], $staff_row["writ_subtype_id"], $execute_date, $_POST["person_type"], DateModules::Shamsi_to_Miladi($_POST["issue_date"]), false, false, $send_letter_no); if (!$writ_obj) { $log_obj->make_unsuccess_rows($staff_row); continue; } manage_writ_item::compute_writ_items($writ_obj->writ_id, $writ_obj->writ_ver, $writ_obj->staff_id); /*@var $writ_obj manage_writ*/ if ($writ_obj !== false && $writ_obj->writ_id > 0) { $staff_row['writ_id'] = $writ_obj->writ_id; $log_obj->make_success_row($staff_row); $send_letter_no = !empty($_POST["step"]) && !empty($_POST["send_letter_no"]) ? $send_letter_no + $_POST["step"] : ""; } else { $log_obj->make_unsuccess_rows($staff_row); if (!empty($_POST["stop_error_count"]) && $unsuccess_count >= $_POST["stop_error_count"]) { ExceptionHandler::PushException(TOO_MANY_ERR); break; } } unset($writ_obj); } $log_obj->finalize(); $log_obj->make_result(); die; }
function InsertData() { $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('utf-8'); $data->setRowColOffset(0); $data->read($_FILES["attach"]["tmp_name"]); $FileType = $_POST["FileType"]; $obj = new manage_pay_get_lists(); $MissionObj = new manage_mission_list_items(); $PGIObj = new manage_pay_get_list_items(); $log_obj = new manage_group_pay_get_log(); $success_count = 0; $unsuccess_count = 0; $costId = ""; if ($FileType == EXTRA_WORK_LIST) { for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) { //for ($j = 0; $j < $data->sheets[0]['numCols']; $j++) //$data->sheets[0]['cells'][$i][$j]; if (!isset($data->sheets[0]['cells'][$i][0]) && !isset($data->sheets[0]['cells'][$i][1])) { break; } $query = " select p.pfname , p.plname , s.person_type from staff s inner join persons p on s.personid = p.personid\n\t\t\t\t\twhere staff_id =" . $data->sheets[0]['cells'][$i][1]; $result = PdoDataAccess::runquery($query); if ($costId != $data->sheets[0]['cells'][$i][0]) { $obj->list_id = null; $obj->cost_center_id = $data->sheets[0]['cells'][$i][0]; $obj->list_date = DateModules::Now(); $obj->doc_state = 1; $obj->list_type = EXTRA_WORK_LIST; if ($obj->AddList() === false) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], $result[0]["pfname"] . " " . $result[0]["plname"], " کد مرکز هزینه نامعتبر است."); $unsuccess_count++; continue; } $costId = $obj->cost_center_id; } if (count($result) > 0) { $pt = $result[0]["person_type"]; if ($pt == 3) { $salaryItemId = 152; } elseif ($pt == 2) { $salaryItemId = 39; } elseif ($pt == 5) { $salaryItemId = 639; } $PGIObj->staff_id = $data->sheets[0]['cells'][$i][1]; $PGIObj->salary_item_type_id = $salaryItemId; $PGIObj->approved_amount = $data->sheets[0]['cells'][$i][2]; $PGIObj->comments = $data->sheets[0]['cells'][$i][3]; $PGIObj->list_id = $obj->GetLastID("pay_get_lists", "list_id", " list_type = 1 and cost_center_id =" . $obj->cost_center_id); $PGIObj->list_row_no = $PGIObj->GetLastID("pay_get_list_items", "list_row_no", " list_id =" . $PGIObj->list_id) + 1; if ($PGIObj->Add() == false) { $log_obj->make_unsuccess_rows($PGIObj->staff_id); $unsuccess_count++; } } else { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], " ", "شماره شناسایی نامعتبر است."); $unsuccess_count++; } } $log_obj->finalize(); $st = preg_replace('/\\r\\n/', "", $log_obj->make_result()); echo "{success:true,data:'" . $st . "'}"; die; } elseif ($FileType == MISSION_LIST) { for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) { //for ($j = 0; $j < $data->sheets[0]['numCols']; $j++) //$data->sheets[0]['cells'][$i][$j]; $query = " select p.pfname , p.plname , s.person_type from staff s inner join persons p on s.personid = p.personid\n\t\t\t\t\twhere staff_id =" . $data->sheets[0]['cells'][$i][1]; $result = PdoDataAccess::runquery($query); if ($costId != $data->sheets[0]['cells'][$i][0]) { $obj->list_id = null; $obj->cost_center_id = $data->sheets[0]['cells'][$i][0]; $obj->list_date = DateModules::Now(); $obj->doc_state = 1; $obj->list_type = MISSION_LIST; if ($obj->AddList() === false) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], $result[0]["pfname"] . " " . $result[0]["plname"], " کد مرکز هزینه نامعتبر است."); $unsuccess_count++; continue; } $costId = $obj->cost_center_id; } if (count($result) > 0) { $pt = $result[0]["person_type"]; if ($pt == 1) { $salaryItemId = 42; } elseif ($pt == 2) { $salaryItemId = 43; } elseif ($pt == 3) { $salaryItemId = 10315; } elseif ($pt == 5) { $salaryItemId = 643; } $MissionObj->staff_id = $data->sheets[0]['cells'][$i][1]; $MissionObj->doc_no = $data->sheets[0]['cells'][$i][2]; $MissionObj->doc_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][3]); $MissionObj->from_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][4]); $MissionObj->to_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][5]); $MissionObj->duration = $data->sheets[0]['cells'][$i][6]; $MissionObj->travel_cost = isset($data->sheets[0]['cells'][$i][7]) ? $data->sheets[0]['cells'][$i][7] : ""; $MissionObj->destination = $data->sheets[0]['cells'][$i][8]; $MissionObj->using_facilities = isset($data->sheets[0]['cells'][$i][9]) ? $data->sheets[0]['cells'][$i][9] : ""; // $MissionObj->report_summary = (isset($data->sheets[0]['cells'][$i][11])) ? $data->sheets[0]['cells'][$i][11] : "" ; $MissionObj->comments = isset($data->sheets[0]['cells'][$i][12]) ? $data->sheets[0]['cells'][$i][12] : ""; $MissionObj->region_coef = isset($data->sheets[0]['cells'][$i][10]) ? $data->sheets[0]['cells'][$i][10] : ""; $MissionObj->salary_item_type_id = $salaryItemId; $MissionObj->list_id = $obj->GetLastID("pay_get_lists", "list_id", " list_type = 9 and cost_center_id =" . $obj->cost_center_id); $MissionObj->list_row_no = $MissionObj->GetLastID("mission_list_items", "list_row_no", " list_id =" . $MissionObj->list_id) + 1; if ($MissionObj->Add() == false) { $log_obj->make_unsuccess_rows($MissionObj->staff_id, $result[0]["pfname"] . " " . $result[0]["plname"], "اطلاعات مربوط به این فرد معتبر نمی باشد."); $unsuccess_count++; } } else { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], " ", "شماره شناسایی نامعتبر است."); $unsuccess_count++; } } $log_obj->finalize(); $st = preg_replace('/\\r\\n/', "", $log_obj->make_result()); echo "{success:true,data:'" . $st . "'}"; die; } elseif ($FileType == 11) { //.... محاسبه باقیمانده وامها .......... $Arr = preg_split('/[\\/]/', DateModules::shNow()); $LYear = $Arr[0]; $LMonth = $Arr[1]; manage_subtracts::GetRemainder("", "", "", true, $LMonth, $LYear); //...................................... $pdo = PdoDataAccess::getPdoObject(); $pdo->beginTransaction(); $DB = ""; //echo $data->sheets[0]['numRows'].'----' ; die() ; for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) { $subObj = new manage_subtracts(); $subFlowObj = new manage_subtract_flows(); if (!isset($data->sheets[0]['cells'][$i][1])) { $log_obj->make_unsuccess_rows('-', '-', 'ردیف ' . ($i + 1) . ' معتبر نمی باشد.'); $unsuccess_count++; continue; } // آیا این قلم وجود دارد ؟...................................... $qry = " select salary_item_type_id , available_for\n\t\t\t\t\t\t\tfrom salary_item_types where salary_item_type_id=" . $data->sheets[0]['cells'][$i][1]; $resItem = PdoDataAccess::runquery($qry); //.............................................................. if (isset($resItem[0]['salary_item_type_id']) && $resItem[0]['salary_item_type_id'] > 0) { if (empty($data->sheets[0]['cells'][$i][0])) { $log_obj->make_unsuccess_rows('-', $data->sheets[0]['cells'][$i][1], 'لطفا شماره شناسایی ردیف ' . ($i + 1) . ' را وارد نمایید.'); $unsuccess_count++; continue; } // قلم مربوط به وام نبوده است ............................... if ($data->sheets[0]['cells'][$i][2] == 1 && $resItem[0]['available_for'] != 1) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], " قلم مربوط به وام نمی باشد. "); $unsuccess_count++; continue; } if ($data->sheets[0]['cells'][$i][2] == 2 && !($resItem[0]['available_for'] == 4 || $resItem[0]['available_for'] == 5)) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], " قلم مربوط به کسور نمی باشد. "); $unsuccess_count++; continue; } if ($data->sheets[0]['cells'][$i][2] == 1 && !empty($data->sheets[0]['cells'][$i][6]) && $data->sheets[0]['cells'][$i][6] != 0 && !empty($data->sheets[0]['cells'][$i][5]) && $data->sheets[0]['cells'][$i][5] != 0 && $data->sheets[0]['cells'][$i][6] > $data->sheets[0]['cells'][$i][5]) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], 'قسط وام مورد نظر از مبلغ اوليه آن بزرگتر است.'); $unsuccess_count++; continue; } if (!empty($data->sheets[0]['cells'][$i][8]) && DateModules::GetDateFormat($data->sheets[0]['cells'][$i][7]) > DateModules::GetDateFormat($data->sheets[0]['cells'][$i][8])) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], 'تاريخ پايان بايد بزرگتر و يا مساوي تاريخ شروع باشد.'); $unsuccess_count++; continue; } if (empty($data->sheets[0]['cells'][$i][3])) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], 'نوع وام/کسور مشخص نشده است.'); $unsuccess_count++; continue; } if (!empty($data->sheets[0]['cells'][$i][4])) { $qry = "select bank_id from banks where branch_code=" . $data->sheets[0]['cells'][$i][4]; $resbank = PdoDataAccess::runquery($qry); if (count($resbank) == 0) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], 'کد بانک معتبر نمی باشد.'); $unsuccess_count++; continue; } } $qry = " select staff_id,PersonID from staff where staff_id =" . $data->sheets[0]['cells'][$i][0]; $resStaff = PdoDataAccess::runquery($qry); if (count($resStaff) == 0) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], ' شماره شناسایی معتبر نمی باشد.'); $unsuccess_count++; continue; } //.............................................................................. $Arr2 = preg_split('/[\\/]/', DateModules::GetDateFormat($data->sheets[0]['cells'][$i][7])); $sfd = (int) $Arr2[0] . "/" . (int) $Arr2[1] . "/" . (int) $Arr2[2]; if (!empty($data->sheets[0]['cells'][$i][8])) { $Arr3 = preg_split('/[\\/]/', DateModules::GetDateFormat($data->sheets[0]['cells'][$i][8])); $efd = (int) $Arr3[0] . "/" . (int) $Arr3[1] . "/" . (int) $Arr3[2]; } //........................................................................... $Arr = preg_split('/[\\/]/', DateModules::GetDateFormat($data->sheets[0]['cells'][$i][7])); $sdate = $edate = ''; $start_day = ""; $start_month = (int) $Arr[1]; if ($start_month < 7) { $day = 31; } elseif ($start_month < 12) { $day = 30; } elseif ($start_month == 12) { $day = 29; } $sd = (int) $Arr[0] . "/" . (int) $Arr[1] . "/01"; $ed = (int) $Arr[0] . "/" . (int) $Arr[1] . "/" . $day; $sdate = DateModules::shamsi_to_miladi($sd); $edate = DateModules::shamsi_to_miladi($ed); $PID = $resStaff[0]['PersonID']; //ثبت وام یا کسور جدید.................................................. if ($data->sheets[0]['cells'][$i][3] == 1) { $qry = " select subtract_id, remainder, instalment \n\t\t\t\t\t\t\t\t\tfrom person_subtracts \n\t\t\t\t\t\t\t\t\t\twhere salary_item_type_id = " . $data->sheets[0]['cells'][$i][1] . " and\n\t\t\t\t\t\t\t\t\t\t\t PersonID =" . $PID . " AND IsFinished = 0 and \n\t\t\t\t\t\t\t\t\t\t\t start_date <= '" . str_replace("/", "-", $sdate) . "' and \n\t\t\t\t\t\t\t\t\t\t\t ( end_date >= '" . str_replace("/", "-", $edate) . "' OR end_date IS NULL OR end_date = '0000-00-00' ) "; $res = PdoDataAccess::runquery($qry); if (count($res) > 0 && $res[0]['subtract_id'] > 0) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], "-", "این /کسور قبلا در سیستم ثبت گردیده است."); $unsuccess_count++; continue; } //....................................................... $subObj->PersonID = $PID; $subObj->subtract_type = $data->sheets[0]['cells'][$i][2] == 1 ? LOAN : FIX_FRACTION; $subObj->bank_id = !empty($data->sheets[0]['cells'][$i][4]) ? $resbank[0]['bank_id'] : ""; $subObj->first_value = !empty($data->sheets[0]['cells'][$i][5]) ? $data->sheets[0]['cells'][$i][5] : 0; $subObj->instalment = !empty($data->sheets[0]['cells'][$i][6]) ? $data->sheets[0]['cells'][$i][6] : 0; $subObj->remainder = !empty($data->sheets[0]['cells'][$i][5]) ? $data->sheets[0]['cells'][$i][5] : 0; $subObj->start_date = DateModules::shamsi_to_miladi($sfd); $subObj->end_date = !empty($data->sheets[0]['cells'][$i][8]) ? DateModules::shamsi_to_miladi($efd) : ""; $subObj->loan_no = !empty($data->sheets[0]['cells'][$i][9]) ? $data->sheets[0]['cells'][$i][9] : ""; $subObj->contract_no = !empty($data->sheets[0]['cells'][$i][10]) ? $data->sheets[0]['cells'][$i][10] : ""; $subObj->salary_item_type_id = $data->sheets[0]['cells'][$i][1]; $subObj->reg_date = DateModules::NowDateTime(); //Isfinished = 0 ; if ($subObj->Add() === false) { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], "-", " خطا "); $unsuccess_count++; continue; } } // ثبت گردش ................................................... if ($data->sheets[0]['cells'][$i][3] == 2) { $qry = " select psf.subtract_id \n\t\t\t\t\t\t\t\t\tfrom person_subtracts ps inner join person_subtract_flows psf \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton ps.subtract_id = psf.subtract_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\twhere ps.salary_item_type_id = " . $data->sheets[0]['cells'][$i][1] . " and\n\t\t\t\t\t\t\t\t\t\t\t ps.PersonID =" . $PID . " and \n\t\t\t\t\t\t\t\t\t\t\t psf.flow_date >= '" . str_replace("/", "-", $sdate) . "' and \n\t\t\t\t\t\t\t\t\t\t\t psf.flow_date <= '" . str_replace("/", "-", $edate) . "'"; $res = PdoDataAccess::runquery($qry); if (count($res) > 0 && $res[0]['subtract_id'] > 0) { //echo PdoDataAccess::GetLatestQueryString() ; die(); $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], "-", " این گردش قبلا در سیستم ثبت گردیده است."); $unsuccess_count++; continue; } //................................................................. $qry = " select ps.subtract_id, ts.remainder, ps.instalment \n\t\t\t\t\t\t\t\t\tfrom person_subtracts ps left join tmp_SubtractRemainders ts \n\t\t\t\t\t\t\t\t\t on ps.subtract_id = ts.subtract_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\twhere ps.salary_item_type_id = " . $data->sheets[0]['cells'][$i][1] . " and\n\t\t\t\t\t\t\t\t\t\t\t ps.PersonID =" . $PID . " AND ps.IsFinished = 0 AND ps.start_date <= '" . str_replace("/", "-", $sdate) . "' AND \n\t\t\t\t\t\t\t\t\t\t\t( ps.end_date >= '" . str_replace("/", "-", $edate) . "' OR ps.end_date IS NULL OR ps.end_date = '0000-00-00' ) "; $res = PdoDataAccess::runquery($qry); // echo PdoDataAccess::GetLatestQueryString() ; if (count($res) > 0 && $res[0]['subtract_id'] > 0) { $new_remainder = $new_instalment = 0; if ($data->sheets[0]['cells'][$i][2] == 1) { $subFlowObj->subtract_id = $res[0]['subtract_id']; $subFlowObj->flow_type = REGISTER_NEW_FLOW_TYPE; $subFlowObj->flow_date = DateModules::NowDateTime(); $subFlowObj->flow_coaf = !empty($data->sheets[0]['cells'][$i][5]) && $data->sheets[0]['cells'][$i][5] * 1 > $res[0]['remainder'] * 1 ? -1 : 1; $subFlowObj->amount = !empty($data->sheets[0]['cells'][$i][5]) && $data->sheets[0]['cells'][$i][5] * 1 > $res[0]['remainder'] * 1 ? $data->sheets[0]['cells'][$i][5] * 1 - $res[0]['remainder'] * 1 : $res[0]['remainder'] * 1 - $data->sheets[0]['cells'][$i][5] * 1; $subFlowObj->newRemainder = !empty($data->sheets[0]['cells'][$i][5]) ? $data->sheets[0]['cells'][$i][5] : 0; $subFlowObj->comments = "گردش دستی"; if ($subFlowObj->Add() == false) { $log_obj->make_unsuccess_rows($subObj->staff_id); $unsuccess_count++; continue; } else { $new_remainder = !empty($data->sheets[0]['cells'][$i][5]) ? $data->sheets[0]['cells'][$i][5] : 0; $new_instalment = !empty($data->sheets[0]['cells'][$i][6]) ? $data->sheets[0]['cells'][$i][6] : 0; $qry = " update person_subtracts \n\t\t\t\t\t\t\t\t\t\t\tset\t\tremainder = " . $new_remainder . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinstalment = " . $new_instalment . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\treg_date = '" . DateModules::NowDateTime() . "'\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\twhere subtract_id =" . $subFlowObj->subtract_id; PdoDataAccess::runquery($qry); } } else { //echo "*****"; die() ; $new_instalment = !empty($data->sheets[0]['cells'][$i][6]) ? $data->sheets[0]['cells'][$i][6] : 0; $qry = " update person_subtracts \n\t\t\t\t\t\t\t\t\t\tset\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tinstalment = " . $new_instalment . ",\n\t\t\t\t\t\t\t\t\t\t\t\treg_date = '" . DateModules::NowDateTime() . "'\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\twhere subtract_id =" . $res[0]['subtract_id']; PdoDataAccess::runquery($qry); } } else { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], "این وام / کسور ثبت سیستم نشده است."); $unsuccess_count++; continue; } } } else { $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][0], $data->sheets[0]['cells'][$i][1], "کد قلم معتبر نمی باشد."); $unsuccess_count++; continue; } } $log_obj->finalize(); $st = preg_replace('/\\r\\n/', "", $log_obj->make_result()); if ($unsuccess_count > 0) { $pdo->rollBack(); } else { $pdo->commit(); } echo "{success:true,data:'" . $st . "'}"; die; } }
header('Pragma: public'); echo file_get_contents("../../../HRProcess/"."DSKWOR".$res[0]['cost_center_id'].'.DBF'); */ die() ; } elseif( $_REQUEST["task"] == 'ShowList' ) { echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">'; echo "<center><table style='border:0px groove #9BB1CD;border-collapse:collapse;width:90%'><tr> <td width=60px><img src='/HumanResources/img/fum_symbol.jpg'></td> <td align='center' style='font-family:b titr;font-size:15px'>گزارش لیست بیمه"." </td> <td width='200px' align='center' style='font-family:tahoma;font-size:11px'>تاریخ تهیه گزارش : " . DateModules::shNow() . "<br>"; echo "</td></tr></table>"; echo '<table class="reportGenerator" style="text-align: right;width:90%!important" cellpadding="4" cellspacing="0"> <tr class="header1"> <td colspan="24">صورت دستمزد/حقوق ومزایای '. $monthTitle.' '.$_POST['pay_year'].'</td> </tr> <tr class="header1"> <td colspan="4" >شماره کارگاه : '.$res[0]['daily_work_place_no'].'</td> <td colspan="4">نام گارگاه : '.$res[0]['detective_name'].'</td> <td colspan="5">نام کارفرما : '.$res[0]['employer_name'].'</td> <td colspan="6">نشانی کارگاه : '.$res[0]['detective_address'].'</td> <td colspan="5">شعبه تامین اجتماعی : '.$res[0]['collective_security_branch'].'</td> </tr> <tr class="header"> <td rowspan="2">ردیف </td>
function ShowReport(){ global $tableQuery; $rpt = new ReportGenerator(); $rpt->mysql_resource = PrepareData(); ?> <html> <head> <META http-equiv=Content-Type content="text/html; charset=UTF-8" > </head> <body dir=rtl> <div style="display:none" > <? echo $tableQuery . "\n----------------------------------------------------\n";?> <? echo PdoDataAccess::GetLatestQueryString();?> </div> <? function moneyRender($row,$value){ return number_format($value, 0, '.', ','); } function pure_paymentRender($row){ return moneyRender(null,$row["pure_payment"]) . "<br>" . moneyRender(null,$row["diff_pure_payment"]); } function continus_paymentRender($row){ return moneyRender(null,$row["continus_payment"]) . "<br>" . moneyRender(null,$row["diff_continus_payment"]); } function totalRender($row){ return moneyRender(null, $row["normal_insure"] + $row["normal2_insure"] + $row["first_surplus_insure"] + $row["second_surplus_insure"]); } function insure_valueRender($row){ return moneyRender(null,$row["insure_value"]) . "<br>" . moneyRender(null,$row["diff_insure_value"]); } function org_insure_valueRender($row){ return moneyRender(null,$row["org_insure_value"]) . "<br>" . moneyRender(null,$row["diff_org_insure_value"]); } $rpt->addColumn("شماره<br> شناسایی", "staff_id"); $rpt->addColumn("نام خانوادگي", "plname"); $rpt->addColumn("نام", "pfname"); $rpt->addColumn("خالص دريافتي <br>تفاوت", "pure_payment", "pure_paymentRender"); $rpt->addColumn("مستمر<br>تفاوت", "continus_payment", "continus_paymentRender"); $rpt->addColumn("کل", "normal_insure", "totalRender"); $rpt->addColumn("مازاد2", "second_surplus_insure"); $rpt->addColumn("مازاد1", "first_surplus_insure"); $rpt->addColumn("معمولي2", "normal2_insure"); $rpt->addColumn("معمولي", "normal_insure"); $rpt->addColumn("مبلغ بيمه<br>تفاوت", "insure_value", "insure_valueRender"); $rpt->addColumn("سهم سازمان<br>تفاوت", "org_insure_value", "org_insure_valueRender"); $rpt->header_alignment = "center"; $rpt->headerContent = " <table width=100% border=0 style='font-family:b nazanin;'> <tr> <td width=120px><img src='/HumanResources/img/fum_symbol.jpg'></td> <td align=center style='font-weight:bold'>گزارش کارمندان استفاده کننده از بيمه</td> <td width=120px> شماره : <br> تاریخ : " . DateModules::shNow() . " </td> </tr> <tr bgcolor='#BDD3EF' > <td colspan=3 style='border: 1px solid black;font-weight:bold;color:#15428B;padding-right:5px'> " . DateModules::GetMonthName($_POST["pay_month"]) . " ماه " . $_POST["pay_year"] . " </td> </tr> </table>"; $rpt->page_size = 30; $rpt->paging = true; $rpt->generateReport(); die(); ?> </body> </html> <? }
.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} .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> <body> <center> <table width="50%" cellpadding="0" cellspacing="0"> <tr> <td width="20%"><img src="/HumanResources/img/fum_symbol.jpg" ></td> <td align="center" style="font-family:'b titr'">گزارش افرادی که ترفیع نگرفته اند</td> <td width="20%" align="left" style="font-family:tahoma;font-size:8pt">تاریخ : <?= DateModules::shNow() ?></td> </tr> </table> <table style="text-align: right;" class="reportGenerator" cellpadding="4" cellspacing="0" > <tr class="header"> <td width="10%">ردیف</td> <td width="20%">شماره شناسایی</td> <td width="25%">نام خانوادگی</td> <td width="15%">نام</td> <td width="20%">مرتبه علمی</td> <td width="10%">پایه</td> </tr> </table> <table style="text-align: right;" class="reportGenerator" cellpadding="4" cellspacing="0" > <? for($i=0 ; $i<count($res);$i++)
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; } }