예제 #1
0
 public static function hours_fit_in_calculated_amount($projects_id, $activity_amount, $selected_date)
 {
     $database = $_SESSION['database'];
     $project_query = $database->query("SELECT projects_calculated_hours," . "(SELECT IFNULL(SUM(activities_amount),0) " . "FROM " . TABLE_ACTIVITIES . " " . "LEFT JOIN (" . TABLE_TIMESHEETS . "," . TABLE_TARIFFS . "," . TABLE_EMPLOYEES_ROLES . "," . TABLE_ROLES . ") " . "ON (" . TABLE_ACTIVITIES . ".timesheets_id=" . TABLE_TIMESHEETS . ".timesheets_id " . "AND " . TABLE_ACTIVITIES . ".tariffs_id=" . TABLE_TARIFFS . ".tariffs_id " . "AND " . TABLE_TARIFFS . ".employees_roles_id=" . TABLE_EMPLOYEES_ROLES . ".employees_roles_id " . "AND " . TABLE_EMPLOYEES_ROLES . ".roles_id=" . TABLE_ROLES . ".roles_id) " . "WHERE " . TABLE_TIMESHEETS . ".timesheets_start_date<='" . tep_strftime(DATE_FORMAT_DATABASE, $selected_date) . "' " . "AND " . TABLE_TIMESHEETS . ".timesheets_end_date>='" . tep_strftime(DATE_FORMAT_DATABASE, $selected_date) . "' " . "AND " . TABLE_ROLES . ".projects_id=" . TABLE_PROJECTS . ".projects_id) AS projects_calculated_hours_used " . "FROM " . TABLE_PROJECTS . " " . "WHERE projects_id=" . $projects_id . " " . "AND (projects_calculated_hours=0 " . "OR (projects_calculated_hours>0 " . "AND projects_calculated_hours_period='B')) " . "UNION " . "SELECT projects_calculated_hours," . "(SELECT IFNULL(SUM(activities_amount),0) " . "FROM " . TABLE_ACTIVITIES . " " . "LEFT JOIN (" . TABLE_TARIFFS . "," . TABLE_EMPLOYEES_ROLES . "," . TABLE_ROLES . ") " . "ON (" . TABLE_ACTIVITIES . ".tariffs_id=" . TABLE_TARIFFS . ".tariffs_id " . "AND " . TABLE_TARIFFS . ".employees_roles_id=" . TABLE_EMPLOYEES_ROLES . ".employees_roles_id " . "AND " . TABLE_EMPLOYEES_ROLES . ".roles_id=" . TABLE_ROLES . ".roles_id) " . "WHERE " . TABLE_ROLES . ".projects_id=" . TABLE_PROJECTS . ".projects_id) " . "FROM " . TABLE_PROJECTS . " " . "WHERE projects_id=" . $projects_id . " " . "AND projects_calculated_hours>0 " . "AND projects_calculated_hours_period='E' ");
     $project_result = $database->fetch_array($project_query);
     if (tep_not_null($project_result) && ($project_result['projects_calculated_hours'] == 0 || round($project_result['projects_calculated_hours'] - $project_result['projects_calculated_hours_used'] - $activity_amount, 2) >= 0)) {
         return true;
     } else {
         return false;
     }
 }
    for ($index = 0; $index < sizeof($_SESSION['employee_role']->listing); $index++) {
        ?>
                                <tr class="entryListing-<?php 
        echo $odd_or_even;
        ?>
" style="vertical-align:top">
                                  <td class="entryListing-data"><?php 
        echo $_SESSION['employee_role']->listing[$index]->role->name;
        ?>
</td>
                                  <td class="entryListing-data"><?php 
        echo $_SESSION['employee_role']->listing[$index]->employee->fullname;
        ?>
</td>
                                  <td class="entryListing-data"><?php 
        echo tep_strftime(DATE_FORMAT_SHORT, $_SESSION['employee_role']->listing[$index]->start_date) . '<br>' . ($_SESSION['employee_role']->listing[$index]->end_date != 0 ? tep_strftime(DATE_FORMAT_SHORT, $_SESSION['employee_role']->listing[$index]->end_date) : '&#8734;');
        ?>
</td>
                                  <td class="entryListing-data" style="width:20px;text-align:center">
                                    <?php 
        echo tep_draw_form('edit_entry', tep_href_link(FILENAME_ADMINISTRATION_EMPLOYEES_ROLES)) . tep_create_parameters(array('action' => 'enter_data', 'employees_roles_id' => $_SESSION['employee_role']->listing[$index]->id, 'roles_id' => $_SESSION['employee_role']->listing[$index]->role->id, 'employees_id' => $_SESSION['employee_role']->listing[$index]->employee->id, 'employees_roles_start_date' => $_SESSION['employee_role']->listing[$index]->start_date, 'employees_roles_end_date' => $_SESSION['employee_role']->listing[$index]->end_date), array('mPath', 'projects_id'), 'hidden_field');
        echo tep_image_submit('edit.gif', TEXT_ENTRY_EDIT, '', DIR_WS_IMAGES);
        echo '</form>';
        ?>
                                  </td>
                                  <td class="entryListing-data" style="width:20px;text-align:center">
                                    <?php 
        echo tep_draw_form('delete_entry', tep_href_link(FILENAME_ADMINISTRATION_EMPLOYEES_ROLES)) . tep_create_parameters(array('action' => 'delete_entry', 'employees_roles_id' => $_SESSION['employee_role']->listing[$index]->id, 'roles_id' => $_SESSION['employee_role']->listing[$index]->role->id, 'employees_id' => $_SESSION['employee_role']->listing[$index]->employee->id, 'employees_roles_start_date' => $_SESSION['employee_role']->listing[$index]->start_date, 'employees_roles_end_date' => $_SESSION['employee_role']->listing[$index]->end_date), array('mPath', 'projects_id'), 'hidden_field');
        echo tep_image_submit('delete.gif', TEXT_ENTRY_DELETE, '', DIR_WS_IMAGES);
        echo '</form>';
        ?>
예제 #3
0
        $projects_calculated_hours_used_percentage = $project_array[$index]['projects_calculated_hours'] != 0 ? round($project_array[$index]['projects_calculated_hours_used'] / $project_array[$index]['projects_calculated_hours'] * 100) . '%' : BODY_TEXT_NOT_APPLICABLE;
        ?>
                    <tr class="projectListing-<?php 
        echo $projects_calculated_hours_used_percentage >= 100 ? 'red' : ($projects_calculated_hours_used_percentage >= 75 ? 'orange' : 'green');
        ?>
">
                      <td class="projectListing-data"><?php 
        echo $project_array[$index]['projects_name'];
        ?>
</td>
                      <td class="projectListing-data"><?php 
        echo tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $project_array[$index]['projects_start_date']));
        ?>
