Exemple #1
0
 /**
  * 更新库存
  */
 public function doAddIn(ZOL_Request $input, ZOL_Response $output)
 {
     $db = Db_Andyou::instance();
     $itemIdArr = $input->post("item_id");
     //所有产品ID
     $itemNumArr = $input->post("item_num");
     //所有产品产品数量
     if ($itemIdArr) {
         foreach ($itemIdArr as $i => $pid) {
             $num = $itemNumArr[$i];
             if ($num) {
                 $orgNum = (int) $db->getOne("select stock from product where id = {$pid}");
                 //获得以前的库存数
                 //更新库存信息
                 $sql = "update product set stock = stock + {$num} where id = {$pid} ";
                 $db->query($sql);
                 //获得当前产品的信息
                 $proInfo = Helper_Product::getProductInfo(array('id' => $pid));
                 //记录日志 log_productInStorage
                 $item = array('proId' => $pid, 'adminer' => $output->admin, 'dateTm' => SYSTEM_TIME, 'orgNum' => $orgNum, 'addNum' => $num, 'cateId' => $proInfo["cateId"], 'name' => $proInfo["name"], 'code' => $proInfo["code"]);
                 Helper_Dao::insertItem(array('addItem' => $item, 'dbName' => 'Db_Andyou', 'tblName' => 'log_productInStorage'));
             }
         }
     }
     $urlStr = "?c={$output->ctlName}";
     echo "<script>alert('Success!');document.location='{$urlStr}';</script>";
     exit;
 }
Exemple #2
0
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->sername = $wArr['name'] = $input->get('name');
     if (!empty($wArr)) {
         foreach ($wArr as $k => $v) {
             if (gettype($v) == 'string') {
                 $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : '';
             } else {
                 $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
             }
         }
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&name={$wArr['name']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     //获得所有的产品分类
     $output->productCate = Helper_Product::getProductCatePairs();
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "membercate", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9));
     if ($data) {
         $output->pageBar = $data['pageBar'];
         $output->allCnt = $data['allCnt'];
         $lst = $data['data'];
         //对数据进行二次加工
         $output->data = $data['data'];
         $output->pageUrl = $pageUrl;
     }
     $output->setTemplate('MemberCate');
 }
 public function doDone(ZOL_Request $input, ZOL_Response $output)
 {
     $otherProIdArr = $input->post("otherProId");
     //所有商品
     $staffid = (int) $input->post("staffid");
     //员工
     $remark = $input->post("remark");
     //填写的备注
     $memberId = (int) $input->post("memberId");
     //会员ID
     if (!$staffid || empty($otherProIdArr)) {
         $this->showErrMsg();
     }
     //获得会员信息
     $memberInfo = Helper_Member::getMemberInfo(array("id" => $memberId));
     if (!$memberInfo) {
         $this->showErrMsg();
     }
     //获得商品列表
     $proInfoArr = array();
     foreach ($otherProIdArr as $id) {
         $info = Helper_Product::getMemberOtherPro(array('id' => $id, 'memberId' => $memberId));
         if ($info && $info["num"] > 0) {
             //筛选一下商品
             $proInfoArr[] = $info;
         }
     }
     //生成一个单号
     $bno = Helper_Bill::getCommonMaxBno();
     $db = Db_Andyou::instance();
     if ($proInfoArr) {
         foreach ($proInfoArr as $info) {
             //数量减少
             $sql = "update memeberotherpro set num = num - 1 where id = " . $info["id"];
             $db->query($sql);
             //记录消费日志
             $tmpLogRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'otherproId' => $info["id"], 'name' => $info["name"], 'direction' => 1, 'cvalue' => 1, 'orgcvalue' => $info["num"], 'ctype' => $info["ctype"], 'dateTm' => SYSTEM_TIME, 'staffid' => $staffid, 'bno' => $bno, 'remark' => $remark);
             Helper_Dao::insertItem(array('addItem' => $tmpLogRow, 'dbName' => 'Db_Andyou', 'tblName' => 'log_useotherpro'));
         }
     }
     $staffArr = Helper_Staff::getStaffPairs();
     //准备进入打印页面
     $output->proInfoArr = $proInfoArr;
     $output->bno = $bno;
     $output->memberId = $memberId;
     $output->memberInfo = $memberInfo;
     //会员信息
     $output->staffid = $staffid;
     $output->staffName = $staffArr[$staffid];
     Helper_Bill::createOneCommonBno();
     //生成一个通用订单号
     $output->setTemplate('OtherProPrint');
 }
