コード例 #1
0
 function generate_product_report_csv($c_data = array())
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $line = array('Product', 'Product Code', 'Status', 'created');
     $csv->addRow($line);
     if (!empty($c_data)) {
         $status = array('Deactive', 'Active');
         $status_sold = array(1 => "Yes", 0 => "No");
         foreach ($c_data as $data) {
             $line = array($data['Product']['title'], $data['Product']['product_code'], $status[$data['Product']['is_active']], $data['Product']['created']);
             $csv->addRow($line);
         }
     }
     echo $csv->render("product_report" . date("d/M/Y"));
     exit;
 }
コード例 #2
0
 function generate_sub_dealer_report_csv($vendor_data = array())
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $line = array('Dealer', 'Email', 'Status', 'Total Sale(DKK)', 'Modified');
     $csv->addRow($line);
     if (!empty($vendor_data)) {
         $status = array('Deactive', 'Active');
         foreach ($vendor_data as $data) {
             $sold_price = $data[0]['total_price'];
             $line = array(ucfirst($data['UserProfile']['first_name']) . " " . ucfirst($data['UserProfile']['last_name']), $data['User']['email'], $status[$data['User']['is_active']], sprintf('%0.2f', $sold_price), $data['User']['modified']);
             $csv->addRow($line);
         }
     }
     echo $csv->render("sub_dealer_report" . date("d/M/Y"));
     exit;
 }
コード例 #3
0
 function generate_weekly_report_csv($c_data = array())
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $line = array("Store number", "Terminal", "Vendor", "Product", "Item", "Face Value", "Billed downloads", "Billed returns", "Net Billed Downloads", "Net Face Value", "Net Cost", "Net Commission", "Merchant", "Site", "Street", "Postcode", "City", "Duplicate Downloads", "All Downloads", "Duplicate Returns", "All Returns", "Net All Downloads", "Download Face Value", "Download Cost", "Download Commission", "Return Face Value", "Return Cost", "Return Commission", "From", "To");
     $csv->addRow($line);
     if (!empty($c_data)) {
         foreach ($c_data as $data) {
             $line = array($data['u']['u_id'], 'X', 'X', 'X', $data['p']['title'], 'X', $data['0']['total'], 'X', $data['0']['total'], 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X');
             $csv->addRow($line);
         }
     }
     echo $csv->render("weekly" . date("d/M/Y"));
     exit;
 }
コード例 #4
0
 function generate_coupon_report_csv($c_data = array(), $b_data = array(), $p_title = null, $v_name = null)
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $list[] = $line = array('Vendor', 'Product', 'Product Code', 'Batch', 'Coupon Id', 'Activation Code', 'Status', 'Sold', 'Expire Date', 'Sale Time');
     $csv->addRow($line);
     if (!empty($c_data)) {
         $status = array('Deactive', 'Active');
         $status_sold = array(1 => "Yes", 0 => "No");
         App::import("Model", "Product");
         $this->Product = new Product();
         $product_data = $this->Product->find("list", array("recursive" => -1, "fields" => array("Product.product_code", "Product.title"), "conditions" => array("Product.is_deleted" => "0", "Product.is_active" => "1")));
         foreach ($c_data as $data) {
             $sale_time = $data['Coupon']['is_sold'] == "1" ? $data['Coupon']['modified'] : "Not yet";
             $line = array($v_name, $product_data[$data['Coupon']['product_code']], $data['Coupon']['product_code'], $b_data[$data['Coupon']['batch_id']], $data['Coupon']['coupon_id'], $data['Coupon']['activation_code'], $status[$data['Coupon']['is_active']], $status_sold[$data['Coupon']['is_sold']], $data['Coupon']['expire_date'], $sale_time);
             $csv->addRow($line);
             $list[] = $line;
         }
     }
     echo $csv->render($v_name . "_" . str_replace(" ", "_", "{$p_title}") . "_" . date("d_M_Y_h_i_s_a"));
     //for save into folder
     $directory_path = $this->create_directory("pull_coupon_sale_csv");
     $fp = fopen($directory_path . $v_name . "_" . str_replace(" ", "_", "{$p_title}") . "_" . date("d_M_Y_h_i_s_a") . '.csv', 'w');
     foreach ($list as $fields) {
         fputcsv($fp, $fields);
     }
     fclose($fp);
     exit;
 }
コード例 #5
0
 function generate_voucher_report_csv($vendor_data = array())
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $line = array('Voucher', 'Status', 'Total Sale(DKK)', 'Modified');
     $csv->addRow($line);
     if (!empty($vendor_data)) {
         $status = array('Deactive', 'Active');
         foreach ($vendor_data as $data) {
             $sold_price = $data[0]['total_price'];
             $line = array(ucfirst($data['Category']['title']), $status[$data['Category']['is_active']], sprintf('%0.2f', $sold_price), $data['Category']['modified']);
             $csv->addRow($line);
         }
     }
     echo $csv->render("voucher_report" . date("d/M/Y"));
     exit;
 }
コード例 #6
0
 function generate_coupon_report_csv($c_data = array(), $b_data = array())
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $line = array('Product Code', 'Batch', 'Coupon Id', 'Status', 'Sold', 'Expire Date', 'Sale Time');
     $csv->addRow($line);
     if (!empty($c_data)) {
         $status = array('Deactive', 'Active');
         $status_sold = array(1 => "Yes", 0 => "No");
         foreach ($c_data as $data) {
             $sale_time = $data['Coupon']['is_sold'] == "1" ? $data['Coupon']['modified'] : "Not yet";
             $line = array($data['Coupon']['product_code'], $b_data[$data['Coupon']['batch_id']], $data['Coupon']['coupon_id'], $status[$data['Coupon']['is_active']], $status_sold[$data['Coupon']['is_sold']], $data['Coupon']['expire_date'], $sale_time);
             $csv->addRow($line);
         }
     }
     echo $csv->render("coupon_report" . date("d/M/Y"));
     exit;
 }
コード例 #7
0
 function generate_coupon_report_csv($c_data = array(), $b_data = array(), $p_title = null)
 {
     App::import('Helper', 'csv');
     $csv = new csvHelper();
     $list[] = $line = array('Product Code', 'Batch', 'Coupon Id', 'Status', 'Sold', 'Expire Date', 'Sale Time');
     $csv->addRow($line);
     if (!empty($c_data)) {
         $status = array('Deactive', 'Active');
         $status_sold = array(1 => "Yes", 0 => "No");
         foreach ($c_data as $data) {
             $sale_time = $data['Coupon']['is_sold'] == "1" ? $data['Coupon']['modified'] : "Not yet";
             $line = array($data['Coupon']['product_code'], $b_data[$data['Coupon']['batch_id']], $data['Coupon']['coupon_id'], $status[$data['Coupon']['is_active']], $status_sold[$data['Coupon']['is_sold']], $data['Coupon']['expire_date'], $sale_time);
             $csv->addRow($line);
             $list[] = $line;
         }
     }
     echo $csv->render(str_replace(" ", "_", "{$p_title}") . "_" . date("d_M_Y_h_i_s_a"));
     //for save into folder
     $directory_path = $this->create_directory("pull_coupon_sale_csv");
     $fp = fopen($directory_path . str_replace(" ", "_", "{$p_title}") . "_" . date("d_M_Y_h_i_s_a") . '.csv', 'w');
     foreach ($list as $fields) {
         fputcsv($fp, $fields);
     }
     fclose($fp);
     exit;
 }