shandong_2016.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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',
  25. name: '直接费'
  26. },
  27. {
  28. type: 'marketDirectWork',
  29. name: '直接工程费'
  30. }, {
  31. type: 'marketLabour',
  32. name: '人工费'
  33. },
  34. {
  35. type: 'marketMaterial',
  36. name: '材料费'
  37. },
  38. {
  39. type: 'marketMachine',
  40. name: '施工机械使用费'
  41. },
  42. {
  43. type: 'otherFee',
  44. name: '其他工程费'
  45. },
  46. {
  47. type: 'otherFee1',
  48. name: '其他工程费I'
  49. },
  50. {
  51. type: 'otherFee2',
  52. name: '其他工程费II'
  53. },
  54. {
  55. type: 'indirectFee',
  56. name: '间接费'
  57. },
  58. {
  59. type: 'manage',
  60. name: '企业管理费'
  61. },
  62. {
  63. type: 'force',
  64. name: '规费'
  65. },
  66. {
  67. type: 'profit',
  68. name: '利润'
  69. },
  70. {
  71. type: 'tax',
  72. name: '税金'
  73. },
  74. {
  75. type: 'common',
  76. name: '建安费'
  77. }
  78. ]
  79. })();
  80. // 清单基数
  81. const progression = ['养护工程管理费', '养护工程设计费'];
  82. const deficiency = {};
  83. if (typeof baseFigureMap !== 'undefined') {
  84. const {
  85. fixedFlag
  86. } = commonConstants;
  87. const budgetMap = {
  88. // 显示:除清单固定类别是“建筑安装工程费”的以外部分可显示。
  89. '建筑安装工程费': {
  90. base: 'JZAZGCF',
  91. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  92. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
  93. pick: false,
  94. },
  95. // 显示:仅清单固定类别是“安全生产费”的可显示。
  96. '建筑安装工程费(不含设备费)': {
  97. base: 'JZAZGCFBHSB',
  98. fixedFlag: null,
  99. filter: [fixedFlag.SAFE_COST],
  100. pick: true
  101. },
  102. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”的以外部分可显示。
  103. '土地使用及拆迁补偿费': {
  104. base: 'TDSYJCQBCF',
  105. fixedFlag: fixedFlag.LAND_USED_DEMOLITION,
  106. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION],
  107. pick: false,
  108. },
  109. // 显示:除清单固定类别是“建筑安装工程费”、“土地使用及拆迁补偿费”、“工程建设其他费用”的以外部分可显示。
  110. '工程建设其他费用': {
  111. base: 'GCJSQTFY',
  112. fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
  113. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
  114. pick: false,
  115. },
  116. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  117. '养护工程管理费': {
  118. isProgressive: true,
  119. base: 'YHGCGLF',
  120. fixedFlag: null,
  121. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  122. pick: true,
  123. },
  124. // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
  125. '养护工程设计费': {
  126. isProgressive: true,
  127. base: 'YHGCSJF',
  128. fixedFlag: null,
  129. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  130. pick: true,
  131. },
  132. // 显示:仅“价差预备费”可显示
  133. '价差预备费': {
  134. base: 'JCYBF',
  135. fixedFlag: null,
  136. filter: [fixedFlag.SPREAD_BUDGET_FEE],
  137. pick: true,
  138. },
  139. };
  140. const boqMap = {
  141. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  142. '各章清单合计': {
  143. base: 'GZQDHJ',
  144. fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
  145. filter: [fixedFlag.ONE_SEVEN_BILLS],
  146. pick: false
  147. },
  148. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  149. '专项暂定合计': {
  150. base: 'ZXZDHJ',
  151. fixedFlag: null,
  152. filter: [fixedFlag.ONE_SEVEN_BILLS],
  153. pick: false
  154. },
  155. /*
  156. * 清单固定行[第100章至700章清单]下的[第100章清单]需要允许清单可使用基数{100章以外合计}
  157. * 因此{100章以外合计}不设置关联的清单固定行
  158. * */
  159. //仅允许用于固定类别为“100章清单”引用
  160. '100章以外清单合计': {
  161. base: 'YBZYHQDHJ',
  162. fixedFlag: null,
  163. filter: [fixedFlag.ONE_HUNDRED_BILLS],
  164. pick: true
  165. }
  166. };
  167. baseFigureMap.budget = budgetMap;
  168. baseFigureMap.boq = boqMap;
  169. }
  170. if (typeof baseFigureTemplate !== 'undefined') {
  171. const {
  172. fixedFlag
  173. } = commonConstants;
  174. baseFigureTemplate.budget = {
  175. // 建筑安装工程费 算法:取清单固定类别是“建筑安装工程费”的金额。
  176. JZAZGCF(tender) {
  177. return cbTools.getBaseFee(fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'common');
  178. },
  179. // 土地使用及拆迁补偿费 算法:取清单固定类别是“土地使用及拆迁补偿费”的金额。
  180. TDSYJCQBCF(tender) {
  181. return cbTools.getBaseFee(fixedFlag.LAND_USED_DEMOLITION, tender, 'common');
  182. },
  183. // 工程建设其他费用 算法:取清单固定类别是“养护工程其他费用”的金额。
  184. GCJSQTFY(tender) {
  185. return cbTools.getBaseFee(fixedFlag.MAINTENANCE_EXPENSES, tender, 'common');
  186. },
  187. // 养护工程管理费 算法:以{建筑安装工程费}为基数,采用累进办法计算
  188. YHGCGLF(tender) {
  189. const baseFee = this['JZAZGCF'](tender);
  190. if (!tender) {
  191. calcBase.baseProgressiveFee = baseFee;
  192. }
  193. return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  194. },
  195. // 养护工程设计费 算法:以{建筑安装工程费}为基数,采用累进办法计算。
  196. YHGCSJF(tender) {
  197. const baseFee = this['JZAZGCF'](tender);
  198. if (!tender) {
  199. calcBase.baseProgressiveFee = baseFee;
  200. }
  201. return calculateUtil.getProgressiveFee(baseFee, '养护工程设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  202. },
  203. /* 价差预备费 算法:以建筑安装工程费为基数,按设计文件编制年始至养护项目工程竣工年终的年数和年工程造价增涨率计算。
  204. 价差预备费 P * [(1+i)^(n-1) -1]
  205. P——建筑安装工程费总额(元);
  206. i——年工程造价增涨率(%);
  207. n——设计文件编制年至养护项目开工年+养护项目建设期限(年)。
  208. */
  209. JCYBF(tender) {
  210. //建筑安装工程费作为基数
  211. const installFee = this['JZAZGCF'](tender);
  212. //年造价增涨
  213. const costGrowthRate = calcBase.project.property.costGrowthRate ?
  214. calcBase.project.property.costGrowthRate :
  215. 0;
  216. //增涨计费年限
  217. const growthPeriod = projectObj.project.property.growthPeriod ?
  218. calcBase.project.property.growthPeriod :
  219. 0;
  220. //= P * [(1+i)^(n-1) -1]
  221. return (installFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
  222. }
  223. };
  224. baseFigureTemplate.boq = {
  225. //{各章清单合计}
  226. // 取清单固定类别是“第100章至700章清单”的金额
  227. 'GZQDHJ': function (tender) {
  228. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'common');
  229. },
  230. //{专项暂定合计}
  231. // 汇总专项暂定列有值的清单的金额
  232. 'ZXZDHJ': function (tender) {
  233. let rst = 0,
  234. feeField = 'common',
  235. subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  236. let billsData = calcBase.project.Bills.datas,
  237. filterData = billsData.filter(function (data) {
  238. return data.specialProvisional;
  239. });
  240. for (let data of filterData) {
  241. if (cbTools.isUnDef(data.feesIndex) || _.isEmpty(data.feesIndex) ||
  242. cbTools.isUnDef(data.feesIndex[feeField]) || cbTools.isUnDef(data.feesIndex[feeField][subFeeField])) {
  243. continue;
  244. }
  245. rst += data.feesIndex[feeField][subFeeField];
  246. }
  247. return rst.toDecimal(decimalObj.bills.totalPrice);
  248. },
  249. //{100章以外清单合计}
  250. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  251. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  252. 'YBZYHQDHJ': function (tender) {
  253. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  254. if (!oneToSeven) {
  255. return 0;
  256. }
  257. //100-700章固定节点的所有子节点
  258. let allChildren = [];
  259. function getChildren(nodes) {
  260. allChildren = allChildren.concat(nodes);
  261. for (let node of nodes) {
  262. if (node.children.length > 0) {
  263. getChildren(node.children);
  264. }
  265. }
  266. }
  267. getChildren(oneToSeven.children);
  268. //扣除的节点:100章的节点[100-200)
  269. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  270. //计算金额
  271. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  272. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  273. }
  274. };
  275. }
  276. //工料机类型排序:人工、机上人工、混凝土、砂浆、配合比、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备。
  277. function o_sortRationGLJ(list, std, tm) {
  278. let lo_sh = typeof _ !== 'undefined' ? _ : require('lodash');
  279. const field = std ? 'gljType' : 'type';
  280. const TypeMap = {
  281. 1: 1,
  282. 303: 2,
  283. 202: 3,
  284. 203: 4,
  285. 204: 5,
  286. 201: 6,
  287. 205: 7,
  288. 206: 8,
  289. 208: 9,
  290. 209: 10,
  291. 301: 11,
  292. 302: 12,
  293. 5: 13,
  294. };
  295. if (tm) TypeMap = tm;
  296. list = lo_sh.sortByAll(list, [function (item) {
  297. return TypeMap[item[field]];
  298. }, function (item) {
  299. let arr = item.code.split('-')
  300. return arr[0];
  301. }, 'code']);
  302. return list;
  303. }
  304. if (typeof gljUtil !== 'undefined') {
  305. gljUtil.sortRationGLJ = o_sortRationGLJ;
  306. gljUtil.sortProjectGLJ = function (list) {
  307. //人工、机上人工、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备、混凝土、砂浆、配合比
  308. const TypeMap = {
  309. 1: 1,
  310. 303: 2,
  311. 201: 3,
  312. 205: 4,
  313. 206: 5,
  314. 208: 6,
  315. 209: 7,
  316. 301: 8,
  317. 302: 9,
  318. 5: 10,
  319. 202: 11,
  320. 203: 12,
  321. 204: 13,
  322. };
  323. return o_sortRationGLJ(list, false, TypeMap)
  324. }
  325. }
  326. //山东工地转移费率值修改特殊处理
  327. if (typeof feeRateObject !== 'undefined') {
  328. feeRateObject.feeRateSpecialHandle = function (subRate, value) {
  329. let result = {};
  330. if (subRate.name == "工地转移(km)" && value && value < 50) { //工地转移50km以内按50km算
  331. result.valueKey = "50";
  332. result.value = scMathUtil.roundForObj(value, getDecimal("feeRate")); //设置显示的节点值
  333. }
  334. return result;
  335. }
  336. }
  337. if (typeof module !== 'undefined' && !module.nodeType) {
  338. module.exports = {
  339. progression,
  340. deficiency,
  341. sortRationGLJ: o_sortRationGLJ,
  342. getDefalutAssistProductionFeeRate: function () {
  343. return 5
  344. }
  345. };
  346. }