hunan_2020.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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: 'force', 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. let baseFee = this['YHGCF'](tender);
  235. const fixedNode = projectObj.project.mainTree.roots.find(node => node.getFlag() === fixedFlag.CONSTRUCTION_INSTALL_FEE);
  236. const allSubNodes = [];
  237. projectObj.project.mainTree.getAllSubNode(fixedNode, allSubNodes);
  238. const equipmentNodes = allSubNodes.filter(node => node.data.type === rationType.gljRation && node.data.subType === gljType.EQUIPMENT);
  239. const feeField = 'common';
  240. const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  241. for (const node of equipmentNodes) {
  242. const data = node.data;
  243. if (cbTools.isUnDef(data.feesIndex) || _.isEmpty(data.feesIndex) ||
  244. cbTools.isUnDef(data.feesIndex[feeField]) || cbTools.isUnDef(data.feesIndex[feeField][subFeeField])) {
  245. continue;
  246. }
  247. baseFee -= data.feesIndex[feeField][subFeeField];
  248. }
  249. return baseFee.toDecimal(decimalObj.bills.totalPrice);
  250. },
  251. // 定额养护工程费 取清单固定类别是“建筑安装工程费”的定额建安费。
  252. DEYHGCF(tender) {
  253. return cbTools.getBaseFee(fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'rationCommon');
  254. },
  255. // 定额养护工程费(不含专项费用) 算法:取清单固定类别是“建筑安装工程费”的“定额建安费”,扣除“专项费用”的“定额建安费”。
  256. DEYHGCFBHZXFY(tender) {
  257. return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.SPECIAL_COST], tender, 'rationCommon');
  258. },
  259. // 土地使用及拆迁补偿费 算法:取清单固定类别是“土地使用及拆迁补偿费”的金额。
  260. TDSYJCQBCF(tender) {
  261. return cbTools.getBaseFee(fixedFlag.LAND_USED_DEMOLITION, tender, 'common');
  262. },
  263. // 工程建设其他费用 算法:取清单固定类别是“养护工程其他费用”的金额。
  264. GCJSQTFY(tender) {
  265. return cbTools.getBaseFee(fixedFlag.MAINTENANCE_EXPENSES, tender, 'common');
  266. },
  267. // 施工场地建设费 算法:以{定额养护工程费(不含专项费用)}为基数,采用累进办法计算。
  268. SGCDJSF(tender) {
  269. const baseFee = this['DEYHGCFBHZXFY'](tender);
  270. if (!tender) {
  271. calcBase.baseProgressiveFee = baseFee;
  272. }
  273. return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  274. },
  275. // 养护单位项目管理费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  276. YHDWXMGLF(tender) {
  277. const baseFee = this['DEYHGCF'](tender);
  278. if (!tender) {
  279. calcBase.baseProgressiveFee = baseFee;
  280. }
  281. return calculateUtil.getProgressiveFee(baseFee, '养护单位项目管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  282. },
  283. // 养护单位项目管理费(未单独设置项目部) 算法:以{定额养护工程费}为基数,采用累进办法计算。
  284. YHDWXMGLFWSXMB(tender) {
  285. const baseFee = this['DEYHGCF'](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. GCJLF(tender) {
  293. const baseFee = this['DEYHGCF'](tender);
  294. if (!tender) {
  295. calcBase.baseProgressiveFee = baseFee;
  296. }
  297. return calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  298. },
  299. // 工程监理费(未实行社会监理) 算法:以{定额养护工程费}为基数,采用累进办法计算。
  300. GCJLFWSXSHJL(tender) {
  301. const baseFee = this['DEYHGCF'](tender);
  302. if (!tender) {
  303. calcBase.baseProgressiveFee = baseFee;
  304. }
  305. return calculateUtil.getProgressiveFee(baseFee, '工程监理费(未实行社会监理)', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  306. },
  307. // 设计文件审查费 算法:以{定额养护工程费}为基数,采用累进办法计算。
  308. SJWJSCF(tender) {
  309. const baseFee = this['DEYHGCF'](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. GCSJF(tender) {
  317. const baseFee = this['DEYHGCF'](tender);
  318. if (!tender) {
  319. calcBase.baseProgressiveFee = baseFee;
  320. }
  321. return calculateUtil.getProgressiveFee(baseFee, '工程设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  322. },
  323. /* 价差预备费 算法:以建筑安装工程费为基数,按设计文件编制年始至养护项目工程竣工年终的年数和年工程造价增涨率计算。
  324. 价差预备费 P * [(1+i)^(n-1) -1]
  325. P——建筑安装工程费总额(元);
  326. i——年工程造价增涨率(%);
  327. n——设计文件编制年至养护项目开工年+养护项目建设期限(年)。
  328. */
  329. JCYBF(tender) {
  330. //建筑安装工程费作为基数
  331. const installFee = this['YHGCF'](tender);
  332. //年造价增涨
  333. const costGrowthRate = calcBase.project.property.costGrowthRate
  334. ? calcBase.project.property.costGrowthRate
  335. : 0;
  336. //增涨计费年限
  337. const growthPeriod = projectObj.project.property.growthPeriod
  338. ? calcBase.project.property.growthPeriod
  339. : 0;
  340. //= P * [(1+i)^(n-1) -1]
  341. return (installFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
  342. }
  343. };
  344. baseFigureTemplate.boq = {
  345. //{各章清单合计}
  346. // 取清单固定类别是“第100章至700章清单”的金额
  347. 'GZQDHJ': function (tender) {
  348. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'common');
  349. },
  350. //{专项暂定合计}
  351. // 第100章至700章清单行的暂估合价
  352. 'ZXZDHJ': function (tender) {
  353. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'estimate');
  354. },
  355. //{100章以外清单合计}
  356. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  357. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  358. 'YBZYHQDHJ': function (tender) {
  359. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  360. if (!oneToSeven) {
  361. return 0;
  362. }
  363. //100-700章固定节点的所有子节点
  364. let allChildren = [];
  365. function getChildren(nodes) {
  366. allChildren = allChildren.concat(nodes);
  367. for (let node of nodes) {
  368. if (node.children.length > 0) {
  369. getChildren(node.children);
  370. }
  371. }
  372. }
  373. getChildren(oneToSeven.children);
  374. //扣除的节点:100章的节点[100-200)
  375. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  376. //计算金额
  377. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  378. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  379. }
  380. };
  381. }
  382. if (typeof projectObj !== 'undefined') {
  383. projectObj.isInsertEquipmentVisable = function (selected) {
  384. if (projectObj.project.property.valuationType !== 'ration') {//预算项目中,右键“插入设备”,仅在第一部分中显示。
  385. return projectObj.project.Bills.isConstructionInstall(selected);
  386. }
  387. return true; //湖南不管是预算或者工程量清单,都显示
  388. }
  389. }
  390. //湖南工地转移费率值修改特殊处理
  391. if (typeof feeRateObject !== 'undefined') {
  392. feeRateObject.feeRateSpecialHandle = function (subRate, value) {
  393. let result = {};
  394. if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
  395. result.valueKey = "50";
  396. result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
  397. }
  398. return result;
  399. }
  400. }
  401. if (typeof electrovalenceObj !== 'undefined') {
  402. electrovalenceObj.options = [
  403. { code: "3005003", name: "电网电", specs: "", unit: "kW·h", type: "201" },
  404. { code: "8017001", name: "15kW以内柴油发电机组", specs: "12GF1", unit: "台班", type: "301" },
  405. { code: "8017002", name: "30kW以内柴油发电机组", specs: "30GFY-2", unit: "台班", type: "301" },
  406. { code: "8017003", name: "50kW以内柴油发电机组", specs: "50GFY-2", unit: "台班", type: "301" }
  407. ]
  408. }
  409. // 在新建分段的时候需要隐藏养护类别和费用标准
  410. if (typeof $ !== 'undefined') { // 后端也有引用这个文件,后端引用时$没有定义会报错
  411. $(document).ready(function () {
  412. $('#tender-engineering-group').hide();
  413. $('#tender-feeStandard-group').hide();
  414. });
  415. }
  416. // CommonJS module
  417. if (typeof module !== 'undefined' && !module.nodeType) { // 防止module是前端的一个html标签
  418. module.exports = {
  419. progression,
  420. deficiency
  421. };
  422. }