private function test_reports()
 {
     $sales_reports_repo = new Sales_Reports_Repository($this->base_model->get_db_instance());
     $sales_report_id = $sales_reports_repo->new_sales_report();
     if ($sales_report_id >= 1) {
         echo $sales_reports_repo->to_export_sales_report_json($sales_report_id);
     } else {
         echo 0;
         // there are no receipts to report
     }
 }
Пример #2
0
 public function generate_sales_report_data_post()
 {
     $file_path = $this->input->post('filePath');
     // e:\sample_path.json
     $sales_report_id = $this->input->post('salesReportId');
     $sales_reports_repo = new Sales_Reports_Repository($this->base_model->get_db_instance());
     $sales_report_data = $sales_reports_repo->to_export_sales_report_json($sales_report_id);
     $enc = new Encryption();
     $file_size = file_put_contents($file_path, $enc->encrypt($sales_report_data));
     if ($file_size >= 1) {
         $sales_reports_repo->update_sales_report_status($sales_report_id, Sales_Report_Status::Success);
     } else {
         $sales_reports_repo->update_sales_report_status($sales_report_id, Sales_Report_Status::Failed);
     }
     echo $file_size;
     // if >= 1, write is successful
 }