Exemple #4
0
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->serproId = $wArr['proId'] = $input->get('proId');
     $output->sercateId = $wArr['cateId'] = $input->get('cateId');
     $output->sername = $wArr['name'] = $input->get('name');
     $output->sercode = $wArr['code'] = $input->get('code');
     $output->startTime = $wArr['startTime'] = $input->get('startTime');
     $output->endTime = $wArr['endTime'] = $input->get('endTime');
     if ($output->sercateId) {
         $whereSql .= ' AND cateId =' . $output->sercateId;
     }
     if ($output->sercode) {
         $whereSql .= ' AND cateId =\'' . $output->sercode . '\'';
     }
     if ($output->sername) {
         $whereSql .= ' AND name like \'%' . $output->sername . '%\'';
     }
     if ($output->startTime) {
         $stm = strtotime($output->startTime . "00:00:00");
         $whereSql .= " AND dateTm > {$stm}";
     }
     if ($output->endTime) {
         $stm = strtotime($output->endTime . "23:59:59");
         $whereSql .= " AND dateTm < {$stm}";
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&proId={$wArr['proId']}&cateId={$wArr['cateId']}&name={$wArr['name']}&code={$wArr['code']}&startTime={$wArr['startTime']}&endTime={$wArr['endTime']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "log_productinstorage", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9));
     if ($data) {
         $output->pageBar = $data['pageBar'];
         $output->allCnt = $data['allCnt'];
         $output->data = $data['data'];
         $output->pageUrl = $pageUrl;
     }
     //获得所有的产品分类
     $output->proCateArr = Helper_Product::getProductCatePairs();
     $output->setTemplate('LogInStorage');
 }
Exemple #5
0
 /**
  * 根据电话号码获得产品信息
  */
 public function doGetProductByCode(ZOL_Request $input, ZOL_Response $output)
 {
     $code = $input->get('code');
     $fromScore = (int) $input->get('fromScore');
     if (!$code) {
         echo "{}";
         exit;
     }
     $proList = Helper_Product::getProductList(array('code' => $code, 'num' => 30, 'canByScore' => $fromScore));
     if ($proList) {
         //完善产品的分类信息
         $catePairs = Helper_Product::getProductCatePairs();
         foreach ($proList as $k => $p) {
             $proList[$k]['cateName'] = $catePairs[$p["cateId"]];
         }
         $data = array('num' => count($proList), 'data' => $proList);
         echo api_json_encode($data);
     } else {
         echo "{}";
     }
     exit;
 }
Exemple #6
0
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->sername = $wArr['name'] = $input->get('name');
     $output->sercode = $wArr['code'] = $input->get('code');
     $output->sercateId = $wArr['cateId'] = $input->get('cateId');
     if (!empty($wArr)) {
         foreach ($wArr as $k => $v) {
             if (gettype($v) == 'string') {
                 $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : '';
             } else {
                 $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
             }
         }
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&name={$wArr['name']}&code={$wArr['code']}&cateId={$wArr['cateId']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "product", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9));
     //获得符合条件的库存总量
     $db = Db_Andyou::instance();
     $sql = "select sum(stock) sumstock,sum(stock*price) sumprice from product where ctype = 1 {$whereSql}";
     $tmp = $db->getRow($sql);
     $output->sumstock = $tmp["sumstock"];
     $output->sumprice = $tmp["sumprice"];
     if ($data) {
         $output->pageBar = $data['pageBar'];
         $output->allCnt = $data['allCnt'];
         $output->data = $data['data'];
         $output->pageUrl = $pageUrl;
     }
     $output->cateInfo = Helper_Product::getProductCatePairs();
     $output->setTemplate('ProductSm');
 }
