project_account_csv.php 752 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. /**
  3. * @var Template $template
  4. * @var object[] $fields
  5. * @var resource $handle
  6. * @var Test[] $tests
  7. * @var Constraint $year_cycle_constraint
  8. */
  9. $config = $template->getConfiguration();
  10. $field_names = [
  11. "Internal ID",
  12. "Location Name",
  13. "Template Name",
  14. "Date",
  15. "Test ID",
  16. "Test Cost",
  17. ];
  18. fputcsv($handle, $field_names);
  19. foreach($tests as $test) {
  20. $location = $test->getLocation();
  21. $project = $test->getProject();
  22. $output = [];
  23. $output[] = $location->internal_id;
  24. $output[] = $location->name;
  25. $output[] = $template->name;
  26. $output[] = $test->getDateTimeStart()->format("d/m/Y");
  27. $output[] = $test->id;
  28. $output[] = $test->getCustomerFee();
  29. fputcsv($handle, $output);
  30. }