예제 #1
0
 function print_order()
 {
     $order_id = \CI::uri()->segment(3);
     $action = \CI::uri()->segment(4);
     $data['order'] = \CI::Orders()->getOrder($order_id);
     //echo '<pre>';print_r($data);exit;
     if (empty($action)) {
         $html = \CI::load()->view('print_order_details', $data, true);
         \CI::load()->helper('html_to_pdf');
         convert2pdf($html, $order_id . '.pdf');
         exit;
         echo 'aaa';
         exit;
     } else {
     }
 }
예제 #2
0
 function documents($eng, $alt, $can, $con, $hz = 50, $phase = 3)
 {
     if ($eng == '' || $alt == '') {
         redirect(site_url());
     }
     $power_factor = 0.8;
     $engine = \CI::Products()->getProduct($eng);
     $alternator = \CI::Products()->getProduct($alt);
     if (empty($engine) || empty($alternator)) {
         redirect(site_url());
     }
     $engine->manufacturer = \CI::Products()->getManufacturers($engine->manufacturers);
     $alternator->manufacturer = \CI::Products()->getManufacturers($alternator->manufacturers);
     $engine_parameters = \CI::Products()->getParameters($engine->id, 'engines');
     $engine_alternator = \CI::Products()->getParameters($alternator->id, 'alternators', $hz);
     $data['page_title'] = $engine->name;
     $data['meta'] = $engine->meta;
     $data['seo_title'] = !empty($engine->seo_title) ? $engine->seo_title : $engine->name;
     $data['product'] = $engine;
     $data['engine_parameters'] = $engine_parameters;
     $data['alt'] = $alternator;
     $data['eng'] = $engine;
     $data['engine_alternator'] = $engine_alternator;
     $generators = array();
     $generators['kVA'] = $generators['kVA_standby'] = $engine_parameters->standby / $power_factor * ($engine_alternator->efficiency * 0.01);
     $generators['kVA_prime'] = $engine_parameters->prime / $power_factor * ($engine_alternator->efficiency * 0.01);
     $generators['price'] = $engine->price_1 + $alternator->price_1;
     if ($engine_alternator->power < $generators['kVA']) {
         $generators['kVA'] = $engine_alternator->power;
     }
     if ($engine->days > $alternator->days) {
         $generators['days'] = $engine->days;
     } else {
         $generators['days'] = $alternator->days;
     }
     $generators['name'] = 'G50-' . round($generators['kVA']) . $engine->manufacturer->code . $alternator->manufacturer->code . 'BA';
     //echo '<pre>';print_r($generators);exit;
     $data['generators'] = $generators;
     $data['engine_manufacturer'] = $engine->manufacturer->name;
     $data['alternator_manufacturer'] = $alternator->manufacturer->name;
     \CI::load()->helper('calculator');
     \CI::load()->helper('html_to_pdf');
     $data['fuel'] = get_info_fuel_consumption($engine->id, $alternator->id, $hz, $phase);
     //echo '<pre>';print_r($data);exit;
     $html = \CI::load()->view('documents', $data, true);
     convert2pdf($html, $data['generators']['name'] . '.pdf');
     exit;
 }