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.

1217 lines
42 KiB
JavaScript

3 months ago
Ext.namespace('Shipping');
Shipping.MsOpVgmSendIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpVgmSendIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpVgmSendIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
selectbsno: '',
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "MsOpVgmSendIndex"; //页面名称
//定义数据集
this.AMOUNT = 0;
this.REMARK ='';
this.OTREMARK = '';
this.BsNo = '';
this.modOpSaleRptAdd = 0;
this.modOpSaleRptReadOnly = 0;
this.storePLList = Ext.create('Ext.data.Store', {
model: 'MsOpSaleRpt'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpSaleRpt',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSaleRpt/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
_thisSaleRpt = this;
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: 'GID',
header: '业务编号',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'RPTSTATUS',
header: '状态',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
}, {
sortable: true,
dataIndex: 'STLDATE',
header: '应结日期',
width: 80
}, {
sortable: true,
dataIndex: 'NODAY',
header: '超期',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200, //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 150
}, {
sortable: true,
dataIndex: 'PLANDATE',
header: '计划回收时间',
allowBlank: false,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 120
}, {
sortable: true,
dataIndex: 'RMBDR',
header: 'RMB应收',
width: 80
}, {
sortable: true,
dataIndex: 'USDDR',
header: 'USD应收',
width: 80
}, {
sortable: true,
dataIndex: 'STLRMBDR',
header: 'RMB已收',
width: 80
}, {
sortable: true,
dataIndex: 'STLUSDDR',
header: 'USD已收',
width: 80
}, {
sortable: true,
dataIndex: 'BALRMBDR',
header: 'RMB未收',
width: 80
}, {
sortable: true,
dataIndex: 'BALUSDDR',
header: 'USD未收',
width: 80
}, {
sortable: true,
dataIndex: 'TTLBALDR',
header: '未收合计',
width: 80
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期',
width: 80
}, {
sortable: true,
dataIndex: 'LOCKTIME',
header: '锁定时间',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
//定义Grid
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,
plugins: [this.cellEditing],
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
//this.SelectedRecord = record;
//this.OprationStatus = 'edit';
//DsOpenEditWin('/MvcShipping/MsOpOther/Edit', record.data.BSNO);
this.BsNo = record.data.BSNO;
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
//#region formSearch 查询条件
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称',
store: this.storeCustCode,
labelWidth: 70,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售', //'揽货人',
store: this.storeOpCode,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeRPTSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeRPTSTATUS.add({ "FSTATUS": "未发布", "NAME": "未发布"});
this.storeRPTSTATUS.add({ "FSTATUS": "发布", "NAME": "发布" });
this.storeRPTSTATUS.add({ "FSTATUS": "锁定", "NAME": "锁定" });
this.comboxRPTSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '状态',
store: this.storeRPTSTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'RPTSTATUS',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRPTSTATUS,{
fieldLabel: '从会计期间',
labelWidth: 70,
format: 'Y-m',
xtype: 'datefield',
name: 'FRACCDATE',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
}, {
fieldLabel: '至',
labelWidth: 20,
format: 'Y-m',
xtype: 'datefield',
name: 'TOACCDATE',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
}, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
labelWidth: 70,
xtype: 'datefield',
name: 'FRETD',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
}, {
fieldLabel: '至',
format: 'Y-m-d',
labelWidth: 20,
xtype: 'datefield',
name: 'TOETD',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
}, this.comboxCustCode,{
fieldLabel: '主提单号',
labelWidth: 70,
name: 'MBLNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisSaleRpt.onRefreshClick();
}
}
}
}, this.comboxSALE, {
xtype: 'button',
width: 90,
text: "查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
}]
}]
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '导入', //"EXCEL模板导出",
iconCls: "btnexportexcel",
id: 'btnexportexcel',
handler: function (button, event) {
_thisSaleRpt.onImportBillClick();
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
id: 'btndelete',
handler: function (button, event) {
this.onDeleteListClick(button, event);
}, scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '发布',
tooltip: '发布',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnCancelSubmitAudit',
text: '取消发布',
tooltip: '取消发布',
handler: function (button, event) {
this.CancelSubList();
},
scope: this
}, '-', {
id: 'btnLock',
text: '锁定',
tooltip: '锁定',
handler: function (button, event) {
this.onLockClick();
},
scope: this
}, {
text: "保存",
iconCls: "btnsave",
id: 'btnsave',
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
},
'-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _thisSaleRpt.formname, _thisSaleRpt.gridList.columns, _thisSaleRpt.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_thisSaleRpt.girdcolums = DsTruck.SaveGridPanel(USERID, _thisSaleRpt.formname, _thisSaleRpt.gridList.columns, _thisSaleRpt.initgirdcolums, 1, true);
}
}],
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_thisSaleRpt.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_thisSaleRpt.PrintSelect();
}
}],
scope: this
}, {
text: "导出EXCEL",
handler: function (button, event) {
GridExportExcelPage(_thisSaleRpt.gridList);
}
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 65,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//this.sqlcontext = "";
//this.storeList.load({
// params: { start: 0, limit: this.PageSize, sort: '', condition: _thisSaleRpt.sqlcontext },
// waitMsg: "正在查询数据...",
// scope: this
//});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _thisSaleRpt.sqlcontext });
}, this);
//签单方式
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modOpSaleRptAdd"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var btnEdit = Ext.getCmp('btnexportexcel');
btnEdit.setVisible(false);
var btnEdit = Ext.getCmp('btndelete');
btnEdit.setVisible(false);
var btnEdit = Ext.getCmp('btnSubmitAudit');
btnEdit.setVisible(false);
var btnEdit = Ext.getCmp('btnCancelSubmitAudit');
btnEdit.setVisible(false);
var btnEdit = Ext.getCmp('btnLock');
btnEdit.setVisible(false);
var btnEdit = Ext.getCmp('btnsave');
btnEdit.setVisible(true);
_thisSaleRpt.sqlcontext = " SALE='" + SHOWNAME + "' and RPTSTATUS='发布' ";
_thisSaleRpt.onDsQuery();
} else {
_thisSaleRpt.modOpSaleRptAdd = 1;
var btnEdit = Ext.getCmp('btnexportexcel');
btnEdit.setVisible(true);
var btnEdit = Ext.getCmp('btndelete');
btnEdit.setVisible(true);
var btnEdit = Ext.getCmp('btnSubmitAudit');
btnEdit.setVisible(true);
var btnEdit = Ext.getCmp('btnCancelSubmitAudit');
btnEdit.setVisible(true);
var btnEdit = Ext.getCmp('btnLock');
btnEdit.setVisible(true);
var btnEdit = Ext.getCmp('btnsave');
btnEdit.setVisible(false);
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modOpSaleRptReadOnly"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
_thisSaleRpt.modOpSaleRptReadOnly = 1;
}
} else {
}
},
scope: this
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onPostDetailClick: function (button, event) {
var bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
var PLANDATE = member.data.PLANDATE;
if (PLANDATE != '')
PLANDATE = Ext.util.Format.date(PLANDATE, 'Y-m-d');
member.data.PLANDATE = PLANDATE;
bodyDrChFeeDatas.push(member);
};
var jsonChFeeBody = ConvertGIDRecordsToJson(bodyDrChFeeDatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpSaleRpt/SaveDetail',
scope: this,
params: {
body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
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
onSubmitAuditClick: function () {
Ext.MessageBox.confirm('提示', '确定发布所有未发布的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在提交数据...');
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOpSaleRpt/SubmitAudit',
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisSaleRpt.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: '发布成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
CancelSubList: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var reg = new RegExp("<", "g"); //创建正则RegExp对象
var stringObj = "";
var bodyAddDatas = [];
var icount = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var isdelete = true;
if (rec.data.RPTSTATUS != '发布') {
Ext.Msg.show({ title: '警告', msg: '当前状态不允许取消发布!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
isdelete = false;
return;
}
if (isdelete) {
bodyAddDatas.push(rec);
icount = icount + 1;
}
}
Ext.MessageBox.confirm('提示', "确实要取消发布选中的【" + icount.toString() + "】票业务吗?", function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在锁定....');
Ext.Ajax.request({
waitMsg: '正在锁定....',
url: '/MvcShipping/MsOpSaleRpt/CancelSubList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisSaleRpt.storeList.reload();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onDeleteListClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var reg = new RegExp("<", "g"); //创建正则RegExp对象
var stringObj = "";
var bodyAddDatas = [];
var icount = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var isdelete = true;
if (rec.data.RPTSTATUS != '未发布') {
Ext.Msg.show({ title: '警告', msg: '已发布,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
isdelete = false;
return;
}
if (isdelete) {
bodyAddDatas.push(rec);
icount = icount + 1;
}
}
Ext.MessageBox.confirm('提示', "确实要删除选中的【" + icount.toString() + "】票业务吗?", function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除....');
Ext.Ajax.request({
waitMsg: '正在删除....',
url: '/MvcShipping/MsOpSaleRpt/DeleteList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisSaleRpt.storeList.reload();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title:'错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title:'警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onLockClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var reg = new RegExp("<", "g"); //创建正则RegExp对象
var stringObj = "";
var bodyAddDatas = [];
var icount = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var isdelete = true;
if (rec.data.RPTSTATUS != '发布') {
Ext.Msg.show({ title: '警告', msg: '当前状态不允许锁定!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
isdelete = false;
return;
}
if (isdelete) {
bodyAddDatas.push(rec);
icount = icount + 1;
}
}
Ext.MessageBox.confirm('提示', "确实要锁定选中的【" + icount.toString() + "】票业务吗?", function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在锁定....');
Ext.Ajax.request({
waitMsg: '正在锁定....',
url: '/MvcShipping/MsOpSaleRpt/LockList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisSaleRpt.storeList.reload();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
//#region EXCEL导入
onImportBillClick: function () {
Ext.MessageBox.confirm('提示', '确定引入超期欠费的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在引入数据...');
Ext.Ajax.request({
waitMsg: '正在引入数据...',
url: '/MvcShipping/MsOpSaleRpt/NewData',
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisSaleRpt.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: '引入成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
cellEditingBeforeEdit: function (editor, e) {
var RPTSTATUS = e.record.get('RPTSTATUS');
var canedit = true;
if (RPTSTATUS!= '发布') {
Ext.Msg.show({ title:'提示', msg:'当前状态不允许修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改!
canedit = false;
}
if (_thisSaleRpt.modOpSaleRptReadOnly == 1) {
Ext.Msg.show({ title: '提示', msg: '没有修改权限!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改!
canedit = false;
}
return canedit;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
if (_thisSaleRpt.modOpSaleRptAdd == '0') {
sql = " RPTSTATUS='发布' "
}
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'");
//会计期间
var FRACCDATE = form.findField('FRACCDATE').getRawValue();
sql = sql + getAndConSql(sql, FRACCDATE, "ACCDATE>='" + FRACCDATE + "'");
var TOACCDATE = form.findField('TOACCDATE').getRawValue();
sql = sql + getAndConSql(sql, TOACCDATE, "ACCDATE<='" + TOACCDATE + "' ");
var FRETD = form.findField('FRETD').getRawValue();
sql = sql + getAndConSql(sql, FRETD, "ETD>='" + FRETD + "'");
var TOETD = form.findField('TOETD').getRawValue();
sql = sql + getAndConSql(sql, TOETD, "ETD<='" + TOETD + "' ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "SALE= '" + SALE + "'");
var RPTSTATUS = form.findField('RPTSTATUS').getValue();
sql = sql + getAndConSql(sql, RPTSTATUS, "RPTSTATUS= '" + RPTSTATUS + "'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.selectbsno;
ret[4] = 'op_plan';
ret[5] = this.storePLList;
return ret;
},
onExportClick: function (button, event) {
if (this.storeList.getCount() == 0) {
return;
}
var sortstr = '';
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsOpSaleRpt/GetDataListStr',
//(int start, int limit, string sort, string condition, int billtype)
scope: this,
params: {
start: 0,
limit: 10000000,
sort: sortstr,
condition: _thisSaleRpt.sqlcontext,
billtype: 0
},
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 condition = jsonresult.Message;
if (condition != '') condition = ' where ' + condition;
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
if (sql1 != '') {
GridExportBySql(sql1, this.formname, '收费计划列表.xls');
}
} 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 () {
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsOpSaleRpt/GetDataListStr',
scope: this,
params: {
condition: _thisSaleRpt.sqlcontext,
printstr: 'true'
},
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 = 'MSOPPLANLIST';
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
});
}
}
});
},
PrintSelect: function () {
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
if (sortstr == "") sortstr = "SFNO "
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('BSNO') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.BSNO;
}
var printType = 'MSOPPLANLISTSELECT';
var sql1 = "select * from op_salerpt WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select * from op_plan where BSNO='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});