Ext.namespace('Shipping');
Shipping.MsOpPlanIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpPlanIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpPlanIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
selectbsno: '',
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "formMsOpPlanIndex"; //页面名称
//定义数据集
this.AMOUNT = 0;
this.REMARK ='';
this.OTREMARK = '';
this.BsNo = '';
this.storePLList = Ext.create('Ext.data.Store', {
model: 'MsOpPlan'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPlan',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpPlan/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
_this = 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: 'BSNO',
header: '业务编号',
hidden: true,
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
} else if (value == '驳回提交') {
meta.tdCls = 'feestatus_nopass';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'DRINVSTATUS',
header: '应收开票',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '已开票') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分开票') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'BSSTATUS',
header: '状态',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '停用') {
meta.tdCls = 'feestatus_nopass';
} else if (value == '改按次') {
meta.tdCls = 'feestatus_settle';
} else if (value == '延期') {
meta.tdCls = 'feestatus_settlepart';
} else if (value == '取消') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '计划单号',
width: 80
}, {
sortable: true,
dataIndex: 'BSCUSTNO',
header: '委托编号',
width: 80
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细',
width: 80
}, {
sortable: true,
dataIndex: 'FEEDATE',
header: '首次计费时间',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '创建人',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTDATE',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期',
width: 80
}, {
sortable: true,
dataIndex: 'OPSTATUS',
header: '当前动态',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'OTREMARK',
header: '其他备注',
width: 200
},
{
sortable: true,
id: '',
dataIndex: 'TOSALE',
header: '转销售',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == 'true' || value == 'True') {
value = '是';
meta.tdCls = 'feestatus_pass';
} else value = '否';
return value;
}
}];
this.girdcolums = this.initgirdcolums;
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
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.AMOUNT = record.data.AMOUNT;
this.REMARK = record.data.REMARK;
this.OTREMARK = record.data.OTREMARK;
this.storeOpStatusList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: "BSNO='" + this.BsNo + "'" },
waitMsg: "正在查询数据...",
scope: this
});
if (_this.panelsouth.isVisible()) {
this.storeOTList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: "CUSTOMERNAME='" + record.data.CUSTOMERNAME + "'" },
waitMsg: "正在查询数据...",
scope: this
});
}
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch 查询条件
_this = this;
//客户加载_委托单位
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,
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) {
_this.onRefreshClick();
}
}
}
});
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.comboxBSSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源',
store: this.storeSource,
forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.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.storeDRFEESTATUS= Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeDRFEESTATUS.add({ "FSTATUS": "", "NAME": "全部" });
this.storeDRFEESTATUS.add({ "FSTATUS": "审核通过", "NAME": "审核通过" });
this.storeDRFEESTATUS.add({ "FSTATUS": "录入状态", "NAME": "录入状态" });
this.storeDRFEESTATUS.add({ "FSTATUS": "提交审核", "NAME": "提交审核" });
this.storeDRFEESTATUS.add({ "FSTATUS": "部分结算", "NAME": "部分结算" });
this.storeDRFEESTATUS.add({ "FSTATUS": "结算完毕", "NAME": "结算完毕" });
this.comboxDRFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收费用',
store: this.storeDRFEESTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'DRFEESTATUS',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeDRINVSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeDRINVSTATUS.add({ "FSTATUS": "", "NAME": "全部" });
this.storeDRINVSTATUS.add({ "FSTATUS": "已开票", "NAME": "已开票" });
this.storeDRINVSTATUS.add({ "FSTATUS": "部分开票", "NAME": "部分开票" });
this.storeDRINVSTATUS.add({ "FSTATUS": "未开票", "NAME": "未开票" });
this.comboxDRINVSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收开票',
store: this.storeDRINVSTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'DRINVSTATUS',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeSTATUS.add({ "FSTATUS": "", "NAME": "全部" });
this.storeSTATUS.add({ "FSTATUS": "有", "NAME": "有" });
this.storeSTATUS.add({ "FSTATUS": "无", "NAME": "无" });
this.comboxSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '状态和动态',
store: this.storeSTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'STATUS',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从会计期间',
format: 'Y-m',
xtype: 'datefield',
name: 'FRACCDATE',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至',
format: 'Y-m',
xtype: 'datefield',
name: 'TOACCDATE',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, this.comboxBSSOURCE, {
fieldLabel: '计划单号',
name: 'CUSTNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxSTATUS, {
xtype: 'button',
width: 90,
text: "查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSALE, this.comboxDRFEESTATUS, this.comboxDRINVSTATUS, {
fieldLabel: '备注',
name: 'REMARK',
flex: 2,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '委托编号',
name: 'BSCUSTNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
text: "重置",
xtype: 'button',
width: 90,
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}]
}]
}]
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: 'EXCEL导入', //"EXCEL模板导出",
iconCls: "btnexportexcel",
handler: function (button, event) {
_this.onImportBillClick();
},
scope: this
}, '-', {
text: "生成订单",
handler: function (button, event) {
this.onCreateListClick(button, event);
},
scope: this
}, '-', {
text: "更改状态",
menu: [
{
text: "停用",
handler: function (button, event) {
_this.onChangeStatusClick('停用');
}
}, {
text: "改按次",
handler: function (button, event) {
_this.onChangeStatusClick('改按次');
}
}, {
text: "延期",
handler: function (button, event) {
_this.onChangeStatusClick('延期');
}
}, {
text: "取消",
handler: function (button, event) {
_this.onChangeStatusClick('取消');
}
}],
scope: this
}, {
text: "修改",
handler: function (button, event) {
_this.formModify.getForm().findField('AMOUNT').setValue(_this.AMOUNT);
_this.formModify.getForm().findField('REMARK').setValue(_this.REMARK);
_this.formModify.getForm().findField('OTREMARK').setValue(_this.OTREMARK);
_this.winModifyShow.show();
},
scope: this
}, {
text: "转销售",
handler: function (button, event) {
this.onToSaleClick(button, event);
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteListClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, {
text: "导出EXCEL",
handler: function (button, event) {
GridExportExcelPage(_this.gridList);
}
}, {
text: "历史记录",
handler: function (button, event) {
if (_this.panelsouth.isVisible()) {
_this.panelsouth.setVisible(false);
} else {
_this.panelsouth.setVisible(true);
}
}
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.storeOpStatusList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpStatus',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpStatus/GetListData',
reader: {
id: 'ST_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeOPSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeOPSTATUS.load({ params: { enumTypeId: 97801 } });
this.comboxOPSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeOPSTATUS,
//forceSelection: true,
name: 'STATUS'
});
this.girdOpStatuscolums = [{
sortable: true,
dataIndex: 'ST_ID',
header: 'ST_ID',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'STATUS',
header: '动态',
editor: this.comboxOPSTATUS,
width: 120
}, {
sortable: true,
dataIndex: 'COMPTIME',
header: '时间',
editor: {
xtype: 'datefield',
format: 'Y-m-d H:i:s',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 120
}, {
sortable: true,
dataIndex: 'COMPOP',
header: '操作',
width: 80
}
];
this.gridOpStatusListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxOpStatusModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridOpStatusList = new Ext.grid.GridPanel({
store: this.storeOpStatusList,
enableHdMenu: false,
region: 'east',
width: 360,
splite:true,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridOpStatusListCellEditing],
selModel: this.CheckBoxOpStatusModel,
tbar: [{
text: '增加动态',
tooltip: '增加动态',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
},
'-',
{
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除动态',
tooltip: '删除动态',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}],
selType: 'cellmodel',
columns: this.girdOpStatuscolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeOpStatusList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.storeOpStatusList.on('beforeload', function (store) {
var sql = "BSNO='" + this.BsNo + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.panelcenter = new Ext.Panel({
layout: "border",
region: "center",
items: [this.gridList, this.gridOpStatusList]
});
//#region 历史记录
this.storeOTList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpOtherEntity',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpOther/GetDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initOTgirdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
},
{
sortable: true,
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
align: 'center',
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "";
}
}
},
{
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
} else if (value == '驳回提交') {
meta.tdCls = 'feestatus_nopass';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS',
header: '应付费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
} else if (value == '驳回提交') {
meta.tdCls = 'feestatus_nopass';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'DRINVSTATUS',
header: '应收开票',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '已开票') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分开票') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'DRDUISTATUS',
header: '应收对帐', //'应收开票',
align: 'center',
// xtype: 'actioncolumn',
width: 60,
renderer: function (value, meta, record) {
if (value == '已对账') {
// value = '已开票'
meta.tdCls = 'feestatus_pass';
} else if (value == '部分对账') {
meta.tdCls = 'feestatus_refer';
// value = '部分开票'
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRINVSTATUS',
header: '应付开票', //'应收开票',
align: 'center',
// xtype: 'actioncolumn',
width: 60,
renderer: function (value, meta, record) {
var openSet = "height=200, width=650, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 250) / 2 + ",Left= " + (screen.width - 600) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsRptChInvTotal/BsCrView?handle=check&bsno=" + record.data.BSNO;
var winstr = "window.open(this.href,'" + openType + "','" + openSet + "')";
if (value == '已开票') {
value = '已开票'
meta.tdCls = 'feestatus_pass';
} else if (value == '部分开票') {
meta.tdCls = 'feestatus_refer';
value = '部分开票'
}
return value;
}
}, {
sortable: true,
id: '',
dataIndex: 'BillFeeStatus',
header: '整票状态', //'整票状态',
width: 60,
renderer: function (value, meta) {
if (value == '0') {
return "未提交";
} else if (value == '1') {
meta.tdCls = 'feestatus_refer';
return "整票提交";
} else if (value == '2') {
meta.tdCls = 'feestatus_pass';
return "审核通过";
} else if (value == '4') {
meta.tdCls = 'feestatus_nopass';
return "整票驳回";
} else {
return "";
}
}
}, {
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 80
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 80
}, {
sortable: true,
dataIndex: 'ORDERNO',
header: '订舱编号',
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 80
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'ETD',
header: '业务日期',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTSERVICE',
header: '客服',
width: 80
}, {
sortable: true,
dataIndex: 'OPERATOR',
header: '客户联系人',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细',
width: 80
}, {
sortable: true,
dataIndex: 'TRADETYPE',
header: '贸易方式',
width: 80
}, {
sortable: true,
dataIndex: 'TRANSTYPE',
header: '运输类型',
width: 80
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '运输工具',
width: 80
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '班次号',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
}, {
sortable: true,
dataIndex: 'NETWEIGHT',
header: '净重',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
}, {
sortable: true,
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 80
}, {
sortable: true,
dataIndex: 'VOUNO',
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: 'BOOKNO',
header: '手册号',
width: 80
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 80
}, {
sortable: true,
dataIndex: 'WAREHOUSE',
header: '仓库',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
}];
this.girdOTcolums = this.initOTgirdcolums;
//定义Grid
this.GridOTCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.gridOTList = new Ext.grid.GridPanel({
store: this.storeOTList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridOTCheckBoxModel,
columns: this.girdOTcolums,
tbar: [
{
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdOTcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'OT', _this.gridOTList.columns, _this.girdOTcolums, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.girdOTcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'OT', _this.gridOTList.columns, _this.initOTgirdcolums, 1, true);
}
}],
scope: this
}],
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeOTList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdOTcolums = DsTruck.GetGridPanel(USERID, this.formname+'OT', this.girdOTcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
this.gridOTList.reconfigure(this.storeOTList, this.girdOTcolums);
this.gridOTList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////
this.gridOTList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpOther/Edit', record.data.BSNO);
}, this);
//#endregion
this.panelsouth = new Ext.Panel({
layout: "border",
region: "south",
title: '客户历史记录',
height: 300,
splite: true,
hidden:true,
items: [this.gridOTList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelcenter, this.panelsouth]
});
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m');
this.formSearch.getForm().findField('FRACCDATE').setValue(mydatestr);
this.formSearch.getForm().findField('TOACCDATE').setValue(mydatestr);
this.sqlcontext = " (op_plan.ACCDATE='" + mydatestr + "' or op_plan.OLDACCDATE='" + mydatestr + "') ";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
//签单方式
this.formModifyAccDate = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '延期至会计期间',
format: 'Y-m',
xtype: 'datefield',
name: 'ACCDATE'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
me = this;
this.winModifyAccDateShow = Ext.create('Ext.window.Window', {
title:'', //"批量修改",
width: 260,
//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.formModifyAccDate],
buttons: [{
text: '确认', //"确认修改",
minWidth: 70,
handler: function () {
var accdate = _this.formModifyAccDate.getForm().findField('ACCDATE').getRawValue();
if (accdate == '' || accdate == null || accdate == undefined) {
Ext.Msg.show({ title: '提示', msg: '会计期间不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
_this.onChangeStatusFn(accdate);
me.winModifyAccDateShow.close();
}
}, {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
me.winModifyAccDateShow.close();
}
}]
});
this.formModify = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel:'BSNO', //'业务编号',
name: 'BSNO', hidden: true
},{
fieldLabel: '金额', //'财务税率',
xtype: 'numberfield',
value: 0,
name: 'AMOUNT'
}
]
}
]//end items(fieldset 1)
}, {//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK',
height: 50,
xtype: "textarea"
}
]
}
]//end items(fieldset 1)
}, , {//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '其他备注',
name: 'OTREMARK',
height: 50,
xtype: "textarea"
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
me = this;
this.winModifyShow = Ext.create('Ext.window.Window', {
title: '', //"批量修改",
width: 380,
//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.formModify],
buttons: [{
text: '确认', //"确认修改",
minWidth: 70,
handler: function () {
_this.AMOUNT = _this.formModify.getForm().findField('AMOUNT').getValue();
_this.REMARK = _this.formModify.getForm().findField('REMARK').getValue();
_this.OTREMARK = _this.formModify.getForm().findField('OTREMARK').getValue();
_this.onModiyDataFn();
me.winModifyShow.close();
}
}, {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
me.winModifyShow.close();
}
}]
});
}, //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
});
},
onDeleteClick: 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 record = selections[0];
if (record.data.BSCUSTNO!= '') {
Ext.Msg.show({ title: '警告', msg: '已生成业务,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpPlan/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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.BSCUSTNO != '') {
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/MsOpPlan/DeleteList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.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);
},
onCreateListClick: 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.BSCUSTNO != '') {
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/MsOpPlan/SaveToOther',
params: {
body: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.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);
},
onToSaleClick: function () {
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 (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/MsOpPlan/ToSale',
params: {
body: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.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);
},
onChangeStatusClick: function(status){
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 (isdelete) {
bodyAddDatas.push(rec);
icount = icount + 1;
}
}
Ext.MessageBox.confirm('提示', "确实要将选中的【" + icount.toString() + "】票业务生成状态更改为'" + status+"'吗?", function (btn) {
if (btn == 'yes') {
_this.jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this.planstatus = status;
if (status == '延期') {
_this.winModifyAccDateShow.show();
}else
_this.onChangeStatusFn("");
}
}, this);
},
onChangeStatusFn: function (accdate) {
Ext.Msg.wait('正在生成....');
Ext.Ajax.request({
waitMsg: '正在生成....',
url: '/MvcShipping/MsOpPlan/ChangeStatus',
params: {
data: _this.jsonbodyAddDatas,
bsstatus: _this.planstatus,
accdate: accdate
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.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
},
onModiyDataFn:function() {
Ext.Msg.wait('正在生成....');
Ext.Ajax.request({
waitMsg: '正在生成....',
url: '/MvcShipping/MsOpPlan/Modify',
params: {
BSNO: _this.BsNo,
AMOUNT: _this.AMOUNT,
REMARK: _this.REMARK,
OTREMARK: _this.OTREMARK
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.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
},
onAddDetailClick: function (button, event) {
var n = this.storeOpStatusList.getCount();
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
var record = Ext.create('MsOpStatus', {
ST_ID: NewGuid(),
BSNO: '*',
ORDNO: n + 1,
STATUS: '',
ISOPEN: '0',
ISOPENREF: '不公开',
COMPTIME: mydatestr,
COMPOP: SHOWNAME,
REMARK: ''
});
this.storeOpStatusList.add(record);
var n = this.storeOpStatusList.getCount();
this.gridOpStatusListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
onDelDetailClick: function () {
var selectedRecords = this.CheckBoxOpStatusModel.selected.items;
Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BSNO == "" || rec.BSNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeOpStatusList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpStatus/Delete',
params: {
bsno: _this.BsNo,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.storeOpStatusList.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);
},
onPostDetailClick: function (button, event) {
var bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeOpStatusList.getCount(); i += 1) {
var memberyf = this.storeOpStatusList.getAt(i);
memberyf.data.COMPTIME = Ext.util.Format.date(memberyf.data.COMPTIME, 'Y-m-d H:i:s');
bodyDrChFeeDatas.push(memberyf);
var STATUS = memberyf.data.STATUS;
if (STATUS == '') {
Ext.Msg.show({
title: '警告',
msg: '状态不能为空,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpStatus/Save',
scope: this,
params: {
bsno: _this.BsNo,
body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeOpStatusList.getCount(); i += 1) {
var member = this.storeOpStatusList.getAt(i);
member.set("BSNO", _this.BsNo);
member.commit();
}
} 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
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
//#region EXCEL导入
onImportBillClick: function () {
var BSNO = "";
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'DsLoadExcel',
name: 'DsLoadExcel',
emptyText: '请选择EXCEL文件', //'请选择EXCEL文件',
fieldLabel: 'EXCEL', //'EXCEL',
buttonText: '选择文件', //'选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传', //'上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('DsLoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认上传的文件为EXCEL', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请确认你上传的文件为EXCEL文件!'
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOpPlan/ImpExcel',
waitMsg: '正在上传数据',
method: 'POST',
params: {
bsno: BSNO
},
success: function (form, action) {
win.close(this);
_this.storeList.reload();
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('错误', action.result.Message);
}
});
}
}, {
text: '关闭', //'关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL", //"上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
//#endregion
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var CUSTNO = form.findField('CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, "CUSTNO like '%" + CUSTNO + "%'");
//会计期间
var FRACCDATE = form.findField('FRACCDATE').getRawValue();
sql = sql + getAndConSql(sql, FRACCDATE, "(ACCDATE>='" + FRACCDATE + "' OR OLDACCDATE>='" + FRACCDATE + "')");
var TOACCDATE = form.findField('TOACCDATE').getRawValue();
sql = sql + getAndConSql(sql, TOACCDATE, "(ACCDATE<='" + TOACCDATE + "' OR OLDACCDATE<='" + TOACCDATE + "')");
var BSCUSTNO = form.findField('BSCUSTNO').getValue();
sql = sql + getAndConSql(sql, BSCUSTNO, " EXISTS (select 1 from OP_OTHER WHERE op_plan.MASTERNO=OP_OTHER.BSNO AND CUSTNO like '%" + BSCUSTNO + "%') ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var BSSOURCE = form.findField('BSSOURCE').getValue();
sql = sql + getAndConSql(sql, BSSOURCE, "BSSOURCE= '" + BSSOURCE + "'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "SALE= '" + SALE + "'");
var REMARK = form.findField('REMARK').getValue();
sql = sql + getAndConSql(sql, REMARK, "REMARK like '%" + REMARK + "%'");
var DRFEESTATUS = form.findField('DRFEESTATUS').getValue();
if (DRFEESTATUS != '') {
if (DRFEESTATUS == '审核通过') {
sql = sql + getAndConSql(sql, DRFEESTATUS, " dbo.F_GetBillDrFeeStatus(op_plan.MASTERNO)='0:'");
} else if (DRFEESTATUS == '录入状态') {
sql = sql + getAndConSql(sql, DRFEESTATUS, " dbo.F_GetBillDrFeeStatus(op_plan.MASTERNO)='1:'");
} else if (DRFEESTATUS == '提交审核') {
sql = sql + getAndConSql(sql, DRFEESTATUS, " dbo.F_GetBillDrFeeStatus(op_plan.MASTERNO)='2:'");
} else if (DRFEESTATUS == '部分结算') {
sql = sql + getAndConSql(sql, DRFEESTATUS, " dbo.F_GetBillDrFeeStatus(op_plan.MASTERNO)='8:' ");
} else if (DRFEESTATUS == '结算完毕') {
sql = sql + getAndConSql(sql, DRFEESTATUS, " dbo.F_GetBillDrFeeStatus(op_plan.MASTERNO)='9:'");
}
}
var DRINVSTATUS = form.findField('DRINVSTATUS').getValue();
if (DRINVSTATUS != '') {
if (DRINVSTATUS == '已开票') {
sql = sql + getAndConSql(sql, DRINVSTATUS, " i.TTLDR<>0 and i.TTLDR=i.TTLINVDR ");
} else if (DRINVSTATUS == '部分开票') {
sql = sql + getAndConSql(sql, DRINVSTATUS, " i.TTLDR<>0 and i.TTLDR<>i.TTLINVDR and i.TTLINVDR<>0 ");
} else if (DRINVSTATUS == '未开票') {
sql = sql + getAndConSql(sql, DRINVSTATUS, " i.TTLDR<>0 and i.TTLINVDR=0 ");
}
}
var STATUS = form.findField('STATUS').getValue();
if (STATUS != '') {
if (STATUS == '有') {
sql = sql + getAndConSql(sql, STATUS, " (isnull(op_plan.BSSTATUS,'')<>'' OR EXISTS (select 1 from op_status where OP_STATUS.BSNO=OP_PLAN.BSNO)) ");
} else if (STATUS == '无') {
sql = sql + getAndConSql(sql, STATUS, " isnull(op_plan.BSSTATUS,'')='' and not EXISTS (select 1 from op_status where OP_STATUS.BSNO=OP_PLAN.BSNO) ");
}
}
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) {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var sortstr = '';
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsOpPlan/GetDataListStr',
//(int start, int limit, string sort, string condition, int billtype)
scope: this,
params: {
start: 0,
limit: 10000000,
sort: sortstr,
condition: _this.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 () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsOpPlan/GetDataListStr',
scope: this,
params: {
condition: _this.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 () {
_this = this;
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_plan 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);
}
});