|
@@ -49,9 +49,12 @@ type
|
|
|
|
|
|
// 扣款项是否已达起扣金额
|
|
|
function CheckStartedPrice(AID: Integer): Boolean;
|
|
|
+ function CheckReachPlan(ARec: TsdDataRecord): Boolean;
|
|
|
function GetAllowTotalPrice(AID: Integer; ATotalPrice: Double): Double;
|
|
|
procedure UpdateTotalPrice(AID: Integer; ATotalPrice: Double);
|
|
|
|
|
|
+ function PlanStr(ARec: TsdDataRecord): string;
|
|
|
+
|
|
|
function GetStartedPrice(AID: Integer): Double;
|
|
|
|
|
|
procedure CalcStarted_RangePrice;
|
|
@@ -67,6 +70,7 @@ type
|
|
|
property AddTotalPrice: Double read GetAddTotalPrice;
|
|
|
// 实付
|
|
|
property PaidTotalPrice: Double read GetPaidTotalPrice;
|
|
|
+ property PayFormula: TPayFormula read FPayFormula;
|
|
|
end;
|
|
|
|
|
|
implementation
|
|
@@ -110,7 +114,10 @@ begin
|
|
|
Rec := sddDealPayment.FindKey('idxID', AID);
|
|
|
if Rec.ValueByName('RangePrice').AsFloat = 0 then Exit;
|
|
|
fAllowPrice := Rec.ValueByName('RangePrice').AsFloat - Rec.ValueByName('TotalPrice').AsFloat;
|
|
|
- Result := Min(fAllowPrice, ATotalPrice);
|
|
|
+ if not CheckReachPlan(Rec) then
|
|
|
+ Result := Min(fAllowPrice, ATotalPrice)
|
|
|
+ else
|
|
|
+ Result := fAllowPrice;
|
|
|
end;
|
|
|
|
|
|
function TDealPaymentData.GetNewID: Integer;
|
|
@@ -431,6 +438,11 @@ procedure TDealPaymentData.sdvDealPaymentSetText(var Text: string;
|
|
|
begin
|
|
|
Rec.ValueByName('Formula').AsString := '';
|
|
|
AValue.Owner.ValueByName(sFField).AsString := '';
|
|
|
+ fTotalPrice := StrToFloatDef(Text, 0) - AValue.AsFloat;
|
|
|
+ if CheckStartedPrice(AID) then
|
|
|
+ Text := FloatToStr(AValue.AsFloat + GetAllowTotalPrice(AID, fTotalPrice))
|
|
|
+ else
|
|
|
+ Text := '';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
@@ -637,4 +649,38 @@ begin
|
|
|
Result := Rec.ValueByName('StartedPrice').AsFloat;
|
|
|
end;
|
|
|
|
|
|
+function TDealPaymentData.CheckReachPlan(ARec: TsdDataRecord): Boolean;
|
|
|
+var
|
|
|
+ fCurValue, fDeadlineValue: Double;
|
|
|
+begin
|
|
|
+ Result := False;
|
|
|
+ if ARec.ValueByName('PlanType').AsInteger <> 0 then
|
|
|
+ begin
|
|
|
+ if ARec.ValueByName('PlanType').AsInteger = 1 then
|
|
|
+ fCurValue := TProjectData(FProjectData).ProjProperties.PhaseCount
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 0 then
|
|
|
+ fCurValue := TProjectData(FProjectData).BillsData.Settlement[4]
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 1 then
|
|
|
+ fCurValue := TProjectData(FProjectData).BillsData.Settlement[1]
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 2 then
|
|
|
+ fCurValue := TProjectData(FProjectData).BillsData.Settlement[2];
|
|
|
+ fDeadlineValue := ARec.ValueByName('PlanDeadline').AsFloat;
|
|
|
+ Result := fCurValue >= fDeadlineValue;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPaymentData.PlanStr(ARec: TsdDataRecord): string;
|
|
|
+begin
|
|
|
+ if ARec.ValueByName('PlanType').AsInteger = 0 then
|
|
|
+ Result := '无'
|
|
|
+ else if ARec.ValueByName('PlanType').AsInteger = 1 then
|
|
|
+ Result := Format('计量期数 >= %d', [ARec.ValueByName('PlanDeadline').AsInteger])
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 0 then
|
|
|
+ Result := Format('累计完成计量金额 >= %f', [ARec.ValueByName('PlanDeadline').AsFloat])
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 1 then
|
|
|
+ Result := Format('累计合同计量金额 >= %f', [ARec.ValueByName('PlanDeadline').AsFloat])
|
|
|
+ else if ARec.ValueByName('PlanSubType').AsInteger = 2 then
|
|
|
+ Result := Format('累计变更计量金额 >= %f', [ARec.ValueByName('PlanDeadline').AsFloat])
|
|
|
+end;
|
|
|
+
|
|
|
end.
|