window_function 取得row資訊後做迴圈運算
long ll_count
string ls_seq_no, ls_out, ls_part, ls_partnum, ls_card, ls_postal, ls_addr1, ls_addr2, ls_addr3
decimal ld_out, ld_turn
tab_1.tabpage_1.dw_4.Reset()//重新產生dw4之前先清除
long ll_dw3_count,ll_dw3_rowcount,ll_dw3_row
string ls_dw3_out,ls_dw3_part,ls_dw3_pick
ll_dw3_rowcount = tab_1.tabpage_1.dw_3.rowcount()
ls_seq_no = '000'
ll_count = 0
declare curd_lsf200 cursor for
select a.part_no, a.part_num, a.card_no, a.out_no, a.postal, a.addr1, a.addr2, a.addr3
from lsf200 a
where 1 = 1
and a.proj_no = :fs_proj
and isnull(a.lsp170_yn,'N') <> 'Y'
order by a.part_no, a.out_no, a.card_no;
open curd_lsf200;
fetch curd_lsf200 into :ls_part, :ls_partnum, :ls_card, :ls_out, :ls_postal, :ls_addr1, :ls_addr2, :ls_addr3 ;
do while sqlca.sqlcode = 0
ll_dw3_count = 1
do while ll_dw3_count <= ll_dw3_rowcount
ll_dw3_row = tab_1.tabpage_1.dw_3.GetRowFromRowId(ll_dw3_count)
ls_dw3_out = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"out_no")
ls_dw3_part = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"part_no")
ls_dw3_pick = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"ls_pick")
if ls_dw3_pick = 'Y' and ls_dw3_out = ls_out and ls_dw3_part = ls_part then
ll_count = ll_count + 1
ls_seq_no = string( long(ls_seq_no) + 1 ,'000')
tab_1.tabpage_1.dw_4.insertrow(0)
tab_1.tabpage_1.dw_4.setitem(ll_count, "seq_no", ls_seq_no)
tab_1.tabpage_1.dw_4.setitem(ll_count, "part_no", ls_part)
tab_1.tabpage_1.dw_4.setitem(ll_count, "part_num", ls_partnum)
tab_1.tabpage_1.dw_4.setitem(ll_count, "card_no", ls_card)
tab_1.tabpage_1.dw_4.setitem(ll_count, "out_no", ls_out)
tab_1.tabpage_1.dw_4.setitem(ll_count, "postal", ls_postal)
tab_1.tabpage_1.dw_4.setitem(ll_count, "addr1", ls_addr1)
tab_1.tabpage_1.dw_4.setitem(ll_count, "addr2", ls_addr2)
tab_1.tabpage_1.dw_4.setitem(ll_count, "addr3", ls_addr3)
tab_1.tabpage_1.dw_4.setitem(ll_count, "ls_pick", 'Y')
end if
ll_dw3_count = ll_dw3_count+1
loop
fetch curd_lsf200 into :ls_part, :ls_partnum, :ls_card, :ls_out, :ls_postal, :ls_addr1, :ls_addr2, :ls_addr3 ;
loop
close curd_lsf200;
return
buttenchecked
//IFITB00F-HD000000000860 新增條件:分公司別和部門別//業務員
//分公司
if dwo.name = "pb_comp" then
lstr.pc_cnt = 2
openwithparm( w_pick_company, lstr, gw_win )
lstr = Message.PowerObjectParm
if lstr.pc_cnt > 0 then
ls_code1 = lstr.ps_code1[1]
tab_1.tabpage_1.dw_1.setitem( row, "comp_no", ls_code1)
tab_1.tabpage_1.dw_1.setitem( row, "comp_name_a", lstr.ps_code2[1] )
tab_1.tabpage_1.dw_1.setcolumn("comp_no")
else
tab_1.tabpage_1.dw_1.setfocus()
tab_1.tabpage_1.dw_1.setcolumn("comp_no")
end if
tab_1.tabpage_1.dw_1.setfocus()
tab_1.tabpage_1.dw_1.setcolumn("comp_no")
goto buttonclicked_exit
end if
//部門別
if dwo.name = "pb_dept" then
lstr.pc_cnt = 2
openwithparm( w_pick_dept, lstr, gw_win )
lstr = Message.PowerObjectParm
// 有挑選資料
if lstr.pc_cnt > 0 then
ls_code1 = lstr.ps_code1[1]
tab_1.tabpage_1.dw_1.setitem(row, "dept_no", ls_code1)
tab_1.tabpage_1.dw_1.setitem(row, "dept_name", lstr.ps_code2[1])
tab_1.tabpage_1.dw_1.setcolumn("dept_no")
else
tab_1.tabpage_1.dw_1.setfocus()
tab_1.tabpage_1.dw_1.setcolumn("dept_no")
end if
tab_1.tabpage_1.dw_1.setfocus()
tab_1.tabpage_1.dw_1.setcolumn("dept_no")
goto buttonclicked_exit
end if
//業務員
IF dwo.name = "pb_emp" THEN
lstr.pc_cnt = 1
lstr.ps_where="isnull(baf004.emp_yn,'N') = 'Y' and isnull(baf004.leave_date,'') = ''"
openwithparm( w_pick_emp, lstr, gw_win )
lstr = Message.PowerObjectParm
IF lstr.pc_cnt > 0 THEN
is_change = "Y"
tab_1.tabpage_1.dw_1.setitem( row, "emp_id" , lstr.ps_code1[1])
tab_1.tabpage_1.dw_1.setitem( row, "emp_cname" , lstr.ps_code2[1])
// tab_1.tabpage_1.dw_1.setitem( row, "comp_no" , lstr.ps_code3[1])
// tab_1.tabpage_1.dw_1.setitem( row, "comp_name_a", lstr.ps_code4[1])
//
// tab_1.tabpage_1.dw_1.setitem( row, "dept_no" , lstr.ps_code5[1])
// tab_1.tabpage_1.dw_1.setitem( row, "dept_name", lstr.ps_code6[1])
//debug
//err_msg(63,2,'@1'+lstr.ps_code1[1]+'AAA'+lstr.ps_code2[1]+'AAA'+lstr.ps_code3[1]+'AAA'+lstr.ps_code4[1]+'AAA'+lstr.ps_code5[1]+'AAA'+lstr.ps_code6[1]+'AAA'+lstr.ps_code7[1]+'AAA'+'@')
//is_err = 'Y'
ELSE
tab_1.tabpage_1.dw_1.setfocus()
tab_1.tabpage_1.dw_1.setcolumn("emp_no")
goto buttonclicked_exit
END if
//tab_1.tabpage_1.dw_1.setcolumn("eng_emp")
//tab_1.tabpage_1.dw_1.setfocus()
goto buttonclicked_exit
END if
itemchange
//IFITB00F-HD000000000860 新增條件:分公司別和部門別//業務員
//分公司
case "comp_no"
//ls_compno ,ls_compnm
ls_compno = tab_1.tabpage_1.dw_1.getitemstring(row,"comp_no")
select comp_name_a into :ls_compnm from pu_company where comp_no = :ls_compno
using sqlca;
if ls_compnm <> ''
tab_1.tabpage_1.dw_1.setitem( row, "comp_name_a", ls_compnm )
tab_1.tabpage_1.dw_1.setcolumn("comp_no")
else
err_msg(2,2,"@@1" + "此~公~司~代~號~不~存~在~﹐請~重~新~輸~入~﹗ " + "@")
tab_1.tabpage_1.dw_1.setitem( row, "comp_no", "" )
goto itemchanged_exit
end if
//部門別 ls_deptno, ls_deptnm
case "dept_no"
ls_deptno = tab_1.tabpage_1.dw_1.getitemstring(row,"dept_no")
select dept_name into :ls_deptnm from baf002 where dept_no = :ls_deptno ;
//select comp_name_a into :ls_compnm from pu_company where comp_no = :ls_compno
using sqlca;
if ls_compnm <> ''
tab_1.tabpage_1.dw_1.setitem( row, "dept_name", ls_deptnm )
else
err_msg(2,2,"@@1" + "此~部~門~代~號~不~存~在~﹐請~重~新~輸~入~﹗ " + "@")
tab_1.tabpage_1.dw_1.setitem( row, "dept_no", "" )
goto itemchanged_exit
end if
//業務員
// ls_empid, ls_empnm
case "emp_id"
ls_empid = tab_1.tabpage_1.dw_1.getitemstring(row,"emp_id")
select emp_cname into :ls_empnm from baf004
where emp_id = :ls_empid
and isnull(baf004.emp_yn,'N') = 'Y'
and isnull(baf004.leave_date,'') ='';
using sqlca;
if ls_compnm <> ''
tab_1.tabpage_1.dw_1.setitem( row, "emp_cname", ls_empnm )
else
err_msg(2,2,"@@1" + "此~員~工~代~號~不~存~在~﹐請~重~新~輸~入~﹗ " + "@")
tab_1.tabpage_1.dw_1.setitem( row, "dept_no", "" )
goto itemchanged_exit
end if