123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- /**
- * 预收-应收明细确认
- */
- Ext.define('erp.view.core.button.ConfirmYSYS',{
- extend: 'Ext.Button',
- alias: 'widget.erpConfirmYSYSButton',
- //iconCls: 'x-button-icon-submit',
- cls: 'x-btn-gray',
- id:'confirmysys',
- text: $I18N.common.button.erpConfirmYSYSButton,
- style: {
- marginLeft: '10px'
- },
- width: 140,
- initComponent : function(){
- this.callParent(arguments);
- },
- listeners: {
- click: function(m){
- var grid = Ext.getCmp('batchDealGridPanel'), record = grid.getSelectionModel().getLastSelected();
- if(record != null){
- Ext.getCmp('confirmysys').turn(record);
- } else {
- showMessage('提示', '请选择需要确认的明细!');
- return;
- }
- }
- },
- turn: function(record){
- var win = new Ext.window.Window({
- id : 'win',
- height: "100%",
- width: "80%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [{
- xtype:'form',
- layout:'column',
- anchor : '100% 10%',
- frame:true,
- defaults:{
- margin: '5 15 0 5',
- xtype:'textfield',
- columnWidth:0.5
- },
- items:[{
- fieldLabel:'客户编号',
- value:record.data.cm_custcode,
- readOnly: true,
- fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
- id:'cucode'
- },{
- fieldLabel:'客户名称' ,
- value:record.data.cu_name,
- fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
- readOnly: true
- },{
- fieldLabel:'币别',
- value:record.data.cm_currency,
- fieldStyle:'background:#f0f0f0;border: 0px solid #8B8970;color:blue;',
- readOnly: true,
- id:'currency'
- },{
- fieldLabel:'冲账金额',
- xtype:'separnumberfield',
- value:record.data.cm_prepaybalance,
- readOnly: false,
- id:'cm_prepaybalance'
- },{
- fieldLabel:'VMID',
- value:record.data.cm_id,
- readOnly: true,
- id:'cm_id'
- }]
- },{
- xtype : 'grid',
- anchor: '100% 45%',
- columnLines : true,
- id : 'grid1',
- plugins: [Ext.create('erp.view.core.grid.HeaderFilter', {
- remoteFilter: true
- }),Ext.create('Ext.grid.plugin.CellEditing', {
- clicksToEdit: 1,
- })],
- selModel: Ext.create('Ext.selection.CheckboxModel',{
- checkOnly : true,
- ignoreRightMouseSelection : false,
- getEditor: function(){
- return null;
- }
- }),
- columns : [ {
- text : '预收单号',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_CODE',
- width: 100,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '日期',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_DATE',
- width: 120,
- filter: {
- xtype : 'datefield'
- },
- renderer: function(val) {return Ext.Date.format(new Date(val), 'Y-m-d');}
- }, {
- text : '冲账币别',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_CURRENCY',
- width: 70,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '预收挂账金额',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_JSAMOUNT',
- width: 100,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '已结算金额',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_HAVEBALANCE',
- width: 80,
- filter: {
- xtype : 'textfield'
- }
- },{
- text : '类型',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_KIND',
- width: 120,
- filter: {
- xtype : 'textfield'
- }
- },{
- text : '本次结算金额',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_THISAMOUNT',
- width: 100,
- filter: {
- xtype : 'textfield'
- },
- xtype:'numbercolumn',
- editable:true,
- editor:{
- xtype:'numberfield',
- format:'0',
- hideTrigger: true
- }
- }, {
- text : '销售单号',
- cls : 'x-grid-header-1',
- dataIndex: 'PR_ORDERCODE',
- width: 200,
- filter: {
- xtype : 'textfield'
- }
- }],
- store : new Ext.data.Store({
- fields : [ 'PR_CODE', 'PR_DATE', 'PR_JSAMOUNT',
- 'PR_HAVEBALANCE', 'PR_THISAMOUNT','PR_KIND',
- 'PR_ID','PR_CUSTCODE','PR_CURRENCY', 'PR_ORDERCODE' ],
- proxy : {
- type : 'ajax',
- url : basePath + 'fa/ars/getPreRec.action',
- reader : {
- type : 'json',
- root : 'data'
- }
- },
- autoLoad : false
- })
- },{
- xtype : 'grid',
- anchor: '100% 45%',
- columnLines : true,
- id : 'grid2',
- plugins: [Ext.create('erp.view.core.grid.HeaderFilter', {
- remoteFilter: true
- }),Ext.create('Ext.grid.plugin.CellEditing', {
- clicksToEdit: 1,
- })],
- selModel: Ext.create('Ext.selection.CheckboxModel',{
- checkOnly : true,
- ignoreRightMouseSelection : false,
- getEditor: function(){
- return null;
- }
- }),
- columns : [ {
- text : '发票编号',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_CODE',
- width: 100,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '日期',
- xtype:'datecolumn',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_DATE',
- width: 120,
- filter: {
- xtype : 'datefield'
- },
- renderer: function(val) {return Ext.Date.format(new Date(val), 'Y-m-d');}
- }, {
- text : '发票金额',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_ARAMOUNT',
- width: 80,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '已收金额',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_PAYAMOUNT',
- width: 80,
- filter: {
- xtype : 'textfield'
- }
- }, {
- text : '类型',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_CLASS',
- width: 100,
- filter: {
- xtype : 'textfield'
- }
- },{
- text : '本次结算金额',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_THISAMOUNT',
- width: 100,
- disable:true,
- filter: {
- xtype : 'textfield'
- },
- xtype:'numbercolumn',
- editable:true,
- editor:{
- xtype:'numberfield',
- format:'0',
- hideTrigger: true
- }
- }, {
- text : '销售单号',
- cls : 'x-grid-header-1',
- dataIndex: 'AB_ORDERCODE',
- width: 370,
- filter: {
- xtype : 'textfield'
- }
- }],
- store : new Ext.data.Store({
- fields : [ 'AB_CODE', 'AB_DATE', 'AB_ARAMOUNT',
- 'AB_PAYAMOUNT', 'AB_ORDERCODE','AB_CLASS',
- 'AB_ID','AB_VENDCODE','AB_CURRENCY', 'AB_THISAMOUNT'],
- proxy : {
- type : 'ajax',
- url : basePath + 'fa/ars/getARBill.action',
- reader : {
- type : 'json',
- root : 'data'
- }
- },
- autoLoad : false
- })
- }],
- buttons : [{
- name: 'confirm',
- text : $I18N.common.button.erpConfirmButton,
- iconCls: 'x-button-icon-confirm',
- cls: 'x-btn-gray',
- listeners: {
- buffer: 500,
- click: function(btn) {
- var grid1 = Ext.getCmp('grid1'), grid2 = Ext.getCmp('grid2');
- var items1 = grid1.selModel.getSelection(),
- items2 = grid2.selModel.getSelection();
- var data1 = Ext.Array.map(items1, function(item){
- return {pr_id: item.get('PR_ID'), pr_thisamount: item.get('PR_THISAMOUNT')};
- }), data2 = Ext.Array.map(items2, function(item){
- return {ab_id: item.get('AB_ID'), ab_thisamount: item.get('AB_THISAMOUNT')};
- });
-
- if(data1.length > 0 || data2.length > 0) {
- Ext.Ajax.request({
- url : basePath + 'fa/confirmPreRecARBill.action',
- params: {
- cmid: Ext.getCmp("cm_id").value,
- thisamount: Ext.getCmp("cm_prepaybalance").value,
- data1: Ext.JSON.encode(data1).toString(),
- data2: Ext.JSON.encode(data2).toString()
- },
- method : 'post',
- timeout: 6000000,
- callback : function(options,success,response){
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- var str = localJson.exceptionInfo;
- showError(str);return;
- }
- if(localJson.success){
- if(localJson.log){
- showMessage("提示", localJson.log);
- }
- Ext.getCmp('win').close();
- }
- }
- });
- } else {
- showError("请勾选需要的明细!");
- }
- }
- }
- }, {
- text : $I18N.common.button.erpCloseButton,
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- handler : function(){
- Ext.getCmp('win').close();
- }
- }]
- });
- win.show();
- win.down('#grid1').getStore().load({
- params: {
- custcode: record.get('cm_custcode'),
- currency: record.get('cm_currency')
- }
- });
- win.down('#grid2').getStore().load({
- params: {
- custcode: record.get('cm_custcode'),
- currency: record.get('cm_currency')
- }
- });
- }
- });
|