ConfirmYSYS.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. /**
  2. * 预收-应收明细确认
  3. */
  4. Ext.define('erp.view.core.button.ConfirmYSYS',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpConfirmYSYSButton',
  7. //iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. id:'confirmysys',
  10. text: $I18N.common.button.erpConfirmYSYSButton,
  11. style: {
  12. marginLeft: '10px'
  13. },
  14. width: 140,
  15. initComponent : function(){
  16. this.callParent(arguments);
  17. },
  18. listeners: {
  19. click: function(m){
  20. var grid = Ext.getCmp('batchDealGridPanel'), record = grid.getSelectionModel().getLastSelected();
  21. if(record != null){
  22. Ext.getCmp('confirmysys').turn(record);
  23. } else {
  24. showMessage('提示', '请选择需要确认的明细!');
  25. return;
  26. }
  27. }
  28. },
  29. turn: function(record){
  30. var win = new Ext.window.Window({
  31. id : 'win',
  32. height: "100%",
  33. width: "80%",
  34. maximizable : true,
  35. buttonAlign : 'center',
  36. layout : 'anchor',
  37. items: [{
  38. xtype:'form',
  39. layout:'column',
  40. anchor : '100% 10%',
  41. frame:true,
  42. defaults:{
  43. margin: '5 15 0 5',
  44. xtype:'textfield',
  45. columnWidth:0.5
  46. },
  47. items:[{
  48. fieldLabel:'客户编号',
  49. value:record.data.cm_custcode,
  50. readOnly: true,
  51. fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
  52. id:'cucode'
  53. },{
  54. fieldLabel:'客户名称' ,
  55. value:record.data.cu_name,
  56. fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
  57. readOnly: true
  58. },{
  59. fieldLabel:'币别',
  60. value:record.data.cm_currency,
  61. fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
  62. readOnly: true,
  63. id:'currency'
  64. },{
  65. fieldLabel:'冲账金额',
  66. xtype:'separnumberfield',
  67. value:record.data.cm_prepaybalance,
  68. readOnly: false,
  69. id:'cm_prepaybalance'
  70. },{
  71. fieldLabel:'VMID',
  72. value:record.data.cm_id,
  73. readOnly: true,
  74. id:'cm_id'
  75. }]
  76. },{
  77. xtype : 'grid',
  78. anchor: '100% 45%',
  79. columnLines : true,
  80. id : 'grid1',
  81. plugins: [Ext.create('erp.view.core.grid.HeaderFilter', {
  82. remoteFilter: true
  83. }),Ext.create('Ext.grid.plugin.CellEditing', {
  84. clicksToEdit: 1,
  85. })],
  86. selModel: Ext.create('Ext.selection.CheckboxModel',{
  87. checkOnly : true,
  88. ignoreRightMouseSelection : false,
  89. getEditor: function(){
  90. return null;
  91. }
  92. }),
  93. columns : [ {
  94. text : '预收单号',
  95. cls : 'x-grid-header-1',
  96. dataIndex: 'PR_CODE',
  97. width: 100,
  98. filter: {
  99. xtype : 'textfield'
  100. }
  101. }, {
  102. text : '日期',
  103. cls : 'x-grid-header-1',
  104. dataIndex: 'PR_DATE',
  105. width: 120,
  106. filter: {
  107. xtype : 'datefield'
  108. },
  109. renderer: function(val) {return Ext.Date.format(new Date(val), 'Y-m-d');}
  110. }, {
  111. text : '冲账币别',
  112. cls : 'x-grid-header-1',
  113. dataIndex: 'PR_CURRENCY',
  114. width: 70,
  115. filter: {
  116. xtype : 'textfield'
  117. }
  118. }, {
  119. text : '预收挂账金额',
  120. cls : 'x-grid-header-1',
  121. dataIndex: 'PR_JSAMOUNT',
  122. width: 100,
  123. filter: {
  124. xtype : 'textfield'
  125. }
  126. }, {
  127. text : '已结算金额',
  128. cls : 'x-grid-header-1',
  129. dataIndex: 'PR_HAVEBALANCE',
  130. width: 80,
  131. filter: {
  132. xtype : 'textfield'
  133. }
  134. },{
  135. text : '类型',
  136. cls : 'x-grid-header-1',
  137. dataIndex: 'PR_KIND',
  138. width: 120,
  139. filter: {
  140. xtype : 'textfield'
  141. }
  142. },{
  143. text : '本次结算金额',
  144. cls : 'x-grid-header-1',
  145. dataIndex: 'PR_THISAMOUNT',
  146. width: 100,
  147. filter: {
  148. xtype : 'textfield'
  149. },
  150. xtype:'numbercolumn',
  151. editable:true,
  152. editor:{
  153. xtype:'numberfield',
  154. format:'0',
  155. hideTrigger: true
  156. }
  157. }, {
  158. text : '销售单号',
  159. cls : 'x-grid-header-1',
  160. dataIndex: 'PR_ORDERCODE',
  161. width: 200,
  162. filter: {
  163. xtype : 'textfield'
  164. }
  165. }],
  166. store : new Ext.data.Store({
  167. fields : [ 'PR_CODE', 'PR_DATE', 'PR_JSAMOUNT',
  168. 'PR_HAVEBALANCE', 'PR_THISAMOUNT','PR_KIND',
  169. 'PR_ID','PR_CUSTCODE','PR_CURRENCY', 'PR_ORDERCODE' ],
  170. proxy : {
  171. type : 'ajax',
  172. url : basePath + 'fa/ars/getPreRec.action',
  173. reader : {
  174. type : 'json',
  175. root : 'data'
  176. }
  177. },
  178. autoLoad : false
  179. })
  180. },{
  181. xtype : 'grid',
  182. anchor: '100% 45%',
  183. columnLines : true,
  184. id : 'grid2',
  185. plugins: [Ext.create('erp.view.core.grid.HeaderFilter', {
  186. remoteFilter: true
  187. }),Ext.create('Ext.grid.plugin.CellEditing', {
  188. clicksToEdit: 1,
  189. })],
  190. selModel: Ext.create('Ext.selection.CheckboxModel',{
  191. checkOnly : true,
  192. ignoreRightMouseSelection : false,
  193. getEditor: function(){
  194. return null;
  195. }
  196. }),
  197. columns : [ {
  198. text : '发票编号',
  199. cls : 'x-grid-header-1',
  200. dataIndex: 'AB_CODE',
  201. width: 100,
  202. filter: {
  203. xtype : 'textfield'
  204. }
  205. }, {
  206. text : '日期',
  207. xtype:'datecolumn',
  208. cls : 'x-grid-header-1',
  209. dataIndex: 'AB_DATE',
  210. width: 120,
  211. filter: {
  212. xtype : 'datefield'
  213. },
  214. renderer: function(val) {return Ext.Date.format(new Date(val), 'Y-m-d');}
  215. }, {
  216. text : '发票金额',
  217. cls : 'x-grid-header-1',
  218. dataIndex: 'AB_ARAMOUNT',
  219. width: 80,
  220. filter: {
  221. xtype : 'textfield'
  222. }
  223. }, {
  224. text : '已收金额',
  225. cls : 'x-grid-header-1',
  226. dataIndex: 'AB_PAYAMOUNT',
  227. width: 80,
  228. filter: {
  229. xtype : 'textfield'
  230. }
  231. }, {
  232. text : '类型',
  233. cls : 'x-grid-header-1',
  234. dataIndex: 'AB_CLASS',
  235. width: 100,
  236. filter: {
  237. xtype : 'textfield'
  238. }
  239. },{
  240. text : '本次结算金额',
  241. cls : 'x-grid-header-1',
  242. dataIndex: 'AB_THISAMOUNT',
  243. width: 100,
  244. disable:true,
  245. filter: {
  246. xtype : 'textfield'
  247. },
  248. xtype:'numbercolumn',
  249. editable:true,
  250. editor:{
  251. xtype:'numberfield',
  252. format:'0',
  253. hideTrigger: true
  254. }
  255. }, {
  256. text : '销售单号',
  257. cls : 'x-grid-header-1',
  258. dataIndex: 'AB_ORDERCODE',
  259. width: 370,
  260. filter: {
  261. xtype : 'textfield'
  262. }
  263. }],
  264. store : new Ext.data.Store({
  265. fields : [ 'AB_CODE', 'AB_DATE', 'AB_ARAMOUNT',
  266. 'AB_PAYAMOUNT', 'AB_ORDERCODE','AB_CLASS',
  267. 'AB_ID','AB_VENDCODE','AB_CURRENCY', 'AB_THISAMOUNT'],
  268. proxy : {
  269. type : 'ajax',
  270. url : basePath + 'fa/ars/getARBill.action',
  271. reader : {
  272. type : 'json',
  273. root : 'data'
  274. }
  275. },
  276. autoLoad : false
  277. })
  278. }],
  279. buttons : [{
  280. name: 'confirm',
  281. text : $I18N.common.button.erpConfirmButton,
  282. iconCls: 'x-button-icon-confirm',
  283. cls: 'x-btn-gray',
  284. listeners: {
  285. buffer: 500,
  286. click: function(btn) {
  287. var grid1 = Ext.getCmp('grid1'), grid2 = Ext.getCmp('grid2');
  288. var items1 = grid1.selModel.getSelection(),
  289. items2 = grid2.selModel.getSelection();
  290. var data1 = Ext.Array.map(items1, function(item){
  291. return {pr_id: item.get('PR_ID'), pr_thisamount: item.get('PR_THISAMOUNT')};
  292. }), data2 = Ext.Array.map(items2, function(item){
  293. return {ab_id: item.get('AB_ID'), ab_thisamount: item.get('AB_THISAMOUNT')};
  294. });
  295. if(data1.length > 0 || data2.length > 0) {
  296. Ext.Ajax.request({
  297. url : basePath + 'fa/confirmPreRecARBill.action',
  298. params: {
  299. cmid: Ext.getCmp("cm_id").value,
  300. thisamount: Ext.getCmp("cm_prepaybalance").value,
  301. data1: Ext.JSON.encode(data1).toString(),
  302. data2: Ext.JSON.encode(data2).toString()
  303. },
  304. method : 'post',
  305. timeout: 6000000,
  306. callback : function(options,success,response){
  307. var localJson = new Ext.decode(response.responseText);
  308. if(localJson.exceptionInfo){
  309. var str = localJson.exceptionInfo;
  310. showError(str);return;
  311. }
  312. if(localJson.success){
  313. if(localJson.log){
  314. showMessage("提示", localJson.log);
  315. }
  316. Ext.getCmp('win').close();
  317. }
  318. }
  319. });
  320. } else {
  321. showError("请勾选需要的明细!");
  322. }
  323. }
  324. }
  325. }, {
  326. text : $I18N.common.button.erpCloseButton,
  327. iconCls: 'x-button-icon-close',
  328. cls: 'x-btn-gray',
  329. handler : function(){
  330. Ext.getCmp('win').close();
  331. }
  332. }]
  333. });
  334. win.show();
  335. win.down('#grid1').getStore().load({
  336. params: {
  337. custcode: record.get('cm_custcode'),
  338. currency: record.get('cm_currency')
  339. }
  340. });
  341. win.down('#grid2').getStore().load({
  342. params: {
  343. custcode: record.get('cm_custcode'),
  344. currency: record.get('cm_currency')
  345. }
  346. });
  347. }
  348. });