Aryaraj
25th November 2014, 09:23
Dear Concern,
When we generate the Print Daily Sales Report, in that report weight is not showing negative in Return sales order(Quantity, value all showing negative value) . Weight should show negative value in return sales invoicing. Please do the needful.
We arre using script as
r.invoice = cisli245.ityp & "/" & str$(cisli245.idoc) |arya
select sum(whinh431.ntwt):r.net.wght
from whinh431
where whinh431._index1 = {:l.shpm}
and whinh431.item = :cisli245.item
as set with 1 rows
selectdo
selectempty
endselect
if double.cmp(r.net.wght,0.00,0.0001) <= 0 then
select tcibd001.wght
from tcibd001
where tcibd001._index1 = {:cisli245.item}
as set with 1 rows
selectdo
r.net.wght = tcibd001.wght * r.dqua
selectempty
r.net.wght = 0.00
endselect
endif |arya
r.tot.ntwt = r.tot.ntwt + r.net.wght
r.tot.dqua = r.tot.dqua + r.dqua
r.tot.amti = r.tot.amti + r.amti
r.tot.amth = r.tot.amth + r.amth
Regards,
Arya
bhushanchanda
25th November 2014, 09:29
Hi,
Which field shows the weight on report? Is it tcibd001.wght?
If yes, just add a condition in before.layout. Something like,
if order.type = sales_return then
tcibd001.wght = tcibd001.wght * -1
endif
OR
if amount_variable_is_negative then
tcibd001.wght = tcibd001.wght * -1
endif
Aryaraj
25th November 2014, 11:44
Dear Sir,
Still not coming. The weight used in report is whinh431.ntwt. where to put this condition.
select cisli245.ityp,
cisli245.idoc,
cisli245.item,
max(cisli245.stbp):l.hold.ofbp,
max(cisli245.ddat):r.ddat, |arya
max(cisli245.ctem):r.aitc,
max(cisli245.ccur):r.ccur,
sum(cisli245.amth(1)):r.amth,
sum(cisli245.dqua):r.dqua,
sum(cisli245.amti):r.amti,
max(cisli245.shpm):l.shpm,
max(tcibd001.citg):r.citg
from cisli245, tcibd001, tccom110
where cisli245._index2 inrange {:l.curr.comp,:i.ityp.f,:i.idoc.f} and
{:l.curr.comp,:i.ityp.t,:i.idoc.t}
and cisli245.ddat inrange {:l.inv.dt.f} and {:l.inv.dt.t}
and cisli245.item inrange {:i.item.f} and {:i.item.t}
and cisli245.stbp inrange {:i.ofbp.f} and {:i.ofbp.t}
and (( :i.is.aitm = tcyesno.yes and
cisli245.ctem inrange {:i.aitm.f} and {:i.aitm.t}) or
( :i.is.aitm = tcyesno.no))
and cisli245.item refers to tcibd001 unref skip
and tcibd001.cpln inrange {:i.cpln.f} and {:i.cpln.t}
and cisli245.stbp refers to tccom110 unref skip
and tccom110.cbrn inrange {:i.cbrn.f} and {:i.cbrn.t}
and tccom110.creg inrange {:i.area.f} and {:i.area.t}
group by cisli245.ityp, cisli245.idoc, cisli245.item
selectdo
l.need.cont = false
if isspace(cisli245.ityp) or
cisli245.idoc = 0 then
continue
endif
|
| if i.is.aitm = tcyesno.yes then
| select tcibd004.*
| from tcibd004
| where tcibd004._index1 = {ITM_CODE_SYS, :i.ofbp.f, :cisli245.item}
| and tcibd004.aitc inrange {:i.aitm.f} and {:i.aitm.t}
| as set with 1 rows
| selectdo
| selectempty
| l.need.cont = true
| endselect
| if l.need.cont then
| continue
| endif
| endif
|
r.invoice = cisli245.ityp & "/" & str$(cisli245.idoc)
select sum(whinh431.ntwt):r.net.wght
from whinh431
where whinh431._index1 = {:l.shpm}
and whinh431.item = :cisli245.item
as set with 1 rows
selectdo
selectempty
endselect
if double.cmp(r.net.wght,0.00,0.0001) <= 0 then
select tcibd001.wght
from tcibd001
where tcibd001._index1 = {:cisli245.item}
as set with 1 rows
selectdo
r.net.wght = tcibd001.wght * r.dqua
selectempty
r.net.wght = 0.00
endselect
endif
|
r.tot.ntwt = r.tot.ntwt + r.net.wght
r.tot.dqua = r.tot.dqua + r.dqua
r.tot.amti = r.tot.amti + r.amti
r.tot.amth = r.tot.amth + r.amth |gayatri
bhushanchanda
25th November 2014, 11:54
Try this piece of code. I am not sure though without looking at the layouts and scritps. Debugging is the best option.
select cisli245.ityp,
cisli245.idoc,
cisli245.item,
max(cisli245.stbp):l.hold.ofbp,
max(cisli245.ddat):r.ddat, |arya
max(cisli245.ctem):r.aitc,
max(cisli245.ccur):r.ccur,
sum(cisli245.amth(1)):r.amth,
sum(cisli245.dqua):r.dqua,
sum(cisli245.amti):r.amti,
max(cisli245.shpm):l.shpm,
max(tcibd001.citg):r.citg
from cisli245, tcibd001, tccom110
where cisli245._index2 inrange {:l.curr.comp,:i.ityp.f,:i.idoc.f} and
{:l.curr.comp,:i.ityp.t,:i.idoc.t}
and cisli245.ddat inrange {:l.inv.dt.f} and {:l.inv.dt.t}
and cisli245.item inrange {:i.item.f} and {:i.item.t}
and cisli245.stbp inrange {:i.ofbp.f} and {:i.ofbp.t}
and (( :i.is.aitm = tcyesno.yes and
cisli245.ctem inrange {:i.aitm.f} and {:i.aitm.t}) or
( :i.is.aitm = tcyesno.no))
and cisli245.item refers to tcibd001 unref skip
and tcibd001.cpln inrange {:i.cpln.f} and {:i.cpln.t}
and cisli245.stbp refers to tccom110 unref skip
and tccom110.cbrn inrange {:i.cbrn.f} and {:i.cbrn.t}
and tccom110.creg inrange {:i.area.f} and {:i.area.t}
group by cisli245.ityp, cisli245.idoc, cisli245.item
selectdo
l.need.cont = false
if isspace(cisli245.ityp) or
cisli245.idoc = 0 then
continue
endif
|
| if i.is.aitm = tcyesno.yes then
| select tcibd004.*
| from tcibd004
| where tcibd004._index1 = {ITM_CODE_SYS, :i.ofbp.f, :cisli245.item}
| and tcibd004.aitc inrange {:i.aitm.f} and {:i.aitm.t}
| as set with 1 rows
| selectdo
| selectempty
| l.need.cont = true
| endselect
| if l.need.cont then
| continue
| endif
| endif
|
r.invoice = cisli245.ityp & "/" & str$(cisli245.idoc)
select sum(whinh431.ntwt):r.net.wght
from whinh431
where whinh431._index1 = {:l.shpm}
and whinh431.item = :cisli245.item
as set with 1 rows
selectdo
selectempty
endselect
|*****************CHANGES START**************************
if double.cmp(r.net.wght,0.00,0.0001) = 0 then
select tcibd001.wght
from tcibd001
where tcibd001._index1 = {:cisli245.item}
as set with 1 rows
selectdo
r.net.wght = tcibd001.wght * r.dqua
selectempty
r.net.wght = 0.00
endselect
endif
if double.cmp(r.net.wght,0.00,0.0001) < 0 then
select tcibd001.wght
from tcibd001
where tcibd001._index1 = {:cisli245.item}
as set with 1 rows
selectdo
r.net.wght = tcibd001.wght * r.dqua
r.net.wght = r.net.wght * -1
selectempty
r.net.wght = 0.00
endselect
endif
|********************CHANGES END**************************
|
r.tot.ntwt = r.tot.ntwt + r.net.wght
r.tot.dqua = r.tot.dqua + r.dqua
r.tot.amti = r.tot.amti + r.amti
r.tot.amth = r.tot.amth + r.amth