表cgdd(采购订单)
                     
                           id     spbm     sl        jhsl(进货数量)
                            1      p001     10       10
                            1      p002     20       30
                            1      p003     30       25
     s_sql:='select sum(sl) as sl,sum(jhsl) as jhsl from TCG_CGDD  where id='+inttostr(FieldByName('yyid').AsInteger);
                    ADOQueryTmp.SQL.Clear ;
                    ADOQueryTmp.SQL.Add(s_sql) ;
                    ADOQueryTmp.open;
                    if ADOQueryTmp.FieldByName('sl').Value<=ADOQueryTmp.FieldByName('jhsl').Value then
                      begin
                       s_sql:='update prindxdd set zt=2  where id='+inttostr(FieldByName('yyid').AsInteger);
                       ADOQueryTmp.SQL.Clear ;
                       ADOQueryTmp.SQL.Add(s_sql) ;
                       ADOQueryTmp.ExecSQL;
                      end;
如上所示,采购入库时判断采购订单数量有没有完成,我设计了上面的代码,虽然采购入库总数已经大于等于采购定单,按程序设计采购订单已完成,实际我想设计当所以的jhsl>=sl时,采购定单才能算完成,这样的话上面的数量总数完成了,但实际按照我的设想还是没有完成,怎么设计