Ext . namespace ( 'Shipping' ) ;
Shipping . MsCwVouchersGlChFeeIndex = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsCwVouchersGlChFeeIndex . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsCwVouchersGlChFeeIndex , Ext . Panel , {
PageSize : 100 ,
SelectedRecord : null ,
OprationStatus : null ,
sqlcontext : '' ,
strCwSTARTGID : '' ,
initUIComponents : function ( ) {
this . formname = "formMsCwVouchersGlChFeeIndex" ; //成本收入
this . ISRATESET = 0 ;
this . sqlcontext = '' ;
//#region formSearch 下拉框信息加载
//凭证状态
var _this = this ;
Ext . define ( 'ISVOUALLNOModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataISVOUALLNO = [ { "Name" : "未生成" } , { "Name" : "已生成" } , { "Name" : "" } ] ;
var storeISVOUALLNO = Ext . create ( 'Ext.data.Store' , { model : 'ISVOUALLNOModel' , data : dataISVOUALLNO } ) ;
this . comboxISVOUALLNO = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '凭证状态' ,
forceSelection : true ,
store : storeISVOUALLNO ,
id : 'ISVOUALLNO' ,
name : 'ISVOUALLNO' ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
value : "未生成" ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//业务类型
this . storeOPLBNAME = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.OPLBModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetOPLBList' }
} ) ;
this . storeOPLBNAME . load ( { params : { condition : "" } } ) ;
this . comboxOPLBNAME = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '业务类型' ,
store : this . storeOPLBNAME ,
forceSelection : true ,
name : 'OPLBNAME' ,
valueField : 'OPLBNAME' ,
displayField : 'OPLBNAME' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//委托单位
this . storeCustCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListController' }
} ) ;
//this.storeCustCode.load({ params: { condition: ""} }); //ISCONTROLLER='1'
this . comboxCustCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '委托单位' ,
store : this . storeCustCode ,
queryMode : 'remote' ,
matchFieldWidth : false ,
minChars : 1 ,
queryParam : 'CODENAME' ,
forceSelection : true ,
name : 'CUSTOMERNAME' ,
valueField : 'CustName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//结算单位
this . storeSETTLEMENTNAME = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListRm' }
} ) ;
// this.storeSETTLEMENTNAME.load({ params: { condition: ""} }); //ISCONTROLLER='1'
this . comboxSETTLEMENTNAME = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '结算单位' ,
store : this . storeSETTLEMENTNAME ,
queryMode : 'remote' ,
matchFieldWidth : false ,
minChars : 1 ,
queryParam : 'CODENAME' ,
forceSelection : true ,
name : 'SETTLEMENTNAME' ,
valueField : 'CustName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//收付类型
Ext . define ( 'FEETYPEModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataFEETYPE = [ { "Name" : "收" } , { "Name" : "付" } , { "Name" : "" } ] ;
var storeFEETYPE = Ext . create ( 'Ext.data.Store' , { model : 'FEETYPEModel' , data : dataFEETYPE } ) ;
this . comboxFEETYPE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收付' ,
forceSelection : true ,
store : storeFEETYPE ,
flex : 0.4 ,
labelWidth : 30 ,
id : 'FEETYPE' ,
name : 'FEETYPE' ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//费用名称
this . storeFeeNameRef = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.FeeTypeRefModel' ,
proxy : { url : '/MvcShipping/MsChFee/GetFeeTypeRefList' }
} ) ;
this . storeFeeNameRef . load ( { params : { condition : "" } } ) ;
this . comboxFeeNameRef = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '费用名称' ,
store : this . storeFeeNameRef ,
forceSelection : true ,
name : 'FeeName' ,
valueField : 'Name' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
this . StoreFeeFrt = Ext . create ( 'Ext.data.Store' , {
fields : [ 'DC' , 'NAME' ]
} ) ;
this . StoreFeeFrt . add ( { "DC" : "" , "NAME" : "全部" } ) ;
this . StoreFeeFrt . add ( { "DC" : "PP" , "NAME" : "PP" } ) ;
this . StoreFeeFrt . add ( { "DC" : "CC" , "NAME" : "CC" } ) ;
this . comboxFeeFrt = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'FRT' ,
store : this . StoreFeeFrt ,
valueField : 'DC' ,
displayField : 'NAME' ,
flex : 0.5 ,
labelWidth : 30 ,
value : '' ,
forceSelection : true ,
name : 'FEEFRT' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
//费用范围
Ext . define ( 'FEESTATUSModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataFEESTATUS = [ { "Name" : "仅录入状态" } , { "Name" : "仅提交审核" } , { "Name" : "已审核通过" } , { "Name" : "仅审核通过" } , { "Name" : "仅部分结算" } , { "Name" : "仅结算完毕" } ] ;
var storeFEESTATUS = Ext . create ( 'Ext.data.Store' , { model : 'FEESTATUSModel' , data : dataFEESTATUS } ) ;
this . comboxFEESTATUS = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '费用范围' ,
forceSelection : true ,
store : storeFEESTATUS ,
id : 'FEESTATUS' ,
name : 'FEESTATUS' ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
value : "已审核通过" ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//币别
this . storeCodeCurrency = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeCurrencyModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeCurrencyList' }
} ) ;
this . storeCodeCurrency . load ( ) ;
this . comboxCodeCurrency = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '币别' ,
store : this . storeCodeCurrency ,
flex : 0.5 ,
labelWidth : 40 ,
forceSelection : true ,
id : 'CURRENCY' ,
name : 'CURRENCY' ,
valueField : 'CODENAME' ,
displayField : 'CODENAME' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//费用锁定
Ext . define ( 'ISFEESTATUSModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataISFEESTATUS = [ { "Name" : "未锁定" } , { "Name" : "已锁定" } , { "Name" : "" } ] ;
var storeISFEESTATUS = Ext . create ( 'Ext.data.Store' , { model : 'ISFEESTATUSModel' , data : dataISFEESTATUS } ) ;
this . comboxISFEESTATUS = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '费用锁定' ,
forceSelection : true ,
store : storeISFEESTATUS ,
name : 'ISFEESTATUS' ,
labelAlign : 'right' ,
flex : 0.6 ,
valueField : 'Name' ,
displayField : 'Name' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//是否垫付
Ext . define ( 'ISADVANCEDPAYModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataISADVANCEDPAY = [ { "Name" : "是" } , { "Name" : "否" } , { "Name" : "" } ] ;
var storeISADVANCEDPAY = Ext . create ( 'Ext.data.Store' , { model : 'ISADVANCEDPAYModel' , data : dataISADVANCEDPAY } ) ;
this . comboxISADVANCEDPAY = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '是否垫付' ,
forceSelection : true ,
store : storeISADVANCEDPAY ,
flex : 0.6 ,
name : 'ISADVANCEDPAY' ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
value : '' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//是否禁开发票
Ext . define ( 'ISINVOICEModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataISINVOICE = [ { "Name" : "是" } , { "Name" : "否" } , { "Name" : "" } ] ;
var storeISINVOICE = Ext . create ( 'Ext.data.Store' , { model : 'ISINVOICEModel' , data : dataISINVOICE } ) ;
this . comboxISINVOICE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '禁开发票' ,
forceSelection : true ,
store : storeISINVOICE ,
name : 'ISINVOICE' ,
labelAlign : 'right' ,
flex : 0.6 ,
valueField : 'Name' ,
displayField : 'Name' ,
value : '' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
this . comboxISCRMORDER = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '销售订舱' ,
forceSelection : true ,
store : storeISINVOICE ,
name : 'ISCRMORDER' ,
flex : 0.6 ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
value : '' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//所属公司, 需求编号: SR2017062800002
Ext . define ( 'SubComp' , {
extend : 'Ext.data.Model' ,
fields : [
{ name : 'GID' , type : 'string' } ,
{ name : 'NAME' , type : 'string' } ,
{ name : 'ENNAME' , type : 'string' }
]
} ) ;
this . StoreSubComp = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'SubComp' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetCompanyEN' }
} ) ;
this . StoreSubComp . load ( { params : { condition : "" } } ) ;
this . comboxSubComp = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '所属公司' ,
store : this . StoreSubComp ,
name : 'SUBCOMP' ,
valueField : 'GID' ,
displayField : 'NAME' ,
value : COMPANYID ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . comboxSaleComp = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '业务所属分部' ,
store : this . StoreSubComp ,
labelWidth : 80 ,
name : 'SALECOMP' ,
valueField : 'GID' ,
displayField : 'NAME' ,
// value: COMPANYID,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
//#endregion
//#region formSearch 查询面板
this . formSearch2 = Ext . widget ( 'form' , {
frame : true ,
//region: "west",
border : false ,
width : 130 ,
items : [ {
xtype : 'radiogroup' ,
id : 'rdLBYS' ,
name : 'rdLBYS' ,
vertical : true ,
items : [
{ id : 'rdoHJ' , boxLabel : '按业务' , name : 'OBJNUM' , inputValue : '按业务' } ,
{ id : 'rdoMX' , boxLabel : '按费用' , name : 'OBJNUM' , inputValue : '按费用' , checked : true } //
] ,
listeners : {
change : function ( rd , newValue , oldValue , eOpts ) {
saveQuerySetting ( _this . formname , _this . formSearch2 , false , true ) ;
// _this.onRefreshClick();
if ( newValue . OBJNUM . toString ( ) == "按业务" ) {
_this . gridListBS . show ( ) ; //显示按钮
_this . gridList . hide ( ) ; //隐藏按钮
}
else {
_this . gridList . show ( ) ; //显示按钮
_this . gridListBS . hide ( ) ; //隐藏按钮
}
}
}
} ] //end root items
} ) ;
this . formSearch = Ext . widget ( 'form' , {
frame : true ,
border : false ,
region : 'center' ,
bodyPadding : 5 ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 60 ,
msgTarget : 'qtip'
} ,
items : [ { //fieldset 1
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . formSearch2 , {
fieldLabel : '会计期间' ,
xtype : 'monthfield' ,
editable : false ,
id : 'ACCDATEbgn' ,
name : 'ACCDATEbgn' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : '到' ,
xtype : 'monthfield' ,
editable : false ,
labelWidth : 20 ,
flex : 0.8 ,
id : 'ACCDATEend' ,
name : 'ACCDATEend' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : 'ETD日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ETDbgn' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : '到' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
labelWidth : 20 ,
flex : 0.8 ,
name : 'ETDend' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , this . comboxISADVANCEDPAY , this . comboxISINVOICE , this . comboxISCRMORDER , this . comboxSubComp ] //所属公司, 需求编号: SR2017062800002
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxISVOUALLNO , this . comboxOPLBNAME , {
fieldLabel : '主提单号' ,
name : 'MBLNO' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : '委托单号' ,
name : 'CUSTNO' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , this . comboxCustCode , {
fieldLabel : '凭证号' ,
name : 'VOUALLNO' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , this . comboxSaleComp ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxSETTLEMENTNAME , this . comboxFeeNameRef , this . comboxFEESTATUS , this . comboxISFEESTATUS , this . comboxFEETYPE , this . comboxCodeCurrency , this . comboxFeeFrt , {
fieldLabel : '费用封账日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
labelWidth : 80 ,
name : 'Closebgn' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : '到' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'Closeend' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ]
} ] //end items(fieldset 1)
} ] //end root items
} ) ;
//#endregion formSearch
//#region 按业务
//#region 定义数据集
this . storeListBS = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsCwVouchersGlChFeeBSModel' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
timeout : 6000000 , //60秒
url : '/MvcShipping/MsCwVouchersGlChFee/GetDataListBS' ,
reader : {
id : 'BSNO,VOUALLNO' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//#endregion
//#region 定义列
this . PagenumBS = 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 ( ) ;
}
}
}
} ) ;
Ext . grid . RowNumbererBS = Ext . extend ( Ext . grid . RowNumberer , {
width : 50
} ) ;
this . GridCheckBoxModelBS = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . girdcolumsBS = [ {
dataIndex : 'BSNO' ,
header : '唯一编码' ,
width : 0
} , {
sortable : true ,
dataIndex : 'VOUALLNO' ,
header : '凭证号' ,
width : 150
} , {
sortable : true ,
dataIndex : 'OPLBNAME' ,
header : '业务类型' ,
width : 70
} , {
sortable : true ,
dataIndex : 'CUSTOMERNAME' ,
header : '委托单位' ,
width : 150
} , {
sortable : true ,
dataIndex : 'CUSTNO' ,
header : '委托单号' ,
width : 150
} , {
sortable : true ,
dataIndex : 'MBLNO' ,
header : '主提单号' ,
width : 150
} , {
sortable : true ,
dataIndex : 'ACCDATE' ,
header : '会计期间' ,
width : 60
} , {
sortable : true ,
dataIndex : 'SALE' ,
header : '揽货人' ,
width : 60
} , {
sortable : true ,
dataIndex : 'ETD' ,
header : '业务日期( ETD) ' ,
width : 100
} , {
sortable : true ,
dataIndex : 'FEECLOSETIME' ,
header : '费用封账日期' ,
width : 100
} ] ;
//#endregion
//#region List列表显示信息
this . gridListBS = new Ext . grid . GridPanel ( {
store : this . storeListBS ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
enableHdMenu : false , //是否显示表格列的菜单
stripeRows : true , //斑马线效果
rowLines : true ,
columnLines : true ,
columns : this . girdcolumsBS ,
selModel : this . GridCheckBoxModelBS ,
viewConfig : {
enableTextSelection : true , //允许复制数据
autoFill : true
} ,
// paging bar on the bottom
bbar : [ Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeListBS ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} ) , this . PagenumBS ]
} ) ;
////////////////////////////////////////////////
this . gridListBS . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
var strCUSTNO = record . data . CUSTNO . toString ( ) ;
var dData = dataview . store . data ;
for ( var i = 0 ; i < dData . length ; i ++ ) {
var sCUSTNO = dData . items [ i ] . data . CUSTNO . toString ( ) ;
if ( sCUSTNO == strCUSTNO ) {
this . gridListBS . selModel . select ( i , true , false ) ;
}
}
} , this ) ;
//#endregion
//#endregion
//#region 按费用
//#region 定义数据集
this . storeList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsCwVouchersGlChFeeModel' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
timeout : 6000000 , //60秒
url : '/MvcShipping/MsCwVouchersGlChFee/GetDataList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//#endregion
//#region 定义列
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 ( ) ;
}
}
}
} ) ;
Ext . grid . RowNumberer = Ext . extend ( Ext . grid . RowNumberer , {
width : 50
} ) ;
this . GridCheckBoxModel = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . girdcolums = [ {
dataIndex : 'GID' ,
header : '唯一编码' ,
width : 0
} , {
sortable : true ,
dataIndex : 'VOUALLNO' ,
header : '凭证号' ,
width : 100
} , {
sortable : true ,
dataIndex : 'OPLBNAME' ,
header : '业务类型' ,
width : 100
} , {
sortable : true ,
dataIndex : 'CUSTOMERNAME' ,
header : '委托单位' ,
width : 100
} , {
sortable : true ,
dataIndex : 'CUSTNO' ,
header : '委托单号' ,
width : 150
} , {
sortable : true ,
dataIndex : 'MBLNO' ,
header : '主提单号' ,
width : 100
} , {
sortable : true ,
dataIndex : 'ACCDATE' ,
header : '会计期间' ,
width : 60
} , {
sortable : true ,
dataIndex : 'ETD' ,
header : '业务日期( ETD) ' ,
width : 80
} , {
sortable : true ,
dataIndex : 'SALE' ,
header : '揽货人' ,
width : 60
} , {
sortable : true ,
dataIndex : 'FEETYPE' ,
header : '费用类型' ,
width : 60
} , {
sortable : true ,
dataIndex : 'FEESTATUS' ,
header : '费用状态' ,
width : 70
} , {
sortable : true ,
dataIndex : 'FEENAME' ,
header : '费用名称' ,
width : 100
} , {
sortable : true ,
dataIndex : 'SETTLEMENTNAME' ,
header : '结算单位' ,
width : 100
} , {
sortable : true ,
dataIndex : 'UNIT' ,
header : '单位' ,
width : 60
} , {
sortable : true ,
dataIndex : 'UNITPRICE' ,
header : '不含税单价' ,
align : 'right' ,
width : 80 ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} , {
sortable : true ,
dataIndex : 'TAXRATE' ,
header : '税率' ,
align : 'right' ,
width : 60
} , {
sortable : true ,
dataIndex : 'TAXUNITPRICE' ,
header : '单价' ,
align : 'right' ,
width : 80 ,
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 : 'QUANTITY' ,
header : '数量' ,
width : 60
} , {
sortable : true ,
dataIndex : 'NOTAXAMOUNT' ,
header : '不含税金额' ,
align : 'right' ,
width : 80 ,
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 : 80 ,
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 : 'CURRENCY' ,
header : '币别' ,
editor : this . comboxCurr ,
width : 40
} , {
sortable : true ,
dataIndex : 'EXCHANGERATE' ,
header : '汇率' ,
align : 'right' ,
width : 60
} , {
sortable : true ,
dataIndex : 'ACCTAXRATE' ,
header : '销项税率' ,
align : 'right' ,
width : 60
} , {
sortable : true ,
dataIndex : 'SETTLEMENT' ,
header : '结算金额' ,
align : 'right' ,
width : 80 ,
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 : 'INVOICE' ,
header : '开票金额' ,
align : 'right' ,
width : 80 ,
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 : 'INVOICENUM' ,
header : '发票号码' ,
width : 100
} , {
sortable : true ,
dataIndex : 'REMARK' ,
header : '费用备注' ,
width : 300
} , {
sortable : true ,
dataIndex : 'ENTEROPERATOR' ,
header : '录入人' ,
width : 60
} , {
sortable : true ,
dataIndex : 'ENTERDATE' ,
header : '录入时间' ,
width : 140
} , {
sortable : true ,
dataIndex : 'BSNO' ,
header : '' , //唯一编码
hidden : true ,
width : 0
} ] ;
//#endregion
//#region List列表显示信息
this . gridList = new Ext . grid . GridPanel ( {
store : this . storeList ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
enableHdMenu : false , //是否显示表格列的菜单
stripeRows : true , //斑马线效果
rowLines : true ,
columnLines : true ,
columns : this . girdcolums ,
selModel : this . GridCheckBoxModel ,
viewConfig : {
enableTextSelection : true , //允许复制数据
autoFill : true
} ,
// paging bar on the bottom
bbar : [ Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeList ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} ) , this . Pagenum ]
} ) ;
////////////////////////////////////////////////
this . gridList . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
var strCUSTNO = record . data . CUSTNO . toString ( ) ;
var dData = dataview . store . data ;
for ( var i = 0 ; i < dData . length ; i ++ ) {
var sCUSTNO = dData . items [ i ] . data . CUSTNO . toString ( ) ;
if ( sCUSTNO == strCUSTNO ) {
this . gridList . selModel . select ( i , true , false ) ;
}
}
} , this ) ;
//#endregion
//#endregion
//#region 按钮工具条
this . panelBtn = new Ext . Panel ( {
region : "center" ,
border : false ,
tbar : [ {
text : "执行查询" ,
iconCls : "btnrefresh" ,
handler : function ( button , event ) {
this . onRefreshClick ( ) ;
} ,
scope : this
} , {
text : "重置条件" ,
iconCls : "btnreset" ,
handler : function ( button , event ) {
this . onClearSql ( button , event ) ;
} ,
scope : this
} , '-' , {
text : "生成凭证" ,
id : "btnAddCwVouchers" ,
iconCls : "btnadd" ,
handler : function ( button , event ) {
this . onAddCwVouchers ( ) ;
} ,
scope : this
} , '-' , {
text : "导出Excel" ,
id : "btnExportExcel" ,
iconCls : 'btnexportexcel' ,
handler : function ( button , event ) {
this . onExportClick ( button , event ) ;
} ,
scope : this
} , '-' , {
text : "高级查询" ,
iconCls : "btnmore" ,
handler : function ( button , event ) {
var sql = this . getCondition ( ) ;
var form = this . formSearch . getForm ( ) ;
//封账日期
var Closebgn = form . findField ( 'Closebgn' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , Closebgn , "CONVERT(char(10), c.FEECLOSETIME, 20)>='" + Closebgn + "'" ) ;
var Closeend = form . findField ( 'Closeend' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , Closeend , "CONVERT(char(10),c.FEECLOSETIME, 20)<='" + Closeend + "'" ) ;
var winAccess = new Shipping . DsQuery ( {
} ) ;
winAccess . StoreList = this . storeList ;
winAccess . formname = this . formname ;
winAccess . condition = sql ;
winAccess . show ( ) ;
return ;
} ,
scope : this
}
//, {
// text: "打印",
// iconCls: 'btnprint',
// handler: function (button, event) {
// this.Print();
// },
// scope: this
//}
]
} ) ;
//#endregion
//#region 页面布局
this . panelZQ = new Ext . Panel ( {
layout : "border" ,
region : "east" ,
width : 500 ,
style : 'text-align:right;' ,
border : false ,
items : [ {
xtype : 'displayfield' ,
id : 'lbTitle2' ,
name : 'lbTitle2' ,
value : " "
} ]
} ) ;
this . panelTopF = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 26 ,
//border: false,
items : [ this . panelBtn , this . panelZQ ]
} ) ;
this . panelTop = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 130 ,
border : false ,
items : [ this . panelTopF , this . formSearch ]
} ) ;
Ext . apply ( this , {
border : false ,
items : [ this . panelTop , this . gridList , this . gridListBS ]
} ) ;
//this.onRefreshClick();
//#endregion
//#region 页面加载
this . storeList . on ( 'beforeload' , function ( store ) {
var strCondition = this . getCondition ( ) ;
var form = this . formSearch . getForm ( ) ;
//封账日期
var Closebgn = form . findField ( 'Closebgn' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closebgn , "CONVERT(char(10), c.FEECLOSETIME, 20)>='" + Closebgn + "'" ) ;
var Closeend = form . findField ( 'Closeend' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closeend , "CONVERT(char(10),c.FEECLOSETIME, 20)<='" + Closeend + "'" ) ;
Ext . apply ( store . proxy . extraParams , { condition : strCondition } ) ;
} , this ) ;
this . storeListBS . on ( 'beforeload' , function ( store ) {
var strCondition = this . getCondition ( ) ;
var form = this . formSearch . getForm ( ) ;
//封账日期
var Closebgn = form . findField ( 'Closebgn' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closebgn , "CONVERT(char(10), c.FEECLOSETIME, 20)>='" + Closebgn + "'" ) ;
var Closeend = form . findField ( 'Closeend' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closeend , "CONVERT(char(10),c.FEECLOSETIME, 20)<='" + Closeend + "'" ) ;
Ext . apply ( store . proxy . extraParams , { condition : strCondition } ) ;
} , this ) ;
//#endregion
//#region 生成凭证_汇率列表
//#region 加载数据
//制单人
this . storePREPAREDCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.UserRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserRefList' }
} ) ;
this . storePREPAREDCode . load ( ) ;
this . comboxPREPARED = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '制单人' ,
store : this . storePREPAREDCode ,
forceSelection : true ,
id : 'PREPARED' ,
name : 'PREPARED' ,
valueField : 'UserName' ,
displayField : 'CodeAndName' ,
value : SHOWNAME
} ) ;
//#endregion
//#region 定义数据集
this . storeListCw = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsCodeCurrencyList' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsCwVouchersGlChFee/GetCodeCurrencyList' ,
reader : {
id : 'CURR' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//#endregion
//#region 列定义
this . girdcolums = [ {
sortable : false ,
text : '币别' ,
dataIndex : 'CURR' ,
width : 100 ,
align : 'center'
} , {
sortable : false ,
text : '调整汇率' ,
dataIndex : 'FCYEXRATE' ,
width : 118 ,
align : 'right' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) { try { var lsValue = usMoney ( value , 5 , '' , false ) ; if ( lsValue != "NaN" ) { value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ; } } else { return value ; } } catch ( e ) { return value ; } return value ; } ,
editor : {
xtype : 'numberfield' ,
selectOnFocus : true , //得到焦点时自动选择文本
allowDecimals : true , //允许输入小数
decimalPrecision : 5 , //允许保留的小数位数,并四舍五入
nanText : '请输入有效数值' ,
hideTrigger : true //是否隐藏上下调节按钮
}
} ] ;
//#endregion
//#region gridList列表显示信息
this . gridListCellEditing = Ext . create ( 'Ext.grid.plugin.CellEditing' , {
clicksToEdit : 1 //1单击, 2双击
} ) ;
this . gridListCw = new Ext . grid . GridPanel ( {
region : 'center' ,
width : 220 ,
store : this . storeListCw ,
enableHdMenu : false , //是否显示表格列的菜单
hideHeaders : false , //是否隐藏表头
rowLines : true ,
columnLines : true ,
loadMask : { msg : "数据加载中,请稍等..." } ,
plugins : [ this . gridListCellEditing ] ,
selType : 'cellmodel' ,
columns : this . girdcolums
} ) ;
//#endregion
//#endregion
//#region 页面加载
_this . gridList . show ( ) ; //显示按钮
_this . gridListBS . hide ( ) ; //隐藏按钮
this . InitData ( ) ;
Ext . Ajax . request ( {
waitMsg : '' ,
url : '/MvcShipping/MsBaseInfo/GetCwISRATESET' ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( result . Success != true ) {
} else {
var data = result . data ;
if ( data == '1' ) {
this . ISRATESET = 1 ;
} else {
}
}
} else {
}
} ,
scope : this
} ) ;
} , //end initUIComponents
//#region 加载事件
InitData : function ( ) {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcShipping/RptCwGenlegAccitems/GetData' ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
return ;
}
data = result . data ;
var arrtmp = data . toString ( ) . split ( "&" ) ;
this . strCwSTARTGID = arrtmp [ 0 ] . toString ( ) ;
var strCwSTARTNAME = arrtmp [ 1 ] . toString ( ) ;
var strCwACCDATE = arrtmp [ 2 ] . toString ( ) ;
var sYear = arrtmp [ 3 ] . toString ( ) ;
var sMonth = arrtmp [ 4 ] . toString ( ) ;
//
var sZQ = " 当前登录账套:“" + strCwSTARTNAME + "” 当前财务账期:“" + sYear + "年第" + sMonth + "期” " ;
Ext . getCmp ( "lbTitle2" ) . setValue ( sZQ ) ;
//this.onRefreshClick();
LoadQueryData ( this . formname , this . formSearch2 , this . CheckSaveQuery ) ;
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
} ,
scope : this
} ) ;
} , //end InitData
//#endregion
//#region 执行查询
onRefreshClick : function ( ) {
var strCondition = this . getCondition ( ) ;
var form = this . formSearch . getForm ( ) ;
//封账日期
var Closebgn = form . findField ( 'Closebgn' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closebgn , "CONVERT(char(10), c.FEECLOSETIME, 20)>='" + Closebgn + "'" ) ;
var Closeend = form . findField ( 'Closeend' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closeend , "CONVERT(char(10),c.FEECLOSETIME, 20)<='" + Closeend + "'" ) ;
this . sqlcontext = strCondition ;
Ext . Ajax . timeout = 6000000 ;
if ( Ext . getCmp ( 'rdLBYS' ) . getValue ( ) . OBJNUM . toString ( ) == "按业务" ) {
this . PageSize = this . PagenumBS . getValue ( ) ;
this . storeListBS . pageSize = this . PageSize ;
this . storeListBS . load ( {
params : { start : 0 , limit : this . PageSize , sort : '' , condition : strCondition } ,
waitMsg : "正在查询数据..." ,
timeout : 6000000 , //60秒
scope : this
} ) ;
}
else {
this . PageSize = this . Pagenum . getValue ( ) ;
this . storeList . pageSize = this . PageSize ;
this . storeList . load ( {
params : { start : 0 , limit : this . PageSize , sort : '' , condition : strCondition } ,
waitMsg : "正在查询数据..." ,
timeout : 6000000 , //60秒
scope : this
} ) ;
}
} ,
onDsQuery : function ( ) {
var strCondition = this . sqlcontext ;
Ext . Ajax . timeout = 6000000 ;
if ( Ext . getCmp ( 'rdLBYS' ) . getValue ( ) . OBJNUM . toString ( ) == "按业务" ) {
this . PageSize = this . PagenumBS . getValue ( ) ;
this . storeListBS . pageSize = this . PageSize ;
this . storeListBS . load ( {
params : { start : 0 , limit : this . PageSize , sort : '' , condition : strCondition } ,
waitMsg : "正在查询数据..." ,
timeout : 6000000 , //60秒
scope : this
} ) ;
}
else {
this . PageSize = this . Pagenum . getValue ( ) ;
this . storeList . pageSize = this . PageSize ;
this . storeList . load ( {
params : { start : 0 , limit : this . PageSize , sort : '' , condition : strCondition } ,
waitMsg : "正在查询数据..." ,
timeout : 6000000 , //60秒
scope : this
} ) ;
}
} ,
getCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
var sql = "" ;
//凭证状态
var ISVOUALLNO = form . findField ( 'ISVOUALLNO' ) . getValue ( ) ;
if ( ISVOUALLNO == "未生成" ) {
sql = sql + getAndConSql ( sql , ISVOUALLNO , "VW_FEE.gid not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this . strCwSTARTGID + "')" ) ;
}
else if ( ISVOUALLNO == "已生成" ) {
sql = sql + getAndConSql ( sql , ISVOUALLNO , " VW_FEE.gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this . strCwSTARTGID + "')" ) ;
}
//凭证号
var VOUALLNO = form . findField ( 'VOUALLNO' ) . getValue ( ) ;
//sql = sql + getAndConSql(sql, VOUALLNO, "VOUALLNO like '%" + VOUALLNO + "%'");
sql = sql + getAndConSql ( sql , VOUALLNO , " VW_FEE.gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this . strCwSTARTGID + "' and VOUALLNO like '%" + VOUALLNO + "%')" ) ;
// //会计期间
// var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue();
// var ACCDATEend = form.findField('ACCDATEend').getRawValue();
//// sql = sql + getAndConSql(sql, ACCDATEbgn, "((ACCDATE>='" + ACCDATEbgn + "' and ACCDATE<='" + ACCDATEend + "') or (ACCDATE>='" + ACCDATEbgn.replace("-0", "-") + "' and ACCDATE<='" + ACCDATEend.replace("-0", "-") + "'))");
// sql = sql + getAndConSql(sql, ACCDATEbgn, " (ACCDATE>='" + ACCDATEbgn + "' and ACCDATE<='" + ACCDATEend + "') ");
//会计期间
var ACCDATEbgn = form . findField ( 'ACCDATEbgn' ) . getRawValue ( ) ;
var ACCDATEend = form . findField ( 'ACCDATEend' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ACCDATEbgn , " ACCDATE>='" + ACCDATEbgn + "'" ) ;
sql = sql + getAndConSql ( sql , ACCDATEend , " ACCDATE<='" + ACCDATEend + "'" ) ;
//业务日期
var ETDbgn = form . findField ( 'ETDbgn' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ETDbgn , "CONVERT(char(10), ETD, 20)>='" + ETDbgn + "'" ) ;
var ETDend = form . findField ( 'ETDend' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ETDend , "CONVERT(char(10), ETD, 20)<='" + ETDend + "'" ) ;
//业务类型
var OPLBNAME = form . findField ( 'OPLBNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , OPLBNAME , "OPLBNAME='" + OPLBNAME + "'" ) ;
//主提单号
var MBLNO = form . findField ( 'MBLNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , MBLNO , "MBLNO like '%" + MBLNO + "%'" ) ;
//委托单号
var CUSTNO = form . findField ( 'CUSTNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CUSTNO , "CUSTNO like '%" + CUSTNO + "%'" ) ;
//委托单位
var CUSTOMERNAME = form . findField ( 'CUSTOMERNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CUSTOMERNAME , "CUSTOMERNAME='" + CUSTOMERNAME + "'" ) ;
//结算单位
var SETTLEMENTNAME = form . findField ( 'SETTLEMENTNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SETTLEMENTNAME , "SETTLEMENTNAME='" + SETTLEMENTNAME + "'" ) ;
//费用名称
var FeeName = form . findField ( 'FeeName' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FeeName , "FEENAME='" + FeeName + "'" ) ;
//费用范围
var FEESTATUS = form . findField ( 'FEESTATUS' ) . getValue ( ) ;
if ( FEESTATUS == "已审核通过" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "(FEESTATUS='审核通过' or FEESTATUS='部分结算' or FEESTATUS='结算完毕')" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅审核通过" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='审核通过'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅部分结算" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='部分结算'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅结算完毕" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='结算完毕'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅录入状态" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='录入状态'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . hide ( ) ;
}
else if ( FEESTATUS == "仅提交审核" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='提交审核'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . hide ( ) ;
}
//费用范围
var ISFEESTATUS = form . findField ( 'ISFEESTATUS' ) . getValue ( ) ;
if ( ISFEESTATUS == "已锁定" ) {
sql = sql + getAndConSql ( sql , ISFEESTATUS , "ISFEESTATUS=1" ) ;
}
else if ( ISFEESTATUS == "未锁定" ) {
sql = sql + getAndConSql ( sql , ISFEESTATUS , "ISFEESTATUS=0" ) ;
}
//收付类型
var FEETYPE = form . findField ( 'FEETYPE' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FEETYPE , "FEETYPE='" + FEETYPE + "'" ) ;
var FEEFRT = form . findField ( 'FEEFRT' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FEEFRT , "FEEFRT='" + FEEFRT + "'" ) ;
//币别
var CURRENCY = form . findField ( 'CURRENCY' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CURRENCY , "CURRENCY='" + CURRENCY + "'" ) ;
//是否垫付
var ISADVANCEDPAY = form . findField ( 'ISADVANCEDPAY' ) . getValue ( ) ;
if ( ISADVANCEDPAY == "是" ) {
sql = sql + getAndConSql ( sql , ISADVANCEDPAY , "ISADVANCEDPAY=1" ) ;
}
else if ( ISADVANCEDPAY == "否" ) {
sql = sql + getAndConSql ( sql , ISADVANCEDPAY , "ISADVANCEDPAY=0" ) ;
}
//是否禁开发票
var ISINVOICE = form . findField ( 'ISINVOICE' ) . getValue ( ) ;
if ( ISINVOICE == "是" ) {
sql = sql + getAndConSql ( sql , ISINVOICE , "ISINVOICE=1" ) ;
}
else if ( ISINVOICE == "否" ) {
sql = sql + getAndConSql ( sql , ISINVOICE , "ISINVOICE=0" ) ;
}
var ISCRMORDER = form . findField ( 'ISCRMORDER' ) . getValue ( ) ;
if ( ISCRMORDER == "是" ) {
sql = sql + getAndConSql ( sql , ISCRMORDER , "ISCRMORDERFEE=1" ) ;
}
else if ( ISCRMORDER == "否" ) {
sql = sql + getAndConSql ( sql , ISCRMORDER , "ISNULL(ISCRMORDERFEE,0)=0" ) ;
}
//所属公司
var SUBCOMP = form . findField ( 'SUBCOMP' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SUBCOMP , "CORPID='" + SUBCOMP + "'" ) ;
var SALECOMP = form . findField ( 'SALECOMP' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SALECOMP , "SALECORPID='" + SALECOMP + "'" ) ;
return sql ;
} ,
getConditionCw : function ( ) {
var form = this . formSearch . getForm ( ) ;
var sql = "" ;
// //凭证状态
// var ISVOUALLNO = form.findField('ISVOUALLNO').getValue();
// if (ISVOUALLNO == "未生成") {
// sql = sql + getAndConSql(sql, ISVOUALLNO, "gid not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this.strCwSTARTGID + "')");
// }
// else if (ISVOUALLNO == "已生成") {
// sql = sql + getAndConSql(sql, ISVOUALLNO, "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this.strCwSTARTGID + "')");
// }
//凭证号
var VOUALLNO = form . findField ( 'VOUALLNO' ) . getValue ( ) ;
//sql = sql + getAndConSql(sql, VOUALLNO, "VOUALLNO like '%" + VOUALLNO + "%'");
sql = sql + getAndConSql ( sql , VOUALLNO , "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee' and [STARTGID]='" + this . strCwSTARTGID + "' and VOUALLNO like '%" + VOUALLNO + "%')" ) ;
//会计期间
var ACCDATEbgn = form . findField ( 'ACCDATEbgn' ) . getRawValue ( ) ;
var ACCDATEend = form . findField ( 'ACCDATEend' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ACCDATEbgn , " ACCDATE>='" + ACCDATEbgn + "'" ) ;
sql = sql + getAndConSql ( sql , ACCDATEend , " ACCDATE<='" + ACCDATEend + "'" ) ;
//sql = sql + getAndConSql(sql, ACCDATEbgn, "((ACCDATE>='" + ACCDATEbgn + "' and ACCDATE<='" + ACCDATEend + "') or (ACCDATE>='" + ACCDATEbgn.replace("-0", "-") + "' and ACCDATE<='" + ACCDATEend.replace("-0", "-") + "'))");
//业务日期
var ETDbgn = form . findField ( 'ETDbgn' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ETDbgn , "CONVERT(char(10), ETD, 20)>='" + ETDbgn + "'" ) ;
var ETDend = form . findField ( 'ETDend' ) . getRawValue ( ) ;
sql = sql + getAndConSql ( sql , ETDend , "CONVERT(char(10), ETD, 20)<='" + ETDend + "'" ) ;
//业务日期/接单日期
//var OPDATEbgn = form.findField('OPDATEbgn').getRawValue();
//sql = sql + getAndConSql(sql, OPDATEbgn, "CONVERT(char(10), OPDATE, 20)>='" + OPDATEbgn + "'");
//var OPDATEend = form.findField('OPDATEend').getRawValue();
//sql = sql + getAndConSql(sql, OPDATEend, "CONVERT(char(10), OPDATE, 20)<='" + OPDATEend + "'");
//业务类型
var OPLBNAME = form . findField ( 'OPLBNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , OPLBNAME , "OPLBNAME='" + OPLBNAME + "'" ) ;
//主提单号
var MBLNO = form . findField ( 'MBLNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , MBLNO , "MBLNO like '%" + MBLNO + "%'" ) ;
//委托单号
var CUSTNO = form . findField ( 'CUSTNO' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CUSTNO , "CUSTNO like '%" + CUSTNO + "%'" ) ;
//委托单位
var CUSTOMERNAME = form . findField ( 'CUSTOMERNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CUSTOMERNAME , "CUSTOMERNAME='" + CUSTOMERNAME + "'" ) ;
//结算单位
var SETTLEMENTNAME = form . findField ( 'SETTLEMENTNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SETTLEMENTNAME , "SETTLEMENTNAME='" + SETTLEMENTNAME + "'" ) ;
//费用名称
var FeeName = form . findField ( 'FeeName' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FeeName , "FEENAME='" + FeeName + "'" ) ;
//费用范围
var FEESTATUS = form . findField ( 'FEESTATUS' ) . getValue ( ) ;
if ( FEESTATUS == "已审核通过" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "(FEESTATUS='审核通过' or FEESTATUS='部分结算' or FEESTATUS='结算完毕')" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅审核通过" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='审核通过'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅部分结算" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='部分结算'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅结算完毕" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='结算完毕'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . show ( ) ;
}
else if ( FEESTATUS == "仅录入状态" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='录入状态'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . hide ( ) ;
}
else if ( FEESTATUS == "仅提交审核" ) {
sql = sql + getAndConSql ( sql , FEESTATUS , "FEESTATUS='提交审核'" ) ;
Ext . getCmp ( 'btnAddCwVouchers' ) . hide ( ) ;
}
//费用范围
var ISFEESTATUS = form . findField ( 'ISFEESTATUS' ) . getValue ( ) ;
if ( ISFEESTATUS == "已锁定" ) {
sql = sql + getAndConSql ( sql , ISFEESTATUS , "ISFEESTATUS=1" ) ;
}
else if ( ISFEESTATUS == "未锁定" ) {
sql = sql + getAndConSql ( sql , ISFEESTATUS , "ISFEESTATUS=0" ) ;
}
//收付类型
var FEETYPE = form . findField ( 'FEETYPE' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FEETYPE , "FEETYPE='" + FEETYPE + "'" ) ;
var FEEFRT = form . findField ( 'FEEFRT' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , FEEFRT , "FEEFRT='" + FEEFRT + "'" ) ;
//币别
var CURRENCY = form . findField ( 'CURRENCY' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CURRENCY , "CURRENCY='" + CURRENCY + "'" ) ;
//是否垫付
var ISADVANCEDPAY = form . findField ( 'ISADVANCEDPAY' ) . getValue ( ) ;
if ( ISADVANCEDPAY == "是" ) {
sql = sql + getAndConSql ( sql , ISADVANCEDPAY , "ISADVANCEDPAY=1" ) ;
}
else if ( ISADVANCEDPAY == "否" ) {
sql = sql + getAndConSql ( sql , ISADVANCEDPAY , "ISADVANCEDPAY=0" ) ;
}
//是否禁开发票
var ISINVOICE = form . findField ( 'ISINVOICE' ) . getValue ( ) ;
if ( ISINVOICE == "是" ) {
sql = sql + getAndConSql ( sql , ISINVOICE , "ISINVOICE=1" ) ;
}
else if ( ISINVOICE == "否" ) {
sql = sql + getAndConSql ( sql , ISINVOICE , "ISINVOICE=0" ) ;
}
var ISCRMORDER = form . findField ( 'ISCRMORDER' ) . getValue ( ) ;
if ( ISCRMORDER == "是" ) {
sql = sql + getAndConSql ( sql , ISCRMORDER , "ISCRMORDERFEE=1" ) ;
}
else if ( ISCRMORDER == "否" ) {
sql = sql + getAndConSql ( sql , ISCRMORDER , "ISNULL(ISCRMORDERFEE,0)=0" ) ;
}
//所属公司, 需求编号: SR2017062800002
var SUBCOMP = form . findField ( 'SUBCOMP' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SUBCOMP , "CORPID='" + SUBCOMP + "'" ) ;
return sql ;
} ,
//#endregion
//#region 重置条件
onClearSql : function ( ) {
var form = this . formSearch . getForm ( ) ;
form . reset ( ) ;
} ,
//#endregion
//#region 导出Excel
onExportClick : function ( button , event ) {
var sUrl = "" ;
var sHandle = "" ;
if ( Ext . getCmp ( 'rdLBYS' ) . getValue ( ) . OBJNUM . toString ( ) == "按业务" ) {
if ( this . storeListBS . getCount ( ) == 0 ) {
return ;
}
sUrl = "/MvcShipping/MsCwVouchersGlChFee/GetDataListSQLBS" ;
sHandle = "MsCwVouchersGlChFeeBSIndex" ;
}
else {
if ( this . storeList . getCount ( ) == 0 ) {
return ;
}
sUrl = "/MvcShipping/MsCwVouchersGlChFee/GetDataListSQL" ;
sHandle = "MsCwVouchersGlChFeeIndex" ;
}
var strCondition = this . getCondition ( ) ;
var form = this . formSearch . getForm ( ) ;
//封账日期
var Closebgn = form . findField ( 'Closebgn' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closebgn , "CONVERT(char(10), c.FEECLOSETIME, 20)>='" + Closebgn + "'" ) ;
var Closeend = form . findField ( 'Closeend' ) . getRawValue ( ) ;
strCondition = strCondition + getAndConSql ( strCondition , Closeend , "CONVERT(char(10),c.FEECLOSETIME, 20)<='" + Closeend + "'" ) ;
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext . Ajax . request ( {
waitMsg : '正在组织数据, 请稍侯...' ,
url : sUrl ,
params : {
condition : strCondition
} ,
callback : function ( options , success , response ) {
if ( success ) {
var ddd = Ext . MessageBox . isVisible ( ) ;
if ( Ext . MessageBox . isVisible ( ) ) {
Ext . MessageBox . hide ( ) ;
}
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
var returnStr = jsonresult . data ;
if ( returnStr . toString ( ) != "" ) {
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + ( screen . height - 200 ) / 2 + ",Left=" + ( screen . width - 400 ) / 2 ;
var openType = "_blank" ;
var openUrl = "../../Reports/RptExport.aspx?handle=" + sHandle + "&formname=" + this . formname + "&condition1=" + escape ( returnStr . toString ( ) ) ;
window . open ( openUrl , openType , openSet ) ;
}
} else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . Msg . show ( { title : '请重试' ,
msg : '服务器响应出错' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
}
} ,
scope : this
} ) ;
} ,
//#endregion
//#region 生成凭证
onAddCwVouchers : function ( button , event ) {
Ext . Msg . wait ( '正在操作数据, 请稍侯..' ) ;
var strCondition = this . getCondition ( ) ;
var strConditionCw = this . getConditionCw ( ) ;
if ( Ext . getCmp ( 'rdLBYS' ) . getValue ( ) . OBJNUM . toString ( ) == "按业务" ) {
var selections = this . gridListBS . getSelectionModel ( ) . getSelection ( ) ;
if ( selections . length == 0 ) {
var iBSNO = this . storeListBS . totalCount ;
this . onAddCwVouchersBSNull ( selections , strCondition , strConditionCw , iBSNO ) ;
}
else {
this . onAddCwVouchersBS ( selections , strCondition , strConditionCw ) ;
}
}
else {
var selections = this . gridList . getSelectionModel ( ) . getSelection ( ) ;
if ( selections . length == 0 ) {
var iBSNO = this . storeList . totalCount ;
this . onAddCwVouchersFEENull ( selections , strCondition , strConditionCw , iBSNO ) ;
}
else {
this . onAddCwVouchersFEE ( selections , strCondition , strConditionCw ) ;
}
}
} ,
onAddCwVouchersBSNull : function ( selections , strCondition , strConditionCw , iBSNO ) {
Ext . Ajax . request ( {
waitMsg : '正在判断是否有生成凭证的数据, 请稍侯...' ,
url : '/MvcShipping/MsCwVouchersGlChFee/onIsCwVouchers' ,
scope : this ,
params : {
strGids : "" ,
strCondition : strCondition
} ,
callback : function ( options , success , response ) {
if ( success ) {
//Ext.MessageBox.hide();
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . storeListCw . load ( {
params : { sAndGids : strCondition } ,
waitMsg : "正在刷新数据..." ,
timeout : 6000000 , //60秒
scope : this
} ) ;
this . showContactForm ( false , "" , this , "" , iBSNO , "" , "BS" , strCondition , strConditionCw ) ;
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} ,
timeout : 3000000 //30秒
} ) ;
} ,
onAddCwVouchersBS : function ( selections , strCondition , strConditionCw ) {
var sBSNO = "" ;
var iBSNO = 0 ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
var VOUALLNO = rec . data . VOUALLNO ; //凭证号
if ( VOUALLNO == "" ) {
if ( sBSNO . indexOf ( rec . data . BSNO . toString ( ) ) < 0 ) {
if ( sBSNO == "" ) {
sBSNO = rec . data . BSNO . toString ( ) ;
}
else {
sBSNO += "," + rec . data . BSNO . toString ( ) ;
}
iBSNO ++ ;
}
}
}
if ( sBSNO == "" ) {
Ext . Msg . show ( { title : '提示' , msg : '请选择未生成凭证的单据!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
//
var sCondition = "bsno in ('" + sBSNO . trim ( ) . replace ( "," , "','" ) + "') and " + strCondition ;
Ext . Ajax . request ( {
waitMsg : '正在判断是否有生成凭证的数据, 请稍侯...' ,
url : '/MvcShipping/MsCwVouchersGlChFee/onIsCwVouchers' ,
scope : this ,
params : {
strGids : "" ,
strCondition : sCondition
} ,
callback : function ( options , success , response ) {
if ( success ) {
//Ext.MessageBox.hide();
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . storeListCw . load ( { params : { sAndGids : sCondition } , waitMsg : "正在刷新数据..." , timeout : 6000000 , scope : this } ) ;
this . showContactForm ( false , "" , this , sBSNO , iBSNO , "" , "BS" , strCondition , strConditionCw ) ;
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} ,
timeout : 3000000 //30秒
} ) ;
} ,
onAddCwVouchersFEENull : function ( selections , strCondition , strConditionCw , iBSNO ) {
Ext . Ajax . request ( {
waitMsg : '正在判断是否有生成凭证的数据, 请稍侯...' ,
url : '/MvcShipping/MsCwVouchersGlChFee/onIsCwVouchers' ,
scope : this ,
params : {
strGids : "" ,
strCondition : strCondition
} ,
callback : function ( options , success , response ) {
if ( success ) {
//Ext.MessageBox.hide();
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . storeListCw . load ( { params : { sAndGids : strCondition } , waitMsg : "正在刷新数据..." , timeout : 6000000 , scope : this } ) ;
this . showContactForm ( false , "" , this , "" , iBSNO , "" , "FEE" , strCondition , strConditionCw ) ;
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} ,
timeout : 3000000 //30秒
} ) ;
} ,
onAddCwVouchersFEE : function ( selections , strCondition , strConditionCw ) {
var strGids = "" ;
var sGidC = "" ;
var sBSNO = "" ;
var iBSNO = 0 ;
var sError = "" ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
var VOUALLNO = rec . data . VOUALLNO ; //凭证号
if ( VOUALLNO == "" ) {
if ( strGids == "" ) {
strGids = rec . data . GID ;
sGidC = rec . data . GID + "@" + rec . data . BSNO . toString ( ) ; //rec.data.CUSTNO.toString();
}
else {
strGids += "," + rec . data . GID ;
sGidC += "," + rec . data . GID + "@" + rec . data . BSNO . toString ( ) ; //rec.data.CUSTNO.toString();
}
}
//if (rec.data.CUSTNO.toString() == "") {
// sError = "委托单号不允许为空!";
//}
if ( sBSNO . indexOf ( rec . data . BSNO . toString ( ) ) < 0 ) {
if ( sBSNO == "" )
sBSNO = rec . data . BSNO . toString ( ) ;
else {
sBSNO += "," + rec . data . BSNO . toString ( ) ;
}
iBSNO ++ ;
}
}
//
Ext . Ajax . request ( {
waitMsg : '正在判断是否有生成凭证的数据, 请稍侯...' ,
url : '/MvcShipping/MsCwVouchersGlChFee/onIsCwVouchers' ,
scope : this ,
params : {
strGids : strGids ,
strCondition : strCondition
} ,
callback : function ( options , success , response ) {
if ( success ) {
//Ext.MessageBox.hide();
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
if ( strGids == "" ) {
Ext . Msg . show ( { title : '提示' , msg : '请选择未生成凭证的单据!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
if ( sError != "" ) {
Ext . Msg . show ( { title : '提示' , msg : '委托单号不允许为空!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
//
this . storeListCw . load ( { params : { sAndGids : strCondition } , waitMsg : "正在刷新数据..." , timeout : 6000000 , scope : this } ) ;
this . showContactForm ( false , strGids , this , sBSNO , iBSNO , sGidC , "FEE" , strCondition , strConditionCw ) ;
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} else {
this . onRefreshClick ( ) ;
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
} ,
timeout : 3000000 //30秒
} ) ;
} ,
//#endregion
//#region 层_显示信息
showContactForm : function ( win , strGids , _this , sBSNO , iBSNO , sGidC , sType , strCondition , strConditionCw ) {
Ext . Msg . hide ( ) ;
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>' ;
if ( ! win ) {
//#region 编辑formDiv 基本信息
var formDiv = Ext . widget ( 'form' , {
border : false ,
bodyPadding : 10 ,
fieldDefaults : {
labelAlign : 'right' ,
labelWidth : 60 ,
labelStyle : 'font-weight:bold'
} ,
items : [ this . comboxPREPARED , {
fieldLabel : '记账日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
allowBlank : false ,
//id: 'VOUDATE',
name : 'VOUDATE' ,
value : Ext . util . Format . date ( Ext . Date . add ( new Date ( ) , Ext . Date . MONTH - 1 , 1 ) , "Y-m-d" )
} , {
//fieldLabel: "",
xtype : "checkbox" , //checkbox控件
//id: "ISRATE",
name : "ISRATE" ,
boxLabel : "是否按照系统录入汇率" ,
width : 200 ,
inputValue : "true" , //选中的值
uncheckedValue : "false" , //未选中的值
checked : true , //绘制时的选中状态,
listeners : {
'change' : function ( field , newValue , oldValue , eOpts ) {
if ( field . checked . toString ( ) == "false" ) {
//Ext.getCmp('myGroup').show();
this . gridListCw . show ( ) ;
}
else {
//Ext.getCmp('myGroup').hide();
this . gridListCw . hide ( ) ;
}
} ,
scope : this
}
} , this . gridListCw
] ,
buttons : [ {
text : '生成凭证' ,
handler : function ( options , success , response ) {
if ( ! this . up ( 'form' ) . getForm ( ) . isValid ( ) ) {
return ;
}
var dataDiv = this . up ( 'form' ) . getForm ( ) . getValues ( false , false , false ) ;
//
var j = 0 ;
var bodydatas = [ ] ;
for ( var i = 0 ; i < _this . storeListCw . getCount ( ) ; i += 1 ) {
var member = _this . storeListCw . getAt ( i ) ;
bodydatas . push ( member ) ;
}
var jsonBody ;
if ( bodydatas . length > 0 ) {
jsonBody = ConvertRecordsToJsonAll ( bodydatas ) ;
}
var sType = "BS" ;
if ( Ext . getCmp ( 'rdLBYS' ) . getValue ( ) . OBJNUM . toString ( ) == "按费用" )
sType = "FEE" ;
//
Ext . Msg . wait ( '正在生成' + iBSNO + '票/条数据, 请稍侯..' ) ; //
Ext . Ajax . request ( {
waitMsg : '正在生成' + iBSNO + '票/条数据, 请稍侯...' , //
url : '/MvcShipping/MsCwVouchersGlChFee/onAddCwVouchers' ,
scope : this ,
params : {
strGids : strGids ,
sBSNO : sBSNO ,
sGidC : sGidC ,
dataDiv : Ext . JSON . encode ( dataDiv ) ,
jsonBody : jsonBody ,
sType : sType ,
strCondition : strCondition ,
strConditionCw : strConditionCw ,
iBSNO : iBSNO
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
Ext . Msg . show ( { title : '提示' , msg : jsonresult . Message , icon : Ext . MessageBox . INFO , buttons : Ext . Msg . OK } ) ;
_this . onRefreshClick ( ) ;
return ;
} else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} ,
timeout : 3000000 //30秒
} ) ;
//
this . up ( 'form' ) . getForm ( ) . reset ( ) ;
this . up ( 'window' ) . hide ( ) ;
}
} , {
text : '取消' ,
handler : function ( ) {
this . up ( 'form' ) . getForm ( ) . reset ( ) ;
this . up ( 'window' ) . hide ( ) ;
}
} ] ,
listeners : {
scope : this ,
'render' : function ( thisDiv , thisExtend ) {
//var ISRATE = Ext.getCmp('ISRATE').getValue().toString();
//if (ISRATE == "false") {
// this.gridListCw.show();
//}
//else {
// this.gridListCw.hide();
//}
this . gridListCw . hide ( ) ;
//
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetCwVOUNO' ,
params : {
VKNO : "记"
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( { title : '提示' , msg : result . Message , icon : Ext . MessageBox . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
//
data = result . data ;
var arrayList = new Array ( ) ;
arrayList = data . split ( "~" ) ;
var strY = arrayList [ 0 ] . toString ( ) ;
var strM = arrayList [ 1 ] . toString ( ) ;
var sVOUNO = arrayList [ 2 ] . toString ( ) ;
var strVOUNO = arrayList [ 3 ] . toString ( ) ;
var strVOUDATE = arrayList [ 4 ] . toString ( ) ;
var strACCDATE = arrayList [ 5 ] . toString ( ) ;
//
thisDiv . form . findField ( 'VOUDATE' ) . setValue ( strVOUDATE ) ;
thisDiv . form . findField ( 'VOUDATE' ) . setMinValue ( strACCDATE + "-01" ) ;
if ( _this . ISRATESET == 1 ) thisDiv . form . findField ( 'ISRATE' ) . setValue ( false )
//Ext.getCmp('VOUDATE').setValue(strVOUDATE);
//Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
}
}
} ) ;
//#endregion
win = Ext . widget ( 'window' , {
title : '辅助核算' ,
closeAction : 'hide' ,
width : 250 ,
height : 250 ,
layout : 'fit' ,
resizable : true ,
modal : true ,
closable : false ,
items : formDiv
} ) ;
}
win . show ( ) ;
}
//#endregion
} ) ;