/** * Save new overtime into database * * @return bool * @access public */ public function insertOvertime() { global $charges_account; include_once '../hr/class/Employee.php'; $emp = new Employee(); $emp->fetchEmployee($this->employee_id); if ($this->overtimeline_type == "H") { $total_trip = $emp->employee_othour; } else { $total_trip = $emp->employee_ottrip; } $total_amt = $total_trip * $this->overtimeline_totalhour; $timestamp = date("y/m/d H:i:s", time()); $this->log->showLog(3, "Inserting new overtime {$this->overtime_name}"); $sql = "INSERT INTO {$this->tableovertimeline}\r\n (employee_id,overtimeline_date,overtimeline_starttime,overtimeline_endtime,\r\n overtimeline_totalhour,line_desc,overtimeline_type,overtimeline_rate,overtimeline_basicsalary,\r\n overtimeline_totalamt,\r\n created,createdby,updated,updatedby)\r\n values(\r\n {$this->employee_id},'{$this->overtimeline_date}','{$this->overtimeline_starttime}','{$this->overtimeline_endtime}',\r\n {$this->overtimeline_totalhour},'{$this->line_desc}','{$this->overtimeline_type}',{$total_trip},{$emp->employee_salary},\r\n {$total_amt},\r\n '{$timestamp}',{$this->createdby},'{$timestamp}',{$this->updatedby})"; $this->changesql = $sql; $this->log->showLog(4, "Before insert overtime SQL:{$sql}"); $rs = $this->xoopsDB->query($sql); if (!$rs) { $this->log->showLog(1, "Failed to insert overtime code {$overtime_name}:" . mysql_error() . ":{$sql}"); return false; } else { $this->log->showLog(3, "Inserting new overtime {$overtime_name} successfully"); return true; } }
public function updateRate($overtimeline_type, $employee_id) { include_once '../hr/class/Employee.php'; $emp = new Employee(); $emp->fetchEmployee($employee_id); if ($overtimeline_type == "T") { $overtimeline_rate = $emp->employee_ottrip; } else { $overtimeline_rate = $emp->employee_othour; } return $overtimeline_rate; }
$o->employeegroupctrl = $ctrl->getSelectEmployeegroup($o->employeegroup_id, "Y"); $o->departmentctrl = $ctrl->getSelectDepartment($o->department_id, "Y"); $o->permanentcountryctrl = $ctrl->getSelectCountry($o->permanent_country, 'N', 'permanent_country'); $o->contactcountryctrl = $ctrl->getSelectCountry($o->contact_country, 'N', 'contact_country'); $o->uidctrl = $permission->selectAvailableSysUser($o->uid, 'Y', "uid", "", " and isstudent = 0 ", "uid", $widthuser, "Y", 0); $o->supervisor1ctrl = $ctrl->getSelectEmployee($o->supervisor_1, 'Y', "", "supervisor_1", "", "supervisor_1", "style='width:200px'", "Y", 0); $o->supervisor2ctrl = $ctrl->getSelectEmployee($o->supervisor_2, 'Y', "", "supervisor_2", "", "supervisor_2", "style='width:200px'", "Y", 0); $o->jobpositionctrl = $ctrl->getSelectJobposition($o->jobposition_id, "Y", "", "jobposition_id", "", "jobposition_id", "", "Y", 0); $o->getInputForm("new", -1, $token); $o->showEmployeeTable("WHERE a.employee_id>0 and a.organization_id={$defaultorganization_id}", "ORDER BY a.defaultlevel,cast(a.employee_no as signed)"); } break; //when user request to edit particular organization //when user request to edit particular organization case "edit": if ($o->fetchEmployee($o->employee_id)) { //create a new token for editing a form $token = $s->createToken($tokenlife, "CREATE_ACG"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->racesctrl = $ctrl->getSelectRaces($o->races_id, 'N'); $o->religionctrl = $ctrl->getSelectReligion($o->religion_id, 'N'); $o->employeegroupctrl = $ctrl->getSelectEmployeegroup($o->employeegroup_id, "Y"); $o->departmentctrl = $ctrl->getSelectDepartment($o->department_id, "Y"); $o->permanentcountryctrl = $ctrl->getSelectCountry($o->permanent_country, 'N', 'permanent_country'); $o->contactcountryctrl = $ctrl->getSelectCountry($o->contact_country, 'N', 'contact_country'); $o->uidctrl = $permission->selectAvailableSysUser($o->uid, 'Y', "uid", "", " and isstudent = 0 ", "uid", $widthuser, "Y", 0); $o->supervisor1ctrl = $ctrl->getSelectEmployee($o->supervisor_1, 'Y', "", "supervisor_1", "", "supervisor_1", "style='width:200px'", "Y", 0); $o->supervisor2ctrl = $ctrl->getSelectEmployee($o->supervisor_2, 'Y', "", "supervisor_2", "", "supervisor_2", "style='width:200px'", "Y", 0); $o->jobpositionctrl = $ctrl->getSelectJobposition($o->jobposition_id, "Y", "", "jobposition_id", "", "jobposition_id", "", "Y", 0); $o->getInputForm("edit", $o->employee, $token); //$o->showEmployeeTable("WHERE a.employee_id>0 and a.organization_id=$defaultorganization_id","ORDER BY a.defaultlevel,cast(a.employee_no as signed)");