zhejiang_2005.js 14 KB

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