Exemple #7
0
        <?php 
}
?>
    </table>
    
    <table align="center" width="100%" style="font-size:12px;">
        <tr><td>商品</td><td>单价</td><td>数量</td><td>合计</td></tr>
        <?php 
if ($proInfoArr) {
    $proArr = array();
    foreach ($proInfoArr as $proInfo) {
        $proId = $proInfo["proId"];
        $proName = "";
        $proPrice = 0;
        if (!isset($proArr[$proId])) {
            $proArr[$proId] = Helper_Product::getProductInfo(array('id' => $proId));
        }
        if ($proArr[$proId]) {
            $proName = $proArr[$proId]["name"];
            $proPrice = $proArr[$proId]["price"];
        }
        echo "<tr><td colspan='9'>{$proName}</td></tr>";
        echo "<tr><td>&nbsp;</td><td>{$proPrice}</td><td>{$proInfo["num"]}</td><td>" . $proPrice * $proInfo["num"] . "</td></tr>";
        //<td>".($proInfo["price"]/100)."</td>
    }
}
?>
    </table>
    <table align="center"  width="100%">
        <tr><td colspan="9">&nbsp;</td></tr>
        
Exemple #8
0
 public function doDone(ZOL_Request $input, ZOL_Response $output)
 {
     $billInfo = $input->post("bill");
     $itemIdArr = $input->post("item_id");
     //所有产品ID
     $itemDiscArr = $input->post("item_disc");
     //所有产品折扣
     $itemNumArr = $input->post("item_num");
     //所有产品产品数量
     $staffid = (int) $input->post("staffid");
     //员工
     $isBuyScore = (int) $input->post("isBuyScore");
     //是否是从积分兑换页面的提交
     $remark = $input->post("remark");
     //填写的备注
     $endSumModifyFlag = (int) $input->post("endSumModifyFlag");
     //是否手工调整了最总价格
     $endBillPrice = $billInfo["bill_end_sum"];
     //最终的价格,这个价格是可以修改的
     $db = Db_Andyou::instance();
     //----------------------
     //获得会员信息
     //----------------------
     $memberId = (int) $input->post("memberId");
     //会员ID
     $memberInfo = Helper_Member::getMemberInfo(array("id" => $memberId));
     if ($memberInfo) {
         $memberScore = $memberInfo["score"];
         //会员的积分
         $memberCard = $memberInfo["balance"];
         //会员的卡内余额
     } else {
         //如果没有这个会员
         $memberScore = $memberCard = 0;
         $billInfo["bill_member_card"] = 0;
         //传递过来的会员扣费,强制失效掉
         $billInfo["bill_member_score"] = 0;
     }
     //----------------------
     //获得说有的商品信息
     //----------------------
     $proInfoArr = array();
     $sumPrice = 0;
     //原价总金额
     $orgSumPrice = 0;
     //商品总额
     //折扣获得的金额
     $discGetMoney = 0;
     //记录所有商品的总价格
     $itemSumPrice = 0;
     //判断是否购买了其他的服务,如次卡
     $hasBuyOtherPro = false;
     $otherProItemArr = array();
     if ($itemIdArr) {
         foreach ($itemIdArr as $idx => $pid) {
             $proInfo = Helper_Product::getProductInfo(array('id' => $pid));
             $num = (int) $itemNumArr[$idx];
             $price = $num * $proInfo["oprice"] * $itemDiscArr[$idx];
             $orgSumPrice += $num * $proInfo["oprice"];
             $sumPrice += $price;
             $itemSumPrice += $price;
             $proInfoArr[] = array('proId' => $pid, 'num' => $num, 'discount' => $itemDiscArr[$idx], 'price' => $price, 'staffid' => $staffid);
             if ($proInfo["ctype"] != 1) {
                 //购买非商品类的服务
                 $hasBuyOtherPro = true;
                 $otherProItemArr[] = array('info' => $proInfo, 'num' => $num);
             }
         }
     }
     //生成一个单号
     #$bno = Helper_Bill::getMaxBno();
     $bno = Helper_Bill::getCommonMaxBno();
     //----------------------
     //计算总金额
     //----------------------
     $billDisc = $billInfo["bill_disc"];
     //总折扣
     $sumPriceAftDisc = $sumPrice;
     //$orgSumPrice * $billDisc;//总折扣的价格  $sumPrice * $billDisc; //不可以给商品设置单价了
     $discGetMoney = $orgSumPrice - $sumPriceAftDisc;
     //折扣省下来的金额
     //扣除会员卡内余额
     $leftCard = $memberCard;
     //扣除后,卡内还有的余额
     $useCardFlag = false;
     $useCardMoney = 0;
     if ($sumPriceAftDisc && $memberCard && $billInfo["bill_member_card"]) {
         $useCard = min($memberCard, $billInfo["bill_member_card"]);
         $useCard = $useCard * 100;
         $useCard = min($useCard, $sumPriceAftDisc);
         //卡余额和收费的金额比较
         $leftCard = $memberCard - $useCard / 100;
         $useCardMoney = $useCard / 100;
         //记录用了多少卡的金额
         $sumPriceAftDisc = $sumPriceAftDisc - $useCard;
         $useCardFlag = true;
     }
     //会员积分计算
     $sysOptions = Helper_Option::getAllOptions();
     $scoreRatio = !empty($sysOptions["ScoreRatio"]) ? $sysOptions["ScoreRatio"]["value"] : 0;
     $useScore = (int) $billInfo["bill_member_score"];
     if ($useScore && $memberScore > 0) {
         $duihuanRatio = !empty($sysOptions["DuihuanRatio"]) ? $sysOptions["DuihuanRatio"]["value"] : 0;
         $sumPriceAftDisc = $sumPriceAftDisc - round($useScore / $duihuanRatio) * 100;
     }
     /*
              * 先不用会员积分了
             if($sumPriceAftDisc && $memberScore && $billInfo["bill_member_score"]){
                 $useScore = min($memberScore,$billInfo["bill_member_score"]);//需要花多少积分,避免比用户的积分还多
                 
                 //将用户的积分转换成钱
                 $scoreMoney = round($useScore / $scoreRatio,2);// 9 = 270 /30
                 $scoreMoney = $scoreMoney * 100;             // 900 = 9 * 100
                 $scoreMoney = min($scoreMoney,$sumPriceAftDisc); //避免花费的积分比剩余金额还多 
                 
                 $sumPriceAftDisc = $sumPriceAftDisc - $scoreMoney;
                 
             }*/
     //获得订单的信息
     $sumPriceAftDisc = round($sumPriceAftDisc / 100) * 100;
     //金额的四舍五入
     $billDetail = array('useScore' => $useScore, 'useScoreAsMoney' => round($scoreMoney / 100, 2), 'useCard' => $billInfo["bill_member_card"], 'price' => $sumPriceAftDisc, 'discount' => $billDisc, 'orgPrice' => $orgSumPrice, 'staffid' => $staffid, 'memberId' => $memberId, 'bno' => $bno, 'tm' => SYSTEM_TIME, 'dateDay' => date("Ymd"), 'memberScore' => $memberScore, 'memberCard' => $memberCard, 'remark' => $remark, 'isBuyScore' => $isBuyScore);
     if ($memberInfo) {
         $billDetail["phone"] = $memberInfo["phone"];
     }
     //如果销售眼前台修改了应收款,不是计算出来的,就记录
     if ($endSumModifyFlag) {
         if ($sumPriceAftDisc != $endBillPrice) {
             $billDetail["priceTrue"] = $billDetail["price"];
             $billDetail["price"] = $endBillPrice * 100;
             //使用销售员修改的
         }
     }
     //积分的重新计算
     //         =  积分剩余额                                    +  实际消费产品的积分
     $leftScore = $memberScore - (int) $billDetail["useScore"] + ($billDetail["price"] / 100 + $billDetail["useCard"]) * $scoreRatio;
     $memLeftInfo = array();
     $memLeftInfo['score'] = round($leftScore);
     if ($useCardFlag) {
         //使用了会员卡
         $memLeftInfo['balance'] = $leftCard;
     }
     //计算用户的总消费额
     $memLeftInfo['allsum'] = $memberInfo['allsum'] + $endBillPrice + $billInfo["bill_member_card"];
     //记入订单库
     $output->newScore = (int) (($billDetail['useCard'] + $billDetail['price'] / 100) * $scoreRatio);
     //获得的积分
     $billDetail["getScore"] = $output->newScore;
     $bid = Helper_Dao::insertItem(array('addItem' => $billDetail, 'dbName' => 'Db_Andyou', 'tblName' => 'bills'));
     //记入订单详情
     if ($proInfoArr) {
         foreach ($proInfoArr as $item) {
             //补充信息
             $item["bid"] = $bid;
             $item["bno"] = $bno;
             $item["memberId"] = $memberId;
             $item["tm"] = SYSTEM_TIME;
             Helper_Dao::insertItem(array('addItem' => $item, 'dbName' => 'Db_Andyou', 'tblName' => 'billsitem'));
         }
     }
     //更新用户详情信息
     Helper_Dao::updateItem(array('editItem' => $memLeftInfo, 'dbName' => 'Db_Andyou', 'tblName' => 'member', 'where' => ' id=' . $memberId));
     $staffArr = Helper_Staff::getStaffPairs();
     //更新商品的库存情况
     if ($itemIdArr) {
         foreach ($itemIdArr as $idx => $pid) {
             $num = (int) $itemNumArr[$idx];
             $db->query("update product set stock = stock - {$num} where id =  {$pid} ");
             /*
                            $proInfo = Helper_Product::getProductInfo(array('id'=>$pid));
                            $stock   = (int)$proInfo["stock"];
                            if($stock){
                $num = (int)$itemNumArr[$idx];
                $stock = $stock - $num;
                //if($stock < 0)$stock = 0; 不限制负数了,一直减下去
                
                 Helper_Dao::updateItem(array(
                         'editItem'       =>  array("stock"=>$stock),
                         'dbName'         =>  'Db_Andyou',
                         'tblName'        =>  'product',
                         'where'          =>  ' id=' . $pid, 
                 ));
                
                            }
             */
         }
     }
     //记录积分历史
     if ($output->newScore && $memberId) {
         //记录自己的积分历史
         Helper_Member::addScoreLog(array('memberId' => $memberId, 'direction' => 0, 'score' => $output->newScore, 'orgScore' => $memberInfo["score"], 'bno' => $bno, 'remark' => '消费'));
         //给介绍人增加积分
         if ($sysOptions && !empty($sysOptions["MemberParentRatio"]) && !empty($sysOptions["MemberParentRatio"]["value"])) {
             $introducerId = $memberInfo["introducerId"];
             $introducer = $memberInfo["introducer"];
             if (empty($memberInfo["allsum"])) {
                 //如果用户从来没有消费过,也就是第一次消费才给介绍人增加积分
                 if (!$introducerId || !$introducer) {
                     #如果没有ID,就尝试活儿
                     $introInfo = Helper_Member::getMemberInfo(array('phone' => $introducer, 'id' => $introducerId));
                     $introducerId = $introInfo["id"];
                     $iscore = $output->newScore * $sysOptions["MemberParentRatio"]["value"];
                     //更新积分
                     $sql = "update member set score = score + {$iscore}  where id = {$introducerId}";
                     $db->query($sql);
                     //记录积分
                     Helper_Member::addScoreLog(array('memberId' => $introducerId, 'direction' => 0, 'score' => $iscore, 'orgScore' => $introInfo["score"], 'bno' => $bno, 'remark' => '介绍【' . $memberInfo["phone"] . "-" . $memberInfo["name"] . '】消费得积分' . $output->newScore . '*' . $sysOptions["MemberParentRatio"]["value"]));
                 }
             }
         }
     }
     //记录会员会员卡使用记录
     if ($memberId && $billDetail["useCard"]) {
         Helper_Member::addCardLog(array('memberId' => $memberId, 'direction' => 1, 'card' => $billDetail["useCard"], 'orgCard' => $memberInfo["balance"], 'bno' => $bno, 'remark' => '消费'));
     }
     //记录会员会员卡使用记录
     if ($memberId && $billDetail["useScore"]) {
         Helper_Member::addScoreLog(array('memberId' => $memberId, 'direction' => 1, 'score' => $billDetail["useScore"], 'orgScore' => $memberInfo["score"], 'bno' => $bno, 'remark' => '积分兑换'));
     }
     //记录订单的一些额外的信息,但是不记录到数据库
     $billDetail['itemSumPrice'] = $itemSumPrice;
     //所有商品折扣后的累计金额
     //购买了其他商品的服务,如次卡
     if ($hasBuyOtherPro && $memberId) {
         foreach ($otherProItemArr as $re) {
             $info = $re["info"];
             $num = (int) $re["num"];
             $tmpRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'proId' => $info["id"], 'name' => $info["othername"], 'proName' => $info["name"], 'num' => $info["num"], 'ctype' => $info["ctype"], 'buytm' => SYSTEM_TIME);
             $tmpLogRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'otherproId' => $info["id"], 'name' => $info["othername"], 'direction' => 0, 'cvalue' => $info["num"], 'orgcvalue' => 0, 'ctype' => $info["ctype"], 'dateTm' => SYSTEM_TIME, 'staffid' => $staffid, 'bno' => $bno);
             //记录用户的所有服务
             for ($i = 0; $i < $num; $i++) {
                 Helper_Dao::insertItem(array('addItem' => $tmpRow, 'dbName' => 'Db_Andyou', 'tblName' => 'memeberotherpro'));
                 //数据变化日志
                 Helper_Dao::insertItem(array('addItem' => $tmpLogRow, 'dbName' => 'Db_Andyou', 'tblName' => 'log_useotherpro'));
             }
         }
     }
     //准备进入打印页面
     $output->bno = $bno;
     $output->bid = $bid;
     $output->bsn = substr(md5($bid . "HOOHAHA"), 0, 10);
     $output->billDetail = $billDetail;
     $output->proInfoArr = $proInfoArr;
     $output->memLeftInfo = $memLeftInfo;
     $output->staffid = $staffid;
     $output->staffName = $staffArr[$staffid];
     $output->memberInfo = $memberInfo;
     //会员信息
     $output->discGetMoney = $discGetMoney;
     //折扣省下的钱
     $output->orgSumPrice = $orgSumPrice;
     //原始总价
     $output->isBuyScore = $isBuyScore;
     Helper_Bill::createOneCommonBno();
     //生成一个通用订单号
     $output->setTemplate('BillPrint');
 }
