public function printFailureCodes()
 {
     // set options
     $options = array('type' => array('pdf' => '', 'xml' => '', 'csv' => ''), 'output' => array('print' => '', 'save' => '', 'email' => '', 'view' => ''), 'report' => 'cs_failure_codes', 'filename' => $this->generate_collection_name(TRUE));
     // we use status in other print functions, however here we base it on if ajax print is or isn't set
     if (!$this->isPrinting()) {
         return $options;
     }
     $errors = array();
     $s_data = $this->setSearch();
     $customerservice = new CustomerServiceCollection($this->_templateobject);
     $sh = $customerservice->setSearch($s_data);
     $servicesummary = $customerservice->failureCodeSummary($sh);
     $count = 0;
     $data = array();
     foreach ($servicesummary as $group => $detail) {
         foreach ($detail as $key => $fields) {
             if ($fields['description'] == ' - ') {
                 $fields['description'] = 'No Failure Codes';
             }
             if ($this->_data['print']['printtype'] === 'csv') {
                 $data[$count] = $fields;
             } else {
                 $data[$count]['data'] = $fields;
             }
             $count++;
         }
     }
     if ($this->_data['print']['printtype'] === 'csv') {
         // generate the csv and add it to the options array
         $options['csv_source'] = $this->generate_csv($this->_data['print'], $data, array('Failure Description', 'Count', 'Period'));
     } else {
         $extra['title'] = 'Customer Service Failure Code Summary ';
         $extra['cs_failure_codes'] = $data;
         // generate the xml and add it to the options array
         $options['xmlSource'] = $this->generateXML(array('extra' => $extra));
     }
     // fire the print output, echo the output JSON for jQuery to handle
     echo $this->generate_output($this->_data['print'], $options);
     exit;
 }