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/MvcShipping/Viewsjs/MsRptChInvTotal/MsBsChInvView.js

696 lines
26 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//发票综合统计
Ext.namespace('Shipping');
Shipping.MsBsInvView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsBsInvView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsBsInvView, 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 = 'MsBsInvView';
this.storeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'INVOICENO', type: 'string' },
{ name: 'INVOICEMAKETIME', type: 'string' },
{ name: 'OPLB', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'BSTYPE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'INPUTBY', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'BSSTATUS', type: 'string' },
{ name: 'FEESTATUSREF', type: 'string' },
{ name: 'SALE', type: 'string' },
{ name: 'OP', type: 'string' },
{ name: 'DOC', type: 'string' },
{ name: 'CUSTSERVICE', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'CUSTOMNO', type: 'string' },
{ name: 'ACCDATE', type: 'string' },
{ name: 'CARRIER', type: 'string' },
{ name: 'BSSOURCE', type: 'string' },
{ name: 'LANE', type: 'string' },
{ name: 'FORWARDER', type: 'string' },
{ name: 'CNTRTOTAL', type: 'string' },
{ name: 'TRADETYPE', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'OPDATE', type: 'string' },
{ name: 'CUSTOMDATE', type: 'string' },
{ name: 'ENTERP', type: 'string' },
{ name: 'NETWEIGHT', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'CUSTNAME', type: 'string' },
{ name: 'TTLRMB', type: 'number' },
{ name: 'INVRMB', type: 'number' },
{ name: 'TTLUSD', type: 'number' },
{ name: 'INVUSD', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptChInvTotal/BsListData2',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolumsdr = [{
sortable: true,
dataIndex: 'INVOICENO',
header: '发票号',
width: 120
}, {
sortable: true,
dataIndex: 'INVOICEMAKETIME',
header: '开票日期',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNAME',
header: '结算客户',
width: 80
}, {
sortable: true,
dataIndex: 'TTLRMB',
header: 'RMB应开',
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: 'INVRMB',
header: 'RMB已开',
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: 'TTLUSD',
header: 'USD应开',
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: 'INVUSD',
header: 'USD已开',
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
}
];
this.girdcolums = this.initgirdcolumsdr;
this.gridListDr = new Ext.grid.GridPanel({
store: this.storeListDr,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridListDr.reconfigure(this.storeListDr, this.girdcolums);
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
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListDr.columns, _this.girdcolums, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListDr.columns, _this.initgirdcolumsdr, 1, true);
}
}],
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 =" F.FEETYPE=1 AND B.BSNO='"+this.bsnosql+"'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = " F.FEETYPE=1 AND B.BSNO='" + 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
});
}
}
});
}
}
});