Browse Source

[feat] 销售管理

修改总经理添加经营成本前端页面:去掉提交方法中 不含税人工成本、不含税推广成本、不含税业务成本、不含税管理成本相关的方法
去掉 从 `salesEstimateDetailVo` 中获取其他成本信息方法中的,上述四个字段,新增上一年度的总经营不含税成本合计;计算上一年度含税总经营成本,增值税率为 13%;计算 上一年度总物料含税成本合计,增值税率为 13%;计算该料号的不含税经营成本 (RMB)=(该料号的BOM物料不含税总采购成本/上一年度总物料不含税成本合计)*上一年度的总经营不含税成本合计;计算该料号的含税经营成本 (RMB)=(该料号的BOM物料含税总采购成本/上一年度总物料含税成本合计)*上一年度的总经营含税成本合计
修改 总经营成本->上一年度总经营成本;总物料成本->上一年度总物料成本;
事件监听去掉之前四个成本的监听事件,加上totalOperatingCosts监听事件
新增 calculateOperatingCosts方法,通过输入不含税总经营成本(RMB),和不含税总物料成本(RMB)动态计算不含税经营成本(RMB)、含税经营成本(RMB)
销售估价详情数据库表、实体类和mapper.xml层的所有方法新增 上一年度不含税总经营成本字段
物料详情子表包括form表单的数据 去掉不含税人工成本、不含税推广成本、不含税业务成本、不含税管理成本,新增 上一年度不含税总经营成本字段
修改 查询销售估价详情物料价格列表方法:新增 给上一年度不含税总经营成本赋值,去掉之前四个的赋值
修改 查询销售估价Vo详情方法:新增 给上一年度不含税总经营成本赋值,去掉之前四个的赋值
dev
liuxiaoxu 3 months ago
parent
commit
067af76268
  1. 13
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimateDetail.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesEstimateDetailMaterialVo.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateDetailMaterialServiceImpl.java
  4. 6
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml
  6. 177
      ruoyi-admin/src/main/resources/templates/sales/estimate/ceoAdd.html

13
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimateDetail.java

