<#assign base=request.contextPath />
<#import "../common/defaultLayout.ftl" as defaultLayout>
<@defaultLayout.layout>

<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目概算表</strong></div>
        </div>

<form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateAddSave">
    <!--选项卡(tabs)begin-->
    <div class="am-tabs am-margin" data-am-tabs>
        <ul class="am-tabs-nav am-nav am-nav-tabs">
            <li class="am-active"><a href="#tab1">项目基本信息</a></li>
            <li><a href="#tab2">项目详细信息</a></li>
        </ul>
        <div class="am-tabs-bd">
            <div class="am-tab-panel am-fade am-in am-active" id="tab1">
            <#--<input name="permissionID" id="permissionID" type="hidden" value="${permissionID!}" />-->
                <!--验证表单元素(validate) begin-->

                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>部门名称</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <span>${dept.name}</span>
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>

                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划开始时间</div>
                    <div class="am-u-sm-2 am-u-md-2">
                        <div class="am-form-group am-form-icon">
                            <i class="am-icon-calendar"></i>
                            <input type="text" class="am-form-field am-input-sm" id="startDate"
                                   name="startDate" autocomplete="off"
                                   value="" placeholder="项目计划开始时间"
                                   data-am-datepicker>
                        </div>
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划结束时间</div>
                    <div class="am-u-sm-2 am-u-md-2">
                        <div class="am-form-group am-form-icon">
                            <i class="am-icon-calendar"></i>
                            <input type="text" class="am-form-field am-input-sm" id="endDate"
                                   name="endDate" autocomplete="off"
                                   value="" placeholder="项目计划结束时间"
                                   data-am-datepicker>
                        </div>
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>



                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目名称</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="text" class="am-input" data-validate-async data-validation-message="请输入项目名称(20字符以内)"
                               name="name" placeholder="请输入项目名称(20字符以内)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>

                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目类型</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <select data-am-selected id="type" name="type">
                            <option value="1" >工程集成类</option>
                            <option value="2" >设备集成类</option>
                            <option value="3" >战略合作类</option>
                        </select>
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资模式</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <select data-am-selected id="underwrittenMode" name="underwrittenMode">
                            <option value="1" >A类-不垫资(战略合作)</option>
                            <option value="2" >B类-不垫资(背靠背)</option>
                            <option value="3" >C类-垫资(账期覆盖)</option>
                            <option value="4" >D类-垫资(账期不覆盖)</option>
                        </select>
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>

                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>客户名称</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="text" class="am-input" data-validate-async data-validation-message="请输入客户名称(20字符以内)"
                               name="customer" placeholder="请输入客户名称(20字符以内)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>终端客户名称</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="text" class="am-input" data-validate-async data-validation-message="请输入终端客户名称(20字符以内)"
                               name="terminalCustomer" placeholder="请输入终端客户名称(20字符以内)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资利息</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资利息"
                               name="advanceInterestAmount" placeholder="单位(元)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资峰值</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资峰值"
                               name="advancePeakAmount" placeholder="单位(元)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>合同金额</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="number" class="am-input" data-validate-async data-validation-message="请输入合同金额"
                               name="contractAmount" placeholder="单位(元)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>行业场景应用</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="text" class="am-input" data-validate-async data-validation-message="请输入行业场景应用"
                               name="industryScenario" placeholder="请输入行业场景应用" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>华智产品金额</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="number" class="am-input" data-validate-async data-validation-message="华智产品金额"
                               name="huazhiProductAmount" placeholder="单位(元)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>紫光其他产品金额</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="number" class="am-input" data-validate-async data-validation-message="请输入紫光其他产品金额"
                               name="ziguangOtherAmount" placeholder="单位(元)" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>
                <div class="am-g am-form-group am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>主合同收款条款</div>
                    <div class="am-u-sm-6 am-u-md-6">
                        <input type="text" class="am-input" data-validate-async data-validation-message="请输入收款条款"
                               name="mainContractCollectionTerms" placeholder="请输入收款条款" maxlength="20"
                               value="" required />
                    </div>
                    <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                </div>

            </div>
            <!--验证表单元素(validate end-->
        </div>
        <div class="am-tabs-bd">
            <div class="am-tab-panel am-fade am-in" id="tab2">
                <span class="am-text-lg">收入</span>
                <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                    <tbody>
                        <tr class="am-text-lg">
                            <td>类别</td>
                            <td>费用</td>
                            <td>含税金额(元)</td>
                            <td>不含税金额(元)</td>
                        </tr>
                        <tr>
                            <td>收入</td>
                            <td>设备类</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeDeviceTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeDeviceTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>收入</td>
                            <td>工程类</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeEngineerTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeEngineerTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>收入</td>
                            <td>服务类</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeServiceTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeServiceTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td></td>
                            <td><input type="number" name="incomeTotalTaxInclude" readonly title="此列累计"></td>
                            <td><input type="number" name="incomeTotalTaxExclude" readonly title="此列累计"></td>
                        </tr>
                    </tbody>
                </table>
                <span class="am-text-lg">成本</span>
                <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                    <tbody>
                        <tr class="am-text-lg">
                            <td>类别</td>
                            <td>费用</td>
                            <td>费用项目</td>
                            <td>含税金额(元)</td>
                            <td>不含税金额(元)</td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>采购成本</td>
                            <td>设备</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseDeviceTaxInclude" required></td>
                            <td><input type="number" name="costPurchaseDeviceTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>采购成本</td>
                            <td>施工</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseBuildTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseBuildTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>采购成本</td>
                            <td>服务</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseServiceTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseServiceTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>采购成本</td>
                            <td>其他</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseOtherTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costPurchaseOtherTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>项目管理成本</td>
                            <td>项目管理成本</td>
                            <td><input type="number" name="costProjectManageTaxInclude" required readonly></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costProjectManageTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>成本</td>
                            <td>其他</td>
                            <td>其他</td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costOtherOtherTaxInclude" required></td>
                            <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costOtherOtherTaxExclude" required></td>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td></td>
                            <td></td>
                            <td><input type="number" name="costTotalTaxInclude" readonly title="此列累计"></td>
                            <td><input type="number" name="costTotalTaxExclude" readonly title="此列累计"></td>
                        </tr>
                    </tbody>
                </table>
                <span class="am-text-lg">管理</span>
                <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                    <tbody>
                    <tr class="am-text-lg">
                        <td>类别</td>
                        <td>费用项目</td>
                        <td>不含税金额(元)</td>
                    </tr>
                    <tr>
                        <td>财务费用</td>
                        <td>资金占用成本</td>
                        <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costExpropriationTaxExclude" required></td>
                    </tr>
                    <tr>
                        <td>公司管理费用</td>
                        <td></td>
                        <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costCompanyManageTaxExclude" required></td>
                    </tr>
                    </tbody>
                </table>

                <span class="am-text-lg">利润率计算</span>
                <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                    <tbody>
                    <tr class="am-text-lg">
                        <td>类别</td>
                        <td>不含税金额(元)</td>
                        <td>利润率(%)</td>
                    </tr>
                    <tr>
                        <td>项目毛利</td>
                        <td><input type="number" name="projectGrossProfit" readonly title="收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)"></td>
                        <td><input type="number" name="projectGrossProfitRate" readonly title="毛利(不含税)/收入总计(不含税)"></td>
                    </tr>
                    <tr>
                        <td>项目贡献利润率</td>
                        <td><input type="number" name="projectContributionProfit" readonly title="项目毛利(不含税)-公司管理费用总计(不含税)"></td>
                        <td><input type="number" name="projectContributionProfitRate" readonly title="贡献利润(不含税)/收入总计(不含税)"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <!--验证表单元素(validate end-->
        </div>
    </div>
    </div>
    <!--选项卡(tabs)end-->
    <div class="am-margin">
        <button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">返回上一级</button>
        <button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveDraft">保存草稿</button>
        <button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveApprove">提交审核</button>
    </div>
</form>

</div>
</div>
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_estimate.js"></script>
<script>
    $(function () {
        calIncomeAndCost();
        $("#saveDraft").click(function () {
            $("#pmsForm").attr("action","${base}/project/estimateAddSave");
            $("#pmsForm").submit();
        });
        $("#saveApprove").click(function () {
            $("#pmsForm").attr("action","${base}/project/estimateAddSaveAndApprove");
            $("#pmsForm").submit();
        });
    });

</script>
</@defaultLayout.layout>