pegaga1979
29th December 2015, 04:41
Hi,
Need help ..
I would like to print lot number group by item at Print Packing Slips session.
However, i'm just able to print at one line.
For Example (The print should be)
Item: 111-PRT-897
Lot: P334, P335, P336
P337, P338

Currently system just able to print;
Item: 111-PRT-897
Lot: P334, P335, P336


My script in the report as below:
i used field clot.str(2,icnt) to print Lot.


declaration:
#ident "@(#)whinh447501000 whB60asy54 nlbaudv1 Rev.No. 6 22 Jan 10 boosterb"
#ident "@(#)whinh447501000 whB60asy49 nlbaudv1 Rev.No. 2 10 Jun 09 jvdwerf"
table twhinh312
domain tcmcs.long linectr
domain tcamnt total.var, subt.var, print.qty
domain tcitem item.old

domain tcmcs.str40 clot.str(20)
domain tcmcs.str50 temp.str
long icnt, sline

#define CHECK.LINE 45

#include "itcmcs0012"

before.shpm.copy.5:
before.layout:
|||ship.text = whinh430.text

|* after.shpm.copy.75 is triggered for every shpm.copy; this command triggers
|* that packing slip pages are numbered per shipment, starting with page 1.
after.shpm.copy.75:
before.layout:
skip.to(46)
after.layout:
if approval.info <> tcyesno.yes then |#1143565.n
lattr.pageno = 0
endif
|#1143565.n
linectr = 0
total.var = 0


before.sh.line.item.10:
before.layout:
sline = 1
icnt = 1
|set.mem(clot.str,"")




after.shpm.copy.100: |#1143565.sn
after.layout:
lattr.pageno = 0 |#1143565.en

before.e.seq.add.info.9:
before.layout:
NEED(get.nr.of.lines.for.additional.info("whinh430"))


detail.80: |#dev_corn.sn
before.layout:
|* Only print if not Single Customer Order Shipment and not empty
|* If Single CO, then 'sales.orno' (whinh431.corn) equals
|* 'ship.corn' (whinh430.corn)
lattr.print = (not isspace(sales.orno) and ship.scsh = tcyesno.no)
lattr.print = false
|#dev_corn.en

detail.100:
before.layout:
lattr.print = (not isspace(order.line.ref))
lattr.print = false


detail.105:
before.layout:
|* Only print if not Single/Unique Reference Shipment and not empty
lattr.print = (not isspace(sh.line.refs) and ship.srsh = tcyesno.no)
lattr.print = false

detail.10:
before.layout:
NEED(get.nr.of.lines.for.additional.info("whinh431"))
total.var = total.var + sh.line.ship.qty
subt.var = subt.var + sh.line.ship.qty
temp.str = strip$(whinh431.clot)
add.to.str()
lattr.print = false


after.sh.line.item.10:
before.layout:
linectr = linectr + 1
if lattr.lineno >= CHECK.LINE then
page()
endif


after.layout:
|icnt = 1

after.sh.line.item.20:
after.layout:

icnt = icnt + 1
if not isspace(clot.str(1,icnt)) then
layout.again()
endif
set.mem(clot.str,"")

field.order.texta:
before.print:
validate.textline()

field.order.textb:
before.print:
validate.textline()

field.ship.text:
before.print:
validate.textline()

field.tod.text:
before.print:
validate.textline()

field.item.txtn:
before.print:
validate.textline()

field.order.line.text:
before.print:
validate.textline()

field.sh.line.text:
before.print:
validate.textline()

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

functions:
function add.to.str()
{ long len.str, ii
domain tcmcs.str40 first.str

first.str = strip$(clot.str(1,sline))
len.str = len(first.str)
if (len.str + len(temp.str)) > 38 then
sline = sline + 1
endif
clot.str(1,sline) = strip$(clot.str(1,sline)) & "," & temp.str
}

function long get.nr.of.lines.for.additional.info(
domain tcmcs.tabl i.table)
{
long number.of.fields

whint.dlltcstl.addinfo.get.number.of.fields( i.table,
number.of.fields)

number.of.fields = number.of.fields + 5 - e.seq.add.info

return(number.of.fields)
}

function validate.textline()
{
if ( lattr.prline(1;1) = ">" ) then
lattr.prline = lattr.prline(2)
else
if ( lattr.prline(1;1) = "<" ) then
lattr.print = false
endif
endif
}

pegaga1979
29th December 2015, 06:38
Then i amend the script and it result;
1st line at 2nd page (after.sh.line.item.20) is not printed.
but 2nd line onwards, it is printed OK.


the script;

before.sh.line.item.10:
before.layout:
sline = 1

set.mem(clot.str,"")



after.layout:
icnt = 1


after.sh.line.item.20:
after.layout:

icnt = icnt + 1
if not isspace(clot.str(1,icnt)) then
layout.again()
endif
|set.mem(clot.str,"")