먼저, 1) ue_insert에 순차적으로(마지막row추가) 입력하게 한다
/*===========================================================================*/
/* Event : ue_insert */
/* Description : 추가버튼 클릭시 발생 */
/* Update : 수정불가 */
/*===========================================================================*/
String ls_yymm, ls_div
long ll_cur_row, ll_row_count
if dw_entry.AcceptText() <> 1 then return
ls_yymm = String(dw_1.object.bill_ym[1], 'yyyymm')
ls_div = dw_1.object.cp_item[1]
if isnull(ls_yymm) or trim(ls_yymm) = '' then
messagebox("알림","계산서 발행 년월을 입력하세요")
return
end if
if isnull(ls_div) or trim(ls_div) = '' then
messagebox("알림","계산서 발행 구분을 입력하세요")
return
end if
ll_row_count = dw_entry.rowcount()
ll_cur_row = ll_row_count + 1
if ll_cur_row < 0 then return
ii_rc = iuo_object.uf_insert_row (ll_cur_row)
This.Trigger Event ue_button(2, ii_rc, ll_cur_row)
This.Trigger Event ue_message(2, ii_rc)
2) ue_update 저장시 db에 저장된 seq와 화면에 추가 입력된 seq를 구분해 주고 db애 저장한 것이 아니면 seq를 1번부터 새로 부여한 다음 db의 마지막 seq와 더해서 실제 저장될 seq를 구한다
Long p = 1
FOR i = 1 TO ll_row_count
ie_dw_status = dw_entry.GetItemStatus(i, 0, Primary!)
IF ie_dw_status = NewModified! THEN /* New Record */
dw_entry.Setitem(i, "seq", p)
p = p + 1
END IF
NEXT
FOR i = 1 TO ll_row_count
ie_dw_status = dw_entry.GetItemStatus(i, 0, Primary!)
IF ie_dw_status = NewModified! THEN /* New Record */
dw_entry.SetItem(i, "comp_cd" , gs_company)
ll_temp_seq = dw_entry.object.seq[i]
select nvl(max(seq),0) + :ll_temp_seq
into :ll_row_seq
from tb_sw25911
where comp_cd = :gs_company
and yymm = :is_bill_ym
and cp_item = :is_cp_item ;
dw_entry.Setitem(i, "yymm" , is_bill_ym)
dw_entry.SetItem(i, "cp_item" , is_cp_item)
dw_entry.SetItem(i, "seq" , ll_row_seq)
dw_entry.SetItem(i, "create_id", gs_userid)
dw_entry.SetItem(i, "create_dt", ld_datetime)
dw_entry.SetItem(i, "create_ip", gs_ip_add)
ELSEIF ie_dw_status = DataModified! THEN // or ie_dw_status = NotModified!THEN /* Modify Record */
ls_doctype = dw_entry.object.doctype[i]
if isnull(ls_doctype) or trim(ls_doctype) = '' then
dw_entry.SetItem(i, "modify_code", '')
end if
dw_entry.SetItem(i, "modify_id", gs_userid)
dw_entry.SetItem(i, "modify_dt", ld_datetime)
dw_entry.SetItem(i, "modify_ip", gs_ip_add)
END IF
NEXT
ii_rc = iuo_object.uf_update()