ceplonline
21st June 2019, 12:39
Hi,
I need to take LN data and format it into an Excel report. The problem is that only header part is coming. Please help me how i can access data in excel. Here i am attaching a output screen nd code:
function generate.xls()
{
srvr.file = bse.tmp.dir$() & "\" & str$(utc.num()) & ".xls"
srvr.file = bse.tmp.dir$()
clnt.file = "Store Gate Pass Out" & strip$(str$(utc.num())) & ".xls"
fp = seq.open(srvr.file & "/" & clnt.file, "w+")
generate.header.detail()
get.detail()
seq.close(fp)
if tc.is.html.ui() = false then
file.ldir = "C:\temp\"
fp = server2client(srvr.file & "/" & clnt.file, file.ldir & clnt.file, 0)
if fp >= 0 then
start.application.local("excel " & file.ldir & clnt.file, false, fp)
endif
else
fp = client.download.file (srvr.file & "/" & clnt.file, file.ldir & clnt.file)
endif
}
function generate.header.detail()
{
if fp >0 then
file.rval = seq.puts("<TABLE BORDER = ""1"">", fp)
file.rval = seq.puts("<TR>", fp)
file.rval = seq.puts("<TD align = ""center"" nowrap><B>RGP No</B>", fp) |1
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Issued To</B>", fp) |2
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Date</B>", fp) |3
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Through</B>", fp) |4
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Item</B>", fp) |5
file.rval = seq.puts("<TD align = ""center"" nowrap><B>U/M</B>", fp) |6
file.rval = seq.puts("<TD align = ""center"" nowrap><B>RGP QTY</B>", fp) |7
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Bal QTY</B>", fp) |8
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Expt.DT.Return</B>", fp) |9
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Remark</B>", fp) |10
file.rval = seq.puts("</TR>",fp)
file.rval = seq.puts("</TABLE>",fp)
endif
}
function get.detail()
{
select tdcus105.gpno,tdcus105.bpid,tdcus105.date,tdcus105.emno,tdcus115.item,tdcus115.unit,tdcus115.qoor,tdcus115.pqty,tdcus105.rdat,tdcus105.rmks
from tdcus105,tdcus115
where tdcus105.date inrange {:date.f} and {:date.t}
and tdcus105._index1 refers to tdcus115
order by tdcus105.date
selectdo
print.detail()
endselect
}
function print.detail()
{
file.rval = seq.puts("<TABLE border = ""1"">", fp)
file.rval = seq.puts("<TR>", fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.gpno, fp) |1 |1
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.bpid, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.date), fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.emno, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus115.item, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus115.unit, fp) |2
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.date), fp) |3
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%@ZZZZZZZZZ9VD99@",tdcus115.pqty), fp) |4
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.rdat), fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.rmks, fp)
file.rval = seq.puts("</TR>", fp)
file.rval = seq.puts("</TABLE>", fp)
}
I need to take LN data and format it into an Excel report. The problem is that only header part is coming. Please help me how i can access data in excel. Here i am attaching a output screen nd code:
function generate.xls()
{
srvr.file = bse.tmp.dir$() & "\" & str$(utc.num()) & ".xls"
srvr.file = bse.tmp.dir$()
clnt.file = "Store Gate Pass Out" & strip$(str$(utc.num())) & ".xls"
fp = seq.open(srvr.file & "/" & clnt.file, "w+")
generate.header.detail()
get.detail()
seq.close(fp)
if tc.is.html.ui() = false then
file.ldir = "C:\temp\"
fp = server2client(srvr.file & "/" & clnt.file, file.ldir & clnt.file, 0)
if fp >= 0 then
start.application.local("excel " & file.ldir & clnt.file, false, fp)
endif
else
fp = client.download.file (srvr.file & "/" & clnt.file, file.ldir & clnt.file)
endif
}
function generate.header.detail()
{
if fp >0 then
file.rval = seq.puts("<TABLE BORDER = ""1"">", fp)
file.rval = seq.puts("<TR>", fp)
file.rval = seq.puts("<TD align = ""center"" nowrap><B>RGP No</B>", fp) |1
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Issued To</B>", fp) |2
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Date</B>", fp) |3
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Through</B>", fp) |4
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Item</B>", fp) |5
file.rval = seq.puts("<TD align = ""center"" nowrap><B>U/M</B>", fp) |6
file.rval = seq.puts("<TD align = ""center"" nowrap><B>RGP QTY</B>", fp) |7
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Bal QTY</B>", fp) |8
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Expt.DT.Return</B>", fp) |9
file.rval = seq.puts("<TD align = ""center"" nowrap><B>Remark</B>", fp) |10
file.rval = seq.puts("</TR>",fp)
file.rval = seq.puts("</TABLE>",fp)
endif
}
function get.detail()
{
select tdcus105.gpno,tdcus105.bpid,tdcus105.date,tdcus105.emno,tdcus115.item,tdcus115.unit,tdcus115.qoor,tdcus115.pqty,tdcus105.rdat,tdcus105.rmks
from tdcus105,tdcus115
where tdcus105.date inrange {:date.f} and {:date.t}
and tdcus105._index1 refers to tdcus115
order by tdcus105.date
selectdo
print.detail()
endselect
}
function print.detail()
{
file.rval = seq.puts("<TABLE border = ""1"">", fp)
file.rval = seq.puts("<TR>", fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.gpno, fp) |1 |1
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.bpid, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.date), fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.emno, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus115.item, fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus115.unit, fp) |2
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.date), fp) |3
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%@ZZZZZZZZZ9VD99@",tdcus115.pqty), fp) |4
file.rval = seq.puts("<TD align = ""center"" nowrap>" & sprintf$("%u(%04Y/%02m/%02d)", tdcus105.rdat), fp)
file.rval = seq.puts("<TD align = ""center"" nowrap>" & tdcus105.rmks, fp)
file.rval = seq.puts("</TR>", fp)
file.rval = seq.puts("</TABLE>", fp)
}