Пример #1
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $app = $this->getApplication();
         $usedId = $app->getUser()->getUserID() == null ? 0 : $app->getUser()->getUserID();
         $cmd = $this->db->createCommand("SELECT user_id FROM hr_superusers WHERE id={$usedId}");
         $data = $cmd->query();
         $dataUser = $data->read();
         $userId = $dataUser['user_id'];
         $employee = new employee($userId);
         $role = $employee->getRole();
         if ($role == 'employee' && $userId != $this->Request['userId']) {
             $this->Response->redirect($this->Service->constructUrl($this->Request['back']));
         }
         $this->employee->DataSource = $this->PersonList;
         $this->employee->dataBind();
         if ($this->employee->getItemCount() && $this->employee->getSelectedValue() == '') {
             $this->employee->setSelectedIndex(0);
         }
         $this->timecode->DataSource = $this->TimeCodeList;
         $this->timecode->dataBind();
         $this->timecode->setEnabled(false);
         if (isset($this->Request['date'])) {
             $this->date->Text = $this->Request['date'];
         }
         if (isset($this->Request['userId'])) {
             $this->employee->setSelectedValue($this->Request['userId']);
         }
     }
 }
Пример #2
0
 function getEmployees()
 {
     include_once "employee.php";
     $employee = new employee();
     if ($employee->getEmployees) {
         $row = $employee->fetchArray();
         echo '{"results":1,"employees":[';
         while ($row) {
             echo json_encode($row);
             if ($row = $employee->fetchArray()) {
                 echo ',';
             }
         }
         echo ']}';
     }
 }
Пример #3
0
 public function getDelete($id)
 {
     $employee = employee::find($id);
     $employee->delete();
     Session::flash('message', 'The records are deleted successfully');
     return Redirect::to('employee');
 }
Пример #4
0
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
 public function syncBalances()
 {
     $app = Prado::getApplication();
     $db = $app->getModule('horuxDb')->DbConnection;
     $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
     $db->Active = true;
     $sql = "SELECT id FROM hr_user WHERE name!='??' AND firstname!='??' AND isBlocked=0";
     $cmd = $db->createCommand($sql);
     $data = $cmd->query();
     $data = $data->readAll();
     $val = "";
     foreach ($data as $data) {
         $val .= $data['id'] . "/";
         $employee = new employee($data['id']);
         $overTimeLastMonth = $employee->getOvertimeLastMonth(date('n'), date('Y'));
         $overTimeMonth = 0;
         for ($day = 1; $day < date('j'); $day++) {
             $todo = $employee->getDayTodo($day, date('n'), date('Y'));
             $done = $employee->getDayDone($day, date('n'), date('Y'));
             $overTimeMonth = bcadd($overTimeMonth, bcsub($done['done'], $todo, 4), 4);
         }
         //get the info the current day only if the overtime +
         $todo = $employee->getDayTodo(date('j'), date('n'), date('Y'));
         $done = $employee->getDayDone(date('j'), date('n'), date('Y'));
         if (bcsub($done['done'], $todo, 4) > 0) {
             $overTimeMonth = bcadd($overTimeMonth, bcsub($done['done'], $todo, 4), 4);
         }
         $overtime = bcadd($overTimeLastMonth, $overTimeMonth, 4);
         $val .= sprintf("%.02f", $overtime) . "/";
         $lastYear = $employee->geHolidaystMonth(date('Y') - 1, 12);
         $nvy = $employee->geHolidaystMonth(date('Y'), date('n'));
         for ($month = 1; $month < date('n'); $month++) {
             $nv = $employee->getRequest(date('Y'), $month, $employee->getDefaultHolidaysCounter());
             $nvy -= $nv['nbre'];
         }
         $nvy = bcsub($nvy, $lastYear, 4);
         $holidays = $employee->getRequest(date('Y'), date('n'), $defH);
         $holidaysLastMonth = $nvy + $lastYear;
         $holidaysCurrentMonth = bcsub($holidaysLastMonth, $holidays['nbre'], 2);
         $val .= sprintf("%.02f", $holidaysCurrentMonth);
         $val .= ";";
     }
     return $val;
 }
Пример #6
0
<?php

