Esempio n. 1
0
 function createdetailevents($parenteventid)
 {
     $sql = "select * from user_event where id=" . $parenteventid;
     mysql_query($sql);
     $handle = mysql_query($sql) or die(mysql_error());
     /*$this->db->where('id', $parenteventid);
       $q = $this->db->get('user_event');
       if ($q->num_rows() > 0):
       $row = $q->row();
       endif;*/
     $arr;
     while ($row = mysql_fetch_object($handle)) {
         $arr["_ID"] = $row->id;
         $arr["_EventName"] = $row->event_title;
         $arr["_Location"] = $row->event_loc;
         $arr["_Description"] = $row->event_desc;
         $arr["_StartDate"] = $row->start_date;
         $arr["_EndDate"] = $row->to_date;
         $arr["_Daily"] = $row->daily;
         $arr["_Weekly"] = $row->weekly;
         $arr["_Monthly"] = $row->monthly;
         $arr["_Yearly"] = $row->yearly;
         $arr["_Daily_interval"] = $row->daily_interval;
         $arr["_Weekly_interval"] = $row->weekly_interval;
         $arr["_Weekly_interval_day"] = $row->weekly_interval_day;
         $arr["_Monthly_interval"] = $row->monthly_interval;
         $arr["_Monthly_interval_date"] = $row->monthly_interval_date;
         $arr["_Yearly_interval_date"] = $row->yearly_interval_date;
         $arr["_Yearly_interval_month"] = $row->yearly_interval_month;
         $arr["_Occurence"] = $row->event_occ;
         $arr["repeat_start_date"] = $row->repeat_start_date;
         if (trim($arr["_Daily"]) == "0" && trim($arr["_Monthly"]) == "0" && trim($arr["_Weekly"]) == "0" && trim($arr["_Yearly"]) == "0") {
             $startdate = $arr['_StartDate'];
             $start_exp = explode("/", $startdate);
             $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
             $enddate = $arr['_EndDate'];
             $end_exp = explode("/", $enddate);
             $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0];
             $strFieldsName = "parenteventid,startDate,endDate";
             $strInsertValue = "'" . $arr["_ID"] . "','" . $arr["_StartDate"] . "','" . $arr["_EndDate"] . "'";
             $this->insertdetailevent($strFieldsName, $strInsertValue);
         } else {
             $startdate = $arr['_StartDate'];
             $start_exp = explode("/", $startdate);
             $startdate = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
             $enddate = $arr['_EndDate'];
             $end_exp = explode("/", $enddate);
             $enddate = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0];
             $repeat_start_date = $arr['repeat_start_date'];
             $repeat_exp = explode("/", $repeat_start_date);
             $repeat_start_date = $repeat_exp[2] . "-" . $repeat_exp[1] . "-" . $repeat_exp[0];
             $date_difference = strtotime($repeat_start_date) - strtotime($startdate);
             if (trim($arr["_Daily"]) == "1") {
                 // Start Code
                 $strFieldsName = "parenteventid,startDate,endDate";
                 $strInsertValue = "";
                 $arr["_Occurence"] = $date_difference / (60 * 60 * 24);
                 if (trim($arr["_Daily_interval"]) != "") {
                     if (intval($arr["_Daily_interval"]) <= 0) {
                         $arr["_Daily_interval"] = 1;
                     }
                     $icounter = -1;
                     $blnloop = 1;
                     while ($blnloop == 1) {
                         $icounter++;
                         $strInsertValue = "'" . $arr["_ID"] . "'";
                         $interval = intval(trim($arr["_Daily_interval"])) * $icounter;
                         $startresult = mysql_fetch_array(mysql_query("SELECT ADDDATE('" . $startdate . "', INTERVAL " . $interval . " DAY) as startdate"));
                         $endresult = mysql_fetch_array(mysql_query("SELECT ADDDATE('" . $enddate . "', INTERVAL " . $interval . " DAY) as enddate"));
                         $strNewDate = $startresult['startdate'];
                         $strEndDate = $endresult['enddate'];
                         //$strNewDate=adddays($arr["_StartDate"],(intval(trim($arr["_Daily_interval"]))*$icounter),"day");
                         //$strEndDate=adddays($arr["_EndDate"],(intval(trim($arr["_Daily_interval"]))*$icounter),"day");
                         $strInsertValue .= ",'" . $strNewDate . "','" . $strEndDate . "'";
                         $this->insertdetailevent($strFieldsName, $strInsertValue);
                         if ($icounter + 1 >= intval($arr["_Occurence"])) {
                             $blnloop = 0;
                         }
                     }
                 }
                 // End Code
             }
             // weekly
             if (trim($arr["_Weekly"]) == "1") {
                 $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 7);
                 // Start Code
                 $strFieldsName = "parenteventid,startDate,endDate";
                 $strInsertValue = "";
                 if (trim($arr["_Weekly_interval"]) == "") {
                     $startdate = $arr['_StartDate'];
                     $start_exp = explode("/", $startdate);
                     $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
                     $arr["_Weekly_interval"] = getCurrentWeeklyDay($arr["_StartDate"]);
                 }
                 if (trim($arr["_Weekly_interval"]) != "") {
                     $icounter = -1;
                     $blnloop = 1;
                     $strNewDate = "";
                     $strNewEndDate = "";
                     $startdate = $arr['_StartDate'];
                     $start_exp = explode("/", $startdate);
                     $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
                     $enddate = $arr['_EndDate'];
                     $end_exp = explode("/", $enddate);
                     $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0];
                     while ($blnloop == 1) {
                         $strInsertValue = "'" . $arr["_ID"] . "'";
                         $icounter++;
                         if ($icounter == 0) {
                             $strNewDate = getWeeklyDay($arr["_StartDate"], trim($arr["_Weekly_interval"]));
                         } else {
                             $intWeekInterval = 1;
                             if (trim($arr["_Weekly_interval_day"]) != "") {
                                 $intWeekInterval = intval(trim($arr["_Weekly_interval_day"]));
                             }
                             if ($intWeekInterval <= 0) {
                                 $intWeekInterval = 1;
                             }
                             $strNewDate = adddays($strNewDate, $intWeekInterval, "week");
                         }
                         $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate);
                         $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day");
                         $exp_new = explode("-", $strNewDate);
                         if (strlen($exp_new[2]) == 1) {
                             $exp_new[2] = "0" . $exp_new[2];
                         }
                         $exp_newend = explode("-", $strNewEndDate);
                         if (strlen($exp_newend[2]) == 1) {
                             $exp_newend[2] = "0" . $exp_newend[2];
                         }
                         $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2];
                         $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2];
                         $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'";
                         $this->insertdetailevent($strFieldsName, $strInsertValue);
                         if ($icounter + 1 >= intval($arr["_Occurence"])) {
                             $blnloop = 0;
                         }
                     }
                 }
                 // End Code
             }
             // Monthly
             if (trim($arr["_Monthly"]) == "1") {
                 // Start Code
                 $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 30);
                 $strFieldsName = "parenteventid,startDate,endDate";
                 $strInsertValue = "";
                 $startdate = $arr['_StartDate'];
                 $start_exp = explode("/", $startdate);
                 $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
                 $enddate = $arr['_EndDate'];
                 $end_exp = explode("/", $enddate);
                 $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0];
                 if (trim($arr["_Monthly_interval"]) == "") {
                     $arr["_Monthly_interval"] = getCurrentMonthDay($arr["_StartDate"]);
                 }
                 if (trim($arr["_Monthly_interval"]) != "") {
                     $icounter = -1;
                     $blnloop = 1;
                     $strNewDate = "";
                     while ($blnloop == 1) {
                         $strInsertValue = "'" . $arr["_ID"] . "'";
                         $icounter++;
                         $intMonthInterval = 1;
                         if (trim($arr["_Monthly_interval_date"]) != "") {
                             $intMonthInterval = intval(trim($arr["_Monthly_interval_date"]));
                         }
                         if ($intMonthInterval <= 0) {
                             $intMonthInterval = 1;
                         }
                         if ($icounter == 0) {
                             $strNewDate = getMonthDay($arr["_StartDate"], trim($arr["_Monthly_interval"]), $intMonthInterval, 1);
                         } else {
                             $strNewDate = getMonthDay($strNewDate, trim($arr["_Monthly_interval"]), $intMonthInterval);
                         }
                         if ($strNewDate != "") {
                             $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate);
                             $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day");
                             $exp_new = explode("-", $strNewDate);
                             if (strlen($exp_new[2]) == 1) {
                                 $exp_new[2] = "0" . $exp_new[2];
                             }
                             $exp_newend = explode("-", $strNewEndDate);
                             if (strlen($exp_newend[2]) == 1) {
                                 $exp_newend[2] = "0" . $exp_newend[2];
                             }
                             $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2];
                             $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2];
                             $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'";
                             $this->insertdetailevent($strFieldsName, $strInsertValue);
                         }
                         if ($icounter + 1 >= intval($arr["_Occurence"])) {
                             $blnloop = 0;
                         }
                     }
                 }
                 // End Code
             }
             // Yearly
             if (trim($arr["_Yearly"]) == "1") {
                 // Start Code
                 $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 365);
                 $startdate = $arr['_StartDate'];
                 $start_exp = explode("/", $startdate);
                 $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0];
                 $enddate = $arr['_EndDate'];
                 $end_exp = explode("/", $enddate);
                 $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0];
                 // Start Code
                 $strFieldsName = "parenteventid,startDate,endDate";
                 $strInsertValue = "";
                 if (trim($arr["_Yearly_interval_date"]) == "" && intval(trim($arr["_Yearly_interval_date"])) <= 0) {
                     $arr["_Yearly_interval_date"] = getCurrentMonth($arr["_StartDate"]);
                 }
                 if (trim($arr["_Yearly_interval_month"]) == "" && intval(trim($arr["_Yearly_interval_month"])) <= 0) {
                     $arr["_Yearly_interval_month"] = getCurrentMonthDay($arr["_StartDate"]);
                 }
                 if (trim($arr["_Yearly_interval_month"]) != "") {
                     $icounter = -1;
                     $blnloop = 1;
                     $strNewDate = "";
                     while ($blnloop == 1) {
                         $strInsertValue = "'" . $arr["_ID"] . "'";
                         $icounter++;
                         if ($icounter == 0) {
                             $strNewDate = getYearDay($arr["_StartDate"], trim($arr["_Yearly_interval_date"]), trim($arr["_Yearly_interval_month"]), 1);
                         } else {
                             $strNewDate = getYearDay($strNewDate, trim($arr["_Yearly_interval_date"]), trim($arr["_Yearly_interval_month"]));
                         }
                         if ($strNewDate != "") {
                             $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate);
                             $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day");
                             $exp_new = explode("-", $strNewDate);
                             if (strlen($exp_new[2]) == 1) {
                                 $exp_new[2] = "0" . $exp_new[2];
                             }
                             $exp_newend = explode("-", $strNewEndDate);
                             if (strlen($exp_newend[2]) == 1) {
                                 $exp_newend[2] = "0" . $exp_newend[2];
                             }
                             $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2];
                             $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2];
                             $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'";
                             $this->insertdetailevent($strFieldsName, $strInsertValue);
                         }
                         if ($icounter + 1 >= intval($arr["_Occurence"])) {
                             $blnloop = 0;
                         }
                     }
                 }
                 // End Code
             }
         }
     }
 }