</td>
                      <td class="projectListing-data"><?php 
        echo $project_array[$index]['projects_end_date'] != '2099-12-31' ? tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $project_array[$index]['projects_end_date'])) : BODY_TEXT_NOT_APPLICABLE;
        ?>
</td>
                      <td class="projectListing-data"><?php 
        echo $project_array[$index]['projects_calculated_hours'] != 0 ? $project_array[$index]['projects_calculated_hours'] : BODY_TEXT_NOT_APPLICABLE;
        ?>
</td>
                      <td class="projectListing-data"><?php 
        echo $project_array[$index]['projects_calculated_hours'] != 0 ? $PROJECTS_CALCULATED_HOURS_PERIOD[$project_array[$index]['projects_calculated_hours_period']] : BODY_TEXT_NOT_APPLICABLE;
        ?>
</td>
                      <td class="projectListing-data"><?php 
        echo tep_number_db_to_user($project_array[$index]['projects_calculated_hours_used'], 2);
        ?>
</td>
                      <td class="projectListing-data"><?php 
예제 #4
0
 $periodstartdate = $database->prepare_input(tep_periodstartdate($_POST['period']));
 $employees_query_string = 'SELECT ts.timesheets_start_date, ts.timesheets_end_date, cus.customers_id, cus.customers_name, cus.customers_billing_show_logo, bu.business_units_image, bu.business_units_image_position, pr.projects_id, pr.projects_name, rl.roles_id, rl.roles_name, rl.roles_mandatory_ticket_entry, act.activities_date, emp.employees_id, emp.employees_fullname, act.activities_amount, units.units_id, units.units_name, tar.tariffs_amount, act.activities_travel_distance, act.activities_expenses, act.activities_ticket_number, act.activities_expenses + (act.activities_amount * tar.tariffs_amount) AS total, act.activities_comment ' . 'FROM ' . TABLE_TIMESHEETS . ' AS ts ' . 'INNER JOIN (' . TABLE_EMPLOYEES . ' AS emp, ' . TABLE_ACTIVITIES . ' AS act, ' . TABLE_UNITS . ', ' . TABLE_TARIFFS . ' AS tar, ' . TABLE_EMPLOYEES_ROLES . ' AS er, ' . TABLE_ROLES . ' AS rl, ' . TABLE_PROJECTS . ' AS pr, ' . TABLE_CUSTOMERS . ' AS cus, ' . TABLE_BUSINESS_UNITS . ' AS bu) ' . 'ON (ts.employees_id = emp.employees_id ' . 'AND act.timesheets_id = ts.timesheets_id ' . 'AND act.tariffs_id = tar.tariffs_id ' . 'AND units.units_id = tar.units_id ' . 'AND er.employees_roles_id = tar.employees_roles_id ' . 'AND rl.roles_id = er.roles_id ' . 'AND pr.projects_id = rl.projects_id ' . 'AND cus.customers_id = pr.customers_id ' . 'AND bu.business_units_id = pr.business_units_id) ' . 'WHERE ts.timesheets_start_date = "' . $periodstartdate . '" ' . 'ORDER BY emp.employees_id, act.activities_date, cus.customers_id, pr.projects_id, rl.roles_id, units.units_id';
 $employees_query = $database->query($employees_query_string);
 $employees_array = array();
 $employees_id = '';
 $table_header_set = false;
 while ($employees_result = $database->fetch_array($employees_query)) {
     if ($employees_id != $employees_result['employees_id']) {
         $employees_id = $employees_result['employees_id'];
         if ($table_header_set) {
             // A previous table exists, create a footer for that one
             $pdf->ConsolidatedProjectsTableFooter($total_amount, $total_value, $total_travel_distance, $total_expenses);
             $pdf->AddPage();
         }
         // Create a new Employee header
         $pdf->ConsolidatedProjectsHeader(tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $employees_result['timesheets_start_date'])) . ' - ' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $employees_result['timesheets_end_date'])), '(' . $employees_result['employees_id'] . ') ' . $employees_result['employees_fullname']);
         // Create a new table header
         $pdf->ConsolidatedProjectsTableHeader();
         $table_header_set = true;
         $total_amount = 0.0;
         $total_value = 0.0;
         $total_travel_distance = 0;
         $total_expenses = 0.0;
     }
     // And we're off creating the table contents
     $pdf->ConsolidatedProjectsTableContents(tep_datetouts('%Y-%m-%d', $employees_result['activities_date']), $employees_result['projects_name'], $employees_result['roles_name'], $employees_result['activities_amount'], $employees_result['units_name'], $employees_result['tariffs_amount'], $employees_result['total'], $employees_result['activities_travel_distance'], $employees_result['activities_expenses'], $employees_result['activities_ticket_number'], $employees_result['activities_comment']);
     $total_amount += $employees_result['activities_amount'];
     $total_value += $employees_result['total'];
     $total_travel_distance += $employees_result['activities_travel_distance'];
     $total_expenses += $employees_result['activities_expenses'];
 }
