function dtcontact() { $win = 1; $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TT_CONTACT'] . ' - ' . $GLOBALS['lang']['TOOLS']); /*header("Content-type:text/html;charset=utf-8"); header("Content-Disposition: attachment; filename=债权转让及受让协议.html"); echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo '<html>'; echo '<head>'; echo '<title>债权转让及受让协议</title>'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<meta http-equiv="X-UA-Compatible" content="IE=7" />'; echo $GLOBALS['tmpl']->fetch("inc/tool/tcontact.html"); echo '</body>'; echo '</html>';*/ require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "债权转让及受让协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/tool/tcontact.html"); $word->save($wordname); }
public function dcontract() { $id = intval($_REQUEST['id']); if ($id == 0) { showErr("操作失败!"); } $deal = get_deal($id); if (!$deal) { showErr("操作失败!"); } $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC"); if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) { showErr("操作失败!"); } $GLOBALS['tmpl']->assign('deal', $deal); $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC"); foreach ($loan_list as $k => $v) { $vv_deal['borrow_amount'] = $v['money']; $vv_deal['rate'] = $deal['rate']; $vv_deal['repay_time'] = $deal['repay_time']; $vv_deal['loantype'] = $deal['loantype']; $vv_deal['repay_time_type'] = $deal['repay_time_type']; $deal_rs = deal_repay_money($vv_deal); $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money']; if (is_last_repay($deal['loantype'])) { $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money']; } } $GLOBALS['tmpl']->assign('loan_list', $loan_list); $u_info = get_user("*", $deal['user_id']); $GLOBALS['tmpl']->assign('user_info', $u_info); if ($u_info['sealpassed'] == 1) { $credit_file = get_user_credit_file($deal['user_id']); $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]); } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); /*header("Content-type:text/html;charset=utf-8"); header("Content-Disposition: attachment; filename=借款协议.html"); echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo '<html>'; echo '<head>'; echo '<title>借款协议</title>'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<meta http-equiv="X-UA-Compatible" content="IE=7" />'; echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html"); echo '</body>'; echo '</html>';*/ require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "借款协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html"); $word->save($wordname); }
{ ob_start(); echo '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">'; } function save($path) { echo "</html>"; $data = ob_get_contents(); ob_end_clean(); $this->wirtefile($path, $data); } function wirtefile($fn, $data) { $fp = fopen($fn, "wb"); fwrite($fp, $data); fclose($fp); } } $html = file_get_contents("http://localhost/bakup/index2.html"); //批量生成 $word = new word(); $word->start(); $wordname = "报告.doc"; echo $html; $word->save($wordname); ob_flush(); //每次执行前刷新缓存 flush(); echo "OK!";
/** * * @导出Word * @name 自定义名称(不支持中文) * @作者 shop猫 * @版权 宁波天发网络 * @官网 http://www.tifaweb.com http://www.dswjcms.com */ public function exportWord($name) { $dir_teaname = './Public/Word/'; //要创建的文件夹名称 Word //判断目录是否存在,存在就删除 if (!is_dir($dir_teaname)) { //创建目录 $mk = mkdir($dir_teaname); if (!$mk) { echo "创建目录失败!"; exit; } } //生成word文档 import("ORG.Custom.Word"); $savePath = $dir_teaname; $word = new word(); $word->start(); $this->display(); $wordname = $name . '_' . time() . '.doc'; //生成的word名称 $wordname = iconv("utf-8", "gb2312", $wordname); //编码转换 $word->save($savePath . $wordname); echo "<script>window.location.href='" . __ROOT__ . "/Public/Word/" . $wordname . "';</script>"; }
function dtcontact() { $win = 1; $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TT_CONTACT'] . ' - ' . $GLOBALS['lang']['TOOLS']); $id = intval($_REQUEST['id']); if ($id > 0) { //先执行更新借贷信息 $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } else { syn_deal_status($deal_id); } $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; require APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); if ($transfer) { $GLOBALS['tmpl']->assign('transfer', $transfer); } else { echo "不存在的债权"; die; } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); } require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "债权转让及受让协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/tool/tcontact.html"); $word->save($wordname); }