You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/MsRptStlRemitIndex.js

704 lines
24 KiB
JavaScript

2 years ago
//欠费统计
Ext.namespace('Shipping');
Shipping.MsRptStlRemitIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptStlRemitIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptStlRemitIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
bslistdrsortfield: '',
bslistdrsortdire: '',
bslistcrsortfield: '',
bslistcrsortdire: '',
feelistdrsortfield: '',
feelistdrsortdire: '',
feelistcrsortfield: '',
feelistcrsortdire: '',
salesumsortfield: '',
salesumsortdire: '',
custsumsortfield: '',
custsumsortdire: '',
vesselsumsortfield: '',
vesselsumsortdire: '',
initUIComponents: function () {
//定义数据集
this.formname = 'MsRptStlRemitIndex';
this.storeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'GID', type: 'string' },
{ name: 'FEEID', type: 'string' },
{ name: 'BILLNO', type: 'string' },
{ name: 'BSNO', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'CUSTNAME', type: 'string' },
{ name: 'SALE', type: 'string' },
{ name: 'REMITTANCE', type: 'string' },
{ name: 'FEENAME', type: 'string' },
{ name: 'FEETYPEREF', type: 'string' },
{ name: 'CURRENCY', type: 'string' },
{ name: 'SETTLETIME', type: 'string' },
{ name: 'AMOUNT', type: 'number' },
{ name: 'TTLAMOUNT', type: 'number' },
{ name: 'BUYRATE', type: 'number' },
{ name: 'SELLRATE', type: 'number' },
{ name: 'SETTLRATE', type: 'number' },
{ name: 'REMITTANCEAMOUNT', type: 'number' },
{ name: 'REMARK', type: 'string' },
{ name: 'COMPANYID', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetRemitList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.PageNum,
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 170,
minValue: 0
})
//定义Grid
this.initgirdcolumsdr = [{
sortable: true,
dataIndex: 'BILLNO',
header: 'BILL',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'FEEDOID',
header: 'FEEDOID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'SETTLETIME',
header: Zi.LAN.SettlementTime,
width: 120
}, {
sortable: true,
dataIndex: 'BILLNO',
header: Zi.LAN.BillNo,
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNAME',
header: Zi.LAN.SettlementCustomers,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: Zi.LAN.DelegateNumber,
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: Zi.LAN.LadingNumber,
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.Requester,
width: 100
}, {
sortable: true,
dataIndex: 'FEENAME',
header: Zi.LAN.CostName,
width: 80
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: Zi.LAN.FeeTypeRef,
width: 40
}, {
sortable: true,
dataIndex: 'REMITTANCE',
header: Zi.LAN.Exchange,
width: 60
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: Zi.LAN.SettlementAmount,
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; }
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: Zi.LAN.Currency,
width: 80
}, {
sortable: true,
dataIndex: 'TTLAMOUNT',
header: Zi.LAN.RMBHeJiJinE,
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; }
}, {
sortable: true,
dataIndex: 'SELLRATE',
header: Zi.LAN.SellingRate,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'REMITTANCEAMOUNT',
header: Zi.LAN.ProvisionAmountOfPurchase,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 100
}, {
sortable: true,
dataIndex: 'SETTLRATE',
header: Zi.LAN.SettlementRate,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 4, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'BUYRATE',
header: Zi.LAN.BuyingRate ,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: Zi.LAN.LanhuoPeople,
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: Zi.LAN.Remark,
width: 120
}
];
this.girdcolumsdr = DsTruck.GetGridPanel(USERID, this.formname + 'dr', this.initgirdcolumsdr, 1);
this.gridListDr = new Ext.grid.GridPanel({
store: this.storeListDr,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsdr,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeListDr,
displayInfo: true,
displayMsg: Zi.LAN.FenYe,
emptyMsg: Zi.LAN.DataEmptyMsg
}), this.Pagenum]
});
this.gridListDr.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
// DsOpenEditWin("/TruckMng/MsWlPc/Edit");
}, this);
this.gridListDr.addListener('sortchange', function (ct, column, direction, eOpts) {
this.bslistdrsortfield = column.dataIndex;
this.bslistdrsortdire = direction;
}, this);
//#region formSearch
//#region formSearch枚举参照相关
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": Zi.LAN.AllFee });
this.storeAddDCType.add({ "DC": "1", "NAME": Zi.LAN.YingShouFee });
this.storeAddDCType.add({ "DC": "2", "NAME": Zi.LAN.YingFuFee });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.FeeTypeRef,
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
// labelWidth: 50,
forceSelection: true,
name: 'DC',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load();
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.LanhuoPeople,
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeREMITTANCE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeREMITTANCE.load({ params: { enumTypeId: 97045} });
this.comboxREMITTANCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.Exchange,
name: 'REMITTANCE',
flex: 1,
store: this.storeREMITTANCE,
valueField: 'EnumValueName',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.SettlementTime,
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_ETDDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.SettlementTime,
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_ETDDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxSalesCode, {
fieldLabel: Zi.LAN.DelegateNumber,
name: 'PS_MBLNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxaddDCType, this.comboxREMITTANCE
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: Zi.LAN.RememberQuery,
checked: true,
width: 120
});
_this = this;
this.SearchBtn = new Ext.Button({
text: Zi.LAN.HideQuery,
handler: function () {
if (_this.SearchBtn.text == Zi.LAN.HideQuery) {
_this.panelSearch.hide();
_this.SearchBtn.setText(Zi.LAN.ShowQuery);
} else {
_this.panelSearch.show();
_this.SearchBtn.setText(Zi.LAN.HideQuery);
}
}
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.Executequery,
iconCls: "btnrefresh",
id: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = true;
var issavevalue = false;
if (_this.SearchBtn.text == Zi.LAN.HideQuery)
isvisible = true
else
isvisible = false;
if (this.CheckSaveQuery.checked)
issavevalue = true
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
scope: this
}, {
text: Zi.LAN.ExportExcel,
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{
text: Zi.LAN.Print,
iconCls: 'btnprint',
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', this.SearchBtn, {
xtype: 'button',
width: 90,
text: Zi.LAN.ClearCondition,
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, this.CheckSaveQuery, '-', {
text: Zi.LAN.SavelistStyle,
id: "btntest",
menu: [
{ text: Zi.LAN.SaveGrid,
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: Zi.LAN.RefreshGrid,
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 48,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.gridListDr]
});
this.storeListDr.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.sqlcontext = sql;
this.storeListDr.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: Zi.LAN.NowSelect ,
scope: this
});
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
var data = this.formSearch.getForm().getValues(false, false, false);
var sql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, " (r.CUSTNO like '%" + mblNo + "%') ");
var etdDate_Min = form.findField('PS_ETDDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, etdDate_Min, " s.SETTLETIME>='" + etdDate_Min + "'");
var etdDate_Max = form.findField('PS_ETDDATEEND').getRawValue();
sql = sql + getAndConSql(sql, etdDate_Max, " s.SETTLETIME<='" + etdDate_Max + " 23:59:59'");
var SALE = form.findField('PS_SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "r.SALE='" + SALE + "'");
var DC = form.findField('DC').getValue();
sql = sql + getAndConSql(sql, DC, "r.FEETYPE=" + DC);
var REMITTANCE = form.findField('REMITTANCE').getValue();
sql = sql + getAndConSql(sql, REMITTANCE, "r.REMITTANCE='" + REMITTANCE+"'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.SelectConditionValError);
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord.data.BSNO;
ret[4] = "MsRptNoTotalIndex";
return ret;
},
onSaveGridClick: function (button, event) {
this.girdcolumsdr = DsTruck.SaveGridPanel(USERID, this.formname + 'dr', this.gridListDr.columns, this.girdcolumsdr, 1, true);
},
oninitGridClick: function (button, event) {
this.gridListDr.reconfigure(this.storeListDr, this.initgirdcolumsdr);
this.girdcolumsdr = DsTruck.SaveGridPanel(USERID, this.formname + 'dr', this.gridListDr.columns, this.initgirdcolumsdr, 1, true);
},
onExportClick: function (button, event) {
_this = this;
GridExportExcelPage(this.gridListDr);
},
Print: function () {
var sql = this.getCondition();
_this = this;
if (this.storeListDr.getCount() == 0) {
return;
}
var sortstr = '';
if (this.bslistdrsortfield != '' && this.bslistdrsortdire != '') {
sortstr = this.bslistdrsortfield + ' ' + this.bslistdrsortdire;
}
Ext.Msg.wait(Zi.LAN.HandlingDataAndWait);
Ext.Ajax.request({
waitMsg: Zi.LAN.HandlingData,
url: '/Account/Chfee_settlement/GetRemitList',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: sql,
printstr: 'true',
sortstr: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.Data;
var printType = 'MsRptStlRemitIndex';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.Retry,
msg: Zi.LAN.ServerResponseError,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
});