GLDetail2.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.GLDetail2', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views: ['core.trigger.DbfindTrigger', 'fa.gla.GLDetail', 'fa.gla.LedgerDetail', 'core.form.MonthDateField', 'core.trigger.CateTreeDbfindTrigger',
  7. 'core.form.ConMonthDateField', 'core.form.ConDateField', 'core.form.YearDateField', 'core.trigger.MultiDbfindTrigger'],
  8. init:function(){
  9. var me = this;
  10. this.control({
  11. 'button[id=query]': {
  12. afterrender: function(btn) {
  13. setTimeout(function(){
  14. var y = getUrlParam('y'),
  15. c = getUrlParam('c'),
  16. cr = getUrlParam('cr'),
  17. at = getUrlParam('at'),
  18. ac = getUrlParam('ac'),
  19. an = getUrlParam('an'),
  20. un = getUrlParam('un');
  21. me.showFilterPanel(btn, y, c, cr, at, ac, an, un);
  22. me.getCateSetting();
  23. if(y && y != 'undefined') {
  24. var fl = Ext.getCmp('query-filter'),
  25. con = me.getCondition(fl);
  26. con.querytype = 'current';
  27. me.query(con);
  28. }
  29. }, 200);
  30. },
  31. click: function(btn) {
  32. me.showFilterPanel(btn);
  33. }
  34. },
  35. 'button[id=prev]': {
  36. click: function(btn) {
  37. var fl = Ext.getCmp('query-filter'),
  38. con = me.getCondition(fl);
  39. con.querytype = 'prev';
  40. me.query(con);
  41. }
  42. },
  43. 'button[id=next]': {
  44. click: function(btn) {
  45. var fl = Ext.getCmp('query-filter'),
  46. con = me.getCondition(fl);
  47. con.querytype = 'next';
  48. me.query(con);
  49. }
  50. },
  51. 'ledgerdetail': {
  52. itemclick: function(selModel, record) {
  53. me.loadVoucher(record);
  54. }
  55. },
  56. 'button[name=export]': {
  57. click: function() {
  58. var grid = Ext.getCmp('ledger');
  59. me.BaseUtil.exportGrid(grid, '明细账');
  60. }
  61. },
  62. '#ak_asscode': {
  63. change: function(f) {
  64. if(!Ext.isEmpty(f.value)) {
  65. var ch = f.up('window').down('#chkall');
  66. if(!ch.value) {
  67. ch.setValue(true);
  68. }
  69. }
  70. }
  71. }
  72. });
  73. },
  74. getCateSetting : function() {
  75. var me = this;
  76. Ext.Ajax.request({
  77. url : basePath + 'common/getFieldData.action',
  78. params: {
  79. caller: 'Setting',
  80. field: 'se_value',
  81. condition: 'se_what=\'CateTreeSearch\''
  82. },
  83. method : 'post',
  84. async : false,
  85. callback : function(opt, s, res){
  86. var r = new Ext.decode(res.responseText);
  87. if(r.exceptionInfo){
  88. showError(r.exceptionInfo);
  89. } else if(r.success && r.data == 'true' ){
  90. me.CateTreeSearch = true;
  91. }
  92. }
  93. });
  94. },
  95. showFilterPanel: function(btn, ym, caCode, curr, at, ac, an, un) {
  96. var filter = Ext.getCmp(btn.getId() + '-filter');
  97. if(!filter) {
  98. filter = this.createFilterPanel(btn);
  99. }
  100. filter.show();
  101. if(ym && ym != 'undefined') {
  102. filter.down('#sl_yearmonth').setValue(ym);
  103. filter.hide();
  104. }
  105. if(caCode && caCode != 'undefined') {
  106. filter.down('#ca_code').setValue(caCode);
  107. this.catecode = caCode;//当前科目
  108. }
  109. if(curr && curr != 'undefined') {
  110. filter.down('#sl_currency').setValue(curr);
  111. }
  112. if(at && at != 'undefined') {
  113. filter.down('#ak_name').setValue(at);
  114. filter.down('#ak_name').asskind = {
  115. ak_name: at
  116. };
  117. filter.down('#ak_name').autoDbfind('form', caller, 'ak_name', 'ak_name like \'%' + at + '%\'');
  118. }
  119. if(ac && ac != 'undefined') {
  120. filter.down('#ak_asscode').setValue(ac);
  121. filter.down('#chkall').setValue(true);
  122. }
  123. if(an && an != 'undefined') {
  124. filter.down('#ak_assname').setValue(an);
  125. }
  126. if(un && un != 'undefined') {
  127. filter.down('#chkhaveun').setValue(un);
  128. }
  129. },
  130. hideFilterPanel: function(btn) {
  131. var filter = Ext.getCmp(btn.getId() + '-filter');
  132. if(filter) {
  133. filter.hide();
  134. }
  135. },
  136. query: function(cond) {
  137. var me = this,
  138. grid = Ext.getCmp('ledger');
  139. grid.setLoading(true);
  140. Ext.Ajax.request({
  141. url: basePath + 'fa/ars/getGLDetail2.action',
  142. params: {
  143. condition: Ext.encode(cond)
  144. },
  145. callback: function(opt, s, r) {
  146. var res = Ext.decode(r.responseText);
  147. if(grid && res.data && res.column) {
  148. Ext.each(res.column,function(colu, index){
  149. grid.headerCt.insert(grid.columns.length, new Ext.grid.column.Column({
  150. dataIndex: 'catecode_'+colu.ca_code,
  151. cls: 'x-grid-header-1',
  152. sortable: false,
  153. text: colu.ca_name,
  154. width: 120,
  155. xtype: 'numbercolumn',
  156. format: '0,000.000',
  157. align: 'right'
  158. }));
  159. });
  160. grid.getView().refresh();
  161. var chkoth = cond.chkoth,/*强制显示对方科目*/
  162. chkcatelist = cond.chkcatelist,/*按明细科目列表显示*/
  163. sl_doubledebit = grid.down('gridcolumn[dataIndex=sl_doubledebit]'),
  164. cacode = grid.down('gridcolumn[dataIndex=ca_code]'),
  165. caname = grid.down('gridcolumn[dataIndex=ca_name]'),
  166. sl_othercate = grid.down('gridcolumn[dataIndex=sl_othercate]');
  167. grid.store.loadData(res.data);
  168. if(res.data.length > 0) {
  169. if(res.data[0].ca_code) {
  170. cond.catecode = me.catecode = res.data[0].ca_code;
  171. cond.catename = res.data[0].ca_name;
  172. }
  173. cond.asstype = res.data[0].asl_asstype;
  174. cond.asscode = res.data[0].asl_asscode;
  175. cond.assname = res.data[0].asl_assname;
  176. Ext.getCmp('ak_name').asskind = {
  177. ak_name: cond.asstype
  178. };
  179. Ext.getCmp('ak_name').setValue(cond.asstype);
  180. Ext.getCmp('ak_asscode').setValue(cond.asscode);
  181. Ext.getCmp('ak_assname').setValue(cond.assname);
  182. } else {
  183. cond.catecode = me.catecode;
  184. cond.catename = '<font color=red>(无数据)</font>';
  185. cond.asstype = null;
  186. cond.asscode = null;
  187. cond.assname = null;
  188. }
  189. me._updateInfo(cond);
  190. if(chkoth) {
  191. if(sl_othercate && sl_othercate.hidden)
  192. sl_othercate.show();
  193. } else {
  194. if(sl_othercate && !sl_othercate.hidden)
  195. sl_othercate.hide();
  196. }
  197. if(chkcatelist) {
  198. if(cacode && cacode.hidden) {
  199. cacode.show();
  200. caname.show();
  201. }
  202. } else {
  203. if(cacode && !cacode.hidden) {
  204. cacode.hide();
  205. caname.hide();
  206. }
  207. }
  208. if(cond.sl_currency != '0') {//显示原币
  209. if(!sl_doubledebit) {
  210. grid.reconfigure(grid.store, grid.doubleColumns);
  211. }
  212. } else {//只显示本币
  213. if(sl_doubledebit) {
  214. grid.reconfigure(grid.store, grid.defaultColumns);
  215. }
  216. }
  217. }
  218. grid.setLoading(false);
  219. }
  220. });
  221. },
  222. getCondition: function(pl) {
  223. var r = new Object(),v;
  224. Ext.each(pl.items.items, function(item){
  225. if(item.getValue !== undefined) {
  226. v = item.getValue();
  227. if(!Ext.isEmpty(v)) {
  228. r[item.id] = v;
  229. }
  230. }
  231. });
  232. if(this.catecode) {
  233. r.catecode = this.catecode;
  234. }
  235. return r;
  236. },
  237. _updateInfo: function(r) {
  238. var tb = Ext.getCmp('gl_info_ym');
  239. if(tb)
  240. tb.updateInfo(r);
  241. tb = Ext.getCmp('gl_info_c');
  242. if(tb)
  243. tb.updateInfo(r);
  244. tb = Ext.getCmp('gl_info_ass');
  245. if(tb)
  246. tb.updateInfo(r);
  247. },
  248. loadVoucher: function(record) {
  249. var me = this, vc = record.get('sl_vocode');
  250. Ext.Ajax.request({
  251. url : basePath + 'common/getFieldData.action',
  252. params: {
  253. caller: 'Voucher',
  254. field: 'vo_id',
  255. condition: 'vo_code=\'' + vc + '\''
  256. },
  257. method : 'post',
  258. callback : function(options,success,response){
  259. var rs = new Ext.decode(response.responseText);
  260. if(rs.exceptionInfo){
  261. showError(rs.exceptionInfo);return null;
  262. }
  263. if(rs.success){
  264. if(rs.data != null){
  265. me.BaseUtil.onAdd('Voucher_' + vc, '凭证', 'jsps/fa/ars/voucher.jsp?formCondition=vo_idIS' + rs.data +
  266. '&gridCondition=vd_voidIS' + rs.data);
  267. }
  268. }
  269. }
  270. });
  271. },
  272. createYearmonthField : function() {
  273. return Ext.create('Ext.form.FieldContainer', {
  274. margin: '10 2 2 10',
  275. columnWidth: 1,
  276. height: 70,
  277. layout: 'column',
  278. items: [{
  279. xtype: 'radio',
  280. boxLabel: '按期间查询',
  281. name: 'dateorym',
  282. columnWidth: 0.3,
  283. checked: true,
  284. listeners: {
  285. change: function(f) {
  286. var s = Ext.getCmp('sl_yearmonth');
  287. if(f.checked) {
  288. s.setDisabled(false);
  289. } else {
  290. s.setDisabled(true);
  291. }
  292. }
  293. }
  294. },{
  295. id: 'sl_yearmonth',
  296. name: 'sl_yearmonth',
  297. xtype: 'conmonthdatefield',
  298. columnWidth: .7,
  299. height: 30,
  300. getValue: function() {
  301. if(!Ext.isEmpty(this.value)) {
  302. return {begin: this.firstVal, end: this.secondVal};
  303. }
  304. return null;
  305. }
  306. },{
  307. xtype: 'radio',
  308. boxLabel: '按日期查询',
  309. name: 'dateorym',
  310. columnWidth: 0.3,
  311. listeners: {
  312. change: function(f) {
  313. var s = Ext.getCmp('sl_date');
  314. if(f.checked) {
  315. s.setDisabled(false);
  316. } else {
  317. s.setDisabled(true);
  318. }
  319. }
  320. }
  321. },{
  322. id: 'sl_date',
  323. name: 'sl_date',
  324. xtype: 'condatefield',
  325. disabled: true,
  326. columnWidth: .7,
  327. height: 30,
  328. getValue: function() {
  329. if(!Ext.isEmpty(this.value)) {
  330. return {begin: Ext.Date.toString(this.firstVal), end: Ext.Date.toString(this.secondVal)};
  331. }
  332. return null;
  333. }
  334. }],
  335. getValue: function() {
  336. var a = Ext.getCmp('sl_yearmonth'),b = Ext.getCmp('sl_date');
  337. this.id = b.disabled ? 'sl_yearmonth' : 'sl_date';
  338. return b.disabled ? a.getValue() : b.getValue();
  339. }
  340. });
  341. },
  342. createCateField : function() {
  343. var me = this, t, t1;
  344. if (me.CateTreeSearch) {
  345. t = Ext.create('erp.view.core.trigger.CateTreeDbfindTrigger', {
  346. name: 'vd_catecode',
  347. id: 'vd_catecode',
  348. autoDbfind: false,
  349. columnWidth: 0.4,
  350. listeners: {
  351. change: function() {
  352. me.catecode = null;
  353. },
  354. aftertrigger: function(t, d) {
  355. t.ownerCt.down('#vd_catename').setValue(d[0].raw.data.ca_name);
  356. }
  357. }
  358. });
  359. t1 = Ext.create('erp.view.core.trigger.CateTreeDbfindTrigger', {
  360. name: 'vd_catecode1',
  361. id: 'vd_catecode1',
  362. autoDbfind: false,
  363. columnWidth: 0.4,
  364. listeners: {
  365. change: function() {
  366. me.catecode = null;
  367. },
  368. aftertrigger: function(t, d) {
  369. t.ownerCt.down('#vd_catename1').setValue(d[0].raw.data.ca_name);
  370. }
  371. }
  372. });
  373. } else {
  374. t = Ext.create('erp.view.core.trigger.DbfindTrigger', {
  375. id: 'vd_catecode',
  376. name: 'vd_catecode',
  377. columnWidth: 0.4,
  378. listeners: {
  379. aftertrigger: function(t, d) {
  380. t.setValue(d.data.ca_code);
  381. t.ownerCt.down('#vd_catename').setValue(d.data.ca_name);
  382. }
  383. }
  384. });
  385. t1 = Ext.create('erp.view.core.trigger.DbfindTrigger', {
  386. id: 'vd_catecode1',
  387. name: 'vd_catecode1',
  388. columnWidth: 0.4,
  389. listeners: {
  390. aftertrigger: function(t, d) {
  391. t.setValue(d.data.ca_code);
  392. t.ownerCt.down('#vd_catename1').setValue(d.data.ca_name);
  393. }
  394. }
  395. });
  396. }
  397. return Ext.create('Ext.form.FieldContainer', {
  398. id: 'ca_code',
  399. margin: '2 2 2 10',
  400. columnWidth: 1,
  401. height: 100,
  402. layout: 'column',
  403. items: [{
  404. xtype: 'radio',
  405. boxLabel: '连续科目范围',
  406. columnWidth: 0.3,
  407. checked: true,
  408. name: 'continueornot',
  409. listeners: {
  410. change: function(f) {
  411. var s = Ext.getCmp('con_vd_catecode');
  412. if(f.checked) {
  413. s.setDisabled(false);
  414. } else {
  415. s.setDisabled(true);
  416. }
  417. }
  418. }
  419. },{
  420. labelWidth: 80,
  421. layout: 'column',
  422. columnWidth: 0.7,
  423. height: 56,
  424. xtype: 'fieldcontainer',
  425. id: 'con_vd_catecode',
  426. defaults: {
  427. fieldStyle : "background:#FFFAFA;color:#515151;"
  428. },
  429. items: [t, {
  430. xtype: 'textfield',
  431. name: 'vd_catename',
  432. id: 'vd_catename',
  433. columnWidth: 0.6,
  434. readOnly: true,
  435. fieldStyle: 'background:#f1f1f1;'
  436. },t1 ,{
  437. xtype: 'textfield',
  438. name: 'vd_catename1',
  439. id: 'vd_catename1',
  440. columnWidth: 0.6,
  441. readOnly: true,
  442. fieldStyle: 'background:#f1f1f1;'
  443. }],
  444. getValue: function() {
  445. var a = this.down('#vd_catecode').value,b = this.down('#vd_catecode1').value,
  446. x = Ext.isEmpty(a), y = Ext.isEmpty(b);
  447. if(x && y) {
  448. return null;
  449. } else if(x && !y) {
  450. a = b;
  451. } else if(!x && y){
  452. b = a;
  453. }
  454. return {begin: a, end: b};
  455. }
  456. },{
  457. xtype: 'radio',
  458. boxLabel: '非连续科目范围',
  459. columnWidth: 0.3,
  460. name: 'continueornot',
  461. listeners: {
  462. change: function(f) {
  463. var s = Ext.getCmp('un_vd_catecode');
  464. if(f.checked) {
  465. s.setDisabled(false);
  466. } else {
  467. s.setDisabled(true);
  468. }
  469. }
  470. }
  471. },{
  472. xtype: 'cateTreeDbfindTrigger',
  473. mode: 'MULTI',
  474. id: 'un_vd_catecode',
  475. name: 'un_vd_catecode',
  476. disabled: true,
  477. columnWidth: 0.7
  478. }],
  479. getValue: function() {
  480. var a = Ext.getCmp('con_vd_catecode'),b = Ext.getCmp('un_vd_catecode');
  481. var val = b.disabled ? a.getValue() : b.value;
  482. if(val) {
  483. if(!b.disabled) {
  484. var arr = val.split('#');
  485. if(me.catecode != null && !Ext.Array.contains(arr, me.catecode)) {
  486. me.catecode = null;
  487. }
  488. } else {
  489. if(me.catecode == null) {
  490. me.catecode = val.begin;
  491. }
  492. }
  493. return b.disabled ? {continuous: true,value: val} : {continuous: false, value: val};
  494. }
  495. return null;
  496. },
  497. setValue: function(v) {
  498. Ext.getCmp('vd_catecode').setValue(v);
  499. Ext.getCmp('vd_catecode1').setValue(v);
  500. }
  501. });
  502. },
  503. createCateLevelField : function() {
  504. return Ext.create('Ext.form.FieldContainer', {
  505. fieldLabel: '科目级别',
  506. labelWidth: 80,
  507. height: 23,
  508. layout: 'hbox',
  509. columnWidth: .51,
  510. id: 'ca_level',
  511. defaults: {
  512. fieldStyle : "background:#FFFAFA;color:#515151;"
  513. },
  514. items: [{
  515. xtype: 'combo',
  516. flex: 1,
  517. editable: false,
  518. name: 'ca_level1',
  519. id: 'ca_level1',
  520. displayField: 'display',
  521. valueField: 'value',
  522. queryMode: 'local',
  523. value: 1,
  524. store: Ext.create('Ext.data.Store', {
  525. fields: ['display', 'value'],
  526. data : [
  527. {"display": 1, "value": 1},
  528. {"display": 2, "value": 2},
  529. {"display": 3, "value": 3},
  530. {"display": 4, "value": 4},
  531. {"display": 5, "value": 5}
  532. ]
  533. })
  534. },{
  535. xtype: 'combo',
  536. flex: 1,
  537. name: 'ca_level2',
  538. id: 'ca_level2',
  539. editable: false,
  540. displayField: 'display',
  541. valueField: 'value',
  542. queryMode: 'local',
  543. value: 5,
  544. store: Ext.create('Ext.data.Store', {
  545. fields: ['display', 'value'],
  546. data : [
  547. {"display": 1, "value": 1},
  548. {"display": 2, "value": 2},
  549. {"display": 3, "value": 3},
  550. {"display": 4, "value": 4},
  551. {"display": 5, "value": 5}
  552. ]
  553. })
  554. }],
  555. getValue: function() {
  556. var a = this.down('#ca_level1').value,b = this.down('#ca_level2').value;
  557. return {begin: Math.min(a, b), end: Math.max(a, b)};
  558. },
  559. setValue: function() {
  560. }
  561. });
  562. },
  563. createCurrencyField : function() {
  564. var me = this;
  565. return Ext.create('Ext.form.field.ComboBox', {
  566. fieldLabel: '币别',
  567. labelWidth: 80,
  568. height: 23,
  569. layout: 'hbox',
  570. columnWidth: .51,
  571. id: 'sl_currency',
  572. queryMode: 'local',
  573. displayField: 'display',
  574. valueField: 'value',
  575. editable: false,
  576. store: Ext.create('Ext.data.Store', {
  577. fields: ['display', 'value'],
  578. data : [
  579. {"display": '本位币', "value": '0'},
  580. {"display": '所有币别', "value": '99'}
  581. ]
  582. }),
  583. value: '0',
  584. listeners: {
  585. afterrender: function(f) {
  586. me.getCurrency(f);
  587. }
  588. }
  589. });
  590. },
  591. createAssField : function() {
  592. return Ext.create('Ext.form.FieldContainer', {
  593. fieldLabel: '辅助核算',
  594. labelWidth: 80,
  595. height: 23,
  596. layout: 'hbox',
  597. columnWidth: 1,
  598. id: 'vds_asscode',
  599. defaults: {
  600. fieldStyle : "background:#FFFAFA;color:#515151;"
  601. },
  602. items: [{
  603. labelWidth: 35,
  604. xtype: 'dbfindtrigger',
  605. flex: 0.2,
  606. id: 'ak_name',
  607. name: 'ak_name',
  608. listeners: {
  609. aftertrigger: function(f, r) {
  610. if(!Ext.isEmpty(f.value)) {
  611. f.asskind = r.data;
  612. var c = Ext.getCmp('ak_asscode'),
  613. n = Ext.getCmp('ak_assname');
  614. c.name = r.data.ak_asscode;
  615. n.name = r.data.ak_assname;
  616. } else {
  617. f.asskind = null;
  618. }
  619. },
  620. change: function() {
  621. var a = Ext.getCmp('ak_asscode'),
  622. b = Ext.getCmp('ak_assname');
  623. a.setValue(null);
  624. b.setValue(null);
  625. }
  626. }
  627. },{
  628. xtype: 'dbfindtrigger',
  629. id: 'ak_asscode',
  630. flex: 0.2,
  631. listeners: {
  632. beforetrigger: function(f) {
  633. var a = Ext.getCmp('ak_name');
  634. f.dbBaseCondition = null;
  635. if(!a.asskind) {
  636. a.focus(false, 200);
  637. showError('请先选择核算项!');
  638. return false;
  639. } else if(f.name == 'akd_asscode') {
  640. f.dbBaseCondition = 'ak_name=\'' + a.value + '\'';
  641. }
  642. },
  643. aftertrigger: function(f, r) {
  644. var a = f.ownerCt.down('#ak_name'),
  645. n = Ext.getCmp('ak_assname');
  646. if(a.asskind) {
  647. f.setValue(r.data[f.name]);
  648. n.setValue(r.data[n.name]);
  649. }
  650. }
  651. }
  652. },{
  653. xtype: 'textfield',
  654. id: 'ak_assname',
  655. flex: 0.6,
  656. readOnly: true,
  657. fieldStyle: 'background:#f1f1f1;'
  658. }],
  659. getValue: function() {
  660. var a = Ext.getCmp('ak_name'),
  661. c = Ext.getCmp('ak_asscode');
  662. if(a.asskind) {
  663. return {asl_asstype: a.asskind.ak_name, asl_asscode: c.value};
  664. }
  665. return null;
  666. }
  667. });
  668. },
  669. createFilterPanel: function(btn) {
  670. var me = this;
  671. var filter = Ext.create('Ext.Window', {
  672. id: btn.getId() + '-filter',
  673. style: 'background:#f1f1f1',
  674. title: '筛选条件',
  675. width: 500,
  676. height: 500,
  677. layout: 'column',
  678. defaults: {
  679. margin: '2 2 2 10'
  680. },
  681. items: [me.createYearmonthField(), me.createCateField(), me.createCateLevelField(),
  682. me.createCurrencyField(), me.createAssField(), {
  683. xtype: 'checkbox',
  684. id: 'chkall',
  685. name: 'chkall',
  686. columnWidth: .5,
  687. boxLabel: '显示辅助核算'
  688. },{
  689. xtype: 'checkbox',
  690. id: 'chkdis',
  691. name: 'chkdis',
  692. columnWidth: .5,
  693. boxLabel: '显示禁用科目'
  694. },{
  695. xtype: 'checkbox',
  696. id: 'chkymno',
  697. name: 'chkymno',
  698. columnWidth: .5,
  699. boxLabel: '显示无发生额的期间合计'
  700. },{
  701. xtype: 'checkbox',
  702. id: 'chkhaveun',
  703. name: 'chkhaveun',
  704. columnWidth: .5,
  705. boxLabel: '包括未过账凭证'
  706. },{
  707. xtype: 'checkbox',
  708. id: 'chkno',
  709. name: 'chkno',
  710. columnWidth: .5,
  711. boxLabel: '无发生额不显示',
  712. listeners: {
  713. change: function(f){
  714. var s = Ext.getCmp('chkzeroandno');
  715. if(f.checked) {
  716. s.setDisabled(true);
  717. } else {
  718. s.setDisabled(false);
  719. }
  720. }
  721. }
  722. },{
  723. xtype: 'checkbox',
  724. id: 'chkDispLeaf',
  725. name: 'chkDispLeaf',
  726. columnWidth: .5,
  727. boxLabel: '只显示末级科目'
  728. },{
  729. xtype: 'checkbox',
  730. id: 'chkzeroandno',
  731. name: 'chkzeroandno',
  732. columnWidth: .5,
  733. boxLabel: '余额为零且无发生额不显示'
  734. },{
  735. xtype: 'checkbox',
  736. id: 'chkunused',
  737. name: 'chkunused',
  738. columnWidth: .5,
  739. boxLabel: '从未使用不显示'
  740. },{
  741. xtype: 'checkbox',
  742. id: 'chkoth',
  743. name: 'chkoth',
  744. columnWidth: .5,
  745. boxLabel: '强制显示对方科目'
  746. },{
  747. xtype: 'checkbox',
  748. id: 'chkothass',
  749. name: 'chkothass',
  750. columnWidth: .5,
  751. boxLabel: '显示对方科目核算项目'
  752. },{
  753. xtype: 'checkbox',
  754. id: 'chkothasslist',
  755. name: 'chkothasslist',
  756. columnWidth: .5,
  757. boxLabel: '按对方科目多条显示',
  758. listeners: {
  759. change: function(f){
  760. var s = Ext.getCmp('chkoth');
  761. if(f.checked) {
  762. s.setValue(true);
  763. }
  764. }
  765. }
  766. },{
  767. xtype: 'checkbox',
  768. id: 'chkcatelist',
  769. name: 'chkcatelist',
  770. columnWidth: .5,
  771. boxLabel: '按明细科目列表显示'
  772. }],
  773. buttonAlign: 'center',
  774. buttons: [{
  775. text: '确定',
  776. width: 60,
  777. cls: 'x-btn-blue',
  778. handler: function(btn) {
  779. var fl = Ext.getCmp('query-filter'),
  780. con = me.getCondition(fl);
  781. con.querytype = 'current';
  782. me.query(con);
  783. fl.hide();
  784. }
  785. },{
  786. text: '关闭',
  787. width: 60,
  788. cls: 'x-btn-blue',
  789. handler: function(btn) {
  790. var fl = btn.ownerCt.ownerCt;
  791. fl.hide();
  792. }
  793. }]
  794. });
  795. this.getCurrentMonth(filter.down('#sl_yearmonth'));
  796. return filter;
  797. },
  798. getCurrency: function(f) {
  799. Ext.Ajax.request({
  800. url : basePath + 'common/getFieldDatas.action',
  801. async: false,
  802. params: {
  803. caller: 'Currencys',
  804. field: 'cr_name',
  805. condition: 'cr_statuscode=\'CANUSE\''
  806. },
  807. method : 'post',
  808. callback : function(options,success,response){
  809. var rs = new Ext.decode(response.responseText);
  810. if(rs.exceptionInfo){
  811. showError(rs.exceptionInfo);return null;
  812. }
  813. if(rs.success && rs.data){
  814. var cr = rs.data.split('#'),c = new Array();
  815. Ext.each(cr, function(r){
  816. c.push({display: r, value: r});
  817. });
  818. f.store.add(c);
  819. }
  820. }
  821. });
  822. },
  823. getCurrentMonth: function(f) {
  824. Ext.Ajax.request({
  825. url: basePath + 'fa/getMonth.action',
  826. params: {
  827. type: 'MONTH-A'
  828. },
  829. callback: function(opt, s, r) {
  830. var rs = Ext.decode(r.responseText);
  831. if(rs.data) {
  832. f.setValue(rs.data.PD_DETNO);
  833. }
  834. }
  835. });
  836. }
  837. });