anhui_2019.js 21 KB

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