예제 #5
0
 public function ConsolidatedProjectsTableContents($date, $project_name, $role_name, $activity_amount, $units_name, $tariff = 0.0, $total_value = 0.0, $travel_distance = 0, $expenses = 0.0, $ticket_number = '', $comment = '')
 {
     $this->SetFont('Arial', '', 10);
     $this->Cell(20, 5, tep_strftime(DATE_FORMAT_SHORT, $date), 0, 0, 'C');
     $tempX = $this->GetX();
     $tempY = $this->GetY();
     $this->MultiCell(50, 5, $project_name . "\n" . $role_name, 0, 'L');
     $tempX += 50;
     $tempYMax = $this->GetY();
     $this->SetXY($tempX, $tempY);
     $this->Cell(15, 5, tep_number_db_to_user($activity_amount, 2), 0, 0, 'R');
     $this->MultiCell(39, 5, $units_name, 0, 'L');
     $tempX += 54;
     if ($this->GetY() > $tempYMax) {
         $tempYMax = $this->GetY();
     }
     $this->SetXY($tempX, $tempY);
     if ($this->show_tariff) {
         $this->Cell(15, 5, tep_number_db_to_user($tariff, 2), 0, 0, 'R');
         $this->Cell(22, 5, tep_number_db_to_user($total_value, 2), 0, 0, 'R');
     }
     if ($this->show_travel_distance) {
         $this->Cell(15, 5, $travel_distance, 0, 0, 'R');
     }
     if ($this->show_expenses) {
         $this->Cell(22, 5, tep_number_db_to_user($expenses, 2), 0, 0, 'R');
     }
     if ($this->show_ticket_number) {
         $this->Cell(22, 5, $ticket_number, 0, 0, 'C');
     }
     if ($this->show_comment) {
         $this->MultiCell(0, 5, $comment);
     }
     if ($this->GetY() < $tempYMax) {
         $this->SetY($tempYMax);
     }
     //$this->Ln();
 }
