示例#1
0
 public function pdf()
 {
     $title = "This is the report title";
     $headers = array('Col 1', 'Col 2', 'Col 3', 'Col 4');
     $sizes = array(40, 40, 40, 158);
     $max_sizes = array(40, 35, 40, 100);
     $data = array(array('Row 1', 'Data ', 'Data', 'Sorry your payment is not ready, work hard to be included in the next payment on September 2015. Sematel, Let the music speak!'), array('Row 2', 'Data ', 'Data', 'Sorry your payment is not ready, work hard to be included in the next payment on September 2015. '), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 1', 'Data ', 'Data', 'Data'), array('Row 2', 'Data ', 'Data', 'Data'), array('Row 3', 'Data ', 'Data', 'Data'), array('Row 4', 'Data ', 'Data', 'Data'), array('Row 5', 'Data ', 'Data', 'Data'), array('Row 6', 'Data ', 'Data', 'Data'), array('Row 7', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'), array('Row 8', 'Data ', 'Data', 'Data'));
     $pdf = new PDF($title, $data, $headers, $sizes, $max_sizes);
     $pdf->Output();
 }
示例#2
0
 public function subscriptions_pdf()
 {
     /*
     	Initialize the request data
     */
     //get request data
     $subscriber_id = Request::get('subscriber_id');
     $service_id = Request::get('service_id');
     $product_id = Request::get('product_id');
     $update_type = Request::get('update_type');
     $start_date = Request::get('start_date');
     $end_date = Request::get('end_date');
     //set default start date - 1 month ago
     if (!isset($start_date) || $start_date == '') {
         $date = date_create(date('Y-m-d'));
         date_sub($date, date_interval_create_from_date_string('1 months'));
         $start_date = date_format($date, 'Y-m-d');
     }
     //set default end date  - current day
     if (!isset($end_date) || $end_date == '') {
         $end_date = date('Y-m-d');
     }
     //request data to be used in calling the model
     $data = array('subscriber_id' => $subscriber_id, 'service_id' => $service_id, 'product_id' => $product_id, 'update_type' => $update_type, 'start_date' => $start_date, 'end_date' => $end_date);
     //log the event
     $this->logger->debug('{class_mame}|{method_name}|request|request-data:{data}', array('class_mame' => __CLASS__, 'method_name' => __FUNCTION__, 'data' => json_encode($data)));
     //call the model
     $model = new MessageModel($this->logger);
     $result = $model->getSubscriptionMessages($start_date . ' 00:00:00', $end_date . ' 23:59:59', $subscriber_id, $service_id, $product_id, $update_type, 0, Config::get('MAX_RECORDS_PDF'));
     //add result
     $data['result'] = $result;
     //print_r($result);
     //request data to be used in calling the model
     $data = array('subscriber_id' => $subscriber_id, 'service_id' => $service_id, 'product_id' => $product_id, 'update_type' => $update_type, 'start_date' => $start_date, 'end_date' => $end_date);
     $title = "Subscription Requests Extract - Subscriber: {$subscriber_id}, Service ID: {$service_id}, Product ID: {$product_id}, Update Type: {$update_type}, Start Date: {$start_date}, End Date: {$end_date}";
     $headers = array('#', 'Subscriber', 'Service ID', 'Product ID', 'Update Type', 'Effective Time', 'Expiry Time', 'Processing Time');
     $sizes = array(15, 43, 40, 40, 35, 35, 35, 35);
     $max_sizes = array(10, 30, 28, 28, 30, 25, 25, 25);
     $data = array();
     $filename = __FUNCTION__ . '_' . Session::get('user_name') . '_' . date('YmdHis') . '.pdf';
     $i = 0;
     foreach ($result['messages'] as $message) {
         $data[$i] = array($message->id, $message->subscriber_id, $message->service_id, $message->product_id, $message->update_desc, $message->effective_time, $message->expiry_time, $message->created_on);
         $i++;
     }
     $pdf = new PDF($title, $data, $headers, $sizes, $max_sizes);
     $pdf->Output($filename, 'I');
     //log the event
     $this->logger->info('{class_mame}|{method_name}|result|{result}|result_desc:{result_desc}', array('class_mame' => __CLASS__, 'method_name' => __FUNCTION__, 'result' => $result['result'], 'result_desc' => $result['resultDesc']));
 }