|
@@ -195,6 +195,7 @@ type
|
|
|
FPlusGather: TPayNode;
|
|
|
FMinusGather: TPayNode;
|
|
|
FGatherPayNode: TPayNode;
|
|
|
+ FCompletePayNode: TPayNode;
|
|
|
|
|
|
function FindPlusPayNode(const AName: string): TPayNode;
|
|
|
function NewPlusPayNode(const AName: string): TPayNode;
|
|
@@ -227,10 +228,12 @@ type
|
|
|
property MinusGather: TPayNode read FMinusGather;
|
|
|
|
|
|
property GatherPayNode: TPayNode read FGatherPayNode;
|
|
|
+ property CompletePayNode: TPayNode read FCompletePayNode;
|
|
|
end;
|
|
|
|
|
|
// 分别对应5张定制汇总表的编号,详见文档
|
|
|
- THaBaiGatherType = (hbgt2, hbgt3, hbgt14, hbgt3_1, hbgt4_1);
|
|
|
+ THaBaiGatherType = (hbgt2, hbgt3, hbgt14, hbgt3_1, hbgt4_1, hbgt_CS);
|
|
|
+ // CS: Counter Sign 会签
|
|
|
|
|
|
TrmHaBaiCustomizedData = class(TDataModule)
|
|
|
cdsCustom2: TClientDataSet;
|
|
@@ -295,12 +298,27 @@ type
|
|
|
cdsCustomProjCurPercent: TFloatField;
|
|
|
cdsCustomProjEndPercent: TFloatField;
|
|
|
cdsCustomProjSerialNo: TIntegerField;
|
|
|
+
|
|
|
+ // 会签表
|
|
|
+ // 流水
|
|
|
+ cdsCustomCS_1: TClientDataSet;
|
|
|
+ cdsCustomCS_1PulsPayName: TWideStringField;
|
|
|
+ cdsCustomCS_1PulsPayTotalPrice: TFloatField;
|
|
|
+ cdsCustomCS_1MinusPayName: TWideStringField;
|
|
|
+ cdsCustomCS_1MinusPayTotalPrice: TFloatField;
|
|
|
+ // 账单
|
|
|
+ cdsCustomCS_2: TClientDataSet;
|
|
|
+ cdsCustomCS_2DealTotalPrice: TFloatField;
|
|
|
+ cdsCustomCS_2EndCompleteTotalPrice: TFloatField;
|
|
|
+ cdsCustomCS_2PreCompleteTotalPrice: TFloatField;
|
|
|
+ cdsCustomCS_2CurPayTotalPrice: TFloatField;
|
|
|
private
|
|
|
FhbGatherType: THaBaiGatherType;
|
|
|
FProjectData: TProjectData;
|
|
|
FProjectName: string;
|
|
|
FGclControl: TGclControl;
|
|
|
FDealPayControl: TDealPayControl;
|
|
|
+ FDealTotalPrice: Double;
|
|
|
|
|
|
procedure BeforeGather(AProjectCount: Integer);
|
|
|
procedure AfterGather;
|
|
@@ -318,24 +336,28 @@ type
|
|
|
procedure WriteReport3;
|
|
|
procedure WriteReport3_1;
|
|
|
procedure WriteReport4_1;
|
|
|
+ procedure WriteReportCounterSign;
|
|
|
|
|
|
procedure WriteData;
|
|
|
public
|
|
|
- function AssignData(AProjects: TList; AhbGatherType: THaBaiGatherType): TDataSet;
|
|
|
+ function AssignData(AProjects: TList; AhbGatherType: THaBaiGatherType; AReCalc: Boolean): TDataSet;
|
|
|
+ function AssignAssistantData(AhbGatherType: THaBaiGatherType): TDataSet;
|
|
|
+
|
|
|
+ property hbGatherType: THaBaiGatherType read FhbGatherType;
|
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
|
UtilMethods, ZhAPI, BillsCompileDm, sdDB, Globals, Math, BillsMeasureDm,
|
|
|
- ZJJLDm;
|
|
|
+ ZJJLDm, BillsDm;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
{ TrmHaBaiCustomizedData }
|
|
|
|
|
|
function TrmHaBaiCustomizedData.AssignData(AProjects: TList;
|
|
|
- AhbGatherType: THaBaiGatherType): TDataSet;
|
|
|
+ AhbGatherType: THaBaiGatherType; AReCalc: Boolean): TDataSet;
|
|
|
var
|
|
|
iProject: Integer;
|
|
|
begin
|
|
@@ -344,7 +366,8 @@ begin
|
|
|
try
|
|
|
for iProject := 0 to AProjects.Count - 1 do
|
|
|
GatherProject(TSelectProject(AProjects.Items[iProject]), iProject);
|
|
|
- FGclControl.ReCalculateTotalPrice;
|
|
|
+ if AReCalc then
|
|
|
+ FGclControl.ReCalculateTotalPrice;
|
|
|
FGclControl.Calculate;
|
|
|
WriteData;
|
|
|
finally
|
|
@@ -354,6 +377,7 @@ begin
|
|
|
hbgt3: Result := cdsCustom3;
|
|
|
hbgt14: Result := cdsCustom14;
|
|
|
hbgt3_1, hbgt4_1: Result := cdsCustomProj;
|
|
|
+ hbgt_CS: Result := cdsCustomCS_1;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
@@ -376,8 +400,17 @@ begin
|
|
|
cdsCustomProj.Active := True;
|
|
|
cdsCustomProj.EmptyDataSet;
|
|
|
|
|
|
+ cdsCustomCS_1.DisableControls;
|
|
|
+ cdsCustomCS_1.Active := True;
|
|
|
+ cdsCustomCS_1.EmptyDataSet;
|
|
|
+
|
|
|
+ cdsCustomCS_2.DisableControls;
|
|
|
+ cdsCustomCS_2.Active := True;
|
|
|
+ cdsCustomCS_2.EmptyDataSet;
|
|
|
+
|
|
|
FGclControl := TGclControl.Create(AProjectCount);
|
|
|
FDealPayControl := TDealPayControl.Create;
|
|
|
+ FDealTotalPrice := 0;
|
|
|
end;
|
|
|
|
|
|
procedure TrmHaBaiCustomizedData.AfterGather;
|
|
@@ -385,6 +418,8 @@ begin
|
|
|
FDealPayControl.Free;
|
|
|
FGclControl.Free;
|
|
|
|
|
|
+ cdsCustomCS_2.EnableControls;
|
|
|
+ cdsCustomCS_1.EnableControls;
|
|
|
cdsCustomProj.EnableControls;
|
|
|
cdsCustom14.EnableControls;
|
|
|
cdsCustom3.EnableControls;
|
|
@@ -419,10 +454,12 @@ begin
|
|
|
FGclControl.ProjectName[AProjectIndex] := FProjectName;
|
|
|
if FhbGatherType in [hbgt2, hbgt3, hbgt3_1, hbgt4_1] then
|
|
|
FilterGcl(AProjectIndex);
|
|
|
- if FhbGatherType = hbgt2 then
|
|
|
+ if FhbGatherType in [hbgt2, hbgt_CS] then
|
|
|
FilterDealPay;
|
|
|
if FhbGatherType = hbgt14 then
|
|
|
WriteFlowData;
|
|
|
+ if FhbGatherType = hbgt_CS then
|
|
|
+ FDealTotalPrice := FDealTotalPrice + FProjectData.BillsData.Settlement[0];
|
|
|
finally
|
|
|
FreeProjectData;
|
|
|
end;
|
|
@@ -466,19 +503,40 @@ var
|
|
|
Continue;
|
|
|
StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
|
|
|
DealPay := FDealPayControl.AddPayNode(Rec.ValueByName('Name').AsString, Rec.ValueByName('IsMinus').AsBoolean);
|
|
|
- DealPay.CurTotalPrice := DealPay.CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
|
|
|
- DealPay.PreTotalPrice := DealPay.PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
|
|
|
- DealPay.EndTotalPrice := DealPay.EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
|
|
|
+ if Assigned(StageRec) then
|
|
|
+ begin
|
|
|
+ DealPay.CurTotalPrice := DealPay.CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
|
|
|
+ DealPay.PreTotalPrice := DealPay.PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
|
|
|
+ DealPay.EndTotalPrice := DealPay.EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+ procedure GatherCompletePayData;
|
|
|
+ var
|
|
|
+ Rec, StageRec: TsdDataRecord;
|
|
|
+ begin
|
|
|
+ Rec := FProjectData.DealPaymentData.DealPayRecord('本期完成计量');
|
|
|
+ StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
|
|
|
+ if not Assigned(StageRec) then Exit;
|
|
|
+
|
|
|
+ with FDealPayControl.CompletePayNode do
|
|
|
+ begin
|
|
|
+ CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
|
|
|
+ PreTotalPrice := PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
|
|
|
+ EndTotalPrice := EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
procedure GatherPayData;
|
|
|
var
|
|
|
Rec, StageRec: TsdDataRecord;
|
|
|
begin
|
|
|
Rec := FProjectData.DealPaymentData.DealPayRecord('本期应付');
|
|
|
StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
|
|
|
+ if not Assigned(StageRec) then Exit;
|
|
|
+
|
|
|
with FDealPayControl.GatherPayNode do
|
|
|
begin
|
|
|
CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
|
|
@@ -492,6 +550,7 @@ begin
|
|
|
sPreField := 'PreTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
|
|
|
sEndField := 'EndTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
|
|
|
GatherCommonDealPayData;
|
|
|
+ GatherCompletePayData;
|
|
|
GatherPayData;
|
|
|
FDealPayControl.CalculateAll;
|
|
|
end;
|
|
@@ -503,6 +562,7 @@ begin
|
|
|
hbgt3: WriteReport3;
|
|
|
hbgt3_1: WriteReport3_1;
|
|
|
hbgt4_1: WriteReport4_1;
|
|
|
+ hbgt_CS: WriteReportCounterSign;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -859,6 +919,69 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+function TrmHaBaiCustomizedData.AssignAssistantData(
|
|
|
+ AhbGatherType: THaBaiGatherType): TDataSet;
|
|
|
+begin
|
|
|
+ Result := nil;
|
|
|
+ if (AhbGatherType = hbgt_CS) and (FhbGatherType = hbgt_CS) then
|
|
|
+ Result := cdsCustomCS_2;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TrmHaBaiCustomizedData.WriteReportCounterSign;
|
|
|
+
|
|
|
+ procedure WriteCounterSign1;
|
|
|
+ var
|
|
|
+ i: Integer;
|
|
|
+ PayNode: TPayNode;
|
|
|
+ begin
|
|
|
+ cdsCustomCS_1.Append;
|
|
|
+ cdsCustomCS_1PulsPayName.AsString := '本期完成金额';
|
|
|
+ cdsCustomCS_1PulsPayTotalPrice.AsFloat := FDealPayControl.CompletePayNode.CurTotalPrice;
|
|
|
+ cdsCustomCS_1.Post;
|
|
|
+
|
|
|
+ for i := 0 to FDealPayControl.PlusPayCount - 1 do
|
|
|
+ begin
|
|
|
+ PayNode := FDealPayControl.PlusPayNode[i];
|
|
|
+ cdsCustomCS_1.Append;
|
|
|
+ cdsCustomCS_1PulsPayName.AsString := PayNode.Name;
|
|
|
+ cdsCustomCS_1PulsPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
|
|
|
+ cdsCustomCS_1.Post;
|
|
|
+ end;
|
|
|
+
|
|
|
+ cdsCustomCS_1.Append;
|
|
|
+ cdsCustomCS_1PulsPayName.AsString := '迟付款利息';
|
|
|
+ cdsCustomCS_1.Post;
|
|
|
+
|
|
|
+ cdsCustomCS_1.First;
|
|
|
+ for i := 0 to FDealPayControl.MinusPayCount - 1 do
|
|
|
+ begin
|
|
|
+ PayNode := FDealPayControl.MinusPayNode[i];
|
|
|
+ if cdsCustomCS_1.Eof then
|
|
|
+ cdsCustomCS_1.Append
|
|
|
+ else
|
|
|
+ cdsCustomCS_1.Edit;
|
|
|
+ cdsCustomCS_1MinusPayName.AsString := PayNode.Name;
|
|
|
+ cdsCustomCS_1MinusPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
|
|
|
+ cdsCustomCS_1.Post;
|
|
|
+ cdsCustomCS_1.Next;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure WriteCounterSign2;
|
|
|
+ begin
|
|
|
+ cdsCustomCS_2.Append;
|
|
|
+ cdsCustomCS_2DealTotalPrice.AsFloat := FDealTotalPrice;
|
|
|
+ cdsCustomCS_2EndCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.EndTotalPrice;
|
|
|
+ cdsCustomCS_2PreCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.PreTotalPrice;
|
|
|
+ cdsCustomCS_2CurPayTotalPrice.AsFloat := FDealPayControl.GatherPayNode.CurTotalPrice;
|
|
|
+ cdsCustomCS_2.Post;
|
|
|
+ end;
|
|
|
+
|
|
|
+begin
|
|
|
+ WriteCounterSign1;
|
|
|
+ WriteCounterSign2;
|
|
|
+end;
|
|
|
+
|
|
|
{ TGclNode }
|
|
|
|
|
|
procedure TGclNode.Calculate;
|
|
@@ -1268,10 +1391,14 @@ begin
|
|
|
FPlusGather := TPayNode.Create;
|
|
|
FMinusGather := TPayNode.Create;
|
|
|
FGatherPayNode := TPayNode.Create;
|
|
|
+ FGatherPayNode.Name := '本期应付';
|
|
|
+ FCompletePayNode :=TPayNode.Create;
|
|
|
+ FCompletePayNode.Name := '本期完成计量';
|
|
|
end;
|
|
|
|
|
|
destructor TDealPayControl.Destroy;
|
|
|
begin
|
|
|
+ FCompletePayNode.Free;
|
|
|
FGatherPayNode.Free;
|
|
|
FMinusGather.Free;
|
|
|
FPlusGather.Free;
|