Ext.namespace('Shipping');
Shipping.MsCwVouchersGlBaoxiao2Index = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlBaoxiao2Index.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwVouchersGlBaoxiao2Index, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 0,
OPERATERANGE: 0,
initUIComponents: function () {
this.formname = "OA_Baoxiao";
this.WorkFlowName = "BaoxiaoMod";
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'Baoxiaomb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/GetDataList',
reader: {
idProperty: 'BXGID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.column = [{
sortable: true,
//hidden: true,
dataIndex: 'BXGID', id: "BXGID",
header: '报销单序列号',
width: 100
}, {
sortable: true,
hidden: true,
dataIndex: 'BXNO', id: "BXNO",
header: '报销单号',
width: 100
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO', id: "BSNO",
header: '委托编号',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'COMPANY', id: "COMPANY",
header: '所属公司',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTNAME', id: "DEPTNAME",
header: '部门',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEUSER', id: "CREATEUSER",
header: '报销人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEDATE', id: "CREATEDATE",
header: '报销日期',
width: 80
}, {
sortable: true,
dataIndex: 'RMBAMOUNT',
header: 'RMB金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'USDAMOUNT',
header: 'USD金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'OTHERAMOUNT',
header: '其他金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'ISDELETE', id: "ISDELETE",
header: 'ISDELETE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETEUSER', id: "DELETEUSER",
header: 'DELETEUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETETIME', id: "DELETETIME",
header: 'DELETETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BXSTATUS', id: "BXSTATUS",
header: 'BXSTATUS',
width: 80
},
{
sortable: true,
dataIndex: 'BXSTATUS_REF', id: "BXSTATUS_REF",
header: '报销状态',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK', id: "REMARK",
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'ISVOU_REF',
id: "ISVOU_REF",
header: '已生成凭证',
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '接口凭证号',
width: 100
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '总账凭证号',
width: 150
},
{
sortable: true,
dataIndex: 'ISJK', id: "ISJK",
header: '费用来源',
width: 60
},
{
sortable: true,
dataIndex: 'AUDITOR', id: "AUDITOR",
header: '审核人',
width: 100
},
{
sortable: true,
dataIndex: 'AUDITTIME', id: "AUDITTIME",
header: '审核时间',
width: 100
},
{
sortable: true,
dataIndex: 'FEEREMARK', id: "FEEREMARK",
header: '报销事由',
width: 100
}];
//定义Grid
//this.BXCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.BXCB = Ext.create('Ext.selection.CheckboxModel');
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 45
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
selModel: this.BXCB,
columns: [new Ext.grid.RowNumberer()],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id,表名 ,中间column数组,跳过一开始的几列
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/MvcShipping/MsCwVouchersGlBaoxiao2/Edit", "", "750", "900", "200", "400");
}, this);
//#region formSearch
this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.DEPTRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDEPT.load({ params: { condition: ""} });
this.comboxDEPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '部门',
store: this.storeDEPT,
name: 'DEPTID', id: "DEPTID",
valueField: 'GID',
displayField: 'DeptName'
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storeUser,
name: 'CREATEUSER',
valueField: 'UserCode',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.comboxUser_1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报销人',
store: this.storeUser,
name: 'CREATEUSER', id: "CREATEUSER_1",
valueField: 'UserName',
displayField: 'CodeAndName'
});
Ext.define('BXSTATUSmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'status', type: 'string' },
{ name: 'statusRef', type: 'string' }
]
});
var StatusData = [{ "status": "0", "statusRef": "审核通过" },
{ "status": "1", "statusRef": "录入状态" },
{ "status": "2", "statusRef": "提交审核" },
{ "status": "6", "statusRef": "驳回提交"}];
this.storeStauts = Ext.create('Ext.data.Store', {
model: 'BXSTATUSmb',
data: StatusData
});
this.comboxStatus = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '报销单状态',
autosize: true,
bodyPadding: 5,
flex: 2, name: 'BXSTATUS',
width: 500,
labelWidth: 90,
store: this.storeStauts,
queryMode: 'local',
triggerOnClick: false,
valueField: 'status',
displayField: 'statusRef'
});
Ext.define('ISPAYEDmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'ISPAYED', type: 'string' }
]
});
var ISPAYEDData = [{ "ID": "0", "ISPAYED": "全部" },
{ "ID": "1", "ISPAYED": "已支付" },
{ "ID": "2", "ISPAYED": "未支付"}];
this.storeISPAYED = Ext.create('Ext.data.Store', {
model: 'ISPAYEDmb',
data: ISPAYEDData
});
this.comboxISPAYED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '支付状态',
store: this.storeISPAYED,
name: 'ISPAYED', //id: "ISPAYED",
valueField: 'ID',
displayField: 'ISPAYED'
});
this.storeWorkFlowStep = Ext.create('DsExt.ux.RefTableStore', {
model: 'WorkFlowStepmb',
proxy: { url: '/CommMng/WorkFlow/GetWorkFlowStep' }
});
this.storeWorkFlowStep.load({ params: { WorkFlowName: this.WorkFlowName} });
this.comboxWorkFlowStep = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '可操作的审批步骤',
store: this.storeWorkFlowStep,
name: 'WorkFlowStep', id: "WorkFlowStep",
valueField: 'GID',
displayField: 'NAME',
values: 1
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxDEPT, {
fieldLabel: '报销单号',
name: 'BXGID', id: "BXGID_S"
}, this.comboxUser_1, {
fieldLabel: '从..报销日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATEDATE_min'
}, {
fieldLabel: '到..报销日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATEDATE_max'
}]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxISPAYED,
{
fieldLabel: '费用金额',
name: 'Fee_Amount',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '支票号',
name: 'CHEQUENUM'
},
this.comboxStatus]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号/船名',
name: 'MBLNO', id: "MBLNO"
}, {
fieldLabel: '客户名称',
name: 'CUSTOMERNAME', id: "CUSTOMERNAME"
}, {
fieldLabel: '费用名称/备注包含',
name: 'FEENAME', id: "FEENAME"
}, {
fieldLabel: '从..金额',
name: 'Amount_min',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '到..金额',
name: 'Amount_max',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}]
}, //end items(fieldset 3)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: []
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
},
scope: this
}, '-', {
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//集中绑定事件
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#region 生成凭证_汇率列表
//#region 加载数据
//制单人
this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storePREPAREDCode.load();
this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storePREPAREDCode,
forceSelection: true,
id: 'PREPARED',
name: 'PREPARED',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/GetCodeCurrencyList',
reader: {
id: 'CURR',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
text: '币别',
dataIndex: 'CURR',
width: 100,
align: 'center'
}, {
sortable: false,
text: '调整汇率',
dataIndex: 'FCYEXRATE',
width: 118,
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
nanText: '请输入有效数值',
hideTrigger: true //是否隐藏上下调节按钮
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击,2双击
});
this.gridListCw = new Ext.grid.GridPanel({
region: 'center',
width: 220,
store: this.storeListCw,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
//#endregion
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
if (this.VISIBLERANGE == "0")//查看权限 全部
{
var sql = '';
} else
if (this.VISIBLERANGE == "1")//分公司
{
var sql = " BX.company='" + COMPANYID + "'";
} else
if (this.VISIBLERANGE == "2")//部门
{
var sql = " BX.DEPTNAME ='" + DEPTGID + "'";
} else
if (this.VISIBLERANGE == "3")//个人
{
var sql = " BX.createuser='" + SHOWNAME + "'";
}
else {
sql = " 1<0";
}
//OPERATERANGE
var DEPTID = Ext.getCmp("DEPTID").getValue();
sql = sql + getAndConSql(sql, DEPTID, "BX.DEPTNAME like '%" + DEPTID + "%'");
var BXGID = Ext.getCmp("BXGID_S").getValue();
sql = sql + getAndConSql(sql, BXGID, "BX.BXGID like '%" + BXGID + "%' or BX.BXNO like '%" + BXGID + "%'");
var CREATEUSER = Ext.getCmp("CREATEUSER_1").getValue();
sql = sql + getAndConSql(sql, CREATEUSER, "BX.CREATEUSER = '" + CREATEUSER + "'");
var CREATEDATE_min = form.findField('CREATEDATE_min').getRawValue();
sql = sql + getAndConSql(sql, CREATEDATE_min, "BX.CREATEDATE >= '" + CREATEDATE_min + "'");
var CREATEDATE_max = form.findField('CREATEDATE_max').getRawValue();
sql = sql + getAndConSql(sql, CREATEDATE_max, "BX.CREATEDATE <= '" + CREATEDATE_max + " 23:59:59'");
var Status = this.comboxStatus.getValue();
if (Status != "") {
sql = sql + getAndConSql(sql, Status, "bx.bxstatus in (" + Status + ")");
}
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "BX.amount >= " + Amount_min);
var Amount_max = form.findField('Amount_max').getValue();
sql = sql + getAndConSql(sql, Amount_max, "BX.amount <= " + Amount_max);
var Fee_Amount = form.findField('Fee_Amount').getValue();
sql = sql + getAndConSql(sql, Fee_Amount, "BX.BXGID in (select bxgid from ch_fee where amount =" + Fee_Amount + ")");
var CHEQUENUM = form.findField('CHEQUENUM').getValue();
sql = sql + getAndConSql(sql, CHEQUENUM, "BX.BXGID in (select bxgid from ch_fee where CHEQUENUM like '%" + CHEQUENUM + "%')");
var ISPAYED = this.comboxISPAYED.getValue();
var CUSTOMERNAME = Ext.getCmp("CUSTOMERNAME").getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "BX.BXGID in (select bxgid from ch_fee where customername like '%" + CUSTOMERNAME + "%')");
var FEENAME = Ext.getCmp("FEENAME").getValue();
sql = sql + getAndConSql(sql, FEENAME, "(BX.BXGID in (select bxgid from ch_fee where FEENAME like '%" + FEENAME + "%' or remark like '%" + FEENAME + "%') or BX.Remark like '%" + FEENAME + "%')");
var MBLNO = Ext.getCmp("MBLNO").getValue();
sql = sql + getAndConSql(sql, MBLNO, "BX.BXGID in (select bxgid from ch_fee where bsno in( select bsno from vw_settlement where mblno like '%" + MBLNO + "%'))");
if (ISPAYED == "1") {//已支付
sql = sql + getAndConSql(sql, ISPAYED, " (select isnull(sum(obp.amount),0) from OA_Baoxiao_Pay obp where obp.BXGID=bx.BXGID)=isnull(bx.amount,0) ");
};
if (ISPAYED == "2") {
sql = sql + getAndConSql(sql, ISPAYED, " (select isnull(sum(obp.amount),0) from OA_Baoxiao_Pay obp where obp.BXGID=bx.BXGID)<>isnull(bx.amount,0) ");
};
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
//#region 生成凭证
onAddCwVouchers: 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 strError = "";
var strGids = "";
var iGids = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (strGids == "")
strGids = rec.data.BXGID;
else {
strGids += "," + rec.data.BXGID;
}
}
//
if (strGids.trim() != "") {
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/GetIsVoucher',
params: {
strGids: strGids
},
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;
}
this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, strGids, this, selections.length);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
//
},
//#region 层_显示信息
showContactForm: function (win, strGids, _this, iGids) {
var required = '*';
if (!win) {
//#region 编辑formDiv 基本信息
var formDiv = Ext.widget('form', {
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 60,
labelStyle: 'font-weight:bold'
},
items: [this.comboxPREPARED, {
fieldLabel: '记账日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, {
xtype: "checkbox", //checkbox控件
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态,
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
this.gridListCw.show();
}
else {
this.gridListCw.hide();
}
},
scope: this
}
}, this.gridListCw
],
buttons: [{
text: '生成凭证',
handler: function (options, success, response) {
if (!this.up('form').getForm().isValid()) {
return;
}
var dataDiv = this.up('form').getForm().getValues(false, false, false);
//
var j = 0;
var bodydatas = [];
for (var i = 0; i < _this.storeListCw.getCount(); i += 1) {
var member = _this.storeListCw.getAt(i);
bodydatas.push(member);
}
var jsonBody;
if (bodydatas.length > 0) {
jsonBody = ConvertRecordsToJsonAll(bodydatas);
}
//
Ext.Msg.wait('正在生成' + iGids + '票结算单数据, 请稍侯...');
Ext.Ajax.request({
waitMsg: '正在生成' + iGids + '票结算单数据, 请稍侯...',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/onAddCwVouchers',
scope: this,
params: {
strGids: strGids,
dataDiv: Ext.JSON.encode(dataDiv),
jsonBody: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
return;
} 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 });
}
},
timeout: 3000000//30秒
});
//
this.up('form').getForm().reset();
this.up('window').hide();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
this.up('window').hide();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
this.gridListCw.hide();
//
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetCwVOUNO',
params: {
VKNO: "记"
},
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.INFO, buttons: Ext.Msg.OK });
return;
}
//
data = result.data;
var arrayList = new Array();
arrayList = data.split("~");
var strY = arrayList[0].toString();
var strM = arrayList[1].toString();
var sVOUNO = arrayList[2].toString();
var strVOUNO = arrayList[3].toString();
var strVOUDATE = arrayList[4].toString();
var strACCDATE = arrayList[5].toString();
//
thisDiv.form.findField('VOUDATE').setValue(strVOUDATE);
thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});
//#endregion
win = Ext.widget('window', {
title: '辅助核算',
closeAction: 'hide',
width: 250,
height: 250,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
}
//#endregion
//#endregion
});