我不知道
is_bh="add" 什么意思 小第做毕业设计不会呀
那位大哥告诉我
我的QQ是278555446
很着急
大家帮帮吧我知道这个问题很傻
还有 当执行过这个函数后 我再添加的时候
例如 数据库原始值是is_bh=00000039
执行过一次后变成 000000040
再执行一次后还是 000000040
然后数据库就出错误了跟约束冲突为什么只能执行一次
is_bh 还是原来的那个值is_bh只更新一次点2次的时候就不行了
long msg,lsh,nf,i,mm,msl,mnf
string pp,mspbm,mph,mckbm
real mcgzje
datetime msxq
decimal ld_she,ld_sjhj,ld_bhsj
if dw_1.rowcount() =0 then
messagebox("操作提示","进货单没有任何数据,不能保存!"
return
end if
if is_bh = "add" then//如果新增,计算单号
select max(编号) into :is_blh from 进货单明细;
if sqlca.sqlcode0 then
messagebox("提示信息","获得进货单编号失败!"
return
end if
if trim(is_blh) = "" or isnull(is_blh) then
is_blh = "0000000001"
else
is_blh = string(long(is_blh) + 1,"0000000000"
end if
dw_bt.setitem(1,"编号",is_blh)
end if
for i = 1 to dw_1.rowcount()
dw_1.setitem(i,"编号",is_blh)
dw_1.setitem(i,"进货单号",is_blh)
ld_she = dw_1.getitemdecimal(i,"税额"
ld_sjhj = dw_1.getitemdecimal(i,"税价合计"
ld_bhsj = dw_1.getitemdecimal(i,"不含税价"
next
dw_bt.setitem(1,"税额",ld_she)
dw_bt.setitem(1,"税价合计",ld_sjhj)
dw_bt.setitem(1,"不含税价",ld_bhsj)
dw_bt.accepttext()
if dw_bt.update() = 1 and dw_1.update() = 1 then
commit;
messagebox("提示信息","进货单保存成功!"
else
rollback;
messagebox("提示信息","进货单保存失败,请重试!"
return
end if
|