Esempio n. 2
0
include_once "mod.calendar.php";
include_once "mod.attendance.php";
include_once "ctrl.checklogin.php";
include_once "ctrl.calendar.php";
include_once "ctrl.attendance.php";
mysql_query("set character_set_client='utf8'");
mysql_query("set character_set_results='utf8'");
mysql_query("set collation_connection='utf8_general_ci'");
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
//$userid = (!isset($_GET['userid']) || $_GET['userid'] == "")?1:$_GET['userid'];
$userid = $_GET['uid'];
$todaydate = explode("-", date("Y-n-j"));
$getCurrentMonth = getCurrentMonth($todaydate, $userid, $db);
$getname = getusername($userid, $db);
foreach ($getname as $result) {
    $fname = $result['user_name'];
}
if (PHP_SAPI == 'cli') {
    die('This example should only be run from a Web Browser');
}
/** Include PHPExcel */
require_once 'Classes/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("Rubbersoul")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
$hrow = 1;
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $hrow, '日付')->setCellValue('B' . $hrow, '曜日')->setCellValue('C' . $hrow, '出社時間')->setCellValue('D' . $hrow, '遅刻')->setCellValue('E' . $hrow, '退社時間')->setCellValue('F' . $hrow, '早退')->setCellValue('G' . $hrow, '作業時間')->setCellValue('H' . $hrow, '残業時間')->setCellValue('I' . $hrow, '統計時間');
Esempio n. 3
0
/**
* function to generate a unique print number for abbott
*/
function generateWorksheetReferenceNumber() {
	global $trailSessionUser,$datetime;
	//get the user's names
	$names=0;
	$names=getDetailedTableInfo2("vl_users","email='$trailSessionUser' limit 1","names");
	$namesArray=array();
	$namesArray=explode(" ",$names);
	$initials=0;
	if(count($namesArray)>1) {
		//get the first letter of each name
		$initials=substr(trim($namesArray[0]),0,1);
		$initials.=substr(trim($namesArray[1]),0,1);
		$initials=strtoupper($initials);
	} else {
		//get the first 2 letters of the email
		$initials=substr(trim($trailSessionUser),0,2);
		$initials=strtoupper($initials);
	}
	
	//variables
	$number=0;
	$number=getDetailedTableInfo3("vl_samples_worksheetcredentials","year(created)='".getCurrentYear()."' and month(created)='".getCurrentMonth()."'","count(id)","num");
	$number+=1;
	
	$reference=0;
	$reference=getFormattedDateYearShort($datetime).getFormattedDateMonth($datetime);
	switch(strlen($number)) {
		case 1:
			$reference.=$initials."00$number";
		break;
		case 2:
			$reference.=$initials."0$number";
		break;
		default:
			$reference.=$initials.$number;
		break;
	}
	return $reference;
}
Esempio n. 4
0
//echo $yr['1'];
$out_limit = $_SESSION['sess_user_outtime'];
$in_limit = $_SESSION['sess_user_intime'];
$to = $_SESSION['sess_user_id'];
$rsesult = getmail($to, $db);
foreach ($rsesult as $row) {
    $tosend = $row['email'];
    //echo $tosend;
}
$getname = getusername($_SESSION['sess_user_id'], $db);
foreach ($getname as $result) {
    $fname = $result['user_name'];
    $eid = $result['user_eid'];
    //echo $eid;
}
$getCurrentMonth = getCurrentMonth($yr, $_SESSION['sess_user_id'], $db);
$to_mail = implode(", ", MailList(getHeaders(1, $db), 'to', $db));
$to_cc = implode(", ", MailList(getHeaders(1, $db), 'cc', $db));
$to_bcc = implode(", ", MailList(getHeaders(1, $db), 'bcc', $db));
$body = '<html>
							<head><title></title>
							<style>
								td{text-align:center; border-bottom: 1px dotted #514F4F;}
								table{width:900px;}
								span{color:red;}
								th{border-top: 1px solid #514F4F;border-bottom: 1px solid #514F4F;background: #514F4F;color: #E1E1E1;}
							</style>
							</head>
								<body>';
$body .= 'User Name: ' . $fname . '<br>';
$body .= 'User Id: ' . $eid . '<br>';
Esempio n. 5
0
include_once "ctrl.attendance.php";
if ($_SESSION['sess_user_id']) {
    $to = $_SESSION['sess_user_id'];
    $rsesult = getmail($to, $db);
    foreach ($rsesult as $row) {
        $tosend = $row['email'];
    }
}
$getname = getusername($_SESSION['sess_user_id'], $db);
foreach ($getname as $result) {
    $fname = $result['user_name'];
    $eid = $result['user_eid'];
}
$userid = !isset($_GET['userid']) || $_GET['userid'] == "" ? 1 : $_GET['userid'];
$todaydate = explode("-", date("Y-n-j"));
$getCurrentMonth = getCurrentMonth($todaydate, $_SESSION['sess_user_id'], $db);
$to_mail = implode(", ", MailList(getHeaders(1, $db), 'to', $db));
$to_cc = implode(", ", MailList(getHeaders(1, $db), 'cc', $db));
$to_bcc = implode(", ", MailList(getHeaders(1, $db), 'bcc', $db));
$body = '<html><head><title></title>';
$body .= '<style>';
$body .= 'table{width:900px;}';
$body .= 'th{border-top: 1px solid #514F4F;border-bottom: 1px solid #514F4F;background: #514F4F;color: #E1E1E1;}';
$body .= 'td{text-align:center; border-bottom: 1px dotted #514F4F;}';
$body .= 'span{color:red;}';
$body .= '</style>';
$body .= '</head><body>';
$body .= 'User Name: ' . $fname . '<br>';
$body .= 'User Id: ' . $eid . '<br>';
$body .= '<table>';
$body .= "<tr>";
Esempio n. 6
0
include_once "ctrl.attendance.php";
include_once "ctrl.checklogin.php";
include_once "ctrl.admin.php";
include_once "ctrl.group.php";
if (isset($_GET['uid']) && isset($_GET['cdate']) && $_GET['uid'] != "" && $_GET['cdate'] != "") {
    $d = explode("-", $_GET['cdate']);
    $userid = $_GET['uid'];
    // ** get user information
    $user = getUserProfileById($userid, $db);
    $wtime = getGroupTime($userid, $db);
    // ** set current timezone according to user type
    setTimeZone($user[0]['user_eid']);
    // ** set intime and outtime for this user's group
    $WORKINTIME = $wtime[0]['group_intime'];
    $WORKOUTTIME = $wtime[0]['group_outtime'];
    $getCurrentMonth = getCurrentMonth($d, $userid, $db);
    $late = getLateCheckIn($userid, $WORKINTIME, $d, $db);
    $earlyleave = getEarlyCheckOut($userid, $WORKOUTTIME, $d, $db);
    $absent = getAbsent($userid, $d, $db);
}
?>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Kinntai system</title>
	<link href="<?php 
echo CSS;
?>
/import.css" rel="stylesheet" type="text/css"/>
	<script src="<?php 
echo JS;