Ejemplo n.º 1
0
 public function view_waitInvList()
 {
     $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();
     $applicant = isset($_GET['applicant']) ? $_GET['applicant'] : '';
     $invPeople = isset($_GET['invPeople']) ? $_GET['invPeople'] : '';
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : '';
     $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : '';
     $usermodel = UserModel::getInstance();
     $user_info = $usermodel->getGlobalUserLists('global_user_id', "where a.global_user_name='{$applicant}'", '', 'limit 1');
     $s_name_id = $user_info[0]['global_user_id'];
     //盘点员
     $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);
     $InventoryAct = new InventoryAct();
     $where = 'where storeId=1 ';
     if ($applicant) {
         $where .= "and applicantId ='{$s_name_id}' ";
         $this->smarty->assign('applicant', $applicant);
     }
     if ($invPeople) {
         $where .= "and invPeopleId ='{$invPeople}' ";
         $this->smarty->assign('invPeople', $invPeople);
     }
     if ($sku) {
         $where .= "and sku ='{$sku}' ";
         $this->smarty->assign('sku', $sku);
     }
     if ($startdate) {
         $starttime = strtotime($startdate);
         $where .= "and applicantionTime >='{$starttime}' ";
     } else {
         $startdate = $now_time;
     }
     $this->smarty->assign('startdate', $startdate);
     if ($enddate) {
         $endtime = strtotime($enddate);
         $where .= "and applicantionTime <='{$endtime}' ";
     } else {
         $enddate = $now_time;
     }
     $this->smarty->assign('enddate', $enddate);
     $total = $InventoryAct->act_getWaitInvNum($where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by id desc " . $page->limit;
     $inventory_info = $InventoryAct->act_getWaitInvList('*', $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 $info) {
             $reason_info = InvReasonModel::getInvReasonList("reasonName", "where id='{$info['invReasonId']}'");
             $reason[$info['id']] = $reason_info[0]['reasonName'];
         }
     }
     $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=waitInvList', '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('waitInventory.htm');
 }