예제 #6
0
 public static function get_former_activity_id($employee_id, $selected_date = null)
 {
     $db_date = tep_strftime(DATE_FORMAT_DATABASE, $selected_date);
     $database = $_SESSION['database'];
     $activity_query = $database->query("SELECT a.activities_id, " . "a.tariffs_id " . "FROM " . TABLE_ACTIVITIES . " AS a, " . TABLE_TIMESHEETS . " AS t " . "WHERE a.timesheets_id = t.timesheets_id " . "AND t.employees_id = '" . $employee_id . "' " . "AND a.activities_date < '" . $db_date . "' " . "ORDER BY a.activities_date DESC, a.activities_id DESC;");
     $activity_result = $database->fetch_array($activity_query);
     if (tep_not_null($activity_result)) {
         // There is a resultset, keep the activity_id for now and
         // check if the activity is valid for the given employee and date
         $former_activity_id = $activity_result['activities_id'];
         $tariffs_id = $activity_result['tariffs_id'];
         // The complicated way: check the entire tree for validation
         /* $activity_query = $database->query("SELECT 1" .
            " FROM " . TABLE_PROJECTS . " AS p, " . TABLE_ROLES . " AS r, " . TABLE_EMPLOYEES_ROLES . " AS er, " . TABLE_TARIFFS . " AS t" .
            " WHERE p.projects_id = r.projects_id" .
            " AND r.roles_id = er.roles_id" .
            " AND er.employees_roles_id = t.employees_roles_id" .
            " AND er.employees_id = '" . $employee_id . "'" .
            " AND t.tariffs_id = '" . $tariffs_id . "'" .
            " AND p.projects_start_date <= '" . $db_date . "'" .
            " AND p.projects_end_date >= '" . $db_date . "'" .
            " AND er.employees_roles_start_date <= '" . $db_date . "'" .
            " AND er.employees_roles_end_date >= '" . $db_date . "'" .
            " AND t.tariffs_start_date <= '" . $db_date . "'" .
            " AND t.tariffs_end_date >= '" . $db_date . "'"); */
         // The easy way: just validate against the obtained tariffs_id
         $activity_query = $database->query("SELECT 1 " . "FROM " . TABLE_TARIFFS . " AS t " . "WHERE t.tariffs_id = '" . $tariffs_id . "' " . "AND t.tariffs_start_date <= '" . $db_date . "' " . "AND t.tariffs_end_date >= '" . $db_date . "';");
         $activity_result = $database->fetch_array($activity_query);
         if (tep_not_null($activity_result)) {
             // Activity is valid for given employee and date
             return $former_activity_id;
         } else {
             // Activity is not valid for given employee and date
             return -1;
         }
     } else {
         // No former activity exists
         return 0;
     }
 }
                    <td align="right" class="infoBoxHeading">
                      <?php 
