You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOp_BLISSUE/MsOp_BLISSUESPEdit.js

3421 lines
115 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.MsOp_BLISSUESPEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOp_BLISSUESPEdit.superclass.constructor.call(this);
};
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minuet
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
Ext.extend(Shipping.MsOp_BLISSUESPEdit, Ext.Panel, {
ParentWin: null,
opStatus: 'add',
HTH: "",
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
VISIBLERANGE: 4,
OPERATERANGE: 4,
_thisGID2: "",
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
this.feeBodyDel = [];
this.formname = "MsOp_BLISSUESPEdit"; //页面名称
this.bsnosql = getUrlParam('bsnosql');
this.bsCust = getUrlParam('bsCust');
//this.formname_fee = "formImportSalesEdit_Fee"; //页面名称
//#region 编辑form
//枚举参照相关(编辑form)
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表参照相关(编辑form)
this.StoreCUSTCARGOAFTER = Ext.create('Ext.data.Store', {
fields: ['CUSTCARGOAFTER']
});
this.StoreCUSTCARGOAFTER.add({ "CUSTCARGOAFTER": "有" });
this.StoreCUSTCARGOAFTER.add({ "CUSTCARGOAFTER": "无" });
this.comboxCUSTCARGOAFTER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '后面是否有货',
store: this.StoreCUSTCARGOAFTER,
forceSelection: true,
name: 'CUSTCARGOAFTER',
valueField: 'CUSTCARGOAFTER',
displayField: 'CUSTCARGOAFTER'
});
_this = this;
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 3,
trackResetOnLoad: true,
// autoScroll: true,
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: '申请序列号', id: "thisGID",
name: 'GID'//, flex: 0, margins: '0'
},
{
fieldLabel: '时间戳',
name: 'TimeMark',
flex: 0,
hidden: true,
margins: '0'
}
, {
fieldLabel: '申请人',
name: 'OPNAME'//, //flex: 0, margins: '0'
}
, {
fieldLabel: '申请日期',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'OPTIME'
}, {
fieldLabel: '审批状态',
name: 'BLSTATUS'
}, {
fieldLabel: '总经理复核状态',
name: 'MNGBLSTATUS'
}, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '委托单位',
id: "thisCUSTOMERNAME",
name: 'CUSTOMERNAME', readOnly: true
}, {
fieldLabel: 'RMB欠款',
name: 'RMBNODR', readOnly: true
}, {
fieldLabel: 'USD欠款',
name: 'USDNODR', readOnly: true
}, {
fieldLabel: '总欠款',
name: 'TTLNODR', readOnly: true
}, {
fieldLabel: '后面是否有货',
name: 'CUSTCARGOAFTER', readOnly: true
}, {
fieldLabel: '揽货人',
name: 'SALE', readOnly: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '客户结算方式',
name: 'STLNAME', readOnly: true
}, {
fieldLabel: '销售部门',
name: 'SALEDEPT', readOnly: true
}, {
fieldLabel: Zi.LAN.ISDEPTARREARS,
name: 'ISDEPTARREARS', readOnly: true
}, {
fieldLabel: Zi.LAN.MAXARREARS,
name: 'MAXARREARS', readOnly: true
}, {
fieldLabel: Zi.LAN.DEPTTTLDR,
name: 'DEPTTTLDR', readOnly: true
}, {
fieldLabel: '是否超期欠费',
name: 'ISCHAOQI', readOnly: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'numberfield',
items: [
{
xtype: 'textareafield',
//grow: true,
fieldLabel: '承诺付款日期',
height: 40,
name: 'COMMITREMARK',
anchor: '100%'
}, {
xtype: 'textareafield',
//grow: true,
flex: 3,
fieldLabel: '申请说明',
height: 40,
name: 'REMARK',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '金额',
hidden: true,
name: 'AMOUNT',
},
{
fieldLabel: 'RMB金额',
hidden: true,
name: 'AMOUNTRMB',
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-',
{
text: "打印",
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: "提交审核", id: "SP_Start",
handler: function (button, event) {
this.onSP_StartClick('0');
},
scope: this
}, '-', {
text: "提交新建", id: "SP_Start_Save",
handler: function (button, event) {
this.onSP_StartClick('1');
},
scope: this
}, {
text: "撤回提交", id: "SP_Back",
tooltip: '取消特殊放单审请',
handler: function (button, event) {
this.onSP_BackClick(button, event);
},
scope: this
}, '-', {
text: "审核通过", id: "SP_Audit",
//iconCls: "btnrefresh",
handler: function (button, event) {
this.winAuditShow.show();
},
scope: this
},
{
text: "审核驳回", id: "SP_AuditBack",
handler: function (button, event) {
this.winAuditBackShow.show();
},
scope: this
}, '-', {
text: "复核通过", id: "MNGSP_Audit",
//iconCls: "btnrefresh",
handler: function (button, event) {
this.onMNGSP_AuditClick();
},
scope: this
},
{
text: "复核驳回", id: "MNGSP_AuditBack",
handler: function (button, event) {
this.onMNGSP_AuditBackClick();
},
scope: this
},
'-',
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'btnEClose',
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//明细表表格相关
//#region 明细表-特殊放单明细
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOp_BLISSUEmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOp_BLISSUE/GetSPDetail',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdcolums = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 60
},
{
sortable: true,
dataIndex: 'BLNO',
header: '主提单号',
width: 80
},
{
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 80
},
{
sortable: true,
dataIndex: 'ZDFD',
header: '主/分单',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLNAME',
header: 'BLNAME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLSTATUS',
header: 'BLSTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLORDERNO',
header: 'BLORDERNO',
width: 80
},
{
sortable: true,
dataIndex: 'ISSUETYPE',
header: '签单方式',
width: 80
},
{
sortable: true,
dataIndex: 'OPNAME',
header: '最近操作人',
width: 80
},
{
sortable: true,
dataIndex: 'OPTIME',
header: '操作时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSINKNO',
header: 'BSINKNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELFLAG',
header: 'DELFLAG',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'EXPRESSCORP',
header: 'EXPRESSCORP',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'EXPRESSNO',
header: 'EXPRESSNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ISADD',
header: 'ISADD',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PUTSINGLETIME',
header: 'PUTSINGLETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PUTSINGLE',
header: 'PUTSINGLE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYTIME',
header: 'PAYTIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYRMB',
header: 'PAYRMB',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYUSD',
header: 'PAYUSD',
width: 80
},
{
sortable: true,
dataIndex: 'BLTYPE',
header: '装运方式',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
},
{
sortable: true,
dataIndex: 'ACCTYPE',
header: '结算方式',
width: 80
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'STLDATE',
header: '结算日期',
width: 80
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 80
},
{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
},
{
sortable: true,
dataIndex: 'BLISSUESTATUS',
header: '提单签发状态',
width: 80
},
{
sortable: true,
dataIndex: 'TSFD',
header: '特殊放单',
width: 80
},
{
sortable: true,
dataIndex: 'XYTS',
header: '协议天数',
width: 80
},
{
sortable: true,
dataIndex: 'CQTS',
header: '超期天数',
width: 80
},
{
sortable: true,
dataIndex: 'SJTS',
header: '实际天数',
width: 80
},
{
sortable: true,
dataIndex: 'TTLNODR',
header: '未收合计',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
plugins: [this.gridListCellEditing],
tbar: [{
text: '删除明细',
tooltip: '删除明细',
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteClick(button, event, 1);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, this.formname, tempcolumns, this.girdcolums, 1, true);
},
scope: this
}/*,{
text: '生成应收',
tooltip: '根据销售单生成应收费用',
id: 'btnmakefee',
iconCls: "btnadddetail",
handler: function (button, event) {
this.MakeFee(button, event, 1);
},
scope: this
}*/],
columns: this.girdcolums
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeBodyList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
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 = "";
if (record.data.OPLBNAME == "报关业务") {
openUrl = "../MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.BSNO;
} else {
openUrl = "../MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
}
window.open(openUrl, openType, openSet);
}, this);
//#endregion
//#region 添加明细
this.storeAddList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOp_BLISSUEmb',
remoteSort: true,
//groupField: 'GroupDate',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/MsOp_BLISSUE/GetDataList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.column_Add = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 60
},
{
sortable: true,
dataIndex: 'BLNO',
header: '主提单号',
width: 140
},
{
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 140
},
{
sortable: true,
dataIndex: 'ZDFD',
header: '主/分单',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLNAME',
header: 'BLNAME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLSTATUS',
header: 'BLSTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BLORDERNO',
header: 'BLORDERNO',
width: 80
},
{
sortable: true,
dataIndex: 'ISSUETYPE',
header: '签单方式',
width: 80
},
{
sortable: true,
dataIndex: 'OPNAME',
header: '最近操作人',
width: 80
},
{
sortable: true,
dataIndex: 'OPTIME',
header: '操作时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSINKNO',
header: 'BSINKNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELFLAG',
header: 'DELFLAG',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'EXPRESSCORP',
header: 'EXPRESSCORP',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'EXPRESSNO',
header: 'EXPRESSNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ISADD',
header: 'ISADD',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PUTSINGLETIME',
header: 'PUTSINGLETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PUTSINGLE',
header: 'PUTSINGLE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYTIME',
header: 'PAYTIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYRMB',
header: 'PAYRMB',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PAYUSD',
header: 'PAYUSD',
width: 80
},
{
sortable: true,
dataIndex: 'BLTYPE',
header: '装运方式',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
},
{
sortable: true,
dataIndex: 'STLNAME',
header: '结算方式',
width: 80
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'STLDATE',
header: '结算日期',
width: 80
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 80
},
{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
},
{
sortable: true,
dataIndex: 'BLISSUESTATUS',
header: '提单签发状态',
width: 80
},
{
sortable: true,
dataIndex: 'TSFD',
header: '特殊放单',
width: 80
},
{
sortable: true,
dataIndex: 'XYTS',
header: '协议天数',
width: 80
},
{
sortable: true,
dataIndex: 'CQTS',
header: '超期天数',
width: 80
},
{
sortable: true,
dataIndex: 'SJTS',
header: '实际天数',
width: 80
},
{
sortable: true,
dataIndex: 'TTLNODR',
header: '业务应收',
width: 80
}
];
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
selModel: this.AddGridCheckBoxModel,
disableSelection: false,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
tbar: [{
text: '添加明细',
tooltip: '添加明细',
id: 'btnadddetail',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddSP(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnSaveTable2",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.gridAddList.columns;
DsTruck.SaveGridPanel(USERID, this.formname + 'add', tempcolumns, this.column_Add, 1, true);
},
scope: this
}],
columns: this.column_Add,
plugins: [
//this.cellEditing
],
/*features: [{
id: 'group',
ftype: 'grouping',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: true
}],*/
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.column_Add = DsTruck.GetGridPanel(USERID, this.formname + 'add', this.column_Add, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridAddList.reconfigure(this.storeAddList, this.column_Add);
this.gridAddList.columns[0] = new Ext.grid.RowNumberer();
_this = this;
//#region formSearch
//#region formSearch枚举参照相关
this.storeBLSTATUS = Ext.create('Ext.data.Store', {
fields: ['BLSTATUS']
});
this.storeBLSTATUS.add({ "BLSTATUS": "录入状态" });
this.storeBLSTATUS.add({ "BLSTATUS": "提交审核" });
this.storeBLSTATUS.add({ "BLSTATUS": "审核通过" });
this.storeBLSTATUS.add({ "BLSTATUS": "驳回提交" });
this.comboxBLSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '特殊放单审请状态',
store: this.storeBLSTATUS,
forceSelection: true,
name: 'BLSTATUS',
valueField: 'BLSTATUS',
displayField: 'BLSTATUS',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
}
}
});
this.StoreOpLb = Ext.create('Ext.data.Store', {
fields: ['OPLBNAME']
});
this.StoreOpLb.add({ "OPLBNAME": "海运出口" });
this.StoreOpLb.add({ "OPLBNAME": "海运进口" });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类别',
store: this.StoreOpLb,
valueField: 'OPLBNAME',
displayField: 'OPLBNAME',
labelWidth: 80,
forceSelection: true,
name: 'OPLBNAME',
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/GetUserLinkRefListRm' }
});
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人', //'揽货人',
store: this.storeSaleCode,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
labelWidth: 45,
name: 'SALE',
flex: 0.6,
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作', //'操 作',
store: this.storeOpCode,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
labelWidth: 30,
forceSelection: true,
name: 'OP',
flex: 0.6, valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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,
labelWidth: 80,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
//var data = combo.value;
//this.formEdit.getForm().findField('SALER').setValue(records[0].data.SALE);
}
}
}
});
//#endregion
this.formSearch_SP = Ext.widget('form', {
frame: true,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth:40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '编号',
name: 'MBLNO',
flex: 0.6,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick_Add();
}
}
}
}, this.comboxOpLb
, this.comboxCustCode, {
fieldLabel: '从开船日期',
labelWidth: 85,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD_BGN',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick_Add();
}
}
}
}, {
fieldLabel: '到开船日期',
labelWidth: 85,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD_END',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick_Add();
}
}
}
}, this.comboxOP, this.comboxSALE, {
xtype: 'button',
width: 90,
// flex: 0.5,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick_Add(button, event);
},
scope: this
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//#region 后续货物
this.storeBillList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChFeedoBill',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/MvcShipping/MsOp_BLISSUE/GetBLListData',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdcolumsbill = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 120
}, {
sortable: true,
id: '',
align: 'center',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',
width: 60,
renderer: function (value, cellmeta) {
if (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 == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
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';
}
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';
}
return value;
}
}, {
sortable: true,
dataIndex: 'OPSTATUS',
header: '费用状态',
width: 180
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '集装箱',
width: 120
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}, {
sortable: true,
dataIndex: 'CUSTOMSNUM',
header: '报关项数',
width: 60
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 60
}, {
sortable: true,
dataIndex: 'KGS',
header: '重量',
width: 60
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 60
}
];
this.girdcolumsbill = this.initgirdcolumsbill;
_this = this;
this.gridBillList = new Ext.grid.GridPanel({
store: this.storeBillList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
viewConfig: {
enableTextSelection: true
},
disableSelection: false,
tbar: [{
text: "保存列表样式",
id: "btntestbody",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.girdcolumsbill = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridBillList.columns, _this.girdcolumsbill, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.girdcolumsbill = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridBillList.columns, _this.initgirdcolumsbill, 1, true);
}
}],
scope: this
}],
columns: this.girdcolumsbill,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBillList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有要审核的数据"
})]
});
this.girdcolumsbill = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdcolumsbill, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridBillList.reconfigure(this.storeBillList, this.girdcolumsbill);
this.gridBillList.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 = "";
openUrl = "../../MvcShipping/MsOpSeae/EditView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
// DsOpenEditWin("/TruckMng/MsWlPc/Edit");
}, this);
this.storeBillList.on('beforeload', function (store) {
var _thisCUSTOMERNAME = Ext.getCmp("thisCUSTOMERNAME").getValue();
var sql = "CUSTOMERNAME='" + _thisCUSTOMERNAME
+ "' and isnull(op_seae.ISCANCEL,0)<>1 AND NOT EXISTS (SELECT 1 FROM op_blissue WHERE op_seae.BSNO=op_blissue.BSNO and op_blissue.BLSTATUS='提单签出') "
+ " AND NOT EXISTS (SELECT 1 FROM v_op_blissuelist_Detail d WHERE op_seae.BSNO=d.BSNO and d.BLSTATUS='审核通过') ";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.panelBillList = new Ext.Panel({
layout: "border",
region: 'east',
title: '此客户未签单业务',
width: 420,
split: true,
margin: '2 2',
items: [this.gridBillList]
});
//#endregion
//#region 明细表-附件管理
this.storeReceiptid = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptid.load({ params: { enumTypeId: 2} });
this.comboxReceiptid = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeReceiptid,
name: 'RECEIPTTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//明细表-数据集
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'MsUploadFile',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOp_BLISSUE/GetFileList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing_Doc = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CBM_Doc = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'west',
width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing_Doc],
selModel: this.CBM_Doc,
selType: 'cellmodel',
tbar: [{
text: '添加',
tooltip: '添加',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '保存',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}, '-', {
text: '打印附件',
tooltip: '打印附件',
iconCls: "btnprint",
handler: function (button, event) {
this.onPrintFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: '单据号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'PID',
header: '单据号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FILEPATH',
header: '文件路径',
// hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FILETYPE',
header: '文件类型',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FILENAME',
header: '附件名称',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 160
}
]
});
this.gridDocList.getSelectionModel().on('select', function (model, record, index) {
if (this.Loading == true) {
return;
}
var PICURL = record.data.FILEPATH;
Ext.getCmp('panelPic').body.update(' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + PICURL + '"> </iframe>');
}, this);
//#endregion
//#region 布局
//控件布局
this.panelService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridList]
});
this.panelPic = new Ext.Panel({
id: "panelPic",
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + this.PICURL + '"> </iframe>'//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg
});
this.panelAddfee = new Ext.Panel({
layout: "border",
region: 'east',
width: 400,
split: true,
margin: '2 2',
items: [this.formInfo_2]
});
this.paneldetail = new Ext.Panel({
//title: '',
layout: "border",
height: 240,
region: "north",
split: true,
items: [
this.panelService, this.panelBillList
]
});
this.panelAddService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridAddList]
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
height: 300,
items: [this.panelAddService
]
});
this.paneladd = new Ext.Panel({
title: '添加申请明细',
layout: "border",
// region: 'south',
region: "center",
// height: 420,
items: [
this.formSearch_SP, this.paneladddetail
]
});
var _this = this;
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
split: true,
items: [this.paneladd, this.panelaccdetail
],
listeners: {
tabchange: function (tp, p) {
if (p.title == '认款/确认核销') {
}
}
}
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 185,
items: [this.panelBtn, this.formEdit]
});
this.page1 = new Ext.Panel({
layout: "border", title: "特殊放单业务明细",
region: "center",
items: [this.paneldetail, this.MainTab]
});
this.page2 = new Ext.Panel({
layout: "border", title: "相关附件",
region: "center",
items: [this.gridDocList, this.panelPic
]
});
this.tabBottom = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
//border: true,
frame: false,
region: 'center',
//enableTabScroll: true,
items:
[
this.page1
, this.page2
]
});
Ext.apply(this, {
items: [this.panelTop, this.tabBottom]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
if (this.bsnosql != undefined) {
this.opStatus = 'add'
this.LoadData(this.opStatus,'1=2');
} else this.InitData();
//绑定事件
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
if (this.opStatus == 'Audit') {
billno = this.editRecord.get('SALESNO');
};
this.storeBodyList.on('beforeload', function (store) {
var sql = " BILLNO='" + billno + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeAddList.on('beforeload', function (store) {
var sql = this.getCondition_Add();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
}
}, this);
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
var bsno = record.data.BSNO;
var feeobjname = record.data.FEEOBJNAME;
var sql = "";
sql = " BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
//this.storeAddFeeList.load({ params: { condition: sql} });
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.DetailAfterEdit(editor, e, eOpts);
}, this);
this.formReason = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
fieldLabel: '备注', id: "REASON",
xtype: 'textfield',
name: 'REASON', width: 400,
listeners: {
change: function (field, eOpts) {
if (field.lastValue != "") {
//this.formHead.getForm().findField('STOCKDATE_1').setValue(field.rawValue);
}
},
scope: this
}
}]
});
this.formReason2 = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
fieldLabel: '备注', id: "REASON2",
xtype: 'textfield',
name: 'REASON', width: 400,
listeners: {
change: function (field, eOpts) {
if (field.lastValue != "") {
//this.formHead.getForm().findField('STOCKDATE_1').setValue(field.rawValue);
}
},
scope: this
}
}]
});
var _this2 = this;
this.winAuditShow = Ext.create('Ext.window.Window', {
id: "winAuditShow",
title: "审核通过",
width: 450,
//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.formReason],
buttons: [
{
text: "确定",
minWidth: 70,
handler: function () {
_this2.onSP_AuditClick(Ext.getCmp("REASON").getRawValue());
}
}, {
text: "取消",
minWidth: 70,
handler: function () {
_this2.winAuditShow.Close();
}
}]
});
this.winAuditBackShow = Ext.create('Ext.window.Window', {
id: "winAuditBackShow",
title: "驳回申请",
width: 450,
//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.formReason2],
buttons: [
{
text: "确定",
minWidth: 70,
handler: function () {
_this2.onSP_AuditBackClick(Ext.getCmp("REASON2").getRawValue());
}
}, {
text: "取消",
minWidth: 70,
handler: function () {
_this2.winAuditShow.Close();
}
}]
});
var btnAudit = Ext.getCmp('SP_Audit');
var btnAuditBack = Ext.getCmp('SP_AuditBack');
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: 'MsOp_BLISSUE_SP'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
btnAudit.setVisible(true);
btnAuditBack.setVisible(true);
} else {
btnAudit.setVisible(false);
btnAuditBack.setVisible(false);
}
}
},
scope: this
});
var btnMNGAuditPass = Ext.getCmp('MNGSP_Audit');
var btnMNGAuditBack = Ext.getCmp('MNGSP_AuditBack');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "MNGSP_AUDIT"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnMNGAuditPass.setVisible(false);
btnMNGAuditBack.setVisible(false);
} else {
btnMNGAuditPass.setVisible(true);
btnMNGAuditBack.setVisible(true);
}
} else {
}
},
scope: this
});
this.LoadMustBe();
//累积选中的“本次核销金额”
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
//this.CWAuditSales = ret[3];
}
if (this.opStatus == 'edit')
condition = " ob.GID='" + this.editRecord.get('GID') + "'";
else condition = " 1=2 "
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
_this = this;
Ext.Ajax.request({
async: false,
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOp_BLISSUE/GetSPData',
params: {
handle: opstatus,
condition: condition
},
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;
if (data.SALESDATE == "") { data.SALESDATE = currdate.format('yyyy-MM-dd') };
if (data.OP == "") { data.OP = USERNAME };
if (data.BSSTATUS == "") { data.BSSTATUS = "0" };
if (data.FEESTATUS == "") { data.FEESTATUS = "0" };
if (data.PREPAYMENT == "") { data.PREPAYMENT = "0" };
if (data.FUNDRATE == "") { data.FUNDRATE = "0" };
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.GetEditStatus();
if (data.CUSTOMERNAME != '') {
this.storeBillList.load({
params: { start: 0, limit: 100, sort: '', condition: "CUSTOMERNAME='" + data.CUSTOMERNAME
+ "' and isnull(op_seae.ISCANCEL,0)<>1 AND NOT EXISTS (SELECT 1 FROM op_blissue WHERE op_seae.BSNO=op_blissue.BSNO and op_blissue.BLSTATUS='提单签出') "
+ " AND NOT EXISTS (SELECT 1 FROM v_op_blissuelist_Detail d WHERE op_seae.BSNO=d.BSNO and d.BLSTATUS='审核通过') "
}
});
}
billno = data.GID;
this.storeDocList.load({ params: { PID: billno} });
this.SetBtnEnable(data);
if (this.bsnosql != undefined && this.bsnosql !='') {
var sql = " not exists (select 1 from op_blissueList_Detail ob1 where ob1.bsno=B.bsno) and isnull(ob.BLSTATUS,'')<>'提单签出' ";
sql = sql + " and B.bsno='" + this.bsnosql + "' "
this.storeAddList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
_this.gridAddList.getSelectionModel().selectAll();
_this.onAddSP();
} else {
Ext.MessageBox.alert('提示', '无添加申请费用明细!');
}
}
}
});
//this.bsnosql = '';
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
if (this.opStatus == 'edit' && this.bsnosql == undefined) {
GID = this.editRecord.get('GID');
this.storeBodyList.load({ params: { condition: " obd.LINKGID='" + GID + "'" },
callback: function (r, options, success) {
if (success) {
if (this.storeBodyList.getCount() > 0) {
// this.HTH = this.storeBodyList.getAt(0).data.HTH;
}
else {
//this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
};
if (this.opStatus == 'add') {
this.storeBodyList.removeAll();
};
//this.storeBodyList.load({ params: { condition: " obd.LINKGID='" + GID + "'" },
// callback: function (r, options, success) {
// if (success) {
// if (this.storeBodyList.getCount() > 0) {
// this.HTH = this.storeBodyList.getAt(0).data.HTH;
// }
// else {
// //this.comboxCustCode.setReadOnly(false);
// }
// }
// },
// scope: this
//});
}, // end LoadDate
SetBtnEnable: function (data) {
var BLSTATUS = this.formEdit.getForm().findField('BLSTATUS').getValue();
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btndeldetail = Ext.getCmp('btndeldetail');
var btnadddetail = Ext.getCmp('btnadddetail');
var btnSP_Start = Ext.getCmp('SP_Start');
var btnSP_Back = Ext.getCmp('SP_Back');
var btnSP_Start_Save = Ext.getCmp('SP_Start_Save');
if (BLSTATUS == '录入状态') {
btnESave.enable();
btnESaveAndClose.enable();
btndeldetail.enable();
btnadddetail.enable();
btnSP_Start.enable();
btnSP_Back.disable();
btnSP_Start_Save.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btndeldetail.disable();
btnadddetail.disable();
btnSP_Start.disable();
btnSP_Back.enable();
btnSP_Start_Save.disable();
}
var btnAudit = Ext.getCmp('SP_Audit');
var btnAuditBack = Ext.getCmp('SP_AuditBack');
var btnMNGAuditPass = Ext.getCmp('MNGSP_Audit');
var btnMNGAuditBack = Ext.getCmp('MNGSP_AuditBack');
var MNGBLSTATUS = this.formEdit.getForm().findField('MNGBLSTATUS').getValue();
if (BLSTATUS == '提交审核') {
btnAudit.enable();
btnAuditBack.disable();
btnMNGAuditPass.disable();
btnMNGAuditBack.disable();
btnSP_Start.disable();
btnSP_Back.enable();
btnSP_Start_Save.disable();
} else if (BLSTATUS == '审核通过') {
btnAudit.disable();
btnSP_Start.disable();
btnSP_Back.disable();
btnSP_Start_Save.disable();
if (MNGBLSTATUS == '录入状态') {
btnAuditBack.enable();
btnMNGAuditPass.enable();
btnMNGAuditBack.enable();
} else if (MNGBLSTATUS == '审核通过') {
btnAuditBack.disable();
btnMNGAuditPass.disable();
btnMNGAuditBack.enable();
} else {
btnAuditBack.enable();
btnMNGAuditPass.enable();
btnMNGAuditBack.disable();
}
}
},
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
async: false,
url: '/MvcShipping/MsOp_BLISSUE/SaveSP',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data)/*,
SaleDetailList: jsonDetailBody*/
},
callback: function (options, success, response) {
if (success) {
//this.feeBodyDel = [];
//this.storeBodyChFee.commitChanges();
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this._thisGID2 = returnData.GID;
//this.storeBodyList.commitChanges();
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
//_thisGID2 = returnData.data.GID;
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOp_BLISSUEListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
//this.storeBodyList.load({ params: { condition: " s.SaleSNO='" + this.editRecord.get("SALESNO") + "'"} });
this.storeBodyList.load({ params: { condition: " obd.LINKGID='" + this.editRecord.get("GID") + "'"} });
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
} 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
onAddDetailClick: function (button, event) {
this.addstore = true;
this.addDetail();
}, //end onAddDetailClick
onAddBillClick: function (button, event) {
this.addstore = true;
this.addBill();
}, //end onAddDetailClick
onDelDetailClick: function (button, event, type) {
this.deleteDetail();
}, //onDelDetailClick
onAddSP: function (button, event) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var _thisGID = this._thisGID2; //Ext.getCmp("thisGID").getValue();
var _thisCUSTOMERNAME = Ext.getCmp("thisCUSTOMERNAME").getValue();
var bodyList = [];
var selectedRecords = this.gridAddList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (_thisCUSTOMERNAME == "" || _thisCUSTOMERNAME == rec.data.CUSTOMERNAME) {
Ext.getCmp("thisCUSTOMERNAME").setValue(rec.data.CUSTOMERNAME);
if (rec.data.ISSUETYPE == '') {
Ext.Msg.show({ title: '提示', msg: '签单方式为空,不允许申请特放!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else
bodyList.push(rec);
} else {
alert("只能添加相同委托单位的业务");
return;
}
}
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
async: false,
url: '/MvcShipping/MsOp_BLISSUE/SaveSP',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data)/*,
SaleDetailList: jsonDetailBody*/
},
callback: function (options, success, response) {
if (success) {
//this.feeBodyDel = [];
//this.storeBodyChFee.commitChanges();
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this._thisGID2 = returnData.GID;
//this.storeBodyList.commitChanges();
if (this.bsnosql != undefined) {
} else {
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
//_thisGID2 = returnData.data.GID;
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOp_BLISSUEListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
}
var _thisGID = this._thisGID2; //Ext.getCmp("thisGID").getValue();
var _thisCUSTOMERNAME = Ext.getCmp("thisCUSTOMERNAME").getValue();
var bodyList = [];
var selectedRecords = this.gridAddList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (_thisCUSTOMERNAME == "" || _thisCUSTOMERNAME == rec.data.CUSTOMERNAME) {
Ext.getCmp("thisCUSTOMERNAME").setValue(rec.data.CUSTOMERNAME);
bodyList.push(rec);
} else {
alert("只能添加相同委托单位的业务");
return;
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == "") {
return;
}
// this.Save("0");
Ext.Msg.wait('正在提交数据...');
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/ADDSP2',
params: {
LINKGID: _thisGID,
data: jsonBody
},
callback: function (options, success, response) {
Ext.Msg.hide();
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisGID = Ext.getCmp("thisGID").getValue();
condition = " ob.GID='" + _thisGID + "'";
this.LoadData("edit", condition);
this.storeBodyList.load({ params: { condition: " obd.LINKGID='" + _thisGID + "'"} });
this.onRefreshClick_Add(button, event);
}
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
} 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
});
}
}
});
} //onDeleteClick
,
onDeleteClick: function (button, event) {
var MainList = "";
var GID = "";
var _thisGID = Ext.getCmp("thisGID").getValue();
formEdit = this.formEdit.getForm();
//var SALESNO = formEdit.findField('SALESNO').getValue();
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('GID') + "'"; }
else {
MainList = MainList + ",'" + rec.get('GID') + "'";
}
}
var formEdit = this.formEdit.getForm();
//var SALESNO = formEdit.findField('SALESNO').getValue();
if (MainList == "") {
return;
}
else
Ext.MessageBox.confirm('提示', '确定删除这些记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOp_BLISSUE/DeleteDetail',
params: {
LINKGID: _thisGID,
GIDList: MainList
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
condition = " ob.GID='" + _thisGID + "'";
this.LoadData("edit", condition);
this.storeBodyList.load({ params: { condition: " obd.LINKGID='" + _thisGID + "'" }
,
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyList.getCount() == 0) {
Ext.getCmp("thisCUSTOMERNAME").setValue("");
//formEdit.findField('CUSTOMERNAME').setvalue("");
this.storeBillList.removeAll();
}
}
},
scope: this
});
//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 });
}
Ext.Msg.hide();
}
},
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);
}, //end onAddDetailClick
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
//alert(canedit);
return canedit;
},
onNextKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) + 1;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onUpKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) - 1;
if (number < 0) number = 0;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onClearSql: function () {
var form = this.formSearch_SP.getForm();
form.reset();
},
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modImportSales",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
if (this.OPERATERANGE == "0" || this.OPERATERANGE == "2" || this.OPERATERANGE == "3") {
this.setSaveBtnStatus(true);
} else {
this.setSaveBtnStatus(false);
}
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
/*
this.StoreOpRange.load({ params: { optype: "modImportSales" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
if (bsStatus == 1||bsStatus == 6)
btnESubmitAudit.enable();
else
btnESubmitAudit.disable();
if (bsStatus == 2)
btnESubmitAuditBack.enable();
else
btnESubmitAuditBack.disable();
} else {
canedit = false;
btnESubmitAudit.disable();
btnESubmitAuditBack.disable();
}
if ((bsStatus != 1) && (bsStatus != 6)) {
_this.setSaveBtnStatus(false);
} else {
_this.setSaveBtnStatus(canedit);
}
}
}
}
});
*/
},
setSaveBtnStatus: function (enable) {
/*
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}*/
},
// #endregion
//合计选中的费用数字和
getCustName: function () {
var custName = this.formEdit.getForm().findField('CUSTOMERNAME');
return custName.getValue();
},
getCondition_Add: function () {
var form = this.formSearch_SP.getForm();
var sql = " not exists (select 1 from op_blissueList_Detail ob1 where ob1.bsno=B.bsno) and isnull(ob.BLSTATUS,'')<>'提单签出' ";
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, " (B.MBLNO like '%" + MBLNO + "%' or B.HBLNO like '%" + MBLNO + "%' or B.CUSTNO like '%" + MBLNO + "%') ");
// var CUSTNO = form.findField('CUSTNO').getValue();
// sql = sql + getAndConSql(sql, CUSTNO, " B.CUSTNO like '%" + CUSTNO + "%' ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " B.CUSTOMERNAME='" + CUSTOMERNAME + "' ");
var ETD_BGN = form.findField('ETD_BGN').getRawValue();
sql = sql + getAndConSql(sql, ETD_BGN, " B.ETD>='" + ETD_BGN + "'");
var ETD_END = form.findField('ETD_END').getRawValue();
sql = sql + getAndConSql(sql, ETD_END, " B.ETD<='" + ETD_END + " 23:59:59'");
var OPLBNAME = form.findField('OPLBNAME').getValue();
sql = sql + getAndConSql(sql, OPLBNAME, " B.OPLBNAME = '" + OPLBNAME + "' ");
//操作人
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "B.OP='" + OP + "'");
//揽货人
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
return sql;
},
onRefreshClick_Add: function (button, event) {
//if (!this.checkSearchCondition())
//return;
var sql = this.getCondition_Add();
this.storeAddList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//}
}
//添加附件
, onAddFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('GID').value;
var myDate = new Date();
var record = Ext.create('MsUploadFile', {
GID: NewGuid(),
PID: '*',
UPLOADEMPLY: SHOWNAME,
UPLOADDATE: myDate,
FILETYPE: '特殊放单附件',
FILEPATH: '',
FILENAME: ''
});
this.storeDocList.add(record);
var n = this.storeDocList.getCount();
this.gridListCellEditing_Doc.startEditByPosition({ row: n - 1, column: 5 });
}
, onPostFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('GID').value;
var bodyDatas = [];
var i;
for (i = 0; i < this.storeDocList.getCount(); i += 1) {
var memberyf = this.storeDocList.getAt(i);
bodyDatas.push(memberyf);
var FILENAME = memberyf.data.FILENAME;
if (FILENAME == '') {
Ext.Msg.show({ title: '警告',
msg: '文件名称不能为空',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_BLISSUE/SaveFile',
scope: this,
params: {
bsno: billno,
body: jsonBody
},
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.storeDocList.getCount(); i += 1) {
var member = this.storeDocList.getAt(i);
member.set("PID", billno);
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
, onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.CBM_Doc.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.PID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOp_BLISSUE/DeleteUploadFile',
params: {
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeDocList.remove(selectedRecords[i]);
}
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
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('GID').value;
var selections = this.gridDocList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要上传的证件名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var PID = record.data.PID;
if (PID == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存附件,再上传!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GID = record.data.GID;
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadImage',
name: 'LoadImage',
emptyText: '请选择图片',
fieldLabel: '图片',
buttonText: '选择文件',
allowBlank: false,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadImage').getValue();
if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOp_BLISSUE/UploadFile',
waitMsg: '正在上传',
method: 'POST',
params: {
fileGid: GID
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
me.storeDocList.load({ params: { PID: billno} });
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传图片",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
, onPrintFileClick: function (button, event) {
selectedRecords = this.CBM_Doc.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的证件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sql1 = "";
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
if (feeGidSql != '') {
sql1 = " Select * from info_files where Gid in (" + feeGidSql + ") ";
}
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm('DriverFilePrint', sql1, sql2, sql3, sql4, sql5, sql6);
}
, onSP_StartClick: function (optype) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/SP_Start',
params: {
USERID: USERID,
data: JSNODATA
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
if (optype == '1') {
this.LoadData('add', '');
} else {
this.SetBtnEnable();
}
}
},
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
}
, onSP_BackClick: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在撤销提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/SP_Back',
params: {
USERID: USERID,
data: JSNODATA
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.SetBtnEnable();
}
}
},
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
},
onSP_AuditClick: function (REASON) {
//this.onSaveClick();
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/SP_Audit',
params: {
USERID: USERID,
data: JSNODATA,
REASON: REASON
},
callback: function (options, success, response) {
if (success) {
this.winAuditShow.close();
Ext.getCmp("REASON").setValue("");
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.SetBtnEnable();
}
}
},
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
}
, onSP_AuditBackClick: function (REASON) {
//this.onSaveClick();
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/SP_AuditBack',
params: {
USERID: USERID,
data: JSNODATA,
REASON: REASON
},
callback: function (options, success, response) {
if (success) {
this.winAuditBackShow.close();
Ext.getCmp("REASON2").setValue("");
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.SetBtnEnable();
}
}
},
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
}
, onMNGSP_AuditClick: function () {
//this.onSaveClick();
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/MNGSP_Audit',
params: {
USERID: USERID,
data: JSNODATA
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.SetBtnEnable();
}
}
},
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
}
, onMNGSP_AuditBackClick: function () {
//this.onSaveClick();
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var JSNODATA = "[" + Ext.JSON.encode(data) + "]";
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsOp_BLISSUE/MNGSP_AuditBack',
params: {
USERID: USERID,
data: JSNODATA
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.SetBtnEnable();
}
}
},
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
},
LoadMustBe: function () {
this.storeMustBe.load({
params: { condition: "BSTYPE='特殊放单申请'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount() ; j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('GID').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var CUSTOMERNAME = basicForm.findField('CUSTOMERNAME').value;
var printType = 'MsOp_BLISSUESPEdit_Form';
var sql1 = " select ob.GID,ob.BLSTATUS,(select BLSTATUS from op_blissue where bsno=ob.BSNO) BL_BLSTATUS";
sql1 = sql1 + " ,ob.BSNO,ob.OPNAME,dbo.trimdate(ob.OPTIME) OPTIME,ob.REMARK,ob.SPREMARK, ";
sql1 = sql1 + " CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=ob.CUSTOMERNAME)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER,ob.STLNAME,ob.SALEDEPT,ob.ISDEPTARREARS,ob.MNGBLSTATUS ";
sql1 = sql1 + " ,ob.CUSTOMERNAME,g.MBLNO,g.HBLNO,g.ETD,g.VESSEL,g.VOYNO ";
sql1 = sql1 + " ,convert(bigint ,ob.TimeMark) as TimeMark,ob.RMBNODR,ob.USDNODR,ob.TTLNODR ";
sql1 = sql1 + " ,isnull(dp.MAXARREARS,0) MAXARREARS,isnull((select sum(TTLDR-STLTTLDR) from v_op_gain_sum where EXISTS (select 1 from v_op_blissuelist_Detail bl";
sql1 = sql1 + " where v_op_gain_sum.BSNO=bl.bsno and bl.BLSTATUS='审核通过' and bl.MNGBLSTATUS<>'审核通过' AND SALEDEPT=ob.SALEDEPT and ";
sql1 = sql1 + " not exists (select 1 from v_op_seae_iscargo i where bl.customername=i.customername))),0) AS DEPTTTLNODR ";
sql1 = sql1 + " from op_blissuelist ob ";
sql1 = sql1 + " left join v_op_blissue_bill g on g.bsno=ob.bsno ";
sql1 = sql1 + " left join workflow_using wu on wu.bsno=ob.GID ";
sql1 = sql1 + " left join SYS_DEPT_ARREARS dp on dp.DEPT=ob.SALEDEPT ";
sql1 = sql1 + " WHERE ob.GID='" + billNo + "' ";
var sql2 = " select obd.GID,B.BSNO,B.mblno BLNO,B.HBLNO ";
sql2 = sql2 + " ,B.OPTYPE ZDFD ";
sql2 = sql2 + " ,ob.BLNAME,ob.BLSTATUS,ob.BLORDERNO ";
sql2 = sql2 + " ,B.ISSUETYPE ";
sql2 = sql2 + " ,ob.OPNAME,ob.OPTIME,ob.BSINKNO,ob.ISVESSELPROVE,ob.VESSELPROVETIME,ob.VESSELPROVEREMARK ";
sql2 = sql2 + " ,ob.REMARK,ob.DELFLAG,ob.EXPRESSCORP,ob.EXPRESSNO,ob.ISADD,dbo.trimdate(ob.PUTSINGLETIME) PUTSINGLETIME ";
sql2 = sql2 + " ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD,obd.SPREMARK SPREMARK ";
sql2 = sql2 + " ,B.BLTYPE,B.CUSTNO,B.customername,B.sale ";
sql2 = sql2 + " ,(select top 1 acctype from info_client_accdate where LINKGID=(select top 1 gid from info_client where SHORTNAME=B.customername) ";
sql2 = sql2 + " and BGNDATE<=B.ETD and ENDDATE>B.ETD and (isnull(SALE,'')='' or SALE=B.SALE)) acctype ";
sql2 = sql2 + " ,dbo.trimdate(B.ETD) ETD,dbo.trimdate(B.STLDATE) STLDATE,B.CARRIER,B.VESSEL,B.VOYNO,B.OP ";
sql2 = sql2 + " ,B.BLISSUESTATUS ";
sql2 = sql2 + " ,obd.BLSTATUS TSFD ";
sql2 = sql2 + " ,DATEDIFF(day,B.ETD,B.STLDATE) XYTS ";
sql2 = sql2 + " ,datediff(day,B.STLDATE,getdate()) cqts ";
sql2 = sql2 + " ,DATEDIFF(day,B.ETD,getdate()) SJTS ";
sql2 = sql2 + " ,g.RMBNODR ";
sql2 = sql2 + " ,g.USDNODR ";
sql2 = sql2 + " ,g.TTLNODR ";
sql2 = sql2 + " ,g.TTLDR ";
sql2 = sql2 + " ,B.OPLBNAME,B.STLNAME ";
sql2 = sql2 + " from v_op_blissue_bill B ";
sql2 = sql2 + " left join op_blissue ob on ob.BSNO=B.BSNO ";
sql2 = sql2 + " left join v_op_blissuelist_Detail obd on obd.BSNO=B.BSNO ";
sql2 = sql2 + " left join v_op_bill_gain g on g.BSNO=B.BSNO ";
sql2 = sql2 + " where obd.LINKGID='" + billNo + "'";
// var sql3 = " select * from company where gid=(select top 1 companyid from ch_fee_do where BILLNO='" + billNo + "') ";
var sql3 = "";
var sql4 = "select '" + madedate + "' as madedate,(select DESCRIPTION from info_client where SHORTNAME='" + CUSTOMERNAME + "') as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});