/**
 * Copyright (c) 2012 Ryan Yonzon, <*****@*****.**>
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
require '../ormbit.init.php';
// require and initialize ORMbit class
// intantiate: /models/employee.model.php
$employee = new employee();
// find twenty(20) employee records
$employee->find(array('limit' => '0,20'));
// get the first record
$employee->first();
// print out
echo $employee->id . ", " . $employee->first_name . ", " . $employee->last_name . ", " . $employee->name . "\n";
// -EOF-
Пример #7
0
 public function onRestoreMonth($sender, $param)
 {
     $data = $this->getData();
     foreach ($data as $d) {
         if ($d['canBeClosed'] == -2) {
             // month already closed
             $employee = new employee($d['user_id']);
             $employee->restoreMonth($this->FilterMonth->getSelectedValue(), $this->FilterYear->getSelectedValue());
             $param = Prado::getApplication()->getParameters();
             $computation2 = $param['computation2'];
             if ($computation2 != '') {
                 Prado::using('horux.pages.components.timuxuser.' . $computation2);
                 if (class_exists($computation2)) {
                     $extendCloseMonth = new $computation2();
                     if ($extendCloseMonth) {
                         $extendCloseMonth->restoreMonth($this->FilterMonth->getSelectedValue(), $this->FilterYear->getSelectedValue(), $employee);
                     }
                 }
             }
         }
     }
     $pBack = array('okMsg' => Prado::localize('The month was restore'));
     $this->Response->redirect($this->Service->constructUrl('components.timuxuser.closemonth.closemonth', $pBack));
 }
Пример #8
0
<?php

//Session Info
session_start();
if (!isset($_SESSION['emanager_logged'])) {
    header('Location: login.php');
}
include 'db_connection.php';
include 'classes/employee.php';
include 'classes/team.php';
include 'header.html';
$connection = new db_connection();
$employee = employee::loadEmployee($connection, $_SESSION['emanager_user_id']);
$connection->close();
?>

<script type="text/javascript">

jQuery.validator.addMethod("combobox", function(value, element) { 
	return this.optional(element) || value > 0; 
}, jQuery.format("Please select a valid option."));

jQuery.validator.addMethod("combobox_md5", function(value, element) { 
	return this.optional(element) || value != -1; 
}, jQuery.format("Please select a valid option."));

jQuery.validator.addMethod("pass_change", function(value, element) {
	return this.optional(element) || value > 0; 	
}, jQuery.format("Please select a valid option."));

function checkAll(){
Пример #9
0
<?php

/**
 * Copyright (c) 2012 Ryan Yonzon, <*****@*****.**>
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
require '../ormbit.init.php';
// require and initialize ORMbit class
// intantiate: /models/employee.model.php
$employee = new employee();
$job_id = 1;
// Software Engineer (from `job` table)
$privilege = 'Administrator';
$record = array('first_name' => 'Curly', 'last_name' => 'Howard', 'phone' => '888-9999', 'job_id' => $job_id, 'access' => $privilege, 'created_on' => date("Y-m-d H:i:s", time()));
// insert/save new record
$id = $employee->save($record);
// print record ID
echo "Record ID: " . $id . "\n";
// -EOF-
Пример #10
0
        $employees = $db->value;
        $where = $department_id > 0 ? 'parent_id=' . $department_id : 'parent_id IS NULL';
        $query = 'SELECT * FROM "' . TABLE_DEPARMENT . '" WHERE ' . $where . ' ORDER BY name ' . $sort_dep_dir;
        $db->query($query);
        $departments = $db->value;
        for ($i = 0; $i < count($departments); $i++) {
            $employees = array_merge($employees, get_employee_in_dep($departments[$i]['id_department'], $sort_dep_dir));
        }
        return $employees;
    }
    $employees = get_employee_in_dep($department_id, $sort_dir);
    $employees = array_slice($employees, $from, LIMIT_EMPLOYEE_ON_PAGE);
    $page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_EMPLOYEE_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars, 'Aclick');
}
$dep = new department();
$emp = new employee();
for ($i = 0; $i < count($employees); $i++) {
    $dep->Init();
    $dep->id_department = $employees[$i]['department_id'];
    $dep->Load();
    $n = 0;
    $employees[$i]['department'] = array();
    $employees[$i]['department'][$n]['dep'] = $dep->name;
    if ($dep->head_id != 0) {
        $emp->id_employee = $dep->head_id;
        $emp->Load();
        $employees[$i]['department'][$n]['head'] = $emp->name;
    } else {
        $employees[$i]['department'][$n]['head'] = '';
    }
    while ($dep->parent_id != 0) {
Пример #11
0
 // *** Create pdf object ***
 $pdf = new PDF('L');
 $pdf->SetTitle(REPORT_NAME_EMPLOYEES);
 $pdf->SetAuthor(TITLE);
 $pdf->AddPage();
 $pdf->SetFont('Arial', '', 12);
 $pdf->Cell(30, 6, REPORT_TEXT_DATE, 0, 0, 'L');
 $pdf->Cell(100, 6, tep_strftime(DATE_FORMAT_SHORT), 0, 0, 'L');
 $pdf->Ln();
 if ($_POST['show_timesheet_info'] || $_POST['show_travel_distance_and_expenses']) {
     $pdf->Cell(30, 6, REPORT_TEXT_PERIOD, 0, 0, 'L');
     $pdf->Cell(100, 6, $_POST['period'] . '  (' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', tep_periodstartdate($_POST['period']))) . ' - ' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', tep_periodenddate($_POST['period']))) . ')', 0, 0, 'L');
     $pdf->Ln();
 }
 $pdf->Ln(6);
 $employees_array = employee::get_array($_POST['show_all_employees']);
 $table_contents = array();
 $index = 0;
 // Set the header and orientation
 $table_header = array(REPORT_EMPLOYEES_ID, REPORT_EMPLOYEES_FULLNAME);
 $table_contents_orientation = array('R', 'L');
 $column_count = 2;
 if ($_POST['show_user_rights']) {
     // Add to header
     $table_header[$column_count] = REPORT_EMPLOYEES_LOGIN;
     $table_header[$column_count + 1] = REPORT_EMPLOYEES_PROJECTLISTING;
     $table_header[$column_count + 2] = REPORT_EMPLOYEES_TIMEREGISTRATION;
     $table_header[$column_count + 3] = REPORT_EMPLOYEES_ANALYSIS;
     $table_header[$column_count + 4] = REPORT_EMPLOYEES_ADMINISTRATION;
     // Add to orientation
     $table_contents_orientation[$column_count] = 'C';
Пример #12
0
<?php

/**
 * Copyright (c) 2012 Ryan Yonzon, <*****@*****.**>
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
require '../ormbit.init.php';
// require and initialize ORMbit class
// intantiate: /models/employee.model.php
$employee = new employee();
// record ID
$id = 2;
// try and select a specific record based on the ID given
if ($employee->select($id)) {
    // print out, before record update
    echo "Before update: " . $employee->id . ", " . $employee->first_name . ", " . $employee->last_name . ", " . $employee->job_id . "\n";
    $new_job_id = 1;
    $record_changes = array('first_name' => 'Larry', 'last_name' => 'Fine', 'job_id' => $new_job_id);
    // try and update the record
    if ($employee->update($record_changes)) {
        // re-select record (get the update record)
        $employee->select($id);
        // print out, after record update
        echo "After update: " . $employee->id . ", " . $employee->first_name . ", " . $employee->last_name . ", " . $employee->job_id . "\n";
    } else {
        echo "Unable to update the record.\n";
    }
Пример #13
0
<?php

require_once '../model/employee.php';
require_once '../model/error.php';
$employee = new employee();
if ($_GET) {
    foreach ($_GET as $key => $value) {
        if ($key != "next") {
            $nattr = "set" . ucfirst($key);
            $employee->{$nattr}($value);
        }
    }
}
try {
    $employee->addToDatabase();
} catch (Exception $e) {
    echo 'Problem at ' . $e->getLine() . ' from controller addEmployee :' . $e->getMessage();
}
header('location:' . $_GET["next"]);
Пример #14
0
<?php

/**
 * Copyright (c) 2012 Ryan Yonzon, <*****@*****.**>
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
require '../ormbit.init.php';
// require and initialize ORMbit class
// intantiate: /models/employee.model.php
$employee = new employee();
// find all records
$employee->find();
// iterate through records and print it out
while ($employee->iterate()) {
    echo $employee->id . ", " . $employee->first_name . ", " . $employee->last_name . ", " . $employee->name . "\n";
}
// -EOF-
Пример #15
0
       
        <th> Ф.И.О</th>
        <th> Должность</th>
        <th> Место командировки</th>
        <th> Контактный телефон(или места куда убыл)</th>
        <th> Цель командировки</th>
        <th> Время убытия</th>
        <th> Время прибытия</th>
        <th> Комментарий</th>
        <th> &nbsp;</th>
    </tr>
    <?php 
    $odd = false;
    for ($i = 0; $i < count($coms); $i++) {
        $odd = !$odd;
        $empl = new employee();
        $empl->id_employee = $coms[$i]['employee_id'];
        $empl->Load();
        ?>
                <tr <?php 
        echo $odd ? 'class="odd"' : '';
        ?>
>
                    <th><?php 
        echo $i + 1;
        ?>
.</th>
                   
                    <td><?php 
        echo htmlspecialchars($coms[$i]['date']);
        ?>
Пример #16
0
<?php

/**
 * Copyright (c) 2012 Ryan Yonzon, <*****@*****.**>
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
require '../ormbit.init.php';
// require and initialize ORMbit class
// intantiate: /models/employee.model.php
$employee = new employee();
// find twenty(20) employee records
$employee->find(array('limit' => '0,20'));
// get the last five(5) records (from the Find result)
$employee->last(5);
// iterate through records and print it out
while ($employee->iterate()) {
    echo $employee->id . ", " . $employee->first_name . ", " . $employee->last_name . ", " . $employee->name . "\n";
}
// -EOF-
Пример #17
0
 protected function printMonthBalance($month, $year)
 {
     $cmd = $this->db->createCommand("SELECT id FROM hr_user WHERE name!='??' ORDER BY name, firstname");
     $data = $cmd->query();
     $data = $data->readAll();
     $app = $this->getApplication()->getGlobalization();
     foreach ($data as $v) {
         $this->pdf->AddPage();
         $employee = new employee($v['id']);
         $this->pdf->SetFont('Arial', '', 9);
         $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('Sign in/out')), 0, 0, 'L');
         $this->pdf->Ln(10);
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Employee')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($employee->getFullName()), 0, 1, 'L');
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Department')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($employee->getDepartment()), 0, 1, 'L');
         $date = new DateFormat($app->getCulture());
         $date = $date->format('1-' . $month . "-" . $year, "P");
         $date = explode(" ", $date);
         $date = $date[2] . " " . $date[3];
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Month')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($date), 0, 1, 'L');
         $this->pdf->Ln(10);
         $header = array(utf8_decode(Prado::localize("Date")), utf8_decode(Prado::localize("Signing")), utf8_decode(Prado::localize("To do")), utf8_decode(Prado::localize("Done")), utf8_decode(Prado::localize("Overtime")), utf8_decode(Prado::localize("Remark")));
         $this->pdf->SetFillColor(124, 124, 124);
         $this->pdf->SetTextColor(255);
         $this->pdf->SetDrawColor(255);
         $this->pdf->SetLineWidth(0.3);
         $this->pdf->SetFont('', 'B');
         $w = array(20, 65, 15, 15, 15, 65);
         for ($i = 0; $i < count($header); $i++) {
             $this->pdf->CellExt($w[$i], 7, $header[$i], 1, 0, 'C', 1);
         }
         $this->pdf->Ln();
         $this->pdf->SetFillColor(215, 215, 215);
         $this->pdf->SetTextColor(0);
         $this->pdf->SetFont('');
         $fill = false;
         $this->pdf->SetFont('courier', '', 7);
         $data = $this->getMonthBalanceData($month, $year, $employee);
         foreach ($data as $d) {
             $date = new DateFormat($app->getCulture());
             $date = $date->format($d['date'], "P");
             $date = explode(" ", $date);
             $date[0] = strtoupper(substr($date[0], 0, 2));
             $date = implode(" ", $date);
             $date = utf8_decode($date);
             $nBr2 = $this->findall("<br/>", $d['sign']);
             $sign = str_replace("&nbsp;", " ", str_replace("<br/>", "\n", $d['sign']));
             $todo = utf8_decode($d['todo']);
             $done = utf8_decode($d['done']);
             $overtime = utf8_decode($d['overtime']);
             $remark = utf8_decode($d['remark']);
             $remark = str_replace("&rarr;", "->", $remark);
             $remark = str_replace("&larr;", "<-", $remark);
             $nBr = $this->findall("<br>", $remark);
             $remark = str_replace("<br>", "\n", $remark);
             $remark = str_replace("<span style=\"color:red\">", "", $remark);
             $remark = str_replace("</span>", "", $remark);
             if ($nBr2 !== false && $nBr2 > $nBr) {
                 $nBr = $nBr2;
             }
             $height = 5;
             if ($nBr !== false) {
                 $height = 5.5 * count($nBr);
             }
             $this->pdf->CellExt($w[0], $height, $date, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[1], $height, $sign, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[2], $height, $todo, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[3], $height, $done, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[4], $height, $overtime, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[5], $height, $remark, 'LR', 0, 'L', $fill);
             $this->pdf->Ln();
             $fill = !$fill;
         }
         $this->pdf->SetFont('Arial', '', 9);
         $this->pdf->SetDrawColor(0);
         $this->pdf->SetLineWidth(0.1);
         $this->pdf->Ln(7);
         // ligne 1
         $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Hours due')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->hoursDue, 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays (days)')) . "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 1, 'R');
         //Ligne 2
         $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Signed')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->signed, 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays balance last year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->balanceHolidaysLastYear, 0, 1, 'R');
         //Ligne 3
         if ($this->overTimeMonth > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Balance for the month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("+%.02f", $this->overTimeMonth), 0, 0, 'R');
         } elseif ($this->overTimeMonth < 0 || $this->overTimeMonth == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Balance for the month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->overTimeMonth), 0, 0, 'R');
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for the year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->holidayForTheYear), 0, 1, 'R');
         //Ligne 4
         if ($this->overTimeLastMonth > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Last month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("+%.02f", $this->overTimeLastMonth), 0, 0, 'R');
         } elseif ($this->overTimeLastMonth < 0 || $this->overTimeLastMonth == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Last month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->overTimeLastMonth), 0, 0, 'R');
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays last month')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->holidaysLastMonth, 0, 1, 'R');
         // ligne 5
         $balances = bcadd($this->overTimeMonth, $this->overTimeLastMonth, 4);
         $overtTimeActivityCounter = $employee->getActivityCounter($year, $month, $employee->getDefaultOvertimeCounter());
         if ($overtTimeActivityCounter != 0) {
             $balances = bcadd($balances, $overtTimeActivityCounter, 4);
         }
         if ($balances > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Balances')) . " :", 0, 0, 'L');
             if ($overtTimeActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* +%.02f", $balances), 0, 0, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("+%.02f", $balances), 0, 0, 'R');
             }
         } elseif ($balances < 0 || $balances == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Balances')) . " :", 0, 0, 'L');
             if ($overtTimeActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* %.02f", $balances), 0, 0, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf(" %.02f", $balances), 0, 0, 'R');
             }
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $defaultHolidayTimeCode = $employee->getDefaultHolidaysCounter();
         $holidays = $employee->getRequest($year, $month, $defaultHolidayTimeCode);
         if ($holidays['nbre'] > 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for this month')) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("-%.02f", $holidays['nbre']), 0, 1, 'R');
         } elseif ($holidays['nbre'] == 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for this month')) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("%.02f", $holidays['nbre']), 0, 1, 'R');
         }
         // ligne 6
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $holidayActivityCounter = $employee->getActivityCounter($year, $month, $employee->getDefaultHolidaysCounter());
         $holidaysTotal = bcsub($this->holidaysLastMonth, $holidays['nbre'], 4);
         if ($holidaysTotal > 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Total')) . " :", 0, 0, 'L');
             if ($holidayActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* +%.02f", $holidaysTotal), 0, 1, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("+%.02f", $holidaysTotal), 0, 1, 'R');
             }
         } elseif ($holidaysTotal < 0 || $holidaysTotal == 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Total')) . " :", 0, 0, 'L');
             if ($holidayActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* %.02f", $holidaysTotal), 0, 1, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("%.02f", $holidaysTotal), 0, 1, 'R');
             }
         }
         // ligne 7
         $this->pdf->ln(3);
         // ligne 8
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Non working days similar to a Sunday')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->nonworkingday, 0, 1, 'R');
         // ligne 9
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Non working days a the end of the year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->nonworkingdayendofyear), 0, 1, 'R');
         $this->pdf->ln(7);
         foreach ($this->TimeCode as $v) {
             $this->pdf->Cell(50, 3, utf8_decode($v['name']) . " :", 0, 0, 'L');
             $this->pdf->Cell(80, 3, utf8_decode($v['value']), 0, 1, 'R');
         }
     }
     $this->pdf->Output(Prado::localize('Balance') . '_' . $month . '_' . $year . '.pdf', 'D');
 }
Пример #18
0
 protected function getData($from, $to)
 {
     $cmd = $this->db->createCommand("SELECT * FROM hr_non_working_day WHERE `from`>='{$from}' AND `until`<='{$to}'  ORDER BY `from`");
     $data = $cmd->query();
     $data = $data->readAll();
     $event = array();
     foreach ($data as $row) {
         $time = '';
         if ($row['period'] == 'morning') {
             $time = 'T08:00:00';
         }
         if ($row['period'] == 'afternoon') {
             $time = 'T13:00:00';
         }
         if ($this->isAccess('nonWorkingDay.mod')) {
             $url = "index.php?page=nonWorkingDay.mod&id=" . $row['id'] . "&back=components.timuxuser.calendar.calendar";
         } else {
             $url = "#";
         }
         $event[] = array('id' => $row['id'], 'title' => $row['name'], 'start' => $row['from'] . $time, 'end' => $row['until'], 'url' => $url, 'className' => 'nonworking_' . substr($row['color'], 1, 6), 'description' => $row['comment'], 'allDay' => $row['period'] == 'allday' ? true : false, 'color' => $row['color'], 'nwd' => true);
     }
     while (strtotime($from) <= strtotime($to)) {
         $cmd = $this->db->createCommand("SELECT * FROM hr_timux_request AS tr LEFT JOIN hr_timux_request_leave AS trl ON trl.request_id=tr.id LEFT JOIN hr_timux_timecode AS tt ON tr.timecodeId=tt.id WHERE trl.datefrom<='{$from}' AND trl.dateto>='{$from}'  AND ( tr.state='validate' OR  tr.state='closed') ORDER BY trl.datefrom");
         $data = $cmd->query();
         $data = $data->readAll();
         foreach ($data as $row) {
             $employee = new employee($row['userId']);
             $time = '';
             if ($row['period'] == 'morning') {
                 $time = 'T08:00:00';
             }
             if ($row['period'] == 'afternoon') {
                 $time = 'T13:00:00';
             }
             if ($this->isAccess('components.timuxuser.leave.mod')) {
                 $url = 'index.php?page=components.timuxuser.leave.mod&id=' . $row['request_id'] . '&back=components.timuxuser.calendar.calendar';
             } else {
                 $url = "#";
             }
             $event[$row['request_id']] = array('id' => $row['request_id'], 'title' => $row['name'] . " (" . $employee->getFullName() . ")", 'start' => $row['datefrom'] . $time, 'end' => $row['dateto'], 'url' => $url, 'description' => $row['remark'], 'className' => 'leave_' . substr($row['color'], 1, 6), 'allDay' => $row['period'] == 'allday' ? true : false, 'color' => $row['color'], 'nwd' => false);
         }
         $from = date("Y-m-d", strtotime(date("Y-m-d", strtotime($from)) . " +1 day"));
     }
     function compare($a, $b)
     {
         return strcasecmp($a["start"], $b["start"]);
     }
     usort($event, "compare");
     return $event;
 }
Пример #19
0
<?php

include 'db_connection.php';
include 'classes/employee.php';
$connection = new db_connection();
$team = $_POST['team'];
$where = stripslashes($_POST['where']);
/*Transaction status*/
$status = 'ok';
if (!employee::deleteTeam($connection, $team, $where)) {
    //Error
    $error = $connection->lastError();
    $status = "Error {$error['errno']}: {$error['error']}";
}
/*XML transaction result.*/
header('Content-Type: text/xml');
echo '<transaction>
<status>' . $status . '</status>
</transaction>
';
$connection->close();
<?php

