hunan_2020.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. /**
  2. * Created by CSL on 2020/07/13. 湖南计算程序、基数 等覆盖。
  3. */
  4. let isHN2020 = true;
  5. // 一般计税取不含税市场价、不含税定额价。简易计税取含税市场价、含税定额价。打开项目时,4个价格根据计税类型只载入其二,所以这里可不作区分。
  6. function overwriteRationCalcBases (taxType){
  7. if (typeof rationCalcBases == 'undefined') return;
  8. for (let key in rationCalcBases) delete rationCalcBases[key];
  9. // let isJY = taxType == '2';
  10. rationCalcBases['人工费'] = function (node, isTender) {
  11. return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender);
  12. };
  13. rationCalcBases['材料费'] = function (node, isTender) {
  14. return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
  15. };
  16. rationCalcBases['施工机械使用费'] = function (node, isTender) {
  17. return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
  18. };
  19. rationCalcBases['施工机械人工费'] = function (node, isTender) {
  20. return calcTools.machineDetailFee(node, node.data.gljList, [], gljType.MACHINE_LABOUR, isTender);
  21. };
  22. rationCalcBases['设备购置费'] = function (node, isTender) {
  23. return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice, isTender);
  24. };
  25. rationCalcBases['定额人工费'] = function (node, isTender) {
  26. return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice, isTender);
  27. };
  28. rationCalcBases['定额材料费'] = function (node, isTender) {
  29. return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptBasePrice, isTender);
  30. };
  31. rationCalcBases['定额施工机械使用费'] = function (node, isTender) {
  32. return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptBasePrice, isTender);
  33. };
  34. rationCalcBases['定额商品砼费'] = function (node, isTender) {
  35. return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptBasePrice, isTender);
  36. };
  37. rationCalcBases['定额设备费'] = function (node, isTender) {
  38. return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptBasePrice, isTender);
  39. };
  40. rationCalcBases['定额外购砼构件费'] = function (node, isTender) {
  41. return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptBasePrice, isTender);
  42. };
  43. rationCalcBases['定额绿化苗木费'] = function (node, isTender) {
  44. return calcTools.rationBaseFee(node, [gljType.GREEN_SEEDLING], priceTypes.ptBasePrice, isTender);
  45. }
  46. };
  47. (function overwriteFeeTypes() {
  48. if (typeof cpFeeTypes == 'undefined') return;
  49. cpFeeTypes = [
  50. {type: 'marketLabour', name: '人工费'},
  51. {type: 'marketMaterial', name: '材料费'},
  52. {type: 'marketMachine', name: '施工机械使用费'},
  53. {type: 'marketMachineLabour', name: '施工机械人工费'},
  54. {type: 'marketEquipment', name: '设备购置费'},
  55. {type: 'marketDirect', name: '直接费'},
  56. {type: 'labour', name: '定额人工费'},
  57. {type: 'material', name: '定额材料费'},
  58. {type: 'machine', name: '定额施工机械使用费'},
  59. {type: 'equipment', name: '定额设备费'},
  60. {type: 'direct', name: '定额直接费'},
  61. {type: 'measure', name: '措施费'},
  62. {type: 'measure1', name: '措施费I'},
  63. {type: 'measure2', name: '措施费II'},
  64. {type: 'manage', name: '企业管理费'},
  65. {type: 'forceFee', name: '规费'},
  66. {type: 'profit', name: '利润'},
  67. {type: 'tax', name: '税金'},
  68. {type: 'common', name: '建安费'},
  69. {type: 'rationCommon', name: '定额建安费'}
  70. ];
  71. })();
  72. // 清单基数
  73. const progression = ['施工场地建设费', '养护单位项目管理费', '养护单位项目管理费(未单独设置项目部)', '工程监理费', '工程监理费(未实行社会监理)', '设计文件审查费', '工程设计费'];
  74. const deficiency = {};
  75. if (typeof baseFigureMap !== 'undefined') {
  76. const { fixedFlag } = commonConstants;
  77. const budgetMap = {
  78. // 显示:除清单固定类别是“建筑安装工程费”的以外部分可显示
  79. '养护工程费': {
  80. base: 'YHGCF',
  81. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  82. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
  83. pick: false,
  84. },
  85. // 显示:仅清单固定类别是“安全生产费”的可显示
  86. '养护工程费(不含安全生产费)': {
  87. base: 'YHGCFBHSC',
  88. fixedFlag: null,
  89. filter: [fixedFlag.SAFE_COST],
  90. pick: true
  91. },
  92. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示
  93. '养护工程费(不含设备费)': {
  94. base: 'YHGCFBHSB',
  95. fixedFlag: null,
  96. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  97. pick: true
  98. },
  99. // 显示:除清单固定类别是“建筑安装工程费”的以外部分可显示
  100. '定额养护工程费': {
  101. base: 'DEYHGCF',
  102. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  103. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
  104. pick: false
  105. },
  106. // 显示:仅清单固定类别是“养护工程其他费用”、“施工场地建设费”的可显示
  107. '定额养护工程费(不含专项费用)': {
  108. base: 'DEYHGCFBHZXFY',
  109. fixedFlag: null,
  110. filter: [fixedFlag.MAINTENANCE_EXPENSES, fixedFlag.CONSTRUCTION_PLANT_COST],
  111. pick: true,
  112. },
  113. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”的以外部分可显示
  114. '土地使用及拆迁补偿费': {
  115. base: 'TDSYJCQBCF',
  116. fixedFlag: fixedFlag.LAND_USED_DEMOLITION,
  117. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION],
  118. pick: false,
  119. },
  120. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”、“工程建设其他费用”的以外部分可显示。
  121. '工程建设其他费用': {
  122. base: 'GCJSQTFY',
  123. fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
  124. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
  125. pick: false,
  126. },
  127. // 显示:仅清单固定类别是“施工场地建设费”的可显示。
  128. '施工场地建设费': {
  129. isProgressive: true,
  130. base: 'SGCDJSF',
  131. fixedFlag: null,
  132. filter: [fixedFlag.CONSTRUCTION_PLANT_COST],
  133. pick: true,
  134. },
  135. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  136. '养护单位项目管理费': {
  137. isProgressive: true,
  138. base: 'YHDWXMGLF',
  139. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  140. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  141. pick: true,
  142. },
  143. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  144. '养护单位项目管理费(未单独设置项目部)': {
  145. isProgressive: true,
  146. base: 'YHDWXMGLFWSXMB',
  147. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  148. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  149. pick: true,
  150. },
  151. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  152. '工程监理费': {
  153. isProgressive: true,
  154. base: 'GCJLF',
  155. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  156. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  157. pick: true,
  158. },
  159. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  160. '工程监理费(未实行社会监理)': {
  161. isProgressive: true,
  162. base: 'GCJLFWSXSHJL',
  163. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  164. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  165. pick: true,
  166. },
  167. // 显示:只有清单固定类别是“养护工程其他费用”部分可显示。
  168. '设计文件审查费': {
  169. isProgressive: true,
  170. base: 'SJWJSCF',
  171. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  172. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  173. pick: true,
  174. },
  175. // 显示:只有清单固定类别是“养护工程其他费用”部分可显示。
  176. '工程设计费': {
  177. isProgressive: true,
  178. base: 'GCSJF',
  179. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  180. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  181. pick: true,
  182. },
  183. // 显示:仅“价差预备费”可显示
  184. '价差预备费': {
  185. base: 'JCYBF',
  186. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  187. filter: [fixedFlag.SPREAD_BUDGET_FEE],
  188. pick: true,
  189. },
  190. };
  191. const boqMap = {
  192. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  193. '各章清单合计': {
  194. base: 'GZQDHJ',
  195. fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
  196. filter: [fixedFlag.ONE_SEVEN_BILLS],
  197. pick: false
  198. },
  199. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  200. '专项暂定合计': {
  201. base: 'ZXZDHJ',
  202. fixedFlag: null,
  203. filter: [fixedFlag.ONE_SEVEN_BILLS],
  204. pick: false
  205. },
  206. /*
  207. * 清单固定行[第100章至700章清单]下的[第100章清单]需要允许清单可使用基数{100章以外合计}
  208. * 因此{100章以外合计}不设置关联的清单固定行
  209. * */
  210. //仅允许用于固定类别为“100章清单”引用
  211. '100章以外清单合计': {
  212. base: 'YBZYHQDHJ',
  213. fixedFlag: null,
  214. filter: [fixedFlag.ONE_HUNDRED_BILLS],
  215. pick: true
  216. }
  217. };
  218. baseFigureMap.budget = budgetMap;
  219. baseFigureMap.boq = boqMap;
  220. }
  221. if (typeof baseFigureTemplate !== 'undefined') {
  222. const { fixedFlag } = commonConstants;
  223. baseFigureTemplate.budget = {
  224. // 养护工程费 算法:取清单固定类别是“建筑安装工程费”的金额。
  225. YHGCF(tender) {
  226. return cbTools.getBaseFee(fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'common');
  227. },
  228. // 养护工程费(不含安全生产费) 算法:取清单固定类别是“建筑安装工程费”的金额,扣除“安全生产费”的金额。
  229. YHGCFBHSC(tender) {
  230. return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.SAFE_COST], tender, 'common');
  231. },
  232. // 养护工程费(不含设备费) 算法:取清单固定类别是“建筑安装工程费”的金额,扣除设备的金额。
  233. YHGCFBHSB(tender) {
  234. return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.EQUIPMENT_ACQUISITION_FEE], tender, 'common');
  235. },
  236. // 定额养护工程费 取清单固定类别是“建筑安装工程费”的定额建安费。
  237. DEYHGCF(tender) {
  238. return cbTools.getBaseFee(fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'rationCommon');
  239. },
  240. // 定额养护工程费(不含专项费用) 算法:取清单固定类别是“建筑安装工程费”的“定额建安费”,扣除“专项费用”的“定额建安费”。
  241. DEYHGCFBHZXFY(tender) {
  242. return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.SPECIAL_COST], tender, 'rationCommon');
  243. },
  244. // 土地使用及拆迁补偿费 算法:取清单固定类别是“土地使用及拆迁补偿费”的金额。
  245. TDSYJCQBCF(tender) {
  246. return cbTools.getBaseFee(fixedFlag.LAND_USED_DEMOLITION, tender, 'common');
  247. },
  248. // 工程建设其他费用 算法:取清单固定类别是“养护工程其他费用”的金额。
  249. GCJSQTFY(tender) {
  250. return cbTools.getBaseFee(fixedFlag.MAINTENANCE_EXPENSES, tender, 'common');
  251. },
  252. // 施工场地建设费 算法:以{定额养护工程费(不含专项费用)}为基数,采用累进办法计算。
  253. SGCDJSF(tender) {
  254. const baseFee = this['DEYHGCFBHZXFY'](tender);
  255. if (!tender) {
  256. calcBase.baseProgressiveFee = baseFee;
  257. }
  258. return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  259. },
  260. // 养护单位项目管理费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  261. YHDWXMGLF(tender) {
  262. const baseFee = this['DEYHGCF'](tender);
  263. if (!tender) {
  264. calcBase.baseProgressiveFee = baseFee;
  265. }
  266. return calculateUtil.getProgressiveFee(baseFee, '养护单位项目管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  267. },
  268. // 养护单位项目管理费(未单独设置项目部) 算法:以{定额养护工程费}为基数,采用累进办法计算。
  269. YHDWXMGLFWSXMB(tender) {
  270. const baseFee = this['DEYHGCF'](tender);
  271. if (!tender) {
  272. calcBase.baseProgressiveFee = baseFee;
  273. }
  274. return calculateUtil.getProgressiveFee(baseFee, '养护单位项目管理费(未单独设置项目部)', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  275. },
  276. // 工程监理费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  277. GCJLF(tender) {
  278. const baseFee = this['DEYHGCF'](tender);
  279. if (!tender) {
  280. calcBase.baseProgressiveFee = baseFee;
  281. }
  282. return calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  283. },
  284. // 工程监理费(未实行社会监理) 算法:以{定额养护工程费}为基数,采用累进办法计算。
  285. GCJLFWSXSHJL(tender) {
  286. const baseFee = this['DEYHGCF'](tender);
  287. if (!tender) {
  288. calcBase.baseProgressiveFee = baseFee;
  289. }
  290. return calculateUtil.getProgressiveFee(baseFee, '工程监理费(未实行社会监理)', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  291. },
  292. // 设计文件审查费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  293. SJWJSCF(tender) {
  294. const baseFee = this['DEYHGCF'](tender);
  295. if (!tender) {
  296. calcBase.baseProgressiveFee = baseFee;
  297. }
  298. return calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  299. },
  300. // 工程设计费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  301. GCSJF(tender) {
  302. const baseFee = this['DEYHGCF'](tender);
  303. if (!tender) {
  304. calcBase.baseProgressiveFee = baseFee;
  305. }
  306. return calculateUtil.getProgressiveFee(baseFee, '工程设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  307. },
  308. /* 价差预备费 算法:以建筑安装工程费为基数,按设计文件编制年始至养护项目工程竣工年终的年数和年工程造价增涨率计算。
  309. 价差预备费 P * [(1+i)^(n-1) -1]
  310. P——建筑安装工程费总额(元);
  311. i——年工程造价增涨率(%);
  312. n——设计文件编制年至养护项目开工年+养护项目建设期限(年)。
  313. */
  314. JCYBF(tender) {
  315. //建筑安装工程费作为基数
  316. const installFee = this['JZAZGCF'](tender);
  317. //年造价增涨
  318. const costGrowthRate = calcBase.project.property.costGrowthRate
  319. ? calcBase.project.property.costGrowthRate
  320. : 0;
  321. //增涨计费年限
  322. const growthPeriod = projectObj.project.property.growthPeriod
  323. ? calcBase.project.property.growthPeriod
  324. : 0;
  325. //= P * [(1+i)^(n-1) -1]
  326. return (installFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
  327. }
  328. };
  329. baseFigureTemplate.boq = {
  330. //{各章清单合计}
  331. // 取清单固定类别是“第100章至700章清单”的金额
  332. 'GZQDHJ': function (tender) {
  333. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'common');
  334. },
  335. //{专项暂定合计}
  336. // 汇总专项暂定列有值的清单的金额
  337. 'ZXZDHJ': function (tender) {
  338. let rst = 0,
  339. feeField = 'common',
  340. subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  341. let billsData = calcBase.project.Bills.datas,
  342. filterData = billsData.filter(function (data) {
  343. return data.specialProvisional;
  344. });
  345. for (let data of filterData) {
  346. if (cbTools.isUnDef(data.feesIndex) || _.isEmpty(data.feesIndex) ||
  347. cbTools.isUnDef(data.feesIndex[feeField]) || cbTools.isUnDef(data.feesIndex[feeField][subFeeField])) {
  348. continue;
  349. }
  350. rst += data.feesIndex[feeField][subFeeField];
  351. }
  352. return rst.toDecimal(decimalObj.bills.totalPrice);
  353. },
  354. //{100章以外清单合计}
  355. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  356. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  357. 'YBZYHQDHJ': function (tender) {
  358. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  359. if (!oneToSeven) {
  360. return 0;
  361. }
  362. //100-700章固定节点的所有子节点
  363. let allChildren = [];
  364. function getChildren(nodes) {
  365. allChildren = allChildren.concat(nodes);
  366. for (let node of nodes) {
  367. if (node.children.length > 0) {
  368. getChildren(node.children);
  369. }
  370. }
  371. }
  372. getChildren(oneToSeven.children);
  373. //扣除的节点:100章的节点[100-200)
  374. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  375. //计算金额
  376. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  377. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  378. }
  379. };
  380. }
  381. // CommonJS module
  382. if (typeof module !== 'undefined' && !module.nodeType) { // 防止module是前端的一个html标签
  383. module.exports = {
  384. progression,
  385. deficiency
  386. };
  387. }