shandong_2016.js 12 KB

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