2016-04-14 82 views
1

我要挑從客戶表餘額(流場)記錄到比爾表。我有一個Customer表和一個BillPros表。 客戶表中的餘額是流場。Dynamics NAV的流場和Calcfild

//Customer on Variable Band Billing 
Customers.RESET; 
Customers.SETCURRENTKEY(Customers."No."); 
Customers.SETFILTER(Customers."No.",'%1',MeterR."Customer Number"); 
Customers.SETFILTER(Customers."Customer Posting 
     Group",'%1',Surcharge."Customer Posting Group"); 
Customers.CALCFIELDS("Balance (LCY)"); 
Bal := Customers."Balance (LCY)"; 

IF Customers.FIND('-')THEN 

    //Post Metre Reading; 
     PostReading.RESET; 
     PostReading.Date := MeterR.Period; 
     PostReading.MetreID :=MeterR."Metre ID"; 
     PostReading."Last Reading" := MeterR."Metre Reading"; 
     PostReading.INSERT; 



     //Bill Info Process 
     TotalAmount:=0; 
     BillPros.INIT; 
     BillPros."Customer No." := MeterR."Customer Number"; 
     BillPros.Consumption := TotalReading; 
     BillPros.Rate := Bands."Rate Amount"; 
     BillPros."Invoice No." := MeterR."Invoice Number"; 
     BillPros.Amount := TotalReading*Bands."Rate Amount"; 


     BillPros.Balance := Bal; 

回答

0

您的代碼是錯誤的。在FIND(' - ')之後你應該調用CALCFIELDS。在此之前,您「沒有」實際的客戶記錄。你不需要Bal變量。您可以編寫BillPros.Balance:= Customer。「Balance(LCY)」;

相關問題