Index: ssts-web/src/main/webapp/disinfectsystem/packing/printRecyclingDetailWin.js =================================================================== diff -u -r29880 -r30076 --- ssts-web/src/main/webapp/disinfectsystem/packing/printRecyclingDetailWin.js (.../printRecyclingDetailWin.js) (revision 29880) +++ ssts-web/src/main/webapp/disinfectsystem/packing/printRecyclingDetailWin.js (.../printRecyclingDetailWin.js) (revision 30076) @@ -575,7 +575,7 @@ }else if(sstsConfig.printRecyclingDetailWithDepartGroup){ //按科室分组打印回收清单 Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/recyclingRecordAction!printRecyclingDetailWithDepartmentGroup.do', + url : WWWROOT + '/disinfectSystem/recyclingRecordAction!handleResultSetByRecyclingDetailPrintConfig.do', params : { startDateTime : startDateTime, endDateTime : endDateTime, @@ -857,35 +857,186 @@ LODOP.SET_SHOW_MODE("HIDE_PAPER_BOARD",1); LODOP.PREVIEW(); } +//判断字符是不是整数 +function isNumber(val) { + var regPos = /^\d+(\.\d+)?$/; //非负浮点数 + var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 + if(regPos.test(val) || regNeg.test(val)) { + return true; + } else { + return false; + } +} function printRecyclingDetailWithDepartgroup(printType,startDateTime,endDateTime,printUser,recyclingDetail){ var LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM')); - LODOP.SET_PRINT_STYLE("FontSize",17); - LODOP.ADD_PRINT_TEXT(5,300,"100%",5,"CSSD每日回收登记表"); - LODOP.SET_PRINT_STYLE("FontSize",11); - LODOP.ADD_PRINT_TEXT(35,50,"100%",5,"制单人: " + printUser); - LODOP.ADD_PRINT_TEXT(35,200,"100%",5,"开始时间:" + startDateTime); - LODOP.ADD_PRINT_TEXT(35,450,"100%",5,"结束时间: " + endDateTime); - -// LODOP.SET_PRINT_STYLE("ItemType", 2); -// LODOP.ADD_PRINT_TEXT(10,600,"95%",5,"第#页/共&页"); - - var htmlTable =""; - var departmentGroupNames = recyclingDetail.departmentGroupNames - for(var i = 0; i < departmentGroupNames.length;++i){ - //分院 - htmlTable += ""; + var DONT_ENUM = "propertyIsEnumerable,isPrototypeOf,hasOwnProperty,toLocaleString,toString,valueOf,constructor".split(","), + hasOwn = ({}).hasOwnProperty; + for (var i in { + toString: 1 + }){ + DONT_ENUM = false; } - //备注 -// htmlTable += ""; + Object.keys = Object.keys || function(obj){ + var result = []; + for(var key in obj ) if(hasOwn.call(obj,key)){ + result.push(key) ; + } + if(DONT_ENUM && obj){ + for(var i = 0 ;key = DONT_ENUM[i++]; ){ + if(hasOwn.call(obj,key)){ + result.push(key); + } + } + } + return result; + }; - htmlContent = "" + htmlTable + ""; + if(recyclingDetail.headerContent && recyclingDetail.headerContent.length > 0){ + var headerContent0 = recyclingDetail.headerContent[0]; + var position0 = headerContent0.position; + var headerContent1 = recyclingDetail.headerContent[1]; + var headerContent2 = recyclingDetail.headerContent[2]; + var headerContent3 = recyclingDetail.headerContent[3]; + var position1 = headerContent1.position; + var position2 = headerContent2.position; + var position3 = headerContent3.position; + LODOP.SET_PRINT_STYLE("FontSize",headerContent0.fontSize); + LODOP.ADD_PRINT_TEXT(position0[0],position0[1],position0[2],position0[3],headerContent0.label); + LODOP.SET_PRINT_STYLE("FontSize",headerContent1.fontSize); + LODOP.ADD_PRINT_TEXT(position1[0],position1[1],position1[2],position1[3],headerContent1.label + ' ' + printUser); + LODOP.ADD_PRINT_TEXT(position2[0],position2[1],position2[2],position2[3],headerContent2.label + ' ' + startDateTime); + LODOP.ADD_PRINT_TEXT(position3[0],position3[1],position3[2],position3[3],headerContent3.label + ' ' + endDateTime); + }else { + LODOP.SET_PRINT_STYLE("FontSize",17); + LODOP.ADD_PRINT_TEXT(5,300,"100%",5,"CSSD每日回收登记表"); + LODOP.SET_PRINT_STYLE("FontSize",11); + LODOP.ADD_PRINT_TEXT(35,50,"100%",5,"制单人: " + printUser); + LODOP.ADD_PRINT_TEXT(35,200,"100%",5,"开始时间:" + startDateTime); + LODOP.ADD_PRINT_TEXT(35,450,"100%",5,"结束时间: " + endDateTime); + } + var configTable = recyclingDetail['配置文件']; + if(configTable){ + var htmlTable = ""; + for(var i=0;i 0){ + htmlTable += "
"; - htmlTable += buildDepartTable(recyclingDetail,departmentGroupNames[i]); - htmlTable += "
"; -// htmlTable += buildRemarkTable(recyclingDetail.remarks,"备注"); -// htmlTable += "
"; + htmlTable += ''; + if(table.departGroupsConfig.showDepartGroupColumn == true){ + htmlTable += ''; + } + htmlTable += ''; + for(var j=0;j 0;j++){ + var tousseColumnsConfig = table.tousseColumnsConfig[j]; + var includeOtherTousses = tousseColumnsConfig.includeOtherTousses; + if(includeOtherTousses == undefined || includeOtherTousses == true){ + htmlTable += ''; + } + } + htmlTable += ''; + + for(var item in tableData){ + var itemLength = Object.keys(tableData[item]).length; + var k = 0; + for(var childItem in tableData[item]){ + htmlTable += ''; + if(k == 0 && table.departGroupsConfig.showDepartGroupColumn == true){ + htmlTable += ''; + } + htmlTable += ''; + if(table.tousseColumnsConfig){ + for(var j=0;j 0;j++){ + var tousseColumnsConfig = table.tousseColumnsConfig[j]; + var includeOtherTousses = tousseColumnsConfig.includeOtherTousses; + var amount = ''; + for(var lastItem in tableData[item][childItem]){ + if(lastItem == tousseColumnsConfig.columnName){ + amount = tableData[item][childItem][lastItem]; + } + } + if(includeOtherTousses == undefined || includeOtherTousses == true){ + htmlTable += ''; + } + } + } + htmlTable += ''; + k++; + } + } + htmlTable += ''; + if(table.departGroupsConfig.showDepartGroupColumn == true){ + htmlTable += ''; + }else { + htmlTable += ''; + } + for(var j=0;j 0;j++){ + var tousseColumnsConfig = table.tousseColumnsConfig[j]; + var includeOtherTousses = tousseColumnsConfig.includeOtherTousses; + var amount = 0; + for(var item in sumInfo){ + if(item == tousseColumnsConfig.columnName){ + amount = sumInfo[item]; + } + } + if(includeOtherTousses == undefined || includeOtherTousses == true){ + htmlTable += ''; + } + } + htmlTable += ''; + + htmlTable += '
院区'+table.departConfig.columnName+''+tousseColumnsConfig.columnName+'
'+item+''+childItem+''+amount+'
合计:合计:'+amount+'
'; + } + } + + if(table.tableLayout == 'noTousseColumns'){ + if(tableData){ + htmlTable += ""; + for(var item in tableData){ + var itemLength = Object.keys(tableData[item]).length; + var k = 0; + for(var childItem in tableData[item]){ + htmlTable += ''; + if(k == 0 && table.showDepartGroupColumn == true){ + htmlTable += ''; + } + htmlTable += ''; + htmlTable += ''; + k++ + } + } + htmlTable += '
'+item+''+childItem+':'; + for(var lastItem in tableData[item][childItem]){ + var isNum = isNumber(lastItem.substr(lastItem.length-1,1)); + if(isNum){ + htmlTable += lastItem + 'x' + tableData[item][childItem][lastItem] + }else { + htmlTable += lastItem + ' ' + tableData[item][childItem][lastItem] + } + } + htmlTable += '
'; + } + } + } + }else { + var htmlTable =""; + var departmentGroupNames = recyclingDetail.departmentGroupNames + if(departmentGroupNames && departmentGroupNames.length > 0){ + for(var i = 0; i < departmentGroupNames.length;++i){ + //分院 + htmlTable += ""; + } + } + } + htmlContent = "" + htmlTable + ""; LODOP.ADD_PRINT_HTM(55,5,"100%","100%",htmlContent); - + if(printType == 0){//直接打印 LODOP.PRINT(); }else{//打印预览
"; + htmlTable += buildDepartTable(recyclingDetail,departmentGroupNames[i]); + htmlTable += "