session_start();
//REQUIRE
require_once '../model/order.php';
require_once '../model/company.php';
require_once '../model/extraction.php';
require_once '../model/employee.php';
require_once 'getText.php';
require_once '../vendor/fpdf17/fpdf.php';
//Initialisation des objets à utiliser
$employee = new employee($_SESSION["employee"]);
$order = new order($_GET['id']);
$company = new company($order->getId_company());
$receiving_address = new address($company->getId_receiving_address());
$billing_address = new address($company->getId_billing_address());
$tf->language = "GER";
// à modifier
//////////////////////////////////////////////
$typedocument = 6;
// Confirmation de commande
//////////////////////////////////////////////
// Génération du n° Document
function generateIdDoc($type, $company, $order)
{
    //[X : typedocument][XX : Year][X : country][XXXX : id commande]
    $year = date('y');
    $country = 5;
    $typedocument = $type;
    $country_company = $company->getNationality();
    $extraction = new extraction();
Пример #21
0
        $this->nombre = $nom;
        $this->apellido = $ape;
        $this->emailp = $emp;
        $this->emailc = $emc;
        $this->skype = $sky;
        $this->direccion = $dir;
        $this->telefono = $tel;
        $this->celular = $cel;
        $this->fechae = $fee;
        $this->fechac = $fec;
        $this->contactoe = $coe;
        $this->parentezco = $par;
        $this->telefonoc = $tep;
        $this->eps = $eps;
        $this->cargo = $car;
        $this->proyectoa = $pro;
    }
    public function pruebas()
    {
        //echo $this->cedula;
    }
    public function registrar()
    {
        $mysql = new Mysql();
        $mysql->conexion();
        $consulta = $mysql->consulta("INSERT INTO empleados values ('{$this->cedula}','{$this->nombre}','{$this->apellido}','{$this->emailp}','{$this->emailc}','{$this->skype}','{$this->direccion}','{$this->telefono}','{$this->celular}','{$this->fechae}','{$this->fechac}','{$this->contactoe}','{$this->parentezco}','{$this->telefonoc}','{$this->eps}','{$this->cargo}','{$this->proyectoa}')");
    }
}
$emp = new employee('$this->cedula', '$this->nombre', '$this->apellido', '$this->emailp', '$this->emailc', '$this->skype', '$this->direccion', '$this->telefono', '$this->celular', '$this->fechae', '$this->fechac', '$this->contactoe', '$this->parentezco', '$this->telefonoc', '$this->eps', '$this->cargo', '$this->proyectoa');
$emp->pruebas();
$emp->registrar();
Пример #22
0
<?php

