//删除进货明细表 adoquery1.Close; adoquery1.sql.clear; adoquery1.sql.add('delete from jhmxb where id=:id'); adoquery1.Parameters.ParamByName('id').Value:=Trim(Edit22.Text); adoquery1.Prepared; adoquery1.ExecSQL;
//修改进货汇总表 adoquery1.Close; adoquery1.sql.clear; adoquery1.sql.add('update jhhzb set jhje=jhje-:jhje,wfje=wfje-:wfje where djh=:djh'); adoquery1.Parameters.ParamByName('jhje').Value:=trim(edit18.Text); adoquery1.Parameters.ParamByName('wfje').Value:=trim(edit18.Text); adoquery1.Parameters.ParamByName('djh').Value:=trim(edit1.Text); adoquery1.Prepared; adoquery1.ExecSQL;
//明细表是否删除完毕 adoquery2.Close; adoquery2.sql.clear; adoquery2.sql.add('select * from jhmxb where djh=:djh'); adoquery2.Parameters.ParamByName('djh').Value:=trim(edit1.Text); adoquery2.Prepared; adoquery2.open; if adoquery2.RecordCount=0 then begin adoquery1.Close; adoquery1.sql.clear; adoquery1.sql.add('delete from jhhzb where djh=:djh'); adoquery1.Parameters.ParamByName('djh').Value:=trim(edit1.Text); adoquery1.Prepared; adoquery1.ExecSQL; end;
//库存明细表 adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('update kcb set jhs=jhs-:jhs,kcs=kcs-:kcs where mc=:mc and jj=:jj'); adoquery1.Parameters.ParamByName('jhs').Value:=Trim(Edit21.Text); adoquery1.Parameters.ParamByName('kcs').Value:=Trim(Edit21.Text); adoquery1.Parameters.ParamByName('mc').Value:=Trim(Edit15.Text);
adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('update kcb set jhje=jhs*jj,kcje=kcs*jj where mc=:mc and jj=:jj'); adoquery1.Parameters.ParamByName('mc').Value:=Trim(Edit15.Text); adoquery1.Parameters.ParamByName('jj').Value:=Trim(Edit20.Text); adoquery1.Prepared; adoquery1.ExecSQL;