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.

1582 lines
53 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.MsChMonthCloseIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChMonthCloseIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChMonthCloseIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
AccDate: null,
IsAccDate: '',
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = 'frmMsChMonthCloseIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'OPLB', type: 'string' },
{ name: 'OPTYPE', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'BSTYPE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'OPSTATUS', type: 'string' },
{ name: 'ACCDATE', 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: 'FEESTATUS', type: 'string' },
{ name: 'BSSTATUSREF', type: 'string' },
{ name: 'FEESTATUSREF', type: 'string' },
{ name: 'DRFEESTATUS', type: 'string' },
{ name: 'CRFEESTATUS', 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: 'ISPRINTPR', type: 'string' },
{ name: 'NETWEIGHT', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'CNTR1', type: 'number' },
{ name: 'CNTR2', type: 'number' },
{ name: 'CNTR3', type: 'number' },
{ name: 'CNTR4', type: 'number' },
{ name: 'CNTR5', type: 'number' },
{ name: 'CNTR6', type: 'number' },
{ name: 'CNTR7', type: 'number' },
{ name: 'CNTR8', type: 'number' },
{ name: 'CNTR9', type: 'number' },
{ name: 'CNTR10', type: 'number' },
{ name: 'OTCNTR', type: 'number' },
{ name: 'RMBDR', type: 'number' },
{ name: 'RMBCR', type: 'number' },
{ name: 'USDDR', type: 'number' },
{ name: 'USDCR', type: 'number' },
{ name: 'OTDR', type: 'number' },
{ name: 'OTCR', type: 'number' },
{ name: 'TTLDR', type: 'number' },
{ name: 'TTLCR', type: 'number' },
{ name: 'RMBPROFIT', type: 'number' },
{ name: 'USDPROFIT', type: 'number' },
{ name: 'OTPROFIT', type: 'number' },
{ name: 'TTLPROFIT', type: 'number' },
{ name: 'PROFITRATE', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_lock/BsListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: '编号',
hidden: true,
width: 130
}, {
sortable: true,
id: '',
align: 'center',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
width: 60,
renderer: function (value, cellmeta) {
if (value == '已锁定' || value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
id: '',
align: 'center',
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
width: 60,
renderer: function (value, cellmeta) {
if (value == '已锁定' || value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'ISPRINTPR',
header: '打印核算单',
width: 80,
renderer: function (value, meta, record) {
if (value == '1')
return '√';
else
return '';
}
},
{
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
var svalue = "";
if (value != "") {
if (value == '0:') {
meta.tdCls = 'feestatus_pass';
svalue = "审核通过";
} else if (value == '1:') {
svalue = "录入状态";
} else if (value == '2:') {
meta.tdCls = 'feestatus_refer';
svalue = "提交审核";
} else if (value == '8:') {
meta.tdCls = 'feestatus_refer';
svalue = "部分结算";
} else if (value == '9:') {
meta.tdCls = 'feestatus_settle';
svalue = "结算完毕";
} else if (value == '') {
svalue = "未录入";
} else if (value.indexOf("9:") > -1) {
meta.tdCls = 'feestatus_settle';
svalue = "部分结算";
} else if (value.indexOf("0:") > -1) {
meta.tdCls = 'feestatus_pass';
svalue = "部分审核";
} else if (value.indexOf("2:") > -1) {
meta.tdCls = 'feestatus_refer';
svalue = "部分提交";
}
}
return svalue;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS',
header: '应付费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
var svalue = "";
if (value != "") {
if (value == '0:') {
meta.tdCls = 'feestatus_pass';
svalue = "审核通过";
} else if (value == '1:') {
svalue = "录入状态";
} else if (value == '2:') {
meta.tdCls = 'feestatus_refer';
svalue = "提交审核";
} else if (value == '8:') {
meta.tdCls = 'feestatus_refer';
svalue = "部分结算";
} else if (value == '9:') {
meta.tdCls = 'feestatus_settle';
svalue = "结算完毕";
} else if (value == '') {
svalue = "未录入";
} else if (value.indexOf("9:") > -1) {
meta.tdCls = 'feestatus_settle';
svalue = "部分结算";
} else if (value.indexOf("0:") > -1) {
meta.tdCls = 'feestatus_pass';
svalue = "部分审核";
} else if (value.indexOf("2:") > -1) {
meta.tdCls = 'feestatus_refer';
svalue = "部分提交";
}
}
return svalue;
}
}, {
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 70
}, {
sortable: true,
dataIndex: 'OPTYPE',
header: '更改单',
width: 70
}, {
sortable: true,
dataIndex: 'BSTYPE',
header: '运输类型',
width: 70
},
{
sortable: true,
id: '',
dataIndex: 'OPSTATUS',
header: '业务状态',
width: 60
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 86
}, {
sortable: true,
dataIndex: 'OPDATE',
header: '业务日期',
width: 86
}, {
sortable: true,
dataIndex: 'CUSTOMDATE',
header: '报关日期',
width: 86
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 136
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 136
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 100
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 86
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 200
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 50
}, {
sortable: true,
dataIndex: 'SALE',
header: '业务员',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 150
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 120
}, {
sortable: true,
dataIndex: 'TEU',
header: 'TEU',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: 'KGS',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'RMBDR',
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: 'RMBCR',
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: 'RMBPROFIT',
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: 'USDDR',
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: 'USDCR',
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: 'USDPROFIT',
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: 'OTDR',
header: '其他币别应收',
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: 'OTCR',
header: '其他币别应付',
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: 'OTPROFIT',
header: '其他币别利润',
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: 'TTLDR',
header: '合计应收',
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: 'TTLCR',
header: '合计应付',
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: 'TTLPROFIT',
header: '合计利润',
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: 'PROFITRATE',
header: '利润率',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
tbar: [{
text: '费用锁定',
tooltip: '费用锁定',
iconCls: "btnsubmit",
handler: function (button, event) {
this.winFeeCloseShow.show();
},
scope: this
}, {
text: '更改为下期',
tooltip: '更改为下期',
iconCls: "btncancel",
handler: function (button, event) {
this.onSelDownMonthClick(button, event);
},
scope: this
}],
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.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 = "/Account/Chfee_lock/Chfee_lockDetail";
window.open(openUrl, openType, openSet);
}, this);
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[1] = new Ext.grid.RowNumberer();
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch
//#region formSearch枚举参照相关
Ext.define('SubComp', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'ENNAME', type: 'string' }
]
});
this.StoreSubComp = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubComp',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.StoreSubComp.load({ params: { condition: ""} });
this.comboxSubComp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属公司',
store: this.StoreSubComp,
name: 'SUBCOMP',
valueField: 'GID',
displayField: 'NAME',
value:COMPANYID,
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: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: 'PYEAR',
name: 'PYEAR', hidden: true
}, {
fieldLabel: 'PMONTH',
name: 'PMONTH', hidden: true
}, {
fieldLabel: '结转期间',
flex: 1,
readOnly: true,
xtype: 'monthfield',
name: 'PERIOD'
}, {
fieldLabel: '开始日期',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'FDAY'
}, {
fieldLabel: '结束日期',
format: 'Y-m-d',
readOnly: true,
xtype: 'datefield',
name: 'TDAY'
}, {
fieldLabel: '结转日期类型',
name: 'CLOSEDATETYPE'
}, this.comboxSubComp,{
xtype: 'label',
flex: 1, id: 'ERROSTR',
html: "<font color='green'></font>"
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "结转本期",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
id: 'btnESaveUp',
text: "反结至上期",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('-1');
},
scope: this
}
]
});
this.CheckAccMonth = new Ext.form.Checkbox({
fieldLabel: '修改会计期间',
checked: false,
width: 120
});
this.formAccMonthShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.CheckAccMonth, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'AccDate'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'radiogroup',
id: 'rLOCKTYPE',
defaults: {
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: '选择',
name: 'LOCKTYPE',
checked: true,
inputValue: 'S',
id: 'radio1'
}, {
boxLabel: '全部',
name: 'LOCKTYPE',
inputValue: 'A',
id: 'radio2'
}
]
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winFeeCloseShow = Ext.create('Ext.window.Window', {
title: "费用封帐",
width: 420,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAccMonthShow],
buttons: [{
text: "确认封帐",
minWidth: 70,
handler: function () {
var form = me.formAccMonthShow.getForm();
var cgLOCKTYPE = Ext.getCmp('rLOCKTYPE');
var LOCKTYPE = cgLOCKTYPE.getValue();
if (me.CheckAccMonth.checked) {
me.AccDate = form.findField('AccDate').getRawValue();
if (me.AccDate == '' || me.AccDate == null || me.AccDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须会计期间!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.IsAccDate = '1';
} else me.IsAccDate = '0';
if (LOCKTYPE.LOCKTYPE == 'A') {
_this.onFeeLockAll()
} else {
_this.onSelFeeLockClick()
}
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winFeeCloseShow.close();
}
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 45,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '业务明细',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridList]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.tabpanel]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql, type: locktype,
printstr: 'false'
});
}, this);
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.LoadData();
}, //end initUIComponents
LoadData: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition:'1=1'
},
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;
}
var data = result.data;
this.formSearch.getForm().reset();
this.formSearch.getForm().setValues(data);
this.formAccMonthShow.getForm().findField('AccDate').setMinValue(data.PERIOD);
this.onRefreshClick();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formSearch.getForm();
if (this.storeList.data.length > 0&&type!='-1') {
Ext.Msg.show({ title: '警告', msg: '本期有未费用封帐的业务,不能月末结账!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
Ext.Msg.wait('正在结转数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在结转数据...',
url: '/Account/ChMonthClose/Save',
scope: this,
params: {
type: type,
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formSearch.getForm().setValues(returnData);
this.onRefreshClick();
} 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
});
}
}
});
}, //end save
onSelLockClick: function (menu, event, type) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.BSSTATUS;
if (type == 2)
status = rec.data.BSSTATUS
else status = rec.data.FEESTATUS
if (status != true) {
bodyAddDatas.push(rec);
}
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/SelLock',
params: {
data: jsonbodyAddDatas,
type: type
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSelFeeLockClick: function (menu, event, type) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.CheckAccMonth.checked) {
this.IsAccDate = '1'
} else this.IsAccDate = '0'
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.FEESTATUS
if (status != true) {
bodyAddDatas.push(rec);
}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/SelFeeLock',
params: {
data: jsonbodyAddDatas,
isAccDate: _this.IsAccDate,
AccDate: _this.AccDate
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
_this.winFeeCloseShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSelDownMonthClick: function (menu, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要处理的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var accDate_Min = this.formSearch.getForm().findField('PERIOD').getRawValue();
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
bodyAddDatas.push(rec);
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要处理的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/SelDownMonth',
params: {
data: jsonbodyAddDatas,
AccDate: accDate_Min
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
_this.winFeeCloseShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onAllLockClick: function (menu, event, type) {
if (this.storeList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有业务明细,无法锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/AllLock',
params: {
billsql: _this.sqlcontext,
type: type
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onFeeLockAll: function () {
if (this.storeList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有业务明细,无法锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.CheckAccMonth.checked) {
this.IsAccDate = '1'
} else this.IsAccDate = '0'
_this = this;
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/onFeeLockAll',
params: {
billsql: _this.sqlcontext,
isAccDate: _this.IsAccDate,
AccDate: _this.AccDate
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
_this.winFeeCloseShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSelUnLockClick: function (menu, event, type) {
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要解除锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var strGids = "";
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var Gid = rec.data.BSNO;
var status = rec.data.BSSTATUS;
if (type == 2) {
status = rec.data.BSSTATUS
}
else {
status = rec.data.FEESTATUS
}
if (status = true) {
bodyAddDatas.push(rec);
strGids += "," + Gid;
}
}
//
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要解除锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
if (strGids != "") {
strGids = strGids.toString().substr(1);
}
Ext.Ajax.request({
waitMsg: '正在判断锁定...',
url: '/Account/Chfee_lock/isSelUnLock',
params: {
strGids: strGids
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在解除锁定...',
url: '/Account/Chfee_lock/SelUnLock',
params: {
data: jsonbodyAddDatas,
type: type
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: "解除锁定成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, type: 'FEE' },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var accDate_Min = form.findField('PERIOD').getRawValue();
sql = sql + getAndConSql(sql, accDate_Min, " B.ACCDATE='" + accDate_Min + "'");
var SUBCOMP = form.findField('SUBCOMP').getValue();
sql = sql + getAndConSql(sql, SUBCOMP, "B.CORPID='" + SUBCOMP + "'");
sql = sql + getAndConSql(sql,"1=1", "B.FEESTATUS=0");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
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] = "MonthClose";
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});