@model Com._9pm2.ClientWeb.Models.FactoryStatement
@{
    ViewBag.Title = "外协对账单";
}

<script src="~/Scripts/factoryordercommon.js?vn=20180813"></script>
<script src="../../Scripts/factorystatement.js?vn=20180813"></script>

<div id="dSearch" class="divSearch">
    <form method="post">
        <div style="width:100%">
            <div class="div-search-select2">
                @Html.DropDownList("sFactoryNo", new SelectList(Model.DdlFactory, "ItemValue", "ItemText"))
            </div>
            @Html.TextBox("sFactoryName", null, new { maxlength = "50", @Style = "width:120px", placeholder = "外协商名称" })
            @Html.DropDownList("sPaymentStatus", new SelectList(Model.DdlPaymentStatus, "ItemValue", "ItemText"))
            @Html.DropDownList("sInvoiceStatus", new SelectList(Model.DdlInvoiceStatus, "ItemValue", "ItemText"))
            <span>
                @Html.TextBox("sBeginDate", null, new { maxlength = "50", @class = "text-date", placeholder = "交易日期" }) ~ @Html.TextBox("sEndDate", null, new { maxlength = "50", @class = "text-date", placeholder = "交易日期" })&nbsp;&nbsp;
                <span class="redStar"></span>
            </span>

            <button class="btn btn-default" id="btnSearch" onclick="return checkField();">搜索</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>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Orders)
                {
                    <tr id="@item.FactoryOrderNo">
                        <td>@item.TransactionDate.ToString("yyyy-MM-dd")</td>
                        <td>@Html.DisplayFor(modelItem => item.FactoryOrderNo)</td>
                        <td>@Html.DisplayFor(modelItem => item.FactoryName)</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>
                    </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>
                    </tr>
                }
                
            </tbody>
        </table>
        @Html.Pager("FactoryStatement", "FactoryOrder", Model.RouterDirectory, Model.PagerConfig, "pagerDiv", "pagerDiv", 8, true, false, true, true, false)
    </div>
</div>

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