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.

1258 lines
42 KiB
JavaScript

10 months ago
Ext.namespace('DsTruck');
DsTruck.CWAdvancePaymentIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.CWAdvancePaymentIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.CWAdvancePaymentIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/CWAdvancePayment/GetDataList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}, groupField: 'CUSTOMERNAME'
});
_this = this;
this.formname = "AdvancePayment";
this.MsPeriod = null;
//枚举参照
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBuyer.load({ params: { condition: "1=1"} });
this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '客户',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 100,
store: this.storeBuyer,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.column = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 80
},
{
sortable: true,
dataIndex: 'BLSTATUS',
header: '状态',
width: 80
},
{
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付类型',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
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) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
header: '已核销金额',
width: 80,
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) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CREATEUSER',
header: 'CREATEUSER',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '录入时间',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEUSER',
header: 'SETTLEUSER',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'SETTLETIME',
header: 'SETTLETIME',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 120
},
{
sortable: true,
dataIndex: 'ISDELETE',
header: 'ISDELETE',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'DELETEUSER',
header: 'DELETEUSER',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'DELETETIME',
header: 'DELETETIME',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'ISFINISHREF',
header: '是否全部完成核销',
width: 80//, hidden: true
},
{
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
width: 80, hidden: true
}, {
sortable: true,
dataIndex: 'COMPANYREF',
header: '所属分公司',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'ISVOU',
header: '生成凭证',
width: 80
}, {
sortable: true,
dataIndex: 'VOUCHERNO',
header: '凭证号',
width: 80
}, {
sortable: true,
dataIndex: 'REMAIN',
header: '剩余金额',
width: 80,
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) {
value = usMoney(value, 2, '', true);
return value;
}
}];
//定义Grid
var _this = this;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true
},
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: true
}],
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//明细内容
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentBodymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/CWAdvancePayment/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridBodyList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
//height: 600,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.cellEditingChFee],
//selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [new Ext.grid.RowNumberer(),
{
sortable: true,
dataIndex: 'GID',
header: 'GID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 130
},
{
sortable: true,
dataIndex: 'SETTLELINKGID',
header: 'SETTLELINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEBILLNO',
header: '核销使用单号',
width: 130
},
{
sortable: true,
dataIndex: 'FEETYPE',
header: 'FEETYPE',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
header: '核销金额',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '核销人',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETIME',
header: '核销时间',
width: 150
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'ISDELETE',
header: 'ISDELETE', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'DELETEUSER',
header: 'DELETEUSER', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'DELETETIME',
header: 'DELETETIME', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '凭证号',
width: 80
}
]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/CWAdvancePayment/Edit', '', 220, 950);
}, this);
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: 'OP',
valueField: 'UserCode',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.CheckRate = new Ext.form.Checkbox({
fieldLabel: '用系统录入汇率',
checked: true
});
this.formVoucherShow = 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: '凭证日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VoucherDate'
}, this.comboxUser
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '美元汇率',
xtype: 'numberfield',
name: 'UsdExrate'
}, this.CheckRate
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winVoucherShow = Ext.create('Ext.window.Window', {
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.formVoucherShow],
buttons: [{
text: "生成凭证",
minWidth: 70,
handler: function () {
var selectedRecords = me.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有选择要生成凭证的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var form = me.formVoucherShow.getForm();
var VoucherDate = form.findField('VoucherDate').getRawValue();
if (VoucherDate == '' || VoucherDate == null || VoucherDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证日期!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var UsdExrate = form.findField('UsdExrate').getValue();
if (!me.CheckRate.checked) {
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
};
var User = me.comboxUser.getValue();
if (User == '' || User == null || User == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证制单人!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.onCreateVoucherClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winVoucherShow.close();
}
}]
});
var _this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBuyer, {
fieldLabel: '结算单号',
name: 'BILLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从..结算日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATETIME_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..结算日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATETIME_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '包含金额为零的',
xtype: 'checkbox',
name: 'I_ZERO', flex: 1
}]
}]
}
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/CWAdvancePayment/Edit", "新建合同", "220", "950");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
//this.onResetClick(button, event);
//alert(this.getCondition);
},
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: "btnadd",
handler: function (button, event) {
var form = this.formVoucherShow.getForm();
var VoucherDate = form.findField('VoucherDate');
this.thisday = this.getToday();
VoucherDate.setRawValue(this.thisday)
this.winVoucherShow.show();
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, false);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, false);
},
scope: this
}, '-', {
text: '打印',
tooltip: '打印报表',
menu:
[
{
text: "打印列表",
handler: function (menu, event) {
_this.Print();
}
}, {
text: "打印选中",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.gridList.getSelectionModel().on('select', function (model, record, index) {
var BILLNO = record.data.BILLNO;
if (BILLNO != "") {
this.storeBodyList.load({ params: { condition: BILLNO} });
} else { this.storeBodyList.removeAll(); }
}, this);
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.panelContract = new Ext.Panel({
//title: '',
layout: "border",
region: 'center',
height: 800,
margin: '1 2',
split: true,
items: [this.gridList]
});
this.panelBody = new Ext.Panel({
//title: '',
layout: "border",
region: 'south',
height: 300,
margin: '1 2',
split: true,
items: [this.gridBodyList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelContract, this.panelBody]
});
this.LoadPeriod();
Ext.getCmp('btnSubmitAudit').disable();
Ext.getCmp('btnSubmitAuditBack').disable();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modCWAPLock"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
Ext.getCmp('btnSubmitAudit').enable();
Ext.getCmp('btnSubmitAuditBack').enable();
}
} else {
}
},
scope: this
});
}, //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
});
},
checkHandler: function () {
alert('Checked a menu item');
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
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
});
//alert(this.storeList.getCount());
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.ISVOU == '是') {
Ext.Msg.show({ title: '提示', msg: '已生成凭证,不能删除业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (record.data.BLSTATUS != '新建') {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许删除业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var CREATETIME = record.data.CREATETIME;
var oDate1 = new Date(CREATETIME);
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: '/Import/CWAdvancePayment/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //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.GID;
if (rec.data.BLSTATUS == '新建') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Import/CWAdvancePayment/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.GID;
if (rec.data.BLSTATUS == '锁定') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Import/CWAdvancePayment/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
});
};
},
onCreateVoucherClick: function (button, event) {
var feeBSNOSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formVoucherShow.getForm();
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.ISVOU == '是') {
Ext.Msg.show({ title: '提示', msg: '没有选择要生成凭证的业务,必须是没有生成凭证的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var VoucherDate = form.findField('VoucherDate').getRawValue();
var UsdExrate = form.findField('UsdExrate').getValue();
var User = this.comboxUser.getValue();
var useRate = 1;
if (!this.CheckRate.checked) { useRate = 0 };
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Import/CWAdvancePayment/CreateVoucher',
params: {
VoucherDate: VoucherDate,
UsdExrate: UsdExrate,
User: User,
useRate: useRate,
data: Ext.JSON.encode(record.data)
},
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.winVoucherShow.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
getToday: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
return (clock);
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var buyer = this.getStrValue(this.comboxBuyer.getValue());
sql = sql + getAndConSql(sql, buyer, "ap.CUSTOMERNAME in (" + buyer + ")");
var CREATETIME_min = form.findField('CREATETIME_min').getRawValue();
sql = sql + getAndConSql(sql, CREATETIME_min, "ap.CREATETIME >= '" + CREATETIME_min + "'");
var CREATETIME_max = form.findField('CREATETIME_max').getRawValue();
sql = sql + getAndConSql(sql, CREATETIME_max, "ap.CREATETIME <= '" + CREATETIME_max + " 23:59:59'");
var billNo = form.findField('BILLNO').getValue();
sql = sql + getAndConSql(sql, billNo, "BILLNO like '%" + billNo + "%'");
var I_ZERO = form.findField("I_ZERO").getValue();
if (I_ZERO)
{ sql = sql + getAndConSql(sql, I_ZERO, " 1=1 "); }
else
{ sql = sql + getAndConSql(sql, true, " ap.AMOUNT<>ap.DOAMOUNT "); }
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/Import/CWAdvancePayment/GetDataListStr',
//(int start, int limit, string sort, string condition, int billtype)
scope: this,
params: {
start: 0,
limit: 10000000,
sort: "",
condition: _this.sqlcontext
},
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 = 'MSCWADLIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
PrintSelect: function () {
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 feeGidSql = '';
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var feeGId = "'" + record.get('BILLNO') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var record = selections[0];
var billNo = record.data.BILLNO;
var printType = 'MSCWADLISTSEL';
var sql1 = "SELECT * ";
sql1 = sql1 + " FROM ch_fee_advance_payment p WHERE BILLNO IN (" + feeGidSql + ") ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});