@model Com._9pm2.ClientWeb.Models.SupplierStatement
@{
    ViewBag.Title = "供应商对账单";
}

<script src="~/Scripts/stockcommon.js?vn=20180813"></script>
<script src="../../Scripts/supplierstatement.js?vn=20180813"></script>

<div id="dSearch" class="divSearch">
    <form method="post">
        <div style="width:100%">
            <div class="div-search-select2">
                @Html.DropDownList("sSupplierId", new SelectList(Model.DdlSupplier, "ItemValue", "ItemText"))
            </div>
            @Html.DropDownList("sType", new SelectList(Model.DdlType, "ItemValue", "ItemText"))
            @Html.DropDownList("sStatus", new SelectList(Model.DdlStatus, "ItemValue", "ItemText"))
            @Html.DropDownList("sPaymentStatus", new SelectList(Model.DdlPaymentStatus, "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:140px">进货类型</th>
                    <th style="width:200px">供应商</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>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.List)
                {
                    <tr id="@item.Id">
                        <td>@item.StockInTime.ToString("yyyy-MM-dd")</td>
                        <td>@item.SN</td>
                        <td>@((Com._9pm2.ClientWeb.Common.StockInType)item.Type)</td>
                        <td>@item.Supplier.Name</td>
                        <td>
                            <span id="spanPaymentStatus">@((Com._9pm2.ClientWeb.Common.SupplierPaymentStatus)item.PaymentStatus)</span>
                        </td>
                        <td>
                            <span id="spanStatus">@((Com._9pm2.ClientWeb.Common.StockInStatus)item.Status)</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.Amount - (item.Paid.HasValue ? item.Paid : 0))</td>
                        <td>@item.Memo</td>
                    </tr>
                }
                @if (Model.List.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>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>

@Html.Partial("StockInDetail")
<input type="hidden" id="Id" />