Ext . namespace ( 'Shipping' ) ;
Shipping . MsChInvoiceIndex = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsChInvoiceIndex . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsChInvoiceIndex , Ext . Panel , {
PageSize : 30 ,
OprationStatus : null , //仅当弹出界面时使用
SelectedRecord : null ,
sqlcontext : '' ,
sortfield : '' ,
sortdire : '' ,
INVITERFACE : '' ,
initUIComponents : function ( ) {
var _this = this ;
this . formname = "formChInvoice_HangXinIndex" ; //页面名称
//#region store
this . StoreLockOp = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsFeeOP' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetOpIDRang' }
} ) ;
this . StoreLockOp . load ( { params : { optype : "modInvLock" } } ) ;
this . StoreUnLockOp = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsFeeOP' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetOpIDRang' }
} ) ;
this . StoreUnLockOp . load ( { params : { optype : "modInvUnLock" } } ) ;
this . StoreOpRange = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsFeeOP' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetOpIDRang' }
} ) ;
this . StoreOpRange . load ( { params : { optype : "modInvUnLock" } } ) ;
this . StoreInviterface = Ext . create ( 'Ext.data.Store' , {
model : 'MsSysInvInterFaceSet' ,
remoteSort : false ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsSysInvInterFaceSet/GetDataList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . StoreInviterface . load ( {
params : { start : 0 , limit : 500 , sort : '' , condition : " isnull(ISDELETE,'false') <> 'true' " } ,
callback : function ( r , options , success ) {
if ( success ) {
if ( _this . StoreInviterface . getCount ( ) > 0 ) {
var rec = _this . StoreInviterface . getAt ( 0 ) ;
_this . INVITERFACE = rec . data . INVITERFACE ;
}
} else {
_this . INVITERFACE = "" ;
}
} ,
scope : this
} ) ;
//#endregion
//定义数据集
this . storeList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsChInvoice' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/Account/Chfee_invoice_HangXin/GetDataList' ,
reader : {
id : 'BILLNO' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//定义Grid
_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 . initgirdcolums = [ {
sortable : true ,
dataIndex : 'INVOICETYPEREF' ,
header : '发票类别' ,
width : 120
} , {
sortable : true ,
dataIndex : 'BILLSTATUS' ,
header : '发票锁定' ,
width : 60 ,
renderer : function ( value , p , record ) {
return record . data . BILLSTATUSREF ;
}
} , {
sortable : true ,
dataIndex : 'BILLNO' ,
header : '发票业务编号' ,
width : 120
} , {
sortable : true ,
dataIndex : 'INVOICENO' ,
header : '发票号' ,
width : 120
} , {
sortable : true ,
dataIndex : 'CUSTOMERNAME' ,
header : '开票单位' ,
width : 120
} , {
sortable : true ,
dataIndex : 'INVOICECUSTNAME' ,
header : '发票抬头' ,
width : 160
} , {
sortable : true ,
dataIndex : 'CURRENCY' ,
header : '币别' ,
width : 60
} , {
sortable : true ,
dataIndex : 'INVAMOUNT' ,
header : '开票金额' ,
align : 'right' ,
width : 100 ,
summaryType : 'sum' , align : 'right' ,
summaryRenderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
var delvalu = _this . sumDelInv ( record ) ;
value = Add ( value , - delvalu ) ;
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 : 'AMOUNT' ,
header : '申请金额' ,
align : 'right' ,
width : 100 ,
summaryType : 'sum' , align : 'right' ,
summaryRenderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
var delvalu = _this . sumDelInv ( record ) ;
value = Add ( value , - delvalu ) ;
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 : 'ISNEEDPRINT' ,
header : '是否打印' ,
width : 60
} , {
sortable : true ,
dataIndex : 'NOSTL' ,
header : '未结算' ,
width : 120
} , {
sortable : true ,
dataIndex : 'RECVCURR' ,
header : '实收币别' ,
width : 60
} , {
sortable : true ,
dataIndex : 'FEEAMOUNT' ,
header : '原币金额' ,
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 : 'INVOICEMAKETIME' ,
header : '开票日期' ,
width : 100
} , {
sortable : true ,
dataIndex : 'OPERATORNAME' ,
header : '开票人' ,
width : 100
} , {
sortable : true ,
dataIndex : 'APPLICANT' ,
header : '申请人' ,
width : 100
} , {
sortable : true ,
dataIndex : 'SALECORP' ,
header : '所属分部' ,
width : 100
} , {
sortable : true ,
dataIndex : 'REMARK' ,
header : '备注' ,
width : 160
} , {
sortable : true ,
dataIndex : 'ISDELETE' ,
header : '是否作废' ,
width : 80
} , {
sortable : true ,
dataIndex : 'DZSTATUS' ,
header : '电子发票' ,
width : 80
} , {
sortable : true ,
dataIndex : 'DELOPERATORNAME' ,
header : '作废人' ,
width : 100
} , {
sortable : true ,
dataIndex : 'DELETETIME' ,
header : '作废时间' ,
width : 100
} , {
sortable : true ,
dataIndex : 'VOUCHERNO' ,
header : '接口凭证' ,
width : 0
} , {
sortable : true ,
dataIndex : 'VOUNO' ,
header : '总账凭证' ,
width : 0
} , {
sortable : true ,
dataIndex : 'CUSTTEL' ,
header : '购方电话' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'CUSTADDR' ,
header : '购方地址' ,
width : 80
} ,
{
sortable : true , hidden : true ,
dataIndex : 'PTORRED' ,
header : 'PTORRED' ,
width : 80
} ,
{
sortable : true , tooltip : '只有冲红发票具备这类信息' ,
dataIndex : 'REDCODE' ,
header : '对应蓝票代码' ,
width : 80
} ,
{
sortable : true , tooltip : '只有冲红发票具备这类信息' ,
dataIndex : 'REDNUM' ,
header : '对应蓝票号码' ,
width : 80
} ,
{
sortable : true , hidden : true ,
dataIndex : 'PUSHMODE' ,
header : 'PUSHMODE' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'PUSHMOBILE' ,
header : '通知手机' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'PUSHEMAIL' ,
header : '通知邮箱' ,
width : 80
} ,
{
sortable : true , hidden : true ,
dataIndex : 'INVOICELINE' ,
header : 'INVOICELINE' ,
width : 80
} ,
{
sortable : true , hidden : true ,
dataIndex : 'EINVOICESTATE' ,
header : 'EINVOICESTATE' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'INVOICEINFOURL' ,
header : '发票详情' ,
width : 80 ,
renderer : function ( value , p , record ) {
if ( value == '' || typeof ( value ) == "undefined" ) {
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
return '' ;
} else {
var url = value . replace ( "https://" , "" )
var url = url . replace ( "http://" , "" ) . replace ( "https://" , "" ) . replace ( "https//" , "" ) ;
return '<a href="http://' + url + '" style=' + '"text-decoration:none" target="_blank"' + ' > 查看 </a>' ;
}
}
} , {
xtype : 'actioncolumn' ,
width : 80 ,
align : 'center' ,
text : "发票PDF" ,
items : [ {
icon : '/images/icons/btnSearch.gif' , // Use a URL in the icon config
tooltip : '图片预览' ,
handler : function ( grid , rowIndex , colIndex ) {
var rec = grid . getStore ( ) . getAt ( rowIndex ) ;
var filePath = rec . get ( 'INVOICEPDFURL' ) ;
var url = filePath . replace ( "http://" , "" ) . replace ( "https://" , "" ) . replace ( "https//" , "" ) ;
DsOpenEditWin _FullUrl ( url , "发票信息" , 600 , 800 , 300 , 300 ) ;
}
} ]
}
//{
// //sortable: true,
// dataIndex: 'INVOICEPDFURL',
// header: '发票PDF地址',
// //xtype: 'gridcolumn',
// width: 150,
// align: 'center',
// xtype: 'gridcolumn',
// //width: 100,
// //sortable: true,
// items: [{
// text: '查看',
// handler: function (grid, rowIndex, colIndex) {
// alert(1);
// }
// }]
// //renderer: function (value, metaData, record) {
// // var id = record.data.BILLNO;
// // metaData.tdAttr = 'data-qtip="查看PDF文件"';
// // Ext.defer(function () {
// // Ext.widget('button', {
// // margins: '0 0 0 0',
// // renderTo: id,
// // height: 13,
// // width: 50,
// // // style:"margin-left:5px;background:blue;",
// // text: 'open',
// // handler: function () {
// // DsOpenEditWin_FullUrl(value.replace("http://", "").replace("https://", ""), "发票信息", 600, 800, 300, 300);
// // }
// // });
// // }, 50);
// // return Ext.String.format('<div id="{0}"></div>', id);
// //}
//}
,
{
sortable : true ,
dataIndex : 'PTORREDREF' ,
header : '开票类型(正票/红票)' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'SETRED' ,
header : '被冲红' ,
width : 80
} ,
{
sortable : true , tooltip : '实际为只推送手机/同时推送手机和邮箱' ,
dataIndex : 'PUSHMODEREF' ,
header : '通知推送方式' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'INVOICELINEREF' ,
header : '发票种类' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'EINVOICESTATEREF' ,
header : '开票状态' ,
align : 'center' ,
width : 80
} , {
sortable : true ,
dataIndex : 'CREATEUSERREF' ,
header : '录入人' ,
width : 100
}
] ;
this . CheckIsDelete = new Ext . form . Checkbox ( {
fieldLabel : '合计含作废金额' ,
checked : false ,
width : 160 ,
listeners : {
change : function ( field , e ) {
_this . onRefreshClick ( ) ;
}
}
} ) ;
this . girdcolums = this . initgirdcolums ;
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 ,
selModel : this . GridCheckBoxModel ,
viewConfig : {
enableTextSelection : true ,
autoFill : true ,
getRowClass : function ( record , rowIndex , rowParams , store ) {
var ISDELETE = record . get ( 'ISDELETE' ) ;
if ( ISDELETE == 'True' )
return 'feestatus_Del' ;
if ( record . get ( 'PTORRED' ) == "2" )
return 'text_red' ;
if ( record . get ( 'SETRED' ) == "1" || record . get ( 'SETRED' ) == "True" )
return 'text_blue' ;
}
} ,
features : [ {
ftype : 'summary' //Ext.grid.feature.Summary表格汇总特性
} ] ,
columns : this . girdcolums ,
// paging bar on the bottom
bbar : [ Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeList ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} ) , this . Pagenum , this . CheckIsDelete ]
} ) ;
this . gridList . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
this . SelectedRecord = record ;
this . OprationStatus = 'edit' ;
if ( record . data . INVOICETYPE == 2 )
DsOpenEditWin ( '/Account/Chfee_invoice_HangXin/AppEdit' , record . data . BILLNO ) ;
else
DsOpenEditWin ( '/Account/Chfee_invoice_HangXin/BLEdit' , record . data . BILLNO ) ;
} , 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
this . storeCompany = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'companymb' ,
proxy : { url : '/CommMng/BasicDataRef/GetcompanyList' }
} ) ;
this . storeCompany . load ( { params : { condition : "" } } ) ;
this . comboxCompany = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '销方公司' ,
store : this . storeCompany ,
labelWidth : 60 ,
name : 'companyid' ,
valueField : 'gid' ,
displayField : 'name' ,
listeners : {
beforequery : function ( e ) {
return FilterCombox ( e ) ; //在beforequery使用此方法
} ,
scope : this
}
} ) ;
this . storeCust = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomInvRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomInvRefList' }
} ) ;
this . storeCust . load ( { params : { condition : "" } } ) ;
this . comboxCust = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '发票抬头' ,
store : this . storeCust ,
labelWidth : 60 ,
// forceSelection: true,
name : 'CustName' ,
valueField : 'CustName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . formSearch = Ext . widget ( 'form' , {
frame : true ,
region : 'center' ,
bodyPadding : 5 ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 50 ,
msgTarget : 'qtip'
} ,
items : [
{ //fieldset 1
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '发票业务号' ,
labelWidth : 66 ,
name : 'BsNo' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '发票号' ,
name : 'InvNo' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '申请编号' ,
name : 'ShenNo' ,
labelWidth : 60 ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '主提单号' ,
labelWidth : 60 ,
name : 'MBLNO' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '购方抬头' ,
name : 'CustName' ,
labelWidth : 60 ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , this . comboxCompany
, {
fieldLabel : '从开票日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
labelWidth : 65 ,
name : 'ExpDateBgn' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '到开票日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
labelWidth : 65 ,
name : 'ExpDateEnd' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
xtype : 'button' ,
width : 90 ,
text : "执行查询" ,
iconCls : "btnrefresh" ,
handler : function ( button , event ) {
this . onRefreshClick ( button , event ) ;
} ,
scope : this
} , {
xtype : 'button' ,
width : 90 ,
text : "高级查询" ,
iconCls : "btnmore" ,
handler : function ( button , event ) {
var sql = this . getCondition ( ) ;
var winAccess = new Shipping . DsQuery ( {
} ) ;
winAccess . StoreList = this . storeList ;
winAccess . formname = this . formname ;
winAccess . condition = sql ;
winAccess . show ( ) ;
return ;
} ,
scope : this
}
]
}
] //end items(fieldset 1)
} //end fieldset 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 ( '/Account/Chfee_invoice_HangXin/BLEdit' , '新建自由发票' ) ;
} ,
scope : this
} ,
'-' , {
text : "复制添加" ,
iconCls : "btnadd" ,
handler : 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 ] ;
this . SelectedRecord = record ;
this . OprationStatus = 'copyadd' ;
if ( record . data . INVOICETYPE == 2 )
DsOpenEditWin ( '/Account/Chfee_invoice_HangXin/AppEdit' , '新建自由发票' ) ;
else
DsOpenEditWin ( '/Account/Chfee_invoice_HangXin/BLEdit' , '新建申请发票' ) ;
} ,
scope : this
} ,
'-' , {
text : "申请开票" ,
iconCls : "btnadd" ,
handler : function ( button , event ) {
this . OprationStatus = 'add' ;
DsOpenEditWin ( '/Account/Chfee_invoice_HangXin/AppEdit' , '新建申请发票' ) ;
} ,
scope : this
} ,
{
text : "重置条件" ,
iconCls : "btnreset" ,
handler : function ( button , event ) {
var form = this . formSearch . getForm ( ) ;
form . reset ( ) ;
} ,
scope : this
} , '-' ,
{
text : "删除" ,
iconCls : "btndelete" ,
id : "btndelete" ,
handler : function ( button , event ) {
this . onDeleteClick ( button , event ) ;
} ,
scope : this
} ,
//'-',
{
text : "作废" , hidden : true ,
iconCls : "btndelete" ,
id : "btndeleteUp" ,
menu : [
{ text : "作废" ,
handler : function ( menu , event ) {
_this . onDeleteUpClick ( menu , event ) ;
}
} , { text : "取消作废" ,
handler : function ( menu , event ) {
_this . onCancelDeleteUpClick ( menu , event ) ;
}
} ] ,
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 : '打印' ,
tooltip : '打印报表' ,
menu :
[
{ text : "打印列表" ,
handler : function ( menu , event ) {
_this . print ( menu , event , 1 ) ;
}
} , { text : "打印选中" ,
handler : function ( menu , event ) {
_this . PrintSelect ( menu , event , 1 ) ;
}
} ] ,
scope : this
} , {
text : "电票批量打印" ,
handler : function ( menu , event ) {
_this . onGETONEPDFClick ( menu , event , 1 ) ;
}
} , '-' , {
text : "导出Excel" ,
id : "btnExportExcel" ,
iconCls : 'btnexportexcel' ,
handler : function ( button , event ) {
this . onExportClick ( button , event ) ;
} ,
scope : this
} , '-' , {
text : "保存列表样式" ,
id : "btntest" ,
menu : [
{ text : "保存" ,
handler : function ( button , event ) {
this . girdcolums = DsTruck . SaveGridPanel ( USERID , _this . formname , _this . gridList . columns , _this . girdcolums , 1 , true ) ;
}
} , { text : "初始化" ,
handler : function ( menu , event ) {
_this . girdcolums = DsTruck . SaveGridPanel ( USERID , _this . formname , _this . gridList . columns , _this . initgirdcolums , 1 , true ) ;
}
} ] ,
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.getCondition();
Ext . apply ( store . proxy . extraParams , { condition : _this . sqlcontext } ) ;
} , this ) ;
var sql = ' isnull(cm.billstatus,0)=0 ' ;
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 : "正在查询数据..." ,
scope : this
} ) ;
this . CheckSaveQuery = new Ext . form . Checkbox ( {
fieldLabel : '记忆查询条件' ,
checked : true ,
width : 20
} ) ;
LoadQueryData ( this . formname , this . formSearch , this . CheckSaveQuery ) ;
this . gridList . getSelectionModel ( ) . on ( 'select' , function ( model , record , index ) {
var ISNEEDPRINT = record . data . ISNEEDPRINT ;
var btnEDeleteDetail = Ext . getCmp ( 'btndelete' ) ;
var btnEDeleteUpDetail = Ext . getCmp ( 'btndeleteUp' ) ;
var op = record . data . OPERATOR ;
var bsstatus = record . data . BILLSTATUS ;
var records = DsStoreQueryBy ( this . StoreOpRange , 'OPID' , op ) ;
if ( records . getCount ( ) > 0 ) {
if ( bsstatus == 1 ) {
btnEDeleteDetail . disable ( ) ;
btnEDeleteUpDetail . disable ( ) ;
} else {
btnEDeleteDetail . enable ( ) ;
btnEDeleteUpDetail . enable ( ) ;
}
} else {
btnEDeleteDetail . disable ( ) ;
btnEDeleteUpDetail . disable ( ) ;
}
var btnESubmitAudit = Ext . getCmp ( 'btnSubmitAudit' ) ;
var btnESubmitAuditBack = Ext . getCmp ( 'btnSubmitAuditBack' ) ;
var records = DsStoreQueryBy ( this . StoreLockOp , 'OPID' , op ) ;
if ( records . getCount ( ) > 0 ) {
if ( bsstatus == 1 ) {
btnESubmitAudit . disable ( ) ;
} else {
btnESubmitAudit . enable ( ) ;
}
} else {
btnESubmitAudit . disable ( ) ;
}
var records = DsStoreQueryBy ( this . StoreUnLockOp , 'OPID' , op ) ;
if ( records . getCount ( ) > 0 ) {
if ( bsstatus == 1 ) {
btnESubmitAuditBack . enable ( ) ;
} else {
btnESubmitAuditBack . disable ( ) ;
}
} else {
btnESubmitAuditBack . disable ( ) ;
}
} , this ) ;
//#region 下载窗体
this . formDownloadShow = Ext . widget ( 'form' , {
frame : true ,
region : 'center' ,
height : 100 ,
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' ,
id : 'downloadfile' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'label' ,
html : '' ,
width : 120 ,
text : ''
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
me = this ;
this . winDownloadShow = 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 . formDownloadShow ] ,
buttons : [ {
text : "关闭" ,
minWidth : 70 ,
handler : function ( ) {
me . winDownloadShow . close ( ) ;
}
} ]
} ) ;
//#endregion
} , //end initUIComponents
onRefreshClick : function ( button , event ) {
saveQuerySetting ( this . formname , this . formSearch , true , true ) ;
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 : "正在查询数据..." ,
scope : this
} ) ;
} ,
onDsQuery : function ( button , event ) {
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 : "正在查询数据..." ,
scope : this
} ) ;
} ,
sumDelInv : function ( Fieldname ) {
var result = 0 ;
if ( this . CheckIsDelete . checked == true )
return 0 ;
for ( i = 0 ; i < this . storeList . getCount ( ) ; i += 1 ) {
var memberyf = this . storeList . getAt ( i ) ;
if ( memberyf . data . ISDELETE == 'True' ) {
result = Add ( result , memberyf . get ( Fieldname ) ) ;
}
} ;
return result ;
} ,
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 ] ;
var ISNEEDPRINT = record . data . ISNEEDPRINT ;
var ISNEEDFEE = record . data . ISNEEDFEE ;
var VOUCHERNO = record . data . VOUCHERNO ;
var ISDELETE = record . data . ISDELETE ;
var BILLSTATUS = record . data . BILLSTATUS ;
if ( BILLSTATUS == 1 ) {
Ext . Msg . show ( { title : '提示' , msg : '已锁定,无法删除或作废!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( VOUCHERNO != '' ) {
Ext . Msg . show ( { title : '提示' , msg : '已生成凭证无法删除此发票,只能作废!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( ISDELETE == 'True' ) {
Ext . Msg . show ( { title : '提示' , msg : '此发票已作废,不能删除!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( ISNEEDFEE == 'True' ) {
Ext . Msg . show ( { title : '提示' , msg : '此发票已结算,不能删除!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
Ext . MessageBox . confirm ( '提示' , '确定删除该记录吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/Account/Chfee_invoice_HangXin/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 ) ;
Ext . Msg . show ( { title : '提示' , msg : '删除成功!' , 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
onDeleteUpClick : 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 ] ;
var ISNEEDPRINT = record . data . ISNEEDPRINT ;
var ISNEEDFEE = record . data . ISNEEDFEE ;
var VOUCHERNO = record . data . VOUCHERNO ;
var ISDELETE = record . data . ISDELETE ;
var BILLSTATUS = record . data . BILLSTATUS ;
if ( BILLSTATUS == 1 ) {
Ext . Msg . show ( { title : '提示' , msg : '已锁定,无法删除或作废!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( VOUCHERNO != '' ) {
Ext . Msg . show ( { title : '提示' , msg : '已生成凭证无法删除此发票!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( ISDELETE == 'True' ) {
Ext . Msg . show ( { title : '提示' , msg : '此发票已作废!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
Ext . MessageBox . confirm ( '提示' , '确定要作废该记录吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/Account/Chfee_invoice_HangXin/DeleteUp' ,
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 . reload ( ) ;
}
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
onCancelDeleteUpClick : 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 ] ;
var ISNEEDPRINT = record . data . ISNEEDPRINT ;
var ISNEEDFEE = record . data . ISNEEDFEE ;
var VOUCHERNO = record . data . VOUCHERNO ;
var ISDELETE = record . data . ISDELETE ;
if ( ISDELETE != 'True' ) {
Ext . Msg . show ( { title : '提示' , msg : '当前状态无法取消作废!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
Ext . MessageBox . confirm ( '提示' , '确定要取消作废吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/Account/Chfee_invoice_HangXin/CancelDeleteUp' ,
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 . reload ( ) ;
}
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 . BILLNO ;
if ( rec . data . BILLSTATUS == '0' ) {
if ( BILLNOStr == '' )
BILLNOStr = BILLNO ;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO ;
}
}
}
if ( BILLNOStr == '' ) {
} else {
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/Account/Chfee_invoice_HangXin/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 . onRefreshClick ( ) ;
}
} 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 ;
}
//#region 判断是否生成过凭证
var sError1 = "" ;
var sError2 = "" ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
var BILLNO = rec . data . BILLNO ;
//接口凭证
var sVOUCHERNO = rec . data . VOUCHERNO ;
if ( sVOUCHERNO != "" ) {
if ( sError1 == "" )
sError1 = BILLNO ;
else {
sError1 = sError1 + ',' + BILLNO ;
}
}
//总账凭证
var sVOUNO = rec . data . VOUNO ;
if ( sVOUNO != "" ) {
if ( sError2 == "" )
sError2 = BILLNO ;
else {
sError2 = sError2 + ',' + BILLNO ;
}
}
}
if ( sError1 != "" ) {
Ext . Msg . show ( { title : '提示' , msg : '单据 “' + sError1 + '” 已经生成接口凭证,不允许解除锁定!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( sError2 != "" ) {
Ext . Msg . show ( { title : '提示' , msg : '单据 “' + sError2 + '” 已经生成总账凭证,不允许解除锁定!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
//#endregion
var BILLNOStr = '' ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
var BILLNO = rec . data . BILLNO ;
if ( ( rec . data . BILLSTATUS == '1' ) ) {
if ( BILLNOStr == '' )
BILLNOStr = BILLNO ;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO ;
}
}
}
if ( BILLNOStr == '' ) {
} else {
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/Account/Chfee_invoice_HangXin/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 . onRefreshClick ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ;
} ,
onExpInvClick : 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 bodyAddDatas = [ ] ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
bodyAddDatas . push ( rec ) ;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll ( bodyAddDatas ) ;
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/Account/Chfee_invoice_HangXin/ExpInv' ,
params : {
bills : jsonbodyAddDatas
} ,
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 {
// var downloadfile = Ext.getCmp('downloadfile');
// var children = downloadfile.items;
// if (children) {
// for (var i = 0, len = children.length; i < len; i++) {
// downloadfile.remove(children.items[i], true);
// }
// }
// var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
// var htmla = Ext.widget('label', {
// html: downloadfiles,
// width: 120,
// text: ''
// });
// downloadfile.items.add(htmla);
// this.winDownloadShow.show();
// return;
var openSet = "height=300, width=600, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + ( screen . height - 200 ) / 2 + ",Left=" + ( screen . width - 200 ) / 2 ;
var openType = "_blank" ;
var openUrl = "../../Reports/FileExport.aspx?filename=" + result . Data ;
window . open ( openUrl , openType , openSet ) ;
_this . storeList . reload ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
onExpDZInvClick : 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 bodyAddDatas = [ ] ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
bodyAddDatas . push ( rec ) ;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll ( bodyAddDatas ) ;
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/Account/Chfee_invoice_HangXin/ExpDZInv' ,
params : {
bills : jsonbodyAddDatas
} ,
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 {
// var downloadfile = Ext.getCmp('downloadfile');
// var children = downloadfile.items;
// if (children) {
// for (var i = 0, len = children.length; i < len; i++) {
// downloadfile.remove(children.items[i], true);
// }
// }
// var downloadfiles = '<a href="' + result.Data + '" style=' + '"text-decoration:none"' + '>' + result.Message + '</a>';
// var htmla = Ext.widget('label', {
// html: downloadfiles,
// width: 120,
// text: ''
// });
// downloadfile.items.add(htmla);
// this.winDownloadShow.show();
// return;
var openSet = "height=300, width=600, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + ( screen . height - 200 ) / 2 + ",Left=" + ( screen . width - 200 ) / 2 ;
var openType = "_blank" ;
var openUrl = "../../Reports/FileExport.aspx?filename=" + result . Data ;
window . open ( openUrl , openType , openSet ) ;
_this . storeList . reload ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
onExpRYTInvClick : 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 rec = selections [ 0 ] ;
var cust = rec . data . CUSTOMERNAME ;
var DZSTATUS = rec . data . DZSTATUS ;
if ( DZSTATUS == '已开票' ) {
Ext . Msg . show ( { title : '提示' , msg : '已开电子发票!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
this . formDZInvShow = Ext . widget ( 'form' , {
frame : true ,
title : '电子开票' ,
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 : [
{
fieldLabel : '客户邮箱' , //'编号',
name : 'email' ,
labelWidth : 60 ,
enableKeyEvents : true
}
]
}
] //end root items
} ) ;
var selectrecords = DsStoreQueryBy ( this . storeCust , 'CustName' , cust ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formDZInvShow . getForm ( ) . findField ( 'email' ) . setValue ( selectdata . EMAIL ) ;
}
this . winDZInvShow = Ext . create ( 'Ext.window.Window' , {
title : "" ,
// closeAction: 'hide',
width : 400 ,
height : 150 ,
layout : 'border' ,
resizable : true ,
modal : true ,
closeAction : 'close' ,
closable : true ,
items : [ this . formDZInvShow ] ,
buttons : [ {
text : "确定" ,
minWidth : 70 ,
handler : function ( ) {
// var remarkstr = formRemarkShow.getForm().findField('INVREMARK').getValue();
// var cgFILEROLE = Ext.getCmp('hjFILEROLEGet');
// var FILEROLE = cgFILEROLE.getValue();
var email = _this . formDZInvShow . getForm ( ) . findField ( 'email' ) . getValue ( ) ;
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/Account/Chfee_invoice_HangXin/ExpRYDInv' ,
params : {
gid : rec . data . GID ,
email : email
} ,
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 ( ) ;
_this . winDZInvShow . close ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
}
} , {
text : "关闭" ,
minWidth : 70 ,
handler : function ( ) {
_this . winDZInvShow . close ( ) ;
}
} ]
} ) ;
_this . winDZInvShow . show ( ) ;
} ,
onGETONEPDFClick : 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];
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 ;
}
}
Ext . MessageBox . confirm ( '提示' , '确定合并下载这些发票吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Ajax . request ( {
waitMsg : '正在获取数据...' ,
url : '/Account/Chfee_invoice_HangXin/GetONEPDF' ,
params : {
BILLNOS : feeGidSql
} ,
callback : function ( options , success , response ) {
if ( success ) {
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
window . open ( jsonresult . Data ) ;
}
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 ) ;
} ,
//onExpDZInvClick: function (email) {
// 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 rec = selections[0];
// Ext.Ajax.request({
// waitMsg: '正在添加数据...',
// url: '/Account/Chfee_invoice_HangXin/ExpDZInv',
// params: {
// gid: rec.data.GID,
// email: email
// },
// 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
// });
//},
getCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
if ( ! form . isValid ( ) ) {
Ext . Msg . alert ( '提示' , '查询条件赋值错误,请检查。' ) ;
return '' ;
}
var sql = '' ;
var BILLNO = form . findField ( 'BsNo' ) . getValue ( ) ;
// sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
sql = sql + getAndConSql ( sql , BILLNO , " BILLNO like '%" + BILLNO + "%'" ) ;
var MBLNO = form . findField ( 'MBLNO' ) . getValue ( ) ;
// sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
sql = sql + getAndConSql ( sql , MBLNO , "EXISTS (SELECT 1 FROM CH_FEE_DO d left join v_op_bill b on (b.BSNO=D.BSNO) WHERE D.BILLNO=CM.BILLNO AND b.MBLNO like '%" + MBLNO + "%' ) " ) ;
var invoiceNo = form . findField ( 'InvNo' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , invoiceNo , " INVOICENO like '%" + invoiceNo + "%' " ) ;
var custName = form . findField ( 'CustName' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , custName , " INVOICECUSTNAME like '%" + custName + "%' " ) ;
var expDateBgn = form . findField ( 'ExpDateBgn' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , expDateBgn , "INVOICEMAKETIME >='" + expDateBgn + "'" ) ;
var expDateEnd = form . findField ( 'ExpDateEnd' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , expDateEnd , "INVOICEMAKETIME <='" + expDateEnd + " 23:59:59'" ) ;
var companyid = form . findField ( 'companyid' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , companyid , "companyid = '" + companyid + "'" ) ;
var ShenNo = form . findField ( 'ShenNo' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , ShenNo , " BILLNO IN (SELECT INVBILLNO FROM ch_fee_invoiceapplication WHERE BILLNO like '%" + ShenNo + "%')" ) ;
return sql ;
} ,
OprationSwap : function ( ) {
var ret = new Array ( ) ;
ret [ 0 ] = this . OprationStatus ;
ret [ 1 ] = this . storeList ;
ret [ 2 ] = this . SelectedRecord ;
ret [ 3 ] = this . storeCust ;
ret [ 4 ] = this . INVITERFACE ;
return ret ;
} ,
onExportClick : function ( button , event ) {
_this = this ;
if ( this . storeList . getCount ( ) == 0 ) {
return ;
}
var sortstr = '' ;
Ext . Msg . wait ( '正在组织数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在组织数据...' ,
url : '/Account/Chfee_invoice_HangXin/GetDataListStr' ,
//(int start, int limit, string sort, string condition, int billtype)
scope : this ,
params : {
start : 0 ,
limit : 10000000 ,
sort : sortstr ,
condition : _this . sqlcontext ,
billtype : 0
} ,
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 condition = jsonresult . Message ;
if ( condition != '' ) condition = ' where ' + condition ;
var printType = 'MSINVOICELIST' ;
var sql1 = returnstr ;
sql1 = sql1 . replace ( /\+/g , "@@@" )
if ( sql1 != '' ) {
GridExportBySql ( sql1 , this . formname , '发票开出列表.xls' ) ;
}
} 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
} ) ;
}
}
} ) ;
} ,
//Print: function () {
// _this = this;
// if (this.storeList.getCount() == 0) {
// return;
// }
// Ext.Msg.wait('正在组织数据, 请稍侯..');
// Ext.Ajax.request({
// waitMsg: '正在组织数据...',
// url: '/Account/Chfee_invoice_HangXin/GetDataListStr',
// //(int start, int limit, string sort, string condition, int billtype)
// scope: this,
// params: {
// start: 0,
// limit: 10000000,
// sort: "",
// condition: _this.sqlcontext,
// billtype:0
// },
// 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 = 'MSINVOICELIST';
// 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
// });
// }
// }
// });
//},
Print : function ( ) {
_this = this ;
if ( this . storeList . getCount ( ) == 0 ) {
return ;
}
var sortstr = ' OPERATETIME DESC ' ;
if ( this . sortfield != '' && this . sortdire != '' ) {
sortstr = this . sortfield + ' ' + this . sortdire ;
}
Ext . Msg . wait ( '正在组织数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在组织数据...' ,
url : '/Account/Chfee_invoice/GetDataListStr' ,
//(int start, int limit, string sort, string condition, int billtype)
scope : this ,
params : {
start : 0 ,
limit : 10000000 ,
billtype : 1 ,
sort : sortstr ,
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 = 'MSINVOICELIST' ;
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 = 'MSCHFEINVOICESEL' ;
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.OPERATOR) as OPERATORNAME" ;
sql1 = sql1 + ",dbo.GetFeeNoStlByInvNo(p.BILLNO) as NOSTL FROM ch_fee_invoice p WHERE BILLNO IN (" + feeGidSql + ") " ;
var sql2 = "" ;
var sql3 = "" ;
var sql4 = "" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 ) ;
}
} ) ;