Example #1
0
 function ts_EmployeeMonthGraphs()
 {
     $curmonth = curmonth();
     $employees = ts_GetAllEmployee();
     $month_jobs_q = "SELECT `workerid`,`jobid` from `jobs` WHERE `date` LIKE '" . $curmonth . "%'";
     $alljobs = simple_queryall($month_jobs_q);
     $jobtypes = ts_GetAllJobtypes();
     $jobdata = array();
     $result = '';
     if (!empty($employees)) {
         if (!empty($alljobs)) {
             foreach ($alljobs as $io => $eachjob) {
                 if (isset($jobdata[$eachjob['workerid']][$eachjob['jobid']])) {
                     $jobdata[$eachjob['workerid']][$eachjob['jobid']]++;
                 } else {
                     $jobdata[$eachjob['workerid']][$eachjob['jobid']] = 1;
                 }
             }
         }
         //build graphs for each employee
         if (!empty($jobdata)) {
             foreach ($jobdata as $employee => $each) {
                 $employeeName = isset($employees[$employee]) ? $employees[$employee] : __('Deleted');
                 $result .= wf_tag('h3', false) . $employeeName . wf_tag('h3', true);
                 $rows = '';
                 if (!empty($each)) {
                     foreach ($each as $jobid => $count) {
                         $cells = wf_TableCell(@$jobtypes[$jobid], '40%');
                         $cells .= wf_TableCell($count, '20%');
                         $cells .= wf_TableCell(web_bar($count, sizeof($alljobs)), '40%');
                         $rows .= wf_TableRow($cells, 'row3');
                     }
                 }
                 $result .= wf_TableBody($rows, '100%', 0);
                 $result .= wf_delimiter();
             }
         }
     }
     return $result;
 }
Example #2
0
/**
 * Returns list of expired undone tasks
 * 
 * @return string
 */
function ts_ShowLate()
{
    $allemployee = ts_GetAllEmployee();
    $alljobtypes = ts_GetAllJobtypes();
    $curyear = curyear();
    $curmonth = date("m");
    $curdate = curdate();
    if ($curmonth != 1 and $curmonth != 12) {
        $query = "SELECT * from `taskman` WHERE `status`='0' AND `startdate` LIKE '" . $curyear . "-%' AND `startdate`< '" . $curdate . "' ORDER BY `startdate` ASC";
    } else {
        $query = "SELECT * from `taskman` WHERE `status`='0' AND `startdate`< '" . $curdate . "' ORDER BY `startdate` ASC";
    }
    $cells = wf_TableCell(__('Target date'));
    $cells .= wf_TableCell(__('Task address'));
    $cells .= wf_TableCell(__('Phone'));
    $cells .= wf_TableCell(__('Job type'));
    $cells .= wf_TableCell(__('Who should do'));
    $cells .= wf_TableCell(__('Actions'));
    $rows = wf_TableRow($cells, 'row1');
    $all = simple_queryall($query);
    if (!empty($all)) {
        foreach ($all as $io => $each) {
            $cells = wf_TableCell($each['startdate']);
            $cells .= wf_TableCell($each['address']);
            $cells .= wf_TableCell($each['phone']);
            $cells .= wf_TableCell(@$alljobtypes[$each['jobtype']]);
            $cells .= wf_TableCell(@$allemployee[$each['employee']]);
            $actions = wf_Link('?module=taskman&edittask=' . $each['id'], web_edit_icon(), false, '');
            $cells .= wf_TableCell($actions);
            $rows .= wf_TableRow($cells, 'row3');
        }
    }
    $result = wf_TableBody($rows, '100%', '0', 'sortable');
    return $result;
}
Example #3
0
 /**
  * Loads available jobtypes from database
  * 
  * @return void
  */
 protected function loadJobtypes()
 {
     $this->allJobtypes = ts_GetAllJobtypes();
 }
Example #4
0
 /**
  * Returns ajax selector reply for outcoming operation creation form
  * 
  * @param string $destMark
  * @return string
  */
 public function outcomindAjaxDestSelector($destMark)
 {
     $result = '';
     $destMark = vf($destMark);
     $result .= wf_HiddenInput('newoutdesttype', $destMark);
     switch ($destMark) {
         case 'task':
             $tasksTmp = array();
             $allJobTypes = ts_GetAllJobtypes();
             $allUndoneTasks = ts_GetUndoneTasksArray();
             if (!empty($allUndoneTasks)) {
                 foreach ($allUndoneTasks as $io => $each) {
                     $tasksTmp[$io] = $each['address'] . ' - ' . $allJobTypes[$each['jobtype']];
                 }
             }
             $result .= wf_Selector('newoutdestparam', $tasksTmp, __('Undone tasks'), '', false);
             break;
         case 'contractor':
             $result .= wf_Selector('newoutdestparam', $this->allContractors, __('Contractor'), '', false);
             break;
         case 'employee':
             $result .= wf_Selector('newoutdestparam', $this->activeEmployee, __('Worker'), '', false);
             break;
         case 'storage':
             $result .= wf_Selector('newoutdestparam', $this->allStorages, __('Warehouse storage'), '', false);
             break;
         case 'user':
             $allUsers = zb_UserGetAllIPs();
             if (!empty($allUsers)) {
                 $allUsers = array_flip($allUsers);
             }
             $result .= wf_AutocompleteTextInput('newoutdestparam', $allUsers, __('Login'), '', false);
             break;
         case 'sale':
             $result .= wf_HiddenInput('newoutdestparam', 'true');
             break;
         case 'cancellation':
             $result .= wf_HiddenInput('newoutdestparam', 'true');
             break;
         case 'mistake':
             $result .= wf_HiddenInput('newoutdestparam', 'true');
             break;
         default:
             $result = __('Strange exeption');
             break;
     }
     return $result;
 }