feePlease.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.fee.feePlease', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'oa.fee.feePlease','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar','core.button.Scan','core.form.FileField',
  9. 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.Upload','core.button.ResAudit',
  10. 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail','core.form.DateHourMinuteField',
  11. 'core.button.ResSubmit','core.button.TurnCLFBX','core.button.TurnFYBX','core.button.TurnYHFKSQ','core.button.VoCreate',
  12. 'core.button.TurnYWZDBX','core.button.End','core.button.ResEnd','core.button.Confirm','core.trigger.MultiDbfindTrigger',
  13. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.button.TurnBankRegister','core.form.MultiField','oa.fee.FeeBackGrid',
  14. 'erp.view.core.button.AddDetail','erp.view.core.button.DeleteDetail','erp.view.core.button.Copy','erp.view.core.button.Paste','erp.view.core.button.Up',
  15. 'erp.view.core.button.Down','erp.view.core.button.UpExcel','common.datalist.Toolbar','oa.fee.feePleaseFYBX'
  16. ],
  17. init:function(){
  18. var me = this;
  19. this.control({
  20. 'erpGridPanel2': {
  21. itemclick: function(selModel, record){
  22. if(record.data.fpd_id != 0 && record.data.fpd_id != null && record.data.fpd_id != ''){
  23. var btn = Ext.getCmp('factdays');
  24. btn && btn.setDisabled(false);
  25. }
  26. this.onGridItemClick(selModel, record);
  27. }
  28. },
  29. 'FeeBackGrid': {
  30. itemclick: this.onGridItemClick2
  31. },
  32. 'erpFormPanel' : {
  33. afterload : function(form) {
  34. this.hidecolumns(true);
  35. }
  36. },
  37. 'dbfindtrigger[name=fpd_d1]': {
  38. afterrender:function(trigger){
  39. trigger.dbKey='fp_department';
  40. trigger.mappingKey='fcs_departmentname';
  41. trigger.dbMessage='请先选择申请部门';
  42. }
  43. },
  44. 'dbfindtrigger[name=fp_pleaseman]':{
  45. aftertrigger:function(trigger,record){
  46. Ext.Ajax.request({
  47. url:basePath+'oa/fee/getFeeAccount.action',
  48. method:'POST',
  49. params:{
  50. emcode:trigger.value
  51. },
  52. async:false,
  53. callback:function(opts,success,res){
  54. var r = new Ext.decode(res.responseText);
  55. trigger.up('form').getForm().setValues(r.info);
  56. }
  57. });
  58. }
  59. },
  60. 'erpSaveButton': {
  61. click: function(btn){
  62. var form = me.getForm(btn);
  63. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  64. if(caller=='FeePlease!CLFBX'){
  65. me.BaseUtil.getRandomNumber('FeePlease!FYBX');//差旅费报销取费用报销同样的caller取编号
  66. }else{
  67. me.BaseUtil.getRandomNumber(caller);//自动添加编号
  68. }
  69. }
  70. if(caller == 'FeePlease!CZCFSQ'|| caller == 'FeePlease!FYBX'){
  71. this.getamount();
  72. }
  73. this.beforeSave();
  74. }
  75. },
  76. 'erpCloseButton': {
  77. click: function(btn){
  78. this.FormUtil.beforeClose(this);
  79. }
  80. },
  81. 'erpAddButton': {
  82. click: function(btn){
  83. if(caller=='FeePlease!FYBX'){
  84. me.FormUtil.onAdd('add' + caller, '新增费用申请', "jsps/oa/fee/feePlease.jsp?whoami=" + caller);
  85. }else{
  86. me.FormUtil.onAdd('add' + caller, '新增单据', "jsps/oa/fee/feePleaseFYBX.jsp?whoami=" + caller);
  87. }
  88. }
  89. },
  90. 'erpUpdateButton': {
  91. click: function(btn){
  92. if(caller == 'FeePlease!CZCFSQ'){
  93. this.getamount();
  94. }
  95. this.beforeUpdate();
  96. }
  97. },
  98. 'erpDeleteButton': {
  99. afterrender: function(btn){
  100. var status = Ext.getCmp('fp_statuscode');
  101. if(status && status.value != 'ENTERING'){
  102. btn.hide();
  103. }
  104. },
  105. click: function(btn){
  106. me.FormUtil.onDelete((Ext.getCmp('fp_id').value));
  107. }
  108. },
  109. 'erpAuditButton': {
  110. afterrender: function(btn){
  111. var status = Ext.getCmp('fp_statuscode');
  112. if(status && status.value != 'COMMITED'){
  113. btn.hide();
  114. }
  115. },
  116. click: function(btn){
  117. this.FormUtil.onAudit(Ext.getCmp('fp_id').value);
  118. }
  119. },
  120. 'erpResAuditButton': {
  121. afterrender: function(btn){
  122. var status = Ext.getCmp('fp_statuscode');
  123. if(status && status.value != 'AUDITED'){
  124. btn.hide();
  125. }
  126. },
  127. click: function(btn){
  128. this.FormUtil.onResAudit(Ext.getCmp('fp_id').value);
  129. }
  130. },
  131. 'erpSubmitButton': {
  132. afterrender: function(btn){
  133. var status = Ext.getCmp('fp_statuscode');
  134. if(status && status.value != 'ENTERING'){
  135. btn.hide();
  136. }
  137. },
  138. click: function(btn){
  139. this.FormUtil.onSubmit(Ext.getCmp('fp_id').value);
  140. }
  141. },
  142. 'erpResSubmitButton': {
  143. afterrender: function(btn){
  144. var status = Ext.getCmp('fp_statuscode');
  145. if(status && status.value != 'COMMITED'){
  146. btn.hide();
  147. }
  148. },
  149. click: function(btn){
  150. this.FormUtil.onResSubmit(Ext.getCmp('fp_id').value);
  151. }
  152. },
  153. 'erpPrintButton': {
  154. click:function(btn){
  155. var reportName='';
  156. var kind=Ext.getCmp('fp_kind');
  157. if(kind&&kind.value=="借款申请单"){
  158. reportName="AccountRegZW2";
  159. }else{
  160. reportName="AccountRegZW";
  161. }
  162. var condition='{FeePlease.fp_id}='+Ext.getCmp('fp_id').value+'';
  163. var id=Ext.getCmp('fp_id').value;
  164. me.FormUtil.onwindowsPrint(id,reportName,condition);
  165. }
  166. },
  167. 'erpEndButton': {
  168. afterrender: function(btn){
  169. var status = Ext.getCmp('fp_statuscode');
  170. if(status && status.value == 'FINISH'){
  171. btn.hide();
  172. }
  173. },
  174. click: function(btn){
  175. this.FormUtil.onEnd(Ext.getCmp('fp_id').value);
  176. }
  177. },
  178. 'combo[name=fp_object]': {
  179. delay: 200,
  180. change: function(m){
  181. this.hidecolumns(false);
  182. }
  183. },
  184. 'erpResEndButton': {
  185. afterrender: function(btn){
  186. var status = Ext.getCmp('fp_statuscode');
  187. if(status && status.value != 'FINISH'){
  188. btn.hide();
  189. }
  190. },
  191. click: function(btn){
  192. this.FormUtil.onResEnd(Ext.getCmp('fp_id').value);
  193. }
  194. },
  195. 'erpConfirmButton': {afterrender: function(btn){
  196. var statu = Ext.getCmp('fp_statuscode');
  197. if(statu && statu.value != 'AUDITED'){
  198. btn.hide();
  199. }
  200. },
  201. click: function(btn){
  202. me.onConfirm(Ext.getCmp('fp_id').value);
  203. }
  204. } ,
  205. 'erpVoCreateButton':{//业务招待费转费用报销
  206. beforerender:function(btn){
  207. btn.setWidth(100);
  208. btn.setText("转费用报销");
  209. },
  210. afterrender: function(btn){
  211. var status = Ext.getCmp('fp_statuscode');
  212. var turnStatus=Ext.getCmp('fp_v11');
  213. if(status && status.value != 'AUDITED'&&turnStatus||turnStatus.value!='未转费用申请'){
  214. btn.hide();
  215. }
  216. },
  217. click:function(){
  218. this.turnFYBX(me);
  219. }
  220. },
  221. //转银行登记
  222. 'erpTurnBankRegisterButton':{
  223. click:function(btn){
  224. me.turnBankRegister();
  225. },
  226. afterrender: function(btn){
  227. var status = Ext.getCmp('fp_statuscode');
  228. if(status && status.value != 'AUDITED'){
  229. btn.hide();
  230. }
  231. }
  232. },
  233. /**
  234. * 更改实际天数
  235. */
  236. '#factdays': {
  237. click: function(btn) {
  238. var record=btn.ownerCt.ownerCt.getSelectionModel().getLastSelected();
  239. me.UpdateFactdays(record);
  240. }
  241. },
  242. 'field[name=fp_v11]':{
  243. beforerender:function(field){
  244. var status = Ext.getCmp('fp_statuscode');
  245. if(status && status.value == 'AUDITED'){
  246. field.readOnly=false;
  247. }
  248. }
  249. },
  250. 'field[name=fp_n2]':{
  251. beforerender:function(field){
  252. var status = Ext.getCmp('fp_statuscode');
  253. if(status && status.value == 'AUDITED'){
  254. field.readOnly=false;
  255. }
  256. }
  257. },
  258. 'field[name=fp_sourcecode]': {
  259. afterrender:function(f){
  260. if(caller=='FeePlease!CLFBX'|| caller=='FeePlease!FYBX'||caller=='FeePlease!HKSQ'){
  261. f.setFieldStyle({
  262. 'color': 'blue'
  263. });
  264. f.focusCls = 'mail-attach';
  265. var c = Ext.Function.bind(me.openRelative, me);
  266. Ext.EventManager.on(f.inputEl, {
  267. mousedown : c,
  268. scope: f,
  269. buffer : 100
  270. });
  271. }
  272. }
  273. },
  274. 'erpTurnCLFBXButton':{
  275. afterrender: function(btn){
  276. var status = Ext.getCmp('fp_statuscode');
  277. if(status && status.value != 'AUDITED'){
  278. btn.hide();
  279. }
  280. },
  281. click: function(btn){
  282. warnMsg("确定要转入差旅费报销单吗?", function(btn){
  283. if(btn == 'yes'){
  284. me.FormUtil.getActiveTab().setLoading(true);//loading...
  285. Ext.Ajax.request({
  286. url : basePath + 'oa/feeplease/turnCLFBX.action',
  287. params: {
  288. caller: caller,
  289. id: Ext.getCmp('fp_id').value
  290. },
  291. method : 'post',
  292. callback : function(options,success,response){
  293. me.FormUtil.getActiveTab().setLoading(false);
  294. var localJson = new Ext.decode(response.responseText);
  295. if(localJson.exceptionInfo){
  296. showError(localJson.exceptionInfo);
  297. }
  298. if(localJson.success){
  299. turnSuccess(function(){
  300. var id = localJson.id;
  301. var url = "jsps/oa/fee/feePlease.jsp?whoami=FeePlease!CLFBX&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  302. me.FormUtil.onAdd('FeePlease' + id, '差旅费报销单' + id, url);
  303. });
  304. }
  305. }
  306. });
  307. }
  308. });
  309. }
  310. },
  311. 'erpTurnFYBXButton':{
  312. afterrender: function(btn){
  313. var status = Ext.getCmp('fp_statuscode');
  314. if(status && status.value != 'AUDITED'){
  315. btn.hide();
  316. }
  317. },
  318. click: function(btn){
  319. warnMsg("确定要转入费用报销单吗?", function(btn){
  320. if(btn == 'yes'){
  321. me.FormUtil.getActiveTab().setLoading(true);//loading...
  322. Ext.Ajax.request({
  323. url : basePath + 'oa/feeplease/turnFYBX.action',
  324. params: {
  325. caller: caller,
  326. id: Ext.getCmp('fp_id').value
  327. },
  328. method : 'post',
  329. callback : function(options,success,response){
  330. me.FormUtil.getActiveTab().setLoading(false);
  331. var localJson = new Ext.decode(response.responseText);
  332. if(localJson.exceptionInfo){
  333. showError(localJson.exceptionInfo);
  334. }
  335. if(localJson.success){
  336. turnSuccess(function(){
  337. var id = localJson.id;
  338. var url = "jsps/oa/fee/feePlease.jsp?whoami=FeePlease!FYBX&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  339. me.FormUtil.onAdd('FeePlease' + id, '费用报销单' + id, url);
  340. });
  341. }
  342. }
  343. });
  344. }
  345. });
  346. }
  347. },
  348. 'erpTurnYHFKSQButton':{
  349. afterrender: function(btn){
  350. var status = Ext.getCmp('fp_statuscode');
  351. if(status && status.value != 'AUDITED'){
  352. btn.hide();
  353. }
  354. },
  355. click: function(btn){
  356. warnMsg("确定要转入银行付款申请单吗?", function(btn){
  357. if(btn == 'yes'){
  358. me.FormUtil.getActiveTab().setLoading(true);//loading...
  359. Ext.Ajax.request({
  360. url : basePath + 'oa/feeplease/turnYHFKSQ.action',
  361. params: {
  362. caller: caller,
  363. id: Ext.getCmp('fp_id').value
  364. },
  365. method : 'post',
  366. callback : function(options,success,response){
  367. me.FormUtil.getActiveTab().setLoading(false);
  368. var localJson = new Ext.decode(response.responseText);
  369. if(localJson.exceptionInfo){
  370. showError(localJson.exceptionInfo);
  371. }
  372. if(localJson.success){
  373. turnSuccess(function(){
  374. var id = localJson.id;
  375. var url = "jsps/oa/fee/feePlease.jsp?whoami=FeePlease!YHFKSQ&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  376. me.FormUtil.onAdd('FeePlease' + id, '银行付款申请单' + id, url);
  377. });
  378. }
  379. }
  380. });
  381. }
  382. });
  383. }
  384. },
  385. 'erpTurnYWZDBXButton':{
  386. afterrender: function(btn){
  387. var status = Ext.getCmp('fp_statuscode');
  388. if(status && status.value != 'AUDITED'){
  389. btn.hide();
  390. }
  391. },
  392. click: function(btn){
  393. warnMsg("确定要转入业务招待费报销单吗?", function(btn){
  394. if(btn == 'yes'){
  395. me.FormUtil.getActiveTab().setLoading(true);//loading...
  396. Ext.Ajax.request({
  397. url : basePath + 'oa/feeplease/turnYWZDBX.action',
  398. params: {
  399. caller: caller,
  400. id: Ext.getCmp('fp_id').value
  401. },
  402. method : 'post',
  403. callback : function(options,success,response){
  404. me.FormUtil.getActiveTab().setLoading(false);
  405. var localJson = new Ext.decode(response.responseText);
  406. if(localJson.exceptionInfo){
  407. showError(localJson.exceptionInfo);
  408. }
  409. if(localJson.success){
  410. turnSuccess(function(){
  411. var id = localJson.id;
  412. var url = "jsps/oa/fee/feePlease.jsp?whoami=FeePlease!YWZDBX&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  413. me.FormUtil.onAdd('FeePlease' + id, '业务招待费报销单' + id, url);
  414. });
  415. }
  416. }
  417. });
  418. }
  419. });
  420. }
  421. }
  422. });
  423. },
  424. getamount: function(){
  425. var grid = Ext.getCmp('grid');
  426. var items = grid.store.data.items;
  427. var amount = 0;
  428. Ext.each(items,function(item,index){
  429. if(item.data['fpd_date1']!=null&&item.data['fpd_date1']!=""){
  430. amount= amount + Number(item.data['fpd_total']);
  431. }
  432. });
  433. Ext.getCmp('fp_pleaseamount').setValue(amount);
  434. },
  435. onGridItemClick: function(selModel, record){//grid行选择
  436. this.GridUtil.onGridItemClick(selModel, record);
  437. },
  438. getForm: function(btn){
  439. return btn.ownerCt.ownerCt;
  440. },
  441. onConfirm: function(id){
  442. var form = Ext.getCmp('form');
  443. Ext.Ajax.request({
  444. url : basePath + form.confirmUrl,
  445. params: {
  446. id: id,
  447. caller:caller
  448. },
  449. method : 'post',
  450. callback : function(options,success,response){
  451. //me.setLoading(false);
  452. var localJson = new Ext.decode(response.responseText);
  453. if(localJson.success){
  454. //audit成功后刷新页面进入可编辑的页面
  455. //auditSuccess(function(){
  456. window.location.reload();
  457. //});
  458. } else {
  459. if(localJson.exceptionInfo){
  460. var str = localJson.exceptionInfo;
  461. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  462. str = str.replace('AFTERSUCCESS', '');
  463. showMessage("提示", '确认成功');
  464. //auditSuccess(function(){
  465. window.location.reload();
  466. //});
  467. } else {
  468. showError(str);return;
  469. }
  470. }
  471. }
  472. }
  473. });
  474. },
  475. openRelative:function(e, el, obj){
  476. var f = obj.scope;
  477. var name='';
  478. var cal='';
  479. var field=''
  480. var conField=''
  481. var type=Ext.getCmp('fp_sourcekind').value;
  482. if(type=='客户拜访记录'){
  483. name='VisitRecord';
  484. cal='visitrecord';
  485. field='vr_id';
  486. conField='vr_class=\'OfficeClerk\' and vr_code';
  487. }else if(type=='原厂拜访记录'){
  488. name='VisitRecord';
  489. cal='visitrecord';
  490. field='vr_id';
  491. conField='vr_class=\'VisitRecord!Vender\' and vr_code';
  492. }else if(type=='业务招待费申请单'){
  493. name='FeePlease';
  494. cal='FeePlease';
  495. field='fp_id';
  496. conField='fp_kind=\'业务招待费申请单\' and fp_code';
  497. }else if(type=='出差申请单'){
  498. name='FeePlease';
  499. cal='FeePlease';
  500. field='fp_id';
  501. conField='fp_kind=\'出差申请单\' and fp_code';
  502. }else if(type=='资源开发记录'){
  503. name='VisitRecord';
  504. cal='visitrecord';
  505. field='vr_id';
  506. conField='vr_class=\'VisitRecord!Resource\' and vr_code';
  507. }else if(type=='借款申请单'){
  508. name='FeePlease';
  509. cal='FeePlease';
  510. field='fp_id';
  511. conField='fp_kind=\'借款申请单\' and fp_code';
  512. }
  513. else if(type=='费用申请'){
  514. name='PreFeePlease';
  515. cal='PreFeePlease';
  516. field='fp_id';
  517. conField=' fp_code';
  518. }else if(type=='资产维修'){
  519. name='Propertyrepair';
  520. cal='Propertyrepair';
  521. field='pr_id';
  522. conField=' pr_code';
  523. }else if(type=='车辆维修'){
  524. name='vehiclearchivesdetail';
  525. cal='vehiclearchivesdetail';
  526. field='vd_id';
  527. conField=' vd_code';
  528. }else if(type=='市场调研立项'){
  529. name='MarketTaskReport';
  530. cal='MarketTaskReport';
  531. field='mr_id';
  532. conField='mr_code';
  533. }
  534. if(type=='市场调研立项'||type=='客户拜访记录' || type=='原厂拜访记录' || type=='业务招待费申请单'||type=='出差申请单'||type=='资源开发记录'||type=='借款申请单'||type=='费用申请'||type=='资产维修'||type=='车辆维修') {
  535. var code = Ext.getCmp('fp_sourcecode').value;
  536. if(code.indexOf('(')>-1){//来自其他的单据
  537. this.turnOtherSob(code,field,conField,cal);
  538. }else{
  539. var url=this.getRelativeUrl(code,field,conField,cal);
  540. this.FormUtil.onAdd(name, Ext.getCmp('fp_sourcekind').value,
  541. url);
  542. }
  543. }
  544. },
  545. getRelativeUrl:function(code,field,conField,cal){
  546. var id = 0;
  547. Ext.Ajax.request({
  548. url : basePath + 'common/getFieldData.action',
  549. async: false,
  550. params: {
  551. caller: cal,
  552. field: field,
  553. condition: conField+'=\'' + code + '\''
  554. },
  555. method : 'post',
  556. callback : function(o, s, r){
  557. var rs = new Ext.decode(r.responseText);
  558. if(rs.exceptionInfo){
  559. showError(rs.exceptionInfo);return;
  560. }
  561. if(rs.success){
  562. if(rs.data != null){
  563. id = rs.data;
  564. }
  565. }
  566. }
  567. });
  568. var url='#';
  569. var type=Ext.getCmp('fp_sourcekind').value;
  570. if(type=='客户拜访记录'){
  571. url='jsps/crm/customermgr/customervisit/visitRecord.jsp?formCondition=vr_idIS'+id+'&gridCondition=vrd_vridIS'+id;
  572. }else if(type=='原厂拜访记录'){
  573. url='jsps/crm/customermgr/customervisit/visitRecord3.jsp?formCondition=vr_idIS'+id+'&gridCondition=vrd_vridIS'+id;
  574. }else if(type=='业务招待费申请单'){
  575. url='jsps/oa/fee/feePlease.jsp?whoami=FeePlease!YWZDSQ&formCondition=fp_idIS'+id+'&gridCondition=fpd_fpidIS'+id;
  576. }else if(type=='出差申请单'){
  577. url='jsps/oa/fee/feePlease.jsp?whoami=FeePlease!CCSQ&formCondition=fp_idIS'+id+'&gridCondition=fpd_fpidIS'+id;
  578. }else if(type=='资源开发记录'){
  579. url='jsps/crm/customermgr/customervisit/visitRecord4.jsp?formCondition=vr_idIS'+id+'&gridCondition=vrd_vridIS'+id;
  580. }else if(type=='借款申请单'){
  581. url='jsps/oa/fee/feePlease.jsp?whoami=FeePlease!JKSQ&formCondition=fp_idIS'+id+'&gridCondition=fpd_fpidIS'+id;
  582. }else if(type=='费用申请'){
  583. url='jsps/oa/fee/preFeePlease.jsp?formCondition=fp_idIS'+id+'&gridCondition=fpd_fpidIS'+id;
  584. }else if(type=='资产维修'){
  585. url='jsps/oa/storage/propertyrepair.jsp?formCondition=pr_idIS'+id+'&gridCondition=prd_pridIS'+id;
  586. }else if(type=='车辆维修'){
  587. url='jsps/oa/vehicle/vehiclemaintain.jsp?formCondition=vd_idIS'+id;
  588. }else if(type=='市场调研立项'){
  589. var c=Ext.getCmp('fp_v14')?Ext.getCmp('fp_v14').value:'MarketTaskReport#0';//调研模板caller#任务id
  590. var a=c.split('#');
  591. url='jsps/crm/marketmgr/marketresearch/researchReport.jsp?'+
  592. 'whoami='+a[0]+'&cond=idIS'
  593. +a[1]+'&formCondition=mr_idIS'+id+'&gridCondition=mrd_mridIS'+id;
  594. }
  595. return url;
  596. },
  597. turnOtherSob:function(code,field,conField,cal){
  598. var newSob=null;//code形如:2015040052(资料中心)
  599. Ext.Ajax.request({//去资料中心寻找括号内的帐套
  600. url : basePath + 'common/getFieldData.action',
  601. async: false,
  602. params: {
  603. caller: 'DataCenter.MASTER',
  604. field: 'ma_user',
  605. condition: 'ma_function=\'' + code.split('(')[1].slice(0,-1) + '\''
  606. },
  607. method : 'post',
  608. callback : function(o, s, r){
  609. var rs = new Ext.decode(r.responseText);
  610. if(rs.exceptionInfo){
  611. showError(rs.exceptionInfo);return;
  612. }
  613. if(rs.success){
  614. if(rs.data != null){
  615. newSob = rs.data;
  616. }
  617. }
  618. }
  619. });
  620. if(newSob==null){
  621. showError('没有找到要转的帐套!');
  622. return;
  623. }else{
  624. var url=this.getRelativeUrl(code.split('(')[0],field,conField,newSob+'.'+cal);
  625. var currentMaster = parent.sob?parent.sob:parent.parent.sob;
  626. url=parent.location.href.split('jsps')[0]+url;//防止因为父页面url的改变,而找不到页面
  627. Ext.Ajax.request({
  628. url: basePath + 'common/changeMaster.action',
  629. params: {
  630. to: newSob
  631. },
  632. callback: function(opt, s, r) {
  633. if (s) {
  634. var win = parent.Ext.create('Ext.Window', {
  635. width: '100%',
  636. height: '100%',
  637. draggable: false,
  638. closable: false,
  639. modal: true,
  640. id:'modalwindow',
  641. historyMaster:currentMaster,
  642. title: '创建到帐套' + code.split('(')[1].slice(0,-1) + '的临时会话',
  643. html : '<iframe src="' + url + '" height="100%" width="100%" frameborder="0" style="border-width: 0px;padding: 0px;" scrolling="auto"></iframe>',
  644. buttonAlign: 'center',
  645. buttons: [{
  646. text: $I18N.common.button.erpCloseButton,
  647. cls: 'x-btn-blue',
  648. id: 'close',
  649. handler: function(b) {
  650. Ext.Ajax.request({
  651. url: basePath + 'common/changeMaster.action',
  652. params: {
  653. to: currentMaster
  654. },
  655. callback: function(opt, s, r) {
  656. if (s) {
  657. b.up('window').close();
  658. } else {
  659. alert('切换到原帐套失败!');
  660. }
  661. }
  662. });
  663. }
  664. }]
  665. });
  666. win.show();
  667. } else {
  668. alert('无法创建到帐套' + code.split('(')[1].slice(0,-1) + '的临时会话!');
  669. }
  670. }
  671. });
  672. }
  673. },
  674. turnFYBX:function(me){
  675. warnMsg("确定要转入费用报销单吗?", function(btn){
  676. if(btn == 'yes'){
  677. me.FormUtil.getActiveTab().setLoading(true);//loading...
  678. Ext.Ajax.request({
  679. url : basePath + 'oa/feeplease/turnFYBX2.action',
  680. params: {
  681. caller: caller,
  682. id: Ext.getCmp('fp_id').value
  683. },
  684. method : 'post',
  685. callback : function(options,success,response){
  686. me.FormUtil.getActiveTab().setLoading(false);
  687. var localJson = new Ext.decode(response.responseText);
  688. if(localJson.exceptionInfo){
  689. showError(localJson.exceptionInfo);
  690. }
  691. if(localJson.success){
  692. //turnSuccess(function(){
  693. showMessage("提示", '转入成功');
  694. window.location.reload();
  695. var id = localJson.id;
  696. var url = "jsps/oa/fee/feePlease.jsp?whoami=FeePlease!FYBX&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  697. me.FormUtil.onAdd('FeePlease' + id, '费用报销单' + id, url);
  698. //});
  699. }
  700. }
  701. });
  702. }
  703. });
  704. },
  705. turnBankRegister:function(){
  706. var catecode = Ext.getCmp('fp_v11').value;
  707. if(catecode == null || catecode == ''){
  708. showMessage("警告", '请填写需要转银行登记的付款方信息!');
  709. return;
  710. }
  711. var thispayamount=Ext.getCmp('fp_n2').value;
  712. /*if(Ext.getCmp('fp_n2').value==0){
  713. showMessage("警告", '本次转金额不能为0!');
  714. return;
  715. }*/
  716. /*if(Ext.getCmp('fp_n2').value<0){
  717. showMessage("警告", '本次转金额不能小于0!');
  718. return;
  719. }*/
  720. var back=0;//还款金额
  721. if(Ext.getCmp('fp_n6')&&Ext.getCmp('fp_n6').value!=null&&Ext.getCmp('fp_n6').value!=''){
  722. back=Ext.getCmp('fp_n6').value;
  723. }
  724. if(((thispayamount+Ext.getCmp('fp_n1').value).toFixed(3)-0)>((Ext.getCmp('fp_pleaseamount').value-back).toFixed(3)-0)){
  725. showMessage("警告", '本次转金额超出剩余金额!');
  726. return;
  727. }
  728. var main = parent.Ext.getCmp("content-panel");
  729. main.getActiveTab().setLoading(true);//loading...
  730. Ext.Ajax.request({
  731. url : basePath + 'oa/fee/turnBankRegister.action',
  732. params: {
  733. id:Ext.getCmp("fp_id").value,
  734. paymentcode:Ext.getCmp('fp_v11').value,
  735. payment:Ext.getCmp('fp_v10').value,
  736. thispayamount:Ext.getCmp('fp_n2').value,
  737. caller:caller
  738. },
  739. method : 'post',
  740. callback : function(options,success,response){
  741. main.getActiveTab().setLoading(false);
  742. var localJson = new Ext.decode(response.responseText);
  743. if(localJson.exceptionInfo){
  744. showError(localJson.exceptionInfo);
  745. return "";
  746. }
  747. if(localJson.success){
  748. if(localJson.log){
  749. showMessage("提示", localJson.log);
  750. window.location.reload();
  751. }
  752. }
  753. }
  754. });
  755. },
  756. UpdateFactdays:function(record){
  757. var win = this.factdayswindow;
  758. if (!win) {
  759. win = this.getFactdaysWindow();
  760. }
  761. win.show();
  762. },
  763. getFactdaysWindow : function() {
  764. var me = this;
  765. return Ext.create('Ext.window.Window',{
  766. width: 330,
  767. height: 180,
  768. closeAction: 'hide',
  769. cls: 'custom-blue',
  770. title:'<h1>更改实际天数</h1>',
  771. layout: {
  772. type: 'vbox'
  773. },
  774. items:[{
  775. margin: '5 0 0 5',
  776. xtype:'numberfield',
  777. fieldLabel:'实际天数',
  778. name:'factdays',
  779. id:'factdays'
  780. },{
  781. margin: '5 0 0 5',
  782. xtype: 'fieldcontainer',
  783. fieldLabel: '全部更新',
  784. combineErrors: false,
  785. defaults: {
  786. hideLabel: true
  787. },
  788. layout: {
  789. type: 'column',
  790. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  791. },
  792. items: [{
  793. xtype:'checkbox',
  794. columnidth: 0.4,
  795. fieldLabel:'全部更新',
  796. name:'allupdate',
  797. id:'allupdate'
  798. },{
  799. xtype:'displayfield',
  800. fieldStyle:'color:red',
  801. columnidth: 0.6,
  802. value:' *更改当前所有明细'
  803. }]
  804. }],
  805. buttonAlign:'center',
  806. buttons:[{
  807. xtype:'button',
  808. text:'保存',
  809. width:60,
  810. iconCls: 'x-button-icon-save',
  811. handler:function(btn){
  812. var w = btn.up('window');
  813. me.saveFactdays(w);
  814. w.hide();
  815. }
  816. },{
  817. xtype:'button',
  818. columnWidth:0.1,
  819. text:'关闭',
  820. width:60,
  821. iconCls: 'x-button-icon-close',
  822. margin:'0 0 0 10',
  823. handler:function(btn){
  824. btn.up('window').hide();
  825. }
  826. }]
  827. });
  828. },
  829. saveFactdays: function(w) {
  830. var factdays = w.down('field[name=factdays]').getValue(),
  831. grid = Ext.getCmp('grid'),
  832. record = grid.getSelectionModel().getLastSelected();
  833. if(!factdays) {
  834. showError('请先设置预计天数.') ;
  835. return;
  836. } else {
  837. var allupdate = w.down('field[name=allupdate]').getValue();
  838. var dd = {
  839. fpd_id : record.data.fpd_id,
  840. fpd_fpid : record.data.fpd_fpid,
  841. factdays : factdays? factdays : record.data.fpd_n5,
  842. allupdate : allupdate ? 1 : 0
  843. };
  844. Ext.Ajax.request({
  845. url : basePath +'oa/fee/updatefactdays.action',
  846. params : {
  847. data: unescape(Ext.JSON.encode(dd))
  848. },
  849. method : 'post',
  850. callback : function(opt, s, res){
  851. var r = new Ext.decode(res.responseText);
  852. if(r.success){
  853. grid.GridUtil.loadNewStore(grid,{
  854. caller:'FeePlease!CCSQ',
  855. condition: 'fpd_fpid=' + record.data.fpd_fpid
  856. });
  857. } else if(r.exceptionInfo){
  858. showError(r.exceptionInfo);
  859. } else{
  860. saveFailure();
  861. }
  862. }
  863. });
  864. }
  865. },
  866. beforeSave: function(){
  867. var me = this;
  868. var form = Ext.getCmp('form');
  869. if(! me.FormUtil.checkForm()){
  870. return;
  871. }
  872. if(caller=='FeePlease!FYBX'&&Ext.getCmp('fp_object')){
  873. var obj = Ext.getCmp("fp_object").value;
  874. if(obj == '供应商' && (Ext.getCmp('fp_vendcode').value==null||Ext.getCmp('fp_vendcode').value=='')){
  875. showError('供应商不能为空!');//对象为供应商时,供应商编号不能为空
  876. return;
  877. }
  878. if(obj == '客户' && (Ext.getCmp('fp_cucode').value==null||Ext.getCmp('fp_cucode').value=='')){
  879. showError('供应商不能为空!');//对象为客户时,客户编号不能为空
  880. return;
  881. }
  882. }
  883. if(Ext.getCmp(form.keyField).value == null || Ext.getCmp(form.keyField).value == ''){
  884. me.FormUtil.getSeqId(form);
  885. }
  886. var detail = Ext.getCmp('grid');
  887. var detail2 = Ext.getCmp('FeeBackGrid');
  888. Ext.each(detail.store.data.items, function(item){
  889. if(item.data.vd_id == null || item.data.vd_id == 0){
  890. item.data.vd_id = -item.index;
  891. }
  892. });
  893. var param1 = me.GridUtil.getGridStore(detail);
  894. var param2 = new Array();
  895. if(detail2) {
  896. param2 = me.GridUtil.getGridStore(detail2);
  897. }
  898. param1 = param1 == null ? [] : "[" + param1.toString().replace(/\\/g,"%") + "]";
  899. param2 = param2 == null ? [] : "[" + param2.toString().replace(/\\/g,"%") + "]";
  900. if(form.getForm().isValid()){
  901. Ext.each(form.items.items, function(item){
  902. if(item.xtype == 'numberfield'){
  903. if(item.value == null || item.value == ''){
  904. item.setValue(0);
  905. }
  906. }
  907. });
  908. var r = form.getValues();
  909. me.save(r, param1, param2);
  910. }else{
  911. me.FormUtil.checkForm();
  912. }
  913. },
  914. save: function(){
  915. var form=Ext.getCmp('form');
  916. var params = new Object();
  917. var r = arguments[0];
  918. Ext.each(Ext.Object.getKeys(r), function(k){//去掉页面非表单定义字段
  919. if(contains(k, 'ext-', true)){
  920. delete r[k];
  921. }
  922. });
  923. //去除ignore字段
  924. var keys = Ext.Object.getKeys(r), f;
  925. var reg = /[!@#$%^&*()'":,\/?]/;
  926. Ext.each(keys, function(k){
  927. f = form.down('#' + k);
  928. if(f && f.logic == 'ignore') {
  929. delete r[k];
  930. }
  931. //codeField值强制大写,自动过滤特殊字符
  932. if(k == form.codeField && !Ext.isEmpty(r[k])) {
  933. r[k] = r[k].trim().toUpperCase().replace(reg, '');
  934. }
  935. });
  936. params.formStore = unescape(Ext.JSON.encode(r).replace(/\\/g,"%"));
  937. params.param = unescape(arguments[1].toString().replace(/\\/g,"%"));
  938. params.param2 = unescape(arguments[2].toString().replace(/\\/g,"%"));
  939. params.caller=caller;
  940. /*for(var i=2; i<arguments.length; i++) { //兼容多参数
  941. params['param' + i] = unescape(arguments[i].toString().replace(/\\/g,"%"));
  942. }*/
  943. var me = this;
  944. var form = Ext.getCmp('form');
  945. //me.getActiveTab().setLoading(true);//loading...
  946. Ext.Ajax.request({
  947. url : basePath + form.saveUrl,
  948. params : params,
  949. method : 'post',
  950. callback : function(options,success,response){
  951. var localJson = new Ext.decode(response.responseText);
  952. if(localJson.success){
  953. saveSuccess(function(){
  954. //add成功后刷新页面进入可编辑的页面
  955. var value = r[form.keyField];
  956. var formCondition = form.keyField + "IS" + value ;
  957. if(me.contains(window.location.href, '?', true)){
  958. window.location.href = window.location.href + '&formCondition=' +
  959. formCondition+'&gridCondition=fpd_fpidIS'+value;
  960. } else {
  961. window.location.href = window.location.href + '?formCondition=' +
  962. formCondition+'&gridCondition=fpd_fpidIS'+value;
  963. }
  964. });
  965. } else if(localJson.exceptionInfo){
  966. var str = localJson.exceptionInfo;
  967. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  968. str = str.replace('AFTERSUCCESS', '');
  969. saveSuccess(function(){
  970. //add成功后刷新页面进入可编辑的页面
  971. var value = r[form.keyField];
  972. var formCondition = form.keyField + "IS" + value ;
  973. if(me.contains(window.location.href, '?', true)){
  974. window.location.href = window.location.href + '&formCondition=' +
  975. formCondition+'&gridCondition=fpd_fpidIS'+value;
  976. } else {
  977. window.location.href = window.location.href + '?formCondition=' +
  978. formCondition+'&gridCondition=fpd_fpidIS'+value;
  979. }
  980. });
  981. showError(str);
  982. } else {
  983. showError(str);
  984. return;
  985. }
  986. } else{
  987. saveFailure();//@i18n/i18n.js
  988. }
  989. }
  990. });
  991. },
  992. beforeUpdate: function(){
  993. var me = this;
  994. var form = Ext.getCmp('form');
  995. if(! me.FormUtil.checkForm()){
  996. return;
  997. }
  998. if(caller=='FeePlease!FYBX'&&Ext.getCmp('fp_object')){
  999. var obj = Ext.getCmp("fp_object").value;
  1000. if(obj == '供应商' && (Ext.getCmp('fp_vendcode').value==null||Ext.getCmp('fp_vendcode').value=='')){
  1001. showError('供应商不能为空!');//对象为供应商时,供应商编号不能为空
  1002. return;
  1003. }
  1004. if(obj == '客户' && (Ext.getCmp('fp_cucode').value==null||Ext.getCmp('fp_cucode').value=='')){
  1005. showError('客户不能为空!');//对象为客户时,客户编号不能为空
  1006. return;
  1007. }
  1008. }
  1009. if(Ext.getCmp(form.keyField).value == null || Ext.getCmp(form.keyField).value == ''){
  1010. me.FormUtil.getSeqId(form);
  1011. }
  1012. var detail = Ext.getCmp('grid');
  1013. var detail2 = Ext.getCmp('FeeBackGrid');
  1014. Ext.each(detail.store.data.items, function(item){
  1015. if(item.data.vd_id == null || item.data.vd_id == 0){
  1016. item.data.vd_id = -item.index;
  1017. }
  1018. });
  1019. var param1 = me.GridUtil.getGridStore(detail);
  1020. var param2 = new Array();
  1021. if(detail2) {
  1022. param2 = me.GridUtil.getGridStore(detail2);
  1023. }
  1024. param1 = param1 == null ? [] : "[" + param1.toString().replace(/\\/g,"%") + "]";
  1025. param2 = param2 == null ? [] : "[" + param2.toString().replace(/\\/g,"%") + "]";
  1026. if(form.getForm().isValid()){
  1027. Ext.each(form.items.items, function(item){
  1028. if(item.xtype == 'numberfield'){
  1029. if(item.value == null || item.value == ''){
  1030. item.setValue(0);
  1031. }
  1032. }
  1033. });
  1034. var r = form.getValues();
  1035. me.update(r, param1, param2);
  1036. }else{
  1037. me.FormUtil.checkForm();
  1038. }
  1039. },
  1040. update:function(){
  1041. var form=Ext.getCmp('form');
  1042. var params = new Object();
  1043. var r = arguments[0];
  1044. Ext.each(Ext.Object.getKeys(r), function(k){//去掉页面非表单定义字段
  1045. if(contains(k, 'ext-', true)){
  1046. delete r[k];
  1047. }
  1048. });
  1049. //去除ignore字段
  1050. var keys = Ext.Object.getKeys(r), f;
  1051. var reg = /[!@#$%^&*()'":,\/?]/;
  1052. Ext.each(keys, function(k){
  1053. f = form.down('#' + k);
  1054. if(f && f.logic == 'ignore') {
  1055. delete r[k];
  1056. }
  1057. //codeField值强制大写,自动过滤特殊字符
  1058. if(k == form.codeField && !Ext.isEmpty(r[k])) {
  1059. r[k] = r[k].trim().toUpperCase().replace(reg, '');
  1060. }
  1061. });
  1062. params.formStore = unescape(Ext.JSON.encode(r).replace(/\\/g,"%"));
  1063. params.param = unescape(arguments[1].toString().replace(/\\/g,"%"));
  1064. params.param2 = unescape(arguments[2].toString().replace(/\\/g,"%"));
  1065. params.caller=caller;
  1066. var me = this;
  1067. var form = Ext.getCmp('form');
  1068. //me.getActiveTab().setLoading(true);//loading...
  1069. Ext.Ajax.request({
  1070. url : basePath + form.updateUrl,
  1071. params : params,
  1072. method : 'post',
  1073. callback : function(options,success,response){
  1074. //me.getActiveTab().setLoading(false);
  1075. var localJson = new Ext.decode(response.responseText);
  1076. if(localJson.success){
  1077. saveSuccess(function(){
  1078. //add成功后刷新页面进入可编辑的页面
  1079. var value = r[form.keyField];
  1080. var formCondition = form.keyField + "IS" + value ;
  1081. if(me.contains(window.location.href, '?', true)){
  1082. window.location.href = window.location.href + '&formCondition=' +
  1083. formCondition;
  1084. } else {
  1085. window.location.href = window.location.href + '?formCondition=' +
  1086. formCondition;
  1087. }
  1088. });
  1089. } else if(localJson.exceptionInfo){
  1090. var str = localJson.exceptionInfo;
  1091. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  1092. str = str.replace('AFTERSUCCESS', '');
  1093. saveSuccess(function(){
  1094. //add成功后刷新页面进入可编辑的页面
  1095. var value = r[form.keyField];
  1096. var formCondition = form.keyField + "IS" + value ;
  1097. if(me.contains(window.location.href, '?', true)){
  1098. window.location.href = window.location.href + '&formCondition=' +
  1099. formCondition;
  1100. } else {
  1101. window.location.href = window.location.href + '?formCondition=' +
  1102. formCondition;
  1103. }
  1104. });
  1105. showError(str);
  1106. } else {
  1107. showError(str);
  1108. return;
  1109. }
  1110. } else{
  1111. saveFailure();//@i18n/i18n.js
  1112. }
  1113. }
  1114. });
  1115. },
  1116. contains: function(string,substr,isIgnoreCase){
  1117. if(isIgnoreCase){
  1118. string=string.toLowerCase();
  1119. substr=substr.toLowerCase();
  1120. }
  1121. var startChar=substr.substring(0,1);
  1122. var strLen=substr.length;
  1123. for(var j=0;j<string.length-strLen+1;j++){
  1124. if(string.charAt(j)==startChar){//如果匹配起始字符,开始查找
  1125. if(string.substring(j,j+strLen)==substr){//如果从j开始的字符与str匹配,那ok
  1126. return true;
  1127. }
  1128. }
  1129. }
  1130. return false;
  1131. },
  1132. onGridItemClick: function(selModel, record){//grid行选择
  1133. this.GridUtil.onGridItemClick(selModel, record);
  1134. },
  1135. onGridItemClick2: function(selModel,record){
  1136. this.onGridItemClick(selModel,record,'FeeBackGrid');
  1137. },
  1138. hidecolumns: function(isNoClean){
  1139. if(caller=='FeePlease!CLFBX'){
  1140. var source = Ext.getCmp('fp_sourcekind').value;
  1141. var form = Ext.getCmp('fp_sourcekind').ownerCt;
  1142. if(source == '原厂拜访记录'){
  1143. if(Ext.getCmp('fp_cucode')){
  1144. form.down('#fp_cucode').hide();
  1145. }
  1146. if(Ext.getCmp('fp_cuname')){
  1147. form.down('#fp_cuname').hide();
  1148. }
  1149. }else if(source == '客户拜访记录'){
  1150. if(Ext.getCmp('fp_vendcode')){
  1151. form.down('#fp_vendcode').hide();
  1152. }
  1153. if(Ext.getCmp('fp_vendname')){
  1154. form.down('#fp_vendname').hide();
  1155. }
  1156. }else{
  1157. if(Ext.getCmp('fp_vendcode')){
  1158. form.down('#fp_vendcode').hide();
  1159. }
  1160. if(Ext.getCmp('fp_vendname')){
  1161. form.down('#fp_vendname').hide();
  1162. }
  1163. if(Ext.getCmp('fp_cucode')){
  1164. form.down('#fp_cucode').hide();
  1165. }
  1166. if(Ext.getCmp('fp_cuname')){
  1167. form.down('#fp_cuname').hide();
  1168. }
  1169. }
  1170. }
  1171. if(caller=='FeePlease!FYBX'&&Ext.getCmp('fp_object')){
  1172. var obj=Ext.getCmp('fp_object').value;
  1173. var form = Ext.getCmp('fp_object').ownerCt;
  1174. if(obj=='供应商'){
  1175. form.down('#fp_cucode').hide();
  1176. form.down('#fp_cuname').hide();
  1177. form.down('#fp_vendcode').show();
  1178. form.down('#fp_vendname').show();
  1179. if(!isNoClean){
  1180. form.down('#fp_cucode').setValue('');
  1181. form.down('#fp_cuname').setValue('');
  1182. form.down('#fp_vendcode').setValue('');
  1183. form.down('#fp_vendname').setValue('');
  1184. }
  1185. }else if(obj=='客户'){
  1186. form.down('#fp_cucode').show();
  1187. form.down('#fp_cuname').show();
  1188. form.down('#fp_vendcode').hide();
  1189. form.down('#fp_vendname').hide();
  1190. if(!isNoClean){
  1191. form.down('#fp_cucode').setValue('');
  1192. form.down('#fp_cuname').setValue('');
  1193. form.down('#fp_vendcode').setValue('');
  1194. form.down('#fp_vendname').setValue('');
  1195. }
  1196. }else{
  1197. form.down('#fp_cucode').hide();
  1198. form.down('#fp_cuname').hide();
  1199. form.down('#fp_vendcode').hide();
  1200. form.down('#fp_vendname').hide();
  1201. if(!isNoClean){
  1202. form.down('#fp_cucode').setValue('');
  1203. form.down('#fp_cuname').setValue('');
  1204. form.down('#fp_vendcode').setValue('');
  1205. form.down('#fp_vendname').setValue('');
  1206. }
  1207. }
  1208. }
  1209. }
  1210. });