require_once '../model/employee.php';
try {
    $id = $_GET["id"];
} catch (Exception $e) {
    header('location:viewProducts.php');
    exit;
}
$employee = new employee($id);
$employee->eraseOfDatabase();
header('location:viewEmployees.php');
exit;
Пример #23
0
 public function deleteOnClick($sender)
 {
     employee::delete($sender->owner->getDataItem()->employee_id);
     $this->employeetable->employeelist->Reload();
 }
Пример #24
0
 public function getDepartmentList()
 {
     $employee = new employee($this->userId);
     $role = $employee->getRole();
     $department = $employee->getDepartmentId();
     $cmd = NULL;
     if ($role == 'manager' || $role == 'employee') {
         $cmd = $this->db->createCommand("SELECT name AS Text, id AS Value FROM hr_department WHERE id={$department}");
     } else {
         $cmd = $this->db->createCommand("SELECT name AS Text, id AS Value FROM hr_department ORDER BY name");
     }
     $data = $cmd->query();
     $data = $data->readAll();
     if ($role == 'rh') {
         $dataAll[] = array("Value" => 0, "Text" => Prado::localize("--- All ---"));
         $data = array_merge($dataAll, $data);
     }
     return $data;
 }
Пример #25
0
 public function loadAllemployeeInConflict()
 {
     global $logger;
     $employeeInConflict = $mongoemployeeInConflict = null;
     $logger->debug("Selecting collection: conflictemployee");
     $this->mongo->selectCollection('conflictemployee');
     $mongoemployeeInConflict = $this->mongo->find(array());
     foreach ($mongoemployeeInConflict as $mongoemployeeInConflict) {
         $employeeInConflict[] = employee::deserialize($mongoemployeeInConflict);
     }
     return $employeeInConflict;
 }
