Calculation

From: Shahzard (shahzardnazeer_at_yahoo.com)
Date: 12/23/03

  • Next message: Lou Feliz: "Stored Prod Param Help"
    Date: 22 Dec 2003 22:43:04 -0700
    
    

    hi,
    I used the following code to calculate the Amounts of a detail Table for a particular Order in a Order processing System, which as follows(An order could consists many order detail items)

    USED TABLES:
    ORDER(OrderNo*, Date, TotalAmount)
    ORDERDETAILS(OrderNo*,ItemNo*, Quantity, Amount)
    Item(ItemNo*, Discription, UnitPrice)

    Procedure DetailTable.afterpost;
    var
       Amount: array of Currency;
       i:Integer;
    begin

      for i:= 0 to Detail.RecordCount - 1 do
        Amount[i] := 0;
        begin
          try
            Item.Open;
            Item.Locate('ItemNo', DetailItemNo.value,[]);
            Amount[i] := (DetailQuantity.Value * ItemUnitPrice.Value);
            DetailAmount.Value := Amount[i];
            Detail.Next;
          finally
            Price.Close;
          end;

    however I got the following error in my message editor "Variable Amount might not have been Initialized". However I intialized the variable as "Amount[i]:=0;". Is there any wrong coding there?
    Pls. help me out of this.

    Note: I'm just using MSSQL Server 2000 in a Client-Server Environment.


  • Next message: Lou Feliz: "Stored Prod Param Help"