zhejiang_2005.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /**
  2. * Created by CSL on 2019/09/11. 浙江计算程序、基数 等覆盖。
  3. */
  4. let isZJ2005 = 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. };
  20. (function overwriteFeeTypes() {
  21. if (typeof cpFeeTypes == 'undefined') return;
  22. cpFeeTypes = [
  23. { type: 'directWork', name: '直接工程费' },
  24. { type: 'direct', name: '直接费' },
  25. { type: 'marketLabour', name: '人工费' },
  26. { type: 'marketMaterial', name: '材料费' },
  27. { type: 'marketMachine', name: '施工机械使用费' },
  28. { type: 'otherDirect', name: '其他直接费' },
  29. { type: 'local', name: '现场经费' },
  30. { type: 'indirect', name: '间接费' },
  31. { type: 'profit', name: '计划利润' },
  32. { type: 'tax', name: '税金' },
  33. { type: 'composite', name: '年度经费综合费' },
  34. { type: 'common', name: '养护工程费' }
  35. ];
  36. })();
  37. // 清单基数
  38. const progression = ['养护工程管理费'];
  39. const deficiency = {};
  40. if (typeof baseFigureMap !== 'undefined') {
  41. const { fixedFlag } = commonConstants;
  42. const budgetMap = {
  43. // 除清单固定类别是“建筑安装工程费”的以外部分可显示
  44. '公路养护工程费': {
  45. base: 'GLYHGCF',
  46. fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
  47. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
  48. pick: false,
  49. },
  50. // 除清单固定类别是“建筑安装工程费”、“设备购置费”的以外部分可显示
  51. '设备购置费用': {
  52. base: 'SBGZFY',
  53. fixedFlag: fixedFlag.EQUIPMENT_ACQUISITION_FEE,
  54. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE],
  55. pick: false,
  56. },
  57. // 除清单固定类别是“建筑安装工程费”、“设备购置费”、“养护工程其他费用”的以外部分可显示
  58. '公路养护工程其他费用': {
  59. base: 'GLYHGCQTFY',
  60. fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
  61. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE, fixedFlag.MAINTENANCE_EXPENSES],
  62. pick: false,
  63. },
  64. // 只有清单固定类别是“养护工程其他费用”部分可显示
  65. '养护工程管理经费': {
  66. progressiveName: '养护工程管理费', // 累进库里配置的名称与基数名称应该是一样的,但是这里不一样且已经在yun上线。特殊处理
  67. isProgressive: true,
  68. base: 'YHGCGLJF',
  69. fixedFlag: null,
  70. filter: [fixedFlag.MAINTENANCE_EXPENSES],
  71. pick: true,
  72. },
  73. // 除清单固定类别是“建筑安装工程费”、“设备购置费”、“养护工程其他费用”、“一二三部分合计”的以外部分可显示
  74. '一二三部分合计': {
  75. base: 'YESBFHJ',
  76. fixedFlag: fixedFlag.ONE_TO_THREE_TOTAL,
  77. filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE, fixedFlag.MAINTENANCE_EXPENSES, fixedFlag.ONE_TO_THREE_TOTAL],
  78. pick: false,
  79. },
  80. // 只有清单固定类别是“预备费”部分可显示
  81. '工程造价增涨预留费': {
  82. base: 'GCZJZZYLF',
  83. fixedFlag: null,
  84. filter: [fixedFlag.BUDGET_FEE],
  85. pick: true,
  86. }
  87. };
  88. const boqMap = {
  89. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  90. '各章清单合计': {
  91. base: 'GZQDHJ',
  92. fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
  93. filter: [fixedFlag.ONE_SEVEN_BILLS],
  94. pick: false
  95. },
  96. //仅允许用于固定类别是“第100章至700章清单”以外的清单
  97. '专项暂定合计': {
  98. base: 'ZXZDHJ',
  99. fixedFlag: null,
  100. filter: [fixedFlag.ONE_SEVEN_BILLS],
  101. pick: false
  102. },
  103. /*
  104. * 清单固定行[第100章至700章清单]下的[第100章清单]需要允许清单可使用基数{100章以外合计}
  105. * 因此{100章以外合计}不设置关联的清单固定行
  106. * */
  107. //仅允许用于固定类别为“100章清单”引用
  108. '100章以外清单合计': {
  109. base: 'YBZYHQDHJ',
  110. fixedFlag: null,
  111. filter: [fixedFlag.ONE_HUNDRED_BILLS],
  112. pick: true
  113. }
  114. };
  115. baseFigureMap.budget = budgetMap;
  116. baseFigureMap.boq = boqMap;
  117. }
  118. if (typeof baseFigureTemplate !== 'undefined') {
  119. const { fixedFlag } = commonConstants;
  120. baseFigureTemplate.budget = {
  121. // 公路养护工程费:取清单固定类别是“建筑安装工程费”的金额
  122. GLYHGCF(tender) {
  123. return cbTools.getBaseFee(calcBase.fixedFlag.CONSTRUCTION_INSTALL_FEE, tender, 'common');
  124. },
  125. // 设备购置费用:取清单固定类别是“设备购置费”的金额
  126. SBGZFY(tender) {
  127. return cbTools.getBaseFee(calcBase.fixedFlag.EQUIPMENT_ACQUISITION_FEE, tender, 'common');
  128. },
  129. // 公路养护工程其他费用:取清单固定类别是“养护工程其他费用”的金额。
  130. GLYHGCQTFY(tender) {
  131. return cbTools.getBaseFee(calcBase.fixedFlag.MAINTENANCE_EXPENSES, tender, 'common');
  132. },
  133. // 养护工程管理经费:取清单固定类别是“建筑安装工程费”金额为基数,采用累进办法计算
  134. YHGCGLJF(tender) {
  135. const baseFee = this['GLYHGCF'](tender);
  136. if (!tender) {
  137. calcBase.baseProgressiveFee = baseFee;
  138. }
  139. return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
  140. },
  141. // 一二三部分合计:取清单固定类别是“一二三部分合计”的金额
  142. YESBFHJ(tender) {
  143. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_TO_THREE_TOTAL, tender, 'common');
  144. },
  145. // 工程造价增涨预留费:以{公路养护工程费}为基数,= P * [(1+i)^(n-1) -1]
  146. // P:公路养护工程费总额(元)
  147. // i:年造价增长率(%)(项目属性已有字段)
  148. // N:增涨计费年限(项目属性已有字段)
  149. GCZJZZYLF(tender) {
  150. const baseFee = this['GLYHGCF'](tender);
  151. //年造价增涨
  152. const costGrowthRate = calcBase.project.property.costGrowthRate
  153. ? calcBase.project.property.costGrowthRate
  154. : 0;
  155. //增涨计费年限
  156. const growthPeriod = projectObj.project.property.growthPeriod
  157. ? calcBase.project.property.growthPeriod
  158. : 0;
  159. return (baseFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
  160. }
  161. };
  162. baseFigureTemplate.boq = {
  163. //{各章清单合计}
  164. // 取清单固定类别是“第100章至700章清单”的金额
  165. 'GZQDHJ': function (tender) {
  166. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'common');
  167. },
  168. //{专项暂定合计}
  169. // 第100章至700章清单行的暂估合价
  170. 'ZXZDHJ': function (tender) {
  171. return cbTools.getBaseFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, tender, 'estimate');
  172. },
  173. //{100章以外清单合计}
  174. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  175. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  176. 'YBZYHQDHJ': function (tender) {
  177. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  178. if (!oneToSeven) {
  179. return 0;
  180. }
  181. //100-700章固定节点的所有子节点
  182. let allChildren = [];
  183. function getChildren(nodes) {
  184. allChildren = allChildren.concat(nodes);
  185. for (let node of nodes) {
  186. if (node.children.length > 0) {
  187. getChildren(node.children);
  188. }
  189. }
  190. }
  191. getChildren(oneToSeven.children);
  192. //扣除的节点:100章的节点[100-200)
  193. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  194. //计算金额
  195. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  196. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  197. }
  198. };
  199. }
  200. if (typeof gljOprObj !== 'undefined') {
  201. // 添加、替换工料机界面工料机排序
  202. gljOprObj.sortSelectViewGLJ = function (data) {
  203. // 工料机编码:按“-”前的数值排序
  204. const reg = /[^-]+/;
  205. data.sort((a, b) => {
  206. const orgCodeA = a.code;
  207. const orgCodeB = b.code;
  208. const regCodeA = orgCodeA.match(reg);
  209. const regCodeB = orgCodeB.match(reg);
  210. const compareCodeA = regCodeA
  211. ? +regCodeA[0]
  212. ? +regCodeA[0]
  213. : regCodeA[0]
  214. : orgCodeA;
  215. const compareCodeB = regCodeB
  216. ? +regCodeB[0]
  217. ? +regCodeB[0]
  218. : regCodeB
  219. : orgCodeB;
  220. return isNaN(compareCodeA) && isNaN(compareCodeB)
  221. ? compareCodeA.localeCompare(compareCodeB)
  222. : compareCodeA - compareCodeB;
  223. });
  224. // 工料机类型排序:人工、机上人工、混凝土、砂浆、配合比、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备。
  225. const TypeMap = {
  226. 1: 1,
  227. 303: 2,
  228. 202: 3,
  229. 203: 4,
  230. 204: 5,
  231. 201: 6,
  232. 205: 7,
  233. 206: 8,
  234. 208: 9,
  235. 209: 10,
  236. 301: 11,
  237. 302: 12,
  238. 5: 13,
  239. };
  240. data.sort((a, b) => {
  241. const typeA = TypeMap[a.gljType];
  242. const typeB = TypeMap[b.gljType];
  243. return typeA - typeB;
  244. });
  245. }
  246. }
  247. if (typeof gljUtil !== 'undefined') {
  248. gljUtil.getCodeSortMath = getCodeSortMath;
  249. gljUtil.getElecCoe = function () {
  250. return 0.34;
  251. }
  252. gljUtil.getElecCode = function () {
  253. return "267";
  254. }
  255. }
  256. if (typeof electrovalenceObj !== 'undefined') {
  257. electrovalenceObj.options = [
  258. { code: "270", name: "电网电", specs: "", unit: "kW·h", type: "201" },
  259. { code: "905", name: "5kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  260. { code: "906", name: "15kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  261. { code: "907", name: "30kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  262. { code: "908", name: "50kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  263. { code: "909", name: "75kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  264. { code: "910", name: "100kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  265. { code: "911", name: "120kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  266. { code: "912", name: "160kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  267. { code: "913", name: "200kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  268. { code: "914", name: "250kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
  269. { code: "915", name: "320kW以内柴油发电机组", specs: "", unit: "台班", type: "301" }
  270. ]
  271. }
  272. if (typeof materialCalcObj !== 'undefined') {
  273. materialCalcObj.getAssistProductionLabel = function () {
  274. return "辅助生产现场经费费率(%)";
  275. }
  276. gljUtil.getAssUsedPrice = function(g){
  277. return g.marketPrice;
  278. }
  279. }
  280. if (typeof projectObj !== 'undefined') {
  281. projectObj.isInsertEquipmentVisable = function (selected) {
  282. return false; //浙江不管是预算或者工程量清单,都是隐藏
  283. }
  284. }
  285. if (typeof module !== 'undefined') {
  286. let _ = require('lodash');
  287. module.exports = {
  288. sortRationGLJ: function (list) {
  289. list = _.sortByAll(list, [function (item) {
  290. return getMainType(item.gljType ? item.gljType : item.type);
  291. }, getCodeSortMath()]);
  292. return list;
  293. function getMainType(type) {
  294. let str = type + "";
  295. return parseInt(str.substr(0, 1));
  296. }
  297. },
  298. getDefalutAssistProductionFeeRate: function () {
  299. return 15
  300. }
  301. };
  302. }
  303. function getCodeSortMath() {
  304. return function (item) {
  305. let arr = item.code.split('-');
  306. return parseInt(arr[0])
  307. }
  308. }
  309. if (typeof module !== 'undefined') {
  310. module.exports = {
  311. progression,
  312. deficiency
  313. };
  314. }