@model Com._9pm2.ClientWeb.Models.CompanySetting
@{
    ViewBag.Title = "系统参数设置";
}


<script src="../../Scripts/settings.js?vn=20180813"></script>

<style>
    .tableEdit td {
        height: 40px !important;
        padding: 5px !important;
    }

    #img-delivery, #img-order, #img-install {
        display: block;
    }

    .order-img {
        position: relative;
        display: inline-block;
        margin-bottom: 5px;
        padding-top: 10px;
        padding-right: 10px;
    }

        .order-img:hover .img-delete {
            display: block;
        }

        .order-img .img-delete {
            position: absolute;
            right: 0;
            top: 0;
            text-align: right;
            display: none;
            background-color: transparent;
            border-radius: 2px;
        }

    .img-delete img {
        width: 28px;
    }

    input[type=file] {
        display: unset;
    }
</style>
<form method="post" id="form" enctype="multipart/form-data">

    <div id="divSettings" class="">
        <div class="error-msg"></div>


        @if (ViewBag.Message != null)
        {
            <div class="info-msg" style="display:block">@ViewBag.Message</div>
        }

        <div class="nav-tabs-custom ">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#" id="a1">公司信息</a></li>
                <li class=""><a href="#" id="a2">打印（通用）</a></li>
                <li class=""><a href="#" id="a3">业务单打印</a></li>
                <li class=""><a href="#" id="a4">生产单打印</a></li>
                <li class=""><a href="#" id="a5">安装单打印</a></li>
                <li class=""><a href="#" id="a6">开单设置</a></li>
                <li class=""><a href="#" id="a7">库存设置</a></li>
                <li class=""><a href="#" id="a8">绩效设置</a></li>
                <li class=""><a href="#" id="a9">其它设置</a></li>
            </ul>
            <div class="tab-content" style="min-height:200px">
                <div class="tab-pane active" id="tab_1">
                    <table class="tableEdit ">
                        <tr>
                            <td class="label">公司名称</td>
                            <td>@Html.TextBox("CompanyNameOnReport", null, new { @style = "width:400px" }) <span class="redStar">*</span> </td>
                        </tr>

                        <tr>
                            <td class="label">公司地址</td>
                            <td>@Html.TextBox("AddressOnReport", null, new { @style = "width:400px" })</td>
                        </tr>
                        <tr>
                            <td class="label">公司邮编</td>
                            <td>@Html.TextBox("PostCodeOnReport", null, new { @style = "width:200px" })</td>
                        </tr>
                        <tr>
                            <td class="label">公司电话</td>
                            <td>@Html.TextBox("PhoneFaxOnReport", null, new { @style = "width:200px" }) <span class="redStar">*</span> </td>
                        </tr>

                    </table>

                </div>

                <div class="tab-pane" id="tab_2">
                    <div class="gray">提示：打印（通用）设置对所有类型的单据打印均适用</div>
                    <table class="tableEdit ">

                        <tr>
                            <td class="label">字体大小</td>
                            <td>
                                @Html.DropDownList("PrintCommonFontSize", new SelectList(ViewBag.DdlFontSize as List<Com._9pm2.ClientWeb.Common.SimpleItemList>, "ItemValue", "ItemText"))   &nbsp;<span class="redStar">*</span>
                            </td>
                        </tr>
                        <tr style="display:none">
                            <td class="label">字体类型</td>
                            <td>
                                @Html.DropDownList("PrintCommonFontName", new SelectList(ViewBag.DdlFontName as List<Com._9pm2.ClientWeb.Common.SimpleItemList>, "ItemValue", "ItemText"))   &nbsp;<span class="redStar">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td class="label">页边距（上右下左）</td>
                            <td>
                                @Html.TextBox("PrintCommonMargin", null, new { @style = "width:200px" }) <span class="redStar">*</span>
                            </td>
                        </tr>

                    </table>
                </div>

                <div class="tab-pane" id="tab_3">
                    <div class="gray">提示：业务单打印设置对客户业务单、客户报价单及外协单打印均适用</div>
                    <table class="tableEdit ">

                        <tr>
                            <td class="label">业务单打印空白行</td>
                            <td style="width:280px">@Html.CheckBox("PrintDeliveryEmptyRow")</td>
                            <td class="label" rowspan="3">业务单左上角图片<br />（Logo或二维码）</td>
                            <td rowspan="3">

                                @if (!string.IsNullOrEmpty(Model.ImgOnDeliveryPrint))
                                { <div class="order-img">
                                    <img style="height:60px;" src="/CompanyLogo/@Model.ImgOnDeliveryPrint" />

                                    <a href="javascript:void(0)" class="img-delete" onclick="deleteImg(this)">
                                        <img src="~/Images/delete.png" title="删除" />
                                    </a>
                                </div>
                                }

                                <input type="file" id="img-delivery" name="img-delivery" />
                                <div class="tip">建议尺寸：宽度70~120px，高度70px</div>
                                @Html.Hidden("ImgOnDeliveryPrint")
                            </td>
                        </tr>

                        <tr>
                            <td class="label">业务单空白行行数</td>
                            <td>@Html.TextBox("PrintDeliveryEmptyRowNumber", null, new { @style = "width:120px" }) <span class="redStar">*</span> </td>
                        </tr>
                        <tr>
                            <td class="label">业务单打印方式</td>
                            <td>
                                @Html.RadioButtonFor(m => m.PrintDeliveryMethod, 1, new { @id = "radio1", @name = "rdolstState" }) 网页打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintDeliveryMethod, 2, new { @id = "radio2", @name = "rdolstState" }) Pdf打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintDeliveryMethod, 3, new { @id = "radio3", @name = "rdolstState" }) Excel打印
                            </td>
                        </tr>
                        <tr>
                            <td class="label">业务单打印可选项</td>
                            <td colspan="3">
                                @Html.CheckBox("PrintDeliveryOrderNo") 订单编号 &nbsp;
                                @Html.CheckBox("PrintDeliveryTransactionDate") 交易日期 &nbsp;
                                @Html.CheckBox("PrintDeliveryCategory") 业务类别 &nbsp;
                                @Html.CheckBox("PrintDeliveryMaterial") 材料名称 &nbsp;
                                @Html.CheckBox("PrintDeliveryUnit") 计价单位 &nbsp;
                                @Html.CheckBox("PrintDeliveryDetail") 明细 &nbsp;
                                @Html.CheckBox("PrintDeliveryMemo") 明细备注 &nbsp;
                                @Html.CheckBox("PrintDeliveryOrderMemo") 订单备注
                            </td>
                        </tr>
                        <tr>
                            <td class="label">优先使用开单人电话</td>
                            <td colspan="3">
                                @Html.CheckBox("PrintDeliveryShowPersonalPhone")
                            </td>
                        </tr>
                        <tr>
                            <td class="label">业务单底部三联单文本</td>
                            <td colspan="3">
                                @Html.TextBox("PrintDeliveryBottomText", null, new { @style = "width:360px" }) <span class=""> 竖线分隔，比如“第一联：存根|第二联：客户|第三联：财务”</span>
                            </td>
                        </tr>


                    </table>
                </div>

                <div class="tab-pane" id="tab_4">

                    <table class="tableEdit ">

                        <tr>
                            <td class="label">生产单打印空白行</td>
                            <td style="width:280px">@Html.CheckBox("PrintOrderEmptyRow")</td>
                            <td class="label" rowspan="3">生产单左上角图片<br />（Logo或二维码）</td>
                            <td rowspan="3">

                                @if (!string.IsNullOrEmpty(Model.ImgOnOrderPrint))
                                { <div class="order-img">
                                    <img style="height:60px;" src="/CompanyLogo/@Model.ImgOnOrderPrint" />

                                    <a href="javascript:void(0)" class="img-delete" onclick="deleteImg(this)">
                                        <img src="~/Images/delete.png" title="删除" />
                                    </a>
                                </div>
                                }

                                <input type="file" id="img-order" name="img-order" />
                                <div class="tip">建议尺寸：宽度70~120px，高度70px</div>
                                @Html.Hidden("ImgOnOrderPrint")
                            </td>
                        </tr>

                        <tr>
                            <td class="label">生产单空白行行数</td>
                            <td>@Html.TextBox("PrintOrderEmptyRowNumber", null, new { @style = "width:120px" }) <span class="redStar">*</span> </td>
                        </tr>
                        <tr>
                            <td class="label">生产单打印方式</td>
                            <td>
                                @Html.RadioButtonFor(m => m.PrintOrderMethod, 1, new { @id = "radio1", @name = "rdolstState" }) 网页打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintOrderMethod, 2, new { @id = "radio2", @name = "rdolstState" }) Pdf打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintOrderMethod, 3, new { @id = "radio3", @name = "rdolstState" }) Excel打印&nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="label">生产单打印可选项</td>
                            <td colspan="3">
                                @Html.CheckBox("PrintOrderOrderNo") 订单编号 &nbsp;
                                @Html.CheckBox("PrintOrderCategory") 业务类别 &nbsp;
                                @Html.CheckBox("PrintOrderMaterial") 材料名称 &nbsp;
                                @Html.CheckBox("PrintOrderUnit") 计价单位 &nbsp;
                                @Html.CheckBox("PrintOrderMemo") 明细备注&nbsp;
                                @Html.CheckBox("PrintOrderOrderMemo") 订单备注
                            </td>
                        </tr>

                    </table>
                </div>

                <div class="tab-pane" id="tab_5">

                    <table class="tableEdit ">

                        <tr>
                            <td class="label">安装单打印空白行</td>
                            <td style="width:280px">@Html.CheckBox("PrintInstallEmptyRow")</td>
                            <td class="label" rowspan="3">安装单左上角图片<br />（Logo或二维码）</td>
                            <td rowspan="3">

                                @if (!string.IsNullOrEmpty(Model.ImgOnInstallPrint))
                                { <div class="order-img">
                                    <img style="height:60px;" src="/CompanyLogo/@Model.ImgOnInstallPrint" />

                                    <a href="javascript:void(0)" class="img-delete" onclick="deleteImg(this)">
                                        <img src="~/Images/delete.png" title="删除" />
                                    </a>
                                </div>
                                }

                                <input type="file" id="img-install" name="img-install" />
                                <div class="tip">建议尺寸：宽度70~120px，高度70px</div>
                                @Html.Hidden("ImgOnInstallPrint")
                            </td>
                        </tr>

                        <tr>
                            <td class="label">安装单空白行行数</td>
                            <td>@Html.TextBox("PrintInstallEmptyRowNumber", null, new { @style = "width:120px" }) <span class="redStar">*</span> </td>
                        </tr>
                        <tr>
                            <td class="label">安装单打印方式</td>
                            <td>
                                @Html.RadioButtonFor(m => m.PrintInstallMethod, 1, new { @id = "radio1", @name = "rdolstState" }) 网页打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintInstallMethod, 2, new { @id = "radio2", @name = "rdolstState" }) Pdf打印&nbsp;
                                @Html.RadioButtonFor(m => m.PrintInstallMethod, 3, new { @id = "radio3", @name = "rdolstState" }) Excel打印&nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="label">安装单打印可选项</td>
                            <td colspan="3">
                                @Html.CheckBox("PrintInstallOrderNo") 订单编号 &nbsp;
                                @Html.CheckBox("PrintInstallCategory") 业务类别 &nbsp;
                                @Html.CheckBox("PrintInstallMaterial") 材料名称 &nbsp;
                                @Html.CheckBox("PrintInstallUnit") 计价单位 &nbsp;
                                @Html.CheckBox("PrintInstallMemo") 明细备注&nbsp;
                                @Html.CheckBox("PrintInstallOrderMemo") 订单备注
                            </td>
                        </tr>

                    </table>
                </div>

                <div class="tab-pane" id="tab_6">
                    <table class="tableEdit ">
                        <tr>
                            <td class="label">启用标准开单（客户订单）</td>
                            <td>@Html.CheckBox("EnableStandarOrder")</td>
                        </tr>
                        <tr>
                            <td class="label">启用极速开单（客户订单）</td>
                            <td>@Html.CheckBox("EnableSimpleOrder")</td>
                        </tr>
                        <tr>
                            <td class="label">启用标准开单（外协订单）</td>
                            <td>@Html.CheckBox("EnableStandarFactoryOrder")</td>
                        </tr>
                        <tr>
                            <td class="label">启用极速开单（外协订单）</td>
                            <td>@Html.CheckBox("EnableSimpleFactoryOrder")</td>
                        </tr>
                        <tr>
                            <td class="label">默认开单方式（客户订单）</td>
                            <td>
                                @Html.RadioButtonFor(m => m.OrderEditDefaultModel, 1, new { @id = "radio1", @name = "rdolstState" })标准开单 &nbsp;
                                @Html.RadioButtonFor(m => m.OrderEditDefaultModel, 2, new { @id = "radio2", @name = "rdolstState" })极速开单
                            </td>
                        </tr>                       
                        <tr>
                            <td class="label" style="line-height:24px">开客户单关联创建外协单</td>
                            <td>
                                @Html.CheckBox("ShowRightFactoryItem") 右侧显示外协开单 &nbsp;&nbsp;
                                @Html.CheckBox("ShowSimpleFactoryItem") 下方显示外协开单
                            </td>
                        </tr>
                        <tr>
                            <td class="label">长宽单位（极速开单）</td>
                            <td>
                                @Html.RadioButtonFor(m => m.WidthUnit, "m", new { @id = "radio1", @name = "rdolstState" }) 米（m） &nbsp;
                                @Html.RadioButtonFor(m => m.WidthUnit, "cm", new { @id = "radio2", @name = "rdolstState" }) 厘米（cm）
                                @Html.RadioButtonFor(m => m.WidthUnit, "mm", new { @id = "radio3", @name = "rdolstState" }) 毫米（mm）
                            </td>
                        </tr>

                    </table>
                </div>

                <div class="tab-pane" id="tab_7">
                    <table class="tableEdit ">
                        <tr>
                            <td class="label">开单时自动扣减库存</td>
                            <td>@Html.CheckBox("DeductStock")</td>
                        </tr>
                        <tr>
                            <td class="label">库存为零时继续扣减</td>
                            <td>@Html.CheckBox("DeductStockLessThenZero")</td>
                        </tr>
                    </table>
                </div>

                <div class="tab-pane" id="tab_8">
                    <table class="tableEdit ">

                        <tr>
                            <td class="label">绩效提成方式</td>
                            <td>
                                @Html.RadioButtonFor(m => m.PerformanceCalculationType, 1, new { @id = "radio1", @name = "rdolstState" })按订单金额 &nbsp;
                                @Html.RadioButtonFor(m => m.PerformanceCalculationType, 2, new { @id = "radio2", @name = "rdolstState" })按订单利润
                            </td>
                        </tr>
                        <tr>
                            <td class="label">绩效提成比例</td>
                            <td>@Html.TextBox("PerformanceCalculationRatio") % <span class="redStar">*</span> </td>
                        </tr>

                    </table>
                </div>

                <div class="tab-pane" id="tab_9">
                    <table class="tableEdit ">
                        <tr>
                            <td class="label">每页显示记录数</td>
                            <td>@Html.TextBox("PageSize") <span class="redStar">*</span> </td>
                        </tr>
                        <tr>
                            <td class="label" style="line-height:24px">客户订单查询页面<br />显示客户颜色标记</td>
                            <td>@Html.CheckBox("ShowCustomerCategory")
                        </tr>
                        <tr>
                            <td class="label" style="line-height:24px">客户订单查询页面<br />显示完工剩余天数</td>
                            <td>@Html.CheckBox("ShowOrderDueDay")
                        </tr>

                        <tr>
                            <td class="label" style="line-height:24px">订单查询页面<br />显示金额总计</td>
                            <td>@Html.CheckBox("ShowOrderTotalAmount")
                        </tr>

                        <tr>
                            <td class="label">启用流程跟踪</td>
                            <td>
                                @Html.CheckBox("EnableWorkFlow")
                            </td>
                        </tr>
                    </table>
                </div>

            </div>

        </div>

    </div>

    <div style="text-align:right;">
        <button class="btn btn-primary" type="button" id="btnSave">保存</button>
    </div>
     
</form>

<script>
    function deleteImg(v) {
        $(v).parent().find("img").remove();
        $(v).parent().parent().find("input[type='hidden']").val("");
    }
</script>
