/**
* 应收对账单
*/
Ext.define('saas.view.sale.b2b.RecDataList', {
extend: 'saas.view.core.base.BasePanel',
xtype: 'sale-b2b-recdatalist',
viewName: 'sale-b2b-recdatalist',
// dataUrl: 'http://10.1.80.35:8560/api/sale/saledown/list',
dataUrl: '/api/sale/b2b/apCheck/customer',
initComponent: function() {
var me = this;
Ext.apply(this, {
searchField: [{
name:'ar_customer',
xtype: 'textfield',
emptyText: '请输入客户名称'
}, {
name:'ar_date',
xtype: 'condatefield',
fieldLabel: '日期',
columnWidth: 0.5,
value:2
}],
toolButtons:[{
ignore: true,
style:'text-align: center;',
xtype:'displayfield',
value:'对账详情'
}],
gridConfig: {
features : [Ext.create('Ext.grid.feature.Grouping',{
collapsible:false,
showSummaryRow: false,
groupHeaderTpl: '客户名称 : {name} (共:{rows.length}条)'
})],
listeners:{
boxready:function(){
this.store.group('custName', 'ASC');
}
},
idField: null,
codeField: null,
statusCodeField: null,
dataUrl: me.dataUrl,
caller: null,
rootProperty: 'data.content',
totalProperty: 'data.totalElement',
actionColumn: [],
selModel: {
type: 'cellmodel'
},
hiddenTools: true,
data: [],
columns : [{
text:'apId',
dataIndex:'apId',
hidden:true
},{
text: '客户名称',
dataIndex: 'custName',
hidden:true
}, {
text: 'UU',
dataIndex: 'custUU',
hidden:true
},{
text: '币别',
dataIndex: 'currency',
}, {
text: '本期应收',
xtype:'numbercolumn',
dataIndex: 'thisPeriodAmount',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '本期发货',
xtype:'numbercolumn',
dataIndex: 'thisPeriodSendQty',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '本期未对账',
xtype:'numbercolumn',
dataIndex: 'thisPeriodTodoAmount',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '本期已对账',
xtype:'numbercolumn',
dataIndex: 'thisPeriodDoneAmount',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '本期已收',
xtype:'numbercolumn',
dataIndex: 'thisPeriodReceipt',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '应收总额',
xtype:'numbercolumn',
dataIndex: 'totalAmount',
renderer: function (v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 2, false);
}
}, {
text: '操作',
dataIndex: 'op',
ignore: true,
renderer: function(v,m,r) {
return '明细';
},
listeners: {
click: function(tableView, td, row, col, e, record, tr) {
var idValue = record.get('apId'),
id = 'sale-b2b-recformpanel-formpanel-' + idValue;
var ar_date = tableView.ownerCt.ownerCt.down('[name=ar_date]');
saas.util.BaseUtil.openTab('sale-b2b-recformpanel-formpanel', "应收对账单", id, {
currency:record.get('currency'),
customerUU:record.get('custUU'),
suuorname:record.get('custName'),
fromDate:new Date(ar_date.value.from).getTime(),
endDate:new Date(ar_date.value.to).getTime()
});
}
}
}]
}
});
me.callParent(arguments);
},
/**
* 处理部分字段值
*/
getConditionValue: function (field, value) {
var me = this,
xtypes = field.getXTypes().split('/'),
conditionValue;
if (me.isContainsAny(xtypes, ['datefield'])) {
conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
} else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
var from = value.from,
to = value.to;
conditionValue = from + ',' + to;
} else if (me.isContainsAny(xtypes, ['condatefield'])) {
var from = new Date(value.from).getTime(),
to = new Date(value.to).getTime();
conditionValue = {
from: from,
to: to
};
} else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
conditionValue = value;
} else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
conditionValue = value;
} else if (me.isContainsAny(xtypes, ['multicombo'])) {
conditionValue = value.map ? value.map(function (v) {
return v.value;
}).join(',') : '';
} else {
conditionValue = value;
}
return conditionValue;
},
getExtraParams: function(store, op, condition) {
var ar_customer = this.down('[name=ar_customer]');
var searchFilter = {}
for(var i = 0; i < condition.length; i++) {
var con = condition[i];
if(con.type == 'date') {
searchFilter.fromDate = con.value.from;
searchFilter.endDate = con.value.to;
}
}
var obj = {
count:op.config.limit,
page:op.config.page,
searchFilter:JSON.stringify(searchFilter)
};
if(ar_customer.value&&ar_customer.value!=""){
obj.keyword = ar_customer.value
}
return obj;
}
});