public function executeRs2(sfWebRequest $request) { $this->form = new ReportRs2Form(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $from_date = $this->form->getValue('from_date'); $from_date = mktime(0, 0, 0, $from_date['month'], 1, $from_date['year']); $to_date = $this->form->getValue('to_date'); $to_date = mktime(0, 0, 0, $to_date['month'], 1, $to_date['year']); $to_date = strtotime('+1 month -1 second', $to_date); $c = new Criteria(); $c->add(NoteEntryPeer::SERVICE_DATE, $from_date, Criteria::GREATER_EQUAL); $c->addAnd(NoteEntryPeer::SERVICE_DATE, $to_date, Criteria::LESS_EQUAL); // sort by kid last name $c->addJoin(NoteEntryPeer::CLIENT_ID, ClientPeer::ID); $c->addAscendingOrderByColumn(ClientPeer::LAST_NAME); $note_entries = NoteEntryPeer::doSelectJoinAll($c); $this->months = $this->get_months($from_date, $to_date); $default_array = array('Physical Therapist' => $this->months, 'Occupational Therapist' => $this->months, 'Speech Language Pathologist' => $this->months, 'Psychologist' => $this->months); $this->report = array(); foreach ($note_entries as $entry) { $client_id = $entry->getClient()->getFullName(); $service_month = $entry->getServiceDate('F'); $job = $entry->getEmployee()->getJob()->getName(); if (!array_key_exists($client_id, $this->report)) { $this->report[$client_id] = $default_array; } if ($entry->getAbsent()) { if (is_array($this->report[$client_id][$job]) && array_key_exists($service_month, $this->report[$client_id][$job])) { $this->report[$client_id][$job][$service_month]['absent'][NoteEntryPeer::getAbsentName($entry->getAbsent())] += $entry->getUnits(); } else { $this->report[$client_id][$job][$service_month]['absent'][NoteEntryPeer::getAbsentName($entry->getAbsent())] = $entry->getUnits(); } } else { if (is_array($this->report[$client_id][$job]) && array_key_exists($service_month, $this->report[$client_id][$job])) { if (is_object($entry->getFrequency())) { $freq = $entry->getFrequency()->getName(); } else { $freq = 'Units'; } if (!array_key_exists($freq, $this->report[$client_id][$job][$service_month]['units'])) { $this->report[$client_id][$job][$service_month]['units'][$freq] = 0.0; } $this->report[$client_id][$job][$service_month]['units'][$freq] += $entry->getUnits(); } else { $this->report[$client_id][$job][$service_month]['units'][$freq] = $entry->getUnits(); } } } array('client_id' => array('ot' => array('month' => array('units' => array('frequency' => 'unit count'), 'absent' => array('1' => 'teacher absent count', '2' => 'student absent count', '3' => 'school closing count'))))); return 'Report'; } } }
echo $entry->getCptCode(); ?> </td> <th>Units:</th> <td><?php echo $entry->getUnits(); ?> </td> </tr> <tr> <th colspan="2"> <?php if ($entry->getAbsent()) { ?> <?php echo NoteEntryPeer::getAbsentName($entry->getAbsent()); ?> TA-UNBILLED <?php } else { ?> <?php if ($entry->countNoteEntryKidss()) { ?> Group:<?php } else { ?> Individual<?php } ?> BILLED