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.

908 lines
40 KiB
JavaScript

11 months ago
Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//#region 当前日期格式
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //cond
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
}
}
xhr.send(null);
//#endregion
//#region 关闭窗口前的判断
function getSaved() {
var changelines = panelEdit.storeDetailList.getModifiedRecords();
var changecount = changelines.length;
//var delcount = panelEdit.DelBody.length;
var AllDirty = true;
//if (changecount == 0 && delcount == 0) { return false; }
if (changecount == 0) { return false; }
if (panelEdit.formHead.getForm().isDirty() == true || AllDirty == true) { return true; }
else { return false };
}
//#endregion
Shipping.MsCtBankStatementEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCtBankStatementEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCtBankStatementEdit, Ext.Panel, {
ParentWin: null,
StoreList: null,
EditRecord: null,
sqlcontext: '',
sCondition: '',
strSTARTNAME: '',
strACCDATE: '',
strACCDAY: '',
strACCTODAY: '',
strCondition: '',
isInitial: 0,
btnRefresh: null,
initUIComponents: function () {
this.serialNo = 0;
this.itemindex = 1;
//this.DelBody = [];
//#region formSearch 下拉框信息加载
//科目加载
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
});
this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 and ISBANK=1"} });
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '科目名称',
store: this.storeCwAccitems,
allowBlank: false,
forceSelection: true, //输入值是否严格为待选列表中存在的值
matchFieldWidth: false, //下拉框本身宽度不会变,下拉之后的宽度会根据文本中最大的字符长度自适应
id: 'ACCNAME',
name: 'ACCNAME',
valueField: 'ACCNAME',
displayField: 'ACCIDNAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'change': function (_Field, newValue, oldValue, eOpts) {
if (newValue != "") {
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCNAME', newValue);
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
//是不是外币都默认为RMB?
var sFCYNO = selections[0].data.FCYNO;
this.storeCwAccitemsCurrency.load({
params: { condition: "LINKGID='" + AccitemsRaw.GID + "'" },
waitMsg: "正在刷新数据...",
callback: function (options, success, response) {
var combo = Ext.getCmp("CURRENCY");
if (options.length > 0) {
for (var i = 0; i < options.length; i++) {
if (options[i].data.CURRENCY.toString() == selections[0].data.FCYNO.toString()) {
sFCYNO = selections[0].data.FCYNO.toString();
break;
}
sFCYNO = options[0].data.CURRENCY;
}
}
else {
sFCYNO = "RMB";
}
combo.setValue(sFCYNO); //选中
selections[0].set('FCYNO', sFCYNO);
},
scope: this
});
this.onNextKeyClick(9);
}
}
},
'keyup': {
fn: function (_field, e, eOpts) {
if (e.getKey() == 13) {
this.onNextKeyClick(9);
}
},
scope: this
}
}
});
//币别选项
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsCurrencyList' }
});
this.storeCwAccitemsCurrency.load({ params: { condition: "LINKGID=''"} });
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '币别',
store: this.storeCwAccitemsCurrency,
forceSelection: true, //输入值是否严格为待选列表中存在的值
matchFieldWidth: false, //下拉框本身宽度不会变,下拉之后的宽度会根据文本中最大的字符长度自适应
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CURRENCY',
displayField: 'CURRENCY',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'focus': function (_this, eOpts) {
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
var sCURRENCY = selections[0].data.FCYNO.toString().trim();
var sACCNAME = selections[0].data.ACCNAME.toString().trim();
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCNAME', sACCNAME);
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
var ssCURRENCY = sCURRENCY;
this.storeCwAccitemsCurrency.load({
params: { condition: "LINKGID='" + AccitemsRaw.GID + "'" },
waitMsg: "正在刷新数据...",
callback: function (options, success, response) {
var combo = Ext.getCmp("CURRENCY");
if (options.length > 0) {
for (var i = 0; i < options.length; i++) {
if (options[i].data.CURRENCY.toString() == selections[0].data.FCYNO.toString()) {
ssCURRENCY = selections[0].data.FCYNO.toString();
break;
}
ssCURRENCY = options[0].data.CURRENCY;
}
}
else {
ssCURRENCY = "RMB";
}
sCURRENCY = ssCURRENCY;
combo.setValue(ssCURRENCY); //选中
},
scope: this
});
}
},
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onNextKeyClick(10);
}
},
scope: this
}
}
});
//键值维护表_凭证字
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,
matchFieldWidth: false, //下拉框本身宽度不会变,下拉之后的宽度会根据文本中最大的字符长度自适应
name: 'VKNO',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
//结算方式
this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.StoreStlMode.load({ params: { condition: ""} });
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '结算方式',
store: this.StoreStlMode,
forceSelection: true,
matchFieldWidth: false, //下拉框本身宽度不会变,下拉之后的宽度会根据文本中最大的字符长度自适应
id: 'SETTLETYPENAME',
name: 'SETTLETYPENAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
//经手人信息加载
this.storeENTERED = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeENTERED.load();
this.comboxENTERED = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '经手人',
store: this.storeENTERED,
forceSelection: true,
matchFieldWidth: false, //下拉框本身宽度不会变,下拉之后的宽度会根据文本中最大的字符长度自适应
id: 'ENTERED',
name: 'ENTERED',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//出纳摘要
this.storeEXPLAN = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.MsCtExplanDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetEXPLAN' }
});
this.storeEXPLAN.load({ params: { condition: "MODULETYPE='出纳'"} });
this.comboxEXPLAN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '摘要',
store: this.storeEXPLAN,
forceSelection: false, //输入值是否严格为待选列表中存在的值
name: 'EXPLAN',
valueField: 'EXPLAN',
displayField: 'EXPLAN',
allowBlank: false,
matchFieldWidth: true, //下拉款不自适应宽度
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'render': function (_field, eOpts) {//自定义函数,定义双击事件
_field.getEl().on('dblclick', function (e, t, eOpts) {
DsOpenEditWin('/MvcShipping/MsCtExplan/Index', "摘要信息", "400", "616", (window.screen.availHeight / 2 - 200), (window.screen.availWidth / 2 - 400));
});
},
'select': function (combo, records, eOpts) {
this.onNextKeyClick(8);
}
}
});
//#endregion
//#region 定义数据集
//列表加载
this.storeDetailList = Ext.create('Ext.data.Store', {
model: 'MsCtBankStatementModel_2',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCtBankStatement/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'ITEMNO',
header: '序号',
align: 'center',
width: 35
},
{
sortable: false,
id: 'ACCDATE',
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m'),
width: 60
},
{
sortable: false,
id: 'VOUDATE',
dataIndex: 'VOUDATE',
header: '结算日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
allowBlank: false,
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
width: 60,
editor: this.comboxStlMode
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'ENTERED',
header: '经手人',
width: 60,
editor: this.comboxENTERED
},
{
id: 'EXPLAN',
sortable: false,
dataIndex: 'EXPLAN',
header: '摘要',
//align: 'center',
width: 150,
editor: this.comboxEXPLAN
},
{
sortable: false,
dataIndex: 'ACCNAME',
header: '银行科目',
//align: 'center',
width: 120,
allowBlank: false,
editor: this.comboxACCNAME
},
{
sortable: false,
dataIndex: 'FCYNO',
header: '原币币别',
align: 'center',
width: 60,
allowBlank: false,
editor: this.comboxCodeCurrency
},
{
sortable: false,
dataIndex: 'DR',
header: '借方金额',
align: 'right',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
minValue: -999999999.99,
maxValue: 999999999.99,
value: 0.00,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 32) {
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
var DR_OLD = _field.value;
var CR_OLD = selections[0].data.CR;
_field.setValue(CR_OLD);
selections[0].set('CR', DR_OLD);
}
else if (e.getKey() == 40) {
this.onAddClick();
}
else if (e.getKey() == 13) {
this.onNextKeyClick(11);
}
},
scope: this
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
if (parseFloat(value) < 0) {
return '<SPAN style="COLOR: red">' + value + '</SPAN>';
}
return value;
}
},
{
sortable: false,
dataIndex: 'CR',
header: '贷方金额',
align: 'right',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
nanText: '请输入有效小数',
minValue: -999999999.99,
maxValue: 999999999.99,
value: 0.00,
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
hideTrigger: true, //是否隐藏上下调节按钮
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 32) {
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
var DR_OLD = selections[0].data.DR;
var CR_OLD = _field.value;
selections[0].set('DR', CR_OLD);
_field.setValue(DR_OLD);
}
else if (e.getKey() == 40) {
this.onAddClick();
}
else if (e.getKey() == 9) {
this.onAddClick();
}
else if (e.getKey() == 13) {
this.onAddClick();
}
},
scope: this
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
if (parseFloat(value) < 0) {
return '<SPAN style="COLOR: red">' + value + '</SPAN>';
}
return value;
}
},
{
sortable: false,
dataIndex: 'BLC',
header: '',
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'SETTLETYPE',
header: '',
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ACCGID',
header: '',
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ISINITIAL',
header: '',
hidden: true,
value: this.isInitial,
width: 0
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridList = new Ext.grid.GridPanel({
region: 'center',
store: this.storeDetailList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
//disableSelection: false, //是否禁止选择表格行或列默认为false
//trackMouseOver: true, //高亮显示鼠标所在的行默认为true,
//stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums,
listeners: {
scope: this,
'edit': function (editor, e, eOpts) {
if (e.value == e.originalValue) { return; }
//else if (e.colIdx == 10) {
else if (e.field == 'DR') {
var DR = e.record.data['DR'];
if (DR != 0) {
e.record.set('CR', 0);
}
}
else if (e.field == 'CR') {
var CR = e.record.data['CR'];
if (CR != 0) {
e.record.set('DR', 0);
}
}
else if (e.field == 'FCYNO') {
var sCURRENCY = Ext.getCmp("CURRENCY").getValue();
e.record.set('FCYNO', sCURRENCY);
}
//
}
}
});
//#endregion
//#region 按钮Toolbar/框架/加载
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '添加',
tooltip: '添加',
id: "btnadd",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick();
},
scope: this
}, {
text: '删除',
tooltip: '删除',
id: "btndel",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
id: 'btnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnSaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
Ext.apply(this, {
items: [this.panelBtn, this.gridList]
});
parentWin = window.parent.opener;
this.InitData();
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
if (parentWin) {
var ret = parentWin.OprationSwap();
this.StoreList = ret[0];
this.EditRecord = ret[1];
this.sqlcontext = ret[2];
this.sCondition = ret[3];
this.isInitial = ret[4];
this.btnRefresh = ret[5];
}
var condition = "1<0";
if (this.EditRecord == null) {
if (this.sCondition != null) {
if (this.sCondition != "") {
condition = this.sCondition;
}
}
}
else {
condition = "convert(varchar,VOUDATE,23)='" + this.EditRecord.data.VOUDATE.toString().substr(0, 10) + "'";
if (this.sCondition != null) {
if (this.sCondition != "") {
condition += " and " + this.sCondition;
}
}
}
this.strCondition = condition;
this.storeDetailList.load({ params: { condition: condition }, waitMsg: "正在刷新数据...", scope: this });
this.LoadData();
},
LoadData: function () {
Ext.Ajax.request({
waitMsg: '正在查询...',
//url: '/MvcShipping/MsCtBankStatement/GetInitData',
url: '/MvcShipping/MsCtBankJournal/GetInitData',
params: {
isInitial: this.isInitial
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
var strArg = result.data.toString().split("");
this.strCtSTARTGID = strArg[0].toString();
this.strACCDATE = strArg[1].toString();
this.strACCDAY = strArg[2].toString();
this.strACCTODAY = strArg[3].toString();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
//#region 按钮函数
Save: function (type) {
var bodydatas = [];
var sError = "";
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
var member = this.storeDetailList.getAt(i);
//结算方式
if (member.data.SETTLETYPENAME != null) {
var sName = member.data.SETTLETYPENAME.toString();
var comboxList = DsStoreQueryBy(this.StoreStlMode, 'STLNAME', sName);
if (comboxList.length > 0) {
var comboxRaw = comboxList.getAt(0).raw;
member.set("SETTLETYPE", comboxRaw.STLCODE.toString());
}
}
else {
member.set("SETTLETYPE", 0);
}
//银行科目
sName = member.data.ACCNAME.toString();
var comboxList = DsStoreQueryBy(this.storeCwAccitems, 'ACCNAME', sName);
if (comboxList.length > 0) {
var comboxRaw = comboxList.getAt(0).raw;
member.set("ACCGID", comboxRaw.GID.toString());
}
member.set("BLC", 0);
bodydatas.push(member);
//判断是否轧账
Ext.Ajax.request({
waitMsg: '正在判断数据...',
url: '/MvcShipping/MsCtCarryOver/onIsCARRY',
async: false,
params: {
gid: member.data.GID.toString(),
voudate: member.data.VOUDATE.toString(),
tablename: 'ct_bank_statement'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
}
else {
if (jsonresult.Message.toString() != "") {
sError = jsonresult.Message;
return;
}
}
}
},
scope: this
});
}
if (sError != "") {
Ext.Msg.show({ title: '提示', msg: sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (bodydatas.length > 0) {
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
//var DelBody = ConvertRecordsToJsonAll(this.DelBody);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsCtBankStatement/SaveEdit',
scope: this,
params: {
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
if (type == '1') {
window.close();
}
else {
//this.DelBody = [];
this.storeDetailList.load({ params: { condition: this.strCondition }, waitMsg: "正在刷新数据...", scope: this });
var btn = opener.document.getElementById(this.btnRefresh.id);
btn.click();
}
} 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.WARNING, buttons: Ext.Msg.OK });
}
}
});
}
}, //end save
onAddClick: function () {
var n = this.storeDetailList.getCount();
var sEXPLAN = "";
if (n > 0) {
sEXPLAN = this.storeDetailList.getAt(n - 1).get("EXPLAN");
}
//
if (this.isInitial == 0) {
var record = Ext.create('MsCtBankStatementModel_2', {
GID: '*',
ITEMNO: n + 1,
ACCDATE: this.strACCDATE,
VOUDATE: this.strACCTODAY,
SETTLETYPENAME: '',
BILLNO: '',
ENTERED: '',
EXPLAN: '', //sEXPLAN
ACCNAME: '',
FCYNO: '', //RMB
DR: 0,
CR: 0,
SETTLETYPE: '',
ACCGID: '',
ISINITIAL: this.isInitial
});
this.storeDetailList.add(record);
this.gridListCellEditing.startEditByPosition({ row: n, column: 3 }); //n - 1
}
else {
var record = Ext.create('MsCtBankStatementModel_2', {
GID: '*',
ITEMNO: n + 1,
ACCDATE: this.strACCDATE,
VOUDATE: this.strACCDAY,
SETTLETYPENAME: '',
BILLNO: '',
ENTERED: '',
EXPLAN: '', //sEXPLAN
ACCNAME: '',
FCYNO: '', //RMB
DR: 0,
CR: 0,
SETTLETYPE: '',
ACCGID: '',
ISINITIAL: this.isInitial
});
this.storeDetailList.add(record);
this.gridListCellEditing.startEditByPosition({ row: n, column: 3 }); //n - 1
}
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (i == 0) {
gids = record.get('GID');
}
else {
gids += "," + record.get('GID');
}
}
//
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsCtBankStatement/Delete',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeList.remove(record);
this.storeDetailList.load({ params: { condition: this.strCondition }, waitMsg: "正在刷新数据...", scope: this });
var btn = opener.document.getElementById(this.btnRefresh.id);
btn.click();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, 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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
Print: function (button, event) {
var strGIDs = this.formHead.getForm().findField('GID').getValue();
//#region sql语句
var sSql1 = "SELECT GID as [明细表GID],GID as [主表GID并与明细表关联],VOUNO as [月初清零],VKNO as [凭证字],VOUDATE as [凭证日期],ACCYEAR as [年],ACCMONTH as [月],ATTACHS as [附件单据数],FCY as [是否含有外币科目],QTY as [是否含有数量科目],VOUPROP as [凭证属性],PREPARED as [制单人],CHECKED as [审核人],ENTERED as [记账人],ERRMSG as [错误信息],ISDELETE as [是否废除],DELETEUSER as [废除操作人],DELETETIME as [废除时间],VOUALLNO as [年+月+自动生成编号=凭证号],ISEXPORT as [是否导出凭证],ITEMNO as [行号],ACCID as [科目代码],PACCID as [父级科目代码],ACCNAME as [科目名称],PROPERTY as [科目属性],GRADE as [科目级别],DC as [借贷方向],DR as [本位币借方金额],CR as [本位币贷方金额],ISFCY as [是否外币],FCYNO as [外币编号usd],FCYEXRATE as [汇率],FCYDR as [外币借方金额],FCYCR as [外币贷方金额],QTYUNIT as [数量包装单位],QTYDR as [借方数量],QTYCR as [贷方数量],EXPLAN as [摘要],ISDEPTACC as [核算部门],ISEMPLACC as [核算人员],ISCORPACC as [核算客户],ISITEMACC as [核算项目],DEPTID as [部门(系统)],EMPLID as [人员(系统)],CORPID as [客户(系统)],PITEMID as [父级项目编号],ITEMID as [项目编号],FIELD1 as [预留字段1],FIELD2 as [预留字段2],FIELD3 as [预留字段3],FIELD4 as [预留字段4],FIELD5 as [预留字段5],FIELD6 as [预留字段6],FIELD7 as [预留字段7],FIELD8 as [预留字段8],FIELD9 as [预留字段9],FIELD10 as [预留字段10],ISSYS as [是否手动录入],FSETTLCODE as [结算方式],FSETTLENO as [财务辅助编号],FSETTLDATE as [结算日期],MODIFIEDUSER as [最后一次更新操作人],MODIFIEDTIME as [最后一次更新操作时间],CUSTOMERNAME as [委托单位],SALE as [揽货人],BLNO as [业务编号],ITEMGID as [项目GID],DEPTGID as [部门GID],ACCNAME as [会计科目字符串]"
+ " from VW_cw_vouchers_vouitems_gl where ISDELETE=0 and GID='" + strGIDs + "'";
var sSql2 = "";
var sSql3 = "";
var sSql4 = "";
var sSql5 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
var sSql6 = "SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
//#endregion
PrintComm(printType, sSql1, sSql2, sSql3, sSql4, sSql5, sSql6);
},
onNextKeyClick: function (col) {
var rows = this.gridList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridList.getStore();
var number = s.indexOf(row);
this.gridListCellEditing.startEditByPosition({ row: number, column: col });
},
OprationSwap2: function () {
var ret = new Array();
ret[0] = this.comboxEXPLAN;
return ret;
}
//#endregion
});