james30
15th September 2014, 07:12
Hi All,
i need help for the report and i want to combine 2 data with the same values and it will combine/Add the quantity for 2 values

This is the code(REPORT SCRIPT)
|whinh312.refe (this is just a reference-Manualy Encode when Receiving Item)

before.whinh312.refe.1:
before.layout:
select distinct whinh312.refe
from whinh312
where whinh312.item = {:whinr110.item}
and whinh312.pono = {:whinr110.pono}
and whinh312.orno = {:whinr110.orno}
and whinh312.refe <> ""
group by whinh312.refe
selectdo
lattr.print = true
selectempty
whinh312.refe = ""
lattr.print = false
endselect

IMAGE Display:
ITEM
1010530001 Quantity
Pallete#1 500
Pallete#2 500
Pallete#3 500
Pallete#1 500
Total: 2,000

For example above i want to combine Pallete with the same NUMBER just like Pallete#1 and also Add the Quantity of Pallete#1

The Output must be:
1010530001 Quantity
Pallete#1 1,000 <-- the two Pallete#1 are combine and the quantity is add it become 1,000
Pallete#2 500
Pallete#3 500
Total: 2,000

Anyone i need help pls :(
thanks in advance.

bhushanchanda
15th September 2014, 10:16
Hi,

You can try using alias. I am not able to figure out what exactly you are trying to print. What I understand is, you are selecting records based on whinr110.orno and pono and item. And then just grouping the records based on refe. Does your refe stores Pallete#1, #2 information?

Also, where do you want to print it? Just after item I guess. So, I don't see how you are sorting the records based on Palette.

Basic idea will be to sort the records of whinh312 based on refe. You can use on.change.check() and if changed() combinations to collect the total quantity of a single palette and then print the quantity. Now, if any other palettes are available, call the layout again.

james30
15th September 2014, 10:41
hi Bhushan,
thanks for your reply, but regarding to my concern i just want to combine the same records or data just like Pallete#1. us u can see ther are two Pallete#1 at records and different quantity i want to combine the same data and add the quantity. and
Pallete#1 become:
1010530001 Quantity
Pallete#1 1,000

Regarding to ur question
The Pallete#1 - 3 it just encoding when the Item Receipt(Warehouse Receipt) just typing

i group it base on ITEM under item is Pallete#1, It will just display the Pallete base on the warehouse and item.

can u make a script so that i can test it if it work on me

thank you Bhushan.

bbhawesh
15th September 2014, 10:55
May be you can try to read all the records related a particular pallet at a time and store this read pallet in an array. Every time before printing a pallet you can check whether that is already printed with the help of this array.

So it would be something like in report script i got Pallet#1 then i will search the table and read all records with Pallet#1 and do the summation of quantity and store this Pallet#1 to an array (say already.printed). Everytime before executing above logic i will check if my Pallet exists in array already.printed or not.

james30
15th September 2014, 11:03
hi bbhawesh,
I am NEW in BAAN Script, can u make a script so that i can clearly understand on how my report will be going using ur ideas.

thanks in advance.

vamsi_gujjula
15th September 2014, 12:30
can you post the input fields & layouts screen shots(need to check the ordering & layouts used).... and do you have access to program script ??

james30
16th September 2014, 04:38
hi vamsi_gujjula

This is my Program Script

declaration:
table twhinr110,ttdisa001,ttcibd003,ttcibd001
extern domain tcitem itemf
extern domain tcitem itemt
extern domain tccwar cwarf
extern domain tccwar cwart
extern domain tctrns.date datef
extern domain tctrns.date datet
extern domain tckoor typef
extern domain tckoor typet
extern domain tcorno ornof
extern domain tcorno ornot
extern domain tcmcs.str15 itemunit,cuni
extern domain tcqdhc convertion
extern domain tcqdhc qtytest
extern domain tfgld.str30 stat
|****************************** PROGRAM SECTION ***************************
group.1:
init.group:
get.screen.defaults()
|****************************** ZOOM FROM SECTION ***************************
|************ITEM FIELD CHANGE*************
field.itemf:
when.field.changes:
itemt = itemf
|*********WAREHOUSE FIELD CHANGE***********
field.cwarf:
when.field.changes:
cwart = cwarf
|*********ORDER NUMBER FIELD CHANGE***********
field.ornof:
when.field.changes:
ornot = ornof

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif

functions:
function read.main.table()
{
|write your select statement here

select
whinr110.koor,
whinr110.orno,
whinr110.pono,
whinr110.qhnd,
whinr110.qstk,
whinr110.trdt,
whinr110.cwar,
whinr110.item,
whinr110.kost,
whinr110.shpm,
whinr110.rcno,
whinr110.logn,
whinr110.clot,
whinr110.bpid

from
whinr110
where

whinr110._index2 inrange {:typef,:ornof,0,:datef,0}
and {:typet,:ornot,9999,:datet,9999}

and whinr110.item inrange {:itemf} and {:itemt}
and whinr110.cwar inrange {:cwarf} and {:cwart}

selectdo

|para sa item unit
select tdisa001.cuqs
from tdisa001
where tdisa001._index1 = {:whinr110.item}
selectdo
itemunit = tdisa001.cuqs
endselect

|NEW sa Convertion Factor
select tcibd001.cuni,tcibd001.dsca
from tcibd001
where tcibd001._index1 = {:whinr110.item}
selectdo
cuni = tcibd001.cuni
endselect

|Convertion Unit
|Unit convertion
select tcibd003.*|tcibd003.conv,tcibd003.unit <E add to sa input fields ng report pag ng error sa convertion
from tcibd003
where tcibd003.item = ""
and tcibd003.basu = :cuni|"TN"
and tcibd003.unit = :itemunit |{:cisli245.cuqs} |Unit ng Item<--para makuha din convertion ng pack

selectdo


selectempty
convertion=1
endselect



if whinr110.kost = tckost.issue and whinr110.qstk < 0 then |Putaway

qtytest=whinr110.qstk * (-1) / convertion
stat = "Put Away"
else

if whinr110.kost = tckost.issue and whinr110.qstk > 0 then |Shipped

qtytest=whinr110.qstk * (-1) / convertion
stat = "Shipped"
else

if whinr110.kost = tckost.receipt then |Put Away

qtytest=whinr110.qstk / convertion
stat = "Put Away"
else

qtytest=whinr110.qstk / convertion |Processed
stat = "Processed"
endif
endif
endif


rprt_send()
endselect

}



About in input field and Layout see the attach file
i hope u can help me :(

cos i dont know how to do now :confused: