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.

1035 lines
40 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsCwVouchersGlInvoiceHeXiaoIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlInvoiceHeXiaoIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwVouchersGlInvoiceHeXiaoIndex, Ext.Panel, {
PageSize: 100,
SelectedRecord: null,
OprationStatus: null,
sqlcontext: '',
strCwSTARTGID: '',
initUIComponents: function () {
this.formname = "formMsCwVouchersGlInvoiceHeXiaoIndex"; //成本收入_发票凭证
this.ISRATESET = 0;
Ext.define('MsFeeCurr', {
extend: 'Ext.data.Model',
idProperty: 'CURR',
fields: [
{ name: 'CURR', type: 'string' },
{ name: 'DEFRATE', type: 'number' },
{ name: 'CRDEFRATE', type: 'number' }
]
});
//#region formSearch 下拉框信息加载
//凭证状态
Ext.define('ISVOUNOModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISVOUNO = [{ "Name": "未生成" }, { "Name": "已生成" }, { "Name": ""}];
var storeISVOUNO = Ext.create('Ext.data.Store', { model: 'ISVOUNOModel', data: dataISVOUNO });
this.comboxISVOUNO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '凭证状态',
forceSelection: true,
store: storeISVOUNO,
//flex: 0.8,
id: 'ISVOUNO',
name: 'ISVOUNO',
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
}
}
});
//币别
this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' }
});
this.storeCodeCurrency.load();
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCodeCurrency,
forceSelection: true,
//flex: 0.5,
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CODENAME',
displayField: 'CODENAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//开票单位
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCust.load({ params: { condition: ""} });
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '开票单位',
store: this.storeCust,
// forceSelection: true,
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeInvCategory = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsExtEnumModel',
proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
});
this.storeInvCategory.load({ params: { enumTypeId: 97008 } });
this.comboxInvCategory = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '发票类型',
//labelWidth: 60,
store: this.storeInvCategory,
forceSelection: true,
name: 'INVOICECATEGORY',
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
//#endregion
//#region formSearch 查询面板
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: "" } });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
//labelWidth: 40,
store: this.StoreCurr,
forceSelection: true,
allowBlank: false,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
// var companyid = data.items[0].data.GID;
// this.StoreBANK.load({ params: { condition: ""} });
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
border: false,
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: [{
fieldLabel: '核销号',
name: 'BsNo',
//labelWidth: 50,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
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',
labelWidth: 20,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCust, this.comboxISVOUNO]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '凭证号',
name: 'VOUNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxInvCategory, {
fieldLabel: '税率',
name: 'TAXRATE',
//labelWidth: 40,
//flex: 0.7,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCurr, this.comboxSaleCompany]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 按发票合计
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVouchersGlInvoiceHeXiaoModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlInvoiceHeXiao/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 定义列
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.girdcolums = [{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
width: 150
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '发票核销号',
width: 150
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: '状态',
width: 70
}, {
sortable: true,
dataIndex: 'INVDATE',
header: '发票日期',
width: 80
}, {
sortable: true,
dataIndex: 'INVNO',
header: '发票号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '开票单位',
width: 160
}, {
sortable: true,
dataIndex: 'CURR',
header: '币别',
width: 40
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '实际金额',
align: 'right',
width: 120,
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;
}
}, {
sortable: true,
dataIndex: 'INVAMOUNT',
header: '开票金额',
align: 'right',
width: 120,
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;
}
}, {
sortable: true,
dataIndex: 'TAXRATE',
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: 80
}, {
sortable: true,
dataIndex: 'TAX',
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,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'BALBILLNO',
header: '入账编号',
width: 160
}, {
sortable: true,
dataIndex: 'INVOICECUSTNAME',
header: '发票抬头',
width: 200
}, {
sortable: true,
dataIndex: 'OP',
header: '核销人',
width: 80
}, {
sortable: true,
dataIndex: 'ISAPP',
header: '财务入账',
width: 60,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "是";
}
}
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 160
}];
//#endregion
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();
}
}
}
});
//#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]
});
////////////////////////////////////////////////
// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// var strCUSTNO = record.data.CUSTNO.toString();
// var dData = dataview.store.data;
// for (var i = 0; i < dData.length; i++) {
// var sCUSTNO = dData.items[i].data.CUSTNO.toString();
// if (sCUSTNO == strCUSTNO) {
// this.gridList.selModel.select(i, true, false);
// }
// }
// }, this);
//#endregion
//#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: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
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: 110,
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
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlInvoiceHeXiao/GetCodeCurrencyList',
reader: {
id: 'CURRENCY',
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();
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
});
}, //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.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: strCondition }, waitMsg: "正在查询数据...", scope: this });
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = "";
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 CURRENCY = form.findField('CURRENCY').getValue();
sql = sql + getAndConSql(sql, CURRENCY, "CURR='" + CURRENCY + "'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "INVDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "INVDATE <='" + expDateEnd + "'");
var INVOICECATEGORY = form.findField('INVOICECATEGORY').getValue();
sql = sql + getAndConSql(sql, INVOICECATEGORY, "INVOICECATEGORY=" + INVOICECATEGORY);
var TAXRATE = form.findField('TAXRATE').getValue();
sql = sql + getAndConSql(sql, TAXRATE, "TAXRATE=" + TAXRATE);
var SALECORPID = form.findField('SALECORPID').getValue();
sql = sql + getAndConSql(sql, SALECORPID, "SALECORPID='" + SALECORPID + "'");
//发票是否锁定
sql = sql + getAndConSql(sql, "BILLSTATUS", "BILLSTATUS='审核通过'");
//凭证状态
var ISVOUNO = form.findField('ISVOUNO').getValue();
if (ISVOUNO == "未生成") {
//sql = sql + getAndConSql(sql, ISVOUNO, "(VOUNO='' or VOUNO is null)");
sql = sql + getAndConSql(sql, ISVOUNO, "BILLNO not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoicehexiao' and [STARTGID]='" + this.strCwSTARTGID + "')");
}
else if (ISVOUNO == "已生成") {
//sql = sql + getAndConSql(sql, ISVOUNO, "(VOUNO<>'' and VOUNO is not null)");
sql = sql + getAndConSql(sql, ISVOUNO, "BILLNO in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoicehexiao' and [STARTGID]='" + this.strCwSTARTGID + "')");
}
//凭证号
var VOUNO = form.findField('VOUNO').getValue();
//sql = sql + getAndConSql(sql, VOUNO, "VOUNO like '%" + VOUNO + "%'");
sql = sql + getAndConSql(sql, VOUNO, "BILLNO in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoicehexiao' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUNO + "%')");
return sql;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
//#endregion
//#region 导出Excel
onExportClick: function (button, event) {
var sUrl = "";
var sHandle = "";
if (this.storeList.getCount() == 0) {
return;
}
sUrl = "/MvcShipping/MsCwVouchersGlInvoiceHeXiao/GetDataListSQL";
sHandle = "MsCwVouchersGlInvoiceHeXiaoIndex";
var strCondition = this.getCondition();
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: sUrl,
params: {
condition: strCondition
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
if (returnStr.toString() != "") {
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=" + sHandle + "&formname=" + this.formname + "&condition1=" + escape(returnStr.toString());
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 });
}
},
scope: this
});
},
//#endregion
//#region 生成凭证
onAddCwVouchers: function (selections) {
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 sBILLNO = "";
var iBILLNO = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var sVOUNO = rec.data.VOUNO; //凭证号
if (sVOUNO == "") {
if (sBILLNO.indexOf(rec.data.BILLNO.toString()) < 0) {
if (sBILLNO == "") {
sBILLNO = rec.data.BILLNO.toString();
}
else {
sBILLNO += "," + rec.data.BILLNO.toString();
}
iBILLNO++;
}
}
}
//
if (sBILLNO != "") {
var strBILLNOs = " and BILLNO in ('" + sBILLNO.trim().replace(",", "','") + "')";
this.storeListCw.load({ params: { strBILLNOs: strBILLNOs }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, this, sBILLNO, iBILLNO);
}
else
{
Ext.Msg.show({ title: '提示', msg: '请选择未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 层_显示信息
showContactForm: function (win, _this, sBILLNO, iBILLNO) {
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")
}, {
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") {
//Ext.getCmp('myGroup').show();
this.gridListCw.show();
}
else {
//Ext.getCmp('myGroup').hide();
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('正在生成' + iBILLNO + '票数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在生成' + iBILLNO + '票数据, 请稍侯...',
url: '/MvcShipping/MsCwVouchersGlInvoiceHeXiao/onAddCwVouchers',
scope: this,
params: {
strBILLNOs: sBILLNO,
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");
if (_this.ISRATESET == 1) thisDiv.form.findField('ISRATE').setValue(false)
} 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
});