$smarty->assign('inout_type_list', $inout_type_list); /* 取得仓库 */ $sql = "select store_id, store_name from " . $ecs->table('store_main') . " where parent_id=0 "; $store_list = array(); $ress = $db->query($sql); while ($rows = $db->fetchRow($ress)) { $store_list[] = $rows; } $smarty->assign('store_list', $store_list); //取得出入单商品 $goods_list = array(); $sql = "select i.*, g.goods_name, g.goods_thumb from " . $ecs->table('store_inout_goods') . " AS i left join " . $ecs->table('goods') . " AS g on i.goods_id=g.goods_id where i.inout_rec_id='{$id}' "; $goods_res = $db->query($sql); while ($goods_row = $db->fetchRow($goods_res)) { $goods_row['goods_thumb'] = "../" . get_image_path($goods_row['goods_id'], $goods_row['goods_thumb']); $goods_row['goods_attr1'] = get_attr_name($goods_row['attr_value']); $goods_row['goods_attr2'] = $goods_row['attr_value']; $goods_list[] = $goods_row; } $smarty->assign('goods_list', $goods_list); $smarty->assign('inout', $inout); $smarty->assign('ur_here', $_LANG['store_inout_edit']); $smarty->assign('action_link', array('text' => $_LANG['store_inout_list_in'], 'href' => 'store_inout_in.php?act=list&' . list_link_postfix())); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('store_inout_in_info.htm'); } // 更新某条入库单 if ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('inout_in_manage');
function get_inoutgoods_list() { $result = get_filter(); if ($result === false) { $filter = array(); $filter['sid'] = empty($_REQUEST['sid']) ? '0' : intval($_REQUEST['sid']); $filter['ssid'] = empty($_REQUEST['ssid']) ? '0' : intval($_REQUEST['ssid']); $filter['inout_mode'] = empty($_REQUEST['inout_mode']) ? '0' : intval($_REQUEST['inout_mode']); $filter['inout_type'] = empty($_REQUEST['inout_type']) ? '0' : intval($_REQUEST['inout_type']); $filter['add_time1'] = empty($_REQUEST['add_time1']) ? '' : (strpos($_REQUEST['add_time1'], '-') > 0 ? local_strtotime($_REQUEST['add_time1']) : $_REQUEST['add_time1']); $filter['add_time2'] = empty($_REQUEST['add_time2']) ? '' : (strpos($_REQUEST['add_time2'], '-') > 0 ? local_strtotime($_REQUEST['add_time2']) : $_REQUEST['add_time2']); $filter['brand'] = empty($_REQUEST['brand']) ? '0' : intval($_REQUEST['brand']); $filter['goods_sn'] = empty($_REQUEST['goods_sn']) ? '' : trim($_REQUEST['goods_sn']); $filter['goods_name'] = empty($_REQUEST['goods_name']) ? '' : trim($_REQUEST['goods_name']); $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'b.book_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $where = ' AND b.supplier_id=' . $_SESSION['supplier_id']; if ($filter['ssid']) { $where .= " AND l.store_id = '" . $filter['ssid'] . "' "; } else { if ($filter['sid']) { $where .= " AND l.store_id in " . get_ssid_list($filter['sid']); } } if ($filter['inout_type']) { $where .= " AND l.inout_type = '" . $filter['inout_type'] . "' "; } if ($filter['add_time1']) { $where .= " AND l.add_time>= '" . $filter['add_time1'] . "' "; } if ($filter['add_time2']) { $where .= " AND l.add_time<= '" . $filter['add_time2'] . "' "; } if ($filter['inout_mode']) { $where .= " AND b.inout_mode = '" . $filter['inout_mode'] . "' "; } if ($filter['goods_sn']) { $where .= " AND g.goods_sn = '" . $filter['goods_sn'] . "' "; } if ($filter['goods_name']) { $where .= " AND g.goods_name like '%" . $filter['goods_name'] . "%' "; } if ($filter['brand']) { $where .= " AND g.brand_id = '" . $filter['brand'] . "' "; } /* 总数 */ $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('store_inout_xushibu') . ' AS b ' . ' left join ' . $GLOBALS['ecs']->table('store_inout_list') . ' AS l on b.inout_rec_id=l.rec_id ' . ' left join ' . $GLOBALS['ecs']->table('goods') . ' AS g on b.goods_id = g.goods_id ' . ' WHERE 1 ' . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 获取入库单数据 */ $sql = 'SELECT b.book_id, b.attr_value, b.inout_mode, b.number_shishou, b.number_stock, g.goods_id, ' . 'g.goods_name, g.goods_sn, g.goods_thumb, l.store_id, l.inout_sn, l.order_sn, l.inout_type, l.takegoods_man, l.add_time ' . 'FROM ' . $GLOBALS['ecs']->table('store_inout_xushibu') . ' AS b ' . ' left join ' . $GLOBALS['ecs']->table('store_inout_list') . ' AS l on b.inout_rec_id=l.rec_id ' . ' left join ' . $GLOBALS['ecs']->table('goods') . ' AS g on b.goods_id=g.goods_id ' . ' WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order']; $filter['keyword'] = stripslashes($filter['keyword']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $arr = array(); $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); while ($rows = $GLOBALS['db']->fetchRow($res)) { $rows['store_name'] = get_store_fullname($rows['store_id']); $rows['goods_attr_name'] = get_attr_name($rows['attr_value']); $rows['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']); $rows['goods_thumb'] = get_image_path($rows['goods_id'], $rows['goods_thumb'], true); $rows['inout_type_name'] = get_inout_type_name($rows['inout_type']); $arr[] = $rows; } return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); }
function get_attr_stock($goods_id, $store_id) { $sql = "select goods_attr, store_number from " . $GLOBALS['ecs']->table('store_goods_stock') . " where goods_id= '{$goods_id}' and store_id= '{$store_id}' "; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['goods_attr_name'] = get_attr_name($row['goods_attr']); $row['store_number'] = $row['store_number'] ? $row['store_number'] : '0'; $arr[] = $row; } return $arr; }
/** * Lookup an address by the indicated field. * * @param string $value The value to look up * @param integer $field The field to look in, should be one * of the SM_ABOOK_FIELD_* constants * defined in include/constants.php * (OPTIONAL; defaults to nickname field) * NOTE: uniqueness is only guaranteed * when the nickname field is used here; * otherwise, the first matching address * is returned. * * @return array Array with lookup results when the value * was found, an empty array if the value was * not found. * * @since 1.5.2 * */ function lookup($value, $field = SM_ABOOK_FIELD_NICKNAME) { $attr = get_attr_name($field); if ($attr == 'ERROR') { return $this->set_error(sprintf(_("Unknown field name: %s"), $field)); } // Generate the dn $dn = $attr . '=' . $this->quotevalue($value) . ',' . $this->basedn; // Do the search $result = $this->ldap_search($dn, true); if (!is_array($result) || count($result) < 1) { return array(); } return $result[0]; }
function getMoveGoods($recid) { global $db, $ecs; $sql = "select i.*,g.goods_name, g.goods_thumb from " . $ecs->table('store_inout_goods') . " as i left join " . $ecs->table('goods') . " as g on i.goods_id=g.goods_id where inout_rec_id = " . $recid; $ret = $db->query($sql); $goodsinfo = array(); while ($row = $db->fetchRow($ret)) { $row['goods_thumb'] = "../" . get_image_path($row['goods_id'], $row['goods_thumb']); $row['goods_attr1'] = get_attr_name($row['attr_value']); $row['goods_attr2'] = $row['attr_value']; $goodsinfo[$row['book_id']] = $row; } return $goodsinfo; }