我想从客户表到账单表中选择余额(流场)记录。我有一个Customer表和一个BillPros表。 客户表中的余额是流场。
//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 :(得分:0)
你的代码错了。您应该在FIND(' - ')之后调用CALCFIELDS。在此之前,您“没有”实际的客户记录。而且你不需要Bal变量。你可以写BillPros.Balance:= Customer。“Balance(LCY)”;