1

我正在创建一个碧玉报告,其参数为datetrfromdatetrto。过滤进行得很好,除非两个参数携带相同的数据,例如

datetrfrom>= '15-12-2012'

datetrto<= '15-12-2012'

在 15-12-2012 处理的数据不会出来。

我在我的 JSP 中试过这个:

function ShowReport(){
var param='';              

var timestart = ' 00:00:00'
var timeend = ' 23:59:59'

var datetrFrom = document.forms['report']['datetransfrom'].value;
datetrFrom.split("-")

    //i split n join back the date to change the format from dd-MM-yyyy to yyyy-MM-dd
    var dtf = [datetrFrom[6],datetrFrom[7],datetrFrom[8],datetrFrom[9],datetrFrom[5],datetrFrom[3],datetrFrom[4],datetrFrom[2],datetrFrom[0],datetrFrom[1] ].join('')
datetrfr = dtf + timestart; //i join the date with the timestart to create format yyyy-MM-dd hh:mm:ss

    var datetrTo = document.forms['report']['datetransto'].value;
datetrTo.split("-")

    var dtt = [datetrTo[6],datetrTo[7],datetrTo[8],datetrTo[9],datetrTo[5],datetrTo[3],datetrTo[4],datetrTo[2],datetrTo[0],datetrTo[1] ].join('')

    datetrto = dtt + timeend; //i join the date with the timeend to create format yyyy-MM-dd hh:mm:ss
    param = param + '@@dtTFrom=='+datetrfr+'@@dtTTo=='+datetrto;

@@dtTFrom并且@@dtTTo是我在碧玉报告中使用的参数。

这就是我在 jasper 报告的 where 子句中所做的:

where record_line_status='NO'
and datetime_process >= convert(date, $P{dtTFrom},105)
and datetime_process <= convert(date, $P{dtTTo},105)

但是我的报告仍然不起作用。谁能帮我?

4

1 回答 1

0

我在这里解决了我的问题。这是我在 JSP 中的新编码:

function ShowReport(){
            var param='';              

                        var timestart = ' 00:00:00'

                        var timeend = ' 23:59:59'

                        var orgFrom = document.forms['report']['org_id'].value;
                         param = param + 'orgFrom=='+orgFrom;       

                        var datetrFrom = document.forms['report']['datetransfrom'].value;
                        var datefromsplit = datetrFrom.split('-');
                        var datefromjoin = [datefromsplit[2], datefromsplit[1], datefromsplit[0]].join('-');
                        var datefromsend = datefromjoin + timestart;

                        var datetrTo = document.forms['report']['datetransto'].value;
                        var datetosplit = datetrTo.split('-');
                        var datetojoin = [datetosplit[2], datetosplit[1], datetosplit[0]].join('-');
                        var datetosend = datetojoin + timeend;


                        param = param + '@@dtTFrom=='+datefromsend+'@@dtTTo=='+datetosend;

这就是我在 jasper 报告的 where 子句中所做的:

 where ep_lpp04_temp.record_line_status='No'
and EP_LPP04_TEMP.datetime_process >= convert(datetime, $P{dtTFrom}, 120)
AND EP_LPP04_TEMP.datetime_process <= convert(datetime, $P{dtTTo}, 120)

顺便说一下我的参数类是

java.lang.string

.

于 2012-12-26T07:35:07.360 回答