<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultPage.aspx.cs" Inherits="System_SystemFrame_DefaultPage" %>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=1280, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <title>系统首页</title>
    <script type="text/javascript" src="../../Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../Scripts/Flow.js"></script>
    <link href="css/common.css" rel="stylesheet" type="text/css">
    <link href="css/green/ui.min.css" rel="stylesheet">
    <link href="css/green/index.css" rel="stylesheet" type="text/css" id="indexFile">
</head>
<body>
<div id="hd" class="cf">
  <div class="fl welcome cf">
	  <strong><span id="greetings"></span>，<span id="username"><%=xview["nickname"]%></span></strong>
	  <a href="javascript:go_open_tab('System_ChangePassword', '修改密码', '../../System/SystemFrame/ChangePassword.aspx');" id="manageAcct">修改密码</a>
	  <a href="http://www.asair.net/Doc/Home/Index.aspx" target="_blank" id="newGuide" title="新手入门">新手入门</a>
  </div>
  <div class="fr storages-search">
      <!--<label><a class="b" id="invWarning">库存预警</a></label>-->
      <label for="">库存查询</label><span class="ui-search"><input type="text" id="keyword" class="ui-input" /></span><span id="stockSearch"></span></div>
</div>
<div id="bd" class="index-body cf">
  <div class="col-main">
    <div class="main-wrap cf">
      <div class="m-top cf" id="profileDom">
        <!--
      	<div class="fr" id="interval">
          	<label class="radio"><input type="radio" name="interval" value="month" checked="checked">本月</label>
          	<label class="radio"><input type="radio" name="interval" value="year">本年</label>
      		<label class="radio"><input type="radio" name="interval" value="today">今日</label>
          	<label class="radio"><input type="radio" name="interval" value="yesterday">昨日</label>
        </div>
        -->
		<table width="100%" border="0" cellspacing="0" cellpadding="20" style='<%=xview["show_home_amount_panel"]%>'>
		  <tr>
		    <td><a class="tad t1" href="#"><span>库存总量:<b id="stock_quantity"></b></span><span>标准成本:<b id="stock_cost"></b></span></a></td>
		    <td><a class="tad t2" href="#"><span>客户欠款:<b id="customer_balance"></b></span><span>供应商欠款:<b id="vendor_balance"></b></span></a></td>
		    <td><a class="tad t4" href="#"><span>销售订单金额(本月):<b id="sales_order_amount"></b></span><span>销售发货金额(本月):<b id="delivery_order_amount"></b></span></a></td>
		    <td><a class="tad t5" href="#"><span>采购订单金额(本月):<b id="purchase_order_amount"></b></span><span>采购入库金额(本月):<b id="purchase_in_amount"></b></span></a></td>  
		  </tr>
		</table>

      </div>
      <ul class="quick-links">
        <li class="purchase-purchase">
        	<a href="javascript:open_tab('Purchase_PurchaseIn', 'Purchase_PurchaseIn', '采购入库单', '../../Purchase/PurchaseIn/PurchaseIn_Document.aspx')" title="从供应商采购入库"><span></span>进货入库</a>
        </li>
        <li class="sales-sales">
        	<a href="javascript:open_tab('Sale_DeliveryOrder', 'Sale_DeliveryOrder', '发货单', '../../Sale/DeliveryOrder/DeliveryOrder_Document.aspx')" title="向客户或分销商发货"><span></span>销货出库</a>
        </li>
        <!--
        <li class="storage-transfers">
        	<a href="javascript:open_tab('Stock_Transfer','Stock_Transfer', '调拨单', '../../Stock/Transfer/Transfer_Document.aspx')"><span></span>仓库调拨</a>
        </li>
        <li class="storage-inventory">
            <a href="javascript:open_tab('Stock_StockCount','Stock_StockCount', '盘点单', '../../Stock/StockCount/StockCount_Document.aspx')"><span></span>库存盘点</a>
        </li>-->
        <li class="storage-otherWarehouse">
            <a href="javascript:open_tab('Stock_OtherIn','Stock_OtherIn', '其它入库单', '../../Stock/OtherIn/OtherIn_Document.aspx')" title="可用于分店从总店调货入库"><span></span>其他入库</a>
        </li>
        <li class="storage-otherOutbound">
            <a href="javascript:open_tab('Stock_OtherOut','Stock_OtherOut', '其它出库单', '../../Stock/OtherOut/OtherOut_Document.aspx')" title="可用于总店向直营分店调货出库"><span></span>其他出库</a>
        </li>
        <!--
        <li class="added-service">
            <a href="javascript:go_open_tab('Site_AddedService', '增值服务', 'http://www.asair.net/Price.aspx#AddedService')"><span></span>增值服务</a>
        </li>
        <li class="feedback">
            <a href="javascript:go_open_tab('Site_Contact', '联系我们', 'http://www.asair.net/Contact.aspx')"><span></span>联系我们</a>
        </li>-->
      </ul>
    </div>
  </div>
  <div class="col-extra">
    <div class="extra-wrap">
      <h2>快速查看</h2>
      <div class="list">
        <ul>
            <li><span class="bulk-import" onclick="open_tab('Base_Inventory','Base_Inventory', '存货', '../../Base/Inventory/Inventory_List.aspx?action=Add')">新增</span><a href="javascript:open_tab('Base_Inventory','Base_Inventory', '存货', '../../Base/Inventory/Inventory_List.aspx')">商品管理</a></li>
            <li><span class="bulk-import" onclick="open_tab('Base_Customer','Base_Customer', '客户', '../../Base/Customer/Customer_List.aspx?action=Add')">新增</span><a href="javascript:open_tab('Base_Customer','Base_Customer', '客户', '../../Base/Customer/Customer_List.aspx')">客户管理</a></li>
            <li><span class="bulk-import" onclick="javascript:open_tab('Base_Vendor','Base_Vendor', '供应商', '../../Base/Vendor/Vendor_List.aspx?action=Add')">新增</span><a href="javascript:open_tab('Base_Vendor','Base_Vendor', '供应商', '../../Base/Vendor/Vendor_List.aspx')">供应商管理</a></li>
            <li><a href="javascript:open_tab('Sale_Report_DeliveryOrder_Details','Sale_Report_DeliveryOrder_Details', '发货单明细表', '../../Sale/Report/DeliveryOrder_Details.aspx')">销售记录</a></li>
            <li><a href="javascript:open_tab('Purchase_Report_PurchaseIn_Details','Purchase_Report_PurchaseIn_Details', '采购入库单明细表', '../../Purchase/Report/PurchaseIn_Details.aspx')">采购记录</a></li>
        	<li><a href="javascript:open_tab('ARAP_Report_SFKuan_List_AR','ARAP_Report_SFKuan_List_AR', '收款单列表', '../../ARAP/Report/SFKuan_List.aspx?rp_flag=AR')">收款记录</a></li>
            <li><a href="javascript:open_tab('ARAP_Report_SFKuan_List_AP','ARAP_Report_SFKuan_List_AP', '付款单列表', '../../ARAP/Report/SFKuan_List.aspx?rp_flag=AP')">付款记录</a></li>
            <li><a href="javascript:open_tab('ARAP_Report_CustomerBalance','ARAP_Report_CustomerBalance', '客户应收余额表', '../../ARAP/Report/CustomerBalance.aspx')">客户欠款</a></li>
            <li><a href="javascript:open_tab('ARAP_Report_VendorBalance','ARAP_Report_VendorBalance', '供应商应付余额表', '../../ARAP/Report/VendorBalance.aspx')">供应商欠款</a></li>
        </ul>
      </div>
    </div>
  </div>
    <div style="float:left;margin-top:20px;"><%=login_info %></div>
