local i, lchar, lnum, jn, lcnt, ltmp, lncargo, pono, ordrno, hblno1, hblno2, k, tmp, lhbl
dimension lcargo(12)
dimension lpono(12)
dimension lordrno(12)
dimension arr[2,25]
ex = 0
vess = ""
with thisform.pf.pg1
.xdf_bl.value = ""
.xdf_bl2.value = "" && Add
.xdf_indent.value = ""
.xdf_indent2.value = ""
.xdf_pol.value = ""
.xdf_pod.value = ""
.xdf_dterm.value = ""
.xdf_vessel.value = ""
.xdf_cargo.value = ""
.xdf_cargo2.value = ""
.xdf_cargo3.value = ""
.xdf_ntank.value = ""
.xdf_tank1.value = ""
.xdf_tank2.value = ""
.xdf_tank3.value = ""
.xdf_tank4.value = "" && Add
.xdf_others.value = ""
.xdf_etd.value = {}
.xdf_eta.value = {}
select dbfidgl
jn = .xdf_jn.value
if .not. empty(jn) then
for i=1 to 99
goto i
if empty(di_pre) then
loop
endif
lchar = alltrim(di_pre)
lnum = len(lchar)
if lchar = left(jn,lnum) then
with thisform.pf.pg2
.dtdgl.value = di_dtdgl
.crevgl.value = di_crevgl
.cgstgl.value = di_cgstgl
.dtdglname.value = space(40)
.crevglname.value = space(40)
.cgstglname.value = space(40)
endwith
exit
endif
next i
endif
select tnfjob
set order to tnfjob
locate for (jt_jobno = jn) and (not(empty(jt_fvess)))
if found()
ex = 1
.xdf_pol.value = jt_fpol
vess = alltrim(jt_fvess)
.xdf_etd.value = jt_fdpod
else
continue
endif
select abkng
set order to bkng
seek jn
if found() and not(empty(jn))
if ex = 0
.xdf_pol.value = bkg_pol
vess = bkg_vessel
.xdf_etd.value = bkg_etdpol
else
vess = vess+" / "+bkg_vessel
endif
.xdf_pod.value = bkg_pod
.xdf_dterm.value = bkg_term
.xdf_vessel.value= vess
.xdf_eta.value = bkg_etapod
.xdf_indent.value= bkg_pono
lcnt = 0
if (alltrim(.xdf_deb.value) = alltrim(bkg_cgnee))
.xdf_cont.value = bkg_cntcgn
else
if (alltrim(.xdf_deb.value) = alltrim(bkg_shiper))
.xdf_cont.value = bkg_cntshp
endif
endif
select port
set order to port
seek .xdf_pol.value
.xdf_pol.value = pt_name
seek .xdf_pod.value
.xdf_pod.value = pt_name
store space(70) to lcargo
store space(30) to lpono
store space(30) to lordrno
lncargo = 0
ltmp = ""
pono = ""
ordrno = ""
tmp = ""
hblno1 = "" && Add
hblno2 = "" && Add
m = 1
n = 1
s = 1
eq = 0
k = 1
select tnfjob
set order to tnfjob
locate for (jt_jobno = jn)
do while found()
lcnt = lcnt + 1
do case
case lcnt <= 3
.xdf_ntank.value = .xdf_ntank.value + jt_tankno + ' '
case lcnt > 3 .and. lcnt <= 7
.xdf_tank1.value = .xdf_tank1.value + jt_tankno + ' '
case lcnt > 7 .and. lcnt <= 11
.xdf_tank2.value = .xdf_tank2.value + jt_tankno + ' '
case lcnt > 11 .and. lcnt <= 15
.xdf_tank3.value = .xdf_tank3.value + jt_tankno + ' '
case lcnt > 15 .and. lcnt <= 19
.xdf_tank4.value = .xdf_tank4.value + jt_tankno + ' ' && Add
endcase
* do case
** Break into 2 lines in HBL no in the box
* case lcnt <= 2
* .xdf_bl.value = .xdf_bl.value + jt_hblno + ' '
* case lcnt > 2 .and. lcnt <= 4
* .xdf_bl2.value = .xdf_bl2.value + jt_hblno + ' '
* endcase
if .not. empty(jt_pronme)
j = 0
for i = 1 to lncargo
if jt_pronme = lcargo(i)
j = i
exit
endif
next i
if j=0
lncargo = lncargo + 1
if lncargo > 12
lncargo = 12
endif
lcargo(lncargo) = jt_pronme
endif
endif
*/* Purchase Order (PO no: )
if .not. empty(jt_pono)
if m = 1
lpono(m) = alltrim(jt_pono)
m = m + 1
else
eq = 0
for i = 1 to m-1
if upper(lpono(i)) = upper(alltrim(jt_pono))
eq = 1
exit
endif
endfor
if eq = 0
lpono(m) = alltrim(jt_pono)
m = m+1
endif
endif
endif
*/* Order No
if .not. empty(jt_ordrno)
if s = 1
lordrno(s) = alltrim(jt_ordrno)
s = s + 1
else
eq = 0
for i = 1 to s-1
if upper(lordrno(i)) = upper(alltrim(jt_ordrno))
eq = 1
exit
endif
endfor
if eq = 0
lordrno(s) = alltrim(jt_ordrno)
s = s+1
endif
endif
endif
*/* HBL no
if k=1
if .not.(empty(jt_hblno))
arr[1,k]= "("+alltrim(str(k))
arr[2,k] = jt_hblno
k = k+1
else
k = k+1
endif
else
for l = 1 to k-1
if k = 2
if .not.(empty(jt_hblno)) .and. .not.(empty(arr[1,l]))
if .not.(jt_hblno = arr[2,k-1])
arr[1,k]= "("+alltrim(str(k))
arr[2,k] = jt_hblno
k = k+1
exit
else
tmp = arr[1,l]
arr[1,k] = alltrim(tmp)+","+alltrim(str(k))
k = k+1
exit
endif
else
if .not.(empty(jt_hblno))
arr[1,k] = "("+alltrim(str(k))
arr[2,k] = jt_hblno
endif
k = k+1
endif
else
if .not.(empty(jt_hblno)) .and. .not.(empty(arr[1,l]))
if .not.(jt_hblno = arr[2,l])
if l = k-1
arr[1,k] = "("+alltrim(str(k))
arr[2,k] = jt_hblno
k = k+1
exit
endif
else
tmp = arr[1,l]
arr[1,l] = alltrim(tmp)+","+alltrim(str(k))
k = k+1
exit
endif
else
if .not.(empty(jt_hblno))
arr[1,l] = "("+alltrim(str(k))
endif
k = k+1
exit
endif
endif
endfor
endif
select tnfjob
continue
enddo
.xdf_ntank.value = '('+left(str(lcnt,2)+') '+.xdf_ntank.value,60)
.xdf_cargo.value = lcargo(1)
.xdf_cargo2.value = lcargo(2)
.xdf_cargo3.value = lcargo(3)
for i = 1 to m-1
if i = 1
pono = lpono(i)
else
pono = pono+" & "+lpono(i)
endif
next i
for i = 1 to s-1
if i = 1
ordrno = lordrno(i)
else
ordrno = ordrno+" & "+lordrno(i)
endif
next i
for l = 1 to k-1
if l = 1
if .not.(empty(arr[1,l]))
hblno1 = arr[1,l]+") "+alltrim(Jt_hblno)
endif
else
if .not.(empty(arr[1,l]))
hblno1=hblno1+" &"+substr(alltrim(Jt_hblno),at(" ",alltrim(Jt_hblno)))
endif
i=i+1
endif
endfor
* for l = 1 to k-1
* if l = 1
* if .not.(empty(arr[1,l]))
* hblno1 = arr[1,l]+") "+alltrim(arr[2,l])
* endif
* else
* if .not.(empty(arr[1,l]))
* hblno1 = hblno1+" & "+arr[1,l]+") "+alltrim(arr[2,l])
* endif
* endif
* endfor
.xdf_indent.value= pono
.xdf_indent2.value= ordrno
.xdf_bl.value= hblno1
&& .xdf_bl.value= LEFT(hblno1,AT(" ",hblno1 )) + " " + STRTRAN(STRTRAN(hblno1 ,LEFT(hblno1 ,AT(" ",hblno1 )),""),","," & ")
* .xdf_bl2.value= hblno2 && add
endif
*/* For the job with "K" . Copy Original coding 22/05/06
* if substr(.xdf_jn.value,1,1)="K"
* x = 0
* y = 0
* i = 1
* ad = 1
* tank = ""
* bl = ""
* lncargo = 0
* store space(20) to arr
* store space(70) to lcargo
* select tffile
* set order to tffile
* seek .xdf_jn.value
* do while found() .and. (tf_jobno = .xdf_jn.value)
* x = x+1
* if x = 1
* tank = "CONTAINER NO / FLEXITANK NO:-"+chr(13)+str(x,1)+")"+tf_cntno+" / "+tf_flxno+chr(13)
* else
* tank = tank+str(x,1)+")"+tf_cntno+" / "+tf_flxno+chr(13)
* endif
* if i = 1
* arr[1,i] = alltrim(tf_hblno)
* bl = alltrim(tf_hblno)
* y = 1
* endif
* ad = 1
* for z = 1 to y
* if (alltrim(arr[1,z]) = alltrim(tf_hblno))
* ad = 0
* endif
* next z
* if i > 1
* if ad = 1
* arr[1,y+1] = alltrim(tf_hblno)
* bl = bl+" & "+alltrim(tf_hblno)
* y = y+1
* endif
* endif
* if .not. empty(tf_cargo)
* j = 0
* for i = 1 to lncargo
* if tf_cargo = lcargo(i)
* j = i
* exit
* endif
* next i
* if j=0
* lncargo = lncargo + 1
* if lncargo > 12
* lncargo = 12
* endif
* select cargo
* set order to cargo
* seek tffile.tf_cargo
* if found()
* lcargo(lncargo) = crg_prod
* endif
* select tffile
* endif
* endif
* i = i+1
* skip
* enddo
* .xdf_bl.value = bl
* .xdf_indent2.value= abkng.bkg_ordrno
* if not(abkng.bkg_mft20 = 0) or not(empty(abkng.bkg_mft20))
* .xdf_ntank.value = alltrim(str(abkng.bkg_mft20))+" x 20'"
* endif
* if not(abkng.bkg_mft40 = 0) or not(empty(abkng.bkg_mft40))
* .xdf_tank1.value = alltrim(str(abkng.bkg_mft40))+" x 40'"
* endif
* .xdf_cargo.value = lcargo(1)
* .xdf_cargo2.value = lcargo(2)
* .xdf_cargo3.value = lcargo(3)
* .xdf_others.value = tank
* endif
endwith