|
版本: |
X5.2.7 |
小版本号: |
|
|
|
数据库: |
MS SQLServer |
服务器操作系统: |
Windows |
应用服务器: |
Tomcat |
客户端操作系统: |
Windows 7 |
浏览器: |
IE10 |
|
|
自定义action 代码:
public static Table getBillInfo(Map variables) {
String accountID = variables.get("accountID").toString();
String accountMode = variables.get("accountMode").toString();
Integer finaYear = (Integer) variables.get("finaYear");
Integer finaMonth = (Integer) variables.get("finaMonth");
//按照如下条件提取 领料单、入库单:
StringBuffer sql = new StringBuffer(64);
//领料单:
sql.append("select case when a.outstocksort = '销售出库' then '出售单' else '领料单' end field1,outstockno field2,depotNo field3,depotname field4,receiveOrgaName field5,receiver field6,case when a.recStatus='进行' then '正在审批,没有办理出库。' else '没有办理出库。' end field7");
sql.append(" from t_outstockbill a ,t_depot d ,SA_OPORG sa ,t_finaperidef b ");
sql.append(" where a.recStatus in ('进行','生效') and a.depotid=d.fid and d.orgaID=sa.sID and b.AccountID=sa.sAccountId and a.outStockDate between b.begindate and b.enddate ");
sql.append(" and b.accountid='").append(accountID).append("' and b.finayear=").append(finaYear).append(" and b.finamonth=").append(finaMonth)
.append(" and b.ACCOUNTMODE='").append(accountMode).append("' and a.materialtype='").append(accountMode).append("'");
sql.append(" union ");
sql.append("select '入库单' field1,instockno field2,depotNo field3,depotname field4,a.orgashortname field5,a.creator field6,case when a.recStatus='进行' then '正在审批,没有办理入库。' else '没有办理入库。' end field7");
sql.append(" from t_instockbill a ,t_depot d ,SA_OPORG sa ,t_finaperidef b ");
sql.append(" where a.recStatus in ('进行','生效') and a.depotid=d.fid and d.orgaID=sa.sID and b.AccountID=sa.sAccountId and a.instockdate between b.begindate and b.enddate ");
sql.append(" and b.accountid='").append(accountID).append("' and b.finayear=").append(finaYear).append(" and b.finamonth=").append(finaMonth)
.append(" and b.ACCOUNTMODE='").append(accountMode).append("' and a.materialtype='").append(accountMode).append("'");
return Butone.excuteSel(sql.toString());
}
//Butone 查询
public static Table excuteSel(String sql) {
System.out.println("sqlSel ==== " + sql);
HashMap<String, String> sqlMap = new HashMap<String, String>();
sqlMap.put("MSSQL", sql);
return SQL.select(sqlMap, null, DATA_MODEL);
}
.W页面
var tableInfoActivity = {};
var accountMode;
var accountID;
var finaYear;
var finaMonth;
tableInfoActivity.bizDataRefreshCreateParam = function(event){
var param = new justep.Request.MapParam();
param.put("accountMode", accountMode);
param.put("accountID", accountID);
param.put("finaYear", finaYear);
param.put("finaMonth", finaMonth);
event.param.setMap("variables", param);
};
tableInfoActivity.windowReceiverReceive = function(event){
accountMode = event.data.accountMode;
accountID = event.data.accountID;
finaYear = event.data.finaYear;
finaMonth = event.data.finaMonth;
};
请问如何在页面的grid 展示自己写的SQL 列 ?
|
|