|
@@ -24,6 +24,8 @@ type
|
|
|
|
|
|
function GetPayablePrice(AIndex: Integer): Double;
|
|
|
|
|
|
+ procedure RepairPhaseRecord;
|
|
|
+
|
|
|
procedure BeforeBatchOperation;
|
|
|
procedure AfterBatchOperation;
|
|
|
|
|
@@ -161,6 +163,7 @@ var
|
|
|
begin
|
|
|
if TPhaseData(FPhaseData).StageDataReadOnly then Exit;
|
|
|
|
|
|
+ RepairPhaseRecord;
|
|
|
for iIndex := 0 to sddPhasePay.RecordCount - 1 do
|
|
|
Calculate(sddPhasePay.Records[iIndex].ValueByName('ID').AsInteger);
|
|
|
CalculateCurPay;
|
|
@@ -178,7 +181,31 @@ begin
|
|
|
sTPField := 'TotalPrice' + IntToStr(TPhaseData(FPhaseData).StageIndex);
|
|
|
sFField := 'Formula' + IntToStr(TPhaseData(FPhaseData).StageIndex);
|
|
|
sPreField := 'PreTotalPrice' + IntToStr(TPhaseData(FPhaseData).StageIndex);
|
|
|
- if Rec.ValueByName(sFField).AsString <> '' then
|
|
|
+
|
|
|
+ iID := Rec.ValueByName('ID').AsInteger;
|
|
|
+ with TProjectData(TPhaseData(FPhaseData).ProjectData).DealPaymentData do
|
|
|
+ begin
|
|
|
+ // 获取起扣金额
|
|
|
+ fStartedPrice := GetStartedPrice(iID);
|
|
|
+
|
|
|
+ if Rec.ValueByName(sFField).AsString <> '' then
|
|
|
+ begin
|
|
|
+ // 初次达到起扣金额时,bqwc基数值取值为累计完成计量-起扣金额
|
|
|
+ if Rec.ValueByName('Pre'+sTPField).AsFloat = 0 then
|
|
|
+ fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString, fStartedPrice)
|
|
|
+ else
|
|
|
+ fTotalPrice := FPayFormula.Calculate(Rec.ValueByName(sFField).AsString);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ fTotalPrice := 0;
|
|
|
+
|
|
|
+ if CheckStartedPrice(iID) then
|
|
|
+ Rec.ValueByName(sTPField).AsFloat := GetAllowTotalPrice(iID, fTotalPrice, Rec.ValueByName(sPreField).AsFloat)
|
|
|
+ else
|
|
|
+ Rec.ValueByName(sTPField).AsFloat := 0;
|
|
|
+ end;
|
|
|
+
|
|
|
+ {if Rec.ValueByName(sFField).AsString <> '' then
|
|
|
begin
|
|
|
with TProjectData(TPhaseData(FPhaseData).ProjectData).DealPaymentData do
|
|
|
begin
|
|
@@ -195,7 +222,7 @@ begin
|
|
|
else
|
|
|
Rec.ValueByName(sTPField).AsFloat := 0;
|
|
|
end;
|
|
|
- end;
|
|
|
+ end;}
|
|
|
// 计算截止数据
|
|
|
Rec.ValueByName('End' + sTPField).AsFloat := Rec.ValueByName(sTPField).AsFloat
|
|
|
+ Rec.ValueByName('Pre' + sTPField).AsFloat;
|
|
@@ -361,4 +388,28 @@ begin
|
|
|
Result := sddPhasePay.FindKey('idxID', AID);
|
|
|
end;
|
|
|
|
|
|
+procedure TPhasePayData.RepairPhaseRecord;
|
|
|
+var
|
|
|
+ i: Integer;
|
|
|
+ vDealRec, vPhaseRec: TsdDataRecord;
|
|
|
+begin
|
|
|
+ // 旧设计中,DealPayment中数据多于PhasePay
|
|
|
+ // 在于用户新增了合同支付项,但未输入金额或公式,以减少数据
|
|
|
+ // 现,要求存在合同支付项,设置了计提期限,但未输入金额或公式时,达计提期限时,金额需计
|
|
|
+ // 故在每次计算前,检查一遍合同支付数据,以兼容旧项目,并保证DealPayment与PhasePay数据行相同
|
|
|
+ with TProjectData(TPhaseData(FPhaseData).ProjectData).DealPaymentData do
|
|
|
+ begin
|
|
|
+ if sddDealPayment.RecordCount > sddPhasePay.RecordCount then
|
|
|
+ begin
|
|
|
+ for i := 0 to sddDealPayment.RecordCount - 1 do
|
|
|
+ begin
|
|
|
+ vDealRec := sddDealPayment.Records[i];
|
|
|
+ vPhaseRec := PayRecord(vDealRec.ValueByName('ID').AsInteger);
|
|
|
+ if not Assigned(vPhaseRec) then
|
|
|
+ vPhaseRec := AddPayRecord(vDealRec.ValueByName('ID').AsInteger);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|