echo tep_image_submit('arrow_right.gif', TEXT_TIMEREGISTRATION_FORWARD, '', DIR_WS_IMAGES);
?>
                    </td>
                  </form>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td align="center">
              <table border="0px" width="20%" cellspacing="0" cellpadding="3" class="infoBoxContents">
                <tr>
                  <td align="center" class="boxText"><?php 
echo tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $_SESSION['timesheet']->start_date)) . '&nbsp;&nbsp;-&nbsp;&nbsp;' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $_SESSION['timesheet']->end_date));
?>
</td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '20');
?>
</td>
          </tr>
          <tr>
            <td align="center" class="main"><?php 
echo TEXT_TIMEREGISTRATION_CALENDAR_DESCRIPTION;
예제 #8
0
 public function has_duplicates($start_date, $end_date, $roles_id, $employees_id)
 {
     $database = $_SESSION['database'];
     $duplicates_query = $database->query("select 1 from " . TABLE_EMPLOYEES_ROLES . " where employees_roles_id != " . (tep_not_null($this->id) ? $this->id : 0) . " and roles_id = " . $roles_id . " and employees_id = " . $employees_id . " and employees_roles_start_date <= '" . ($end_date != 0 ? tep_strftime(DATE_FORMAT_DATABASE, $end_date) : '2099-12-31') . "'" . " and employees_roles_end_date >= '" . tep_strftime(DATE_FORMAT_DATABASE, $start_date) . "'");
     $duplicates_result = $database->fetch_array($duplicates_query);
     return tep_not_null($duplicates_result);
 }
예제 #9
0
                    <td align="right" class="infoBoxHeading">
                      <?php 
echo tep_image_submit('arrow_right.gif', TEXT_ANALYSIS_FORWARD, '', DIR_WS_IMAGES);
?>
                    </td>
                  </form>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td align="center">
              <table border="0px" width="20%" cellspacing="0" cellpadding="3" class="infoBoxContents">
                <tr>
                  <td align="center" class="boxText"><?php 
echo tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', tep_periodstartdate($_POST['period']))) . '&nbsp;&nbsp;-&nbsp;&nbsp;' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', tep_periodenddate($_POST['period'])));
?>
</td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '20');
?>
</td>
          </tr>
          <tr>
            <td>
              <table border="0" cellspacing="0" cellpadding="0">
예제 #10
0
?>
</td>
                </tr>
                <tr>
                  <td width="50%" class="item_entry"><?php 
echo TEXT_ACTIVITY_TICKETNUMBER;
?>
</td>
                  <td colspan="2" width="50%" class="item_entry"><?php 
echo tep_draw_input_field('activity_ticket_number', '', 'size="1" maxlength="16" style="width: 100%"' . ($_POST['action'] == 'enter_data' || $_POST['action'] == 'save_data' ? '' : ' disabled'));
?>
</td>
                  <td width="22px" class="item_entry">
                    <?php 
