Ejemplo n.º 1
0
function getMoveList($store_str)
{
    global $db, $ecs, $smarty;
    $result = get_filter();
    if ($result === false) {
        $inorout = isset($_REQUEST['io']) && !empty($_REQUEST['io']) ? $_REQUEST['io'] : 'out';
        $where_and = '';
        if ($inorout == 'in') {
            //录入中状态的转拨单,被入仓库的相关人不可以查看到
            $where_and = ' and status > 0 ';
        }
        $filter['store_id_out'] = empty($_REQUEST['store_id_out']) ? 0 : intval($_REQUEST['store_id_out']);
        $filter['store_id_in'] = empty($_REQUEST['store_id_in']) ? 0 : intval($_REQUEST['store_id_in']);
        $filter['status'] = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : -1;
        $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']);
        if ($filter['store_id_out']) {
            $where_and .= " and store_id_out=" . $filter['store_id_out'] . " ";
        }
        if ($filter['store_id_in']) {
            $where_and .= " and store_id_in=" . $filter['store_id_in'] . " ";
        }
        if ($filter['status'] > -1) {
            $where_and .= " and status=" . $filter['status'] . " ";
        }
        if ($filter['add_time1']) {
            $where_and .= " AND out_time>=  '" . $filter['add_time1'] . "' ";
        }
        if ($filter['add_time2']) {
            $where_and .= " AND out_time<=  '" . $filter['add_time2'] . "' ";
        }
        /* 记录总数 */
        $sql = "select count(*) from " . $ecs->table('store_move') . " where store_id_" . $inorout . " in(" . $store_str . ")" . $where_and . " and supplier_id=" . $_REQUEST[storetypeid];
        $filter['record_count'] = $db->getOne($sql);
        $filter = page_and_size($filter);
        $sql = "select * from " . $ecs->table('store_move') . " where store_id_" . $inorout . " in(" . $store_str . ")" . $where_and . " and supplier_id=" . $_REQUEST[storetypeid] . " order by move_id desc";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $ret = $db->selectLimit($sql, $filter['page_size'], $filter['start']);
    //$ret = $db->query($sql);
    $info = array();
    while ($row = $db->fetchRow($ret)) {
        $info[$row['move_id']]['move_id'] = $row['move_id'];
        $info[$row['move_id']]['out_store_name'] = getStoreName($row['store_id_out']);
        $info[$row['move_id']]['in_store_name'] = getStoreName($row['store_id_in']);
        $info[$row['move_id']]['out_store_user'] = getUserName($row['store_user_out']);
        $info[$row['move_id']]['in_store_user'] = $row['store_user_in'] > 0 ? getUserName($row['store_user_in']) : '';
        $info[$row['move_id']]['number'] = getMoveGoodsNum($row['move_id'], $inorout == 'out' ? 1 : 2);
        $info[$row['move_id']]['addtime'] = local_date('Y-m-d H:i:s', $row['add_time']);
        $info[$row['move_id']]['outtime'] = $row['out_time'] > 0 ? local_date('Y-m-d H:i:s', $row['out_time']) : '';
        $info[$row['move_id']]['intime'] = $row['in_time'] > 0 ? local_date('Y-m-d H:i:s', $row['in_time']) : '';
        $info[$row['move_id']]['status_info'] = getMoveStatus($row['status']);
        $info[$row['move_id']]['status'] = $row['status'];
        $info[$row['move_id']]['doing'] = getStatusDo($row['move_id'], $row['status'], $inorout);
    }
    $smarty->assign('inorout', $inorout);
    return array('arr' => $info, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    //return $info;
}
Ejemplo n.º 2
0
// Categories
$categories = getCategories($storeId);
// Products
$searchTerm = $_GET["terms"];
$products = searchOnStore($storeId, $searchTerm, 30);
$products = array_map("updatePath", $products);
// Vat
$vat_oux = getStoreById($storeId);
$vat = $vat_oux[0]["vat"];
//loged in user
$smarty->assign('userPermission', 'guest');
if (isset($_SESSION['storesLogin'][$storeId]['userId'])) {
    $userInfo = $_SESSION['storesLogin'][$storeId]['userId'];
    if (isset($userInfo)) {
        $userInfo = getAccount($userInfo);
        $userPermission = getAccountPermission($userInfo["id"]);
        $userPermission = $userPermission["name"];
    }
    $smarty->assign('userInfo', $userInfo);
    $smarty->assign('userPermission', $userPermission);
}
/* END -- Get store data */
$storeName = getStoreName($domain);
$smarty->assign('title', $storeName . " Search results");
$smarty->assign('logoPath', $logoPath);
$smarty->assign('categories', $categories);
$smarty->assign('products', $products);
$smarty->assign('storeDomain', $domain);
$smarty->assign('storeId', $storeId);
$smarty->assign('vat', $vat);
$smarty->display('store/home.tpl');
        $docElementId = $product["ID"];
        $product = array_merge($product, getProductInfo($product));
        $product["BARCODE"] = '';
        if ($product["IS_MULTIPLY_BARCODE"] == 'N') {
            $dbBarCode = CCatalogStoreBarCode::getList(array(), array("PRODUCT_ID" => $product["ELEMENT_ID"]));
            if ($arBarCode = $dbBarCode->GetNext()) {
                $product["BARCODE"] = $arBarCode["BARCODE"];
            }
        } elseif ($product["IS_MULTIPLY_BARCODE"] == 'Y') {
            $dbBarCodes = CCatalogStoreDocsBarcode::getList(array(), array("DOC_ELEMENT_ID" => $docElementId));
            while ($arBarCode = $dbBarCodes->GetNext()) {
                $product["BARCODE"][] = $arBarCode["BARCODE"];
            }
        }
        $storeFromName = getStoreName($product["STORE_FROM"]);
        $storeToName = getStoreName($product["STORE_TO"]);
        ?>
		<script type="text/javascript">
			var arBarCodes = new Array();
			<?php 
        if (is_array($product["BARCODE"])) {
            foreach ($product["BARCODE"] as $barCode) {
                ?>
			arBarCodes.push("<?php 
                echo $barCode;
                ?>
");

			<?php 
            }
            $product["BARCODE"] = '';