pegaga1979
4th February 2014, 09:09
Hi Experts,

Continuity from my previous question :)
I hv add After.Field row to sum total qty receipt and issue by using field name whinr110.qstk for both and differentiate at Aggregrate Expression.
Thank you to all experts who had guide me till this stage.

However, i would like to do substraction between receipt and issue.
Can anyone guide me on this?
Im not expert in writing script in Report :(

Thank you.

bhushanchanda
4th February 2014, 09:20
Hi,

There can be different ways to do it. Here's one way.

You can sum up both receipts and issue quantity in 2 variables and in after.report you can print them in your report.

e.g.

extern domain tcqiv1 tot.issue,tot.receipt

select tcibd001.*
from tcibd001
where tcibd001._index1 inrange {:item.f} and {:item.t}
selectdo

tot.receipt = 0
tot.issue = 0

db.set.to.default(twhinr110)
select whinr110.item,,
whinr110.qstk,
whinr110.cwar
from whinr110
where whinr110.item = :tcibd001.item
and whinr110.cwar inrange {:cwar.f} and {:cwar.t}
selectdo
if whinr110.kost = tckost.receipt then
tot.receipt = tot.receipt + whinr110.qstk | Get total receipt
endif
if whinr110.kost = tckost.issue then
tot.issue = tot.issue + whinr110.qstk | Get total issue
endif
endselect

rprt_send()
endselect

Make sure to add the total fields in report input fields.

pegaga1979
4th February 2014, 09:56
can u guide me in detail?
i tried to put in report script but it gives a lot of error.
i already registered the tot.receipt and tot.issue in Input Field.

bhushanchanda
4th February 2014, 10:05
Hi,

I just gave an idea. You can use the same logic in your script. Please post your script which can give a better idea what you are trying to print.

pegaga1979
4th February 2014, 10:36
Hi Bhushan,

At this moment i create SQL queries and the report without writing script in report.
u can see from attachment.
At layout After.Field, it used to calculate total issue and receipt per item.

bhushanchanda
4th February 2014, 10:57
Hi,

In your report script write this:-

declaration:

detail.1:

before.layout:

if whinr110.kost = tckost.receipt then
tot.receipt = tot.receipt + whinr110.qstk
endif

if whinr110.kost = tckost.issue then
tot.issue = tot.issue + whinr110.qstk
endif


after.whinr110.item.1:

after.layout:

tot.receipt = 0
tot.issue = 0

Check if you have included whinr110.kost, tot.issue,tot.receipt in report input fields.