shandong_2016.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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. // 第100章至700章清单行的暂估合价
  226. ZXZDHJ: function (tender) {
  227. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'estimate');
  228. },
  229. //{100章以外清单合计}
  230. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  231. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  232. YBZYHQDHJ: function (tender) {
  233. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  234. if (!oneToSeven) {
  235. return 0;
  236. }
  237. //100-700章固定节点的所有子节点
  238. let allChildren = [];
  239. function getChildren(nodes) {
  240. allChildren = allChildren.concat(nodes);
  241. for (let node of nodes) {
  242. if (node.children.length > 0) {
  243. getChildren(node.children);
  244. }
  245. }
  246. }
  247. getChildren(oneToSeven.children);
  248. //扣除的节点:100章的节点[100-200)
  249. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  250. //计算金额
  251. let fullFeeField = tender ? "common.tenderTotalFee" : "common.totalFee";
  252. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  253. },
  254. };
  255. }
  256. //工料机类型排序:人工、机上人工、混凝土、砂浆、配合比、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备。
  257. function o_sortRationGLJ(list, std, tm) {
  258. let lo_sh = typeof _ !== "undefined" ? _ : require("lodash");
  259. const field = std ? "gljType" : "type";
  260. const TypeMap = {
  261. 1: 1,
  262. 303: 2,
  263. 202: 3,
  264. 203: 4,
  265. 204: 5,
  266. 201: 6,
  267. 205: 7,
  268. 206: 8,
  269. 208: 9,
  270. 209: 10,
  271. 301: 11,
  272. 302: 12,
  273. 5: 13,
  274. };
  275. if (tm) TypeMap = tm;
  276. list = lo_sh.sortByAll(list, [
  277. function (item) {
  278. return TypeMap[item[field]];
  279. },
  280. function (item) {
  281. let arr = item.code.split("-");
  282. return arr[0];
  283. },
  284. "code",
  285. ]);
  286. return list;
  287. }
  288. if (typeof gljUtil !== "undefined") {
  289. gljUtil.sortRationGLJ = o_sortRationGLJ;
  290. gljUtil.sortProjectGLJ = function (list) {
  291. //人工、机上人工、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备、混凝土、砂浆、配合比
  292. const TypeMap = {
  293. 1: 1,
  294. 303: 2,
  295. 201: 3,
  296. 205: 4,
  297. 206: 5,
  298. 208: 6,
  299. 209: 7,
  300. 301: 8,
  301. 302: 9,
  302. 5: 10,
  303. 202: 11,
  304. 203: 12,
  305. 204: 13,
  306. };
  307. return o_sortRationGLJ(list, false, TypeMap);
  308. };
  309. }
  310. //山东工地转移费率值修改特殊处理
  311. if (typeof feeRateObject !== "undefined") {
  312. feeRateObject.feeRateSpecialHandle = function (subRate, value) {
  313. let result = {};
  314. if (subRate.name == "工地转移(km)" && value && value < 50) {
  315. //工地转移50km以内按50km算
  316. result.valueKey = "50";
  317. result.value = scMathUtil.roundForObj(value, getDecimal("feeRate")); //设置显示的节点值
  318. }
  319. return result;
  320. };
  321. }
  322. if (typeof gljOprObj !== 'undefined') {
  323. // 添加、替换工料机界面工料机排序
  324. gljOprObj.sortSelectViewGLJ = function (data) {
  325. // 工料机编码:按“-”前的数值排序
  326. const reg = /[^-]+/;
  327. data.sort((a, b) => {
  328. const orgCodeA = a.code;
  329. const orgCodeB = b.code;
  330. const regCodeA = orgCodeA.match(reg);
  331. const regCodeB = orgCodeB.match(reg);
  332. const compareCodeA = regCodeA
  333. ? +regCodeA[0]
  334. ? +regCodeA[0]
  335. : regCodeA[0]
  336. : orgCodeA;
  337. const compareCodeB = regCodeB
  338. ? +regCodeB[0]
  339. ? +regCodeB[0]
  340. : regCodeB
  341. : orgCodeB;
  342. return isNaN(compareCodeA) && isNaN(compareCodeB)
  343. ? compareCodeA.localeCompare(compareCodeB)
  344. : compareCodeA - compareCodeB;
  345. });
  346. // 工料机类型排序:人工、机上人工、混凝土、砂浆、配合比、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备。
  347. const TypeMap = {
  348. 1: 1,
  349. 303: 2,
  350. 202: 3,
  351. 203: 4,
  352. 204: 5,
  353. 201: 6,
  354. 205: 7,
  355. 206: 8,
  356. 208: 9,
  357. 209: 10,
  358. 301: 11,
  359. 302: 12,
  360. 5: 13,
  361. };
  362. data.sort((a, b) => {
  363. const typeA = TypeMap[a.gljType];
  364. const typeB = TypeMap[b.gljType];
  365. return typeA - typeB;
  366. });
  367. }
  368. }
  369. if (typeof module !== "undefined" && !module.nodeType) {
  370. module.exports = {
  371. progression,
  372. deficiency,
  373. sortRationGLJ: o_sortRationGLJ,
  374. getDefalutAssistProductionFeeRate: function () {
  375. return 5;
  376. },
  377. };
  378. }