@model Com._9pm2.ClientWeb.Models.StockInModel
@{ ViewBag.Title = Model.Id == 0 ? "开进货单" : "修改进货单";}

<script src="../../Scripts/stockcommon.js?vn=20180813"></script>
<script src="../../Scripts/stockinedit.js?vn=20180813"></script>
<script src="~/Content/resizecolumn/jquery.resizableColumns.js"></script>
<link rel="stylesheet" href="~/Content/resizecolumn/jquery.resizableColumns.css" />

<div id="divStockIn">
    <div class="error-msg"></div>
    <div id="divStockInContent" style="min-height:240px">

        <table id="tableEdit" class="font85 tableEdit" style="width:100%">

            <tr>
                <td class="label">供应商</td>
                <td style="width:400px">
                    @Html.DropDownList("SupplierId", new SelectList(Model.DdlSupplier, "ItemValue", "ItemText"), new { @class = "form-control max-width-180" })
                    <span class="redStar">*</span>
                    <a href="javascript:void(0)" onclick="newSupplier()">快速创建供应商</a>
                </td>
                <td class="label">进货类型</td>
                <td style="width:400px">
                    @Html.DropDownList("Type", new SelectList(Model.DdlType, "ItemValue", "ItemText"), new { @class = "form-control max-width-180" })
                    <span class="redStar">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">进货日期</td>
                <td>
                    @Html.TextBox("StockInTime", Model.StockInTime.ToString("yyyy-MM-dd"), new { maxlength = "10", @class = "text-date" }) <span class="redStar">*</span>
                </td>
                <td class="label">经办人</td>
                <td colspan="3">
                    @Html.TextBox("Operator", null, new { maxlength = "100", @class = "form-control" }) <span class="redStar">*</span>
                </td>
            </tr>

            <tr>
                <td class="label">明细</td>
                <td colspan="5">
                    <div>
                        <div>
                            <div class="btn-group">
                                <button type="button" class="btn btn-default btn-sm" id="btnNewDetail">新增明细</button>
                                <button type="button" class="btn btn-default btn-sm" id="btnCopyDetail">复制明细</button>
                                <button type="button" class="btn btn-default btn-sm" id="btnDeleteDetail">删除明细</button>
                            </div>
                            <button id="btnNewMaterial" type="button" class="btn btn-default btn-sm">快速创建材料</button>
                        </div>
                        </div>
                        <div>
                            <table class="excel-table" id="simpleStockInDetail">
                                <thead>
                                    <tr>
                                        <th></th>
                                        <th style="width:280px">材料</th>
                                        <th style="width:60px">单位</th>
                                        <th style="width:60px">数量</th>
                                        <th style="width:60px">单价</th>
                                        <th style="width:80px">金额</th>
                                        <th>备注</th>
                                    </tr>
                                </thead>
                                <tbody id="simpleStockInTr"></tbody>
                            </table>
                        </div>
                    </div>

                </td>
            </tr>
            <tr>
                <td class="label">总金额</td>
                <td colspan="5">
                    @Html.TextBox("MarketAmount", null, new { maxlength = "10", @class = "text-money amount", @readonly = "readonly" })&nbsp;<span class="redStar">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">折扣金额</td>
                <td colspan="5">
                    @Html.TextBox("Discount", null, new { maxlength = "10", @class = "text-money amount red-text" })
                </td>
            </tr>
            <tr>
                <td class="label">实际金额</td>
                <td colspan="5">
                    @Html.TextBox("RealAmount", null, new { maxlength = "10", @class = "text-money amount", @readonly = "readonly" })&nbsp;<span class="redStar">*</span>
                </td>
            </tr>

            <tr id="trPrePaid" style="display:none">
                <td class="label">已付金额</td>
                <td colspan="5">
                    @Html.TextBox("PrePaid", null, new { maxlength = "10", @class = "text-money amount" })
                    &nbsp;&nbsp;支付方式：@Html.DropDownList("PrePaidPaymentType", new SelectList(Model.DdlPaymentType, "ItemValue", "ItemText"), new { @class = "form-control" })
                    &nbsp;&nbsp;备注：<input type="text" class="text-memo" id="PrePaidMemo" />
                </td>
            </tr>

            <tr>
                <td class="label">备注</td>
                <td colspan="5">
                    @Html.TextArea("Memo", null, new { maxlength = "1000", style = "width:98%;height:80px;", @class = "form-control" })
                </td>
            </tr>
        </table>

    </div>
    <div style="text-align:right;margin:10px 0">
        <span id="errorMessage" class="error-msg"></span>
        <button type="button" class="btn btn-default" id="btnCancel">取消</button>
        <button type="button" class="btn btn-primary" id="btnSave">保存</button>
    </div>
</div>



<div id="divSupplier" title="快速创建供应商" style="display:none">
    <div id="divdivSupplierContent">
        @using (Html.BeginForm())
        {
            <table id="tableEdit" class="font85 tableEdit">
                <tr>
                    <td class="label">供应商名称</td>
                    <td>
                        @Html.TextBox("SupplierName", null, new { maxlength = "100", @style = "width:260px" })&nbsp;<span class="redStar">*</span>
                    </td>
                </tr>

            </table>
            <br />


        }
    </div>
    <div style="text-align:right;">
        <div class="error-msg"></div>
        <button type="button" class="btn btn-default" onclick="$('#divSupplier').dialog('close');">关闭</button>
        <button type="button" class="btn btn-primary" id="btnSaveSupplier">保存</button>
    </div>
</div>


<div id="stock" class="hidden" style="display:none">
    <select id="Material"></select>
    @Html.Hidden("Id")
</div>
@Html.Partial("MaterialEdit")
@Html.Hidden("StockInDetails", Model.StockInDetailString)
@Html.Hidden("Detail")
@Html.Hidden("BackURL")

