} $pdf->AddPage(); } $pdf->InvoiceHeader($projects_result['business_units_image'], $projects_result['business_units_image_position'], $projects_result['customers_name'], tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $projects_result['timesheets_start_date'])) . ' - ' . tep_strftime(DATE_FORMAT_SHORT, tep_datetouts('%Y-%m-%d', $projects_result['timesheets_end_date'])), $projects_result['projects_name'], $projects_result['roles_name'], $_POST['per_employee'] || $_POST['current_employee'] ? $projects_result['employees_fullname'] : ''); $units_id = ''; // To trigger a new table header later on } if ($units_id != $projects_result['units_id']) { if ($table_header_set) { // A previous table exists, create a footer for that one $pdf->InvoiceTableFooter($total_amount, $total_travel_distance, $total_expenses, $total_value); $pdf->Ln(5); // Skip a few mm } // Create a new table header $pdf->InvoiceTableHeader($projects_result['units_name'] . ($_POST['per_employee'] && $_POST['show_tariff'] ? REPORT_TABLE_HEADER_IS_TARIFF . tep_number_db_to_user($projects_result['tariffs_amount'], 2) : ''), $_POST['per_employee'] || $_POST['current_employee'], $_POST['show_tariff'], $_POST['show_travel_distance'], $_POST['show_expenses'], $projects_result['roles_mandatory_ticket_entry'] == '1', $_POST['show_comment']); $table_header_set = true; $total_amount = 0.0; $total_travel_distance = 0; $total_expenses = 0.0; $total_value = 0.0; $units_id = $projects_result['units_id']; } // And we're off creating the table contents $pdf->InvoiceTableContents(tep_datetouts('%Y-%m-%d', $projects_result['activities_date']), $projects_result['employees_fullname'], $projects_result['activities_amount'], $projects_result['units_name'], $projects_result['tariffs_amount'], $projects_result['activities_travel_distance'], $projects_result['activities_expenses'], $projects_result['activities_ticket_number'], $projects_result['total'], $projects_result['activities_comment']); $total_amount += $projects_result['activities_amount']; $total_travel_distance += $projects_result['activities_travel_distance']; $total_expenses += $projects_result['activities_expenses']; $total_value += $projects_result['total']; } if ($table_header_set) {
public function ConsolidatedProjectsTableFooter($total_amount = 0.0, $total_value = 0.0, $total_travel_distance = 0, $total_expenses = 0.0) { $this->SetLineWidth(0.3); $this->SetFont('Arial', 'B', 10); $tempX = $this->GetX() + 70; $tempY = $this->GetY(); $this->SetXY($tempX, $tempY); $this->Cell(15, 5, tep_number_db_to_user($total_amount, 2), 'T', 0, 'R'); $tempX += 54; if ($this->show_tariff) { $tempX += 15; $this->SetXY($tempX, $tempY); $this->Cell(22, 5, tep_number_db_to_user($total_value, 2), 'T', 0, 'R'); $tempX += 22; } if ($this->show_travel_distance) { $this->SetXY($tempX, $tempY); $this->Cell(15, 5, $total_travel_distance, 'T', 0, 'R'); $tempX += 15; } if ($this->show_expenses) { $this->SetXY($tempX, $tempY); $this->Cell(22, 5, tep_number_db_to_user($total_expenses, 2), 'T', 0, 'R'); } $this->Ln(); }
?> </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 echo $projects_calculated_hours_used_percentage; ?> </td> </tr> <?php } ?> </table> </td> </tr> <?php }
break; case 0: // No activity data available $_POST['action'] = 'select_project'; $error_level = 64; break; default: // Retrieve activity details $_POST['activity_id'] = 0; $_POST['projects_id'] = $_SESSION['timesheet']->former_activity->projects_id; $_POST['roles_id'] = $_SESSION['timesheet']->former_activity->roles_id; $_POST['activity_amount'] = tep_number_db_to_user($_SESSION['timesheet']->former_activity->amount, 2); $_POST['tariffs_id'] = $_SESSION['timesheet']->former_activity->tariff->id; $_POST['activity_travel_distance'] = "" . $_SESSION['timesheet']->former_activity->travel_distance; $_POST['activity_travel_description'] = "" . $_SESSION['timesheet']->former_activity->travel_description; $_POST['activity_expenses'] = tep_number_db_to_user($_SESSION['timesheet']->former_activity->expenses, 2); $_POST['activity_ticket_number'] = $_SESSION['timesheet']->former_activity->ticket_number; $_POST['activity_comment'] = $_SESSION['timesheet']->former_activity->comment; $_POST['action'] = 'enter_data'; } } if ($_POST['action'] == 'save_data') { // Check for data format and required fields // change action when not everything is filled-in if ($_POST['selected_date'] == '') { $_POST['action'] = ''; } else { if ($_POST['projects_id'] == '') { $_POST['action'] = 'select_project'; $error_level = 1; } else {
<?php } for ($counter = $calendar_start; $counter <= $calendar_end; $counter++, $calendar_day++, $colindex++) { if ($colindex % 7 == 0) { ?> </tr> <tr> <?php } ?> <td class="<?php echo $counter == $today ? 'large-calendar-today' : ($colindex % 7 >= 0 && $colindex % 7 <= 4 ? $counter < $today && $total_amount_per_day[$calendar_day] < MINIMUM_HOURS_PER_DAY ? 'large-calendar-weekday-minimum-not-met' : 'large-calendar-weekday' : 'large-calendar-weekend'); ?> "> <?php echo '<b>' . $calendar_day . '</b><br> <br>' . ($total_amount_per_day[$calendar_day] != 0 ? tep_number_db_to_user($total_amount_per_day[$calendar_day], 2) : ' ') . '<br> '; ?> </td> <?php } // Walk the rest of the cells to complete the current row for ($restindex = $colindex % 7; $restindex > 0 && $restindex <= 6; $restindex++) { ?> <td class="<?php echo $restindex >= 0 && $restindex <= 4 ? 'large-calendar-notavailable' : 'large-calendar-notavailable'; ?> "> </td> <?php } ?> </tr>
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 //-->
/**************************************************************************** * CODE FILE : benefits.php * Project : BitTS - BART it TimeSheet * Author(s) : Erwin Beukhof * Date : 16 march 2011 * Description : Information box listing granted benefits * * Framework: osCommerce, Open Source E-Commerce Solutions * http://www.oscommerce.com */ $_SESSION['benefit'] = new benefit(0, $_SESSION['employee']->id, $_POST['period']); if (!$_SESSION['benefit']->isempty) { ?> <!-- benefits //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_BENEFITS); new infoBoxHeading($info_box_contents, false, false); $benefits_total = $_SESSION['benefit']->credit + $_SESSION['benefit']->granted; $benefits_remaining = $benefits_total - $_SESSION['benefit']->used; $info_box_contents = array(); $info_box_contents[] = array('text' => "<table width='100%'><tr><td class='infoBoxContents'>" . BOX_BENEFITS_CREDIT . "</td><td class='infoBoxContentsRight'>" . tep_number_db_to_user($_SESSION['benefit']->credit, 2) . BOX_BENEFITS_HOURS . "</td></tr>" . "<tr><td class='infoBoxContents'>" . BOX_BENEFITS_GRANTED . "</td><td class='infoBoxContentsRight'>" . tep_number_db_to_user($_SESSION['benefit']->granted, 2) . BOX_BENEFITS_HOURS . "</td></tr>" . "<tr><td class='infoBoxContentsRight'>+</td><td class='infoBoxContentsRight'><hr></td></tr>" . "<tr><td class='infoBoxContents'>" . BOX_BENEFITS_TOTAL . "</td><td class='infoBoxContentsRight'>" . tep_number_db_to_user($benefits_total, 2) . BOX_BENEFITS_HOURS . "</td></tr>" . "<tr><td class='infoBoxContents'>" . BOX_BENEFITS_USED . "</td><td class='infoBoxContentsRight'>" . tep_number_db_to_user($_SESSION['benefit']->used, 2) . BOX_BENEFITS_HOURS . "</td></tr>" . "<tr><td class='infoBoxContentsRight'>-</td><td class='infoBoxContentsRight'><hr></td></tr>" . "<tr><td class='infoBoxContents'>" . BOX_BENEFITS_REMAINING . "</td><td class='infoBoxContentsRight'>" . tep_number_db_to_user($benefits_remaining, 2) . BOX_BENEFITS_HOURS . "<br>(" . tep_number_db_to_user($benefits_remaining / MINIMUM_HOURS_PER_DAY, 2) . BOX_BENEFITS_DAYS . ")</td></tr></table>"); new infoBox($info_box_contents); ?> </td> </tr> <!-- benefits_eof //--> <?php }
?> </td> <td class="entryListing-data" style="text-align:right"><?php echo tep_number_db_to_user($_SESSION['adm_benefits']->listing[$index]->granted, 2); ?> </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) : '∞'); ?> </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
<td class="entryListing-data"><?php echo tep_number_db_to_user($_SESSION['timesheet']->activities[$index]->expenses, 2); ?> </td> <td class="entryListing-data"><?php echo $_SESSION['timesheet']->activities[$index]->ticket_number; ?> </td> <td class="entryListing-data"><?php echo tep_txt2html($_SESSION['timesheet']->activities[$index]->comment); ?> </td> <td align="center" width="20" class="entryListing-data"> <?php if (!$_SESSION['timesheet']->locked) { echo tep_draw_form('edit_activity', tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('action' => 'enter_data', 'selected_date' => $_SESSION['timesheet']->activities[$index]->date, 'projects_id' => $_SESSION['timesheet']->activities[$index]->projects_id, 'roles_id' => $_SESSION['timesheet']->activities[$index]->roles_id, 'activity_id' => $_SESSION['timesheet']->activities[$index]->activity_id, 'activity_amount' => tep_number_db_to_user($_SESSION['timesheet']->activities[$index]->amount, 2), 'original_activity_amount' => $_SESSION['timesheet']->activities[$index]->amount, 'tariffs_id' => $_SESSION['timesheet']->activities[$index]->tariff->id, 'activity_travel_distance' => "" . $_SESSION['timesheet']->activities[$index]->travel_distance, 'activity_travel_description' => "" . $_SESSION['timesheet']->activities[$index]->travel_description, 'activity_expenses' => tep_number_db_to_user($_SESSION['timesheet']->activities[$index]->expenses, 2), 'activity_ticket_number' => $_SESSION['timesheet']->activities[$index]->ticket_number, 'activity_comment' => $_SESSION['timesheet']->activities[$index]->comment), array('mPath', 'period', 'sort_order'), 'hidden_field'); echo tep_image_submit('edit.gif', TEXT_ENTRY_EDIT, '', DIR_WS_IMAGES); echo '</form>'; } ?> </td> <td align="center" width="20" class="entryListing-data"> <?php if (!$_SESSION['timesheet']->locked) { echo tep_draw_form('delete_activity', tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('action' => 'delete_activity', 'activity_id' => $_SESSION['timesheet']->activities[$index]->activity_id), array('mPath', 'period', 'sort_order'), 'hidden_field'); echo tep_image_submit('delete.gif', TEXT_ENTRY_DELETE, '', DIR_WS_IMAGES); echo '</form>'; } ?> </td> </tr>
?> </td> <td class="entryListing-heading" style="width:20px"> </td> <td class="entryListing-heading" style="width:20px"> </td> </tr> <?php if (tep_not_null($_POST['projects_id']) && tep_not_null($_POST['employees_roles_id']) && !$_SESSION['tariff']->listing_empty) { $odd_or_even = "odd"; for ($index = 0; $index < sizeof($_SESSION['tariff']->listing); $index++) { ?> <tr class="entryListing-<?php echo $odd_or_even; ?> " style="vertical-align:top"> <td class="entryListing-data"><?php echo tep_number_db_to_user($_SESSION['tariff']->listing[$index]->amount, 2); ?> </td> <td class="entryListing-data"><?php echo $_SESSION['tariff']->listing[$index]->unit->name; ?> </td> <td class="entryListing-data"><?php echo tep_strftime(DATE_FORMAT_SHORT, $_SESSION['tariff']->listing[$index]->start_date) . '<br>' . ($_SESSION['tariff']->listing[$index]->end_date != 0 ? tep_strftime(DATE_FORMAT_SHORT, $_SESSION['tariff']->listing[$index]->end_date) : '∞'); ?> </td> <td class="entryListing-data" style="width:20px;text-align:center"> <?php echo tep_draw_form('edit_entry', tep_href_link(FILENAME_ADMINISTRATION_TARIFFS)) . tep_create_parameters(array('action' => 'enter_data', 'tariffs_id' => $_SESSION['tariff']->listing[$index]->id, 'tariffs_amount' => $_SESSION['tariff']->listing[$index]->amount, 'units_id' => $_SESSION['tariff']->listing[$index]->unit->id, 'tariffs_start_date' => $_SESSION['tariff']->listing[$index]->start_date, 'tariffs_end_date' => $_SESSION['tariff']->listing[$index]->end_date), array('mPath', 'projects_id', 'employees_roles_id'), 'hidden_field'); echo tep_image_submit('edit.gif', TEXT_ENTRY_EDIT, '', DIR_WS_IMAGES); echo '</form>';