本文整理汇总了PHP中DateModules::ymd_to_days方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::ymd_to_days方法的具体用法?PHP DateModules::ymd_to_days怎么用?PHP DateModules::ymd_to_days使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateModules
的用法示例。
在下文中一共展示了DateModules::ymd_to_days方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duty_year_month_day
function duty_year_month_day($staff_id = "", $personID = "", $toDate) {
if ($staff_id == "" && $personID = "") {
PdoDataAccess::PushException("يکي از دو پارامتر staff_id و PersonID بايد فرستاده شود");
return false;
}
$query = "select w.execute_date,
w.contract_start_date ,
w.contract_end_date ,
w.person_type ,
w.onduty_year ,
w.onduty_month ,
w.onduty_day ,
w.annual_effect
from writs as w";
if ($personID != "")
$query .= " join staff as s using(staff_id) where s.PersonID=" . $personID;
else if ($staff_id != "")
$query .= " where w.staff_id = $staff_id";
$query .= " AND (w.history_only != " . HISTORY_ONLY . " OR w.history_only is null) AND w.execute_date <= '$toDate'
order by w.execute_date DESC,w.writ_id DESC,w.writ_ver DESC
limit 1";
$temp = PdoDataAccess::runquery($query);
if (count($temp) == 0)
return array("year" => 0, "month" => 0, "day" => 0);
$writ_rec = $temp[0];
$temp_duration = 0;
if (DateModules::CompareDate($toDate, $writ_rec['execute_date']) >= 0)
$temp_duration = DateModules::GDateMinusGDate($toDate, $writ_rec['execute_date']);
if ($writ_rec['annual_effect'] == HALF_COMPUTED)
$temp_duration *= 0.5;
else if ($writ_rec['annual_effect'] == DOUBLE_COMPUTED)
$temp_duration *= 2;
else if ($writ_rec['annual_effect'] == NOT_COMPUTED)
$temp_duration = 0;
$prev_writ_duration = DateModules::ymd_to_days($writ_rec['onduty_year'], $writ_rec['onduty_month'], $writ_rec['onduty_day']);
$duration = $prev_writ_duration + $temp_duration;
$return = array();
DateModules::day_to_ymd($duration, $return['year'], $return['month'], $return['day']);
return $return;
}
示例2: saveData
function saveData()
{
//........ Fill object ..............
$obj = new manage_writ($_POST['writ_id'], $_POST['writ_ver'], $_POST['staff_id']);
PdoDataAccess::FillObjectByArray($obj, $_POST);
$obj->family_responsible = isset($_POST['family_responsible']) ? $_POST['family_responsible'] : 0;
$obj->history_only = isset($_POST['history_only']) ? $_POST['history_only'] : 0;
$obj->remembered = isset($_POST['remembered']) ? $_POST['remembered'] : 0;
$obj->dont_transfer = isset($_POST['dont_transfer']) ? $_POST['dont_transfer'] : 0;
//.............. محاسبه مجدد پایه سنواتی فرد ..................
$Pqry = " select sex , p.person_type ,military_duration_day , military_duration\n\t\t\t\tfrom persons p inner join staff s \n\t\t\t\t\t\t\t\t\ton p.PersonID = s.PersonID \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t where s.staff_id = " . $obj->staff_id;
$Pres = PdoDataAccess::runquery($Pqry);
if ($obj->person_type == 2 || $obj->person_type == 5) {
if ($Pres[0]["sex"] == 1 && $Pres[0]["person_type"] == 2 && ($Pres[0]["military_duration_day"] > 0 || $Pres[0]["military_duration"] > 0)) {
$totalDayWrt = DateModules::ymd_to_days($obj->onduty_year, $obj->onduty_month, $obj->onduty_day);
$totalDaySar = DateModules::ymd_to_days(0, $Pres[0]["military_duration"], $Pres[0]["military_duration_day"]);
$resDay = $totalDayWrt - $totalDaySar;
$Vyear = 0;
$Vmonth = $Vday = 0;
DateModules::day_to_ymd($resDay, $Vyear, $Vmonth, $Vday);
$Vyear = $Vyear;
} else {
$Vyear = $obj->onduty_year;
}
$obj->base = $Vyear + 1;
}
//............................................................
/*$arr = get_object_vars($obj);
$KeyArr = array_keys($arr);
for($i=0; $i<count($arr); $i++)
{
eval("if(isset(\$_POST['" . $KeyArr[$i] . "']))
\$obj->" . $KeyArr[$i] . "= \$_POST ['" . $KeyArr[$i] . "'];");
}
$obj->staff_id = $_POST['staff_id'];
$obj->writ_id = $_POST['writ_id'];
$obj->writ_ver = $_POST['writ_ver'];
$obj->sbid = (empty($obj->sbid)) ? PDONULL : $obj->sbid;
$obj->issue_date = DateModules::Shamsi_to_Miladi($obj->issue_date);
$obj->pay_date = DateModules::Shamsi_to_Miladi($obj->pay_date);
$obj->ref_letter_date = DateModules::Shamsi_to_Miladi($obj->ref_letter_date);
$obj->send_letter_date = DateModules::Shamsi_to_Miladi($obj->send_letter_date);
$obj->warning_date = DateModules::Shamsi_to_Miladi($obj->warning_date);
$obj->remembered = (isset($_POST['remembered'])) ? $_POST['remembered'] : "0" ;*/
//....................................
if ($obj->check_send_letter_no() === false) {
Response::createObjectiveResponse(false, ExceptionHandler::ConvertExceptionsToJsObject());
die;
}
if (!$obj->EditWrit()) {
Response::createObjectiveResponse(false, ExceptionHandler::ConvertExceptionsToJsObject());
die;
}
Response::createObjectiveResponse(true, "{WID:" . $obj->writ_id . "}");
//echo Response::createObjectiveResponse("true", $obj->writ_id);
die;
}
示例3: compute_salary_item2_60
private function compute_salary_item2_60($writ_rec) {
//param1 : ضریب حقوقی
//param2 : عدد مبنا
//param3 : پایه
//param4 : ضریب مدرک تحصیلی
//param5 : رتبه
//param6 : مدرک تحصیلی
//param7 : ضریب مقدار برای مدارک دیپلم و زیر دیپلم
//param8 : پایه استحقاقی
// دارندگان مدرک دیپلم و زیر دیپلم
$coafOfDiplom = 1;
$this->param6 = self::GetEducLevel($writ_rec);
$this->param5 = self::GetGrade($writ_rec,$this->param6);
//...................................
if($this->param6 == '1' || ($writ_rec["education_level"] < 122 && $writ_rec["education_level"] != 117 ) ) // زیر دیپلم
{
$coafOfDiplom = 0.8;
}
elseif($this->param6 == '2') // دیپلم
{
$coafOfDiplom = 0.9;
}
if($this->param6 == 1 || $this->param6 == 2 ) {
$this->param6 = 3 ;
}
$this->param1 = manage_salary_params::get_salaryParam_value("", $writ_rec["sp_person_type"],
SPT_RIAL_COEF, $writ_rec['execute_date']);
$this->param7 = $coafOfDiplom;
$this->param2 = manage_salary_params::get_salaryParam_value("", $writ_rec["sp_person_type"],
SPT_BASE_GRADE, $writ_rec['execute_date'], $this->param5, $this->param6);
//.................
$qry = " select sum(if(ba.BaseType in (6) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0)) TashvighiValue ,
sum(if(ba.BaseType in (3,4,5) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0)) IsarValue ,
sum(if(ba.BaseType in (1,2,7,20,21,22,23,24,25,26,27 ) and ba.BaseStatus = 'NORMAL' ,ba.BaseValue,0)) OtherBase
from bases ba
where ba.PersonID =".$writ_rec['PersonID']." AND ExecuteDate <= '".$writ_rec['execute_date']."'" ;
$baseRes = parent::runquery($qry) ;
//.................
$otherPoint = (($baseRes[0]["TashvighiValue"] + $baseRes[0]["OtherBase"]) > 7) ? 7 : ($baseRes[0]["TashvighiValue"] + $baseRes[0]["OtherBase"]) ;
if($writ_rec["sex"] == 1 && $writ_rec["person_type"] == 2 && ($writ_rec["military_duration_day"] > 0 || $writ_rec["military_duration"] > 0 ) )
{
$totalDayWrt = DateModules::ymd_to_days($writ_rec["onduty_year"], $writ_rec["onduty_month"], $writ_rec["onduty_day"]) ;
$totalDaySar = DateModules::ymd_to_days(0, $writ_rec["military_duration"], $writ_rec["military_duration_day"]) ;
$resDay = $totalDayWrt - $totalDaySar ;
$Vyear = 0 ;
$Vmonth = $Vday = 0 ;
DateModules::day_to_ymd($resDay, $Vyear, $Vmonth, $Vday) ;
$Vyear = $Vyear ;
//echo $Vyear." ---- ".$baseRes[0]["IsarValue"]."--isa---".$otherPoint ; die() ;
}
else
$Vyear = $writ_rec["onduty_year"] ;
//if($_SESSION['UserID'] == 'jafarkhani') { echo $Vyear .'---' ; die(); }
// به اضافه یک می شود با توجه به تبصره 8 آیین نامه
$this->param8 = /*($writ_rec['execute_date'] > '2014-03-21' && $writ_rec['base'] > 0 ) ? $writ_rec['base'] :*/ ($Vyear + 1 );
$this->param3 = /*$writ_rec["base"] $Vyear + 1 */ $this->param8 + $baseRes[0]["IsarValue"] + $otherPoint ;
$this->param4 = manage_salary_params::get_salaryParam_value("", $writ_rec["sp_person_type"],
SPT_EDULEVEL_COAF, $writ_rec['execute_date'], $this->param6);
$value = $coafOfDiplom * ($this->param1 * ($this->param2 + ($this->param3 * $this->param4)));
return $value;
}
示例4: floor
$total_year += floor($Mrow[0]["military_duration"] / 12);
$total_month += $Mrow[0]["military_duration"] - floor($Mrow[0]["military_duration"] / 12) * 12;
$total_day += 0;
}
//.......................... سابقه کاری ......................
require_once "../../../personal/persons/class/employment.class.php";
$temp = manage_person_employment::GetAllEmp("PersonID=" . $res[$i]['PersonID']);
for ($k = 0; $k < count($temp); $k++) {
if ($temp[$k]["retired_duration_year"] != 0 || $temp[$k]["retired_duration_month"] != 0 || $temp[$k]["retired_duration_day"] != 0) {
$total_year += $temp[$k]["retired_duration_year"];
$total_month += $temp[$k]["retired_duration_month"];
$total_day += $temp[$k]["retired_duration_day"];
}
}
//..........................................................
$TotalDay = DateModules::ymd_to_days($total_year, $total_month, $total_day);
//DateModules::day_to_ymd($TotalDay, $Tyear, $Tmonth, $Tday);
//................ ذخیره مقدارنهایی
$query = " insert into YearRedemption (PersonID,duration,value,year,writ_id,writ_ver) values \n\t\t\t (" . $res[$i]['PersonID'] . "," . round($TotalDay / 360, 2) . "," . $res[$i]['sv'] . " ," . $_REQUEST['pay_year'] . "," . $res2[$j - 1]['writ_id'] . "," . $res2[$j - 1]['writ_ver'] . "); ";
}
PdoDataAccess::runquery($query);
//.....................................................................
$qry = " select duration , value from YearRedemption\n\t\t\t where PersonID = " . $res[$i]['PersonID'] . " and year = " . ($_REQUEST['pay_year'] - 1);
$res3 = PdoDataAccess::runquery($qry);
$prev_Years = 0;
$prev_Years = !empty($res3[0]['duration']) ? $res3[0]['duration'] * $res3[0]['value'] : 0;
$currentYear = round($TotalDay / 360, 2) * $res[$i]['sv'] - $prev_Years;
$tempArr[$i]['AccUnitID'] = $res2[$cn]['person_type'] != 1 ? $res2[$cn]['AccUnitID'] : $res2[$j - 1]['AccUnitID'];
$tempArr[$i]['person_type'] = $res2[$cn]['person_type'] != 1 ? $res2[$cn]['person_type'] : $res2[$j - 1]['person_type'];
$tempArr[$i]['PersonID'] = $res[$i]['PersonID'];
$tempArr[$i]['amount'] = $currentYear;
示例5: PrintWrit
//.........这里部分代码省略.........
if ($scores[$indx][4] == $s) {
$grade = 'خبره';
} else {
if ($scores[$indx][5] == $s) {
$grade = 'عالی';
}
}
}
}
}
$current_group = $grade;
$grup = $writ_rec['new_grup'];
} else {
$grup = $writ_rec['old_grup'];
}
$listPNO = "";
if ($writ_rec['personel_no'] != NULL && $writ_rec['person_type'] == 1) {
$listPNO = preg_split('/-/', $writ_rec['personel_no']);
}
/*****************************************************/
$MilitaryD = "";
if ($writ_rec['militaryID'] != 17) {
$MilitaryD = " <militaryDate> شروع : <span><!--military_from_date--></span>\n پایان: <span><!--military_to_date--></span></militaryDate>\n\t\t";
}
if ($writ_rec['E_base'] == NULL && ($writ_rec['person_type'] == HR_EMPLOYEE || $writ_rec['person_type'] == HR_CONTRACT)) {
$qry = " SELECT w.staff_id,\n\t\t\t\t\t\t\t SUBSTRING_INDEX(SUBSTRING(max(CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver)),11),'.',1) writ_id,\n\t\t\t\t\t\t\t\t\t\tSUBSTRING_INDEX(max(CONCAT(w.execute_date,w.writ_id,'.',w.writ_ver)),'.',-1) writ_ver\n\n\t\t\t\t\t FROM writs w\n\t\t\t\t\t\t\tINNER JOIN staff ls\n\t\t\t\t\t\t\t\tON(w.staff_id = ls.staff_id)\n\t\t\t\t\t\t\tINNER JOIN writ_salary_items wsi\n\t\t\t\t\t\t\t\t\t\tON w.staff_id = wsi.staff_id AND w.writ_id = wsi.writ_id AND\n\t\t\t\t\t\t\t\t\t\t\tw.writ_ver = wsi.writ_ver AND salary_item_type_id = 10364\n\n\t\t\t\t\t WHERE w.staff_id = " . $writ_rec['staff_id'];
$tmp2 = PdoDataAccess::runquery($qry);
$qry = " select wsi.param8\n\t\t\t\t\t\tfrom writ_salary_items wsi\n\t\t\t\t\t\t\t\t\t\t \n where wsi.staff_id =" . $writ_rec['staff_id'] . " AND wsi.writ_id = " . $tmp2[0]['writ_id'] . " AND \n\t\t\t\t\t\t\t wsi.writ_ver =" . $tmp2[0]['writ_ver'] . " AND wsi.salary_item_type_id = 10364 ";
$tmp = PdoDataAccess::runquery($qry);
$writ_rec['E_base'] = !empty($tmp[0]['param8']) ? $tmp[0]['param8'] : 0;
}
if ($writ_rec['E_base'] == NULL || $writ_rec['E_base'] == 0) {
if ($writ_rec["sex"] == 1 && $writ_rec["person_type"] == 2 && ($writ_rec["military_duration_day"] > 0 || $writ_rec["military_duration"] > 0)) {
$totalDayWrt = DateModules::ymd_to_days($writ_rec["onduty_year"], $writ_rec["onduty_month"], $writ_rec["onduty_day"]);
$totalDaySar = DateModules::ymd_to_days(0, $writ_rec["military_duration"], $writ_rec["military_duration_day"]);
$resDay = $totalDayWrt - $totalDaySar;
$Vyear = 0;
$Vmonth = $Vday = 0;
DateModules::day_to_ymd($resDay, $Vyear, $Vmonth, $Vday);
$writ_rec['E_base'] = $Vyear;
//echo $Vyear." ---- ".$baseRes[0]["IsarValue"]."--isa---".$otherPoint ; die() ;
} else {
$writ_rec['E_base'] = $writ_rec["onduty_year"];
}
}
if ($writ_rec['ComputeGrade'] == NULL && ($writ_rec['person_type'] == HR_EMPLOYEE || $writ_rec['person_type'] == HR_CONTRACT)) {
$qry = " select wsi.param5 ComputeGrade\n\t\t\t\t\t\tfrom writs w inner join writ_salary_items wsi\n\t\t\t\t\t\t\t\t\t\t\ton w.staff_id = wsi.staff_id and\n\t\t\t\t\t\t\t\t\t\t\t\tw.writ_id = wsi.writ_id and\n\t\t\t\t\t\t\t\t\t\t\t\tw.writ_ver = wsi.writ_ver and wsi.salary_item_type_id = 10364\n\n\t\t\t\t\t\t\t\t\t\twhere w.staff_id = " . $writ_rec["staff_id"] . " and \n w.corrective_writ_id = " . $writ_rec["writ_id"] . " and\n\t\t\t\t\t\t\t\t\t\t\tw.corrective_writ_ver = " . $writ_rec["writ_ver"] . "\n\n\t\t\t\t\torder by w.writ_id , w.writ_id\n\n\t\t\t\t\tlimit 1";
$tmp2 = PdoDataAccess::runquery($qry);
$writ_rec['ComputeGrade'] = !empty($tmp2[0]['ComputeGrade']) ? $tmp2[0]['ComputeGrade'] : 0;
}
$GradeTitle = "";
if ($writ_rec['ComputeGrade'] == 1) {
$GradeTitle = "مقدماتی";
} elseif ($writ_rec['ComputeGrade'] == 2) {
$GradeTitle = "مهارتی";
} elseif ($writ_rec['ComputeGrade'] == 3) {
$GradeTitle = "3";
} elseif ($writ_rec['ComputeGrade'] == 4) {
$GradeTitle = "2";
} elseif ($writ_rec['ComputeGrade'] == 5) {
$GradeTitle = "1";
}
if ($writ_rec['marital_status'] == 3) {
$writ_rec['marital_status_title'] = 'مجرد';
} else {
if ($writ_rec['marital_status'] == 4) {