if (ENABLE_TICKET_DATABASE_LOOKUPS && ($_POST['action'] == 'enter_data' || $_POST['action'] == 'save_data')) {
    echo tep_image_button('button_lookup.gif', TEXT_ACTIVITY_TICKETNUMBER_LOOKUP, 'onClick="fetchTicketNrAndDescription(\'' . tep_strftime('%Y-%m-%d', $_POST['selected_date']) . '\');"');
    //echo tep_image(DIR_WS_LANGUAGES . $_SESSION['language'] . '/images/buttons/button_lookup.gif', '', '', '', 'onClick="fetchTicketNrAndDescription(\'' . tep_strftime('%Y-%m-%d', $_POST['selected_date']) . '\');"');
} else {
    echo tep_image(DIR_WS_LANGUAGES . $_SESSION['language'] . '/images/buttons/button_lookup_disabled.gif');
}
?>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td class="item_entry">
              <?php 
echo TEXT_ACTIVITY_COMMENT;
?>
예제 #11
0
 public function save()
 {
     $database = $_SESSION['database'];
     // Insert a new benefit if one does not exist and retrieve the id
     if ($this->id == 0) {
         // The benefit does not exist
         $database->query("insert into " . TABLE_BENEFITS . " (benefits_start_date, benefits_end_date, benefits_credit, benefits_granted, benefits_comment, employees_id, roles_id) values ('" . tep_strftime(DATE_FORMAT_DATABASE, $this->start_date) . "', '" . ($this->end_date != 0 ? tep_strftime(DATE_FORMAT_DATABASE, $this->end_date) : '2099-12-31') . "', '" . $this->credit . "', '" . $this->granted . "', '" . $this->comment . "', '" . $this->employee->id . "', '" . $this->role->id . "')");
         $this->id = $database->insert_id();
         // The proper id is now known
     } else {
         // The benefit exists, update the contents
         $this->id = $database->prepare_input($this->id);
         $benefit_query = $database->query("update " . TABLE_BENEFITS . " set benefits_start_date='" . tep_strftime(DATE_FORMAT_DATABASE, $this->start_date) . "', benefits_end_date='" . ($this->end_date != 0 ? tep_strftime(DATE_FORMAT_DATABASE, $this->end_date) : '2099-12-31') . "', benefits_credit='" . $this->credit . "', benefits_granted='" . $this->granted . "', benefits_comment='" . $this->comment . "', employees_id='" . $this->employee->id . "', roles_id='" . $this->role->id . "' where benefits_id = '" . (int) $this->id . "'");
     }
 }
