$quotation = check_quotation_exists($id); $quotation_items = unserialize($quotation->items); $data = array('breadcrumb_title' => '刪除報價單', 'quotation' => $quotation, 'quotation_items' => $quotation_items); $data = array_merge($data, $options); $app->render('quotation_delete.html', $data); }); $app->get('/quotation_download_pdf/:id', function ($id) use($app) { require 'lib/Wkhtmltopdf.php'; $option_keys = array('company_fax'); $options = get_options($option_keys); $quotation = check_quotation_exists($id); $url = $app->config('full_doc_root') . '/quotation_view/' . $id; try { $wkhtmltopdf = new Wkhtmltopdf(array('path' => PROJECT_PATH . '/pdf/', 'binpath' => WKHTMLTOPDF_BIN_PATH)); $wkhtmltopdf->setTitle($quotation->quotation_name); $wkhtmltopdf->setUrl($url); $wkhtmltopdf->setCookie(COOKIE_NAME, urlencode($app->getCookie(COOKIE_NAME))); $wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, $quotation->quotation_name . '.pdf'); } catch (Exception $e) { $app->notFound(); } }); $app->get('/quotation_status_update/:id', function ($id) use($app) { $quotation_status_words = array('confirmed' => '訂單確認', 'canceled' => '取消', 'paid' => '已付款', 'wait' => '待回應'); $quotation = check_quotation_exists($id); $quotation_items = unserialize($quotation->items); $data = array('breadcrumb_title' => '更新報價單狀態', 'quotation' => $quotation, 'quotation_status_words' => $quotation_status_words); $app->render('quotation_status_update.html', $data); }); $app->post('/ajax_save_quotations', function () use($app) { $quotation_keys = array('quotation_name', 'company_name', 'company_info', 'company_contact', 'customer_info', 'customer_notes', 'bank_info', 'sub_total_price', 'vat_price', 'total_price');
<?php chdir(__DIR__); require 'config.php'; dol_include_once('/query/class/query.class.php'); dol_include_once('/query/class/dashboard.class.php'); $PDOdb = new TPDOdb(); $dash = new TQDashboard(); if ($dash->loadBy($PDOdb, GETPOST('uid'), 'uid', false)) { try { if (!class_exists('Wkhtmltopdf')) { dol_include_once('/query/lib/Wkhtmltopdf.php'); } $wkhtmltopdf = new Wkhtmltopdf(array('path' => sys_get_temp_dir())); $wkhtmltopdf->setTitle($dash->title); $wkhtmltopdf->setOrientation('landscape'); $wkhtmltopdf->setUrl(dol_buildpath('/query/dashboard.php', 2) . '?action=run&uid=' . $dash->uid); $wkhtmltopdf->_bin = !empty($conf->global->ABRICOT_WKHTMLTOPDF_CMD) ? $conf->global->ABRICOT_WKHTMLTOPDF_CMD : 'wkhtmltopdf'; $wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, $dash->uid . '.pdf'); } catch (Exception $e) { echo $e->getMessage(); } }