zhejiang_2005.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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. if (!tender) {
  135. calcBase.baseProgressiveFee = baseFee;
  136. }
  137. return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
  138. },
  139. // 一二三部分合计:取清单固定类别是“一二三部分合计”的金额
  140. YESBFHJ(tender) {
  141. const feeField = 'common';
  142. const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  143. return cbTools.getBillsFee(calcBase.fixedFlag.ONE_TO_THREE_TOTAL, feeField, subFeeField);
  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. let feeField = 'common',
  167. subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  168. return cbTools.getBillsFee(calcBase.fixedFlag.ONE_SEVEN_BILLS, feeField, subFeeField);
  169. },
  170. //{专项暂定合计}
  171. // 汇总专项暂定列有值的清单的金额
  172. 'ZXZDHJ': function (tender) {
  173. let rst = 0,
  174. feeField = 'common',
  175. subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
  176. let billsData = calcBase.project.Bills.datas,
  177. filterData = billsData.filter(function (data) {
  178. return data.specialProvisional;
  179. });
  180. for (let data of filterData) {
  181. if (cbTools.isUnDef(data.feesIndex) || _.isEmpty(data.feesIndex) ||
  182. cbTools.isUnDef(data.feesIndex[feeField]) || cbTools.isUnDef(data.feesIndex[feeField][subFeeField])) {
  183. continue;
  184. }
  185. rst += data.feesIndex[feeField][subFeeField];
  186. }
  187. return rst.toDecimal(decimalObj.bills.totalPrice);
  188. },
  189. //{100章以外清单合计}
  190. // 取清单固定清单[第100章至700章清单]的金额,但扣除清单100章下的金额。
  191. // 如果是固定清单[第100章至700章清单]下100章以外清单引用此基数,要排除自身(目前只允许100章的清单使用,所以暂时不需要此判断)
  192. 'YBZYHQDHJ': function (tender) {
  193. let oneToSeven = cbTools.findNodeByFlag(fixedFlag.ONE_SEVEN_BILLS);
  194. if (!oneToSeven) {
  195. return 0;
  196. }
  197. //100-700章固定节点的所有子节点
  198. let allChildren = [];
  199. function getChildren(nodes) {
  200. allChildren = allChildren.concat(nodes);
  201. for (let node of nodes) {
  202. if (node.children.length > 0) {
  203. getChildren(node.children);
  204. }
  205. }
  206. }
  207. getChildren(oneToSeven.children);
  208. //扣除的节点:100章的节点[100-200)
  209. let deductNodes = allChildren.filter(cbTools.withingOneHundred);
  210. //计算金额
  211. let fullFeeField = tender ? 'common.tenderTotalFee' : 'common.totalFee';
  212. return projectObj.project.calcProgram.getTotalFee([oneToSeven], deductNodes, fullFeeField).toDecimal(decimalObj.bills.totalPrice);
  213. }
  214. };
  215. }
  216. if (typeof gljOprObj !== 'undefined') {
  217. // 添加、替换工料机界面工料机排序
  218. gljOprObj.sortSelectViewGLJ = function (data) {
  219. // 工料机编码:按“-”前的数值排序
  220. const reg = /[^-]+/;
  221. data.sort((a, b) => {
  222. const orgCodeA = a.code;
  223. const orgCodeB = b.code;
  224. const regCodeA = orgCodeA.match(reg);
  225. const regCodeB = orgCodeB.match(reg);
  226. const compareCodeA = regCodeA
  227. ? +regCodeA[0]
  228. ? +regCodeA[0]
  229. : regCodeA[0]
  230. : orgCodeA;
  231. const compareCodeB = regCodeB
  232. ? +regCodeB[0]
  233. ? +regCodeB[0]
  234. : regCodeB
  235. : orgCodeB;
  236. return isNaN(compareCodeA) && isNaN(compareCodeB)
  237. ? compareCodeA.localeCompare(compareCodeB)
  238. : compareCodeA - compareCodeB;
  239. });
  240. // 工料机类型排序:人工、机上人工、混凝土、砂浆、配合比、普通材料、商品混凝土、商品砂浆、外购砼构件、绿化苗木、机械台班、机械组成物、设备。
  241. const TypeMap = {
  242. 1: 1,
  243. 303: 2,
  244. 202: 3,
  245. 203: 4,
  246. 204: 5,
  247. 201: 6,
  248. 205: 7,
  249. 206: 8,
  250. 208: 9,
  251. 209: 10,
  252. 301: 11,
  253. 302: 12,
  254. 5: 13,
  255. };
  256. data.sort((a, b) => {
  257. const typeA = TypeMap[a.gljType];
  258. const typeB = TypeMap[b.gljType];
  259. return typeA - typeB;
  260. });
  261. }
  262. }
  263. if(typeof gljUtil !== 'undefined'){
  264. gljUtil.getCodeSortMath = getCodeSortMath;
  265. gljUtil.getElecCoe = function () {
  266. return 0.24;
  267. }
  268. gljUtil.getElecCode = function () {
  269. return "267";
  270. }
  271. }
  272. if(typeof electrovalenceObj !== 'undefined'){
  273. electrovalenceObj.options = [
  274. {code:"270",name:"电网电",specs:"",unit:"kW·h",type:"201"},
  275. {code:"905",name:"5kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  276. {code:"906",name:"15kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  277. {code:"907",name:"30kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  278. {code:"908",name:"50kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  279. {code:"909",name:"75kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  280. {code:"910",name:"100kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  281. {code:"911",name:"120kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  282. {code:"912",name:"160kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  283. {code:"913",name:"200kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  284. {code:"914",name:"250kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
  285. {code:"915",name:"320kW以内柴油发电机组",specs:"",unit:"台班",type:"301"}
  286. ]
  287. }
  288. if(typeof materialCalcObj !== 'undefined'){
  289. materialCalcObj.getAssistProductionLabel = function () {
  290. return "辅助生产现场经费费率(%)";
  291. }
  292. }
  293. if(typeof projectObj !== 'undefined'){
  294. projectObj.isInsertEquipmentVisable = function(selected){
  295. return false; //浙江不管是预算或者工程量清单,都是隐藏
  296. }
  297. }
  298. if(typeof module !== 'undefined'){
  299. let _= require('lodash');
  300. module.exports = {
  301. sortRationGLJ: function(list){
  302. list = _.sortByAll(list, [function (item) {
  303. return getMainType(item.gljType?item.gljType:item.type);
  304. }, getCodeSortMath()]);
  305. return list;
  306. function getMainType(type) {
  307. let str = type + "";
  308. return parseInt(str.substr(0,1));
  309. }
  310. },
  311. getDefalutAssistProductionFeeRate:function () {
  312. return 15
  313. }
  314. };
  315. }
  316. function getCodeSortMath() {
  317. return function (item) {
  318. let arr = item.code.split('-');
  319. return parseInt(arr[0])
  320. }
  321. }