我在数据窗口的itemchanged写了如下语句,可总不能如我所愿啊?
cl007 2001-06-22 02:35:00 我想在"smallyl"输完最小用量,回车,判断库存是否满足,可回车后没动静,我把最小用量再改动一下才触发,请问我该怎么做啊?
string xm_id,authorized_number,medicine_serial_noint,xm_spec,drugstore_id
int mid_to_small,xm_midyl,xm_smallyl,n
if dw_4.getcolumnname()="smallyl" then
n=dw_4.getrow()
xm_id=dw_4.getitemstring(n,"xm_id")
authorized_number=dw_4.getitemstring(n,"authorized_number")
medicine_serial_noint=dw_4.getitemstring(n,"medicine_serial_noint")
xm_spec=dw_4.getitemstring(n,"gg")
drugstore_id=dw_4.getitemstring(n,"drugstore_id")
mid_to_small=dw_4.getitemnumber(n,"mid_to_small")
xm_midyl=dw_4.getitemnumber(n,"midyl")
xm_smallyl=dw_4.getitemnumber(n,"smallyl")
//确定药品是否够用
int li_store_amount_total,li_store_amount,li_store_amount_small
int li_use_amount_total
int li_remain_amount_total
select medicine_amount,medicine_amount_small
into :li_store_amount,:li_store_amount_small
from yf_store_amount
where drugstore_id=:drugstore_id and
medicine_id=:xm_id and
authorized_number=:authorized_number and
medicine_serial_noint=:medicine_serial_noint and
medicine_spec=:xm_spec;
li_store_amount_total = (li_store_amount * mid_to_small + li_store_amount_small)
li_use_amount_total = (xm_midyl * mid_to_small) +xm_smallyl
li_remain_amount_total = (li_store_amount_total - li_use_amount_total)
if li_remain_amount_total < 0 then
messagebox("提示","药品库存不足!")
rollback;
end if
end if