//In admin module, enterprise account has IsInVoucher to identify vouchers
//However web admin is not requried voucher, so the field is not available in web admin,
//so set acctVoucherHasNull=true at this moment
//But in the web admin, balance is not required at this stage, so set balanceIsNull=true
//string sql = "select count(1) from EnterpriseAccount where IsInVoucher is null";
//bool balanceIsNull = true;
//bool acctVoucherHasNull = true;
List<String>whereList=Lists.newArrayList();
Stringsql="SELECT * FROM ( "+
"SELECT CASE IsLeaf WHEN 0 THEN '+' ELSE '' END IsEx,Code, Name, FullName, "+
"CASE Direction WHEN 1 THEN N'借方' WHEN -1 THEN N'贷方' END Direction, "+
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdAccountCode END StdCode,"+
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdName END StdName, "+
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE StdAccountCode + '/' + StdFullName END StdCodeName, "+
"CASE StdAccountCode WHEN '0000' THEN '-' ELSE CASE StdDirection WHEN 1 THEN N'借方' WHEN -1 THEN N'贷方' END END StdDirection, "+
"CASE WHEN AcctProp<>StdAcctProp THEN 1 ELSE 0 END IsAcctPropDiff,"+
"CASE WHEN StdAccountCode IS NULL THEN 0 ELSE 1 END MappingStatus, "+
"CASE WHEN StdAccountCode IS NULL THEN AcctProp ELSE StdAcctProp END AcctProp, ParentCode, AcctLevel, StdAccountCode AcctStdCode, IsLeaf "+
" FROM (SELECT ID,Code,Name,FullName,Direction,AcctProp,ParentCode,AcctLevel,IsLeaf FROM EnterpriseAccount WHERE EnterpriseAccountSetID=?) ea "+
"LEFT JOIN (SELECT EnterpriseAccountCode ,StandardAccountCode FROM AccountMapping WHERE OrganizationID=? AND IndustryID=?) am ON ea.Code=am.EnterpriseAccountCode "+
"LEFT JOIN (SELECT ID StdID, Code StdAccountCode, Name StdName, FullName StdFullName,Direction StdDirection,AcctProp StdAcctProp FROM StandardAccount WHERE IndustryID=?) sa ON am.StandardAccountCode=sa.StdAccountCode ) T";