Ext.namespace('Shipping');
Shipping.MsChHexiaoIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChHexiaoIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChHexiaoIndex, Ext.Panel, {
PageSize: 50,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
strCwSTARTGID: '',
initUIComponents: function () {
this.formname = "formChHexiaoIndex"; //页面名称
this.MsPeriod = null;
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
this.StoreOpRange.load({ params: { optype: "modhexiao" },
callback: function (r, options, success) {
if (success) {
if (_this.StoreOpRange.getCount() > 0) {
} else {
Ext.getCmp('btndelete').hide();
Ext.getCmp('btnadd').hide();
}
}
}
});
this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
this.StoreLockOp.load({ params: { optype: "modhexiaolock"} });
this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
this.StoreUnLockOp.load({ params: { optype: "modhexiaounlock"} });
//人员
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.comboxCreateUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '创建人', //'客服',
store: this.storeOpCode,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CREATEUSER',
valueField: 'GID',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeOpCode.load();
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChHexiao',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_hexiao/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initgirdcolums = [{
sortable: true,
dataIndex: 'BILLNO',
header: '核销单号',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: '状态',
width: 60,
renderer: function (value, p, record) {
return record.data.BILLSTATUSREF;
}
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '核销单位',
width: 120
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 120,
renderer: function (value, p, record) {
return record.data.CREATEUSERREF;
}
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 120
}, {
sortable: true,
dataIndex: 'SETTLETIME',
header: '结算时间',
width: 120
}, {
sortable: true,
dataIndex: 'VOUNO',
header: '内部凭证号',
width: 120
}, {
sortable: true,
dataIndex: 'EXPVOUNO',
header: '导出凭证号',
width: 120
}, {
sortable: true,
dataIndex: 'AUDITUSER',
header: '审核人',
width: 120,
width: 120,
renderer: function (value, p, record) {
return record.data.AUDITUSERREF;
}
}, {
sortable: true,
dataIndex: 'AUDITTIME',
header: '审核时间',
width: 120
}, {
sortable: true,
dataIndex: 'STLRMBDR',
header: 'RMB应收核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'STLUSDDR',
header: 'USD应收核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'STLOTDR',
header: '其他应收核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'STLRMBCR',
header: 'RMB应付核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'STLUSDCR',
header: 'USD应付核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'STLOTCR',
header: '其他应付核销',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}];
this.girdcolums = this.initgirdcolums;
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();
}
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
_this = this;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Account/Chfee_hexiao/HexiaoEdit');
}, this);
//#region formSearch
//#region formSearch枚举参照相关
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.storeCust.load({ params: { condition: ""} });
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算单位',
store: this.storeCust,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
// forceSelection: true,
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
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: [{
fieldLabel: '核销单号',
name: 'BsNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '结算单号',
name: 'StlNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCust, {
fieldLabel: '总账凭证号',
name: 'VOUCHERNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'StlDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'StlDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [this.comboxCreateUser, , {
fieldLabel: '从创建日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到创建日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '核销金额从',
name: 'AMOUNTFR',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至',
name: 'AMOUNTTO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '导出凭证号',
name: 'VOUNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]//end items(fieldset 1)
}
]//end root items
});
//#endregion formSearch
//#region
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '收费结算流水', hidden: true,
handler: clickHandler_1
}, {
text: '收费结算流水(费用组分组)', hidden: true,
handler: clickHandler_2
}
]
});
//#region 打印格式定义
function clickHandler_1() {
_this.Print();
};
function clickHandler_2() {
_this.Print_FYFZ();
};
//#endregion
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建核销",
iconCls: "btnadd",
id: 'btnadd',
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_hexiao/HexiaoEdit');
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, '-', {
text: '提交锁定',
tooltip: '提交锁定',
id: 'btnSubmitAudit',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
text: '撤销锁定',
tooltip: '撤销锁定',
id: 'btnSubmitAuditBack',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
id: 'btndelete',
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, 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.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(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: 102,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
var op = record.data.CREATEUSER;
var bsstatus = record.data.BILLSTATUS;
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btndelete = Ext.getCmp('btndelete');
var records = DsStoreQueryBy(this.StoreLockOp, 'OPID', op);
if (records.getCount() > 0) {
if (bsstatus == 1) {
btnESubmitAudit.disable();
} else {
btnESubmitAudit.enable();
}
} else {
btnESubmitAudit.disable();
}
var records = DsStoreQueryBy(this.StoreUnLockOp, 'OPID', op);
if (records.getCount() > 0) {
if (bsstatus == 1) {
btnESubmitAuditBack.enable();
} else {
btnESubmitAuditBack.disable();
}
} else {
btnESubmitAuditBack.disable();
}
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
btndelete.enable();
} else {
btndelete.disable();
}
}, this);
var sql = ' BILLSTATUS<>1 ';
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, billtype: 1 },
waitMsg: "正在查询数据...",
scope: this
});
this.LoadPeriod();
//#region 生成凭证_汇率列表
//#region 加载数据
//权限加载
this.StoreIsCwVouchers = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.ModuleModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetSysModuleList' }
});
this.StoreIsCwVouchers.load({
params: { condition: "[name]='modChRecvSettlementIndexCwVouchers'" },
waitMsg: '正在查询数据...',
callback: function (options, success, response) {
if (success) {
//判断是否显示凭证按钮
if (options.length > 0) {
Ext.getCmp('btnAddCwVouchers').show();
} else {
Ext.getCmp('btnAddCwVouchers').hide();
}
}
},
scope: this
});
//制单人
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
});
//键值维护表_凭证字//需求编号:SR2017080200007
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} });
this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '凭证字',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'VKNO',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
this.storeMerGeType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeMerGeType.add({ "DC": "", "NAME": "系统设置" });
this.storeMerGeType.add({ "DC": "1", "NAME": "合并" });
this.storeMerGeType.add({ "DC": "2", "NAME": "不合并" });
this.comboxMergeType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否合并生成凭证',
store: this.storeMerGeType,
labelWidth: 110,
width: 210,
valueField: 'DC',
value: '',
displayField: 'NAME',
forceSelection: true,
name: 'MERGE'
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_hexiao/GetCodeCurrencyListJK',
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
this.InitData();
//#endregion
}, //end initUIComponents
LoadPeriod: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#region 加载事件
InitData: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/RptCwGenlegAccitems/GetData',
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
var arrtmp = data.toString().split("&");
this.strCwSTARTGID = arrtmp[0].toString();
var strCwSTARTNAME = arrtmp[1].toString();
var strCwACCDATE = arrtmp[2].toString();
var sYear = arrtmp[3].toString();
var sMonth = arrtmp[4].toString();
//
//var sZQ = " 当前登录账套:“" + strCwSTARTNAME + "” 当前财务账期:“" + sYear + "年第" + sMonth + "期” ";
//Ext.getCmp("lbTitle2").setValue(sZQ);
//this.onRefreshClick();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, //end InitData
//#endregion
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.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];
var billstatus = record.data.BILLSTATUS;
if (billstatus == '1') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
// var oDate1 = new Date(SETTLETIME);
// var oDate2 = new Date(this.MsPeriod.FDAY);
// if (oDate1.getTime() < oDate2.getTime()) {
// Ext.Msg.show({ title: '提示', msg: '本期已月末结账,无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_hexiao/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: '删除成功!', 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);
}, //onDeleteClick
onSubmitAuditClick: 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 BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_hexiao/LockList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.storeList.reload();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: 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 BILLNOStr = '';
var strIsVOUCHERNO = "";
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
var isvou = rec.data.ISEXPORT;
var isVOUCHERNO = rec.data.VOUNO;
if (isVOUCHERNO != "") {
strIsVOUCHERNO = "已经生成总账凭证的单据,不允许撤销锁定!";
}
if ((rec.data.BILLSTATUS == '1') && (isvou != true) && (isVOUCHERNO == "")) {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
if (strIsVOUCHERNO != "") {
Ext.Msg.show({ title: '提示', msg: strIsVOUCHERNO, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_hexiao/UnLockList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.storeList.reload();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var customNo = form.findField('BsNo').getValue();
sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
var StlNo = form.findField('StlNo').getValue();
sql = sql + getAndConSql(sql, StlNo, "BILLNO IN (SELECT HXBILLNO from ch_fee_settlement WHERE BILLNO like '%" + StlNo + "%')");
var VOUCHERNO = form.findField('VOUCHERNO').getValue();
//sql = sql + getAndConSql(sql, VOUCHERNO, "VOUCHERNO like '%" + VOUCHERNO + "%'");
sql = sql + getAndConSql(sql, VOUCHERNO, "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUCHERNO + "%')");
var VOUNO = form.findField('VOUNO').getValue();
sql = sql + getAndConSql(sql, VOUNO, "VOUNO IN (SELECT VOUALLNO from cw_vouchers WHERE EXPVOUNO like '%" + VOUNO + "%')");
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "BILLDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "BILLDATE <='" + expDateEnd + " 23:59:59'");
var CREATEUSER = form.findField('CREATEUSER').getValue();
sql = sql + getAndConSql(sql, CREATEUSER, "CREATEUSER ='" + CREATEUSER + "'");
var stlDateBgn = form.findField('StlDateBgn').getRawValue();
var stlDateEnd = form.findField('StlDateEnd').getRawValue();
if (stlDateBgn != '' || stlDateEnd != '') {
var stlsql = '';
stlsql = stlsql + getAndConSql(stlsql, stlDateBgn, "SETTLETIME >='" + stlDateBgn + "'");
stlsql = stlsql + getAndConSql(stlsql, stlDateEnd, "SETTLETIME <='" + stlDateEnd + " 23:59:59'");
if (stlsql != '') {
sql = sql + getAndConSql(sql, stlsql, " BILLNO IN (SELECT HXBILLNO from ch_fee_settlement WHERE " + stlsql + " )");
}
}
var AMOUNTFR = form.findField('AMOUNTFR').getValue();
var AMOUNTTO = form.findField('AMOUNTTO').getValue();
if (AMOUNTFR != '' || AMOUNTTO != '') {
var stlsql = '';
if (AMOUNTFR != '' && AMOUNTTO != '') {
stlsql = '(';
stlsql = stlsql + " (D.STLRMBDR>='" + AMOUNTFR + "' AND D.STLRMBDR<='" + AMOUNTTO + "') ";
stlsql = stlsql + " OR (D.STLUSDDR>='" + AMOUNTFR + "' AND D.STLUSDDR<='" + AMOUNTTO + "') ";
stlsql = stlsql + " OR (D.STLRMBCR>='" + AMOUNTFR + "' AND D.STLRMBCR<='" + AMOUNTTO + "') ";
stlsql = stlsql + " OR (D.STLUSDCR>='" + AMOUNTFR + "' AND D.STLUSDCR<='" + AMOUNTTO + "') ";
stlsql = stlsql + ')';
} else if (AMOUNTFR != '') {
stlsql = '(';
stlsql = stlsql + " D.STLRMBDR>='" + AMOUNTFR + "' ";
stlsql = stlsql + " OR D.STLUSDDR>='" + AMOUNTFR + "' ";
stlsql = stlsql + " OR D.STLRMBCR>='" + AMOUNTFR + "' ";
stlsql = stlsql + " OR D.STLUSDCR>='" + AMOUNTFR + "' ";
stlsql = stlsql + ')';
} else if (AMOUNTTO != '') {
stlsql = '(';
stlsql = stlsql + " D.STLRMBDR<='" + AMOUNTTO + "' ";
stlsql = stlsql + " OR D.STLUSDDR<='" + AMOUNTTO + "' ";
stlsql = stlsql + " OR D.STLRMBCR<='" + AMOUNTTO + "' ";
stlsql = stlsql + " OR D.STLUSDCR<='" + AMOUNTTO + "' ";
stlsql = stlsql + ')';
}
sql = sql + getAndConSql(sql, stlsql, stlsql);
}
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onExportClick: function (button, event) {
_this = this;
GridExportExcelPage(this.gridList);
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/Account/Chfee_hexiao/GetDataListStr',
scope: this,
params: {
start: 0,
limit: 10000000,
sort: "",
condition: _this.sqlcontext,
billtype: 1
},
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 = 'MSHEXIAOLIST';
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
});
}
}
});
},
//#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 strGids = "";
//var strError = "";
//var iGids = 0;
//for (var i = 0; i < selections.length; i++) {
// var rec = selections[i];
// var VOUCHERNO = rec.data.VOUCHERNO; //凭证号
// var BILLSTATUS = rec.data.BILLSTATUS; //是否锁定
// var SETTLETYPEREF = rec.data.SETTLETYPEREF; //结算方式
// var ACCOUNTREF = rec.data.ACCOUNTREF; //结算账户
// //
// if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) {
// if (strGids == "")
// strGids = rec.data.GID;
// else {
// strGids += "," + rec.data.GID;
// }
// iGids++;
// }
// else {
// strError = "请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!";
// }
//}
//if (strError != "") {
// Ext.Msg.show({ title: '提示', msg: strError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
//
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.VOUNO == '' && rec.data.BILLSTATUS == '1' && rec.data.REMARK != '冲抵自动核销') {
if (strGids == "")
strGids = rec.data.BILLNO;
else {
strGids += "," + rec.data.BILLNO;
}
}
}
if (strGids == "") {
Ext.Msg.show({ title: '提示', msg: "必须是锁定和没有生成凭证的核销单,没有要生成凭证的核销单!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/Account/Chfee_hexiao/GetIsVoucherJK',
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();
this.showContactForm(false, strGids, this, selections.length);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
},
//#endregion
//#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"),
listeners: {
'change': function (ths, newValue, oldValue, eOpts) {
if (newValue == oldValue) return;
var voudate = ths.getRawValue();
_this.storeListCw.load({
params: { sVOUDATE: voudate },
waitMsg: "正在查询数据...",
scope: this
});
}
}
}, //需求编号:SR2017080200007
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: '/Account/Chfee_hexiao/onAddCwVouchersJK',
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.show();
//
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");
//Ext.getCmp('VOUDATE').setValue(strVOUDATE);
//Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});
//#endregion
win = Ext.widget('window', {
title: '辅助核算',
closeAction: 'hide',
width: 250,
height: 300,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
}
//#endregion
});