</div>
<script>
    var greetings = "", cur_time = new Date().getHours();
    if (cur_time >= 0 && cur_time <= 4) {
        greetings = "已经夜深了，请注意休息"
    } else if (cur_time > 4 && cur_time <= 7) {
        greetings = "早上好";
    } else if (cur_time > 7 && cur_time < 12) {
        greetings = "上午好";
    } else if (cur_time >= 12 && cur_time <= 18) {
        greetings = "下午好";
    } else {
        greetings = "晚上好";
    };
    document.getElementById("greetings").innerHTML = greetings;
    //查询库存
    function search_stock() {
        var keyword = document.getElementById("keyword").value;
        var url = "../../Stock/Report/OnHand.aspx?keyword=" + escape(keyword);
        open_tab("Stock_Report_OnHand", "Stock_Report_OnHand", "现存量查询", url);
    }
    //加载库存数量、收款金额、销售金额等信息
    function load_quick_info() {
        //$("#kczl").html("11000.4");
        var range = "month";
        $.ajax({
            type: "POST",
            contentType: "application/json",
            url: 'DefaultPage_Service.asmx/GetQuickInfo',
            data: "{range:'" + range + "'}",
                dataType: 'json',
                success: function (result) {
                    var r = result.d;
                    var arr = r.split('|');
                    $("#stock_quantity").html(arr[0]);
                    $("#stock_cost").html(arr[1]);
                    $("#customer_balance").html(arr[2]);
                    $("#vendor_balance").html(arr[3]);
                    $("#sales_order_amount").html(arr[4]);
                    $("#delivery_order_amount").html(arr[5]);
                    $("#purchase_order_amount").html(arr[6]);
                    $("#purchase_in_amount").html(arr[7]);
                }
            });
    }
    //页面加载事件
    window.onload = function () {
        //点击搜索库存按钮
        document.getElementById("stockSearch").onclick = function () {
            search_stock();
        }
        //搜索库存文本框回车事件
        document.getElementById("keyword").onkeypress = function (evt) {
            evt = evt ? evt : (window.event ? window.event : null);
            if (evt.keyCode == "13") {
                search_stock();
            }
        }
        load_quick_info();
    }
    //禁止F5刷新
    document.onkeydown = function (ev) {
        var oEvent = ev || event;
        if (oEvent.keyCode == 116) {
            if (!/firefox/i.test(window.navigator.userAgent)) oEvent.keyCode = 0;
            oEvent.cancelBubble = true;
            return false;
        }
    };
</script>    
</body>
</html>
