<?php $_W['page']['title'] = '楼盘项目列表 - 楼盘项目'; $sql = 'select * from ' . tablename('project'); $condition = ' where 1=1 '; $projects = biz_getUserProject($_W['user']); if (is_array($projects)) { $condition .= ' and projguid in (\'' . implode("','", $projects) . '\')'; } $status = biz_getDictionary('projstatus'); $pars = array(); $keyword = trim($_GPC['keyword']); if (!empty($keyword)) { $condition = " AND `projname` LIKE :name"; $pars[':name'] = "%{$keyword}%"; } $sql .= $condition; $list = pdo_fetchall($sql, $pars); $import_enable = $_W['isfounder']; include template('project/display', TEMPLATE_INCLUDEPATH);
function print_addTask($chips, $backUrl, $printType) { global $_W, $_GPC; $templates = biz_getPrintTemplates($_W['project']['projguid'], $printType, 'id'); if (empty($templates) || count($templates) == 0) { message('无可用的打印模板,请找管理配置模板!', $backUrl, 'error'); } $templateId = trim($_GPC['template']); if (!isset($templates[$templateId])) { message('无效的打印模板', $backUrl); } $prints = biz_getAllPrinter($_W['project']['projguid']); if (empty($prints) || count($prints) == 0) { message('无可用的打印机,请找管理员确认打印机配置!', $backUrl, 'error'); } $titles = biz_getDictionary('printtype'); $printTitle = $titles[$printType]; if (empty($printTitle)) { message('无效的打印调用!', $backUrl, 'error'); } $template = $templates[$templateId]; $printId = intval($_GPC['printer']); //记录当前使用的打印机 isetcookie('__print', $printId); $print = $prints[$printId]; if (!biz_checkChipsStatus($chips, $printType, 'printstatus')) { db_updateChipsStatus($chips['id'], $printType, false, 'printstatus'); } $copy_max = 9; $copy = intval($_GPC['copy']); if ($copy <= 0) { $copy = 1; } if ($copy > $copy_max) { $copy = $copy_max; } $printdata = biz_Print_getTemplateData($templateId, $chips); $task = array('projguid' => $chips['projguid'], 'title' => $chips['cname'] . '-' . $printTitle, 'printid' => $printId, 'moduleid' => $print['moduleid'], 'templateid' => $templateId, 'templatename' => $template['title'], 'key' => $chips['qrcode'], 'printname' => $print['title'], 'printtype' => $printType, 'printdata' => iserializer($printdata), 'createid' => $_W['uid'], 'creator' => $_W['username'], 'copy' => $copy, 'status' => '等待', 'createtime' => TIMESTAMP); if (pdo_insert('printtask', $task)) { message('数据已进入排队打印中,请稍候...', $backUrl); } else { message('写入打印任务数据出错', $backUrl); } }
public function doWebCustomer() { global $_W, $_GPC; $step = 1; if (isset($_GPC['step'])) { $step = intval($_GPC['step']); } $id = intval($_GPC['id']); $chips = biz_getChips($id); if (empty($chips) || $chips['deleted']) { message('无效认筹单', $this->createWebUrl('chips')); } $op = $_GPC['op']; if (!in_array($op, array('change', 'add', 'delete'))) { message('无效操作', $this->createWebUrl('chips')); } $url = $this->createWebUrl('customer', array('op' => $op, 'id' => $id)); if ($op == 'change') { $title = '认筹单换名'; } if ($op == 'add') { $title = '增加附属权益人'; } if (checksubmit('submit')) { if ($step == 1) { $user_info = biz_getCustomerByCardId($_GPC['cardid'], $_W['project']['projguid']); if (empty($user_info)) { $user_info = $_GPC['user']; $user_info['CardID'] = $_GPC['cardid']; $user_info['Country'] = '中国'; $user_info['Gender'] = '男'; } $step = 2; } else { if ($step == 2) { $user_info = $_GPC['user']; $customer = biz_getCustomerByCardId($user_info['CardID'], $_W['project']['projguid']); if ($op == 'change') { if (empty($customer)) { $customer = $user_info; biz_saveCustomer($customer, $_W['project']); } // 插入的数据 $data = array('cname' => $user_info['CstName'], 'cardid' => $user_info['CardID'], 'mobile' => $user_info['MobileTel'], 'grender' => $user_info['Gender']); $data['cid'] = $customer['CstGUID']; pdo_update('chips', $data, array('id' => $id)); message('认筹单换名成功!', $this->createWebUrl('chips')); } if ($op == 'add') { if (empty($customer)) { $customer = $user_info; biz_saveCustomer($customer, $_W['project']); } $result = biz_saveHolder($chips, $customer); if ($result['result']) { message('数据增加成功!', $this->createWebUrl('chips', array('id' => $id))); } else { message('数据保存出错:' . $result['msg'], $this->createWebUrl('customer', array('op' => 'add', 'id' => $id)), 'error'); } } } } } if ($step == 2) { $cardTypes = biz_getDictionary('CardType'); $khTypes = biz_getDictionary('kehuType'); } include $this->template('chips_change'); }
$list = pdo_fetchall("SELECT * FROM " . tablename('chips') . " WHERE {$condition}", $pars); load()->web('down'); down_LuckyInfo($list); exit; } } $pindex = max(1, intval($_GPC['page'])); $psize = 15; $start = ($pindex - 1) * $psize; $sql = "SELECT COUNT(*) FROM " . tablename('chips') . " WHERE {$condition}"; $total = pdo_fetchcolumn($sql, $pars); // $sql = "SELECT * FROM " . tablename('chips') . " WHERE {$condition} ORDER BY signed desc,lucky desc, `createtime` DESC LIMIT {$start}, {$psize}"; $pager = pagination($total, $pindex, $psize); $list = pdo_fetchall($sql, $pars); $status = biz_getDictionary('chipstatus'); include $this->template('chips_signed'); } if ($op == 'disp') { disableWebCache(); $keyword = getInputGUID($_GPC['qrcode']); if (empty($keyword)) { message('请输入有效的认筹单号!', $this->createWebUrl($do), 'warning'); } $chips = biz_getChipsByQrcode($keyword); if (empty($chips)) { message('无效的认筹单!', $this->createWebUrl($do), 'error'); } $url = $this->createWebUrl($do, array('op' => 'disp', 'qrcode' => $keyword)); $ok = empty($chips['lucky']); if ($ok) {
$item['InvoNo'] = $bill['InvoNo']; } } } unset($item); include $this->template('order_list'); exit; } if ($op == 'pay') { load()->web('print'); $billType = 2; $id = intval($_GPC['id']); $chips = biz_getChips($id); $this->CheckDataRight($chips); $enable = !empty($chips) && !$chips['deleted']; $status = biz_getDictionary('chipstatus', true); $url = $this->createWebUrl($do); if (!empty($_GPC['back'])) { $url = $this->createWebUrl($_GPC['back'], array('id' => $chips['id'])); } $urlEdit = $this->createWebUrl($do, array('id' => $id, 'op' => 'pay', 'edit' => true)); if (!$enable) { message('无效数据或认筹单不允许修改!', $url); } if (empty($chips['roomstatus'])) { message('认筹单未选房,不能录入订金信息!', $url); } $user_info = $chips['user']; $printed_Bills = biz_getBills($chips['qrcode'], 1, true); $inputBill = biz_getBill($chips['qrcode'], $billType, false); $totalMoney = $chips['ordermoney'] + $chips['premoney'];
public function doWebTemplate() { global $_W, $_GPC; $op = !empty($_GPC['op']) ? $_GPC['op'] : 'list'; $printtype = biz_getDictionary('printtype'); if ($op == 'list') { $pindex = max(1, intval($_GPC['page'])); $psize = 20; $table = 'printtemplate'; $sql = "SELECT * FROM " . tablename($table) . " limit " . ($pindex - 1) * $psize . "," . $psize; $list = pdo_fetchall($sql); $total = pdo_fetchcolumn(" select count(*) from " . tablename($table)); $pager = pagination($total, $pindex, $psize); include $this->template('template_list'); exit; } if ($op == 'delete') { $this->CheckRight('deltemp'); $id = $_GPC['id']; $template = db_getPrintTemplate($id); if (!empty($template)) { pdo_delete('printtemplate', array('id' => $template['id'])); exit('success'); } else { exit('无效数据!'); } } if ($op == 'down') { $id = $_GPC['id']; $template = db_getPrintTemplate($id); header("Cache-Control:must-revalidate,post-check=0,pre-check=0"); header("Content-Type:application/force-download"); header("Content-Type: application/vnd.ms-word;charset=UTF-8"); header("Content-Type:application/octet-stream"); header("Content-Type:application/download"); $ua = $_SERVER["HTTP_USER_AGENT"]; $filename = $template['title'] . ".docx"; if (preg_match("/MSIE/", $ua)) { $filename = urlencode($filename); header('Content-Disposition: attachment; filename=' . $filename); } else { header('Content-Disposition: attachment; filename=' . $filename); } header("Content-Transfer-Encoding:binary"); echo base64_decode($template['content']); exit; } load()->web('print'); if ($op == 'post') { $this->CheckRight('addtemp'); if (checksubmit()) { if (!empty($_FILES['wordfile']['name'])) { if ($_FILES['wordfile']['error'] != 0) { message('文件上传失败,请重试!', $this->createWebUrl('template', array('op' => 'post')), 'error'); } } else { message('请选择要上传的模板!', $this->createWebUrl('template', array('op' => 'post')), 'warning'); } $word = GetUploadFile('wordfile'); if (empty($word)) { message('上传文件失败,目录无写入权限!', $this->createWebUrl('template', array('op' => 'post')), 'error'); } $tags = GetTagsOfXml($word); if (empty($tags)) { message('无效的模板文件,无法读取标签!', $this->createWebUrl('template', array('op' => 'post')), 'error'); } $data = array('id' => GUID(), 'title' => trim($_GPC['title']), 'printtype' => $_GPC['printtype'], 'tags' => iserializer($tags), 'content' => base64_encode(file_get_contents($word)), 'tagsnum' => count($tags), 'status' => '0', 'createtime' => TIMESTAMP); @unlink($word); if (empty($data['title'])) { $data['title'] = $_FILES['wordfile']['name']; } if (!empty($_GPC['onlyCurr'])) { $data['project'] = $_W['project']['projguid']; } pdo_insert('printtemplate', $data); //$test=biz_Print_getTemplateById($data['id']); message('保存数据成功!', $this->CreateWebUrl('template')); } include $this->template('template_post'); exit; } if ($op == 'tags') { $id = $_GPC['id']; $template = db_getPrintTemplate($id, true); if (empty($template)) { if ($_W['isajax']) { echo '无效参数,无法获取模板信息'; exit; } } $disable = !empty($template['status']); $url = $this->createWebUrl('template', array('op' => $op, 'id' => $id)); $map = $template['datamap']; $fields = biz_Print_getDataField($template['printtype']); if (empty($map)) { $map = array(); foreach ($template['tags'] as $t) { $map[$t] = ''; } } $json = json_encode($map); if ($_W['isajax']) { include $this->template('tagEdit'); exit; } if ($_W['token'] == $_GPC['token']) { $map = json_decode(htmlspecialchars_decode($_GPC['json'])); $map = object_to_array($map); if (!$disable) { $update = array('datamap' => iserializer($map)); pdo_update('printtemplate', $update, array('id' => $id)); message('模板标签数据已配置', $this->createWebUrl('template')); } else { message('模板已启用,不允许修改', $this->createWebUrl('template')); } } } if ($op == 'set') { $this->CheckRight('tag'); $id = $_GPC['id']; $template = db_getPrintTemplate($id, true); if (empty($template)) { message('无效打印模板', $this->createWebUrl('template'), 'error'); } $disable = !empty($template['status']); $url = $this->createWebUrl('template', array('op' => 'set', 'id' => $id)); $map = $template['datamap']; $fields = biz_Print_getDataField($template['printtype']); if (empty($map)) { $map = array(); foreach ($template['tags'] as $t) { $map[$t] = ''; } } if ($_W['token'] == $_GPC['token']) { if (!$disable) { $update = array('datamap' => iserializer($_GPC['map'])); pdo_update('printtemplate', $update, array('id' => $id)); message('模板标签数据已配置', $this->createWebUrl('template')); } else { message('模板已启用,不允许修改', $this->createWebUrl('template')); } } include $this->template('tagSet2'); } }
public function doWebSet() { global $_W, $_GPC; $op = $_GPC['op']; $this->CheckRight('set'); //检查项目状态,是否允许设置 $project = db_getProject($_W['pid'], false, false); if (empty($project)) { //|| !empty($project['status']) if ($_W['isajax']) { echo '无效的项目数据或当前项目不允许设置!'; exit; } else { message('无效的项目数据或当前项目不允许设置!', $this->createWebUrl('manage')); } } $url = $this->createWebUrl('set', array('op' => $op)); if ($op == 'discount') { $discount = db_getDiscount($project['projguid'], 'DiscntGUID'); $payform = db_getPayForm($project['projguid'], 'PayFormGUID'); foreach ($payform as &$p) { if ($p['DisCount']) { $p['title'] = $p['PayformName'] . "[{$p['DisCount']}%]"; } if ($p['PreferentialPrice'] > 0) { $p['title'] = $p['PayformName'] . "[-{$p['PreferentialPrice']}¥]"; } } unset($p); $set = biz_unserializer($project, 'payform'); if (empty($set)) { $set = array('pay_id' => ''); } else { if (count($set['pay_id']) > 0) { foreach ($discount as $k => $v) { $discount[$k]['select'] = in_array($k, $set['dis_id']); } } } if ($_W['isajax']) { include $this->template('discountSet'); exit; } if ($_W['token'] == $_GPC['token']) { $pay_id = trim($_GPC['payform']); $calc = array('paydiscount' => 1.0, 'decmoney' => 0, 'discount' => 1.0); if (!empty($pay_id) && isset($payform[$pay_id])) { $set['pay_id'] = $pay_id; $set['Payform'] = $payform[$pay_id]; $set['title'] = $payform[$pay_id]['title']; $set['details'] = db_getPaydetail($pay_id); } unset($set['dis_id']); foreach ($_GPC['discount'] as $d) { if (isset($discount[$d])) { $set['dis_id'][] = $d; } } $calc = biz_getRoomPriceCalc($set, $discount, $payform); $set['calc'] = $calc; $tip = round($calc['discount'] * 100, 2); $set['discount'] = "减免{$calc['dec_money']},折扣{$tip}%"; $data = array('payform' => iserializer($set)); pdo_update('project', $data, array('id' => $_W['pid'])); biz_mem_clearProject(); $rooms = db_getRooms($_W['project']['projguid']); foreach ($rooms as $r) { if (in_array($r['Status'], array('待售', '销控'))) { biz_calcRoomPrice($r, $calc, true); } //calc_payorder($r,true); } message('数据已设置', $this->createWebUrl('manage')); } } if ($op == 'invoice') { load()->web('print'); $set = biz_unserializer($project, 'finance'); if (empty($set['prepay'])) { $prepay = $set; } else { $prepay = $set['prepay']; } $order = $set['order']; $prefix = $set['Prefix']; if ($_W['isajax']) { include $this->template('invoiceSet'); exit; } if ($_W['token'] == $_GPC['token']) { $getInvoInfo = function ($set) use($project) { $set['BatchNo'] = trim($set['BatchNo']); $set['Prefix'] = trim($set['Prefix']); $invo = biz_getInvoiceByBatchNo($set['BatchNo'], $set['Prefix'], $project); $config = array('BatchNo' => $set['BatchNo'], 'Prefix' => $set['Prefix']); if (!empty($invo)) { $config['InvoGUID'] = $invo['InvoGUID']; } return $config; }; $set = array(); $set['prepay'] = $getInvoInfo($_GPC['prepay']); $set['order'] = $getInvoInfo($_GPC['order']); $set['Prefix'] = trim($_GPC['Prefix']); $set['ChipsPre'] = trim($_GPC['ChipsPre']); $data = array('finance' => iserializer($set)); pdo_update('project', $data, array('id' => $_W['pid'])); biz_mem_clearProject($project); message('数据已设置', $this->createWebUrl('manage')); } } if ($op == 'sign') { $set = biz_unserializer($project, 'signset'); if (empty($set)) { $set = array('num' => 10, 'max' => 1); } if ($_W['isajax']) { include $this->template('signSet'); exit; } if ($_W['token'] == $_GPC['token']) { $set = array('num' => intval($_GPC['num']), 'max' => intval($_GPC['max'])); if ($set['num'] <= 0) { $set['num'] = 10; } if ($set['max'] <= 0) { $set['max'] = 1; } //只能一组 $set['max'] = 1; $data = array('signset' => iserializer($set)); pdo_update('project', $data, array('id' => $_W['pid'])); if ($_GPC['clear']) { pdo_update('sign', array('signed' => 0), array('pid' => $_W['pid'])); pdo_update('call_group', array('called' => 0), array('pid' => $_W['pid'])); //pdo_update('p_room',array('selectroom'=>0)) memcached_delete('global_sign_' . $project['id']); } biz_mem_clearProject($project); message('数据已设置', $this->createWebUrl('manage')); } } if ($op == 'project') { $status = biz_getDictionary('projstatus'); //删除创建默认状态 unset($status[0]); $set = biz_unserializer($project, 'sync'); if ($_W['isajax']) { include $this->template('projSet'); exit; } if ($_W['token'] == $_GPC['token']) { $selStatus = intval($_GPC['status']); $set = array('client' => trim($_GPC['client'])); $data = array('status' => $selStatus, 'sync' => iserializer($set)); pdo_update('project', $data, array('id' => $project['id'])); biz_mem_clearProject($project); message('数据已设置', $this->createWebUrl('manage')); } } if ($op == 'build') { $set = biz_unserializer($project, 'builds'); if (empty($set['timeout'])) { $set['timeout'] = 30; } $builds = db_getBuilds($_W['project']['projguid'], 'BldGUID'); if ($_W['isajax']) { include $this->template('buildSet'); exit; } if ($_W['token'] == $_GPC['token']) { $bids = $_GPC['m_ids']; $timeout = intval($_GPC['timeout']); if ($timeout < 0 || $timeout > 300) { $timeout = 30; } //统计房间数量 // 更新 pdo_update('p_building', array('status' => '0'), array('ProjGUID' => $project['projguid'])); $keys = array_keys($builds); foreach ($bids as $bldGuid) { if (in_array($bldGuid, $keys)) { pdo_update('p_building', array('status' => '1'), array('BldGUID' => $bldGuid)); } } $sql = 'SELECT count(*) as cnt FROM ims_p_room '; $sql .= ' a INNER JOIN ims_p_building b ON a.BldGUID = b.BldGUID '; $sql .= ' WHERE b.`Status`=1 and b.ProjGUID=:projguid'; $cnt = pdo_fetchcolumn($sql, array(':projguid' => $project['projguid'])); $set = array('build' => $bids, 'timeout' => $timeout, 'roomnum' => $cnt); $data = array('builds' => iserializer($set)); pdo_update('project', $data, array('id' => $_W['pid'])); biz_mem_clearProject(); message('数据已设置', $this->createWebUrl('manage')); } } if ($op == 'bank') { $banks = biz_getBanks($_W['project']['BUGUID']); $bk = empty($project['bank']) ? array() : iunserializer($project['bank']); if ($_W['isajax']) { include $this->template('bankSet'); exit; } if ($_W['token'] == $_GPC['token']) { $bankid = $_GPC['bank']; $prebank = db_getPreBank($bankid); $data = array('bank' => iserializer($prebank)); pdo_update('project', $data, array('id' => $_W['pid'])); biz_mem_clearProject($project); message('数据已设置', $this->createWebUrl('manage')); } } }