|
@@ -190,22 +190,42 @@ type
|
|
|
|
|
|
TDealPayControl = class
|
|
|
private
|
|
|
- FPayNodes: TList;
|
|
|
+ FPlusPayNodes: TList;
|
|
|
+ FMinusPayNodes: TList;
|
|
|
+ FPlusGather: TPayNode;
|
|
|
+ FMinusGather: TPayNode;
|
|
|
FGatherPayNode: TPayNode;
|
|
|
|
|
|
- function FindPayNode(const AName: string; AIsMinus: Boolean): TPayNode;
|
|
|
- function NewPayNode(const AName: string; AIsMinus: Boolean): TPayNode;
|
|
|
+ function FindPlusPayNode(const AName: string): TPayNode;
|
|
|
+ function NewPlusPayNode(const AName: string): TPayNode;
|
|
|
+ function AddPlusPayNode(const AName: string): TPayNode;
|
|
|
|
|
|
- function GetPayCount: Integer;
|
|
|
- function GetPayNode(AIndex: Integer): TPayNode;
|
|
|
+ function FindMinusPayNode(const AName: string): TPayNode;
|
|
|
+ function NewMinusPayNode(const AName: string): TPayNode;
|
|
|
+ function AddMinusPayNode(const AName: string): TPayNode;
|
|
|
+
|
|
|
+ procedure CalculateGather(AGather: TPayNode; ANodes: TList);
|
|
|
+
|
|
|
+ function GetMinusPayCount: Integer;
|
|
|
+ function GetMinusPayNode(AIndex: Integer): TPayNode;
|
|
|
+ function GetPlusPayCount: Integer;
|
|
|
+ function GetPlusPayNode(AIndex: Integer): TPayNode;
|
|
|
public
|
|
|
constructor Create;
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
function AddPayNode(const AName: string; AIsMinus: Boolean): TPayNode;
|
|
|
|
|
|
- property PayCount: Integer read GetPayCount;
|
|
|
- property PayNode[AIndex: Integer]: TPayNode read GetPayNode;
|
|
|
+ procedure CalculateAll;
|
|
|
+
|
|
|
+ property PlusPayCount: Integer read GetPlusPayCount;
|
|
|
+ property PlusPayNode[AIndex: Integer]: TPayNode read GetPlusPayNode;
|
|
|
+ property PlusGather: TPayNode read FPlusGather;
|
|
|
+
|
|
|
+ property MinusPayCount: Integer read GetMinusPayCount;
|
|
|
+ property MinusPayNode[AIndex: Integer]:TPayNode read GetMinusPayNode;
|
|
|
+ property MinusGather: TPayNode read FMinusGather;
|
|
|
+
|
|
|
property GatherPayNode: TPayNode read FGatherPayNode;
|
|
|
end;
|
|
|
|
|
@@ -473,6 +493,7 @@ begin
|
|
|
sEndField := 'EndTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
|
|
|
GatherCommonDealPayData;
|
|
|
GatherPayData;
|
|
|
+ FDealPayControl.CalculateAll;
|
|
|
end;
|
|
|
|
|
|
procedure TrmHaBaiCustomizedData.WriteData;
|
|
@@ -525,6 +546,16 @@ procedure TrmHaBaiCustomizedData.WriteReport2;
|
|
|
cdsCustom2.Post;
|
|
|
end;
|
|
|
|
|
|
+ procedure WriteSpecialRecord;
|
|
|
+ begin
|
|
|
+ cdsCustom2.Append;
|
|
|
+ cdsCustom2Name.AsString := '북 셕';
|
|
|
+ cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice;
|
|
|
+ cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice;
|
|
|
+ cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice;
|
|
|
+ cdsCustom2.Post;
|
|
|
+ end;
|
|
|
+
|
|
|
var
|
|
|
iIndex: Integer;
|
|
|
begin
|
|
@@ -535,9 +566,11 @@ begin
|
|
|
WriteBlankRecord('송목딧憐');
|
|
|
WriteBlankRecord('跨獨랜쏜');
|
|
|
WriteBlankRecord('넨마운적口');
|
|
|
- WriteGclChapter(FGclControl.GclChapterGather, '북 셕');
|
|
|
- for iIndex := 0 to FDealPayControl.PayCount - 1 do
|
|
|
- WritePayNode(FDealPayControl.PayNode[iIndex]);
|
|
|
+ for iIndex := 0 to FDealPayControl.PlusPayCount - 1 do
|
|
|
+ WritePayNode(FDealPayControl.PlusPayNode[iIndex]);
|
|
|
+ WriteSpecialRecord;
|
|
|
+ for iIndex := 0 to FDealPayControl.MinusPayCount - 1 do
|
|
|
+ WritePayNode(FDealPayControl.MinusPayNode[iIndex]);
|
|
|
WritePayNode(FDealPayControl.GatherPayNode, '連 마');
|
|
|
end;
|
|
|
|
|
@@ -834,8 +867,8 @@ var
|
|
|
begin
|
|
|
FTotalPrice := FPrice * FQuantity;
|
|
|
FCurGatherTotalPrice := FPrice * FCurGatherQuantity;
|
|
|
- FEndGatherTotalPrice := FPrice * FEndGatherTotalPrice;
|
|
|
- FPreGatherTotalPrice := FPrice * FPreGatherTotalPrice;
|
|
|
+ FEndGatherTotalPrice := FPrice * FEndGatherQuantity;
|
|
|
+ FPreGatherTotalPrice := FPrice * FPreGatherQuantity;
|
|
|
for i := 0 to FProjectCount - 1 do
|
|
|
begin
|
|
|
FP_TotalPrice[i] := FPrice * FP_Quantity[i];
|
|
@@ -1182,39 +1215,83 @@ end;
|
|
|
|
|
|
{ TDealPayControl }
|
|
|
|
|
|
+function TDealPayControl.AddMinusPayNode(const AName: string): TPayNode;
|
|
|
+begin
|
|
|
+ Result := FindMinusPayNode(AName);
|
|
|
+ if not Assigned(Result) then
|
|
|
+ Result := NewMinusPayNode(AName);
|
|
|
+end;
|
|
|
+
|
|
|
function TDealPayControl.AddPayNode(const AName: string;
|
|
|
AIsMinus: Boolean): TPayNode;
|
|
|
begin
|
|
|
- Result := FindPayNode(AName, AIsMinus);
|
|
|
+ if AIsMinus then
|
|
|
+ Result := AddMinusPayNode(AName)
|
|
|
+ else
|
|
|
+ Result := AddPlusPayNode(AName);
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPayControl.AddPlusPayNode(const AName: string): TPayNode;
|
|
|
+begin
|
|
|
+ Result := FindPlusPayNode(AName);
|
|
|
if not Assigned(Result) then
|
|
|
- Result := NewPayNode(AName, AIsMinus);
|
|
|
+ Result := NewPlusPayNode(AName);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TDealPayControl.CalculateAll;
|
|
|
+begin
|
|
|
+ CalculateGather(FPlusGather, FPlusPayNodes);
|
|
|
+ CalculateGather(FMinusGather, FMinusPayNodes);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TDealPayControl.CalculateGather(AGather: TPayNode; ANodes: TList);
|
|
|
+var
|
|
|
+ i: Integer;
|
|
|
+ vPayNode: TPayNode;
|
|
|
+begin
|
|
|
+ AGather.CurTotalPrice := 0;
|
|
|
+ AGather.EndTotalPrice := 0;
|
|
|
+ AGather.PreTotalPrice := 0;
|
|
|
+ for i := 0 to ANodes.Count - 1 do
|
|
|
+ begin
|
|
|
+ vPayNode := TPayNode(ANodes.Items[i]);
|
|
|
+ AGather.CurTotalPrice := AGather.CurTotalPrice + vPayNode.CurTotalPrice;
|
|
|
+ AGather.EndTotalPrice := AGather.EndTotalPrice + vPayNode.EndTotalPrice;
|
|
|
+ AGather.PreTotalPrice := AGather.PreTotalPrice + vPayNode.PreTotalPrice;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
constructor TDealPayControl.Create;
|
|
|
begin
|
|
|
- FPayNodes := TList.Create;
|
|
|
+ FPlusPayNodes := TList.Create;
|
|
|
+ FMinusPayNodes := TList.Create;
|
|
|
+ FPlusGather := TPayNode.Create;
|
|
|
+ FMinusGather := TPayNode.Create;
|
|
|
FGatherPayNode := TPayNode.Create;
|
|
|
end;
|
|
|
|
|
|
destructor TDealPayControl.Destroy;
|
|
|
begin
|
|
|
FGatherPayNode.Free;
|
|
|
- ClearObjects(FPayNodes);
|
|
|
- FPayNodes.Free;
|
|
|
+ FMinusGather.Free;
|
|
|
+ FPlusGather.Free;
|
|
|
+ ClearObjects(FMinusPayNodes);
|
|
|
+ FMinusPayNodes.Free;
|
|
|
+ ClearObjects(FPlusPayNodes);
|
|
|
+ FPlusPayNodes.Free;
|
|
|
inherited;
|
|
|
end;
|
|
|
|
|
|
-function TDealPayControl.FindPayNode(const AName: string;
|
|
|
- AIsMinus: Boolean): TPayNode;
|
|
|
+function TDealPayControl.FindMinusPayNode(const AName: string): TPayNode;
|
|
|
var
|
|
|
iIndex: Integer;
|
|
|
vPayNode: TPayNode;
|
|
|
begin
|
|
|
Result := nil;
|
|
|
- for iIndex := 0 to FPayNodes.Count -1 do
|
|
|
+ for iIndex := 0 to FMinusPayNodes.Count -1 do
|
|
|
begin
|
|
|
- vPayNode := TPayNode(FPayNodes.Items[iIndex]);
|
|
|
- if (vPayNode.Name = AName) and (vPayNode.IsMinus = AIsMinus) then
|
|
|
+ vPayNode := TPayNode(FMinusPayNodes.Items[iIndex]);
|
|
|
+ if (vPayNode.Name = AName) then
|
|
|
begin
|
|
|
Result := vPayNode;
|
|
|
Break;
|
|
@@ -1222,23 +1299,57 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-function TDealPayControl.GetPayCount: Integer;
|
|
|
+function TDealPayControl.FindPlusPayNode(const AName: string): TPayNode;
|
|
|
+var
|
|
|
+ iIndex: Integer;
|
|
|
+ vPayNode: TPayNode;
|
|
|
begin
|
|
|
- Result := FPayNodes.Count;
|
|
|
+ Result := nil;
|
|
|
+ for iIndex := 0 to FPlusPayNodes.Count -1 do
|
|
|
+ begin
|
|
|
+ vPayNode := TPayNode(FPlusPayNodes.Items[iIndex]);
|
|
|
+ if (vPayNode.Name = AName) then
|
|
|
+ begin
|
|
|
+ Result := vPayNode;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
-function TDealPayControl.GetPayNode(AIndex: Integer): TPayNode;
|
|
|
+function TDealPayControl.GetMinusPayCount: Integer;
|
|
|
begin
|
|
|
- Result := TPayNode(FPayNodes.Items[AIndex]);
|
|
|
+ Result := FMinusPayNodes.Count;
|
|
|
end;
|
|
|
|
|
|
-function TDealPayControl.NewPayNode(const AName: string;
|
|
|
- AIsMinus: Boolean): TPayNode;
|
|
|
+function TDealPayControl.GetMinusPayNode(AIndex: Integer): TPayNode;
|
|
|
+begin
|
|
|
+ Result := TPayNode(FMinusPayNodes.Items[AIndex]);
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPayControl.GetPlusPayCount: Integer;
|
|
|
+begin
|
|
|
+ Result := FPlusPayNodes.Count;
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPayControl.GetPlusPayNode(AIndex: Integer): TPayNode;
|
|
|
+begin
|
|
|
+ Result := TPayNode(FPlusPayNodes.Items[AIndex]);
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPayControl.NewMinusPayNode(const AName: string): TPayNode;
|
|
|
+begin
|
|
|
+ Result := TPayNode.Create;
|
|
|
+ FMinusPayNodes.Add(Result);
|
|
|
+ Result.Name := AName;
|
|
|
+ Result.IsMinus := True;
|
|
|
+end;
|
|
|
+
|
|
|
+function TDealPayControl.NewPlusPayNode(const AName: string): TPayNode;
|
|
|
begin
|
|
|
Result := TPayNode.Create;
|
|
|
- FPayNodes.Add(Result);
|
|
|
+ FPlusPayNodes.Add(Result);
|
|
|
Result.Name := AName;
|
|
|
- Result.IsMinus := AIsMinus;
|
|
|
+ Result.IsMinus := False;
|
|
|
end;
|
|
|
|
|
|
end.
|