shandong_2016.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. let isSD2016 = true;
  2. function overwriteRationCalcBases() {
  3. if (typeof rationCalcBases == 'undefined') return;
  4. for (let key in rationCalcBases) delete rationCalcBases[key];
  5. rationCalcBases['人工费'] = function (node, isTender) {
  6. return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender);
  7. };
  8. rationCalcBases['材料费'] = function (node, isTender) {
  9. return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
  10. };
  11. rationCalcBases['施工机械使用费'] = function (node, isTender) {
  12. return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
  13. };
  14. rationCalcBases['商品砼费'] = function (node, isTender) {
  15. return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptMarketPrice, isTender);
  16. };
  17. rationCalcBases['外购砼构件费'] = function (node, isTender) {
  18. return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptMarketPrice, isTender);
  19. };
  20. };
  21. (function overwriteFeeTypes() {
  22. if (typeof cpFeeTypes == 'undefined') return;
  23. cpFeeTypes = [
  24. { type: 'marketDirect', name: '直接费' },
  25. { type: 'marketDirectWork', name: '直接工程费' },
  26. { type: 'marketLabour', name: '人工费' },
  27. { type: 'marketMaterial', name: '材料费' },
  28. { type: 'marketMachine', name: '施工机械使用费' },
  29. { type: 'otherFee', name: '其他工程费' },
  30. { type: 'otherFee1', name: '其他工程费I' },
  31. { type: 'otherFee2', name: '其他工程费II' },
  32. { type: 'indirectFee', name: '间接费' },
  33. { type: 'manage', name: '企业管理费' },
  34. { type: 'force', name: '规费' },
  35. { type: 'profit', name: '利润' },
  36. { type: 'tax', name: '税金' },
  37. { type: 'common', name: '建安费' }
  38. ];
  39. })();
  40. // 清单基数
  41. const progression = ['养护工程管理费', '养护工程设计费'];
  42. const deficiency = {};
  43. if (typeof baseFigureMap !== 'undefined') {
  44. const { fixedFlag } = commonConstants;
  45. const budgetMap = {
  46. // 显示:除清单固定类别是“建筑安装工程费”的以外部分可显示。
  47. '建筑安装工程费': {
  48. base: 'JZAZGCF',
  49. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  50. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
  51. pick: false,
  52. },
  53. // 显示:仅清单固定类别是“安全生产费”的可显示。
  54. '建筑安装工程费(不含设备费)': {
  55. base: 'JZAZGCFBHSB',
  56. fixedFlag: null,
  57. filter: [fixedFlag.SAFE_COST],
  58. pick: true
  59. },
  60. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”的以外部分可显示。
  61. '土地使用及拆迁补偿费': {
  62. base: 'TDSYJCQBCF',
  63. fixedFlag: fixedFlag.LAND_USED_DEMOLITION,
  64. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION],
  65. pick: false,
  66. },
  67. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”、“工程建设其他费用”的以外部分可显示。
  68. '工程建设其他费用': {
  69. base: 'GCJSQTFY',
  70. fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
  71. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
  72. pick: false,
  73. },
  74. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  75. '养护工程管理费': {
  76. isProgressive: true,
  77. base: 'YHGCGLF',
  78. fixedFlag: null,
  79. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  80. pick: true,
  81. },
  82. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  83. '养护工程设计费': {
  84. isProgressive: true,
  85. base: 'YHGCSJF',
  86. fixedFlag: null,
  87. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  88. pick: true,
  89. },
  90. // 显示:仅“价差预备费”可显示
  91. '价差预备费': {
  92. base: 'JCYBF',
  93. fixedFlag: null,
  94. filter: [fixedFlag.SPREAD_BUDGET_FEE],
  95. pick: true,
  96. },
  97. };
  98. const boqMap = {
  99. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  100. '各章清单合计': {
  101. base: 'GZQDHJ',
  102. fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
  103. filter: [fixedFlag.ONE_SEVEN_BILLS],
  104. pick: false
  105. },
  106. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  107. '专项暂定合计': {
  108. base: 'ZXZDHJ',
  109. fixedFlag: null,
  110. filter: [fixedFlag.ONE_SEVEN_BILLS],
  111. pick: false
  112. },
  113. /*
  114. * 清单固定行[第100章至700章清单]下的[第100章清单]需要允许清单可使用基数{100章以外合计}
  115. * 因此{100章以外合计}不设置关联的清单固定行
  116. * */
  117. //仅允许用于固定类别为“100章清单”引用
  118. '100章以外清单合计': {
  119. base: 'YBZYHQDHJ',
  120. fixedFlag: null,
  121. filter: [fixedFlag.ONE_HUNDRED_BILLS],
  122. pick: true
  123. }
  124. };
  125. baseFigureMap.budget = budgetMap;
  126. baseFigureMap.boq = boqMap;
  127. }
  128. if (typeof baseFigureTemplate !== 'undefined') {
  129. const { fixedFlag } = commonConstants;
  130. baseFigureTemplate.budget = {
  131. // 建筑安装工程费 算法:取清单固定类别是“建筑安装工程费”的金额。
  132. JZAZGCF(tender) {
  133. return cbTools.getBaseFee(fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'common');
  134. },
  135. // 土地使用及拆迁补偿费 算法:取清单固定类别是“土地使用及拆迁补偿费”的金额。
  136. TDSYJCQBCF(tender) {
  137. return cbTools.getBaseFee(fixedFlag.LAND_USED_DEMOLITION, tender, 'common');
  138. },
  139. // 工程建设其他费用 算法:取清单固定类别是“养护工程其他费用”的金额。
  140. GCJSQTFY(tender) {
  141. return cbTools.getBaseFee(fixedFlag.MAINTENANCE_EXPENSES, tender, 'common');
  142. },
  143. // 养护工程管理费 算法:以{建筑安装工程费}为基数,采用累进办法计算
  144. YHGCGLF(tender) {
  145. const baseFee = this['JZAZGCF'](tender);
  146. if (!tender) {
  147. calcBase.baseProgressiveFee = baseFee;
  148. }
  149. return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  150. },
  151. // 养护工程设计费 算法:以{建筑安装工程费}为基数,采用累进办法计算。
  152. YHGCSJF(tender) {
  153. const baseFee = this['JZAZGCF'](tender);
  154. if (!tender) {
  155. calcBase.baseProgressiveFee = baseFee;
  156. }
  157. return calculateUtil.getProgressiveFee(baseFee, '养护工程设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  158. },
  159. /* 价差预备费 算法:以建筑安装工程费为基数,按设计文件编制年始至养护项目工程竣工年终的年数和年工程造价增涨率计算。
  160. 价差预备费 P * [(1+i)^(n-1) -1]
  161. P——建筑安装工程费总额(元);
  162. i——年工程造价增涨率(%);
  163. n——设计文件编制年至养护项目开工年+养护项目建设期限(年)。
  164. */
  165. JCYBF(tender) {
  166. //建筑安装工程费作为基数
  167. const installFee = this['JZAZGCF'](tender);
  168. //年造价增涨
  169. const costGrowthRate = calcBase.project.property.costGrowthRate
  170. ? calcBase.project.property.costGrowthRate
  171. : 0;
  172. //增涨计费年限
  173. const growthPeriod = projectObj.project.property.growthPeriod
  174. ? calcBase.project.property.growthPeriod
  175. : 0;
  176. //= P * [(1+i)^(n-1) -1]
  177. return (installFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
  178. }
  179. };
  180. baseFigureTemplate.boq = {
  181. //{各章清单合计}
  182. // 取清单固定类别是“第100章至700章清单”的金额
  183. 'GZQDHJ': function (tender) {
  184. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'common');
  185. },
  186. //{专项暂定合计}
  187. // 汇总专项暂定列有值的清单的金额
  188. 'ZXZDHJ': function (tender) {
  189. let rst = 0,
  190. feeField = 'common',
  191. subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  192. let billsData = calcBase.project.Bills.datas,
  193. filterData = billsData.filter(function (data) {
  194. return data.specialProvisional;
  195. });
  196. for (let data of filterData) {
  197. if (cbTools.isUnDef(data.feesIndex) || _.isEmpty(data.feesIndex) ||
  198. cbTools.isUnDef(data.feesIndex[feeField]) || cbTools.isUnDef(data.feesIndex[feeField][subFeeField])) {
  199. continue;
  200. }
  201. rst += data.feesIndex[feeField][subFeeField];
  202. }
  203. return rst.toDecimal(decimalObj.bills.totalPrice);
  204. },
  205. //{100章以外清单合计}
  206. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  207. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  208. 'YBZYHQDHJ': function (tender) {
  209. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  210. if (!oneToSeven) {
  211. return 0;
  212. }
  213. //100-700章固定节点的所有子节点
  214. let allChildren = [];
  215. function getChildren(nodes) {
  216. allChildren = allChildren.concat(nodes);
  217. for (let node of nodes) {
  218. if (node.children.length > 0) {
  219. getChildren(node.children);
  220. }
  221. }
  222. }
  223. getChildren(oneToSeven.children);
  224. //扣除的节点:100章的节点[100-200)
  225. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  226. //计算金额
  227. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  228. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  229. }
  230. };
  231. }
  232. if (typeof module !== 'undefined' && !module.nodeType) {
  233. module.exports = {
  234. progression,
  235. deficiency,
  236. getDefalutAssistProductionFeeRate: function () {
  237. return 5
  238. }
  239. };
  240. }