Exemple #9
0
 /**
  * 获得数据列表
  */
 public function doSendTable(ZOL_Request $input, ZOL_Response $output)
 {
     header("Pragma: no-cache");
     header('Content-type: application/x-msexcel;charset=utf-8');
     header("Content-Disposition: attachment; filename=商品数据_" . date('Y-m-d H:i:s') . ".xls");
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $output->sername = $wArr['name'] = $input->get('name');
     $output->sercode = $wArr['code'] = $input->get('code');
     $output->sercateId = $wArr['cateId'] = $input->get('cateId');
     if (!empty($wArr)) {
         foreach ($wArr as $k => $v) {
             if ($k == 'cateId' && $v) {
                 $whereSql .= ' AND cateId =' . $v;
             } elseif ($k == 'code' && $v) {
                 $whereSql .= ' AND code =\'' . $v . "'";
             } else {
                 if (gettype($v) == 'string') {
                     $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : '';
                 } else {
                     $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
                 }
             }
         }
     }
     $pageSize = 100000;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_AndyouYun", 'tblName' => "product", 'cols' => "*", 'pageSize' => $pageSize, 'page' => 1, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9));
     if ($data) {
         $output->pageBar = $data['pageBar'];
         $output->allCnt = $data['allCnt'];
         $output->data = $data['data'];
         $output->pageUrl = $pageUrl;
     }
     $output->cateInfo = Helper_Product::getProductCatePairs();
     //获得所有的种类
     $output->proCtype = ZOL_Config::get("GLOBAL", "PRO_CTYPE");
     $html = $output->fetchCol('ProductToExcel');
     echo mb_convert_encoding($html, "utf-8", "gbk");
     exit;
 }