Beispiel #1
0
 /**
  * 插入一条记录
  * @para $data as array
  * return insert_id
  */
 public static function insertRow($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "INSERT INTO `" . self::$table . "` SET " . $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         $insertId = self::$dbConn->insert_id();
         return $insertId;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }
Beispiel #2
0
 public function view_pda_inventory()
 {
     //$this->smarty->template_dir = WEB_PATH.'pda/html/';
     $state = isset($_GET['state']) ? $_GET['state'] : "";
     $type = isset($_GET['type']) ? $_GET['type'] : "";
     $reason = InvReasonModel::getInvReasonList("*", "where storeId=1");
     $this->smarty->assign('reason', $reason);
     $reasonId = isset($_GET['reasonId']) ? $_GET['reasonId'] : "";
     $this->smarty->assign('reasonId', $reasonId);
     if ($type == "error") {
         $this->smarty->assign("errorLog", $state);
     } else {
         $this->smarty->assign("successLog", $state);
     }
     $toptitle = '复核查询';
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('action', $toptitle);
     $this->smarty->display("pda_inventory.htm");
 }
Beispiel #3
0
 public function act_export()
 {
     $invPeople = isset($_GET['invPeople']) ? $_GET['invPeople'] : '';
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $invType = isset($_GET['invType']) ? $_GET['invType'] : '';
     $startdate = isset($_GET['startdate']) ? post_check($_GET['startdate']) : '';
     $enddate = isset($_GET['enddate']) ? post_check($_GET['enddate']) : '';
     $auditStatus = isset($_GET['auditStatus']) ? post_check($_GET['auditStatus']) : '';
     if (empty($invPeople) && empty($sku) && empty($invType) && empty($startdate) && empty($enddate) && empty($auditStatus)) {
         echo "请选择导出条件";
         exit;
     }
     $where = 'where storeId=1 ';
     if ($invPeople) {
         $where .= "and invPeople ='{$invPeople}' ";
     }
     if ($sku) {
         $where .= "and sku ='{$sku}' ";
     }
     if ($invType) {
         $where .= "and invType ='{$invType}' ";
     }
     if ($startdate) {
         $starttime = strtotime($startdate);
         $where .= "and invTime >='{$starttime}' ";
     }
     if ($enddate) {
         $endtime = strtotime($enddate);
         $where .= "and invTime <='{$endtime}' ";
     }
     if ($auditStatus != '' && $auditStatus != 3) {
         $where .= "and auditStatus = {$auditStatus}";
     }
     $lists = InvRecordModel::getInvRecordList('*', $where);
     $excel = new ExportDataExcel('browser', "Files_warehouse" . date('Y-m-d') . ".xls");
     $excel->initialize();
     $tharr = array("日期", "料号", "仓位", "系统数量", "盘点数量", "差异数量", "料号单价", "类型", "盘点原因", "盘点人", "采购员", "物料管理人", "状态", '备注信息');
     $excel->addRow($tharr);
     foreach ($lists as $list) {
         $time = date('Y-m-d', $list['invTime']);
         $sku = $list['sku'];
         $location = $list['location'];
         $systemNums = $list['systemNums'];
         $sku_info = getSkuInfoBySku($list['sku']);
         $goodsCost = $sku_info['goodsCost'];
         $invNums = $list['invNums'];
         if ($list['invType'] == 1) {
             $num = $list['adjustNums'];
             $type = "盘盈";
         } elseif ($list['invType'] == 2) {
             $num = '-' . $list['adjustNums'];
             $type = "盘亏";
         } else {
             $num = $list['adjustNums'];
             $type = "";
         }
         $remark = $list['remark'] ? $list['remark'] : '';
         $reason_info = InvReasonModel::getInvReasonList("reasonName", "where id='{$list['reasonId']}'");
         $reason = $reason_info[0]['reasonName'];
         $invPeople = getUserNameById($list['invPeople']);
         //$sku_info    = getSkuInfoBySku($list['sku']);
         $purchaseName = $sku_info['purchaseId'] ? getUserNameById($sku_info['purchaseId']) : '无';
         $menergeMan = '';
         $mark = '';
         if ($list['auditStatus'] == 0) {
             $mark = '未审核';
         } else {
             if ($list['auditStatus'] == 1) {
                 $mark = '通过';
             } else {
                 if ($list['auditStatus'] == 2) {
                     $mark = '拒绝';
                 }
             }
         }
         $tdarr = array($time, $sku, $location, $systemNums, $invNums, $num, $goodsCost, $type, $reason, $invPeople, $purchaseName, $menergeMan, $mark, $remark);
         $excel->addRow($tdarr);
     }
     $excel->finalize();
     exit;
 }
Beispiel #4
0
 public function view_editReason()
 {
     $id = intval($_GET['id']);
     $reason = InvReasonModel::getInvReasonList("*", "where id={$id}");
     $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=invReason', 'title' => '盘点原因列表'), array('url' => '', 'title' => '修改盘点原因'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('toptitle', '修改盘点原因');
     $toplevel = 0;
     //一级菜单的序号  0 开始
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = 04;
     //当前的二级菜单
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('curusername', $_SESSION['userName']);
     $this->smarty->display('invReasonAdd.htm');
 }