Exemple #1
0
 public function view_invList()
 {
     $now_time = date("Y-m-d H:i:s", time());
     $state = isset($_GET['state']) ? post_check($_GET['state']) : '';
     $this->smarty->assign('state', $state);
     $reason = array();
     $invPeople = isset($_GET['invPeople']) ? $_GET['invPeople'] : '';
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $invType = isset($_GET['invType']) ? $_GET['invType'] : '';
     $auditStatus = isset($_GET['auditStatus']) ? $_GET['auditStatus'] : 3;
     $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : '';
     $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : '';
     $InventoryAct = new InventoryAct();
     $where = 'where storeId=1 ';
     if ($invPeople) {
         $where .= "and invPeople ='{$invPeople}' ";
         $this->smarty->assign('invPeople', $invPeople);
     }
     if ($sku) {
         $where .= "and sku ='{$sku}' ";
         $this->smarty->assign('sku', $sku);
     }
     if ($invType) {
         $where .= "and invType ='{$invType}' ";
         $this->smarty->assign('invType', $invType);
     }
     if ($auditStatus != 3) {
         $where .= "and auditStatus ='{$auditStatus}' ";
     }
     $this->smarty->assign('auditStatus', $auditStatus);
     if ($startdate) {
         $starttime = strtotime($startdate);
         $where .= "and invTime >='{$starttime}' ";
     } else {
         $startdate = $now_time;
     }
     $this->smarty->assign('startdate', $startdate);
     if ($enddate) {
         $endtime = strtotime($enddate);
         $where .= "and invTime <='{$endtime}' ";
     } else {
         $enddate = $now_time;
     }
     $this->smarty->assign('enddate', $enddate);
     $total = $InventoryAct->act_getInvNum($where);
     $num = 80;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by sku, id " . $page->limit;
     $inventory_info = $InventoryAct->act_getInvRecordList('*', $where);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $this->smarty->assign('show_page', $show_page);
     //盘点原因
     if (!empty($inventory_info)) {
         foreach ($inventory_info as $key => $info) {
             $reason_info = InvReasonModel::getInvReasonList("reasonName", "where id='{$info['reasonId']}'");
             $reason[$info['id']] = $reason_info[0]['reasonName'];
             $sku_info = getSkuInfoBySku($info['sku']);
             $inventory_info[$key]['goodsCost'] = $sku_info['goodsCost'];
             $inventory_info[$key]['purchaseName'] = $sku_info['purchaseId'] ? getUserNameById($sku_info['purchaseId']) : '无';
             $inventory_info[$key]['remark'] = $info['remark'] ? $info['remark'] : '';
             //新增等待上架数量 add by Gary
             $tallyList = OmAvailableModel::getTNameList('wh_tallying_list', 'sum(ichibanNums) ichibanNums, sum(shelvesNums) shelvesNums', "where sku='{$info['sku']}' and tallyStatus=0 and is_delete = 0");
             $ichibanNums = intval($tallyList[0]['ichibanNums']);
             $shelvesNums = intval($tallyList[0]['shelvesNums']);
             $inventory_info[$key]['wait_whself'] = $ichibanNums - $shelvesNums;
         }
     }
     $usermodel = UserModel::getInstance();
     //盘点员
     $iqc_user = $usermodel->getGlobalUserLists('global_user_id,global_user_name', "where a.global_user_job in(162,165)", '', '');
     $this->smarty->assign('iqc_user', $iqc_user);
     $this->smarty->assign('inventory_info', $inventory_info ? $inventory_info : array());
     $this->smarty->assign('reason', $reason);
     $navlist = array(array('url' => 'index.php?mod=skuStock&act=getSkuStockList', 'title' => '仓库'), array('url' => 'index.php?mod=inventory&act=inventory', 'title' => '盘点管理'), array('url' => 'index.php?mod=inventory&act=invList', 'title' => '盘点列表'));
     $toplevel = 0;
     //一级菜单的序号  0 开始
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = 04;
     //当前的二级菜单
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('toptitle', '盘点列表');
     $this->smarty->assign('curusername', $_SESSION['userName']);
     $this->smarty->display('inventoryInfo.htm');
 }