Example #1
0
 public function index()
 {
     $SearchSql = '';
     $BeginDateTemp = '';
     $EndDateTemp = '';
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $Magazine = D('Magazine');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     if ($roleEname != 'admin') {
         $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     } else {
         $MagazineList = $Magazine->field('postCode, name')->select();
     }
     $this->assign('MagazineList', $MagazineList);
     $this->searchMap($map, $SearchSql);
     $this->assign('SearchSql', $SearchSql);
     if ($map) {
         if ($roleEname == "businessManager") {
             $map['order_base.employeeID'] = $EmployeeId;
         }
     }
     $model = D('OrderBase');
     if (!empty($model) && !empty($map)) {
         $this->_list($model, $map);
     }
     $this->display();
     return;
 }
 private function indexSearchList()
 {
     /* 获取用户的部门ID */
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     /* 业务经理报刊信息列表 */
     $Magazine = D("Magazine");
     if ($roleEname == 'businessManager') {
         $MagazineList = $Magazine->getMagazineListByEmId($EmployeeId);
     } else {
         $MagazineList = $Magazine->field('postCode, name')->select();
     }
     $this->assign('MagazineList', $MagazineList);
     /* 客户信息 */
     $Custom = M('Custom');
     $map = array();
     $CustomList = $Custom->where($map)->field('id, name')->select();
     $this->assign('CustomList', $CustomList);
     unset($map);
     /* 报刊来源 */
     $MagazineOrigin = M('MagazineOrigin');
     $MagazineOriginList = $MagazineOrigin->field('id, name')->select();
     $this->assign('MagazineOriginList', $MagazineOriginList);
     /* 发行员 */
     $User = D('User');
     $PostPeopleList = $User->getUserByDutyName('物流部发行员');
     $this->assign('PostPeopleList', $PostPeopleList);
     /* 省份信息 */
     $Province = M("Province");
     $ProvinceList = $Province->field('id, name')->select();
     $this->assign('ProvinceList', $ProvinceList);
 }
 private function listFilter(&$map)
 {
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     if ($roleEname != 'admin') {
         $map['magazine.status'] = array('neq', -1);
         $map['employee_newspaper.personID'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     }
 }
Example #4
0
 private function listFilter(&$map)
 {
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     /**
      * 系统管理员可以查看客户信息和管理客户信息
      * 物流质检员可以查看客户信息,只能修改自己的客户信息
      * 业务经理只能看自己的信息和修改自己的客户信息
      * 其他按照可以看自己的信息和修改自己的客户信息
      */
     if ($roleEname == 'businessManager') {
         $map['custom.employeeID'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     } else {
     }
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     if ($roleEname != 'admin') {
         $map['custom.status'] = array('neq', -1);
     }
 }
 protected function searchMap()
 {
     $BeginDateTemp = '';
     $EndDateTemp = '';
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     if ($_REQUEST['beginTime']) {
         $BeginDateTemp = strtotime($_REQUEST['beginTime']);
     }
     if ($_REQUEST['endTime']) {
         $EndDateTemp = strtotime($_REQUEST['endTime']);
     }
     if ($_REQUEST['customID']) {
         $map['order_base.customID'] = array('in', $_REQUEST['customID']);
         $SearchSql .= 'customID/' . $_REQUEST['customID'] . '/';
     }
     if ($_REQUEST['postCode']) {
         $map['order_base.postCode'] = array('in', $_REQUEST['postCode']);
         $SearchSql .= 'postCode/' . $_REQUEST['postCode'] . '/';
     }
     if ($_REQUEST['isCheckOut']) {
         $map['post_goods.isCheckOut'] = $_REQUEST['isCheckOut'];
         $SearchSql .= 'isCheckOut/' . $_REQUEST['isCheckOut'] . '/';
     }
     if ($_REQUEST['magazineOriginNameID']) {
         $map['order_base.magazineOriginNameID'] = $_REQUEST['magazineOriginNameID'];
         $SearchSql .= 'magazineOriginNameID/' . $_REQUEST['magazineOriginNameID'] . '/';
     }
     if ($_REQUEST['isPrintCheckOut']) {
         $map['post_goods.isPrintCheckOut'] = $_REQUEST['isPrintCheckOut'];
         $SearchSql .= 'isPrintCheckOut/' . $_REQUEST['isPrintCheckOut'] . '/';
     } else {
         $map['post_goods.isPrintCheckOut'] = 0;
         $SearchSql .= 'isPrintCheckOut/0/';
     }
     if ($_REQUEST['month']) {
         $MagazineTerrm = D('MagazineTerrm');
         if ($_REQUEST['postCode']) {
             $MagazineMap['postCode'] = $_REQUEST['postCode'];
         }
         $MagazineMap['month'] = $_REQUEST['month'];
         $MagazineList = $MagazineTerrm->where($MagazineMap)->field('id')->select();
         foreach ($MagazineList as $MagazineVo) {
             $MagazineIds .= $MagazineVo['id'] . ',';
         }
         $MagazineIds = substr($MagazineIds, 0, strlen($MagazineIds) - 1);
         $map['order_flow_details.termID'] = array('in', $MagazineIds);
     }
     if ($MagazineList) {
         $MagazinePostCodes = '';
         foreach ($MagazineList as $vo) {
             $MagazinePostCodes .= $vo['postCode'] . ',';
         }
         $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
         if ($MagazinePostCodes) {
             if (!$map['postCode']) {
                 $map['order_base.postCode'] = array('in', $MagazinePostCodes);
             }
         }
     }
     if ($BeginDateTemp || $EndDateTemp) {
         if ($BeginDateTemp && $EndDateTemp) {
             $map['post_goods.insertTime'] = array('between', "{$BeginDateTemp}, {$EndDateTemp}");
         } else {
             if ($BeginDateTemp) {
                 $map['post_goods.insertTime'] = array('egt', $BeginDateTemp);
             } else {
                 $map['post_goods.insertTime'] = array('elt', $EndDateTemp);
             }
         }
     }
     return $map;
 }
Example #6
0
 private function roleMainShow()
 {
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     $employeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $this->assign('roleEname', $roleEname);
     if ($roleEname == "customCenterWorker") {
         $OrderBase = D('OrderBase');
         $List = array();
         $postCodeNameList = $OrderBase->table(array('tb_order_base' => 'order_base'))->join('tb_magazine magazine on magazine.postCode = order_base.postCode')->join('tb_employee_newspaper employee_newspaper on employee_newspaper.postCode = order_base.postCode')->Distinct('order_base.postCode')->field('magazine.postCode, magazine.name')->where("employee_newspaper.personID = '" . get_employeeid($_SESSION[C('USER_AUTH_KEY')]) . "'")->order('employee_newspaper.operatingFrequency desc')->select();
         foreach ($postCodeNameList as $key => $vo) {
             $List[$key]['postCodeName'] = $vo['name'];
             $map['postCode'] = $vo['postCode'];
             $List[$key]['orderNum'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
             unset($map);
             $map['postCode'] = $vo['postCode'];
             $map['isChecked'] = array('eq', '0');
             $List[$key]['sumUnChecked'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
             unset($map);
             $map['postCode'] = $vo['postCode'];
             $map['isChecked'] = array('eq', '1');
             $List[$key]['sumChecked'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
             unset($map);
             $map['postCode'] = $vo['postCode'];
             $map['isSend'] = array('eq', '0');
             $List[$key]['sumUnSend'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
             unset($map);
             $map['postCode'] = $vo['postCode'];
             $map['isSend'] = array('eq', '1');
             $List[$key]['sumSend'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
             unset($map);
         }
         $this->assign('List', $List);
     } else {
         if ($roleEname == 'logisticsAssigner') {
             $OrderBase = D('OrderBase');
             $List = array();
             $postCodeNameList = $OrderBase->table(array('tb_order_base' => 'order_base'))->join('tb_magazine magazine on magazine.postCode = order_base.postCode')->join('tb_employee_newspaper employee_newspaper on employee_newspaper.postCode = order_base.postCode')->Distinct('order_base.postCode')->field('magazine.postCode, magazine.name')->where("employee_newspaper.personID = '" . get_employeeid($_SESSION[C('USER_AUTH_KEY')]) . "'")->order('employee_newspaper.operatingFrequency desc')->select();
             foreach ($postCodeNameList as $key => $vo) {
                 $List[$key]['postCodeName'] = $vo['name'];
                 $map['postCode'] = $vo['postCode'];
                 $map['isReceive'] = array('eq', '1');
                 $List[$key]['sumReceive'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
                 unset($map);
                 $map['postCode'] = $vo['postCode'];
                 $map['isReceive'] = array('eq', '0');
                 $List[$key]['sumUnReceive'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
                 unset($map);
                 $map['postCode'] = $vo['postCode'];
                 $map['isTrans'] = array('eq', '1');
                 $List[$key]['sumTrans'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
                 unset($map);
                 $map['postCode'] = $vo['postCode'];
                 $map['isTrans'] = array('eq', '0');
                 $List[$key]['sumUnTrans'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID');
                 unset($map);
                 $PostGoods = D("PostGoods");
                 $map['order_base.postCode'] = $vo['postCode'];
                 $map['post_goods.isCheckOut'] = array('eq', '1');
                 $List[$key]['sumCheckOut'] = $PostGoods->table(array('tb_post_goods' => 'post_goods'))->join('tb_order_flow_details order_flow_details on order_flow_details.id = post_goods.orderFlowID')->join('tb_order_base order_base on order_base.id = order_flow_details.orderID')->where($map)->count('post_goods.id');
                 unset($map);
                 $PostGoods = D("PostGoods");
                 $map['order_base.postCode'] = $vo['postCode'];
                 $map['post_goods.isCheckOut'] = array('eq', '0');
                 $List[$key]['sumUnCheckOut'] = $PostGoods->table(array('tb_post_goods' => 'post_goods'))->join('tb_order_flow_details order_flow_details on order_flow_details.id = post_goods.orderFlowID')->join('tb_order_base order_base on order_base.id = order_flow_details.orderID')->where($map)->count('post_goods.id');
                 unset($map);
                 unset($map);
             }
             $this->assign('List', $List);
         } else {
             if ($roleEname == 'businessManager') {
                 import("LibChart");
                 $Magazine = D('Magazine');
                 $OrderBase = D('OrderBase');
                 $List = array();
                 $year = date('Y');
                 $month = date('m');
                 $map = array();
                 $MagazineList = $Magazine->getMagazineListByEmId($employeeId);
                 $MagazineCount = 0;
                 $monthAdd = $month + 1;
                 if ($MagazineList) {
                     foreach ($MagazineList as $key => $MagazineVo) {
                         /* 单期订单的数量 */
                         $orderSingleNum = 0;
                         /* 多期订单的数量 */
                         $orderMonthNum = 0;
                         /**
                          * 算法:通过查找判断单期中的订单是否在 本月内 统计其数量 某一报刊 某一个人
                          */
                         $map['postCode'] = $MagazineVo['postCode'];
                         $map['employeeID'] = $employeeId;
                         $map['isSingle'] = 1;
                         $map['orderYear'] = $year;
                         $map['orderTime'] = array('between', strtotime("{$year}-{$month}-1 00:00:00") . ',' . strtotime("{$year}-{$monthAdd}-1 00:00:00"));
                         $orderSingleNum = $OrderBase->where($map)->sum('orderNum');
                         unset($map);
                         if (empty($orderSingleNum)) {
                             $orderSingleNum = 0;
                         }
                         $map['orderYear'] = $year;
                         $map['orderTime'] = array('between', strtotime("{$year}-{$month}-1 00:00:00") . ',' . strtotime("{$year}-{$monthAdd}-1 00:00:00"));
                         $map['postCode'] = $MagazineVo['postCode'];
                         $map['employeeID'] = $employeeId;
                         $orderNumList = $OrderBase->where($map)->field('beginOrderDate, endOrderDate, orderNum')->select();
                         unset($map);
                         if ($orderNumList) {
                             foreach ($orderNumList as $orderNumVo) {
                                 $intervalMonths = $orderNumVo['endOrderDate'] - $orderNumVo['beginOrderDate'] + 1;
                                 $orderMonthNum += $orderNumVo['orderNum'] * $intervalMonths;
                             }
                         }
                         $MagazineNum = $orderMonthNum + $orderSingleNum;
                         $MagazineName = $MagazineVo['name'];
                         if (empty($MagazineNum) || $MagazineNum == 0) {
                             continue;
                         } else {
                             $List[$MagazineCount]['MagazineName'] = $MagazineName;
                             $List[$MagazineCount]['MagazineNum'] = $MagazineNum;
                             $MagazineCount++;
                         }
                     }
                     $chart = new VerticalBarChart(600, 300);
                     $dataSet = new XYDataSet();
                     $index = 1;
                     $picUrlPath = array();
                     foreach ($List as $key => $vo) {
                         /* 每行显示10个报刊,多余10个报刊,显示下一个图片 */
                         if ($key % 10 == 0 && $key != 0) {
                             $chart->setDataSet($dataSet);
                             $chart->setTitle("当月报刊的销售情况:");
                             $chart->render("./Public/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png");
                             $picUrlPath[] = "__PUBLIC__/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png";
                             $dataSet = new XYDataSet();
                             $index++;
                         }
                         $dataSet->addPoint(new Point($vo['MagazineName'], $vo['MagazineNum']));
                     }
                     $chart->setDataSet($dataSet);
                     $chart->setTitle("当月报刊的销售情况:");
                     $chart->render("./Public/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png");
                     $picUrlPath[] = "__PUBLIC__/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png";
                     $this->assign('picUrlPath', $picUrlPath);
                     /* 只保存没提交的订单的数量 */
                     unset($map);
                     $map['isChecked'] = 2;
                     $map['employeeID'] = $employeeId;
                     $orderSaveNotCommitNum = $OrderBase->where($map)->sum('orderNum');
                     $this->assign('orderSaveNotCommitNum', $orderSaveNotCommitNum);
                 }
             }
         }
     }
 }
 public function saveMonthAdd()
 {
     if (!$_REQUEST['postCode']) {
         $this->error('请选择报刊!');
     }
     if (!$_REQUEST['termName']) {
         $this->error('请填写开始期数,本周期开始的期数');
     }
     if (!$_REQUEST['intervalTerm']) {
         $this->error('请填写间隔期数');
     }
     if (!$_REQUEST['monthDay']) {
         $this->error('请填写每月的几号,报刊发行');
     } else {
         if ($_REQUEST['monthDay'] < 1 || $_REQUEST['monthDay'] > 28) {
             $this->error('请填写每月的几号,范围为1 ~ 28');
         }
     }
     if (!$_REQUEST['cycleTerm']) {
         $this->error('请选择周期,本次期数录入,是按一年、上半年还是下半年为周期的');
     }
     if (!$_REQUEST['year']) {
         $this->error('请填写要录入的年份');
     }
     $beginMonth = 1;
     $endMonth = 12;
     $this->setBeginAndEndMonth($beginMonth, $endMonth);
     /* 删除原来的数据 */
     $MagazineTerrm = D('MagazineTerrm');
     $map['month'] = array('between', "{$beginMonth}, {$endMonth}");
     $map['year'] = $_REQUEST['year'];
     $map['postCode'] = $_REQUEST['postCode'];
     $MagazineTerrm->where($map)->delete();
     unset($map);
     $data['insertPerson'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $data['insertTime'] = time();
     $data['year'] = $_REQUEST['year'];
     $data['postCode'] = $_REQUEST['postCode'];
     for ($month = $beginMonth, $i = 0; $month <= $endMonth; $month++, $i++) {
         $data['name'] = $_REQUEST['termName'] + $i * $_REQUEST['intervalTerm'];
         $data['month'] = $month;
         $data['longname'] = $_REQUEST['year'] . '年' . $month . '月' . $_REQUEST['monthDay'] . '日';
         $data['termList'] = $i;
         $MagazineTerrm->data($data)->add();
     }
     $this->success("添加成功!");
 }
 protected function searchMap()
 {
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     if ($_REQUEST['postCode']) {
         $map['magazine_terrm.postCode'] = $_REQUEST['postCode'];
         $SearchSql .= 'postCode/' . $_REQUEST['postCode'] . '/';
     }
     if ($_REQUEST['month']) {
         $MagazineTerrm = D('MagazineTerrm');
         if ($_REQUEST['postCode']) {
             $MagazineMap['postCode'] = $_REQUEST['postCode'];
         }
         $MagazineMap['month'] = $_REQUEST['month'];
         $MagazineList = $MagazineTerrm->where($MagazineMap)->field('id')->select();
         foreach ($MagazineList as $MagazineVo) {
             $MagazineIds .= $MagazineVo['id'] . ',';
         }
         $MagazineIds = substr($MagazineIds, 0, strlen($MagazineIds) - 1);
         $map['order_flow_details.termID'] = array('in', $MagazineIds);
     }
     if ($MagazineList) {
         $MagazinePostCodes = '';
         foreach ($MagazineList as $vo) {
             $MagazinePostCodes .= $vo['postCode'] . ',';
         }
         $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
         if ($MagazinePostCodes) {
             if (!$map['postCode']) {
                 $map['magazine_terrm.postCode'] = array('in', $MagazinePostCodes);
             }
         }
     }
     return $map;
 }
 private function listFilter(&$map)
 {
     /* 获取用户的部门ID */
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]);
     if ($roleEname == 'businessManager') {
         $map['order_base.employeeID'] = $EmployeeId;
     }
     $map['employee_newspaper.personID'] = $EmployeeId;
 }
Example #10
0
 function insert()
 {
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $_POST['employeeID'] = $EmployeeId;
     $_POST['insertDate'] = time();
     //$_POST['resultPersonID'] = $resultPersonID;
     $_POST['reslutTime'] = strtotime($reslutTime);
     $name = $this->getActionName();
     $model = D($name);
     if (false === $model->create()) {
         $this->error($model->getError());
     }
     //保存当前数据对象
     $list = $model->add();
     if ($list !== false) {
         //保存成功
         if (method_exists($this, '_after_insert')) {
             $this->_after_insert($list);
         }
         $this->assign('jumpUrl', Cookie::get('_currentUrl_'));
         $this->success('新增成功!');
     } else {
         //失败提示
         $this->error('新增失败!');
     }
 }
Example #11
0
 public function _before_add()
 {
     $employeeID = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $this->assign('employeeID', $employeeID);
 }
Example #12
0
 public function insert()
 {
     $StockInput = D('StockOutput');
     $data['outputCode'] = $_REQUEST['outputCode'];
     $data['postCode'] = $_REQUEST['postCode'];
     $data['makeID'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $data['outputDate'] = strtotime($_REQUEST['outputDate']);
     foreach ($_REQUEST['termIDArr'] as $termIDKey => $termIDValue) {
         $data['termID'] = $_REQUEST['termIDArr'][$termIDKey];
         $data['outputNum'] = $_REQUEST['printNumArr'][$termIDKey];
         $data['insertTime'] = time();
         $StockInput->add($data);
     }
     $this->success('添加成功!');
 }
Example #13
0
 public function doBackFill()
 {
     $id = $_REQUEST['id'];
     if ($id) {
         $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
         $map['id'] = array('in', $id);
         $data['sendGoodsID'] = $_REQUEST['sendGoodsID'];
         $data['sendGoodsDate'] = $_REQUEST['sendGoodsDate'];
         $data['checkDate'] = time();
         $data['checkID'] = $_REQUEST['checkID'];
         $data['isBackFill'] = 1;
         $PostGoods = D('PostGoods');
         $PostGoods->where($map)->data($data)->save();
         $this->success('保存成功!');
     } else {
         $this->error('没有数据!');
     }
 }
Example #14
0
 public function update()
 {
     $orderFlowID = $_REQUEST['orderFlowID'];
     $id = $_REQUEST['id'];
     if ($orderFlowID) {
         $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
         $data['quantity'] = $_REQUEST['quantity'];
         $data['memo'] = $_REQUEST['memo'];
         $data['insertDate'] = time();
         $data['employeeID'] = $EmployeeId;
         $RenewOrder = D('RenewOrder');
         foreach ($orderFlowID as $key => $vo) {
             if (isset($id[$key]) && !empty($id[$key])) {
                 $map['id'] = array('eq', $id[$key]);
                 $data['orderFlowID'] = $vo;
                 $RenewOrder->where($map)->data($data)->save();
             } else {
                 $data['orderFlowID'] = $vo;
                 $RenewOrder->data($data)->add();
             }
         }
         $this->success("保存数据成功!");
     } else {
         $this->error('没有数据!');
     }
 }
Example #15
0
 public function doConvert()
 {
     $OrderBase = M('OrderBase');
     $id = $_REQUEST[$OrderBase->getPk()];
     if ($id) {
         $vo = $OrderBase->find($id);
         if ($vo['isTrans']) {
             $this->error('该订单已经转换过了,不能重复转换!');
         }
         $MagazineTerrm = M('MagazineTerrm');
         $OrderFlowDetails = M('OrderFlowDetails');
         $Data['orderID'] = $vo['id'];
         $Data['insertPerson'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
         $Data['insertTime'] = time();
         $Data['quantity'] = $vo['orderNum'];
         if ($vo['sendGoodsSortID']) {
             $Data['sendSort'] = get_send_goods_sort_name($vo['sendGoodsSortID']);
         }
         if ($vo['isSingle']) {
             $TermList = $MagazineTerrm->where('id = ' . $vo['termID'])->select();
             if ($TermList) {
                 $Data['termID'] = $TermList[0]['id'];
             }
         } else {
             $map['year'] = $vo['orderYear'];
             if ($vo['beginOrderDate'] && $vo['endOrderDate']) {
                 $map['month'] = array('between', array($vo['beginOrderDate'], $vo['endOrderDate']));
             } else {
                 if ($vo['beginOrderDate']) {
                     $map['month'] = $vo['beginOrderDate'];
                 } else {
                     if ($vo['endOrderDate']) {
                         $map['month'] = $vo['endOrderDate'];
                     } else {
                         $this->error('订单中没有开始月份或结束月份,请设置!');
                     }
                 }
             }
             $map['postCode'] = $vo['postCode'];
             $TermList = $MagazineTerrm->where($map)->field('id, name')->select();
             if ($TermList) {
                 foreach ($TermList as $TermVo) {
                     $TermId[$TermVo['id']] = $TermVo['name'];
                 }
                 asort($TermId);
                 $BeginTermId;
                 $EndTermId;
                 $i = 1;
                 foreach ($TermId as $key => $value) {
                     if ($i == 1) {
                         $BeginTermId = $key;
                     }
                     $i++;
                 }
                 $EndTermId = $key;
                 $Data['beginTermID'] = $BeginTermId;
                 $Data['endTermID'] = $EndTermId;
             }
         }
         if ($TermList) {
             foreach ($TermList as $termVo) {
                 $Data['termID'] = $termVo['id'];
                 $OrderFlowDetails->add($Data);
             }
             unset($Data);
             $Data['id'] = $id;
             $Data['isTrans'] = '1';
             $Data['orderStatus'] = '待分配';
             $OrderBase->data($Data)->save();
             /* 添加发货信息 */
             $this->PostGoodsAdd($vo['id']);
             $this->success('转换成功!');
         } else {
             $this->error('没有数据!');
         }
     } else {
         $this->error('转换失败!');
     }
 }
Example #16
0
 public function getSelect()
 {
     $type = $_REQUEST['type'];
     switch ($type) {
         case '1':
             $postCode = $_REQUEST['postCode'];
             $MagazineTerrm = M("MagazineTerrm");
             if ($postCode) {
                 $year = $_REQUEST['year'];
                 $month = $_REQUEST['month'];
                 $map = array();
                 $map['postCode'] = $postCode;
                 if ($year) {
                     $map['year'] = $year;
                 }
                 if ($month) {
                     $map['month'] = $month;
                 }
                 $MagazineTerrmList = $MagazineTerrm->where($map)->field('id, name')->order('name desc')->select();
             } else {
                 break;
             }
             $select[] = array('id' => '', 'title' => '--请选择--');
             foreach ($MagazineTerrmList as $MagazineTerrmVo) {
                 $select[] = array('id' => $MagazineTerrmVo['id'], 'title' => $MagazineTerrmVo['name']);
             }
             echo json_encode($select);
             return;
             break;
         case 2:
             $isOldClient = $_REQUEST['isOldClient'];
             $Custom = M("Custom");
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $map = array();
             $map['employeeID'] = $EmployeeId;
             if ($isOldClient) {
                 $map['isOldClient'] = 1;
             }
             $CustomList = $Custom->where($map)->field('id, name')->order('name desc')->select();
             $select[] = array('id' => '', 'title' => '--请选择--');
             foreach ($CustomList as $CustomVo) {
                 $select[] = array('id' => $CustomVo['id'], 'title' => $CustomVo['name']);
             }
             echo json_encode($select);
             return;
             break;
         case 3:
             $isSchool = $_REQUEST['isSchool'];
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $CustomUnit = M("CustomUnit");
             $map = array();
             if ($isSchool) {
                 $map['isSchool'] = 1;
             }
             $map['employeeID'] = $EmployeeId;
             $CustomUnitList = $CustomUnit->where($map)->field('id, name')->order('name desc')->select();
             $select[] = array('id' => '', 'title' => '--请选择--');
             foreach ($CustomUnitList as $CustomUnitVo) {
                 $select[] = array('id' => $CustomUnitVo['id'], 'title' => $CustomUnitVo['name']);
             }
             echo json_encode($select);
             return;
             break;
         case 4:
             $customId = $_REQUEST['customId'];
             $CustomGoods = M("CustomGoods");
             $map = array();
             if ($customId) {
                 $map['custom_goods.customId'] = $customId;
                 $CustomGoodsList = $CustomGoods->table(array('tb_custom_goods' => 'custom_goods'))->join('tb_province province on province.id =custom_goods.provinceID')->where($map)->field('custom_goods.id, custom_goods.recName, custom_goods.address,  custom_goods.className, custom_goods.cityName as cityName, province.name as provinceName')->order('custom_goods.recName desc')->select();
                 $select[] = array('id' => '', 'title' => '--请选择--');
                 foreach ($CustomGoodsList as $CustomGoodsVo) {
                     $select[] = array('id' => $CustomGoodsVo['id'], 'title' => $CustomGoodsVo['recName'] . ' ' . $CustomGoodsVo['provinceName'] . ' ' . $CustomGoodsVo['cityName'] . ' ' . msubstr($CustomGoodsVo['address'], 0, 10) . ' ' . msubstr($CustomGoodsVo['className'], 0, 10));
                 }
                 echo json_encode($select);
                 return;
             }
             break;
         case 5:
             $goodsId = $_REQUEST['goodsId'];
             $CustomGoods = M("CustomGoods");
             if ($goodsId) {
                 $CustomGoodsVo = $CustomGoods->find($goodsId);
                 if ($CustomGoodsVo) {
                     echo json_encode($CustomGoodsVo);
                 }
                 return;
             }
             return;
             break;
         case 6:
             $sendSortID = $_REQUEST['sendSortID'];
             $SendGoodsType = M("SendGoodsType");
             if ($sendSortID) {
                 $SendGoodsTypeList = $SendGoodsType->where('sendGoodsSortID = ' . $sendSortID)->order('name desc')->select();
                 $select[] = array('id' => '', 'title' => '--请选择--');
                 foreach ($SendGoodsTypeList as $SendGoodsTypeVo) {
                     $select[] = array('id' => $SendGoodsTypeVo['id'], 'title' => $SendGoodsTypeVo['name']);
                 }
                 echo json_encode($select);
                 return;
             }
             break;
         case 7:
             $typeID = $_REQUEST['typeID'];
             $Magazine = M("Magazine");
             if ($typeID) {
                 $postCodeList = $Magazine->where('typeID = ' . $typeID)->order('name desc')->select();
                 $select[] = array('postCode' => '', 'title' => '--请选择--');
                 foreach ($postCodeList as $postCodeVo) {
                     $select[] = array('postCode' => $postCodeVo['postCode'], 'title' => $postCodeVo['name']);
                 }
                 echo json_encode($select);
                 return;
             }
             break;
         default:
             break;
     }
     $select[] = array('id' => '', 'title' => '--请选择--');
     echo json_encode($select);
     return;
 }
Example #17
0
 public function update()
 {
     $PressNuminfo = D('PressNuminfo');
     $data['id'] = $_REQUEST['id'];
     $data['printNum'] = $_REQUEST['printNum'];
     $data['makeID'] = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $PressNuminfo->save($data);
     $this->success('保存成功!');
 }
Example #18
0
 function export()
 {
     $map = $this->_search();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     $MagazinePostCodes;
     foreach ($MagazineList as $vo) {
         $MagazinePostCodes .= $vo['postCode'] . ',';
     }
     $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
     if ($MagazinePostCodes) {
         $map['postCode'] = array('in', $MagazinePostCodes);
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         $count = $model->where($map)->count('id');
         if ($count > 0) {
             import("ORG.Util.Page");
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $EmployeeNewspaper = D('EmployeeNewspaper');
             $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
             $MagazinePostCodes;
             foreach ($MagazineList as $vo) {
                 $MagazinePostCodes .= $vo['postCode'] . ',';
             }
             $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
             if ($MagazinePostCodes) {
                 $map['postCode'] = array('in', $MagazinePostCodes);
             }
             //创建分页对象
             if (!empty($_REQUEST['listRows'])) {
                 $listRows = $_REQUEST['listRows'];
             } else {
                 $listRows = '';
             }
             $p = new Page($count, $listRows);
             //分页查询数据
             $order = 'insertTime desc, employeeID desc, recPeople desc, postCode desc ';
             $voList = $model->where($map)->order($order)->select();
             $FileName = date('Y-m-d') . "订单审核数据.xls";
             $FileName = iconv("UTF-8", "GBK", $FileName);
             header("Content-Type: application/vnd.ms-execl");
             header("Content-Disposition: attachment; filename= {$FileName}");
             header("Pragma: no-cache");
             header("Expires: 0");
             /*first line*/
             $HeaderStr = "日期" . "\t";
             $HeaderStr .= "批次" . "\t";
             $HeaderStr .= "业务经理" . "\t";
             $HeaderStr .= "客户名称" . "\t";
             $HeaderStr .= "收货人" . "\t";
             $HeaderStr .= "省份" . "\t";
             $HeaderStr .= "城市" . "\t";
             $HeaderStr .= "单位" . "\t";
             $HeaderStr .= "班级" . "\t";
             $HeaderStr .= "手机" . "\t";
             $HeaderStr .= "传真" . "\t";
             $HeaderStr .= "备用电话" . "\t";
             $HeaderStr .= "地址" . "\t";
             $HeaderStr .= "邮编" . "\t";
             $HeaderStr .= "报刊" . "\t";
             $HeaderStr .= "份数" . "\t";
             $HeaderStr .= "起月" . "\t";
             $HeaderStr .= "止月" . "\t";
             $HeaderStr .= "磁带数" . "\t";
             $HeaderStr .= "答案数" . "\t";
             $HeaderStr .= "是否薄弱县" . "\t";
             $HeaderStr .= "发货类型" . "\t";
             $HeaderStr .= "发货方式" . "\t";
             $HeaderStr .= "发货周期" . "\t";
             $HeaderStr .= "备注" . "\t";
             $HeaderStr .= "付款人" . "\t";
             $HeaderStr .= "保存时间" . "\t";
             $HeaderStr .= "提交时间" . "\t";
             $HeaderStr .= "是否审核" . "\t\n";
             $ContentStr = '';
             /*start of second line*/
             foreach ($voList as $vo) {
                 $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t";
                 $ContentStr .= $vo['batch'] . "\t";
                 $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
                 $ContentStr .= get_custom_name($vo['customID']) . "\t";
                 $ContentStr .= $vo['recPeople'] . "\t";
                 $ContentStr .= get_province_name($vo['provinceID']) . "\t";
                 $ContentStr .= $vo['cityName'] . "\t";
                 $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
                 $ContentStr .= $vo['class'] . "\t";
                 $ContentStr .= $vo['recTelphone'] . "\t";
                 $ContentStr .= $vo['recFax'] . "\t";
                 $ContentStr .= $vo['recSpareTel'] . "\t";
                 $ContentStr .= $vo['recAddress'] . "\t";
                 $ContentStr .= $vo['zipCode'] . "\t";
                 $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
                 $ContentStr .= $vo['orderNum'] . "\t";
                 $ContentStr .= $vo['beginOrderDate'] . "\t";
                 $ContentStr .= $vo['endOrderDate'] . "\t";
                 $ContentStr .= $vo['tapeNum'] . "\t";
                 $ContentStr .= $vo['answerNum'] . "\t";
                 $ContentStr .= $vo['weakCity'] . "\t";
                 $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t";
                 $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
                 $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t";
                 $ContentStr .= $vo['memo'] . "\t";
                 $ContentStr .= $vo['payPerson'] . "\t";
                 $ContentStr .= date('Y-m-d H:i:s', $vo['insertTime']) . "\t";
                 $ContentStr .= date('Y-m-d H:i:s', $vo['commitTime']) . "\t";
                 if ($vo['isChecked'] == 1) {
                     $ContentStr .= "是\t\n";
                 } else {
                     $ContentStr .= "否\t\n";
                 }
             }
             $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
             $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
             echo $HeaderStr . $ContentStr;
             exit;
         } else {
             //错误提示
             $this->error('没有数据!');
         }
     }
 }
Example #19
0
 function export()
 {
     $BeginDateTemp = '';
     $EndDateTemp = '';
     $SearchStr;
     $map = $this->_search();
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     if ($_REQUEST['beginTime']) {
         $BeginDateTemp = strtotime($_REQUEST['beginTime']);
     }
     if ($_REQUEST['endTime']) {
         $EndDateTemp = strtotime($_REQUEST['endTime']);
     }
     $EmployeeNewspaper = D('EmployeeNewspaper');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
     $MagazinePostCodes;
     foreach ($MagazineList as $vo) {
         $MagazinePostCodes .= $vo['postCode'] . ',';
     }
     $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
     if ($MagazinePostCodes) {
         $map['postCode'] = array('in', $MagazinePostCodes);
     }
     if ($BeginDateTemp || $EndDateTemp) {
         if ($BeginDateTemp && $EndDateTemp) {
             $map['orderTime'] = array('between', "{$BeginDateTemp}, {$EndDateTemp}");
         } else {
             if ($BeginDateTemp) {
                 $map['orderTime'] = array('egt', $BeginDateTemp);
             } else {
                 $map['orderTime'] = array('elt', $EndDateTemp);
             }
         }
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $model = D('OrderBase');
     if (!empty($model)) {
         $count = $model->where($map)->count('id');
         if ($count > 0) {
             import("ORG.Util.Page");
             $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
             $EmployeeNewspaper = D('EmployeeNewspaper');
             $MagazineList = $EmployeeNewspaper->getEmployeeNespapers($EmployeeId);
             $MagazinePostCodes;
             foreach ($MagazineList as $vo) {
                 $MagazinePostCodes .= $vo['postCode'] . ',';
             }
             $MagazinePostCodes = substr($MagazinePostCodes, 0, strlen($MagazinePostCodes) - 1);
             if ($MagazinePostCodes) {
                 $map['postCode'] = array('in', $MagazinePostCodes);
             }
             $order = 'insertTime desc, employeeID desc, recPeople desc, postCode desc ';
             $voList = $model->where($map)->order($order)->select();
             $FileName = date('Y-m-d') . "订单派发数据.xls";
             $FileName = iconv("UTF-8", "GBK", $FileName);
             header("Content-Type: application/vnd.ms-execl");
             header("Content-Disposition: attachment; filename= {$FileName}");
             header("Pragma: no-cache");
             header("Expires: 0");
             /*first line*/
             $HeaderStr = "日期" . "\t";
             $HeaderStr .= "批次" . "\t";
             $HeaderStr .= "业务经理" . "\t";
             $HeaderStr .= "客户名称" . "\t";
             $HeaderStr .= "收货人" . "\t";
             $HeaderStr .= "省份" . "\t";
             $HeaderStr .= "城市" . "\t";
             $HeaderStr .= "单位" . "\t";
             $HeaderStr .= "班级" . "\t";
             $HeaderStr .= "手机" . "\t";
             $HeaderStr .= "地址" . "\t";
             $HeaderStr .= "报刊" . "\t";
             $HeaderStr .= "份数" . "\t";
             $HeaderStr .= "起月" . "\t";
             $HeaderStr .= "止月" . "\t";
             $HeaderStr .= "发货类型" . "\t";
             $HeaderStr .= "发货方式" . "\t";
             $HeaderStr .= "发货周期" . "\t";
             $HeaderStr .= "付款人" . "\t";
             $HeaderStr .= "是否派发" . "\t";
             $HeaderStr .= "派发时间" . "\t\n";
             $ContentStr = '';
             /*start of second line*/
             foreach ($voList as $vo) {
                 $ContentStr .= date('Y-m-d', $vo['orderTime']) . "\t";
                 $ContentStr .= $vo['batch'] . "\t";
                 $ContentStr .= get_employee_name($vo['employeeID']) . "\t";
                 $ContentStr .= get_custom_name($vo['customID']) . "\t";
                 $ContentStr .= $vo['recPeople'] . "\t";
                 $ContentStr .= get_province_name($vo['provinceID']) . "\t";
                 $ContentStr .= $vo['cityName'] . "\t";
                 $ContentStr .= get_custom_unit_name($vo['schoolID']) . "\t";
                 $ContentStr .= $vo['class'] . "\t";
                 $ContentStr .= $vo['recTelphone'] . "\t";
                 $ContentStr .= $vo['recAddress'] . "\t";
                 $ContentStr .= get_magazine_name($vo['postCode']) . "\t";
                 $ContentStr .= $vo['orderNum'] . "\t";
                 $ContentStr .= $vo['beginOrderDate'] . "\t";
                 $ContentStr .= $vo['endOrderDate'] . "\t";
                 $ContentStr .= get_send_goods_sort_name($vo['sendGoodsSortID']) . "\t";
                 $ContentStr .= get_send_goods_type_name($vo['sendGoodsTypeID']) . "\t";
                 $ContentStr .= get_send_order_cyle_name($vo['sendCyleID']) . "\t";
                 $ContentStr .= $vo['payPerson'] . "\t";
                 if ($vo['isSend']) {
                     $ContentStr .= "是\t";
                 } else {
                     $ContentStr .= "否\t";
                 }
                 if ($vo['sendTime']) {
                     $ContentStr .= date('Y-m-d', $vo['sendTime']) . "\t\n";
                 } else {
                     $ContentStr .= " \t\n";
                 }
             }
             $HeaderStr = iconv("UTF-8", "GBK", $HeaderStr);
             $ContentStr = iconv("UTF-8", "GBK", $ContentStr);
             echo $HeaderStr . $ContentStr;
             exit;
         } else {
             //错误提示
             $this->error('没有数据!');
         }
     }
 }
Example #20
0
 public function import()
 {
     if (!isset($_FILES['customExcelData'])) {
         uploadFileErrorRespond('请选择数据!');
     }
     if (file_exists($_FILES['customExcelData']['tmp_name'])) {
         $Custom = M('Custom');
         $CustomGoods = D('CustomGoods');
         $SendGoodsSort = D('SendGoodsSort');
         $Employee = D('Employee');
         $Province = D('Province');
         $CustomUnit = D('CustomUnit');
         import("ORG.Excel.PHPExcel");
         import("ORG.Excel.PHPExcel.IOFactory", THINK_PATH . '/Lib/', '.php');
         $fileName = $_FILES['customExcelData']['tmp_name'];
         $PHPExcel = new PHPExcel();
         /** 默认用excel2007读取excel,若格式不对,则用之前的版本进行读取 */
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($fileName)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($fileName)) {
                 uploadFileErrorRespond('Excel格式不支持,请转换后重试!');
                 //uploadFileRespond('Excel format not support ,please try again.');
                 return;
             }
         }
         $EmployeeInsertId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
         ob_clean();
         $PHPExcel = $PHPReader->load($fileName);
         /* 读取excel文件中的第一个工作表 */
         $currentSheet = $PHPExcel->getSheet(0);
         /* 取得最大的列号 */
         $allColumn = $currentSheet->getHighestColumn();
         /* 取得一共有多少行 */
         $allRow = $currentSheet->getHighestRow();
         if (empty($allRow) || $allRow < 2) {
             uploadFileErrorRespond('请检查数据是否在excel的第一个sheet中。');
         }
         $customRowCount = 0;
         $customUnitRowCount = 0;
         $customGoodsRowCount = 0;
         /* 从第二行开始输出,因为excel表中第一行为列名 */
         for ($currentRow = 2; $currentRow <= $allRow; $currentRow++) {
             /* 从第A列开始输出 */
             $managerName = trim($currentSheet->getCell('A' . $currentRow)->getValue());
             $address = trim($currentSheet->getCell('B' . $currentRow)->getValue());
             $customName = trim($currentSheet->getCell('C' . $currentRow)->getValue());
             $customUnitName = trim($currentSheet->getCell('D' . $currentRow)->getValue());
             $className = trim($currentSheet->getCell('E' . $currentRow)->getValue());
             $tel = trim($currentSheet->getCell('F' . $currentRow)->getValue());
             $sendSortName = trim($currentSheet->getCell('G' . $currentRow)->getValue());
             $provinceName = trim($currentSheet->getCell('H' . $currentRow)->getValue());
             $payName = trim($currentSheet->getCell('I' . $currentRow)->getValue());
             $zipCode = trim($currentSheet->getCell('J' . $currentRow)->getValue());
             if (empty($managerName) && empty($customName)) {
                 continue;
             }
             $map['name'] = $provinceName;
             $provinceId = $Province->where($map)->getField('id');
             unset($map);
             $map['name'] = $sendSortName;
             $sendSortId = $SendGoodsSort->where($map)->getField('id');
             unset($map);
             $map['employeeName'] = $managerName;
             $employeeId = $Employee->where($map)->getField('id');
             if (empty($employeeId)) {
                 $employeeId = $EmployeeInsertId;
             }
             unset($map);
             $map['name'] = $customUnitName;
             $customUnitId = $CustomUnit->where($map)->getField('id');
             if (empty($customUnitId)) {
                 $data['name'] = $customUnitName;
                 $data['telphone1'] = $tel;
                 $data['address'] = $address;
                 $data['postCode'] = $zipCode;
                 $data['employeeID'] = $employeeId;
                 $customUnitId = $CustomUnit->data($data)->add();
                 $customUnitRowCount++;
                 /* 客户单位信息添加一条 */
             }
             unset($map);
             unset($data);
             /* 唯一定位一个客户 */
             $map['employeeID'] = $employeeId;
             $map['name'] = $customName;
             $map['address'] = $address;
             $map['provinceID'] = $provinceId;
             $customId = $Custom->where($map)->getField('id');
             //echo $Custom->getLastSql();
             //exit();
             if (empty($customId)) {
                 $data['insertPerson'] = $EmployeeInsertId;
                 $data['employeeID'] = $employeeId;
                 $data['name'] = $customName;
                 $data['provinceID'] = $provinceId;
                 $data['address'] = $address;
                 $data['telphone1'] = $tel;
                 $data['UnitID'] = $customUnitId;
                 $data['insertTime'] = time();
                 $data['postCode'] = $zipCode;
                 $customId = $Custom->data($data)->add();
                 $customRowCount++;
                 /* 客户信息插入了一条 */
             }
             unset($map);
             unset($data);
             /* 唯一定位一个发货人 */
             $map['customID'] = $customId;
             $map['schoolID'] = $customUnitId;
             $map['className'] = $className;
             $map['tel'] = $tel;
             $customGoodsId = $CustomGoods->where($map)->getField('id');
             if (empty($customGoodsId)) {
                 $data['customID'] = $customId;
                 $data['recName'] = $customName;
                 $data['phone'] = $tel;
                 $data['address'] = $address;
                 $data['cityName'] = $address;
                 $data['payName'] = $payName;
                 $data['sendSortID'] = $sendSortId;
                 $data['provinceID'] = $provinceId;
                 $data['className'] = $className;
                 $data['schoolID'] = $customUnitId;
                 $data['zipCode'] = $zipCode;
                 $customGoodsId = $CustomGoods->data($data)->add();
                 $customGoodsRowCount++;
             }
             unset($map);
             unset($data);
         }
         $customRowLast = $allRow - $customRowCount;
         $customUnitRowLast = $allRow - $customUnitRowCount;
         $customGoodsRowLast = $allRow - $customGoodsRowCount;
         $msg = '导入成功!<br/>共有' . $allRow . '条数据.<br/>客户信息添加' . $customRowCount . '条;跳过' . $customRowLast . '条.<br/>单户单位信息添加' . $customUnitRowCount . '条;跳过' . $customUnitRowLast . '条.<br/>客户收货信息添加' . $customGoodsRowCount . '条;跳过' . $customGoodsRowLast . '条.';
         uploadFileSuccessRespond($msg, 'Custom');
         return;
     }
     uploadFileErrorRespond('出现错误,请重试!');
 }
Example #21
0
 public function foreverdelete()
 {
     //删除指定记录
     $EmployeeID = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $Messageinfo = D('Messageinfo');
     $map['id'] = $_REQUEST['id'];
     $map['sendNameID'] = $EmployeeID;
     $map['replayStatus'] = '0';
     $model = M('Messageinfo');
     $vo = $model->getById($_REQUEST['id']);
     if ($vo) {
         if ($vo['validateStatus'] == '1') {
             $this->error('已审核,不能删除!');
         } else {
             if ($vo['replayStatus'] == '1') {
                 //$Messageinfo->where($map)->delete();
                 $this->error('已回复不能删除,不能删除!');
             } else {
                 if (false !== $Messageinfo->where($map)->delete()) {
                     $this->successNoClose('删除成功!');
                 } else {
                     $this->error('删除失败!');
                 }
             }
         }
     }
     //
 }
 private function getConditionModel(&$model)
 {
     if (isset($_REQUEST['employeeID']) && !empty($_REQUEST['employeeID'])) {
         $EmployeeId = $_REQUEST['employeeID'];
     } else {
         $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     }
     $model->table(array('tb_order_base' => 'order_base'))->join('tb_employee employee on employee.id = order_base.employeeID')->join('tb_custom custom on custom.id = order_base.customID')->join('tb_magazine magazine on magazine.postCode =  order_base.postCode')->join('tb_magazine_origin magazine_origin on magazine_origin.id = order_base.magazineOriginNameID')->join('tb_province province on province.id = order_base.provinceID')->join('tb_send_goods_sort send_goods_sort on send_goods_sort.id = order_base.sendGoodsSortID')->join('tb_send_goods_type send_goods_type on send_goods_type.id = order_base.sendGoodsTypeID')->join('tb_send_order_cyle send_order_cyle on send_order_cyle.id = order_base.sendCyleID')->join('tb_custom_unit custom_unit on custom_unit.id = order_base.schoolID')->join('tb_employee_newspaper employee_newspaper on employee_newspaper.postCode = order_base.postCode');
 }
Example #23
0
 public function _before_edit()
 {
     $SendGoodsSort = D('SendGoodsSort');
     $SendGoodsType = M('SendGoodsType');
     $CustomUnit = M('CustomUnit');
     $Province = M('Province');
     $SendOrderCyle = M('SendOrderCyle');
     $EmployeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]);
     $CustomUnitList = $CustomUnit->where('employeeID = ' . $EmployeeId)->field('id, name')->select();
     $SendGoodsSortList = $SendGoodsSort->field('id, name')->order("name desc")->select();
     $SendGoodsTypeList = $SendGoodsType->field('id, name')->order("name desc")->select();
     $ProvinceList = $Province->field('id, name')->select();
     $SendOrderCyleList = $SendOrderCyle->field('id, name')->select();
     $this->assign('SendGoodsSortList', $SendGoodsSortList);
     $this->assign('SendGoodsTypeList', $SendGoodsTypeList);
     $this->assign('SchoolList', $CustomUnitList);
     $this->assign('ProvinceList', $ProvinceList);
     $this->assign('SendOrderCyleList', $SendOrderCyleList);
     $this->assign('customId', $_REQUEST['customId']);
 }