Wtf.AccReportPanelWithPaging=function(A){Wtf.apply(this,A);this.title=A.title;Wtf.AccReportPanelWithPaging.superclass.constructor.call(this,{border:false})};Wtf.extend(Wtf.AccReportPanelWithPaging,Wtf.Panel,{initComponent:function(){this.groupingView=new Wtf.grid.GroupingView({forceFit:true,showGroupName:false,enableGroupingMenu:false,hideGroupedColumn:true});this.summary=new Wtf.grid.GroupSummary({});this.grid=new Wtf.AccGridComp({id:"accRepGrid"+this.id,ds:this.gridds,plugins:this.summary,view:this.groupingView,cm:this.gridcm,border:false});this.storeDateType=new Wtf.data.SimpleStore({fields:["abbr","title"],data:[["0","All"],["1","Today"],["2","This Week"],["3","This Week-To-Date"],["4","This Month"],["5","This Month-To-Date"]]});this.storeInvoiceType=new Wtf.data.SimpleStore({fields:["abbr","title"],data:[["0","Student"],["1","Rejected Applicant"]]});this.exportBttn=new Wtf.Toolbar.Button({text:"Export",tooltip:"Export this data",handler:function(){if(this.dateTimePickerFrom.getValue()){setDldUrl("fileDownload.jsp?&type="+this.title+"&dtype=attachment&fromDate="+new Date(this.dateTimePickerFrom.getValue()).format("Y-m-d H:i:s")+"&toDate="+new Date(this.dateTimePickerTo.getValue()).format("Y-m-d H:i:s")+"&type1="+this.type)}else{setDldUrl("fileDownload.jsp?&type="+this.title+"&dtype=attachment&fromDate=&toDate=&type1="+this.type)}},scope:this});this.invoicetypecombo=new Wtf.form.ComboBox({fieldLabel:"Dates*",anchor:"98%",id:"Invoice"+this.id,mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.storeInvoiceType,displayField:"title",value:"Student",allowBlank:false,hidden:this.set,msgTarget:"side"});this.comboBoxDates=new Wtf.form.ComboBox({fieldLabel:"Dates*",anchor:"98%",id:"Dates"+this.id,mode:"local",triggerAction:"all",typeAhead:true,editable:false,store:this.storeDateType,displayField:"title",value:"This Month-To-Date",allowBlank:false,msgTarget:"side"});this.dateTimePickerFrom=new Wtf.form.DateField({fieldLabel:"From",anchor:"98%",id:"DateFrom"+this.id,format:Wtf.getDateFormat(),value:new Date().getFirstDateOfMonth()});this.dateTimePickerFrom.on("change",this.changeBaseParams,this);this.dateTimePickerTo=new Wtf.form.DateField({fieldLabel:"To",anchor:"98%",id:"DateTo"+this.id,format:Wtf.getDateFormat(),value:new Date().clearTime()});this.dateTimePickerTo.on("change",this.changeBaseParams,this);this.allFlag=0;this.dir=0;this.sortIndex="";this.comboBoxDates.on("select",function(){if(this.comboBoxDates.getValue()=="All"){this.dateTimePickerTo.setValue(null);this.dateTimePickerFrom.setValue(null);this.allFlag=1}else{if(this.comboBoxDates.getValue()=="Today"){this.dateTimePickerTo.setValue(new Date());this.dateTimePickerFrom.setValue(new Date());this.allFlag=0}else{if(this.comboBoxDates.getValue()=="This Month"){this.dateTimePickerTo.setValue(new Date().getLastDateOfMonth());this.dateTimePickerFrom.setValue(new Date().getFirstDateOfMonth());this.allFlag=0}else{if(this.comboBoxDates.getValue()=="This Month-To-Date"){this.dateTimePickerTo.setValue(new Date());this.dateTimePickerFrom.setValue(new Date().getFirstDateOfMonth());this.allFlag=0}else{if(this.comboBoxDates.getValue()=="This Week"){var A=new Date();var C=A.format("w");A=A.add(Date.DAY,-C+1);var B=A.add(Date.DAY,6);this.dateTimePickerTo.setValue(B);this.dateTimePickerFrom.setValue(A);this.allFlag=0}else{if(this.comboBoxDates.getValue()=="This Week-To-Date"){var A=new Date();var C=A.format("w");A=A.add(Date.DAY,-C+1);this.dateTimePickerTo.setValue(new Date());this.dateTimePickerFrom.setValue(A);this.allFlag=0}}}}}}this.changeBaseParams()},this);this.type=0;this.invoicetypecombo.on("select",function(){if(this.invoicetypecombo.getValue()=="Student"){this.type=0}else{if(this.invoicetypecombo.getValue()=="Rejected Applicant"){this.type=1}}this.changeBaseParams()},this)},onRender:function(A){Wtf.AccReportPanelWithPaging.superclass.onRender.call(this,A);this.innerpanel=new Wtf.Panel({id:"InnRepPan"+this.id,border:false,layout:"fit",items:[{border:false,layout:"border",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"username"}),"-",this.exportBttn,"->",this.invoicetypecombo,"Dates: &nbsp&nbsp&nbsp",this.comboBoxDates,"&nbsp&nbsp&nbsp From: &nbsp&nbsp&nbsp",this.dateTimePickerFrom,"&nbsp&nbsp&nbsp To: &nbsp&nbsp&nbsp",this.dateTimePickerTo],bbar:this.pgN=new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickPanelSearch,store:this.gridds,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})}),items:[{region:"center",id:"center"+this.id,border:false,layout:"fit",items:this.grid}]}]});this.add(this.innerpanel);this.gridds.on("load",function(B){this.quickPanelSearch.StorageChanged(B)},this);this.gridds.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this);this.grid.on("headerclick",function(C,B,D){if(C.colModel.config[B].sortable==false){return }var E=Wtf.get(D.getTarget().id);if(!this.prevTarget||this.prevTarget!==E){if(this.prevTarget){if(this.prevTarget.hasClass("sort-asc")){this.prevTarget.removeClass("sort-asc")}else{if(this.prevTarget.hasClass("sort-desc")){this.prevTarget.removeClass("sort-desc")}}}this.prevTarget=E}if(E.hasClass("sort-asc")){E.addClass("sort-desc");E.removeClass("sort-asc");this.dir=1}else{E.addClass("sort-asc");E.addClass("x-grid3-hd-inner");if(E.hasClass("sort-desc")){E.removeClass("sort-desc")}this.dir=0}this.sortIndex=C.colModel.config[B].dataIndex;this.changeBaseParams()},this)},changeBaseParams:function(){this.gridds.baseParams={fromdate:new Date(this.dateTimePickerFrom.getValue()).format("Y-m-d H:i:s"),todate:new Date(this.dateTimePickerTo.getValue()).format("Y-m-d H:i:s"),allflag:this.allFlag,sortindex:this.sortIndex,dir:this.dir,type:this.type};this.gridds.load({params:{limit:this.gridds.lastOptions.params.limit,start:this.gridds.lastOptions.params.start},scope:this})}});Wtf.accountmap=function(A){this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[];Wtf.apply(this,A);this.planSM=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.planRec=Wtf.data.Record.create([{name:"feeid",type:"int"},{name:"feename"},{name:"incaccount"},{name:"incaccid"},{name:"expccount"},{name:"expaccid"},{name:"araccount"},{name:"araccid"}]);this.planReader=new Wtf.data.KwlJsonReader({root:"data"},this.planRec);this.planStore=new Wtf.data.Store({url:"jspfiles/admin/acastructure.jsp",reader:this.planReader});this.planCM=new Wtf.grid.ColumnModel([this.planSM,{header:"Fee Type",dataIndex:"feename"},{header:"Income Account",dataIndex:"incaccount"},{header:"Expense Account",dataIndex:"expaccount"},{header:"Accounts Receivable Account",dataIndex:"araccount"}]);this.planCM.defaultSortable=true;this.planGrid=new Wtf.grid.EditorGridPanel({ds:this.planStore,cm:this.planCM,sm:this.planSM,autoScroll:true,trackMouseOver:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.programRecord=Wtf.data.Record.create([{name:"programid",type:"string"},{name:"programname",type:"string"}]);this.programReader=new Wtf.data.KwlJsonReader({root:"data"},this.programRecord);this.programStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.programReader});this.programComboItem=new Wtf.form.ComboBox({triggerAction:"all",store:this.programStore,mode:"local",width:240,listWidth:"240",readOnly:true,displayField:"programname",fieldLabel:"Program*",hiddenName:"programid",allowBlank:false,valueField:"programid",emptyText:"Select a Program"});this.layout="border";this.border=false;this.items=[{region:"north",height:40,layout:"form",border:false,bodyStyle:"padding: 13px;",items:this.programComboItem},{region:"center",border:false,layout:"fit",items:this.planGrid}];this.bbar=[{id:"editfeebtn"+this.id,text:"Select Accounts",scope:this,disabled:true,handler:this.setPlan}];this.programComboItem.on("select",this.getfeeList,this);this.planSM.on("selectionchange",this.setplanedit,this);this.planStore.on("load",this.planstoreload,this);if(this.mode==0){this.programStore.on("load",this.getplanDetails,this)}};Wtf.extend(Wtf.accountmap,Wtf.Panel,{onRender:function(A){Wtf.accountmap.superclass.onRender.call(this,A);this.programStore.load({params:{type:20}})},planstoreload:function(){Wtf.Ajax.requestEx({method:"POST",url:"jspfiles/admin/acastructure.jsp",params:{type:72,programid:this.programComboItem.getValue()}},this,function(response,option){var resp=eval("("+response+")");if(resp!=null&&resp.data!=null){for(var ctr=0;ctr<resp.data.length;ctr++){var index=this.planStore.find("feeid",resp.data[ctr].feeid);if(index>-1){this.planStore.getAt(index).set("incaccount",resp.data[ctr].incaccount);this.planStore.getAt(index).set("expaccount",resp.data[ctr].expaccount);this.planStore.getAt(index).set("araccount",resp.data[ctr].araccount);this.planStore.getAt(index).set("incaccid",resp.data[ctr].incaccid);this.planStore.getAt(index).set("expaccid",resp.data[ctr].expaccid);this.planStore.getAt(index).set("araccid",resp.data[ctr].araccid)}}}},function(resp,req){})},setplanedit:function(){var A=this.planSM.getSelections();if(A.length==1){Wtf.getCmp("editfeebtn"+this.id).setDisabled(false)}else{Wtf.getCmp("editfeebtn"+this.id).setDisabled(true)}},getfeeList:function(){this.planStore.load({params:{type:28,programid:this.programComboItem.getValue(),status:1}})},setPlan:function(A,B){this.pRecord=Wtf.data.Record.create([{name:"accid",type:"string"},{name:"accountname",type:"string"}]);this.pSM=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.pReader=new Wtf.data.KwlJsonReader({root:"data"},this.pRecord);this.pStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.pReader});this.pCM=new Wtf.grid.ColumnModel([this.pSM,{header:"Account",dataIndex:"accountname"}]);this.pCM.defaultSortable=true;this.pGrid=new Wtf.grid.EditorGridPanel({ds:this.pStore,cm:this.pCM,sm:this.pSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.disRecord=Wtf.data.Record.create([{name:"accid",type:"string"},{name:"accountname",type:"string"}]);this.disSM=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.disReader=new Wtf.data.KwlJsonReader({root:"data"},this.disRecord);this.disStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.pReader});this.disCM=new Wtf.grid.ColumnModel([this.disSM,{header:"Account",dataIndex:"accountname"}]);this.disCM.defaultSortable=true;this.disGrid=new Wtf.grid.EditorGridPanel({ds:this.disStore,cm:this.disCM,sm:this.disSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.schRecord=Wtf.data.Record.create([{name:"accid",type:"string"},{name:"accountname",type:"string"}]);this.schSM=new Wtf.grid.CheckboxSelectionModel({singleSelect:true});this.schReader=new Wtf.data.KwlJsonReader({root:"data"},this.schRecord);this.schStore=new Wtf.data.Store({proxy:new Wtf.data.HttpProxy({url:"jspfiles/admin/acastructure.jsp"}),reader:this.schReader});this.schCM=new Wtf.grid.ColumnModel([this.schSM,{header:"Account",dataIndex:"accountname"}]);this.schCM.defaultSortable=true;this.schGrid=new Wtf.grid.EditorGridPanel({ds:this.schStore,cm:this.schCM,sm:this.schSM,autoScroll:true,collapsible:true,layout:"fit",clicksToEdit:1,viewConfig:{forceFit:true,autoFill:true}});this.pStore.load({params:{type:69,typeid:9}});this.disStore.load({params:{type:69,typeid:12}});this.schStore.load({params:{type:69,typeid:2}});this.pStore.on("load",this.pStoreLoad,this);this.disStore.on("load",this.disStoreLoad,this);this.schStore.on("load",this.schStoreLoad,this);this.editWin=new Wtf.Window({title:"Select Plan",closable:true,modal:true,iconCls:"win",width:500,height:550,resizable:false,buttonAlign:"right",buttons:[{text:"Save",scope:this,handler:this.userPlanmap},{text:"Cancel",scope:this,handler:function(){this.editWin.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/upload52.gif","Select Account","Select Account for Feetypes.")},{region:"center",border:false,layout:"fit",items:[{border:false,bodyStyle:"background:transparent;",layout:"border",labelWidth:50,items:[{title:"Income Account",region:"north",layout:"fit",border:false,height:150,items:this.pGrid},{region:"center",layout:"border",border:false,items:[{title:"Expense Account",region:"west",width:250,layout:"fit",border:false,items:this.disGrid},{title:"Account Receivable Account",region:"center",border:false,layout:"fit",items:this.schGrid}]}]}]}]});this.editWin.show()},pStoreLoad:function(){if(this.planSM.getSelected()){var A=[];if(this.planSM.getSelected().data.incaccid){A=this.planSM.getSelected().get("incaccid").split(",")}var B=[];for(var C=0;C<A.length;C++){B.push(this.pStore.getAt(this.pStore.find("accid",A[C])))}this.pSM.selectRecords(B);this.pSM.on("rowselect",this.planSelected,this);this.pSM.on("rowdeselect",this.planDeSelected,this)}},disStoreLoad:function(){if(this.planSM.getSelected()){var A=[];if(this.planSM.getSelected().data.expaccid){A=this.planSM.getSelected().get("expaccid").split(",")}var B=[];for(var C=0;C<A.length;C++){B.push(this.disStore.getAt(this.disStore.find("accid",A[C])))}this.disSM.selectRecords(B);this.disSM.on("rowselect",this.disSelected,this);this.disSM.on("rowdeselect",this.disDeSelected,this)}},schStoreLoad:function(){if(this.planSM.getSelected()){var A=[];if(this.planSM.getSelected().data.araccid){A=this.planSM.getSelected().get("araccid").split(",")}var B=[];for(var C=0;C<A.length;C++){B.push(this.schStore.getAt(this.schStore.find("accid",A[C])))}this.schSM.selectRecords(B);this.schSM.on("rowselect",this.schSelected,this);this.schSM.on("rowdeselect",this.schDeSelected,this)}},planSelected:function(B,A,C){if(this.plandel.indexOf(this.pStore.getAt(A).get("accid"))>-1){this.plandel.remove(this.pStore.getAt(A).get("accid"))}else{this.planAdd.push(this.pStore.getAt(A).get("accid"))}},planDeSelected:function(B,A,C){if(this.planAdd.indexOf(this.pStore.getAt(A).get("accid"))>-1){this.planAdd.remove(this.pStore.getAt(A).get("accid"))}else{this.plandel.push(this.pStore.getAt(A).get("accid"))}},disSelected:function(B,A,C){if(this.displandel.indexOf(this.disStore.getAt(A).get("accid"))>-1){this.displandel.remove(this.disStore.getAt(A).get("accid"))}else{this.displanAdd.push(this.disStore.getAt(A).get("accid"))}},disDeSelected:function(B,A,C){if(this.displanAdd.indexOf(this.disStore.getAt(A).get("accid"))>-1){this.displanAdd.remove(this.disStore.getAt(A).get("accid"))}else{this.displandel.push(this.disStore.getAt(A).get("accid"))}},schSelected:function(B,A,C){if(this.schplandel.indexOf(this.schStore.getAt(A).get("accid"))>-1){this.schplandel.remove(this.schStore.getAt(A).get("accid"))}else{this.schplanAdd.push(this.schStore.getAt(A).get("accid"))}},schDeSelected:function(B,A,C){if(this.schplanAdd.indexOf(this.schStore.getAt(A).get("accid"))>-1){this.schplanAdd.remove(this.schStore.getAt(A).get("accid"))}else{this.schplandel.push(this.schStore.getAt(A).get("accid"))}},userPlanmap:function(){Wtf.Ajax.request({url:"jspfiles/admin/acastructure.jsp",method:"POST",params:{feeid:this.planSM.getSelected().get("feeid"),programid:this.programComboItem.getValue(),incaccid:this.planAdd.toString(),delincaccid:this.plandel.toString(),expaccid:this.displanAdd.toString(),delexpaccid:this.displandel.toString(),araccid:this.schplanAdd.toString(),delaraccid:this.schplandel.toString(),type:71},scope:this,success:function(A,B){this.editWin.close();this.getfeeList();this.planAdd=[];this.plandel=[];this.displanAdd=[];this.displandel=[];this.schplanAdd=[];this.schplandel=[]}})}});Wtf.BalanceSheet=function(A){Wtf.apply(this,A);Wtf.BalanceSheet.superclass.constructor.call(this,A)};Wtf.extend(Wtf.BalanceSheet,Wtf.Panel,{contentTitle:null,contentTitle1:null,textBoxWidth:225,initComponent:function(){Wtf.BalanceSheet.superclass.initComponent.call(this);var B=Wtf.data.Record.create([{name:"balsheettype"},{name:"balsheetdate"},{name:"balsheetno"},{name:"custname"},{name:"studentid"},{name:"balsheetamt"},{name:"balsheetbal"},{name:"accountname"},{name:"displaylevel"}]);var A=new Wtf.data.JsonReader({root:"transactions",totalProperty:"TotalCount"},B);this.dsBalSheet=new Wtf.data.GroupingStore({url:"jspfiles/accounting/reports.jsp?flag=3&title="+this.title+"&companyid=1",reader:A,sortInfo:{field:"accountname",direction:"ASC"},groupField:"accountname"});Wtf.grid.GroupSummary.Calculations["balance"]=function(D,C){return C.data.balsheetbal};this.cmBalSheet=new Wtf.grid.ColumnModel([{header:"Type",dataIndex:"balsheettype"},{header:"Date",dataIndex:"balsheetdate",renderer:function(C){return Wtf.modifyDateFmt(C,"Y-m-j H:i:s",Wtf.getDateFormat())}},{header:"Number",dataIndex:"balsheetno",renderer:function(C){return"<a href = '#' class='printInvoice' > "+C+"</a>"}},{dataIndex:"accountname",sortable:true,groupable:true},{header:"Name",dataIndex:"custname"},{header:"Student ID",dataIndex:"studentid",align:"right"},{header:"Amount",dataIndex:"balsheetamt",align:"right",summaryType:"balance",summaryRenderer:function(C){C=C+"";if(C!=null&&C!=""){return"Total: "+Wtf.precisionDecimalValue(C)}else{return"Total: "+C}},renderer:function(C){C=C+"";if(C!=null&&C!=""){return Wtf.precisionDecimalValue(C)}else{return C}}},{header:"Balance",dataIndex:"balsheetbal",align:"right",sortable:false,summaryType:"balance",summaryRenderer:function(C){C=C+"";if(C!=null&&C!=""){return"Total: "+Wtf.precisionDecimalValue(C)}else{return"Total: "+C}},renderer:function(C){C=C+"";if(C!=null&&C!=""){return Wtf.precisionDecimalValue(C)}else{return C}}}]);this.cmBalSheet.defaultSortable=false},onRender:function(A){Wtf.BalanceSheet.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(Wtf.get("accGridBal"+this.id)));this.dsBalSheet.on("beforeload",function(){this.loadMask.show()},this);this.balancesheet=new Wtf.AccReportPanelWithPaging({id:"RepopanBal"+this.id,layout:"fit",gridds:this.dsBalSheet,gridcm:this.cmBalSheet,border:false,set:this.set,closable:false,title:this.title});this.add(this.balancesheet);this.dsBalSheet.baseParams={fromdate:new Date(this.balancesheet.dateTimePickerFrom.getValue()).format("Y-m-d H:i:s"),todate:new Date(this.balancesheet.dateTimePickerTo.getValue()).format("Y-m-d H:i:s"),allflag:0,sortindex:"",dir:0};this.dsBalSheet.load({params:{limit:15,start:0},scope:this});this.balancesheet.grid.on("cellclick",function(D,B,C,E){if(E.target.className=="printInvoice"){var F=D.getStore().getAt(B);if(F.data.balsheettype=="Invoice"){printInvoice(F.data.balsheetno,1)}else{if(F.data.balsheettype=="Credit Memo"||F.data.balsheettype=="Refund"){printInvoice(F.data.balsheetno,2)}else{if(F.data.balsheettype=="Payment"){printInvoice(F.data.balsheetno,3)}}}}},this);this.dsBalSheet.on("load",function(C,B,D){this.loadMask.hide()},this);this.dsBalSheet.on("loadexception",function(C,B,D){this.loadMask.hide()},this)}});Wtf.CustomerBalance=function(A){Wtf.apply(this,A);Wtf.CustomerBalance.superclass.constructor.call(this,A)};Wtf.extend(Wtf.CustomerBalance,Wtf.Panel,{contentTitle:null,contentTitle1:null,textBoxWidth:225,initComponent:function(){Wtf.CustomerBalance.superclass.initComponent.call(this);custtype=null;var B=Wtf.data.Record.create([{name:"balsheettype"},{name:"balsheetdate",type:"date",dateFormat:"Y-m-j H:i:s"},{name:"balsheetno"},{name:"custname"},{name:"balsheetamt"},{name:"balsheetbal"},{name:"username"},{name:"displaylevel"}]);var A=new Wtf.data.JsonReader({root:"transactions",totalProperty:"TotalCount"},B);this.dscustBalance=new Wtf.data.GroupingStore({url:"jspfiles/accounting/reports.jsp?flag=4&title="+this.title,reader:A,sortInfo:{field:"username",direction:"ASC"},groupField:"username"});Wtf.grid.GroupSummary.Calculations["balance"]=function(D,C){return C.data.balsheetbal};this.cmcustBalance=new Wtf.grid.ColumnModel([{header:"Type",dataIndex:"balsheettype"},{header:"Date",dataIndex:"balsheetdate",renderer:function(C){if(Wtf.isEmpty(C)){return C}else{return C.format(Wtf.getDateFormat())}}},{header:"Number",dataIndex:"balsheetno",renderer:function(C){return"<a href = '#' class='printInvoice' > "+C+"</a>"}},{header:"Name",dataIndex:"custname"},{dataIndex:"username",sortable:true,groupable:true},{header:"Amount",dataIndex:"balsheetamt",align:"right",summaryType:"balance",summaryRenderer:function(C){C=C+"";if(C!=null&&C!=""){return"Total: "+Wtf.precisionDecimalValue(C)}else{return"Total: "+C}},renderer:function(C){C=C+"";if(C!=null&&C!=""){return Wtf.precisionDecimalValue(C)}else{return C}}},{header:"Balance",dataIndex:"balsheetbal",align:"right",sortable:false,summaryType:"balance",summaryRenderer:function(C){C=C+"";if(C!=null&&C!=""){return"Total: "+Wtf.precisionDecimalValue(C)}else{return"Total: "+C}},renderer:function(C){C=C+"";if(C!=null&&C!=""){return Wtf.precisionDecimalValue(C)}else{return C}}}]);this.cmcustBalance.defaultSortable=false},onRender:function(A){Wtf.CustomerBalance.superclass.onRender.call(this,A);this.loadMask=new Wtf.LoadMask(this.el.dom,Wtf.apply(this.loadMask));this.dscustBalance.on("beforeload",function(){this.loadMask.show()},this);this.customerbalance=new Wtf.AccReportPanelWithPaging({id:"RepcustBalance"+this.id,layout:"fit",gridds:this.dscustBalance,gridcm:this.cmcustBalance,border:false,closable:false,set:this.set,iconCls:getTabIconCls(Wtf.etype.home),title:this.title});this.add(this.customerbalance);this.dscustBalance.baseParams={fromdate:new Date(this.customerbalance.dateTimePickerFrom.getValue()).format("Y-m-d H:i:s"),todate:new Date(this.customerbalance.dateTimePickerTo.getValue()).format("Y-m-d H:i:s"),allflag:0,sortindex:"",dir:0};this.dscustBalance.load({params:{limit:15,start:0},scope:this});this.customerbalance.grid.on("cellclick",function(D,B,C,E){if(E.target.className=="printInvoice"){var F=D.getStore().getAt(B);if(F.data.balsheettype=="Invoice"){printInvoice(F.data.balsheetno,1)}else{if(F.data.balsheettype=="Credit Memo"||F.data.balsheettype=="Refund"){printInvoice(F.data.balsheetno,2)}else{if(F.data.balsheettype=="Payment"){printInvoice(F.data.balsheetno,3)}}}}},this);this.dscustBalance.on("load",function(){this.loadMask.hide()},this);this.dscustBalance.on("loadexception",function(){this.loadMask.hide()},this)}});Wtf.AccountPanel=function(A){Wtf.apply(this,A);Wtf.AccountPanel.superclass.constructor.call(this,A)};Wtf.extend(Wtf.AccountPanel,Wtf.Panel,{initComponent:function(){Wtf.CustomerBalance.superclass.initComponent.call(this);this.AccCenter=Wtf.data.Record.create([{name:"acccenterid"},{name:"acccentername",type:"string"},{name:"acccentertype",type:"string"},{name:"acccenterbal",type:"float"}]);this.dsAccCenter=new Wtf.data.Store({baseParams:{flag:6,text:""},url:"jspfiles/accounting/Accounts.jsp",reader:new Wtf.data.JsonReader({root:"data",totalProperty:"TotalCount",remoteGroup:true,remoteSort:true},this.AccCenter)});this.cmAccCenter=new Wtf.grid.ColumnModel([new Wtf.grid.RowNumberer(),{dataIndex:"acccenterid",hidden:true},{header:"Name",dataIndex:"acccentername"},{header:"Type",dataIndex:"acccentertype"},{header:"Balance",dataIndex:"acccenterbal",align:"right",renderer:function(A){return Wtf.precisionDecimalValue(A)}}]);this.cmAccCenter.defaultSortable=true;this.grid=new Wtf.AccGridComp({id:"accGrid"+this.id,border:false,trackMouseOver:true,selModel:new Wtf.grid.RowSelectionModel(),ds:this.dsAccCenter,cm:this.cmAccCenter});this.accountscenter=new Wtf.Panel({id:"accPan"+this.id,layout:"fit",tbar:["Quick Search: ",this.quickPanelSearch=new Wtf.KWLTagSearch({width:200,field:"acccentername"}),"-",new Wtf.Toolbar.Button({text:"Create",tooltip:"New",id:"BtnNew"+this.id,handler:function(){this.newaccwindow=new Wtf.NewAccountWindow({id:"NewAccWin"+this.id,title:"New Account",closable:true,border:false,modal:true,width:340,height:320,iconCls:"win",layout:"fit",resizable:false});this.newaccwindow.show();this.newaccwindow.on("closeform",function(A){this.newaccwindow.close();this.dsAccCenter.load({params:{start:0,limit:15}})},this)},scope:this})],items:this.grid,bbar:new Wtf.PagingSearchToolbar({pageSize:15,searchField:this.quickPanelSearch,store:this.dsAccCenter,displayInfo:false,displayMsg:"Displaying records {0} - {1} of {2}",emptyMsg:"No results to display",plugins:this.pP=new Wtf.common.pPageSize({})})});this.add(this.accountscenter);this.dsAccCenter.on("load",this.storeLoad,this);this.dsAccCenter.on("datachanged",function(){this.quickPanelSearch.setPage(this.pP.combo.value)},this)},onRender:function(A){Wtf.AccountPanel.superclass.onRender.call(this,A);this.dsAccCenter.load({params:{start:0,limit:15}})},storeLoad:function(A,C,B){this.quickPanelSearch.StorageChanged(A)}});Wtf.NewAccountWindow=function(A){Wtf.apply(this,A);Wtf.NewAccountWindow.superclass.constructor.call(this,A)};Wtf.extend(Wtf.NewAccountWindow,Wtf.Window,{initComponent:function(){Wtf.NewAccountWindow.superclass.initComponent.call(this);this.addEvents({"closeform":true})},onRender:function(A){Wtf.NewAccountWindow.superclass.onRender.call(this,A);this.NewAcct=new Wtf.data.Record.create([{name:"name",type:"string"},{name:"id",type:"string"}]);this.storeAcct=new Wtf.data.Store({url:"jspfiles/accounting/Accounts.jsp?flag=2",reader:new Wtf.data.JsonReader({root:"data"},this.NewAcct)});this.add({border:false,layout:"border",items:[{region:"north",border:false,height:75,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/createuser.gif","Account","Create new account")},{region:"center",autoScroll:true,bodyStyle:"background:#f1f1f1;font-size:10px;",border:false,items:[{border:false,layout:"form",bodyStyle:"padding:13px 13px 13px 13px",labelWidth:122,items:[this.acctype=new Wtf.form.ComboBox({fieldLabel:"Type*",anchor:"93%",id:"CmbType"+this.id,mode:"remote",triggerAction:"all",typeAhead:true,editable:false,allowBlank:false,store:this.storeAcct,displayField:"name",valueField:"id",msgTarget:"side"}),this.accname=new Wtf.form.TextField({fieldLabel:"Name*",anchor:"93%",id:"TxtName"+this.id,allowBlank:false,msgTarget:"side"}),this.accdesc=new Wtf.form.TextField({fieldLabel:"Description",anchor:"93%",id:"TxtDesc"+this.id}),this.accno=new Wtf.form.TextField({fieldLabel:"Bank Acc. No.*",anchor:"93%",id:"TxtBacc"+this.id,validator:this.ValidateNumber,allowBlank:false,msgTarget:"side"}),this.accopenbal=new Wtf.form.TextField({fieldLabel:"Opening Balance*",anchor:"93%",id:"TxtObal"+this.id,validator:this.ValidateFloat,allowBlank:false,msgTarget:"side"})]}]}],buttonAlign:"center",buttons:[{text:"Submit",handler:function(){this.acctype.validate();this.accname.validate();this.accno.validate();this.accopenbal.validate();if(!this.acctype.isValid()||!this.acctype.isValid()||!this.acctype.isValid()||!this.acctype.isValid()){return }var H=Wtf.common.CreateJsonStart();var I;var F=new Date();var D=F.format("Y-m-d H:i:s");var C=new Number(this.accopenbal.getValue());var G=C.toFixed(2);var B=new Array("tablename","id","typeid","date","accountName","accountNo","transactions","description","balance");var E=new Array("account",0,this.acctype.value,D,this.accname.getValue(),this.accno.getValue(),"true",this.accdesc.getValue(),G);I=Wtf.common.getJsonObjectForAccounting(B,E);H+=I;H=Wtf.common.CreateJsonEnd(H);this.dstore=new Wtf.data.Store({method:"GET",url:"jspfiles/accounting/Accounts.jsp",baseParams:{flag:4,jsondata:H},reader:new Wtf.data.JsonReader({root:"data",fields:[{name:"result",type:"string"},{name:"ErrorMsg",type:"string"}]})});this.dstore.on("load",function(K,L,J){if(L[0].data["result"]=="Success"){Wtf.Msg.alert("Status","Account created successfully");this.fireEvent("closeform",this.id)}else{Wtf.Msg.alert("Transaction Failure",L[0].get("ErrorMsg"))}this.fireEvent("closeform",this.id)},this);this.dstore.on("loadexception",function(){Wtf.Msg.alert("Error","Error occurred while connecting to server")});this.dstore.load()},scope:this},{text:"Cancel",handler:function(){this.fireEvent("closeform",this.id)},scope:this}]})},ValidateNumber:function(){var A=new KWLAccValidation();if(A.NumCheck(this.el.dom.value)==-1){this.invalidText="Enter a valid account no.";return false}return true},ValidateFloat:function(){var A=new KWLAccValidation();var B=A.FloatCheck(this.getValue());if(B!=-1){return true}else{this.invalidText="Enter a valid decimal with maximum precision level of 2";return false}}});Wtf.onReady(function(){var A=bursarTabs[0];bursarTabs.remove(A);var B=new Wtf.TabPanel({id:"bursarTabPanel"+A.id,bodyStyle:"background:transparent;",deferredRender:true,activeTab:0,border:false,enableTabScroll:true,html:""});if(checktabperms(6,1)=="edit"){B.add(new Wtf.AccountPanel({id:"acccenter"+A.id,title:"Account Center",border:false,bodyBorder:false,iconCls:"payHomeIcon",bodyStyle:"background:none;",layout:"fit"}))}if(checktabperms(6,2)=="edit"){B.add(new Wtf.Panel(new Wtf.accountmap({border:false,bodyBorder:false,layout:"fit",title:"Fee-Account Map",cls:"dashpanel",iconCls:"payHomeIcon",bodyStyle:"background:none;",id:"accmap"+A.id})))}if(checktabperms(6,3)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Exam Withdrawal",iconCls:"payHomeIcon",bodyStyle:"background:none;",border:false,items:new Wtf.WtfNewCourseBursar({id:"examApp"})}))}if(checktabperms(6,4)=="edit"){B.add(new Wtf.paymentReversal({border:false,bodyBorder:false,layout:"fit",title:"Class Withdrawal",cls:"dashpanel",iconCls:"payHomeIcon",bodyStyle:"background:none;",id:"classreversePay"+A.id}))}if(checktabperms(6,5)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Course Withdrawal",iconCls:"payHomeIcon",bodyStyle:"background:none;",border:false,items:new Wtf.WtfCourseWithBursar({id:"couseWithApp"})}))}if(checktabperms(6,6)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Program Withdrawal",iconCls:"payHomeIcon",bodyStyle:"background:none;",border:false,items:new Wtf.WtfProgramWithdraw({id:"programWithdrawal",checkWith:"proWith"})}))}if(checktabperms(6,7)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Student Dismissal List",iconCls:"payHomeIcon",bodyStyle:"background:none;",border:false,items:new Wtf.WtfProgramWithdraw({id:"programWithdrawal",checkWith:"proDism"})}))}if(checktabperms(6,8)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Partial Fee Withdrawal",items:new Wtf.schRefund({id:"schWit",refundtype:"partialPayment"})}))}if(checktabperms(6,9)=="edit"){B.add(new Wtf.Panel({layout:"fit",title:"Exemption Approved Refund",items:new Wtf.schRefund({id:"exmpWit",refundtype:"exemption"})}))}if(checktabperms(6,10)=="edit"){B.add(new Wtf.BalanceSheet({border:false,bodyBorder:false,layout:"fit",title:"General Ledger",cls:"dashpanel",iconCls:"payHomeIcon",bodyStyle:"background:none;",id:"GenLedger"+A.id,set:true}))}if(checktabperms(6,11)=="edit"){B.add(new Wtf.CustomerBalance({id:"CustBalance"+A.id,title:"Customer Balance",custtype:"c",border:false,bodyBorder:false,iconCls:"payHomeIcon",bodyStyle:"background:none;",layout:"fit",set:false}))}if(checktabperms(6,12)=="edit"){B.add(new Wtf.CustomerBalance({id:"OpenInv"+A.id,title:"Open Invoices",custtype:"c",border:false,bodyBorder:false,iconCls:"payHomeIcon",bodyStyle:"background:none;",layout:"fit",set:true}))}A.add(B);A.doLayout()})