예제 #12
0
require 'includes/application_top.php';
// CSV class
require DIR_WS_CLASSES . 'csv.php';
// Check if user is logged in. If not, redirect to login page
if (!tep_not_null($_SESSION['employee'])) {
    tep_redirect(tep_href_link(FILENAME_LOGIN));
}
// Check if the user is allowed to view this page
if (!$_SESSION['employee']->profile->right['analysis']) {
    tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
// Create a CSV object
$csv = new CSV($_POST['action'] . '.csv', ';', '');
// Delimiters chosen to be ms-excel compatible
switch ($_POST['action']) {
    case 'export_activities':
        $database = $_SESSION['database'];
        $periodstartdate = $database->prepare_input(tep_periodstartdate($_POST['period']));
        $activities_query_string = 'SELECT cus.customers_id, cus.customers_name, cus.customers_id_external, ts.timesheets_start_date, ts.timesheets_end_date, pr.projects_name, bu.business_units_name, rl.roles_name, cat.categories_name, act.activities_date, emp.employees_id, emp.employees_fullname, act.activities_amount, units.units_name, tar.tariffs_amount, act.activities_travel_distance, act.activities_expenses, act.activities_ticket_number, act.activities_comment ' . 'FROM ' . TABLE_TIMESHEETS . ' AS ts ' . 'INNER JOIN (' . TABLE_EMPLOYEES . ' AS emp, ' . TABLE_ACTIVITIES . ' AS act, ' . TABLE_UNITS . ', ' . TABLE_TARIFFS . ' AS tar, ' . TABLE_EMPLOYEES_ROLES . ' AS er, ' . TABLE_ROLES . ' AS rl, ' . TABLE_CATEGORIES . ' AS cat, ' . TABLE_PROJECTS . ' AS pr, ' . TABLE_CUSTOMERS . ' AS cus, ' . TABLE_BUSINESS_UNITS . ' AS bu) ' . 'ON (ts.employees_id = emp.employees_id ' . 'AND act.timesheets_id = ts.timesheets_id ' . 'AND act.tariffs_id = tar.tariffs_id ' . 'AND units.units_id = tar.units_id ' . 'AND er.employees_roles_id = tar.employees_roles_id ' . 'AND rl.categories_id = cat.categories_id ' . 'AND rl.roles_id = er.roles_id ' . 'AND pr.projects_id = rl.projects_id ' . 'AND cus.customers_id = pr.customers_id ' . 'AND bu.business_units_id = pr.business_units_id) ' . 'WHERE ts.timesheets_start_date = "' . $periodstartdate . '" ' . 'ORDER BY cus.customers_id, pr.projects_id, rl.roles_id, act.activities_date, emp.employees_id, units.units_id';
        $activities_query = $database->query($activities_query_string);
        $csv->addrow(array('customers_id', 'customers_name', 'customers_id_external', 'period_start_date', 'period_end_date', 'projects_name', 'business_units_name', 'roles_name', 'activities_date', 'employees_id', 'employees_fullname', 'amount', 'units_name', 'tariff', 'travel_distance', 'expenses', 'ticket_number', 'comment', 'categories_name'));
        while ($activities_result = $database->fetch_array($activities_query)) {
            $csv->addrow(array($activities_result['customers_id'], $activities_result['customers_name'], $activities_result['customers_id_external'], tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $activities_result['timesheets_start_date'])), tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $activities_result['timesheets_end_date'])), $activities_result['projects_name'], $activities_result['business_units_name'], $activities_result['roles_name'], tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $activities_result['activities_date'])), $activities_result['employees_id'], $activities_result['employees_fullname'], tep_number_db_to_user($activities_result['activities_amount'], 2), $activities_result['units_name'], tep_number_db_to_user($activities_result['tariffs_amount'], 2), $activities_result['activities_travel_distance'], tep_number_db_to_user($activities_result['activities_expenses'], 2), $activities_result['activities_ticket_number'], str_replace(";", ":", str_replace(array("\r\n", "\n", "\r"), "|", $activities_result['activities_comment'])), $activities_result['categories_name']));
        }
        break;
}
// Get the show on the road
$csv->output('D');
// <!-- application_bottom //-->
require DIR_WS_INCLUDES . 'application_bottom.php';
// <!-- application_bottom_eof //-->
        ?>
</td>
                                  <td class="entryListing-data"  style="text-align:right"><?php 
        echo tep_number_db_to_user($_SESSION['adm_benefits']->listing[$index]->credit + $_SESSION['adm_benefits']->listing[$index]->granted, 2);
        ?>
</td>
                                  <td class="entryListing-data"  style="text-align:right"><?php 
        echo 'gebruikte hoeveelheid';
        ?>
</td>
                                  <td class="entryListing-data"  style="text-align:right"><?php 
        echo tep_number_db_to_user($_SESSION['adm_benefits']->listing[$index]->credit + $_SESSION['adm_benefits']->listing[$index]->granted, 2);
        ?>
