|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
//#region 获取 YYYY-mm-dd 格式的日期
|
|
|
function GetDateStr(sdate, AddDayCount) {
|
|
|
var dd = new Date(sdate); //获取选择的时期对象
|
|
|
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
|
|
|
sdate = dd.toISOString();
|
|
|
sdate = sdate.toString().substr(0, 10);
|
|
|
return sdate;
|
|
|
};
|
|
|
//#endregion
|
|
|
|
|
|
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
|
|
|
|
|
|
Shipping.RptCtBankReconciliationIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.RptCtBankReconciliationIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.RptCtBankReconciliationIndex, Ext.Panel, {
|
|
|
PageSize: 2000,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.formname = "formRptCtBankReconciliationIndex"; //页面名称
|
|
|
_this = this;
|
|
|
|
|
|
//#region formSearch 下拉框信息加载
|
|
|
//银行存款科目加载
|
|
|
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsGlModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
|
|
|
});
|
|
|
this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 and ISBANK=1"} });
|
|
|
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '银行科目',
|
|
|
store: this.storeCwAccitems,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'ACCNAME',
|
|
|
name: 'ACCNAME',
|
|
|
valueField: 'ACCID',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
allowBlank: false,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (_Field, newValue, eOpts) {
|
|
|
if (_Field.value != null) {
|
|
|
var sGID = "";
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', _Field.value.toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
if (sGID != "") {
|
|
|
this.storeCwAccitemsCurrency.load({
|
|
|
params: { condition: "LINKGID = '" + sGID + "'" },
|
|
|
callback: function (options, success, response) {
|
|
|
var combo = Ext.getCmp("FCYNO");
|
|
|
combo.setValue(options[0].data.CURRENCY.toString()); //选中
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//币别选项
|
|
|
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsCurrencyModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsCurrencyList' }
|
|
|
});
|
|
|
//this.storeCwAccitemsCurrency.load({ params: { condition: ""} });
|
|
|
this.comboxCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.storeCwAccitemsCurrency,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'FCYNO',
|
|
|
name: 'FCYNO',
|
|
|
valueField: 'CURRENCY',
|
|
|
displayField: 'CURRENCY',
|
|
|
allowBlank: false
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region formSearch 查询面板
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: "north",
|
|
|
height: 35,
|
|
|
fieldDefaults: {
|
|
|
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: [this.comboxACCNAME, this.comboxCwAccitemsCurrency, {
|
|
|
fieldLabel: '截止日期',
|
|
|
id: 'VOUDATE',
|
|
|
name: 'VOUDATE',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
allowBlank: false, //是否允许为空
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, { xtype: 'label', width: 60 }, {
|
|
|
id: 'lbTitle2',
|
|
|
name: 'lbTitle2',
|
|
|
xtype: 'label',
|
|
|
text: "",
|
|
|
style: 'font-size: 20px; color: #FF0000; font-weight: bold;',
|
|
|
anchor: '100%',
|
|
|
align: 'center'
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
});
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//#region 定义数据集
|
|
|
//列表加载
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'RptCtBankReconciliationModel',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/RptCtBankReconciliation/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
//,autoLoad: true //自动加载
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 列定义
|
|
|
this.girdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: '', //唯一编码
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ITEM1',
|
|
|
header: '项目',
|
|
|
width: 200
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT1',
|
|
|
header: '金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
var sITEM1 = record.data.ITEM1.toString()
|
|
|
if (sITEM1.trim() == "") {
|
|
|
value = "";
|
|
|
}
|
|
|
else {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ITEM2',
|
|
|
header: '项目',
|
|
|
width: 200
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT2',
|
|
|
header: '金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
var sITEM2 = record.data.ITEM2.toString()
|
|
|
if (sITEM2.trim() == "") {
|
|
|
value = "";
|
|
|
}
|
|
|
else {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
}];
|
|
|
//#endregion
|
|
|
|
|
|
//#region gridList列表显示信息
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeList,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
columns: this.girdcolums,
|
|
|
columnLines: true, //是否显示列分割线,默认为false
|
|
|
iconCls: 'icon-grid',
|
|
|
renderTo: Ext.getBody(),
|
|
|
viewConfig: {
|
|
|
autoFill: true,
|
|
|
getRowClass: function (record, rowIndex, rowParams, store) {
|
|
|
var iType = 1;
|
|
|
var sITEM1 = record.data.ITEM1.toString();
|
|
|
if (sITEM1 == "调节后余额(单位)" || sITEM1 == "银行日记账余额:" || sITEM1 == "加:银行已收企业未收" || sITEM1 == "减:银行已付企业未付") {
|
|
|
iType = 2;
|
|
|
}
|
|
|
return Shipping.FeeGetRowClass(iType);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮工具条/页面布局
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [{
|
|
|
text: "查询",
|
|
|
id: "btnRefresh",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "打印",
|
|
|
iconCls: 'btnprint',
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "导出",
|
|
|
id: "btnExportExcel",
|
|
|
iconCls: 'btnexportexcel',
|
|
|
handler: function (button, event) {
|
|
|
this.onExportClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelBtn, this.formSearch, this.gridList]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 页面加载
|
|
|
this.InitData();
|
|
|
//
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
return false;
|
|
|
}
|
|
|
var sACCGID = "";
|
|
|
var sACCID = this.formSearch.getForm().findField('ACCNAME').getValue();
|
|
|
if (sACCID != null) {
|
|
|
if (sACCID != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sACCGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
Ext.apply(store.proxy.extraParams, { sACCGID: sACCGID, sFCYNO: sFCYNO, sVOUDATE: sVOUDATE });
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询...',
|
|
|
url: '/MvcShipping/MsCtBankJournal/GetInitData',
|
|
|
params: {
|
|
|
isInitial: this.isInitial
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
//var data = result.data;
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
this.strCtSTARTGID = strArg[0].toString();
|
|
|
this.strACCDATE = strArg[1].toString();
|
|
|
this.strACCDAY = strArg[2].toString();
|
|
|
this.strACCTODAY = strArg[3].toString();
|
|
|
//
|
|
|
Ext.getCmp("VOUDATE").setValue(this.strACCDAY);
|
|
|
//
|
|
|
this.onRefreshClick();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}, //end InitData
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询/刷新
|
|
|
onRefreshClick: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
return false;
|
|
|
}
|
|
|
var sACCGID = "";
|
|
|
var sACCID = this.formSearch.getForm().findField('ACCNAME').getValue();
|
|
|
if (sACCID != null) {
|
|
|
if (sACCID != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sACCGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
//
|
|
|
this.storeList.load({
|
|
|
waitMsg: "正在刷新数据...",
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', sACCGID: sACCGID, sFCYNO: sFCYNO, sVOUDATE: sVOUDATE },
|
|
|
callback: function (options, success, response) {
|
|
|
var returnData = options[options.length - 1].data;
|
|
|
if (returnData.ITEM1.toString() == "调节后余额(单位)") {
|
|
|
var dAMOUNT1 = returnData.AMOUNT1;
|
|
|
var dAMOUNT2 = returnData.AMOUNT2;
|
|
|
if (dAMOUNT1 == dAMOUNT2) {
|
|
|
Ext.getCmp('lbTitle2').setText("");
|
|
|
//Ext.getCmp('lbTitle2').setText("恭喜!余额调节表已平衡!");
|
|
|
//Ext.getCmp('lbTitle2').removeCls('classDiv2');
|
|
|
//Ext.getCmp('lbTitle2').addCls('classDiv1');
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('lbTitle2').setText("注意:余额调节表不平!");
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('lbTitle2').setText("");
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
this.InitData();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 打印
|
|
|
Print: function () {
|
|
|
_this = this;
|
|
|
if (this.storeList.getCount() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sACCGID = "";
|
|
|
var sACCID = this.formSearch.getForm().findField('ACCNAME').getValue();
|
|
|
if (sACCID != null) {
|
|
|
if (sACCID != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sACCGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
|
|
|
//Ext.Msg.wait('正在组织数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在组织数据, 请稍侯...',
|
|
|
url: '/MvcShipping/RptCtBankReconciliation/GetDataListStr',
|
|
|
params: {
|
|
|
sACCGID: sACCGID,
|
|
|
sFCYNO: sFCYNO,
|
|
|
sVOUDATE: sVOUDATE,
|
|
|
sTYPE: "print"
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var ddd = Ext.MessageBox.isVisible();
|
|
|
if (Ext.MessageBox.isVisible()) {
|
|
|
Ext.MessageBox.hide();
|
|
|
}
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnStr = jsonresult.data;
|
|
|
var printType = 'RptCtBankReconciliationList';
|
|
|
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
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 导出Excel
|
|
|
onExportClick2: function (button, event) {
|
|
|
_this = this;
|
|
|
if (this.storeList.getCount() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sACCGID = "";
|
|
|
var sACCID = this.formSearch.getForm().findField('ACCNAME').getValue();
|
|
|
if (sACCID != null) {
|
|
|
if (sACCID != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sACCGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
//
|
|
|
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=RptCtBankReconciliationIndex&formname=" + this.formname + "&condition1=" + escape(sACCGID) + "&condition2=" + escape(sFCYNO) + "&condition3=" + escape(sVOUDATE);
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
},
|
|
|
|
|
|
//ExtJs 自带的导出当前页的excel导出函数
|
|
|
onExportClick: function (button, event) {
|
|
|
GridExportExcelPage(this.gridList);
|
|
|
}
|
|
|
//#endregion
|
|
|
});
|
|
|
|
|
|
|