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/MsCwVouchersGlSettlement/MsCwVouchersGlSettlementInd...

1323 lines
52 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsCwVouchersGlSettlementIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlSettlementIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwVouchersGlSettlementIndex, Ext.Panel, {
PageSize: 100,
SelectedRecord: null,
OprationStatus: null, //仅当弹出界面时使用
sqlcontext: '',
strCwSTARTGID: '',
initUIComponents: function () {
this.formname = "MsCwVouGlSettlementIndex"; //结算凭证
this.sqlcontext = "";
11 months ago
this.ISRATESET = 0;
2 years ago
_this = this;
//#region formSearch 下拉框信息加载
//凭证状态
Ext.define('ISVOUALLNOModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISVOUALLNO = [{ "Name": "未生成" }, { "Name": "已生成" }, { "Name": ""}];
var storeISVOUALLNO = Ext.create('Ext.data.Store', { model: 'ISVOUALLNOModel', data: dataISVOUALLNO });
this.comboxISVOUALLNO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '凭证状态',
forceSelection: true,
store: storeISVOUALLNO,
id: 'ISVOUALLNO',
name: 'ISVOUALLNO',
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
value: "未生成",
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//结算类型
Ext.define('BILLTYPEModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataBILLTYPE = [{ "Name": "应收结算" }, { "Name": "应付结算" }, { "Name": ""}];
var storeBILLTYPE = Ext.create('Ext.data.Store', { model: 'BILLTYPEModel', data: dataBILLTYPE });
this.comboxBILLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算类型',
forceSelection: true,
store: storeBILLTYPE,
id: 'BILLTYPE',
name: 'BILLTYPE',
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
value: "收费结算",
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//是否垫付
Ext.define('ISADVANCEDPAYModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISADVANCEDPAY = [{ "Name": "是" }, { "Name": "否" }, { "Name": ""}];
var storeISADVANCEDPAY = Ext.create('Ext.data.Store', { model: 'ISADVANCEDPAYModel', data: dataISADVANCEDPAY });
this.comboxISADVANCEDPAY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否垫付',
forceSelection: true,
store: storeISADVANCEDPAY,
name: 'ISADVANCEDPAY',
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
value: '',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//是否禁开发票
Ext.define('ISINVOICEModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISINVOICE = [{ "Name": "是" }, { "Name": "否" }, { "Name": ""}];
var storeISINVOICE = Ext.create('Ext.data.Store', { model: 'ISINVOICEModel', data: dataISINVOICE });
this.comboxISINVOICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '禁开发票',
forceSelection: true,
store: storeISINVOICE,
name: 'ISINVOICE',
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
value: '',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//所属公司需求编号SR2017062800002
Ext.define('SubComp', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'ENNAME', type: 'string' }
]
});
this.StoreSubComp = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubComp',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.StoreSubComp.load({ params: { condition: ""} });
this.comboxSubComp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属公司',
store: this.StoreSubComp,
name: 'SUBCOMP',
valueField: 'GID',
displayField: 'NAME',
value: COMPANYID,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
//#region 账单所属公司
Ext.define('SubComp', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'ENNAME', type: 'string' }
]
});
this.StoreSALECORP = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubComp',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.StoreSALECORP.load({ params: { condition: ""} });
this.comboxSALECORP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '账单所属公司',
store: this.StoreSALECORP,
name: 'SALECORP',
valueField: 'GID',
displayField: 'NAME',
value: '',
labelWidth:100,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' }
});
this.StoreBANK.load({ params: { condition: "" } });
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'结算银行',
store: this.StoreBANK,
forceSelection: true,
name: 'ACCOUNT',
valueField: 'GID',
displayField: 'BANKACCOUNT'
});
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxISVOUALLNO, {
fieldLabel: '凭证号',
name: 'VOUALLNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxBILLTYPE, {
fieldLabel: '结算单号',
name: 'BsNo',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
2 years ago
}, this.comboxSubComp, this.comboxSALECORP,{
fieldLabel: '结算金额',
name: 'StlAmount',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}] //所属公司需求编号SR2017062800002
2 years ago
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '结算单位',
name: 'CustName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
}, {
fieldLabel: '结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
this.onRefreshClick();
}
}
}
2 years ago
}, this.comboxISADVANCEDPAY, this.comboxISINVOICE, this.comboxBANK, { xtype: 'hiddenfield', flex: 1 }]
2 years ago
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVouchersGlSettlementModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlSettlement/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 定义列
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: 30
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initgirdcolums = [{
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUSREF',
header: '状态',
width: 50
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算单位',
width: 120
}, {
sortable: true,
dataIndex: 'SALECORP',
header: '账单所属公司',
width: 120
}, {
sortable: true,
dataIndex: 'BILLTYPENAME',
header: '结算类型',
width: 80
}, {
sortable: true,
dataIndex: 'SETTLEMODEREF',
header: '结算类别',
width: 60
}, {
sortable: true,
dataIndex: 'SETTLETYPEREF',
header: '结算方式',
width: 60
}, {
sortable: true,
dataIndex: 'NOINVOICE',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB',
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNTUSD',
header: 'USD',
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'ACCOUNTREF',
header: '结算账户',
width: 150
}, {
sortable: true,
dataIndex: 'SETTLETIME',
header: '结算日期',
width: 100
}, {
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '结算人',
width: 100
}, {
sortable: true,
dataIndex: 'ISEXPORT',
header: '是否导出凭证',
width: 120,
renderer: function (value, meta, record) {
if (value== true) {
value='是';
} else value = '否';
return value;
}
}, {
sortable: true,
dataIndex: 'ISNOTVOU',
header: '禁止生成凭证',
width: 120,
renderer: function (value, meta, record) {
if (value == true) {
value = '是';
} else value = '否';
return value;
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}, {
sortable: true,
dataIndex: 'VOUCHERNO',
header: '总账凭证号',
width: 150
}];
//#endregion
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.initgirdcolums, 1);
this.girdcolums.unshift(new Ext.grid.RowNumberer());
//#region List列表显示信息
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
enableHdMenu: false, //是否显示表格列的菜单
stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
// paging bar on the bottom
bbar:[Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
//this.column = 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';
//收
if (record.data.BILLTYPENAME.toString() == '应收结算' && record.data.SETTLEMODE == 1) {
DsOpenEditWin('/MvcShipping/MsCwVouchersGlSettlement/RecvAppEdit');
}
else if (record.data.BILLTYPENAME.toString() == '应收结算' && record.data.SETTLEMODE == 3) {
DsOpenEditWin('/MvcShipping/MsCwVouchersGlSettlement/RecvInvEdit');
}
else if (record.data.BILLTYPENAME.toString() == '应收结算') {
DsOpenEditWin('/MvcShipping/MsCwVouchersGlSettlement/RecvBLEdit');
}
//付
if (record.data.BILLTYPENAME.toString() == '应付结算' && (record.data.SETTLEMODE == 1 || record.data.SETTLEMODE == 3)) {
DsOpenEditWin('/MvcShipping/MsCwVouchersGlSettlement/PayAppEdit');
}
else if (record.data.BILLTYPENAME.toString() == '应付结算') {
DsOpenEditWin('/MvcShipping/MsCwVouchersGlSettlement/PayBLEdit');
}
}, this);
//#endregion
//#region 按钮工具条
this.panelBtn = new Ext.Panel({
region: "center",
border: false,
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "生成凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}, '-', {
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();
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, {
text: "刷新列表",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}, '-', {
text: "禁止生成凭证",
id: "btnIsNotVou",
iconCls: "btnadd",
handler: function (button, event) {
this.onUpNotVouClick(button, event, true);
},
scope: this
}, '-', {
text: "取消禁止生成凭证",
id: "btnCancelIsNotVou",
iconCls: "btnadd",
handler: function (button, event) {
this.onUpNotVouClick(button, event, false);
},
scope: this
}
//{
// text: "导出Excel",
// id: "btnExportExcel",
// iconCls: 'btnexportexcel',
// handler: function (button, event) {
// this.onExportClick(button, event);
// },
// scope: this
//}
//, {
// text: "打印",
// iconCls: 'btnprint',
// handler: function (button, event) {
// this.Print();
// },
// scope: this
//}
]
});
//#endregion
//#region 页面布局
this.panelZQ = new Ext.Panel({
layout: "border",
region: "east",
width: 500,
style: 'text-align:right;',
border: false,
items: [{
xtype: 'displayfield',
id: 'lbTitle2',
name: 'lbTitle2',
value: "&nbsp;&nbsp;"
}]
});
this.panelTopF = new Ext.Panel({
layout: "border",
region: "north",
height: 26,
//border: false,
items: [this.panelBtn, this.panelZQ]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 95,
border: false,
items: [this.panelTopF, this.formSearch]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridList]
});
//this.onRefreshClick();
//#endregion
//#region 页面加载
this.storeList.on('beforeload', function (store) {
var strCondition = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: strCondition });
}, this);
//#endregion
//#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
});
//键值维护表_凭证字//需求编号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'
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } 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
//#region 页面加载
this.InitData();
11 months ago
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetCwISRATESET',
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data == '1') {
this.ISRATESET = 1;
} else {
}
}
} else {
}
},
scope: this
});
2 years ago
}, //end initUIComponents
//#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 = "&nbsp;&nbsp;当前登录账套:“" + strCwSTARTNAME + "”&nbsp;&nbsp;当前财务账期:“" + sYear + "年第" + sMonth + "期”&nbsp;&nbsp;";
Ext.getCmp("lbTitle2").setValue(sZQ);
//this.onRefreshClick();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, //end InitData
//#endregion
//#region 执行查询
onRefreshClick: function () {
var strCondition = this.getCondition();
this.sqlcontext = strCondition;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: strCondition }, waitMsg: "正在查询数据...", scope: this });
},
onDsQuery: function () {
var strCondition = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: strCondition }, waitMsg: "正在查询数据...", scope: this });
},
onUpNotVouClick: function (button, event,isnotvou) {
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 bodyAddDatas = [];
var icount = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var isdelete = true;
if (isnotvou) {
if (rec.data.ISNOTVOU) {
Ext.Msg.show({ title:'警告', msg:'当前已设置为不生成凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
isdelete = false;
return;
}
} else {
if (!rec.data.ISNOTVOU) {
Ext.Msg.show({ title: '警告', msg:'当前已设置为不生成凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
isdelete = false;
return;
}
}
if (isdelete) {
bodyAddDatas.push(rec);
icount = icount + 1;
}
}
Ext.MessageBox.confirm('提示', "确实要更新选中的【" + icount.toString() + "】票结算单吗?", function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在操作数据。。。');
Ext.Ajax.request({
waitMsg: '正在操作数据。。。',
url: '/Account/Chfee_settlement/UpdateNotVou',
params: {
data: jsonbodyAddDatas,
isnot:isnotvou
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onDsQuery();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title:'错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title:'警告', msg:'服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = "";
//凭证状态
var ISVOUALLNO = form.findField('ISVOUALLNO').getValue();
if (ISVOUALLNO == "未生成") {
//sql = sql + getAndConSql(sql, ISVOUALLNO, "(VOUCHERNO='' or VOUCHERNO is null)");
sql = sql + getAndConSql(sql, ISVOUALLNO, " ((AMOUNTRMB<>0 and AMOUNTUSD<>0) OR (isnull(ISNOTVOU,0)=0 and gid not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and [STARTGID]='" + this.strCwSTARTGID + "')))");
}
else if (ISVOUALLNO == "已生成") {
//sql = sql + getAndConSql(sql, ISVOUALLNO, "(VOUCHERNO<>'' and VOUCHERNO is not null)");
sql = sql + getAndConSql(sql, ISVOUALLNO, "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and [STARTGID]='" + this.strCwSTARTGID + "')");
}
//凭证号
var VOUALLNO = form.findField('VOUALLNO').getValue();
sql = sql + getAndConSql(sql, VOUALLNO, "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUALLNO + "%')");
//结算类型
var BILLTYPE = form.findField('BILLTYPE').getValue();
if (BILLTYPE == "应收结算") {
sql = sql + getAndConSql(sql, BILLTYPE, "BILLTYPE=1");
}
else if (BILLTYPE == "应付结算") {
sql = sql + getAndConSql(sql, BILLTYPE, "BILLTYPE=2");
}
var customNo = form.findField('BsNo').getValue();
sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
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, "SETTLETIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "SETTLETIME <='" + expDateEnd + " 23:59:59'");
//是否垫付
var ISADVANCEDPAY = form.findField('ISADVANCEDPAY').getValue();
if (ISADVANCEDPAY == "是") {
//sql = sql + getAndConSql(sql, ISADVANCEDPAY, "BILLNO in (SELECT billno from ch_fee_do where FEEID in (select gid from ch_fee where ISADVANCEDPAY=1))");
sql = sql + getAndConSql(sql, ISADVANCEDPAY, "ISADVANCEDPAY=1");
}
else if (ISADVANCEDPAY == "否") {
//sql = sql + getAndConSql(sql, ISADVANCEDPAY, "BILLNO in (SELECT billno from ch_fee_do where FEEID in (select gid from ch_fee where ISADVANCEDPAY=0))");
sql = sql + getAndConSql(sql, ISADVANCEDPAY, "ISADVANCEDPAY=0");
}
//是否禁开发票
var ISINVOICE = form.findField('ISINVOICE').getValue();
if (ISINVOICE == "是") {
//sql = sql + getAndConSql(sql, ISINVOICE, "BILLNO in (SELECT billno from ch_fee_do where FEEID in (select gid from ch_fee where ISINVOICE=1))");
sql = sql + getAndConSql(sql, ISINVOICE, "ISINVOICE=1");
}
else if (ISINVOICE == "否") {
//sql = sql + getAndConSql(sql, ISINVOICE, "BILLNO in (SELECT billno from ch_fee_do where FEEID in (select gid from ch_fee where ISINVOICE=0))");
sql = sql + getAndConSql(sql, ISINVOICE, "ISINVOICE=0");
}
//所属公司需求编号SR2017062800002
var SUBCOMP = form.findField('SUBCOMP').getValue();
sql = sql + getAndConSql(sql, SUBCOMP, "COMPANYID='" + SUBCOMP + "'");
//账单所属公司需求编号SR2017062800002
var SALECORP = form.findField('SALECORP').getValue();
sql = sql + getAndConSql(sql, SALECORP, "SALECORPID='" + SALECORP + "'");
var ACCOUNT = form.findField('ACCOUNT').getValue();
sql = sql + getAndConSql(sql, ACCOUNT, " (ACCOUNTRMB='" + ACCOUNT + "' OR ACCOUNTUSD='" + ACCOUNT+"') ");
2 years ago
var StlAmount = form.findField('StlAmount').getValue();
sql = sql + getAndConSql(sql, StlAmount, " (AMOUNTRMB=" + StlAmount + " OR AMOUNTUSD=" + StlAmount + ") ");
2 years ago
return sql;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
//#endregion
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.girdcolums, 1, true);
},
oninitGridClick: function (button, event) {
this.gridList.reconfigure(this.storeList, this.initgirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.initgirdcolums, 1, true);
},
//#region 导出Excel
onExportClick: function (button, event) {
if (this.storeList.getCount() == 0) {
return;
}
var strCondition = this.getCondition();
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsCwVouchersGlSettlement/GetDataListStr',
scope: this,
params: {
condition: strCondition
},
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 sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
if (sql1 != '') {
GridExportBySql(sql1, this.formname, '结算信息列表.xls');
//var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
//var openType = "_blank";
// var openUrl = "../../Reports/RptExport.aspx?handle=DsRptExcel&formname=" + this.formname + 'dr'+ "&condition1=" + sql1;
//window.open(openUrl, openType, openSet);
}
} 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
});
}
}
});
},
//#endregion
//#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 = "";
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.ISNOTVOU) {
Ext.Msg.show({ title: '警告', msg: '当前已设置为不生成凭证,不允许生成凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (strGids == "")
strGids = rec.data.GID;
else {
strGids += "," + rec.data.GID;
}
}
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/Account/Chfee_settlement/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: { jsonBody: '',dataDiv:'',strGids: strGids },
callback: function (r, options, success) {
if (success) {
this.showContactForm(false, strGids, this, selections.length);
}
},
waitMsg: "正在刷新数据...", scope: this
});
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
//#region 层_显示信息
showContactForm: function (win, strGids, _this, iGids) {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
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")
}, this.comboxVKNO, //需求编号SR2017080200007
{
xtype: "checkbox", //checkbox控件
name: "ButtSettlement",
boxLabel: "对抵结算是否生成银行账款",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, //需求编号SR2017080200007
{
xtype: "checkbox", //checkbox控件
name: "ISSTBANKGROUP",
boxLabel: '银行科目合并',
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
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: '/Account/Chfee_settlement/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) {
//var ISRATE = thisDiv.form.findField('ISRATE').getValue().toString();
//if (ISRATE == "false") {
// this.gridListCw.show();
//}
//else {
// this.gridListCw.hide();
//}
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");
11 months ago
if (_this.ISRATESET == 1) thisDiv.form.findField('ISRATE').setValue(false)
2 years ago
//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: 320,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});