Пример #26
0
/from/0/sort/room/sort_dir/<?php 
    echo $sort == 'room' ? $convert_sort_dirs[$sort_dir] : 'asc';
    ?>
/" onclick="return Aclick(this)">Комната</a><?php 
    echo $sort == 'room' ? $sort_dir == 'asc' ? '▲' : '▼' : '';
    ?>
</th>
        <?php 
}
?>
        <th>Операции</th>
    </tr>
    <?php 
$odd = false;
$prev_dep_id = -1;
$employee = new employee();
for ($i = 0; $i < count($employees); $i++) {
    $odd = !$odd;
    $employee->Init();
    $employee->LoadItem($employees[$i]);
    if ($sort == 'department' && $prev_dep_id != $employee->department_id) {
        $odd = true;
        ?>
            	<tr>
            	    <th align="left" colspan="<?php 
        echo $colspan;
        ?>
">
            	    <?php 
        $dl = '';
        for ($n = count($employees[$i]['department']) - 1; $n > 0; $n--) {
$connection = new db_connection();
$id = isset($_POST['id_hidden']) ? $_POST['id_hidden'] : NULL;
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$landline = $_POST['landline'];
$mobile = $_POST['mobile'];
$homeline = $_POST['homeline'];
$address = $_POST['address'];
$birth = $_POST['birth'];
$twitter = $_POST['twitter'];
$facebook = $_POST['facebook'];
$email = $_POST['email'];
$password = $_POST['password'];
$new_password = $_POST['new_password'];
$type = isset($_POST['type']) ? $_POST['type'] : 2;
$employee = new employee($name, $lastname, $landline, $mobile, $homeline, $address, $birth, $twitter, $facebook, $email, $password, $type, $id);
/*Transaction status*/
$status = 'ok';
if ($result = $employee->checkPassword($connection)) {
    //Error
    $row = $result->fetch_array();
    $pass = $row['valid'];
    $result->close();
    if ($pass == 1) {
        $employee->setPassword($new_password);
        if (!$employee->changePassword($connection)) {
            //Error
            $error = $connection->lastError();
            $status = "Error {$error['errno']}: {$error['error']}";
        }
    } else {
Пример #28
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            if (isset($_POST['employee'])) {
                // Verification usage
                $emp = new employee();
                $emp->db = $db;
                $emp->url = $CONF['url'];
                $emp->company = $_POST['company'];
                /*						$emp->hrphone = $_POST['hrphone'];
                						$emp->hrname = $_POST['hrname'];
                						$emp->hremail = $_POST['hremail'];*/
                $emp->offaddress = $_POST['offaddress'];
                $emp->offemail = $_POST['offemail'];
                $emp->offphone = $_POST['offphone'];
                $emp->industry = $_POST['industry'];
                $emp->designation = $_POST['designation'];
                $emp->department = $_POST['department'];
                $emp->city = $_POST['city'];
                $emp->country = $_POST['country'];
                $emp->state = $_POST['state'];
                $emp->country = $_POST['country'];
                $emp->joining = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
                //$con->dob = $settings['captcha'];
                $TMPL['employeeMsg'] = $emp->process();
                if ($TMPL['employeeMsg'] == 1) {
                    header("Location: " . $CONF['url'] . "/index.php?a=employee");
                }
            }
            if (isset($_POST['noo'])) {
                $emp = new employee();
                $emp->db = $db;
                $emp->url = $CONF['url'];
                $TMPL['employeeMsg'] = $emp->noprocess();
                if ($TMPL['employeeMsg'] == 1) {
                    header("Location: " . $CONF['url'] . "/index.php?a=employee");
                }
            }
            // If the username input string is an e-mail, switch the query
            if (isset($_SESSION['username'])) {
                if (filter_var($_SESSION['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                }
            } elseif (isset($_COOKIE['username'])) {
                if (filter_var($_COOKIE['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                }
            }
            while ($row = $result->fetch_assoc()) {
                $status = $row['status'];
            }
            if ($status == 0) {
                header("Location: " . $CONF['url'] . "/index.php?a=contact");
            } elseif ($status == 2) {
                header("Location: " . $CONF['url'] . "/index.php?a=settings&b=avatar");
            }
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['years'] = generateDateForm(0, $date[0]);
    $TMPL['months'] = generateDateForm(1, $date[1]);
    $TMPL['days'] = generateDateForm(2, $date[2]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Employee'] . ' - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('register/employee');
    return $skin->make();
}
Пример #29
0
<?php

require_once '../model/employee.php';
$employee = new employee();
$_GET["birthdate"] = strtotime($_GET["birthdate"]);
foreach ($_GET as $key => $value) {
    if ($key != "next" && $value != "") {
        echo $key . ' -> ' . $value . '<br/>';
        $nkey = "set" . ucfirst($key);
        echo $nkey . '<br/>';
        try {
            $employee->{$nkey}($value);
        } catch (Exception $e) {
            echo 'shit';
        }
    }
}
$employee->setToDatabase();
header('location:' . $_GET['next']);
Пример #30
-1
function login($email, $password, &$errno)
{
    //Login Function
    $ip = $_SERVER['REMOTE_ADDR'];
    $connection = new db_connection();
    $employee = employee::login($connection, $email, $password, $ip);
    $connection->close();
    if ($employee === -1 || $employee === 0) {
        //Data Base Connection or Incorrect Login Information
        $errno = $employee;
        setcookie("emanager_username", "", time() - 3600);
        setcookie("emanager_password", "", time() - 3600);
    } else {
        if (isset($_POST['remember'])) {
            setcookie("emanager_username", $employee->getEmail(), time() + 60 * 60 * 24 * 30);
            setcookie("emanager_password", $employee->getPassword(), time() + 60 * 60 * 24 * 30);
        }
        $_SESSION['emanager_logged'] = 1;
        $_SESSION['emanager_user_id'] = $employee->getId();
        $_SESSION['emanager_user_type'] = $employee->getType();
        header('Location: index.php');
    }
}