|
@@ -158,7 +158,8 @@ type
|
|
|
constructor Create(AProjectCount: Integer; AIsHaBai: Boolean);
|
|
|
destructor Destroy;
|
|
|
|
|
|
- function AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode;
|
|
|
+ function AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode; overload;
|
|
|
+ function AddGclNode(ARec: TBillsRecord; AStageRec: TStageRecord; AProjectIndex: Integer): TGclNode; overload;
|
|
|
|
|
|
procedure ReCalculateTotalPrice;
|
|
|
procedure Calculate;
|
|
@@ -321,6 +322,7 @@ type
|
|
|
FGclControl: TGclControl;
|
|
|
FDealPayControl: TDealPayControl;
|
|
|
FDealTotalPrice: Double;
|
|
|
+ FIsNewOpen: Boolean;
|
|
|
|
|
|
procedure BeforeGather(AProjectCount: Integer; AIsHaBai: Boolean);
|
|
|
procedure AfterGather;
|
|
@@ -352,7 +354,7 @@ implementation
|
|
|
|
|
|
uses
|
|
|
UtilMethods, ZhAPI, BillsCompileDm, sdDB, Globals, Math, BillsMeasureDm,
|
|
|
- ZJJLDm, BillsDm;
|
|
|
+ ZJJLDm, BillsDm, ScUtils, Windows, PhaseData, sdIDTree, StageDm;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
@@ -438,12 +440,14 @@ procedure TrmHaBaiCustomizedData.OpenProjectData(AProject: TSelectProject);
|
|
|
var
|
|
|
Rec: TsdDataRecord;
|
|
|
begin
|
|
|
+ FIsNewOpen := False;
|
|
|
FProjectData := OpenProjectManager.FindProjectData(AProject.ProjectID);
|
|
|
Rec := ProjectManager.sddProjectsInfo.FindKey('idxID', AProject.ProjectID);
|
|
|
if not Assigned(FProjectData) then
|
|
|
begin
|
|
|
FProjectData := TProjectData.Create;
|
|
|
- FProjectData.OpenForReport3(GetMyProjectsFilePath + Rec.ValueByName('FileName').AsString);
|
|
|
+ FProjectData.OpenForReport4(GetMyProjectsFilePath + Rec.ValueByName('FileName').AsString);
|
|
|
+ FIsNewOpen := True;
|
|
|
end;
|
|
|
FProjectName := Rec.ValueByName('Name').AsString;
|
|
|
end;
|
|
@@ -468,20 +472,83 @@ begin
|
|
|
end;
|
|
|
|
|
|
procedure TrmHaBaiCustomizedData.FilterGcl(AProjectIndex: Integer);
|
|
|
-var
|
|
|
- i: Integer;
|
|
|
- vNode: TMeasureBillsIDTreeNode;
|
|
|
- GclNode: TGclNode;
|
|
|
-begin
|
|
|
- with FProjectData.BillsMeasureData do
|
|
|
+
|
|
|
+ function FindStage(AID: Integer; AList: TList): TStageRecord;
|
|
|
+ var
|
|
|
+ i: Integer;
|
|
|
+ Rec: TStageRecord;
|
|
|
begin
|
|
|
- for i := 0 to BillsMeasureTree.Count - 1 do
|
|
|
+ Result := nil;
|
|
|
+ for i := 0 to AList.Count - 1 do
|
|
|
begin
|
|
|
- vNode := TMeasureBillsIDTreeNode(BillsMeasureTree.Items[i]);
|
|
|
- if not vNode.HasChildren and (vNode.Rec.B_Code.AsString <> '') then
|
|
|
- GclNode := FGclControl.AddGclNode(vNode, AProjectIndex);
|
|
|
+ Rec := TStageRecord(AList.Items[i]);
|
|
|
+ if Rec.BillsID.AsInteger = AID then
|
|
|
+ begin
|
|
|
+ Result := Rec;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
+
|
|
|
+ procedure FilterNewOpened;
|
|
|
+ var
|
|
|
+ vList: TList;
|
|
|
+ i: Integer;
|
|
|
+ GclNode: TGclNode;
|
|
|
+ Rec: TBillsRecord;
|
|
|
+ StageRec: TStageRecord;
|
|
|
+ begin
|
|
|
+ vList := TList.Create;
|
|
|
+ try
|
|
|
+ with FProjectData.PhaseData.StageData do
|
|
|
+ begin
|
|
|
+ for i := 0 to sddStage.RecordCount - 1 do
|
|
|
+ vList.Add(sddStage.Records[i]);
|
|
|
+ end;
|
|
|
+
|
|
|
+ FProjectData.BillsData.sddBills.DisableControls;
|
|
|
+ FProjectData.PhaseData.StageData.sddStage.DisableControls;
|
|
|
+ with FProjectData.BillsData do
|
|
|
+ begin
|
|
|
+ for i := 0 to sddBills.RecordCount - 1 do
|
|
|
+ begin
|
|
|
+ Rec := TBillsRecord(sddBills.Records[i]);
|
|
|
+ if Rec.IsLeaf.AsBoolean and (Rec.B_Code.AsString <> '') then
|
|
|
+ begin
|
|
|
+ StageRec := FindStage(Rec.ID.AsInteger, vList);
|
|
|
+ GclNode := FGclControl.AddGclNode(Rec, StageRec, AProjectIndex);
|
|
|
+ vList.Remove(StageRec);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ finally
|
|
|
+ vList.Free;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure FilterOrg;
|
|
|
+ var
|
|
|
+ i: Integer;
|
|
|
+ vNode: TMeasureBillsIDTreeNode;
|
|
|
+ GclNode: TGclNode;
|
|
|
+ StageRec: TStageRecord;
|
|
|
+ begin
|
|
|
+ with FProjectData.BillsMeasureData do
|
|
|
+ begin
|
|
|
+ for i := 0 to BillsMeasureTree.Count - 1 do
|
|
|
+ begin
|
|
|
+ vNode := TMeasureBillsIDTreeNode(BillsMeasureTree.Items[i]);
|
|
|
+ if not vNode.HasChildren and (vNode.Rec.B_Code.AsString <> '') then
|
|
|
+ GclNode := FGclControl.AddGclNode(vNode, AProjectIndex);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+begin
|
|
|
+ if FIsNewOpen then
|
|
|
+ FilterNewOpened
|
|
|
+ else
|
|
|
+ FilterOrg;
|
|
|
end;
|
|
|
|
|
|
procedure TrmHaBaiCustomizedData.FilterDealPay;
|
|
@@ -1292,6 +1359,39 @@ begin
|
|
|
TGclNode(FGclNodes[iGcl]).Calculate;
|
|
|
end;
|
|
|
|
|
|
+function TGclControl.AddGclNode(ARec: TBillsRecord; AStageRec: TStageRecord;
|
|
|
+ AProjectIndex: Integer): TGclNode;
|
|
|
+begin
|
|
|
+ Result := FindGclNode(ARec);
|
|
|
+ if not Assigned(Result) then
|
|
|
+ Result := NewGclNode(ARec);
|
|
|
+ with ARec do
|
|
|
+ begin
|
|
|
+ Result.Quantity := Result.Quantity + Quantity.AsFloat;
|
|
|
+ Result.TotalPrice := Result.TotalPrice + TotalPrice.AsFloat;
|
|
|
+
|
|
|
+ Result.P_Quantity[AProjectIndex] := Result.P_Quantity[AProjectIndex] + Quantity.AsFloat;
|
|
|
+ Result.P_TotalPrice[AProjectIndex] := Result.P_TotalPrice[AProjectIndex] + TotalPrice.AsFloat;
|
|
|
+ end;
|
|
|
+
|
|
|
+ if Assigned(AStageRec) then
|
|
|
+ with AStageRec do
|
|
|
+ begin
|
|
|
+ Result.CurGatherQuantity := Result.CurGatherQuantity + GatherQuantity.AsFloat;
|
|
|
+ Result.CurGatherTotalPrice := Result.CurGatherTotalPrice + GatherTotalPrice.AsFloat;
|
|
|
+ Result.P_CurGatherQuantity[AProjectIndex] := Result.P_CurGatherQuantity[AProjectIndex] + GatherQuantity.AsFloat;
|
|
|
+ Result.P_CurGatherTotalPrice[AProjectIndex] := Result.P_CurGatherTotalPrice[AProjectIndex] + GatherTotalPrice.AsFloat;
|
|
|
+
|
|
|
+ Result.EndGatherQuantity := Result.EndGatherQuantity + EndGatherQuantity.AsFloat;
|
|
|
+ Result.EndGatherTotalPrice := Result.EndGatherTotalPrice + EndGatherTotalPrice.AsFloat;
|
|
|
+ Result.P_EndGatherQuantity[AProjectIndex] := Result.P_EndGatherQuantity[AProjectIndex] + EndGatherQuantity.AsFloat;
|
|
|
+ Result.P_EndGatherTotalPrice[AProjectIndex] := Result.P_EndGatherTotalPrice[AProjectIndex] + EndGatherTotalPrice.AsFloat;
|
|
|
+
|
|
|
+ Result.PreGatherQuantity := Result.PreGatherQuantity + PreGatherQuantity.AsFloat;
|
|
|
+ Result.PreGatherTotalPrice := Result.PreGatherTotalPrice + PreGatherTotalPrice.AsFloat;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
{ TGclChapter }
|
|
|
|
|
|
procedure TGclChapter.AddGclNode(AGclNode: TGclNode);
|