本文整理汇总了PHP中DateModules::day_to_ymd方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::day_to_ymd方法的具体用法?PHP DateModules::day_to_ymd怎么用?PHP DateModules::day_to_ymd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateModules
的用法示例。
在下文中一共展示了DateModules::day_to_ymd方法的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: AddPerson
function AddPerson($staffObject, $pic = "")
{
$pdo = PdoDataAccess::getPdoObject();
if ($pdo->beginTransaction()) {
if ($this->military_from_date != NULL || $this->military_from_date != '0000-00-00') {
$Vyear = 0;
$Vmonth = $Vday = 0;
$resDay = DateModules::GDateMinusGDate($this->military_to_date, $this->military_from_date);
DateModules::day_to_ymd($resDay, $Vyear, $Vmonth, $Vday);
$mm = $Vyear * 12 + $Vmonth;
$dd = $Vday;
$this->military_duration = $mm;
$this->military_duration_day = $dd;
}
if (parent::insert("HRM_persons", $this, $pdo) === false) {
parent::PushException(ER_PERSON_DONT_SAVE);
$pdo->rollBack();
return false;
}
$this->PersonID = parent::InsertID();
$staffObject->PersonID = $this->PersonID;
$staffObject->person_type = $this->person_type;
$return = $staffObject->AddStaff($pdo);
if (!$return) {
parent::PushException(ER_PERSON_DONT_SAVE);
$pdo->rollBack();
return false;
}
if ($return) {
$pdo->commit();
}
$daObj = new DataAudit();
$daObj->ActionType = DataAudit::Action_add;
$daObj->MainObjectID = $this->PersonID;
$daObj->TableName = "HRM_persons";
$daObj->execute();
return true;
} else {
return false;
}
}
示例4: 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;
}
示例5: PrintWrit
//.........这里部分代码省略.........
}
}
}
}
}
$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) {
$writ_rec['marital_status_title'] = 'متاهل';
}
}
$tags = array('<!--personel_no-->' => !empty($listPNO) && count($listPNO) > 1 ? $listPNO[1] . "-" . $listPNO[0] : $writ_rec['personel_no'], '<!--national_code-->' => $writ_rec['national_code'], '<!--ps_pfname-->' => $writ_rec['ps_pfname'], '<!--ps_plname-->' => $writ_rec['ps_plname'], '<!--ps_father_name-->' => $writ_rec['ps_father_name'], '<!--ps_idcard_no-->' => $writ_rec['ps_idcard_no'], '<!--si_ptitle-->' => $writ_rec['si_ptitle'], '<!--ci_ptitle-->' => $writ_rec['ci_ptitle'], '<!--issue_place-->' => $writ_rec['issue_place'], '<!--cb_ptitle-->' => $writ_rec['cb_ptitle'], '<!--ps_birth_place-->' => $writ_rec['ps_birth_place'], '<!--ps_birth_date-->' => DateModules::miladi_to_shamsi($writ_rec['ps_birth_date']), '<!--education_level_title-->' => $education_level_title, '<!--sf_ptitle-->' => $writ_rec['sf_ptitle'], '<!--sbs_title-->' => $writ_rec['sbs_title'], '<!--p_post_no-->' => $writ_rec['p_post_no'], '<!--jc_title-->' => $writ_rec['jc_title'], '<!--jf_title-->' => $writ_rec['jf_title'], '<!--grup-->' => $grup, '<!--E_base-->' => $writ_rec['E_base'], '<!--S_base-->' => $writ_rec['S_base'], '<!--T_base-->' => $writ_rec['T_base'], '<!--I_base-->' => $writ_rec['I_base'], '<!--Total_base-->' => $writ_rec['E_base'] + $writ_rec['S_base'] + $writ_rec['T_base'] + $writ_rec['I_base'], '<!--grade-->' => $GradeTitle, '<!--cur_group-->' => $current_group, '<!--post_title-->' => $post_title, '<!--onduty-->' => $onduty, '<!--sw_ptitle-->' => $writ_rec['sw_ptitle'], '<!--cw_ptitle-->' => $writ_rec['cw_ptitle'], '<!--sit2_annual_inc_coef-->' => $sit2_annual_inc_coef, '<!--marital_status_title-->' => $writ_rec['marital_status'] == 3 ? 'مجرد' : $writ_rec['marital_status_title'], '<!--included_children_count-->' => $writ_rec['sex'] == 1 || $writ_rec['family_responsible'] == 1 ? $writ_rec['included_children_count'] : $writ_rec['children_count'], '<!--contract_start_date-->' => DateModules::miladi_to_shamsi($writ_rec['contract_start_date']), '<!--contract_end_date-->' => DateModules::miladi_to_shamsi($writ_rec['contract_end_date']), '<!--ref_letter_no-->' => $writ_rec['ref_letter_no'], '<!--ref_letter_date-->' => DateModules::miladi_to_shamsi($writ_rec['ref_letter_date']), '<!--writ_type-->' => $writ_rec['writ_type'], '<!--description-->' => nl2br($writ_rec['description']), '<!--sum-->' => CurrencyModulesclass::toCurrency($sum), '<!--sum_str-->' => CurrencyModulesclass::CurrencyToString($sum), '<!--writ_signature_post_owner-->' => $writ_rec['writ_signature_post_owner'], '<!--writ_signature_post_title-->' => $writ_rec['writ_signature_post_title'], '<!--execute_date-->' => DateModules::miladi_to_shamsi($writ_rec['execute_date']), '<!--send_letter_no-->' => $writ_rec['send_letter_no'], '<!--issue_date-->' => DateModules::miladi_to_shamsi($writ_rec['issue_date']), '<!--ref_letter_no-->' => $writ_rec['ref_letter_no'], '<!--ref_letter_date-->' => DateModules::miladi_to_shamsi($writ_rec['ref_letter_date']), '<!--SALARY_ITEMS-->' => $salary_items, '<!--org_unit_title-->' => $org_unit_title, '<!--devotion_type-->' => $devotion_type, '<!--o_ptitle-->' => $writ_rec['ou_ptitle'], '<!--military-->' => $writ_rec['military'], '<!--MilitaryD-->' => $MilitaryD, '<!--sf_title-->' => $writ_rec['sf_title'], '<!--sbs_title-->' => $writ_rec['sbs_title'], '<!--snc_level-->' => $writ_rec['snc_level'], '<!--edu_c_ptitle-->' => $edu_c_ptitle, '<!--edu_u_ptitle-->' => $edu_u_ptitle, '<!--edu_doc_date-->' => $edu_doc_date, '<!--base-->' => $writ_rec['base'], '<!--worktime-->' => $writ_rec['worktime'], '<!--emp_st-->' => $writ_rec['person_type'] == 2 && ($writ_rec['emp_st'] == 3 || $writ_rec['emp_st'] == 4) ? str_replace('رسمی قطعی', 'رسمي', $writ_rec['emp_st']) : $writ_rec['emp_st'], '<!--org_sub_unit_type-->' => $org_sub_unit_type, '<!--os_ptitle-->' => $os_ptitle, '<!--full_title-->' => $full_title, '<!--gnd-->' => $writ_rec['gnd'] == "1" ? "مرد" : "زن", '<!--professor_post_type-->' => $professor_post_type, '<!--writ_title-->' => $writ_title, '<!--wst_title-->' => $writ_rec['wst_title'], '<!--staff_id-->' => $writ_rec['staff_id'], '<!--work_start_date-->' => DateModules::miladi_to_shamsi($writ_rec['work_start_date']), '<!--job_id-->' => $writ_rec['job_id'], '<!--j_title-->' => $writ_rec['j_title'], '<!--job_group-->' => $writ_rec['job_group'], '<!--contact_title-->' => $contact_title, '<!--worker_salary_item1_title-->' => $worker_salary_item1_title, '<!--worker_salary_item1_value-->' => $worker_salary_item1_value, '<!--worker_salary_item2_title-->' => $worker_salary_item2_title, '<!--worker_salary_item2_value-->' => $worker_salary_item2_value, '<!--WORKER_OTHER_SALARY_ITEMS-->' => $worker_other_salary_items, '<--worker_base_salary-->' => $worker_base_salary, '<!--sisIMAGEPATH-->' => "", '<!--exe_date_title-->' => $exe_date_title, '<!--notes-->' => $writ_rec["notes"], '<!--military_from_date-->' => DateModules::miladi_to_shamsi($writ_rec["military_from_date"]), '<!--military_to_date-->' => DateModules::miladi_to_shamsi($writ_rec["military_to_date"]), '<cr>' => '', '</cr>' => '', '<ncr>' => '', '</ncr>' => '', '<tlm>' => '', '</tlm>' => '', '<ntlm>' => '', '</ntlm>' => '', '<sts>' => '', '</nsts>' => '', '<cnt>' => '', '</cnt>' => '', '<ncnt>' => '', '</ncnt>' => '');
if (is_array($emp_sal_items)) {