Ext . namespace ( 'Shipping' ) ;
Shipping . MsCwVouchersGlInvoiceIndex = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsCwVouchersGlInvoiceIndex . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsCwVouchersGlInvoiceIndex , Ext . Panel , {
PageSize : 2500 ,
SelectedRecord : null ,
OprationStatus : null ,
sqlcontext : '' ,
strCwSTARTGID : '' ,
initUIComponents : function ( ) {
this . formname = "formMsCwVouchersGlInvoiceIndex" ; //成本收入_发票凭证
this . ISRATESET = 0 ;
Ext . define ( 'MsFeeCurr' , {
extend : 'Ext.data.Model' ,
idProperty : 'CURR' ,
fields : [
{ name : 'CURR' , type : 'string' } ,
{ name : 'DEFRATE' , type : 'number' } ,
{ name : 'CRDEFRATE' , type : 'number' }
]
} ) ;
//#region formSearch 下拉框信息加载
//凭证状态
Ext . define ( 'ISVOUNOModel' , { extend : 'Ext.data.Model' , fields : [ { name : 'Name' , type : 'string' } ] } ) ;
var dataISVOUNO = [ { "Name" : "未生成" } , { "Name" : "已生成" } , { "Name" : "" } ] ;
var storeISVOUNO = Ext . create ( 'Ext.data.Store' , { model : 'ISVOUNOModel' , data : dataISVOUNO } ) ;
this . comboxISVOUNO = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '凭证状态' ,
forceSelection : true ,
store : storeISVOUNO ,
id : 'ISVOUNO' ,
name : 'ISVOUNO' ,
labelAlign : 'right' ,
valueField : 'Name' ,
displayField : 'Name' ,
value : "未生成" ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
_this = this ;
//币别
this . storeCodeCurrency = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeCurrencyModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeCurrencyList' }
} ) ;
this . storeCodeCurrency . load ( ) ;
this . comboxCodeCurrency = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '币别' ,
store : this . storeCodeCurrency ,
forceSelection : true ,
id : 'CURRENCY' ,
name : 'CURRENCY' ,
valueField : 'CODENAME' ,
displayField : 'CODENAME' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} ) ;
//开票公司
this . 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 ,
name : 'companyid' ,
valueField : 'gid' ,
displayField : 'name'
} ) ;
//开票单位
this . storeCust = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeCust . load ( { params : { condition : "" } } ) ;
this . comboxCust = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '开票单位' ,
store : this . storeCust ,
name : 'CustName' ,
valueField : 'CustName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . storeInvCategory = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsExtEnumModel' ,
proxy : { url : '/CommMng/PubSys/GetEnumValueList' }
} ) ;
this . storeInvCategory . load ( { params : { enumTypeId : 97008 } } ) ;
this . comboxInvCategory = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '发票类型' ,
//labelWidth: 60,
flex : 0.5 ,
store : this . storeInvCategory ,
forceSelection : true ,
name : 'INVOICECATEGORY' ,
valueField : 'EnumValueId' ,
displayField : 'EnumValueName'
} ) ;
this . StoreCurr = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsFeeCurr' ,
proxy : { url : '/MvcShipping/MsChFee/GetFeeCurrList' }
} ) ;
this . StoreCurr . load ( { params : { condition : "" } } ) ;
this . comboxCurr = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '币别' ,
store : this . StoreCurr ,
forceSelection : true ,
allowBlank : false ,
labelWidth : 60 ,
flex : 0.5 ,
name : 'CURRENCY' ,
valueField : 'CURR' ,
displayField : 'CURR'
} ) ;
this . StoreCurr2 = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsFeeCurr' ,
proxy : { url : '/MvcShipping/MsChFee/GetFeeCurrList' }
} ) ;
this . StoreCurr2 . load ( { params : { condition : "" } } ) ;
this . comboxCurr2 = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '发票币别' ,
store : this . StoreCurr2 ,
forceSelection : true ,
labelWidth : 60 ,
flex : 0.5 ,
name : 'RECVCURR' ,
valueField : 'CURR' ,
displayField : 'CURR'
} ) ;
this . storeSaleCompany = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsCompanysEntity' ,
proxy : { url : '/MvcShipping/MsCompanys/GetNoPicDataList' }
} ) ;
this . storeSaleCompany . load ( { params : { condition : "" } } ) ;
this . comboxSaleCompany = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '所属分部' , //'委托分公司',
store : this . storeSaleCompany ,
forceSelection : true ,
name : 'SALECORPID' ,
valueField : 'GID' ,
displayField : 'NAME' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
// var companyid = data.items[0].data.GID;
// this.StoreBANK.load({ params: { condition: ""} });
}
}
}
} ) ;
//#endregion
//#region formSearch 查询面板
this . formSearch = Ext . widget ( 'form' , {
frame : true ,
border : false ,
region : 'center' ,
bodyPadding : 5 ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ { //fieldset 1
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '编号' ,
name : 'BsNo' ,
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 : '从开票日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ExpDateBgn' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , {
fieldLabel : '到开票日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ExpDateEnd' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , this . comboxInvCategory , this . comboxCurr , this . comboxSaleCompany ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxCust , this . comboxCompany , this . comboxISVOUNO , {
fieldLabel : '凭证号' ,
name : 'VOUNO' ,
enableKeyEvents : true , //激活键盘事件
listeners : {
scope : this ,
'keyup' : {
fn : function ( _field , e ) {
if ( e . getKey ( ) == 13 ) {
this . onRefreshClick ( ) ;
}
} ,
scope : this
}
}
} , {
fieldLabel : '税率' ,
name : 'TAXRATE' ,
flex : 0.5 ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , this . comboxCurr2 , { xtype : 'hiddenfield' } ]
} ] //end items(fieldset 1)
} ] //end root items
} ) ;
//#endregion formSearch
//#region 按发票合计
//#region 定义数据集
this . storeList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsCwVouchersGlInvoiceModel' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsCwVouchersGlInvoice/GetDataList' ,
reader : {
id : 'GID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//#endregion
//#region 定义列
Ext . grid . RowNumberer = Ext . extend ( Ext . grid . RowNumberer , {
width : 50
} ) ;
this . GridCheckBoxModel = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
this . initgirdcolums = [ {
dataIndex : 'GID' ,
header : '唯一编码' ,
width : 0
} , {
sortable : true ,
dataIndex : 'VOUNO' ,
header : '凭证号' ,
width : 150
} , {
sortable : true ,
dataIndex : 'INVOICETYPEREF' ,
header : '发票类别' ,
width : 120
} , {
sortable : true ,
dataIndex : 'BILLSTATUSREF' ,
header : '发票锁定' ,
width : 0
} , {
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 ) {
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 ,
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 : '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 : 'REMARK' ,
header : '备注' ,
width : 160
} , {
sortable : true ,
dataIndex : 'ISDELETE' ,
header : '是否作废' ,
width : 80
} , {
sortable : true ,
dataIndex : 'DELOPERATORNAME' ,
header : '作废人' ,
width : 100
} , {
sortable : true ,
dataIndex : 'DELETETIME' ,
header : '作废时间' ,
width : 100
} ] ;
//#endregion
this . Pagenum = Ext . create ( 'Ext.form.field.Number' , {
name : 'bottles' ,
fieldLabel : '每页记录数' ,
labelAlign : 'right' ,
value : this . PageSize ,
maxValue : 100000 ,
width : 180 ,
minValue : 0 ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . girdcolums = DsTruck . GetGridPanel ( USERID , this . formname , this . initgirdcolums , 1 ) ;
//#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 ,
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表格汇总特性
} ] ,
// 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 : "保存列表样式" ,
id : "btntest" ,
menu : [
{
text : "保存列表" ,
handler : function ( button , event ) {
_this . onSaveGridClick ( button , event ) ;
}
} , {
text : "刷新列表" ,
handler : function ( button , event ) {
_this . oninitGridClick ( button , event ) ;
}
} ] ,
scope : this
} ]
} ) ;
//#endregion
//#region 页面布局
this . panelZQ = new Ext . Panel ( {
layout : "border" ,
region : "east" ,
width : 500 ,
style : 'text-align:right;' ,
border : false ,
items : [ {
xtype : 'displayfield' ,
id : 'lbTitle2' ,
name : 'lbTitle2' ,
value : " "
} ]
} ) ;
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 : 100 ,
border : false ,
items : [ this . panelTopF , this . formSearch ]
} ) ;
Ext . apply ( this , {
border : false ,
items : [ this . panelTop , this . gridList ]
} ) ;
//this.onRefreshClick();
//#endregion
//#region 页面加载
this . storeList . on ( 'beforeload' , function ( store ) {
var strCondition = this . getCondition ( ) ;
Ext . apply ( store . proxy . extraParams , { condition : strCondition } ) ;
} , this ) ;
//#endregion
//#region 生成凭证_汇率列表
//#region 加载数据
//制单人
this . storePREPAREDCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.UserRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserRefList' }
} ) ;
this . storePREPAREDCode . load ( ) ;
this . comboxPREPARED = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '制单人' ,
store : this . storePREPAREDCode ,
forceSelection : true ,
id : 'PREPARED' ,
name : 'PREPARED' ,
valueField : 'UserName' ,
displayField : 'CodeAndName' ,
value : SHOWNAME
} ) ;
//#endregion
//#region 定义数据集
this . storeListCw = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsCodeCurrencyList' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsCwVouchersGlInvoice/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 . 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();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
} ,
scope : this
} ) ;
} , //end InitData
//#endregion
//#region 执行查询
onRefreshClick : function ( ) {
var strCondition = this . getCondition ( ) ;
this . PageSize = this . Pagenum . getValue ( ) ;
this . storeList . pageSize = this . PageSize ;
this . storeList . load ( { params : { start : 0 , limit : this . PageSize , sort : '' , condition : strCondition } , waitMsg : "正在查询数据..." , scope : this } ) ;
} ,
getCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
var sql = " isnull(ISDELETE,0)=0 " ;
var customNo = form . findField ( 'BsNo' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , customNo , "BILLNO like '%" + customNo + "%'" ) ;
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 , "CUSTOMERNAME 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 INVOICECATEGORY = form . findField ( 'INVOICECATEGORY' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , INVOICECATEGORY , "INVOICECATEGORY=" + INVOICECATEGORY ) ;
var TAXRATE = form . findField ( 'TAXRATE' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , TAXRATE , "TAXRATE=" + TAXRATE ) ;
var CURRENCY = form . findField ( 'CURRENCY' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CURRENCY , "CURRENCY='" + CURRENCY + "'" ) ;
var RECVCURR = form . findField ( 'RECVCURR' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , RECVCURR , "RECVCURR='" + RECVCURR + "'" ) ;
var SALECORPID = form . findField ( 'SALECORPID' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SALECORPID , "SALECORPID='" + SALECORPID + "'" ) ;
//发票是否锁定
sql = sql + getAndConSql ( sql , "BILLSTATUSREF" , "BILLSTATUS=1" ) ;
//凭证状态
var ISVOUNO = form . findField ( 'ISVOUNO' ) . getValue ( ) ;
if ( ISVOUNO == "未生成" ) {
//sql = sql + getAndConSql(sql, ISVOUNO, "(VOUNO='' or VOUNO is null)");
sql = sql + getAndConSql ( sql , ISVOUNO , "gid not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoice' and [STARTGID]='" + this . strCwSTARTGID + "')" ) ;
}
else if ( ISVOUNO == "已生成" ) {
//sql = sql + getAndConSql(sql, ISVOUNO, "(VOUNO<>'' and VOUNO is not null)");
sql = sql + getAndConSql ( sql , ISVOUNO , "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoice' and [STARTGID]='" + this . strCwSTARTGID + "')" ) ;
}
//凭证号
var VOUNO = form . findField ( 'VOUNO' ) . getValue ( ) ;
//sql = sql + getAndConSql(sql, VOUNO, "VOUNO like '%" + VOUNO + "%'");
sql = sql + getAndConSql ( sql , VOUNO , "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_invoice' and [STARTGID]='" + this . strCwSTARTGID + "' and VOUALLNO like '%" + VOUNO + "%')" ) ;
return sql ;
} ,
//#endregion
//#region 重置条件
onClearSql : function ( ) {
var form = this . formSearch . getForm ( ) ;
form . reset ( ) ;
} ,
//#endregion
onSaveGridClick : function ( button , event ) {
this . girdcolums = DsTruck . SaveGridPanel ( USERID , this . formname , this . gridList . columns , this . girdcolums , 1 , true ) ;
} ,
oninitGridClick : function ( button , event ) {
this . gridList . reconfigure ( this . storeList , this . initgirdcolums ) ;
this . girdcolums = DsTruck . SaveGridPanel ( USERID , this . formname , this . gridList . columns , this . initgirdcolums , 1 , true ) ;
} ,
//#region 导出Excel
onExportClick : function ( button , event ) {
if ( this . storeList . getCount ( ) == 0 ) {
return ;
}
var strCondition = this . getCondition ( ) ;
Ext . Msg . wait ( '正在组织数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在组织数据...' ,
url : '/MvcShipping/MsCwVouchersGlInvoice/GetDataListSQL' ,
scope : this ,
params : {
condition : strCondition
} ,
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 sql1 = returnstr ;
sql1 = sql1 . replace ( /\+/g , "@@@" )
if ( sql1 != '' ) {
GridExportBySql ( sql1 , this . formname , '销项发票列表.xls' ) ;
//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=DsRptExcel&formname=" + this.formname + 'dr'+ "&condition1=" + sql1;
//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
} ) ;
}
}
} ) ;
//var sUrl = "";
//var sHandle = "";
//if (this.storeList.getCount() == 0) {
// return;
//}
//sUrl = "/MvcShipping/MsCwVouchersGlInvoice/GetDataListSQL";
//sHandle = "MsCwVouchersGlInvoiceIndex";
//var strCondition = this.getCondition();
////Ext.Msg.wait('正在组织数据, 请稍侯..');
//Ext.Ajax.request({
// waitMsg: '正在组织数据, 请稍侯...',
// url: sUrl,
// params: {
// condition: strCondition
// },
// callback: function (options, success, response) {
// if (success) {
// var ddd = Ext.MessageBox.isVisible();
// if (Ext.MessageBox.isVisible()) {
// Ext.MessageBox.hide();
// }
// var jsonresult = Ext.JSON.decode(response.responseText);
// if (jsonresult.Success) {
// var returnStr = jsonresult.data;
// if (returnStr.toString() != "") {
// GridExportBySql(returnStr.toString(), this.formname, '销项发票列表.xls');
// //var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
// //var openType = "_blank";
// //var openUrl = "../../Reports/RptExport.aspx?handle=" + sHandle + "&formname=" + this.formname + "&condition1=" + escape(returnStr.toString());
// //window.open(openUrl, openType, openSet);
// }
// } else {
// Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// }
// } else {
// Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// }
// },
// scope: this
//});
} ,
//#endregion
//#region 生成凭证
onAddCwVouchers : function ( selections ) {
var selections = this . gridList . getSelectionModel ( ) . getSelection ( ) ;
if ( selections . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '请先选择单据!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
var sGID = "" ;
var iGID = 0 ;
for ( var i = 0 ; i < selections . length ; i ++ ) {
var rec = selections [ i ] ;
var sVOUNO = rec . data . VOUNO ; //凭证号
if ( sVOUNO == "" ) {
if ( sGID . indexOf ( rec . data . GID . toString ( ) ) < 0 ) {
if ( sGID == "" ) {
sGID = rec . data . GID . toString ( ) ;
}
else {
sGID += "," + rec . data . GID . toString ( ) ;
}
iGID ++ ;
}
}
}
//
if ( sGID != "" ) {
var strGids = " and GID in ('" + sGID . trim ( ) . replace ( /,/g , "','" ) + "')" ;
this . storeListCw . load ( { params : { strGids : strGids } , waitMsg : "正在刷新数据..." , scope : this } ) ;
this . showContactForm ( false , this , sGID , iGID ) ;
}
else
{
Ext . Msg . show ( { title : '提示' , msg : '请选择未生成凭证的单据!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
} ,
//#endregion
//#region 层_显示信息
showContactForm : function ( win , _this , sGID , iGID ) {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>' ;
if ( ! win ) {
//#region 编辑formDiv 基本信息
var formDiv = Ext . widget ( 'form' , {
border : false ,
bodyPadding : 10 ,
fieldDefaults : {
labelAlign : 'right' ,
labelWidth : 60 ,
labelStyle : 'font-weight:bold'
} ,
items : [ this . comboxPREPARED , {
fieldLabel : '记账日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
allowBlank : false ,
name : 'VOUDATE' ,
value : Ext . util . Format . date ( Ext . Date . add ( new Date ( ) , Ext . Date . MONTH - 1 , 1 ) , "Y-m-d" )
} , {
xtype : "checkbox" , //checkbox控件
name : "ISRATE" ,
boxLabel : "是否按照系统录入汇率" ,
width : 200 ,
inputValue : "true" , //选中的值
uncheckedValue : "false" , //未选中的值
checked : true , //绘制时的选中状态,
listeners : {
'change' : function ( field , newValue , oldValue , eOpts ) {
if ( field . checked . toString ( ) == "false" ) {
//Ext.getCmp('myGroup').show();
this . gridListCw . show ( ) ;
}
else {
//Ext.getCmp('myGroup').hide();
this . gridListCw . hide ( ) ;
}
} ,
scope : this
}
} , this . gridListCw
] ,
buttons : [ {
text : '生成凭证' ,
handler : function ( options , success , response ) {
if ( ! this . up ( 'form' ) . getForm ( ) . isValid ( ) ) {
return ;
}
var dataDiv = this . up ( 'form' ) . getForm ( ) . getValues ( false , false , false ) ;
//
var j = 0 ;
var bodydatas = [ ] ;
for ( var i = 0 ; i < _this . storeListCw . getCount ( ) ; i += 1 ) {
var member = _this . storeListCw . getAt ( i ) ;
bodydatas . push ( member ) ;
}
var jsonBody ;
if ( bodydatas . length > 0 ) {
jsonBody = ConvertRecordsToJsonAll ( bodydatas ) ;
}
Ext . Msg . wait ( '正在生成' + iGID + '票数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在生成' + iGID + '票数据, 请稍侯...' ,
url : '/MvcShipping/MsCwVouchersGlInvoice/onAddCwVouchers' ,
scope : this ,
params : {
strGids : sGID ,
dataDiv : Ext . JSON . encode ( dataDiv ) ,
jsonBody : jsonBody
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
Ext . Msg . show ( { title : '提示' , msg : jsonresult . Message , icon : Ext . MessageBox . INFO , buttons : Ext . Msg . OK } ) ;
_this . onRefreshClick ( ) ;
return ;
} else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . Msg . show ( { title : '请重试' , msg : '服务器响应出错' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} ,
timeout : 3000000 //30秒
} ) ;
//
this . up ( 'form' ) . getForm ( ) . reset ( ) ;
this . up ( 'window' ) . hide ( ) ;
}
} , {
text : '取消' ,
handler : function ( ) {
this . up ( 'form' ) . getForm ( ) . reset ( ) ;
this . up ( 'window' ) . hide ( ) ;
}
} ] ,
listeners : {
scope : this ,
'render' : function ( thisDiv , thisExtend ) {
this . gridListCw . hide ( ) ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetCwVOUNO' ,
params : {
VKNO : "记"
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( { title : '提示' , msg : result . Message , icon : Ext . MessageBox . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
//
data = result . data ;
var arrayList = new Array ( ) ;
arrayList = data . split ( "~" ) ;
var strY = arrayList [ 0 ] . toString ( ) ;
var strM = arrayList [ 1 ] . toString ( ) ;
var sVOUNO = arrayList [ 2 ] . toString ( ) ;
var strVOUNO = arrayList [ 3 ] . toString ( ) ;
var strVOUDATE = arrayList [ 4 ] . toString ( ) ;
var strACCDATE = arrayList [ 5 ] . toString ( ) ;
//
thisDiv . form . findField ( 'VOUDATE' ) . setValue ( strVOUDATE ) ;
thisDiv . form . findField ( 'VOUDATE' ) . setMinValue ( strACCDATE + "-01" ) ;
if ( _this . ISRATESET == 1 ) thisDiv . form . findField ( 'ISRATE' ) . setValue ( false )
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
}
}
} ) ;
//#endregion
win = Ext . widget ( 'window' , {
title : '辅助核算' ,
closeAction : 'hide' ,
width : 250 ,
height : 250 ,
layout : 'fit' ,
resizable : true ,
modal : true ,
closable : false ,
items : formDiv
} ) ;
}
win . show ( ) ;
}
//#endregion
} ) ;