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/Account/Viewsjs/Chfee_payapplication/ChPayapplicationTruckIndex.js

1522 lines
60 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsChPayapplicationIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChPayapplicationIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChPayapplicationIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
sortfield: '',
sortdire: '',
initUIComponents: function () {
//定义数据集
this.formname = "formChPayapplicationIndex"; //页面名称
this.sqlcontext = "";
this.worksql = getUrlParam('worksql');
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modPaySettleAppList"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChPayapplication',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.NumberOfpage,//每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'BILLNO',
header: Zi.LAN.RequisitionNumber, //申请单号
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: Zi.LAN.status, //状态
width: 60,
renderer: function (value, p, record) {
return record.data.BILLSTATUSREF;
}
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.SettlementUnit, //结算单位
width: 120
}, {
sortable: true,
dataIndex: 'CURR',
header: Zi.LAN.Currency, //币别
width: 50
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<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',
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: 'AMOUNTOT',
header: Zi.LAN.OtherBi, //其他外币
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: 'SETTLERMB',
header: Zi.LAN.jsuan+'RMB', //结算RMB
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'SETTLEUSD',
header: Zi.LAN.jsuan+'USD', //结算USD
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'SETTLEOT',
header: Zi.LAN.jsuanOther, //结算其他币别
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: 'APPLYTIME',
header: Zi.LAN.DateApplication, //申请日期
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANTNAME',
header: Zi.LAN.Applicant, //申请人
width: 100
}, {
sortable: true,
dataIndex: 'PAYABLETIME',
header: Zi.LAN.ApplyPaymentDate, //申请支付日期
width: 100
}, {
sortable: true,
dataIndex: 'AUDITTIME',
header: Zi.LAN.FinalReviewDate, //最后审核日期
width: 100
}, {
sortable: true,
dataIndex: 'AUDITUSER',
header: Zi.LAN.lastReviewer, //最后审核人
width: 100
}, {
sortable: true,
dataIndex: 'CUSTBANKNAME',
header: Zi.LAN.jsuanBank, //结算对象银行
width: 80
},
{
sortable: true,
dataIndex: 'CUSTACCOUNT',
header: Zi.LAN.jsuanzh, //结算对象账户
width: 140
}, {
sortable: true,
dataIndex: 'REMARK',
header: Zi.LAN.Remarks, //备注
width: 160
}, {
sortable: true,
dataIndex: 'ISINVOICE',
header: Zi.LAN.Invoiced, //已开发票
width: 80
}, {
sortable: true,
dataIndex: 'INVNO',
header: Zi.LAN.InvoiceNumber, //发票号
width: 80
}, {
sortable: true,
dataIndex: 'PREAMOUNTRMB',
header: Zi.LAN.yjsuan+'RMB', //预计结算RMB
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'PREAMOUNTUSD',
header: Zi.LAN.yjsuan+'USD',//预计结算USD
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'PREAMOUNTOT',
header: Zi.LAN.yjsuanOther, //预计结算其他
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: 'BALAMOUNTRMB',
header: Zi.LAN.weisq+'RMB', //未申请RMB
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'BALAMOUNTUSD',
header: Zi.LAN.weisq+'USD', //未申请USD
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'BALAMOUNTOT',
header: Zi.LAN.weisqOther, //未申请其他
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: 'BS_CUSTOMERNAME',
header: Zi.LAN.Requester, //委托单位
width: 160
}, {
sortable: true,
dataIndex: 'PAYTYPE',
header: Zi.LAN.shfsi, //申请方式
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'ISPRINT',
header: Zi.LAN.printy, //'应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '1')
return '是'; //是
else
return '';
}
}, {
sortable: true,
dataIndex: 'BALBILLNO',
header: Zi.LAN.ruzsq, //入账申请编号
width: 80
}, {
sortable: true,
dataIndex: 'REASON',
header: Zi.LAN.REASON, //驳回原因
width: 80
}
];
this.girdcolums = this.initgirdcolums;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请骚等
trackMouseOver: true,
selModel: this.GridCheckBoxModel,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示条数据
emptyMsg: Zi.LAN.Nodata//没有数据
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var paytype = record.data.PAYTYPE;
if (paytype == '入账申请')//入账申请
DsOpenEditWin('/Account/Chfee_payapplication/BalEdit');
else {
if (bltype == 'TruckIndex')
DsOpenEditWin('/Account/Chfee_payapplication/TruckBLEdit');
else
DsOpenEditWin('/Account/Chfee_payapplication/BLEdit');
}
}, this);
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
this.storeBILLSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBILLSTATUS.load({ params: { enumTypeId: 97005} });
this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: Zi.LAN.sqdstat, //申请单状态
forceSelection: true,
store: this.storeBILLSTATUS,
name: 'BILLSTATUS'
});
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCust.load({ params: { condition: ""} });
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.SettlementUnit, //结算单位
store: this.storeCust,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.ywnum, //业务编号
name: 'CustNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.sqnum, //申请编号
name: 'BsNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCust, this.comboxBILLSTATUS, {
fieldLabel: Zi.LAN.InvoiceNumber, //发票号
name: 'InvNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: Zi.LAN.ExecuteQuery, //执行查询
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: Zi.LAN.AdvancedSearch, //高级查询
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.ResetCondition, //重置条件
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, '-', {
text: '调整', //提交审核
tooltip: '调整',
handler: function (button, event) {
this.winModifyShow.show();
},
scope: this
}, '-', {
text: Zi.LAN.print, //打印
tooltip: Zi.LAN.printbb, //打印报表
menu:
[
{ text: Zi.LAN.printlb, //打印列表
handler: function (menu, event) {
_this.printInvoice(menu, event, 1);
}
}, { text: Zi.LAN.printdp, //打印多票
handler: function (menu, event) {
_this.printInvoice2(menu, event, 1);
}
}, { text: Zi.LAN.printxz, //打印选中
handler: function (menu, event) {
_this.PrintSelect(menu, event, 1);
}
}],
scope: this
}, '-', {
text: Zi.LAN.ExportExcel, //导出Excel
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntest",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: Zi.LAN.Initialization, //初始化
handler: function (menu, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, {
text: Zi.LAN.xswork, //显示工作流
id: "btnShowMap",
iconCls: 'btnexportexcel',
handler: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
var record = selections[0];
var bsno = record.data.BILLNO;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../Account/Chfee_payapplication/Map?bsno=" + bsno;
window.open(openUrl, openType, openSet);
},
scope: this
}, {
//text: Zi.LAN.songchat, //去送微信推送
id: "btnSendTM",
iconCls: 'btnWeChat',
handler: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
var record = selections[0];
var bsno = record.data.BILLNO;
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据
url: '/Mobile/WeChatHandler/SendTM?bsno=' + bsno,
callback: function (options, success, response) {
if (success) {
}
},
scope: this
}); //request over
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
if (this.worksql != undefined && this.worksql != '') {
this.worksql = this.worksql.replace(/@@/g, '=')
this.sqlcontext = this.worksql;
this.onDsQuery();
} else {
this.onInitRefreshClick();
}
this.storeCust2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCust.load({ params: { condition: ""} });
this.comboxCust2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'供应商', //结算单位
store: this.storeCust2,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.formModify = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCust2, {
fieldLabel: '税率', //'航次',
flex: 1,
name: 'TAXRATE'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
me = this;
this.winModifyShow = Ext.create('Ext.window.Window', {
title:'修改供应商及税率', //"批量修改",
width: 520,
//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.formModify],
buttons: [{
text: "确认修改", //"确认修改",
minWidth: 70,
handler: function () {
var CUSTNAME = me.formModify.getForm().findField('CustName').getValue();
if (CUSTNAME == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg:'供应商名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'提单号和场站不能为空!'
return;
}
var TAXRATE = me.formModify.getForm().findField('TAXRATE').getValue();
if (TAXRATE == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg:'税率不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'提单号和场站不能为空!'
return;
}
me.onModifyClick()
}
}, {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
me.winModifyShow.close();
}
}]
});
}, //end initUIComponents
onInitRefreshClick: function (button, event) {
var sql = ' cm.BILLSTATUS<>4 ';
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.onselect, //正在查询数据
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.onselect, //正在查询数据
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.onselect, //正在查询数据
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {//提示 请先选择单据
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var billstatus = record.data.BILLSTATUS;
if (billstatus != '1' && billstatus != '6') {
// 提示 当前状态无法删除此单据
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//提示', '确定删除该记录吗?
Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) {
if (btn == 'yes') {//正在删除数据...
Ext.Msg.wait(Zi.LAN.nowdelete);
Ext.Ajax.request({
waitMsg: Zi.LAN.nowdelete,
url: '/Account/Chfee_payapplication/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record); //Zi.LAN.Prompt, msg: '删除成功!'
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.truedelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {//警告', msg: '服务器响应出错,请重试'
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, 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) {//Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju,
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '1' || rec.data.BILLSTATUS == '6') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({// '正在添加数据...',
waitMsg: Zi.LAN.addnumnow,
url: '/Account/Chfee_payapplication/SubmitAuditList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({// Zi.LAN.Prompt
title: Zi.LAN.Prompt,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {//请求出现错误,请重试'
Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {//提示', msg: '请先选择单据!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({//正在添加数据..
waitMsg: Zi.LAN.addnumnow,
url: '/Account/Chfee_payapplication/SubmitAuditBackList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({//提示
title: Zi.LAN.Prompt,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {//请求出现错误,请重试
Ext.MessageBox.alert(Zi.LAN.FuWuQiError, response.responseText);
}
},
scope: this
});
};
},
onModifyClick: function (menu, event) {
var GidStr = '';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {//提示 请先选择单据
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var billstatus = record.data.BILLSTATUS;
if (billstatus == '4'||billstatus == '5') {
// 提示 当前状态无法删除此单据
Ext.Msg.show({ title: Zi.LAN.Prompt, msg:'当前状态不允许修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var custname = this.formModify.getForm().findField('CustName').getValue();
var taxrate = this.formModify.getForm().findField('TAXRATE').getValue();
_this = this;
Ext.MessageBox.confirm(Zi.LAN.Prompt,'确定要修改供应商和税率吗?', function (btn) {
if (btn == 'yes') {//正在删除数据...
Ext.Msg.wait('正在修改...');
Ext.Ajax.request({
waitMsg: '正在修改...',
url: '/Account/Chfee_payapplication/modify',
params: {
data: Ext.JSON.encode(record.data),
custname: custname,
taxrate: taxrate
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.storeList.reload();
_this.winModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}, this);
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {//提示', '查询条件赋值错误,请检查
Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError);
return '';
}
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 expDateBgn = form.findField('ExpDateBgn').getRawValue();
// sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'");
// var expDateEnd = form.findField('ExpDateEnd').getRawValue();
// sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + "'");
var InvNo = form.findField('InvNo').getValue();
sql = sql + getAndConSql(sql, InvNo, "INVNO like '%" + InvNo + "%'");
var CustNo = form.findField('CustNo').getValue();
sql = sql + getAndConSql(sql, CustNo, "exists (SELECT 1 FROM CH_FEE_DO d LEFT JOIN V_OP_BILL B ON (B.BSNO=D.BSNO) WHERE cm.BILLNO=d.BILLNO AND (b.CUSTNO+''+b.MBLNO+''+b.HBLNO+''+b.CUSTOMNO+''+b.ORDERNO) like '%" + CustNo + "%' )");
var BILLSTATUS = form.findField('BILLSTATUS').getValue();
sql = sql + getAndConSql(sql, BILLSTATUS, "BILLSTATUS= " + BILLSTATUS + "");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
printInvoice: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
//Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, 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 = 'MSCHFEEPAYAPPLICATIONSEL';
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select bankname from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTBANKNAME,";
sql1 = sql1 + "(select ACCOUNT from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTACCOUNT,dbo.GetStlByPayNo(p.BILLNO) as BALBILLNO FROM ch_fee_payapplication p WHERE BILLNO IN (" + feeGidSql + ") ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
printInvoice2: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
//Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var isaudit = 1;
var isprint = 0;
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;
} //审核通过 已结算 部分结算
if (record.data.BILLSTATUSREF != '审核通过' && record.data.BILLSTATUSREF != '已结算' && record.data.BILLSTATUSREF != '部分结算') {
isaudit = 0;
}
if (record.data.ISPRINT == '1') {
isprint = 1;
}
};
var record = selections[0];
var billNo = record.data.BILLNO;
var printType = 'PayFeeAuditReport2';
var sql1 = "SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE BILLNO in (" + feeGidSql + ") order by CUSTOMERNAME,MBLNO,FEENAME ";
var sql2 = "select * from ch_fee_do where billno in( SELECT distinct billno FROM VW_PrintPayFeeAuditReport2 WHERE BILLNO in (" + feeGidSql + "))";
var sql3 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名 ";
sql3 = sql3 + " ,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人 ";
sql3 = sql3 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志 ";
sql3 = sql3 + " ,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 办公电话号码 ";
sql3 = sql3 + " ,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码 ";
sql3 = sql3 + " ,(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 家庭地址 ";
sql3 = sql3 + " ,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 最后一次操作人 ";
sql3 = sql3 + " ,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 紧急联系人联系电话 ";
sql3 = sql3 + " ,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url ";
sql3 = sql3 + " FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
var sql4 = "SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码 ";
sql4 = sql4 + " ,(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 传真号码";
sql4 = sql4 + " ,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头";
sql4 = sql4 + " ,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间";
sql4 = sql4 + " ,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
var sql5 = "";
var sql6 = "";
if (isaudit == 1 && isprint == 0) {
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/UpdatePrint',
params: {
billnos: feeGidSql
},
callback: function (options, success, response) {
if (success) {
_this.storeList.reload();
} else {
}
},
scope: this
});
} else {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='PAYAPPPRINTAFTERAUDIT'"
},
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.PARAMVALUE == '1' && isaudit == 0) {//错误', msg: '付费申请必须审核通过后才能打印'
Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.shtgprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='PAYAPPONLYPRINTONE'"
},
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.PARAMVALUE == '1' && isprint == 1) {//Zi.LAN.Error, msg: '付费申请已打印过,不允许重复打印'
Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.notcfprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/UpdatePrint',
params: {
billnos: feeGidSql
},
callback: function (options, success, response) {
if (success) {
_this.storeList.reload();
} else {
}
},
scope: this
});
}
}
} else {
}
},
scope: this
});
// PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
}
} else {
}
},
scope: this
});
}
},
PrintSelect: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
//Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var isaudit = 1;
var isprint = 0;
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;
}
if (record.data.BILLSTATUSREF != '审核通过' && record.data.BILLSTATUSREF != '已结算' && record.data.BILLSTATUSREF != '部分结算') {
isaudit = 0;
}
if (record.data.ISPRINT == '1') {
isprint = 1;
}
};
var record = selections[0];
var billNo = record.data.BILLNO;
var printType = 'MSCHFEEPAYAPPLICATIONSEL';
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select bankname from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTBANKNAME,";
sql1 = sql1 + "(select ACCOUNT from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTACCOUNT,dbo.GetStlByPayNo(p.BILLNO) as BALBILLNO FROM ch_fee_payapplication p WHERE BILLNO IN (" + feeGidSql + ") ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
if (isaudit == 1 && isprint == 0) {
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/UpdatePrint',
params: {
billnos: feeGidSql
},
callback: function (options, success, response) {
if (success) {
_this.storeList.reload();
} else {
}
},
scope: this
});
} else {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='PAYAPPPRINTAFTERAUDIT'"
},
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.PARAMVALUE == '1' && isaudit == 0) {
Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.shtgprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='PAYAPPONLYPRINTONE'"
},
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.PARAMVALUE == '1' && isprint == 1) {
Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.notcfprint, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/UpdatePrint',
params: {
billnos: feeGidSql
},
callback: function (options, success, response) {
if (success) {
_this.storeList.reload();
} else {
}
},
scope: this
});
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
}
} else {
}
},
scope: this
});
// PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
}
} else {
}
},
scope: this
});
}
}
});