</td>
                                  <td class="entryListing-data"><?php 
        echo tep_strftime(DATE_FORMAT_SHORT, $_SESSION['adm_benefits']->listing[$index]->start_date) . '<br>' . ($_SESSION['adm_benefits']->listing[$index]->end_date != 0 ? tep_strftime(DATE_FORMAT_SHORT, $_SESSION['adm_benefits']->listing[$index]->end_date) : '&#8734;');
        ?>
</td>
                                  <td class="entryListing-data" style="width:20px;text-align:center">
                                    <?php 
        echo tep_draw_form('edit_entry', tep_href_link(FILENAME_ADMINISTRATION_BENEFITS)) . tep_create_parameters(array('action' => 'enter_data', 'benefits_id' => $_SESSION['adm_benefits']->listing[$index]->id, 'benefits_credit' => $_SESSION['adm_benefits']->listing[$index]->credit, 'benefits_granted' => $_SESSION['adm_benefits']->listing[$index]->granted, 'benefits_comment' => $_SESSION['adm_benefits']->listing[$index]->comment, 'roles_id' => $_SESSION['adm_benefits']->listing[$index]->role->id, 'benefits_start_date' => $_SESSION['adm_benefits']->listing[$index]->start_date, 'benefits_end_date' => $_SESSION['adm_benefits']->listing[$index]->end_date), array('mPath', 'employees_id'), 'hidden_field');
        echo tep_image_submit('edit.gif', TEXT_ENTRY_EDIT, '', DIR_WS_IMAGES);
        echo '</form>';
        ?>
                                  </td>
                                  <td class="entryListing-data" style="width:20px;text-align:center">
                                    <?php 
        echo tep_draw_form('delete_entry', tep_href_link(FILENAME_ADMINISTRATION_BENEFITS)) . tep_create_parameters(array('action' => 'delete_entry', 'benefits_id' => $_SESSION['adm_benefits']->listing[$index]->id, 'benefits_credit' => $_SESSION['adm_benefits']->listing[$index]->credit, 'benefits_granted' => $_SESSION['adm_benefits']->listing[$index]->granted, 'benefits_comment' => $_SESSION['adm_benefits']->listing[$index]->comment, 'roles_id' => $_SESSION['adm_benefits']->listing[$index]->role->id, 'benefits_start_date' => $_SESSION['adm_benefits']->listing[$index]->start_date, 'benefits_end_date' => $_SESSION['adm_benefits']->listing[$index]->end_date), array('mPath', 'employees_id'), 'hidden_field');
        echo tep_image_submit('delete.gif', TEXT_ENTRY_DELETE, '', DIR_WS_IMAGES);
        echo '</form>';
        ?>
예제 #14
0
/****************************************************************************
 * CODE FILE   : footer.php
 * Project     : BitTS - BART it TimeSheet
 * Author(s)   : Erwin Beukhof
 * Date        : 14 april 2008
 * Description : .....
 *               .....
 *               Framework: osCommerce, Open Source E-Commerce Solutions
 *               http://www.oscommerce.com
 */
?>
    <table border="0" width="100%" cellspacing="0" cellpadding="1">
      <tr class="footer">
        <td class="footer">&nbsp;&nbsp;<?php 
echo tep_strftime(DATE_FORMAT_LONG);
?>
&nbsp;&nbsp;</td>
        <td align="right" class="footer">&nbsp;&nbsp;</td>
      </tr>
    </table>
    <br>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" class="smallText"><?php 
echo FOOTER_TEXT_BODY;
?>
</td>
      </tr>
    </table>
    <br>
예제 #15
0
function tep_date_long($raw_date)
{
    if ($raw_date == '0000-00-00 00:00:00' || $raw_date == '') {
        return false;
    }
    $year = (int) substr($raw_date, 0, 4);
    $month = (int) substr($raw_date, 5, 2);
    $day = (int) substr($raw_date, 8, 2);
    $hour = (int) substr($raw_date, 11, 2);
    $minute = (int) substr($raw_date, 14, 2);
    $second = (int) substr($raw_date, 17, 2);
    return tep_strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year));
}