@model Com._9pm2.ClientWeb.Models.OrderAging
@{
    ViewBag.Title = "订单账龄统计";
}

<script src="~/Scripts/ordercommon.js?vn=20180813"></script>
<script src="../../Scripts/orderaging.js?vn=20180813"></script>

<div id="dSearch" class="divSearch">
    <form method="post" action="/Order/OrderAging">
        <div style="width:100%">

            @Html.DropDownList("sCustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))
            <input type="text" placeholder="客户索引" class="form-control" style="width:80px" id="txtCustomer" />
            @Html.TextBox("sCustomerName", null, new { maxlength = "50", @Style = "width:120px", placeholder = "客户名称" })
            @Html.TextBox("sContact", null, new { maxlength = "50", @Style = "width:120px", placeholder = "客户联系人" })  
            @Html.DropDownList("sOrderAging", new SelectList(Model.DdlAging, "ItemValue", "ItemText"))
            <button class="btn btn-default" id="btnSearch" type="submit">搜索</button>
            <button class="btn btn-default" type="button" id="btnExportExcel">下载(Excel)</button>               
        </div>

    </form>
</div>
<div class="error-msg"></div>
<div id="Statement">
    <div class="list">
        <table id="tOrder">
            <thead>
                <tr>
                    <th style="width:120px">交易日期</th>
                    <th style="width:140px">订单编号</th>
                    <th style="width:200px">客户</th>
                    <th>订单名称</th>
                    <th style="width:80px">支付状态</th>
                    <th style="width:80px">发票状态</th>
                    <th style="width:80px">金额</th>
                    <th style="width:80px">已付</th>
                    <th style="width:80px">未付</th>
                    <th style="width:100px">联系人</th>
                    <th style="width:100px">账龄</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Orders)
                {
                    <tr id="@item.OrderNo">
                        <td>@item.TransactionDate.ToString("yyyy-MM-dd")</td>
                        <td>@Html.DisplayFor(modelItem => item.OrderNo)</td>
                        <td>@Html.DisplayFor(modelItem => item.CustomerShortName)</td>
                        <td>@Html.DisplayFor(modelItem => item.OrderName)</td>
                        <td>
                            <span id="spanPaymentStatus">@Html.DisplayFor(modelItem => item.PaymentStatusDescription)</span>
                        </td>
                        <td>
                            <span id="spanInvoiceStatus">@(item.IsInvoiced ? "已开票" : "未开票")</span>
                        </td>
                        <td>@Com._9pm2.ClientWeb.Utilities.NFormat.Format(item.Amount)</td>
                        <td>@Com._9pm2.ClientWeb.Utilities.NFormat.Format(item.Paid)</td>
                        <td>@Com._9pm2.ClientWeb.Utilities.NFormat.Format(item.Unpaid)</td>
                        <td>@item.Contact</td>
                        <td>@item.OrderAging</td>
                    </tr>
                }
                @if (Model.Orders.Count > 0)
                {
                    <tr class="totalTd">
                        <td>总计：</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td class="oderAmountTotal">@Com._9pm2.ClientWeb.Utilities.NFormat.Format(Model.TotalAmount)</td>
                        <td class="oderAmountTotal">@Com._9pm2.ClientWeb.Utilities.NFormat.Format(Model.TotalPaid)</td>
                        <td class="oderAmountTotal">@Com._9pm2.ClientWeb.Utilities.NFormat.Format(Model.TotalUnpaid)</td>
                        <td></td>
                        <td></td>
                    </tr>
                }
               
            </tbody>
        </table>
        @Html.Pager("OrderAging", "Order", Model.RouterDirectory, Model.PagerConfig, "pagerDiv", "pagerDiv", 8, true, false, true, true, false)
    </div>
</div>

@Html.Partial("OrderDetail", Session["LoginUser"] as Com._9pm2.ClientWeb.Models.LoginUser)
<input type="hidden" id="OrderNo" />