MaiXinRong 9 роки тому
батько
коміт
364535d00c

+ 73 - 2
DataModules/ReportMemoryDm/rmHaBaiCustomizedDm.dfm

@@ -2,8 +2,8 @@ object rmHaBaiCustomizedData: TrmHaBaiCustomizedData
   OldCreateOrder = False
   Left = 723
   Top = 455
-  Height = 154
-  Width = 339
+  Height = 222
+  Width = 337
   object cdsCustom2: TClientDataSet
     Active = True
     Aggregates = <>
@@ -358,4 +358,75 @@ object rmHaBaiCustomizedData: TrmHaBaiCustomizedData
       FieldName = 'SerialNo'
     end
   end
+  object cdsCustomCS_1: TClientDataSet
+    Active = True
+    Aggregates = <>
+    Params = <>
+    Left = 32
+    Top = 120
+    Data = {
+      900000009619E0BD01000000180000000400000000000300000090000B50756C
+      735061794E616D6502004A00000001000557494454480200020090011150756C
+      73506179546F74616C507269636508000400000000000C4D696E75735061794E
+      616D6502004A0000000100055749445448020002009001124D696E7573506179
+      546F74616C507269636508000400000000000000}
+    object cdsCustomCS_1PulsPayName: TWideStringField
+      FieldName = 'PulsPayName'
+      Size = 200
+    end
+    object cdsCustomCS_1PulsPayTotalPrice: TFloatField
+      FieldName = 'PulsPayTotalPrice'
+    end
+    object cdsCustomCS_1MinusPayName: TWideStringField
+      FieldName = 'MinusPayName'
+      Size = 200
+    end
+    object cdsCustomCS_1MinusPayTotalPrice: TFloatField
+      FieldName = 'MinusPayTotalPrice'
+    end
+  end
+  object cdsCustomCS_2: TClientDataSet
+    Active = True
+    Aggregates = <>
+    FieldDefs = <
+      item
+        Name = 'DealTotalPrice'
+        DataType = ftFloat
+      end
+      item
+        Name = 'EndCompleteTotalPrice'
+        DataType = ftFloat
+      end
+      item
+        Name = 'PreCompleteTotalPrice'
+        DataType = ftFloat
+      end
+      item
+        Name = 'CurPayTotalPrice'
+        DataType = ftFloat
+      end>
+    IndexDefs = <>
+    Params = <>
+    StoreDefs = True
+    Left = 120
+    Top = 120
+    Data = {
+      860000009619E0BD01000000180000000400000000000300000086000E446561
+      6C546F74616C5072696365080004000000000015456E64436F6D706C65746554
+      6F74616C5072696365080004000000000015507265436F6D706C657465546F74
+      616C5072696365080004000000000010437572506179546F74616C5072696365
+      08000400000000000000}
+    object cdsCustomCS_2DealTotalPrice: TFloatField
+      FieldName = 'DealTotalPrice'
+    end
+    object cdsCustomCS_2EndCompleteTotalPrice: TFloatField
+      FieldName = 'EndCompleteTotalPrice'
+    end
+    object cdsCustomCS_2PreCompleteTotalPrice: TFloatField
+      FieldName = 'PreCompleteTotalPrice'
+    end
+    object cdsCustomCS_2CurPayTotalPrice: TFloatField
+      FieldName = 'CurPayTotalPrice'
+    end
+  end
 end

+ 132 - 6
DataModules/ReportMemoryDm/rmHaBaiCustomizedDm.pas

@@ -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,17 +336,21 @@ type
     procedure WriteReport3;
     procedure WriteReport3_1;
     procedure WriteReport4_1;
+    procedure WriteReportCounterSign;
 
     procedure WriteData;
   public
     function AssignData(AProjects: TList; AhbGatherType: THaBaiGatherType): 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}
 
@@ -354,6 +376,7 @@ begin
       hbgt3: Result := cdsCustom3;
       hbgt14: Result := cdsCustom14;
       hbgt3_1, hbgt4_1: Result := cdsCustomProj;
+      hbgt_CS: Result := cdsCustomCS_1;
     end;
   end;
 end;
@@ -376,8 +399,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 +417,8 @@ begin
   FDealPayControl.Free;
   FGclControl.Free;
 
