JoeleZ
1st February 2013, 04:34
I'm new in baan board, and i want to ask to anyone that mastering reporting.
i want to create report for manufacturing order, that have multiple operation.

and i want to print from MO and printing all of the operation, and break page each operation.

right now i already creating program script but it was just printing for one operation per MO. now we have MO with multiple operation. how can i change the code that i have? here i'll put my code

|******************************************************************************
|* tisfc9401 0 VRC B617 u bsi1
|* Manufacturing Order
|* Installation user
|* 2012-10-25
|******************************************************************************
|* Main table tisfc001 Production Orders, Form Type 4
|******************************************************************************

|****************************** declaration section ***************************
declaration:

table ttisfc001 | Production Orders
table tbptmm120
table tticst001
table ttcibd001

extern domain tcpdno pdno.f fixed
extern domain tcpdno pdno.t fixed

extern domain tcbool detail.lay
extern domain tcbool hours.line

extern domain tcbool wip.line

extern domain tcbool estimate.line

extern domain tcitem item.product
extern domain tcdsca item.dsca
extern domain tccuni uom
extern domain tiqcp1 quantity

extern domain tiqro2 target.hour
extern domain tcnoru normal.person
extern domain tccwoc work.center
extern domain tcdsca work.cent.name
extern domain tclogn user.log

extern domain tcbool fill.line

|****************************** program section ********************************


|****************************** group section **********************************

group.1:
init.group:
get.screen.defaults()

|****************************** choice section ********************************

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


|****************************** field section *********************************

field.pdno.f:
when.field.changes:
pdno.t = pdno.f


|****************************** function section ******************************

functions:

function read.main.table()
{
user.log = logname$
fill.line = false
select tisfc001.*
from tisfc001
where tisfc001._index1 inrange {:pdno.f}
and {:pdno.t}
order by tisfc001._index1
selectdo
detail.lay = false
get.target.hour.and.normal.person()
rprt_send()
print.wip()
print.estimated.materials()
estimate.line = true
detail.lay = false
rprt_send()
estimate.line = false
fill.line = true
rprt_send()
fill.line = false
selectempty
message("No data within selection")
return
endselect

}


function print.wip()
{
|* Yet to decide the logic, when customer comes up with logic to calculate, this can filled
}

function print.estimated.materials()
{
detail.lay = true
select ticst001.*
from ticst001
where ticst001._index1 = {:tisfc001.pdno}
selectdo
item.product = ticst001.sitm
item.dsca = get.item.desc()
select tcibd001.*
from tcibd001
where tcibd001.item = {:tisfc001.mitm}
selectdo
uom = tcibd001.cuni
selectempty
uom = "PCS"
endselect
quantity = ticst001.ques
rprt_send()

endselect
detail.lay = false

}

function domain tcdsca get.item.desc()
{
domain tcdsca l.dsca
l.dsca = ""
select tcibd001.dsca:l.dsca
from tcibd001
where tcibd001._index1 = {:ticst001.sitm}
as set with 1 rows
selectdo
break
endselect
return(l.dsca)
}

function get.target.hour.and.normal.person()
{
target.hour = 0
work.center = ""
normal.person = 0
select tisfc010.prte:target.hour,
tisfc010.cwoc:work.center
from tisfc010
where tisfc010._index1 = {:tisfc001.pdno}
|as set with 1 rows
selectdo
select tirou001.noop:normal.person,
tirou001.dsca:work.cent.name
from tirou001
where tirou001._index1 = {:work.center}
|as set with 1 rows
selectdo
endselect
endselect

}


please help me....
my jobs is on the line...

best regards,
Yoel

mark_h
1st February 2013, 20:34
Well you get all the production orders with a select. You then do this:

user.log = logname$
fill.line = false
select tisfc001.*
from tisfc001
where tisfc001._index1 inrange {:pdno.f}
and {:pdno.t}
order by tisfc001._index1
selectdo
detail.lay = false
get.target.hour.and.normal.person()
rprt_send()

so the get.target.hour routine gets all the operations, but you only do a report send after the subroutine. Move the rprt_send() into the function like below:

function get.target.hour.and.normal.person()
{
target.hour = 0
work.center = ""
normal.person = 0
select tisfc010.prte:target.hour,
tisfc010.cwoc:work.center
from tisfc010
where tisfc010._index1 = {:tisfc001.pdno}
|as set with 1 rows
selectdo
select tirou001.noop:normal.person,
tirou001.dsca:work.cent.name
from tirou001
where tirou001._index1 = {:work.center}
as set with 1 rows
selectdo
endselect
rprt_send()
endselect
}

Also note I put the as set with 1 rows back into the work center select. At least on our system we would only need 1 work center per operation.

JoeleZ
4th February 2013, 04:00
Thanksalot, i'll try it now.... thanks a lot.
i'll update you when custom is done.

JoeleZ
4th February 2013, 09:37
Hellow,

Thx Mr Mark,
Now i can do it, but i'm confusehow to doing something like page() in report script if want to do it on program script.

because it isn't break the page but continuous add a new operation and item T_T

thanks again....
best regards,
Yoel

mark_h
4th February 2013, 15:11
As far as I know the page() command will only work in the report script. If you have a layout you always want to start on a new page then you can set it on the layout itself. Sometimes you just basically have to play with a report and the various settings to see what they do.