@ -135,6 +135,11 @@ public class SalesEstimateDetail extends BaseEntity
/** 含税经营成本(RMB) */ /** 含税经营成本(RMB) */
private BigDecimal taxOperatingCosts; private BigDecimal taxOperatingCosts;
/** 上一年度不含税总经营成本(RMB) */
private BigDecimal totalOperatingCosts;
/** 销售估价详情物料子表集合 */ /** 销售估价详情物料子表集合 */
private List<SalesEstimateDetailMaterial> salesEstimateDetailMaterialList; private List<SalesEstimateDetailMaterial> salesEstimateDetailMaterialList;
@ -427,6 +432,13 @@ public class SalesEstimateDetail extends BaseEntity
return taxOperatingCosts; return taxOperatingCosts;
} }
public BigDecimal getTotalOperatingCosts() {
return totalOperatingCosts;
}
public void setTotalOperatingCosts(BigDecimal totalOperatingCosts) {
this.totalOperatingCosts = totalOperatingCosts;
}
public List<SalesEstimateDetailMaterial> getSalesEstimateDetailMaterialList() { public List<SalesEstimateDetailMaterial> getSalesEstimateDetailMaterialList() {
return salesEstimateDetailMaterialList; return salesEstimateDetailMaterialList;
@ -471,6 +483,7 @@ public class SalesEstimateDetail extends BaseEntity
.append("noTaxMaterialCosts", getNoTaxMaterialCosts()) .append("noTaxMaterialCosts", getNoTaxMaterialCosts())
.append("noTaxOperatingCosts", getNoTaxOperatingCosts()) .append("noTaxOperatingCosts", getNoTaxOperatingCosts())
.append("taxOperatingCosts", getTaxOperatingCosts()) .append("taxOperatingCosts", getTaxOperatingCosts())
.append("totalOperatingCosts", getTotalOperatingCosts())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

13
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesEstimateDetailMaterialVo.java

@ -17,17 +17,8 @@ public class SalesEstimateDetailMaterialVo extends SalesEstimateDetailMaterial {
/** 不含税开发成本(RMB) */ /** 不含税开发成本(RMB) */
private BigDecimal noTaxDevelopCosts; private BigDecimal noTaxDevelopCosts;
/** 不含税人工成本(RMB) */ /** 上一年度不含税总经营成本(RMB) */
private BigDecimal noTaxLaborCosts; private BigDecimal totalOperatingCosts;
/** 不含税推广成本(RMB) */
private BigDecimal noTaxPromotionalCosts;
/** 不含税业务成本(RMB) */
private BigDecimal noTaxBusinessCosts;
/** 不含税管理成本(RMB) */
private BigDecimal noTaxManagesCosts;
/** 不含税总物料成本(RMB) */ /** 不含税总物料成本(RMB) */
private BigDecimal noTaxMaterialCosts; private BigDecimal noTaxMaterialCosts;

5
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateDetailMaterialServiceImpl.java

@ -92,16 +92,13 @@ public class SalesEstimateDetailMaterialServiceImpl implements ISalesEstimateDet
private void setCosts(SalesEstimateDetailMaterialVo vo, SalesEstimateDetail salesEstimateDetail) { private void setCosts(SalesEstimateDetailMaterialVo vo, SalesEstimateDetail salesEstimateDetail) {
vo.setNoTaxMaterialCosts(salesEstimateDetail.getNoTaxMaterialCosts()); vo.setNoTaxMaterialCosts(salesEstimateDetail.getNoTaxMaterialCosts());
vo.setNoTaxBusinessCosts(salesEstimateDetail.getNoTaxBusinessCosts());
vo.setNoTaxDevelopCosts(salesEstimateDetail.getNoTaxDevelopCosts()); vo.setNoTaxDevelopCosts(salesEstimateDetail.getNoTaxDevelopCosts());
vo.setNoTaxLaborCosts(salesEstimateDetail.getNoTaxLaborCosts());
vo.setNoTaxManagesCosts(salesEstimateDetail.getNoTaxManagesCosts());
vo.setNoTaxOperatingCosts(salesEstimateDetail.getNoTaxOperatingCosts()); vo.setNoTaxOperatingCosts(salesEstimateDetail.getNoTaxOperatingCosts());
vo.setTaxOperatingCosts(salesEstimateDetail.getTaxOperatingCosts()); vo.setTaxOperatingCosts(salesEstimateDetail.getTaxOperatingCosts());
vo.setNoTaxPromotionalCosts(salesEstimateDetail.getNoTaxPromotionalCosts());
vo.setNoTaxServiceCosts(salesEstimateDetail.getNoTaxServiceCosts()); vo.setNoTaxServiceCosts(salesEstimateDetail.getNoTaxServiceCosts());
vo.setNoTaxShippingCosts(salesEstimateDetail.getNoTaxShippingCosts()); vo.setNoTaxShippingCosts(salesEstimateDetail.getNoTaxShippingCosts());
vo.setProfitRate(salesEstimateDetail.getProfitRate()); vo.setProfitRate(salesEstimateDetail.getProfitRate());
vo.setTotalOperatingCosts(salesEstimateDetail.getTotalOperatingCosts());
} }

6
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java

@ -213,10 +213,8 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
salesEstimateDetailVo.setEProfitRate(salesEstimateTemplate.geteProfitRate()); salesEstimateDetailVo.setEProfitRate(salesEstimateTemplate.geteProfitRate());
salesEstimateDetailVo.setFProfitRate(salesEstimateTemplate.getfProfitRate()); salesEstimateDetailVo.setFProfitRate(salesEstimateTemplate.getfProfitRate());
salesEstimateDetailVo.setNoTaxLaborCosts(salesEstimateTemplate.getNoTaxLaborCosts());
salesEstimateDetailVo.setNoTaxBusinessCosts(salesEstimateTemplate.getNoTaxBusinessCosts()); salesEstimateDetailVo.setTotalOperatingCosts(salesEstimateTemplate.getTotalOperatingCosts());
salesEstimateDetailVo.setNoTaxManagesCosts(salesEstimateTemplate.getNoTaxManagesCosts());
salesEstimateDetailVo.setNoTaxPromotionalCosts(salesEstimateTemplate.getNoTaxPromotionalCosts());
salesEstimateDetailVo.setNoTaxMaterialCosts(salesEstimateTemplate.getNoTaxMaterialCosts()); salesEstimateDetailVo.setNoTaxMaterialCosts(salesEstimateTemplate.getNoTaxMaterialCosts());
return salesEstimateDetailVo; return salesEstimateDetailVo;
} }

8
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml

@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="noTaxMaterialCosts" column="no_tax_material_costs" /> <result property="noTaxMaterialCosts" column="no_tax_material_costs" />
<result property="noTaxOperatingCosts" column="no_tax_operating_costs" /> <result property="noTaxOperatingCosts" column="no_tax_operating_costs" />
<result property="taxOperatingCosts" column="tax_operating_costs" /> <result property="taxOperatingCosts" column="tax_operating_costs" />
<result property="totalOperatingCosts" column="total_operating_costs" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -45,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSalesEstimateDetailVo"> <sql id="selectSalesEstimateDetailVo">
select estimate_detail_id, sales_estimate_code, material_gear_position, usd_rate, profit_rate, material_no, material_name, material_type, material_photo_url, material_unit, material_brand, material_describe, material_process_method, material_num, no_tax_rmb, tax_rmb, all_no_tax_rmb, all_tax_rmb, tax_dollar, no_tax_dollar, all_tax_dollar, all_no_tax_dollar, no_tax_shipping_costs, no_tax_service_costs, no_tax_develop_costs, no_tax_labor_costs, no_tax_promotional_costs, no_tax_business_costs, no_tax_manages_costs, no_tax_material_costs, no_tax_operating_costs, tax_operating_costs, create_by, create_time, update_by, update_time, remark from sales_estimate_detail select estimate_detail_id, sales_estimate_code, material_gear_position, usd_rate, profit_rate, material_no, material_name, material_type, material_photo_url, material_unit, material_brand, material_describe, material_process_method, material_num, no_tax_rmb, tax_rmb, all_no_tax_rmb, all_tax_rmb, tax_dollar, no_tax_dollar, all_tax_dollar, all_no_tax_dollar, no_tax_shipping_costs, no_tax_service_costs, no_tax_develop_costs, no_tax_labor_costs, no_tax_promotional_costs, no_tax_business_costs, no_tax_manages_costs, no_tax_material_costs, no_tax_operating_costs, tax_operating_costs, total_operating_costs, create_by, create_time, update_by, update_time, remark from sales_estimate_detail
</sql> </sql>
<select id="selectSalesEstimateDetailList" parameterType="SalesEstimateDetail" resultMap="SalesEstimateDetailResult"> <select id="selectSalesEstimateDetailList" parameterType="SalesEstimateDetail" resultMap="SalesEstimateDetailResult">
@ -102,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noTaxMaterialCosts != null">no_tax_material_costs,</if> <if test="noTaxMaterialCosts != null">no_tax_material_costs,</if>
<if test="noTaxOperatingCosts != null">no_tax_operating_costs,</if> <if test="noTaxOperatingCosts != null">no_tax_operating_costs,</if>
<if test="taxOperatingCosts != null">tax_operating_costs,</if> <if test="taxOperatingCosts != null">tax_operating_costs,</if>
<if test="totalOperatingCosts != null">total_operating_costs,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -140,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noTaxMaterialCosts != null">#{noTaxMaterialCosts},</if> <if test="noTaxMaterialCosts != null">#{noTaxMaterialCosts},</if>
<if test="noTaxOperatingCosts != null">#{noTaxOperatingCosts},</if> <if test="noTaxOperatingCosts != null">#{noTaxOperatingCosts},</if>
<if test="taxOperatingCosts != null">#{taxOperatingCosts},</if> <if test="taxOperatingCosts != null">#{taxOperatingCosts},</if>
<if test="totalOperatingCosts != null">#{totalOperatingCosts},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -184,6 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
no_tax_material_costs, no_tax_material_costs,
no_tax_operating_costs, no_tax_operating_costs,
tax_operating_costs, tax_operating_costs,
total_operating_costs,
create_by, create_by,
create_time create_time
) )
@ -220,6 +224,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.noTaxMaterialCosts}, #{item.noTaxMaterialCosts},
#{item.noTaxOperatingCosts}, #{item.noTaxOperatingCosts},
#{item.taxOperatingCosts}, #{item.taxOperatingCosts},
#{item.totalOperatingCosts},
#{item.createBy}, #{item.createBy},
#{item.createTime} #{item.createTime}
</foreach> </foreach>
@ -263,6 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noTaxMaterialCosts != null">no_tax_material_costs = #{noTaxMaterialCosts},</if> <if test="noTaxMaterialCosts != null">no_tax_material_costs = #{noTaxMaterialCosts},</if>
<if test="noTaxOperatingCosts != null">no_tax_operating_costs = #{noTaxOperatingCosts},</if> <if test="noTaxOperatingCosts != null">no_tax_operating_costs = #{noTaxOperatingCosts},</if>
<if test="taxOperatingCosts != null">tax_operating_costs = #{taxOperatingCosts},</if> <if test="taxOperatingCosts != null">tax_operating_costs = #{taxOperatingCosts},</if>
<if test="totalOperatingCosts != null">total_operating_costs = #{totalOperatingCosts},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>

177
ruoyi-admin/src/main/resources/templates/sales/estimate/ceoAdd.html

@ -132,10 +132,6 @@
"noTaxDevelopCosts": null, // 初始化为 null 或 0 "noTaxDevelopCosts": null, // 初始化为 null 或 0
"noTaxShippingCosts": null, "noTaxShippingCosts": null,
"noTaxServiceCosts": null, "noTaxServiceCosts": null,
"noTaxLaborCosts": null,
"noTaxPromotionalCosts": null,
"noTaxBusinessCosts": null,
"noTaxManagesCosts": null,
"noTaxMaterialCosts": null, "noTaxMaterialCosts": null,
"noTaxOperatingCosts": null, "noTaxOperatingCosts": null,
"taxOperatingCosts": null, "taxOperatingCosts": null,
@ -149,10 +145,6 @@
var noTaxDevelopCosts = $('#noTaxDevelopCosts' + index).val(); var noTaxDevelopCosts = $('#noTaxDevelopCosts' + index).val();
var noTaxShippingCosts = $('#noTaxShippingCosts' + index).val(); var noTaxShippingCosts = $('#noTaxShippingCosts' + index).val();
var noTaxServiceCosts = $('#noTaxServiceCosts' + index).val(); var noTaxServiceCosts = $('#noTaxServiceCosts' + index).val();
var noTaxLaborCosts = $('#noTaxLaborCosts' + index).val();
var noTaxPromotionalCosts = $('#noTaxPromotionalCosts' + index).val();
var noTaxBusinessCosts = $('#noTaxBusinessCosts' + index).val();
var noTaxManagesCosts = $('#noTaxManagesCosts' + index).val();
var noTaxMaterialCosts = $('#noTaxMaterialCosts' + index).val(); var noTaxMaterialCosts = $('#noTaxMaterialCosts' + index).val();
var noTaxOperatingCosts = $('#noTaxOperatingCosts' + index).val(); var noTaxOperatingCosts = $('#noTaxOperatingCosts' + index).val();
var taxOperatingCosts = $('#taxOperatingCosts' + index).val(); var taxOperatingCosts = $('#taxOperatingCosts' + index).val();
@ -174,27 +166,6 @@
hasError = true; hasError = true;
return; // 退出循环,阻止进一步处理 return; // 退出循环,阻止进一步处理
} }
if (!noTaxLaborCosts && noTaxLaborCosts !== '0') {
$.modal.alertWarning("人工成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的人工成本");
hasError = true;
return; // 退出循环,阻止进一步处理
}
if (!noTaxPromotionalCosts && noTaxPromotionalCosts !== '0') {
$.modal.alertWarning("推广成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的推广成本");
hasError = true;
return; // 退出循环,阻止进一步处理
}
if (!noTaxBusinessCosts && noTaxBusinessCosts !== '0') {
$.modal.alertWarning("业务成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的业务成本");
hasError = true;
return; // 退出循环,阻止进一步处理
}
if (!noTaxManagesCosts && noTaxManagesCosts !== '0') {
$.modal.alertWarning("管理成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的管理成本");
hasError = true;
return; // 退出循环,阻止进一步处理
}
if (!noTaxMaterialCosts && noTaxMaterialCosts !== '0') { if (!noTaxMaterialCosts && noTaxMaterialCosts !== '0') {
$.modal.alertWarning("物料成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的物料成本"); $.modal.alertWarning("物料成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的物料成本");
hasError = true; hasError = true;
@ -220,10 +191,6 @@
estimateMaterialDataList[index].noTaxDevelopCosts = noTaxDevelopCosts; estimateMaterialDataList[index].noTaxDevelopCosts = noTaxDevelopCosts;
estimateMaterialDataList[index].noTaxShippingCosts = noTaxShippingCosts; estimateMaterialDataList[index].noTaxShippingCosts = noTaxShippingCosts;
estimateMaterialDataList[index].noTaxServiceCosts = noTaxServiceCosts; estimateMaterialDataList[index].noTaxServiceCosts = noTaxServiceCosts;
estimateMaterialDataList[index].noTaxLaborCosts = noTaxLaborCosts;
estimateMaterialDataList[index].noTaxPromotionalCosts = noTaxPromotionalCosts;
estimateMaterialDataList[index].noTaxBusinessCosts = noTaxBusinessCosts;
estimateMaterialDataList[index].noTaxManagesCosts = noTaxManagesCosts;
estimateMaterialDataList[index].noTaxMaterialCosts = noTaxMaterialCosts; estimateMaterialDataList[index].noTaxMaterialCosts = noTaxMaterialCosts;
estimateMaterialDataList[index].noTaxOperatingCosts = noTaxOperatingCosts; estimateMaterialDataList[index].noTaxOperatingCosts = noTaxOperatingCosts;
estimateMaterialDataList[index].taxOperatingCosts = taxOperatingCosts; estimateMaterialDataList[index].taxOperatingCosts = taxOperatingCosts;
@ -489,8 +456,8 @@
var firstRow = data[0].rows[0]; var firstRow = data[0].rows[0];
// 初始化累积变量 // 初始化累积变量
let noTaxPurchaseRmb = 0; let noTaxPurchaseRmb = 0; //不含税采购总成本
let taxPurchaseRmb = 0; let taxPurchaseRmb = 0; //含税采购总成本
// 累加无税购买金额 // 累加无税购买金额
data[0].rows.forEach(function (row) { data[0].rows.forEach(function (row) {
@ -517,32 +484,31 @@
// 从 `salesEstimateDetailVo` 中获取其他成本信息 // 从 `salesEstimateDetailVo` 中获取其他成本信息
const { const {
noTaxLaborCosts = '', totalOperatingCosts = '', //上一年度的总经营不含税成本合计
noTaxPromotionalCosts = '', noTaxMaterialCosts = '' // 上一年度总物料不含税成本合计
noTaxBusinessCosts = '',
noTaxManagesCosts = '',
noTaxMaterialCosts = ''
} = salesEstimateDetailVo || {}; } = salesEstimateDetailVo || {};
// 计算不含税总经营成本
const noAllTaxOperatingCosts = (
parseFloat(noTaxLaborCosts) +
parseFloat(noTaxBusinessCosts) +
parseFloat(noTaxManagesCosts) +
parseFloat(noTaxPromotionalCosts)
).toFixed(2) || '';
// 计算含税总经营成本,假设增值税率为 13% // 计算上一年度含税总经营成本,假设增值税率为 13%
const allTaxOperatingCosts = ( const allTaxOperatingCosts = (
parseFloat(noAllTaxOperatingCosts) * 1.13 parseFloat(totalOperatingCosts) * 1.13
).toFixed(2) || '';
//上一年度总物料含税成本合计
const allTaxMaterialCosts = (
parseFloat(noTaxMaterialCosts) * 1.13
).toFixed(2) || ''; ).toFixed(2) || '';
//该料号的不含税经营成本
//该料号的不含税经营成本 (RMB)=(该料号的BOM物料不含税总采购成本/上一年度总物料不含税成本合计)*上一年度的总经营不含税成本合计
const noTaxOperatingCosts = ( const noTaxOperatingCosts = (
(noTaxPurchaseRmb/noTaxMaterialCosts) * noAllTaxOperatingCosts (noTaxPurchaseRmb/noTaxMaterialCosts) * totalOperatingCosts
).toFixed(2) || ''; ).toFixed(2) || '';
// 该料号的含税经营成本
// 该料号的含税经营成本 (RMB)=(该料号的BOM物料含税总采购成本/上一年度总物料含税成本合计)*上一年度的总经营含税成本合计
const taxOperatingCosts = ( const taxOperatingCosts = (
(taxPurchaseRmb/noTaxMaterialCosts) * allTaxOperatingCosts (taxPurchaseRmb/allTaxMaterialCosts) * allTaxOperatingCosts
).toFixed(2) || ''; ).toFixed(2) || '';
// 根据 `parentRow.profitRate` 设置利润率 // 根据 `parentRow.profitRate` 设置利润率
let profitRateKey = 'aprofitRate'; let profitRateKey = 'aprofitRate';
@ -572,10 +538,7 @@
noTaxDevelopCosts, noTaxDevelopCosts,
noTaxShippingCosts, noTaxShippingCosts,
noTaxServiceCosts, noTaxServiceCosts,
noTaxLaborCosts, totalOperatingCosts,
noTaxPromotionalCosts,
noTaxBusinessCosts,
noTaxManagesCosts,
noTaxMaterialCosts, noTaxMaterialCosts,
noTaxOperatingCosts, noTaxOperatingCosts,
taxOperatingCosts, taxOperatingCosts,
@ -590,10 +553,7 @@
noTaxDevelopCosts: '', noTaxDevelopCosts: '',
noTaxShippingCosts: '', noTaxShippingCosts: '',
noTaxServiceCosts: '', noTaxServiceCosts: '',
noTaxLaborCosts: '', totalOperatingCosts: '',
noTaxPromotionalCosts: '',
noTaxBusinessCosts: '',
noTaxManagesCosts: '',
noTaxMaterialCosts: '', noTaxMaterialCosts: '',
noTaxOperatingCosts: '', noTaxOperatingCosts: '',
taxOperatingCosts: '', taxOperatingCosts: '',
@ -616,24 +576,12 @@
formHtml += '<label for="noTaxServiceCosts' + index + '">不含税服务成本(RMB):</label>'; formHtml += '<label for="noTaxServiceCosts' + index + '">不含税服务成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxServiceCosts' + index + '" name="noTaxServiceCosts' + index + '" value="' + costs.noTaxServiceCosts + '" readonly>'; formHtml += '<input type="text" class="form-control" id="noTaxServiceCosts' + index + '" name="noTaxServiceCosts' + index + '" value="' + costs.noTaxServiceCosts + '" readonly>';
formHtml += '</div>'; formHtml += '</div>';
formHtml += '<h3>总经营成本</h3>'; formHtml += '<h3>上一年度总经营成本</h3>';
formHtml += '<div class="form-group">';
formHtml += '<label for="noTaxLaborCosts' + index + '">不含税人工成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxLaborCosts' + index + '" name="noTaxLaborCosts' + index + '" value="' + costs.noTaxLaborCosts + '">';
formHtml += '</div>';
formHtml += '<div class="form-group">';
formHtml += '<label for="noTaxPromotionalCosts' + index + '">不含税推广成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxPromotionalCosts' + index + '" name="noTaxPromotionalCosts' + index + '" value="' + costs.noTaxPromotionalCosts + '">';
formHtml += '</div>';
formHtml += '<div class="form-group">'; formHtml += '<div class="form-group">';
formHtml += '<label for="noTaxBusinessCosts' + index + '">不含税业务成本(RMB):</label>'; formHtml += '<label for="totalOperatingCosts' + index + '">不含税总经营成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxBusinessCosts' + index + '" name="noTaxBusinessCosts' + index + '" value="' + costs.noTaxBusinessCosts + '">'; formHtml += '<input type="text" class="form-control" id="totalOperatingCosts' + index + '" name="totalOperatingCosts' + index + '" value="' + costs.totalOperatingCosts + '">';
formHtml += '</div>'; formHtml += '</div>';
formHtml += '<div class="form-group">'; formHtml += '<h3>上一年度总物料成本</h3>';
formHtml += '<label for="noTaxManagesCosts' + index + '">不含税管理成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxManagesCosts' + index + '" name="noTaxManagesCosts' + index + '" value="' + costs.noTaxManagesCosts + '">';
formHtml += '</div>';
formHtml += '<h3>总物料成本</h3>';
formHtml += '<div class="form-group">'; formHtml += '<div class="form-group">';
formHtml += '<label for="noTaxMaterialCosts' + index + '">不含税总物料成本(RMB):</label>'; formHtml += '<label for="noTaxMaterialCosts' + index + '">不含税总物料成本(RMB):</label>';
formHtml += '<input type="text" class="form-control" id="noTaxMaterialCosts' + index + '" name="noTaxMaterialCosts' + index + '" value="' + costs.noTaxMaterialCosts + '">'; formHtml += '<input type="text" class="form-control" id="noTaxMaterialCosts' + index + '" name="noTaxMaterialCosts' + index + '" value="' + costs.noTaxMaterialCosts + '">';
@ -669,17 +617,8 @@
// 根据 input 的 id 或 name 进行相应的计算 // 根据 input 的 id 或 name 进行相应的计算
switch (inputId) { switch (inputId) {
case 'noTaxLaborCosts' + index: case 'totalOperatingCosts' + index:
calculateOperatingCosts(inputValue, 'noTaxLaborCosts'); calculateOperatingCosts(inputValue, 'totalOperatingCosts');
break;
case 'noTaxPromotionalCosts' + index:
calculateOperatingCosts(inputValue, 'noTaxPromotionalCosts');
break;
case 'noTaxBusinessCosts' + index:
calculateOperatingCosts(inputValue, 'noTaxBusinessCosts');
break;
case 'noTaxManagesCosts' + index:
calculateOperatingCosts(inputValue, 'noTaxManagesCosts');
break; break;
case 'noTaxMaterialCosts' + index: case 'noTaxMaterialCosts' + index:
updateMaterialCosts(inputValue); updateMaterialCosts(inputValue);
@ -692,21 +631,21 @@
}); });
function calculateOperatingCosts(value, costType) { function calculateOperatingCosts(value, costType) {
var noAllTaxOperatingCosts = 0; // var totalOperatingCosts = 0;
var allNoTaxPurchaseRmb = 0; var allNoTaxPurchaseRmb = 0;
var allTaxPurchaseRmb = 0; var allTaxPurchaseRmb = 0;
// 获取所有相关的不含税成本 // // 获取所有相关的不含税成本
['noTaxLaborCosts', 'noTaxPromotionalCosts', 'noTaxBusinessCosts', 'noTaxManagesCosts'].forEach(function(cost) { // ['noTaxLaborCosts', 'noTaxPromotionalCosts', 'noTaxBusinessCosts', 'noTaxManagesCosts'].forEach(function(cost) {
var currentCost = parseFloat($form.find('#' + cost + index).val()); // var currentCost = parseFloat($form.find('#' + cost + index).val());
noAllTaxOperatingCosts += currentCost; // noAllTaxOperatingCosts += currentCost;
}); // });
// 更新不含税总经营成本 // 更新上一年度不含税总经营成本
$form.find('#noAllTaxOperatingCosts' + index).val(noAllTaxOperatingCosts.toFixed(2)); var totalOperatingCosts = parseFloat($form.find('#totalOperatingCosts' + index).val());
// 计算含税总经营成本 // 计算上一年度含税总经营成本
var allTaxOperatingCosts = noAllTaxOperatingCosts * 1.13; var allTaxOperatingCosts = totalOperatingCosts * 1.13;
$form.find('#allTaxOperatingCosts' + index).val(allTaxOperatingCosts.toFixed(2)); $form.find('#allTaxOperatingCosts' + index).val(allTaxOperatingCosts.toFixed(2));
// 遍历数据集计算不含税采购成本和含税采购成本 // 遍历数据集计算不含税采购成本和含税采购成本
@ -720,13 +659,16 @@
}); });
}); });
// 该料号的不含税经营成本
var noTaxMaterialCosts = parseFloat($form.find('#noTaxMaterialCosts' + index).val()); var noTaxMaterialCosts = parseFloat($form.find('#noTaxMaterialCosts' + index).val());//不含税总物料成本
var noTaxOperatingCosts = (allNoTaxPurchaseRmb / noTaxMaterialCosts) * noAllTaxOperatingCosts; var allTaxMaterialCosts = noTaxMaterialCosts * 1.13;//含税总物料成本
// 该料号的不含税经营成本(RMB)=(该料号的BOM物料不含税总采购成本/上一年度总物料不含税成本合计)*上一年度的总经营不含税成本合计
var noTaxOperatingCosts = (allNoTaxPurchaseRmb / noTaxMaterialCosts) * totalOperatingCosts;
$form.find('#noTaxOperatingCosts' + index).val(noTaxOperatingCosts.toFixed(2)); $form.find('#noTaxOperatingCosts' + index).val(noTaxOperatingCosts.toFixed(2));
// 该料号的含税经营成本 // 该料号含税经营成本(RMB)=(该料号BOM物料含税总采购成本/上一年度总物料含税成本合计)*上一年度的总经营含税成本合计
var taxOperatingCosts = (allTaxPurchaseRmb / noTaxMaterialCosts) * allTaxOperatingCosts; var taxOperatingCosts = (allTaxPurchaseRmb / allTaxMaterialCosts) * allTaxOperatingCosts;
$form.find('#taxOperatingCosts' + index).val(taxOperatingCosts.toFixed(2)); $form.find('#taxOperatingCosts' + index).val(taxOperatingCosts.toFixed(2));
} }
@ -747,14 +689,33 @@
}); });
}); });
// 更新不含税经营成本 // // 更新不含税经营成本
var noAllTaxOperatingCosts = parseFloat($form.find('#noAllTaxOperatingCosts' + index).val()); // var noAllTaxOperatingCosts = parseFloat($form.find('#noAllTaxOperatingCosts' + index).val());
var noTaxOperatingCosts = (noTaxPurchaseRmb / value) * noAllTaxOperatingCosts; // var noTaxOperatingCosts = (noTaxPurchaseRmb / value) * noAllTaxOperatingCosts;
// $form.find('#noTaxOperatingCosts' + index).val(noTaxOperatingCosts.toFixed(2));
//
// // 更新含税经营成本
// var taxOperatingCosts = (taxPurchaseRmb / value) * noAllTaxOperatingCosts;
// $form.find('#taxOperatingCosts' + index).val(taxOperatingCosts.toFixed(2));
// 更新上一年度不含税总经营成本
var totalOperatingCosts = parseFloat($form.find('#totalOperatingCosts' + index).val());
// 计算上一年度含税总经营成本
var allTaxOperatingCosts = totalOperatingCosts * 1.13;
$form.find('#allTaxOperatingCosts' + index).val(allTaxOperatingCosts.toFixed(2));
// 该料号的不含税经营成本(RMB)=(该料号的BOM物料不含税总采购成本/上一年度总物料不含税成本合计)*上一年度的总经营不含税成本合计
var noTaxMaterialCosts = parseFloat($form.find('#noTaxMaterialCosts' + index).val());
var allTaxMaterialCosts = noTaxMaterialCosts * 1.13;
var noTaxOperatingCosts = (allNoTaxPurchaseRmb / noTaxMaterialCosts) * totalOperatingCosts;
$form.find('#noTaxOperatingCosts' + index).val(noTaxOperatingCosts.toFixed(2)); $form.find('#noTaxOperatingCosts' + index).val(noTaxOperatingCosts.toFixed(2));
// 更新含税经营成本 // 该料号含税经营成本(RMB)=(该料号的BOM物料含税总采购成本/上一年度总物料含税成本合计)*上一年度的总经营含税成本合计
var taxOperatingCosts = (taxPurchaseRmb / value) * noAllTaxOperatingCosts; var taxOperatingCosts = (allTaxPurchaseRmb / allTaxMaterialCosts) * allTaxOperatingCosts;
$form.find('#taxOperatingCosts' + index).val(taxOperatingCosts.toFixed(2)); $form.find('#taxOperatingCosts' + index).val(taxOperatingCosts.toFixed(2));
} }
} }
}); });

Loading…
Cancel
Save