dojo.provide("parus.balanceIndexConsDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.declare("parus.balanceIndexConsDialog",[parus.Dialog],{intPart:null,fracPart:null,consItems:null,queryConditions:null,description:null,skipUnsignificantZeroes:false,autoSize:true,postCreate:function(){this.inherited(arguments);if(this.description){this.headerPaneText.containerNode.innerHTML=this.description}var b=parus.userdata.get(this.declaredClass);if(b){if(b.additions){this.skipUnsignificantZeroes=b.additions.skipUnsignificantZeroes}}var a={intPart:this.intPart,fracPart:this.skipUnsignificantZeroes?null:this.fracPart};dojo.mixin(this.consItemsGrid.views.views[0].structure.cells[0][1],a);dojo.mixin(this.consItemsGrid.views.views[0].structure.cells[0][1]._props,a);dojo.mixin(this.consItemsGrid.views.views[0].structure.cells[0][14],a);dojo.mixin(this.consItemsGrid.views.views[0].structure.cells[0][14]._props,a);dojo.mixin(this.consItemsGrid.structure[0].cells[0][0],a);dojo.mixin(this.consItemsGrid.structure[0].cells[0][0]._props,a);dojo.mixin(this.consItemsGrid.structure[0].cells[0][13],a);dojo.mixin(this.consItemsGrid.structure[0].cells[0][13]._props,a);this.consItemsGridPopupMenu.bindDomNode(this.consItemsGrid.viewsNode);parus.balance._createActionsButton(this.consItemsGridPopupMenu,this.headerPane);if(b){parus.gridSettingsDialog.mergeGridSettings(this.consItemsGrid,b.gridSettings);parus.gridSettingsDialog.mergeColorConditions(this.consItemsGrid,b.colorConditions);parus.gridSettingsDialog.mergeMenuSettings(this.consItemsGridPopupMenu,b.actionSettings,b.userProcsActions,b.userReportsActions,b.userAppsActions);parus.gridSettingsDialog.mergeFilterBar(this.consItemsGrid,b.showFilterBar,b.filterValues,b.sortInfo)}this.consItemsGrid.attr("store",new parus.gridData({persistent:true,_data:this.consItems}));this.consItemsGrid.setQuery({})},print:function(){orders=[];hiddenCols=[];dojo.forEach(this.consItemsGrid.getSortProps()||[],function(d){var c=dojo.indexOf(["VALUE","KIND","AGNABBR","AGNNAME","STATE","CHECKED","ACCEPTED","SENT","RESULT","CODE","SRSTATE","SRCHECKED","STRVAL","NUMVAL","DATEVAL"],d.field);var b=(c>=0)?["20,21,22",3,5,6,7,8,9,10,11,12,13,14,16,17,18][c]:null;if(b){if(d.descending){b=dojo.map(b.split(","),function(e){return e+" desc"}).join(",")}orders.push(b.toString())}});dojo.forEach(this.consItemsGrid.views.views[0].structure.cells[0],dojo.hitch(this,function(b){if(!b.field){return}if(b.hidden){hiddenCols.push(b.field)}}));var a=this.queryConditions;a.order=orders.length?orders.join(","):"1,2,3,4,5,6,7";this.printForm.query.value=dojo.toJson(a);this.printForm.handler.value=parus.database.connected;this.printForm.skipzero.value=this.skipUnsignificantZeroes?1:0;this.printForm.hiddencols.value=hiddenCols.join(",");document.body.appendChild(this.printForm);this.printForm.submit();document.body.removeChild(this.printForm)},settingsAdditions:function(){return[{title:"Скрыть незначащие нули в дробной части числа",id:"skipUnsignificantZeroes",get:dojo.hitch(this,function(){return this.skipUnsignificantZeroes}),set:dojo.hitch(this,function(c){this.skipUnsignificantZeroes=!!c;var f={intPart:this.intPart,fracPart:this.skipUnsignificantZeroes?null:this.fracPart};var b=dojo.clone(this.consItemsGrid.structure);var a=[];var e=b[0].cells?b[0].cells[0]:b;for(var d=0;d<e.length;d++){dojo.mixin(e[d],f);a.push(dojo.clone(e[d]))}if(b[0]&&b[0].cells){b[0].cells[0]=a}else{b=a}this.consItemsGrid.setStructure(b)})}]}});