}else
{
$from_time="09:00";
$to_time="18:00";
}
$start_date=get_var("start_date_1");
$end_date=get_var("end_date_1");
$sub_para[] = array(
"type_id" => $leave_type,
"start_date_1" => $start_date,
"start_time_1" => $from_time,
"end_date_1" => $end_date,
"end_time_1" => $to_time,
"sub_total_days_1" => get_var("total_days"),
);
// print_r($sub_para);
// check covering staff if on leave in this during.
$is_covering_staff_onleave = $this->bo->check_covering_staff_onleave(get_var("covering_staff"),$sub_para);
if($is_covering_staff_onleave==1)
{
// covering staff on leave
echo "<script language=javascript>window.location.href = 'index.php?menuaction=leave.uiapplyleave.add_leave&return_para=14'</script>";
return "";
}
// check on this during, if have double on leave
$is_check_double_onleave = $this->bo->check_double_onleave($sub_para);
if($is_check_double_onleave==1)
{
// double apply leave
echo "<script language=javascript>window.location.href = 'index.php?menuaction=leave.uiapplyleave.add_leave&return_para=15'</script>";
return "";
}
// save apply data in to database
// print_r($main_para);
{
$from_time="09:00";
$to_time="18:00";
}
$start_date=get_var("start_date_1");
$end_date=get_var("end_date_1");
$sub_para[] = array(
"type_id" => $leave_type,
"start_date_1" => $start_date,
"start_time_1" => $from_time,
"end_date_1" => $end_date,
"end_time_1" => $to_time,
"sub_total_days_1" => get_var("total_days"),
);
// print_r($sub_para);
// check covering staff if on leave in this during.
$is_covering_staff_onleave = $this->bo->check_covering_staff_onleave(get_var("covering_staff"),$sub_para);
if($is_covering_staff_onleave==1)
{
// covering staff on leave
echo "<script language=javascript>window.location.href = 'index.php?menuaction=leave.uiapplyleave.add_leave&return_para=14'</script>";
return "";
}
// check on this during, if have double on leave
$is_check_double_onleave = $this->bo->check_double_onleave($sub_para);
if($is_check_double_onleave==1)
{
// double apply leave
echo "<script language=javascript>window.location.href = 'index.php?menuaction=leave.uiapplyleave.add_leave&return_para=15'</script>";
return "";
}
// save apply data in to database
// print_r($main_para);
$from_time="00:00";
$to_time="00:00";
if(get_var("full_half_day")==0)
{
// half day
$am_pm=get_var("end_time_1");
if($am_pm=="am")
{
$from_time="09:00";
$to_time="13:00";
}else if($am_pm=="pm")
{
$from_time="14:00";
$to_time="18:00";
}
$add=0;
if($assign != null && $leave_type==0){
if($assign["long_annual"]>0){
$annual_start_date=$start_date;
$add=$assign["long_annual"];
$annual_date=$this->bo->assign_date_by_days($annual_start_date,$assign["long_annual"]);
$temp["type_id"]= 1;
$temp["start_date_1"] = $annual_date[0];
$temp["start_time_1"] = $from_time;
$temp["end_date_1"] = $annual_date[1];
$temp["end_time_1"] = $to_time;
$temp["sub_total_days_1"] = $assign["long_annual"];
$sub_para[]=$temp;
}
if($assign["long_adv_annual"]>0){
if($assign["long_annual"]>0)
$adv_annual_start_date=date("Y-m-d",strtotime("+1 day",strtotime($annual_date[1])));
else
$adv_annual_start_date=date("Y-m-d",strtotime("+$add day",strtotime($start_date)));
$add += $assign["long_adv_annual"];
$adv_annual_date=$this->bo->assign_date_by_days($adv_annual_start_date,$assign["long_adv_annual"]);
$temp["type_id"]= 11;
$temp["start_date_1"] = $adv_annual_date[0];
$temp["start_time_1"] = $from_time;
$temp["end_date_1"] = $adv_annual_date[1];
$temp["end_time_1"] = $to_time;
$temp["sub_total_days_1"] = $assign["long_adv_annual"];
$sub_para[]=$temp;
}
if($assign["long_personal"]>0){
if($assign["long_adv_annual"]>0)
$personal_start_date=date("Y-m-d",strtotime("+1 day",strtotime($adv_annual_date[1])));
else
$personal_start_date=date("Y-m-d",strtotime("+$add day",strtotime($start_date)));
$add += $assign["long_personal"];
$personal_date=$this->bo->assign_date_by_days($personal_start_date,$assign["long_personal"]);
$temp["type_id"]= 12;
$temp["start_date_1"] = $personal_date[0];
$temp["start_time_1"] = $from_time;
$temp["end_date_1"] = $personal_date[1];
$temp["end_time_1"] = $to_time;
$temp["sub_total_days_1"] = $assign["long_personal"];
$sub_para[]=$temp;
}
if($assign["long_adv_personal"]>0){
if($assign["long_personal"]>0)
$adv_personal_start_date=date("Y-m-d",strtotime("+1 day",strtotime($personal_date[1])));
else{
if($assign["long_adv_annual"]>0)
$adv_personal_start_date=date("Y-m-d",strtotime("+1 day",strtotime($adv_annual_date[1])));
else
$adv_personal_start_date=date("Y-m-d",strtotime("+$add day",strtotime($start_date)));
}
$add += $assign["long_adv_personal"];
$adv_personal_date=$this->bo->assign_date_by_days($adv_personal_start_date,$assign["long_adv_personal"]);
$temp["type_id"]= 13;
$temp["start_date_1"] = $adv_personal_date[0];
$temp["start_time_1"] = $from_time;
$temp["end_date_1"] = $adv_personal_date[1];
$temp["end_time_1"] = $to_time;
$temp["sub_total_days_1"] = $assign["long_adv_personal"];
$sub_para[]=$temp;
}
if($assign["long_off"]>0){
if($assign["long_adv_personal"]>0){
$off_start_date=date("Y-m-d",strtotime("+1 day",strtotime($adv_personal_date[1])));
}
else{
if($assign["long_personal"]>0)
$off_start_date=date("Y-m-d",strtotime("+1 day",strtotime($personal_date[1])));
else{
if($assign["long_adv_annual"]>0)
$off_start_date=date("Y-m-d",strtotime("+1 day",strtotime($adv_annual_date[1])));
else
$off_start_date=date("Y-m-d",strtotime("+$add day",strtotime($start_date)));
}
}
$add += $assign["long_off"];
$off_date=$this->bo->assign_date_by_days($off_start_date,$assign["long_off"]);
$temp["type_id"]= 2;
$temp["start_date_1"] = $off_date[0];
$temp["start_time_1"] = $from_time;
$temp["end_date_1"] = $off_date[1];
$temp["end_time_1"] = $to_time;
$temp["sub_total_days_1"] = $assign["long_off"];
$sub_para[]=$temp;
}
}
$ret = $this->bo->add_leave_record($main_para,$sub_para);
if(isset($ret))
{
echo "<script language=javascript>window.location.href = 'index.php?menuaction=leave.uileavehistorylist.list_leave_status'</script>";
return "";
}
else
{
echo "<script language=javascript>alert('Apply leave fail');</script>";
echo "<script language=javascript>history.back()</script>";
function get_leave_detail()
{
$items[] = array(
"type_id" => "1",
"start_date" => "2",
"start_time" => "3",
"end_date" => "4",
"end_time" => "5",
"sub_total_days" => "6"
);
}
return
帮我看看,怎么样才可输出5
要调用这函数。