//发票综合统计
Ext.namespace('Shipping');
Shipping.MsChInvDetailView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChInvDetailView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChInvDetailView, 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.bsnosql = getUrlParam('bsno');
if (this.bsnosql == undefined || this.bsnosql == '') {
this.bsnosql = "111";
}
this.formname = 'MsChInvDetailView';
this.storeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'FEEDOID', type: 'string' },
{ name: 'FEEID', type: 'string' },
{ name: 'BILLNO', type: 'string' },
{ name: 'BSNO', type: 'string' },
{ name: 'PARENTID', type: 'string' },
{ name: 'BSSTATUSREF', type: 'string' },
{ name: 'BLISSUESTATUS', type: 'string' },
{ name: 'ACCDATE', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'OPTYPE', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'CUSTOMNO', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'FEEOBJNAME', type: 'string' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'INPUTBY', type: 'string' },
{ name: 'SALE', type: 'string' },
{ name: 'OP', type: 'string' },
{ name: 'CNTRTOTAL', type: 'string' },
{ name: 'DOC', type: 'string' },
{ name: 'BSSOURCE', type: 'string' },
{ name: 'BSSOURCEDETAIL', type: 'string' },
{ name: 'FEENAME', type: 'string' },
{ name: 'FEETYPEREF', type: 'string' },
{ name: 'CURRENCY', type: 'string' },
{ name: 'ORIGCURRENCY', type: 'string' },
{ name: 'ENTERP', type: 'string' },
{ name: 'AMOUNT', type: 'number' },
{ name: 'DOAMOUNT', type: 'number' },
{ name: 'ORIGAMOUNT', type: 'number' },
{ name: 'EXCHANGERATE', type: 'number' },
{ name: 'ORIGEXCHANGERATE', type: 'number' },
{ name: 'APPEXCHANGERATE', type: 'number' },
{ name: 'INVOICENO', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'INPUTMODE', type: 'string' },
{ name: 'COMPANYNAME', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_invoice_HangXin/GetBillList',
reader: {
id: 'BSNO,FEEDOID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义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: 'CUSTNO',
header: '委托编号',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '申请金额',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'ORIGCURRENCY',
header: '原始币别',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGEXCHANGERATE',
header: '原始汇率',
width: 80
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '折算汇率',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGAMOUNT',
header: '原始金额',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名航次',
width: 150,
renderer: function (value, p, record) {
return record.data.VESSEL + '/' + record.data.VOYNO;
}
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 120
}, {
sortable: false,
dataIndex: 'INPUTMODE',
header: '录入方式',
width: 60
}
];
this.gridListDr = new Ext.grid.GridPanel({
store: this.storeListDr,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.initgirdcolumsdr
});
this.gridListDr.addListener('sortchange', function (ct, column, direction, eOpts) {
this.bslistdrsortfield = column.dataIndex;
this.bslistdrsortdire = direction;
}, this);
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelBodyChFee = new Ext.Panel({
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridListDr]
});
Ext.apply(this, {
items: [this.panelTop, this.panelBodyChFee]
});
this.storeListDr.on('beforeload', function (store) {
var sql = " BILLNO in (select billno from ch_fee_invoice where INVOICENO='" + this.bsnosql + "')";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = " BILLNO in (select billno from ch_fee_invoice where INVOICENO='" + this.bsnosql + "')";
this.sqlcontext = sql;
this.storeListDr.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " i.INVOICEMAKETIME>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " i.INVOICEMAKETIME<='" + expDate_Max + " 23:59:59'");
var CUSTNAME = form.findField('CUSTNAME').getValue();
sql = sql + getAndConSql(sql, CUSTNAME, "i.CUSTOMERNAME='" + CUSTNAME + "'");
var Currency = form.findField('Currency').getValue();
sql = sql + getAndConSql(sql, Currency, "i.CURRENCY='" + Currency + "'");
var InvNoTo = form.findField('InvNoTo').getValue();
if (InvNoTo == '' || InvNoTo == null || InvNoTo == NaN) {
var invoiceNo = form.findField('InvNo').getValue();
sql = sql + getAndConSql(sql, invoiceNo, "i.INVOICENO like '%" + invoiceNo + "%'");
} else {
var invoiceNo = form.findField('InvNo').getValue();
sql = sql + getAndConSql(sql, invoiceNo, " (i.INVOICENO>='" + invoiceNo + "' and i.INVOICENO<='" + InvNoTo + "' ) ");
}
var ISDELETE = form.findField('ISDELETE').getValue();
if (ISDELETE == "1") {
sql = sql + getAndConSql(sql, ISDELETE, "i.ISDELETE=1");
} else if (ISDELETE == "2") {
sql = sql + getAndConSql(sql, ISDELETE, " (i.ISDELETE IS NULL or i.ISDELETE=0)");
}
return sql;
},
// saveQuerySetting: function () {
// var form = this.formSearch.getForm();
// var fieldvalue = form.getValues();
// Ext.Ajax.request({
// waitMsg: '正在保存数据...',
// url: '/MvcShipping/MsBaseInfo/SaveUserQuerySetting',
// scope: this,
// params: {
// formname: this.formname,
// isvisible: true,
// issavevalue: true,
// querydetail: Ext.JSON.encode(fieldvalue)
// }
// });
// },
// LoadQueryData: function () {
// Ext.Ajax.request({
// waitMsg: '正在查询主表数据...',
// url: '/MvcShipping/MsBaseInfo/GetUserQuerySetting',
// params: {
// formname: this.formname
// },
// callback: function (options, success, response) {
// if (success) {
// var result = Ext.JSON.decode(response.responseText);
// if (!result.success) {
// Ext.Msg.show({
// title: '提示',
// msg: result.Message,
// icon: Ext.MessageBox.ERROR,
// buttons: Ext.Msg.OK
// });
// return;
// }
// data = result.data;
// this.formSearch.getForm().reset();
// this.formSearch.getForm().setValues(Ext.JSON.decode(data.FIELDVALUES));
// } else {
// Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
// }
// },
// scope: this
// });
// }, // end LoadDate
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
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] = "MsRptOpProfitIndex";
return ret;
},
onSaveGridClick: function (button, event) {
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
this.girdcolumsdr = DsTruck.SaveGridPanel(USERID, this.formname + 'dr', this.gridListDr.columns, this.girdcolumsdr, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelBodyInv) {
this.girdcolumsinv = DsTruck.SaveGridPanel(USERID, this.formname + 'inv', this.gridListInv.columns, this.girdcolumsinv, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelSaleSum) {
this.girdcolumssale = DsTruck.SaveGridPanel(USERID, this.formname + 'sale', this.gridListSale.columns, this.girdcolumssale, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
this.girdcolumscust = DsTruck.SaveGridPanel(USERID, this.formname + 'cust', this.gridListCust.columns, this.girdcolumscust, 1, true);
}
},
oninitGridClick: function (button, event) {
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
this.gridListDr.reconfigure(this.storeListDr, this.initgirdcolumsdr);
this.girdcolumsdr = DsTruck.SaveGridPanel(USERID, this.formname + 'dr', this.gridListDr.columns, this.initgirdcolumsdr, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelBodyInv) {
this.gridListInv.reconfigure(this.storeListInv, this.initgirdcolumsinv);
this.girdcolumsinv = DsTruck.SaveGridPanel(USERID, this.formname + 'inv', this.gridListInv.columns, this.initgirdcolumsinv, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelSaleSum) {
this.gridListSale.reconfigure(this.storeSaleList, this.initgirdcolumssale);
this.girdcolumssale = DsTruck.SaveGridPanel(USERID, this.formname + 'sale', this.gridListSale.columns, this.initgirdcolumssale, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
this.gridListCust.reconfigure(this.storeCustList, this.initgirdcolumscust);
this.girdcolumscust = DsTruck.SaveGridPanel(USERID, this.formname + 'cust', this.gridListCust.columns, this.initgirdcolumscust, 1, true);
}
},
onExportClick: function (button, event) {
_this = this;
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
GridExportExcelPage(this.gridListDr);
} else if (this.tabpanel.getActiveTab() == this.panelBodyInv) {
GridExportExcelPage(this.gridListInv);
} else if (this.tabpanel.getActiveTab() == this.panelSaleSum) {
GridExportExcelPage(this.gridListSale);
} else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
GridExportExcelPage(this.gridListCust);
}
// _this = this;
// Ext.Msg.wait('正在组织数据, 请稍侯..');
// Ext.Ajax.request({
// waitMsg: '正在组织数据...',
// url: '/MvcShipping/MsRptNoTotal/GetSqlStr',
// scope: this,
// params: {
// condition: _this.sqlcontext
// },
// callback: function (options, success, response) {
// if (success) {
// Ext.MessageBox.hide();
// var jsonresult = Ext.JSON.decode(response.responseText);
// if (jsonresult.Success) {
// var sql = jsonresult.Data;
// if (sql != "") {
// var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
// var openType = "_blank";
// var openUrl = "../../Reports/RptExport.aspx?handle=MsRptNoTotalIndex&formname=" + this.formname + "&condition1=" + sql;
// window.open(openUrl, openType, openSet);
// }
// } else {
// Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// }
// } else {
// Ext.Msg.show({ title: '请重试',
// msg: '服务器响应出错',
// icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
// });
// }
// }
// });
},
Print: function () {
var sql = this.getCondition();
_this = this;
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
if (this.storeListDr.getCount() == 0) {
return;
}
var sortstr = ' F.CUSTOMERNAME,B.OPDATE';
if (this.bslistdrsortfield != '' && this.bslistdrsortdire != '') {
sortstr = this.bslistdrsortfield + ' ' + this.bslistdrsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptChInvTotal/BsListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: Drsql,
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 = 'MSRPTCHINVTOTALLISTDR';
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: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else if (this.tabpanel.getActiveTab() == this.panelBodyInv) {
if (this.storeListInv.getCount() == 0) {
return;
}
var sortstr = ' i.INVOICEMAKETIME DESC ';
if (this.bslistinvsortfield != '' && this.bslistinvsortdire != '') {
sortstr = this.bslistinvsortfield + ' ' + this.bslistinvsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptChInvTotal/InvListData',
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 = 'MSRPTCHINVTOTALINVLIST';
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: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else if (this.tabpanel.activeTab == this.panelSaleSum) {
if (this.storeSaleList.getCount() == 0) {
return;
}
var sortstr = ' B.SALE';
if (this.salesumsortfield != '' && this.salesumsortdire != '') {
sortstr = this.salesumsortfield + ' ' + this.salesumsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptInvTotal/SaleListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
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 = 'MSRPTINVTOTALSALE';
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: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else if (this.tabpanel.activeTab == this.panelCustSum) {
if (this.storeCustList.getCount() == 0) {
return;
}
var sortstr = ' F.CUSTOMERNAME';
if (this.custsumsortfield != '' && this.custsumsortdire != '') {
sortstr = this.custsumsortfield + ' ' + this.custsumsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptInvTotal/CustListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
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 = 'MSRPTINVTOTALCUST';
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: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
}
});