+  cdsCustomCS_2.EnableControls;
+  cdsCustomCS_1.EnableControls;
   cdsCustomProj.EnableControls;
   cdsCustom14.EnableControls;
   cdsCustom3.EnableControls;
@@ -419,10 +453,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 +502,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 +549,7 @@ begin
   sPreField := 'PreTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
   sEndField := 'EndTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
   GatherCommonDealPayData;
+  GatherCompletePayData;
   GatherPayData;
   FDealPayControl.CalculateAll;
 end;
@@ -503,6 +561,7 @@ begin
     hbgt3: WriteReport3;
     hbgt3_1: WriteReport3_1;
     hbgt4_1: WriteReport4_1;
+    hbgt_CS: WriteReportCounterSign;
   end;
 end;
 
@@ -859,6 +918,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 +1390,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;

+ 8 - 3
Units/ReportManager.pas

@@ -668,7 +668,10 @@ end;
 function TMemoryReportManager.GetMemoryDataSet(
   ADataSetID: Integer; AProjectData: TProjectData): TDataSet;
 begin
-  //ADataSetID := 49;
+  {if FrmHaBaiCustomizedData.hbGatherType = hbgt_CS then
+    ADataSetID := 51
+  else
+    ADataSetID := 50;}
   case ADataSetID of
     1: Result := FrmGridHeaderData.AssginData(AProjectData);   // 몹깊깊庫
     2: Result := FrmGclBillsBGData.AssignData(AProjectData, rmtPhaseGather, rmgtGather); // 묏넋좆헌데[굶퍅供냥]
@@ -685,8 +688,8 @@ begin
        // 02/03꼬겻, 07꼬겻, 08꼬겻, 09꼬겻, 11꼬겻, 12꼬겻, 16꼬겻, 17꼬겻, 18꼬겻, 19꼬겻,
        32, 33, 35, 36, 39, 40, 44,
        // 讀엑9, 讀엑06-1, 讀엑04, 讀엑01, 묏넋좆헌데쏵똑[맵據멕밗애땍齡], [밤땜凉헤땍齡]셕좆삠悧깊
-       45, 46, 47, 48, 49:
-       // 코촁뮴벗겜땍齡깊(連깊2, 連깊3, 連깊14, 連깊3-1, 連깊4-1)
+       45, 46, 47, 48, 49, 50:
+       // 코촁뮴벗겜땍齡깊(連깊2, 連깊3, 連깊14, 連깊3-1, 連깊4-1, 삔푯)
         Result := SelectProjectsAndAssignData(ADataSetID);
     14: Result := FrmGclBillsBGData.AssignData(AProjectData, rmtPhaseDeal, rmgtGather); // 묏넋좆헌데[굶퍅북谿]
     15: Result := FrmGclBillsBGData.AssignData(AProjectData, rmtPhaseQc, rmgtGather); // 묏넋좆헌데[굶퍅鑒좆긴뫘]
@@ -701,6 +704,7 @@ begin
     38: Result := FrmGclBillsPlaneData.AssignData(AProjectData); // 묏넋좆헌데틱충깊[르쉔0뵀憩瑯]
     42: Result := FrmGcl_XmjBillsData.AssignData(AProjectData, gxtFlowGcl); // 暾켓깃硫깊,憩瑯츠玖깊
     43: Result := FrmGcl_XmjBillsData.AssignData(AProjectData, gxtWithoutXmj); // 暾켓깃硫깊,데깃뙈헌데삠悧깊
+    51: Result := FrmHaBaiCustomizedData.AssignAssistantData(hbgt_CS); //코촁뮴벗겜땍齡깊--삔푯릅燎깊
   end;
   // For Inner Test
   //ShowTestForm(Result);
@@ -823,6 +827,7 @@ begin
       47: Result := FrmHaBaiCustomizedData.AssignData(FTenders, hbgt14);
       48: Result := FrmHaBaiCustomizedData.AssignData(FTenders, hbgt3_1);
       49: Result := FrmHaBaiCustomizedData.AssignData(FTenders, hbgt4_1);
+      50: Result := FrmHaBaiCustomizedData.AssignData(FTenders, hbgt_CS);
       else Result := FrmBillsGatherData.AssignData(FTenders);
     end;
   end;