Prechádzať zdrojové kódy

Merge branch 'master' of http://192.168.1.12:3000/maixinrong/measure

builder 8 rokov pred
rodič
commit
70e5927656

+ 99 - 0
DataModules/OtherMeasurePhaseDm.dfm

@@ -0,0 +1,99 @@
+object OtherMeasurePhaseData: TOtherMeasurePhaseData
+  OldCreateOrder = False
+  Left = 367
+  Top = 303
+  Height = 267
+  Width = 215
+  object sdpPhase: TsdADOProvider
+    TableName = 'OtherMeasurePhase'
+    Left = 56
+    Top = 32
+  end
+  object sddPhase: TsdDataSet
+    Active = False
+    Provider = sdpPhase
+    AfterValueChanged = sddPhaseAfterValueChanged
+    OnGetRecordClass = sddPhaseGetRecordClass
+    Left = 56
+    Top = 96
+    FieldListData = {
+      0101044E616D6506024944094669656C644E616D650602494408446174615479
+      70650203084461746153697A6502040549734B6579080F4E65656450726F6365
+      73734E616D650909507265636973696F6E02000453697A6502000001044E616D
+      65060853657269616C4E6F094669656C644E616D65060853657269616C4E6F08
+      44617461547970650203084461746153697A6502040549734B6579080F4E6565
+      6450726F636573734E616D650909507265636973696F6E02000453697A650200
+      0001044E616D650604436F6465094669656C644E616D650604436F6465084461
+      7461547970650218084461746153697A6502320549734B6579080F4E65656450
+      726F636573734E616D650909507265636973696F6E02000453697A6502000001
+      044E616D6506044E616D65094669656C644E616D6506044E616D650844617461
+      547970650218084461746153697A6503FF000549734B6579080F4E6565645072
+      6F636573734E616D650909507265636973696F6E02000453697A650200000104
+      4E616D6506054D54797065094669656C644E616D6506054D5479706508446174
+      61547970650218084461746153697A6502320549734B6579080F4E6565645072
+      6F636573734E616D650909507265636973696F6E02000453697A650200000104
+      4E616D65060A546F74616C5072696365094669656C644E616D65060A546F7461
+      6C50726963650844617461547970650206084461746153697A6502080549734B
+      6579080F4E65656450726F636573734E616D650909507265636973696F6E0200
+      0453697A6502000001044E616D6506074D656D6F537472094669656C644E616D
+      6506074D656D6F5374720844617461547970650218084461746153697A650203
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060D437265617465506861736549
+      44094669656C644E616D65060D43726561746550686173654944084461746154
+      7970650203084461746153697A6502040549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D65060D437572546F74616C5072696365094669656C644E616D65060D437572
+      546F74616C50726963650844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060D507265546F74616C50726963
+      65094669656C644E616D65060D507265546F74616C5072696365084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000001044E61
+      6D65060D456E64546F74616C5072696365094669656C644E616D65060D456E64
+      546F74616C50726963650844617461547970650206084461746153697A650208
+      0549734B6579080F4E65656450726F636573734E616D65090950726563697369
+      6F6E02000453697A6502000001044E616D65060D416464546F74616C50726963
+      65094669656C644E616D65060D416464546F74616C5072696365084461746154
+      7970650206084461746153697A6502080549734B6579080F4E65656450726F63
+      6573734E616D650909507265636973696F6E02000453697A6502000000}
+  end
+  object sdvPhase: TsdDataView
+    Active = False
+    DataSet = sddPhase
+    Filtered = False
+    Columns = <
+      item
+        FieldName = 'Code'
+      end
+      item
+        FieldName = 'Name'
+      end
+      item
+        FieldName = 'MType'
+      end
+      item
+        FieldName = 'TotalPrice'
+      end
+      item
+        FieldName = 'MemoStr'
+      end
+      item
+        FieldName = 'CreatePhaseID'
+      end
+      item
+        FieldName = 'CurTotalPrice'
+      end
+      item
+        FieldName = 'PreTotalPrice'
+      end
+      item
+        FieldName = 'EndTotalPrice'
+      end
+      item
+        FieldName = 'AddTotalPrice'
+      end>
+    BeforeAddRecord = sdvPhaseBeforeAddRecord
+    Left = 56
+    Top = 160
+  end
+end

+ 219 - 0
DataModules/OtherMeasurePhaseDm.pas

@@ -0,0 +1,219 @@
+unit OtherMeasurePhaseDm;
+
+interface
+
+uses
+  SysUtils, Classes, sdDB, sdProvider, ADODB, OMPhaseRecord;
+
+type
+  TOtherMeasurePhaseData = class(TDataModule)
+    sdpPhase: TsdADOProvider;
+    sddPhase: TsdDataSet;
+    sdvPhase: TsdDataView;
+    procedure sdvPhaseBeforeAddRecord(ARecord: TsdDataRecord;
+      var Allow: Boolean);
+    procedure sdvPhaseAfterValueChanged(AValue: TsdValue);
+    procedure sddPhaseGetRecordClass(var ARecordClass: TsdRecordClass);
+    procedure sddPhaseAfterValueChanged(AValue: TsdValue);
+  private
+    FProjectData: TObject;
+
+    function GetNewID: Integer;
+    function GetNewSerialNo: Integer;
+
+    procedure SaveDetailData;
+
+    procedure BeforeBatchOperation;
+    procedure AfterBatchOperation;
+  public
+    constructor Create(AProjectData: TObject);
+    destructor Destroy; override;
+
+    procedure Open(AConnection: TADOConnection);
+    procedure Save;
+
+    procedure LoadCurStageData;
+  end;
+
+implementation
+
+uses
+  ProjectData, UtilMethods, Math;
+
+{$R *.dfm}
+
+{ TOtherMeasurePhaseData }
+
+procedure TOtherMeasurePhaseData.AfterBatchOperation;
+begin
+  sddPhase.EndUpdate;
+  sddPhase.EnableControls;
+  sddPhase.AfterValueChanged := sddPhaseAfterValueChanged;
+end;
+
+procedure TOtherMeasurePhaseData.BeforeBatchOperation;
+begin
+  sddPhase.AfterValueChanged := nil;
+  sddPhase.DisableControls;
+  sddPhase.BeginUpdate;
+end;
+
+constructor TOtherMeasurePhaseData.Create(AProjectData: TObject);
+begin
+  inherited Create(nil);
+  FProjectData := AProjectData;
+end;
+
+destructor TOtherMeasurePhaseData.Destroy;
+begin
+  inherited;
+end;
+
+function TOtherMeasurePhaseData.GetNewID: Integer;
+var
+  idx: TsdIndex;
+begin
+  idx := sddPhase.FindIndex('idxID');
+  if idx.RecordCount > 0 then
+    Result := idx.Records[idx.RecordCount - 1].ValueByName('ID').AsInteger + 1
+  else
+    Result := 1;
+end;
+
+function TOtherMeasurePhaseData.GetNewSerialNo: Integer;
+var
+  idx: TsdIndex;
+begin
+  idx := sddPhase.FindIndex('idxSerial');
+  if idx.RecordCount > 0 then
+    Result := idx.Records[idx.RecordCount - 1].ValueByName('SerialNo').AsInteger + 1
+  else
+    Result := 1;
+end;
+
+procedure TOtherMeasurePhaseData.LoadCurStageData;
+
+  procedure LoadData;
+  const
+    sSelectSql = 'Select * From OMPhaseDetail Where (PhaseID = %d) and (StageID = %d)';
+  var
+    vQuery: TADOQuery;
+    i: Integer;
+    Rec: TOMPhaseRecord;
+  begin
+    try
+      with TProjectData(FProjectData) do
+        vQuery := QueryData(sdpPhase.Connection, Format(sSelectSql, [PhaseIndex, StageIndex]));
+      for i := 0 to sddPhase.RecordCount - 1 do
+      begin
+        Rec := TOMPhaseRecord(sddPhase.Records[i]);
+        if vQuery.Locate('ID', Rec.ValueByName('ID').AsInteger, []) then
+        begin
+          Rec.PreTotalPrice.AsFloat := vQuery.FieldByName('PreTotalPrice').AsFloat;
+          Rec.CurTotalPrice.AsFloat := vQuery.FieldByName('CurTotalPrice').AsFloat;
+          Rec.EndTotalPrice.AsFloat := vQuery.FieldByName('EndTotalPrice').AsFloat;
+        end
+        else
+        begin
+          Rec.PreTotalPrice.AsFloat := 0;
+          Rec.CurTotalPrice.AsFloat := 0;
+          Rec.EndTotalPrice.AsFloat := 0;
+        end;
+      end;
+    finally
+      vQuery.Free;
+    end;
+  end;
+
+begin
+  BeforeBatchOperation;
+  try
+    LoadData;
+  finally
+    AfterBatchOperation;
+  end;
+end;
+
+procedure TOtherMeasurePhaseData.Open(AConnection: TADOConnection);
+begin
+  sdpPhase.Connection := AConnection;
+  sddPhase.Open;
+  if not Assigned(sddPhase.FindIndex('idxID')) then
+    sddPhase.AddIndex('idxID', 'ID');
+  if not Assigned(sddPhase.FindIndex('idxSerial')) then
+    sddPhase.AddIndex('idxSerial', 'SerialNo');
+  sdvPhase.Open;
+  sdvPhase.IndexName := 'idxSerial';
+
+  LoadCurStageData;
+end;
+
+procedure TOtherMeasurePhaseData.Save;
+begin
+  sddPhase.Save;
+  if not TProjectData(FProjectData).StageDataReadOnly then
+    SaveDetailData;
+end;
+
+procedure TOtherMeasurePhaseData.SaveDetailData;
+const
+  sDeleteSql = 'Delete From OMPhaseDetail where (PhaseID = %d) and (StageID = %d)';
+  sInsertSql = 'Insert Into OMPhaseDetail' +
+               '  Select ID, %d As PhaseID, %d As StageID, PreTotalPrice, CurTotalPrice, EndTotalPrice' +
+               '    From OtherMeasurePhase';
+var
+  iPhase, iStage: Integer;
+  vQuery: TADOQuery;
+begin
+  if TProjectData(FProjectData).StageDataReadOnly then Exit;
+
+  iPhase := TProjectData(FProjectData).PhaseIndex;
+  iStage := TProjectData(FProjectData).StageIndex;
+
+  ExecuteSql(sdpPhase.Connection, Format(sDeleteSql, [iPhase, iStage]));
+  ExecuteSql(sdpPhase.Connection, Format(sInsertSql, [iPhase, iStage]));
+
+  ExecuteSql(sdpPhase.Connection, Format(sDeleteSql, [iPhase, -1]));
+  ExecuteSql(sdpPhase.Connection, Format(sInsertSql, [iPhase, -1]));
+end;
+
+procedure TOtherMeasurePhaseData.sdvPhaseBeforeAddRecord(
+  ARecord: TsdDataRecord; var Allow: Boolean);
+begin
+  ARecord.ValueByName('ID').AsInteger := GetNewID;
+  ARecord.ValueByName('SerialNo').AsInteger := GetNewSerialNo;
+  ARecord.ValueByName('CreatePhaseID').AsInteger := TProjectData(FProjectData).PhaseIndex;
+end;
+
+procedure TOtherMeasurePhaseData.sdvPhaseAfterValueChanged(
+  AValue: TsdValue);
+var
+  Rec: TOMPhaseRecord;
+begin
+  if SameText(AValue.FieldName, 'CurTotalPrice') then
+  begin
+    Rec := TOMPhaseRecord(AValue.Owner);
+    Rec.SetFloatValue(Rec.EndTotalPrice, TotalPriceRoundTo(Rec.CurTotalPrice.AsFloat + Rec.PreTotalPrice.AsFloat));
+  end;
+end;
+
+procedure TOtherMeasurePhaseData.sddPhaseGetRecordClass(
+  var ARecordClass: TsdRecordClass);
+begin
+  ARecordClass := TOMPhaseRecord;
+end;
+
+procedure TOtherMeasurePhaseData.sddPhaseAfterValueChanged(
+  AValue: TsdValue);
+var
+  Rec: TOMPhaseRecord;
+begin
+  if SameText(AValue.FieldName, 'CurTotalPrice') then
+  begin
+    Rec := TOMPhaseRecord(AValue.Owner);
+    Rec.SetFloatValue(Rec.EndTotalPrice, TotalPriceRoundTo(Rec.CurTotalPrice.AsFloat + Rec.PreTotalPrice.AsFloat));
+    Rec.SetFloatValue(Rec.AddTotalPrice, Rec.EndTotalPrice.AsFloat);
+  end;
+end;
+
+end.

+ 4 - 19
DataModules/ProjectGLDm.pas

@@ -47,7 +47,6 @@ type
     procedure CalculatePALRela(ARec: TProjectGLRecord);
     procedure CalculatePALRela(ARec: TProjectGLRecord);
     procedure CalculatePALRelas;
     procedure CalculatePALRelas;
 
 
-    procedure ExecuteSql(const ASql: string);
     procedure SaveGLPrice;
     procedure SaveGLPrice;
     procedure SavePM_CurData;
     procedure SavePM_CurData;
 
 
@@ -214,13 +213,13 @@ var
 begin
 begin
   iPhaseID := TProjectData(FProjectData).ProjProperties.PhaseCount;
   iPhaseID := TProjectData(FProjectData).ProjProperties.PhaseCount;
   sSql := Format(sDeleteSql, [iPhaseID]);
   sSql := Format(sDeleteSql, [iPhaseID]);
-  ExecuteSql(sSql);
+  ExecuteSql(sdpProjectGL.Connection, sSql);
 
 
   sSql := Format(sInsertSql, [iPhaseID]);
   sSql := Format(sInsertSql, [iPhaseID]);
-  ExecuteSql(sSql);
+  ExecuteSql(sdpProjectGL.Connection, sSql);
 
 
   sSql := Format(sUpdateSql, [iPhaseID]);
   sSql := Format(sUpdateSql, [iPhaseID]);
-  ExecuteSql(sSql);
+  ExecuteSql(sdpProjectGL.Connection, sSql);
 end;
 end;
 
 
 procedure TProjectGLData.sddProjectGLAfterAddRecord(
 procedure TProjectGLData.sddProjectGLAfterAddRecord(
@@ -305,20 +304,6 @@ begin
   RefreshGatherData;
   RefreshGatherData;
 end;
 end;
 
 
-procedure TProjectGLData.ExecuteSql(const ASql: string);
-var
-  vQuery: TADOQuery;
-begin
-  vQuery := TADOQuery.Create(nil);
-  try
-    vQuery.Connection := sdpProjectGL.Connection;
-    vQuery.SQL.Add(ASql);
-    vQuery.ExecSQL;
-  finally
-    vQuery.Free;
-  end;
-end;
-
 function TProjectGLData.GetValidDeltaPrice(AID: Integer): Double;
 function TProjectGLData.GetValidDeltaPrice(AID: Integer): Double;
 var
 var
   Rec: TProjectGLRecord;
   Rec: TProjectGLRecord;
@@ -431,7 +416,7 @@ begin
   iStageIndex := TProjectData(FProjectData).PhaseData.StageIndex;
   iStageIndex := TProjectData(FProjectData).PhaseData.StageIndex;
   iPhaseCount := TProjectData(FProjectData).ProjProperties.PhaseCount;
   iPhaseCount := TProjectData(FProjectData).ProjProperties.PhaseCount;
   sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iPhaseCount]);
   sSql := Format(sUpdateSql, [iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iStageIndex, iPhaseCount]);
-  ExecuteSql(sSql);
+  ExecuteSql(sdpProjectGL.Connection, sSql);
 end;
 end;
 
 
 procedure TProjectGLData.CalculateGL_PM(AGLID: Integer);
 procedure TProjectGLData.CalculateGL_PM(AGLID: Integer);

+ 2 - 0
Forms/BGLSelectFrm.pas

@@ -104,6 +104,8 @@ end;
 procedure TBGLSelectForm.Init(AOrgBGL: TBGLSelectInfo;
 procedure TBGLSelectForm.Init(AOrgBGL: TBGLSelectInfo;
   ProjectData: TObject; ABGNum: Double);
   ProjectData: TObject; ABGNum: Double);
 begin
 begin
+  ClientHeight := 281;
+  ClientWidth := 475;
   FProjectData := ProjectData;
   FProjectData := ProjectData;
   with TProjectData(FProjectData).BillsMeasureData.BillsMeasureTree do
   with TProjectData(FProjectData).BillsMeasureData.BillsMeasureTree do
     FGclCode := Selected.Rec.ValueByName('B_Code').AsString;
     FGclCode := Selected.Rec.ValueByName('B_Code').AsString;

+ 3 - 0
Forms/BatchInsertBillsFrm.pas

@@ -147,6 +147,9 @@ end;
 procedure TBatchInsertBillsForm.Init(ABillsCompileData: TBillsCompileData;
 procedure TBatchInsertBillsForm.Init(ABillsCompileData: TBillsCompileData;
   AInsertType: TInsertType);
   AInsertType: TInsertType);
 begin
 begin
+  ClientHeight := 382;
+  ClientWidth := 779;
+
   FBillsCompileData := ABillsCompileData;
   FBillsCompileData := ABillsCompileData;
   sgdDealBills.DataView := TProjectData(ABillsCompileData.ProjectData).DealBillsData.sdvDealBills;
   sgdDealBills.DataView := TProjectData(ABillsCompileData.ProjectData).DealBillsData.sdvDealBills;
   FInsertType := AInsertType;
   FInsertType := AInsertType;

+ 6 - 6
Forms/BatchReplaceBillsFrm.dfm

@@ -1,7 +1,7 @@
 object BatchReplaceBillsForm: TBatchReplaceBillsForm
 object BatchReplaceBillsForm: TBatchReplaceBillsForm
   Left = 494
   Left = 494
   Top = 295
   Top = 295
-  Width = 392
+  Width = 383
   Height = 249
   Height = 249
   Caption = #25209#37327#26367#25442#28165#21333#25968#25454
   Caption = #25209#37327#26367#25442#28165#21333#25968#25454
   Color = clBtnFace
   Color = clBtnFace
@@ -16,8 +16,8 @@ object BatchReplaceBillsForm: TBatchReplaceBillsForm
   object pnlBills: TPanel
   object pnlBills: TPanel
     Left = 0
     Left = 0
     Top = 92
     Top = 92
-    Width = 384
-    Height = 93
+    Width = 375
+    Height = 96
     Align = alClient
     Align = alClient
     BevelOuter = bvNone
     BevelOuter = bvNone
     TabOrder = 0
     TabOrder = 0
@@ -62,8 +62,8 @@ object BatchReplaceBillsForm: TBatchReplaceBillsForm
   end
   end
   object pnlOther: TPanel
   object pnlOther: TPanel
     Left = 0
     Left = 0
-    Top = 185
-    Width = 384
+    Top = 188
+    Width = 375
     Height = 30
     Height = 30
     Align = alBottom
     Align = alBottom
     BevelOuter = bvNone
     BevelOuter = bvNone
@@ -90,7 +90,7 @@ object BatchReplaceBillsForm: TBatchReplaceBillsForm
   object pnlOrgBills: TPanel
   object pnlOrgBills: TPanel
     Left = 0
     Left = 0
     Top = 0
     Top = 0
-    Width = 384
+    Width = 375
     Height = 92
     Height = 92
     Align = alTop
     Align = alTop
     BevelOuter = bvNone
     BevelOuter = bvNone

+ 3 - 0
Forms/BatchReplaceBillsFrm.pas

@@ -95,6 +95,9 @@ end;
 
 
 procedure TBatchReplaceBillsForm.Init(ARec: TsdDataRecord);
 procedure TBatchReplaceBillsForm.Init(ARec: TsdDataRecord);
 begin
 begin
+  ClientHeight := 218;
+  ClientWidth := 375;
+
   InitGrid(zgOrgBills, ARec);
   InitGrid(zgOrgBills, ARec);
   InitGrid(zgBills, ARec);
   InitGrid(zgBills, ARec);
 end;
 end;

+ 1 - 1
Forms/DealPayPlanFrm.dfm

@@ -13,7 +13,7 @@ object DealPayPlanForm: TDealPayPlanForm
   OldCreateOrder = False
   OldCreateOrder = False
   DesignSize = (
   DesignSize = (
     403
     403
-    256)
+    259)
   PixelsPerInch = 96
   PixelsPerInch = 96
   TextHeight = 12
   TextHeight = 12
   object lblTitle: TLabel
   object lblTitle: TLabel

+ 3 - 0
Forms/DealPayPlanFrm.pas

@@ -100,6 +100,9 @@ end;
 
 
 procedure TDealPayPlanForm.InitForm;
 procedure TDealPayPlanForm.InitForm;
 begin
 begin
+  ClientHeight := 259;
+  ClientWidth := 403;
+
   lblDealPayName.Caption := FDealPayRec.ValueByName('Name').AsString;
   lblDealPayName.Caption := FDealPayRec.ValueByName('Name').AsString;
   lblTitle2.Left := lblDealPayName.Left + lblDealPayName.Width + 6;
   lblTitle2.Left := lblDealPayName.Left + lblDealPayName.Width + 6;
   PlanType := FDealPayRec.ValueByName('PlanType').AsInteger;
   PlanType := FDealPayRec.ValueByName('PlanType').AsInteger;

+ 12 - 12
Forms/MainFrm.dfm

@@ -21,7 +21,7 @@ object MainForm: TMainForm
   object jtsProjects: TJimTabSet
   object jtsProjects: TJimTabSet
     Left = 0
     Left = 0
     Top = 49
     Top = 49
-    Width = 734
+    Width = 742
     Height = 21
     Height = 21
     Align = alTop
     Align = alTop
     BackgroundColor = clGradientInactiveCaption
     BackgroundColor = clGradientInactiveCaption
@@ -45,8 +45,8 @@ object MainForm: TMainForm
   end
   end
   object dxStatusBar: TdxStatusBar
   object dxStatusBar: TdxStatusBar
     Left = 0
     Left = 0
-    Top = 480
-    Width = 734
+    Top = 487
+    Width = 742
     Height = 20
     Height = 20
     Panels = <
     Panels = <
       item
       item
@@ -78,12 +78,12 @@ object MainForm: TMainForm
     object dxStatusBarContainer2: TdxStatusBarContainerControl
     object dxStatusBarContainer2: TdxStatusBarContainerControl
       Left = 604
       Left = 604
       Top = 2
       Top = 2
-      Width = 128
+      Width = 136
       Height = 16
       Height = 16
       object ProgressBar: TProgressBar
       object ProgressBar: TProgressBar
         Left = 0
         Left = 0
         Top = 0
         Top = 0
-        Width = 128
+        Width = 136
         Height = 16
         Height = 16
         Align = alClient
         Align = alClient
         Max = 200
         Max = 200
@@ -94,8 +94,8 @@ object MainForm: TMainForm
   object jpsMain: TJimPages
   object jpsMain: TJimPages
     Left = 0
     Left = 0
     Top = 70
     Top = 70
-    Width = 734
-    Height = 410
+    Width = 742
+    Height = 417
     ActivePage = jpsMainProjectsManager
     ActivePage = jpsMainProjectsManager
     ActivePageIndex = 0
     ActivePageIndex = 0
     Align = alClient
     Align = alClient
@@ -103,8 +103,8 @@ object MainForm: TMainForm
     object jpsMainProjectsManager: TJimPage
     object jpsMainProjectsManager: TJimPage
       Left = 0
       Left = 0
       Top = 0
       Top = 0
-      Width = 734
-      Height = 410
+      Width = 742
+      Height = 417
       TabName = 'ProjectsManager'
       TabName = 'ProjectsManager'
       Caption = 'ProjsMgr'
       Caption = 'ProjsMgr'
       object pnlUser: TPanel
       object pnlUser: TPanel
@@ -201,8 +201,8 @@ object MainForm: TMainForm
     object jpsMainProjects: TJimPage
     object jpsMainProjects: TJimPage
       Left = 0
       Left = 0
       Top = 0
       Top = 0
-      Width = 734
-      Height = 410
+      Width = 742
+      Height = 417
       TabName = 'Projects'
       TabName = 'Projects'
       Caption = 'Projects'
       Caption = 'Projects'
       object jpsProjects: TJimPages
       object jpsProjects: TJimPages
@@ -220,7 +220,7 @@ object MainForm: TMainForm
     Font.Charset = DEFAULT_CHARSET
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Color = clWindowText
     Font.Height = -12
     Font.Height = -12
-    Font.Name = #24494#36719#38597#40657
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Font.Style = []
     Bars = <
     Bars = <
       item
       item

+ 0 - 1
Forms/MainFrm.pas

@@ -235,7 +235,6 @@ var
 implementation
 implementation
 
 
 uses
 uses
-
   ProjectProperty, ConstUnit, PHPWebDm, Math, ShellAPI,
   ProjectProperty, ConstUnit, PHPWebDm, Math, ShellAPI,
   FindUserFrm, ImportExcelHintFrm, ConfigDoc, ExportExcel,
   FindUserFrm, ImportExcelHintFrm, ConfigDoc, ExportExcel,
   ProjectCommands, BillsCompileDm, tpMainFrm,
   ProjectCommands, BillsCompileDm, tpMainFrm,

+ 56 - 28
Frames/ProjectFme.dfm

@@ -2,7 +2,7 @@ object ProjectFrame: TProjectFrame
   Left = 0
   Left = 0
   Top = 0
   Top = 0
   Width = 1169
   Width = 1169
-  Height = 438
+  Height = 528
   Font.Charset = ANSI_CHARSET
   Font.Charset = ANSI_CHARSET
   Font.Color = clWindowText
   Font.Color = clWindowText
   Font.Height = -12
   Font.Height = -12
@@ -14,14 +14,14 @@ object ProjectFrame: TProjectFrame
     Left = 0
     Left = 0
     Top = 0
     Top = 0
     Width = 65
     Width = 65
-    Height = 438
+    Height = 528
     Align = alLeft
     Align = alLeft
     TabOrder = 0
     TabOrder = 0
     object dxsbViewControl: TdxSideBar
     object dxsbViewControl: TdxSideBar
       Left = 1
       Left = 1
       Top = 1
       Top = 1
       Width = 63
       Width = 63
-      Height = 436
+      Height = 526
       Align = alClient
       Align = alClient
       BkGround.BeginColor = clInactiveCaption
       BkGround.BeginColor = clInactiveCaption
       BkGround.EndColor = clGradientInactiveCaption
       BkGround.EndColor = clGradientInactiveCaption
@@ -86,14 +86,23 @@ object ProjectFrame: TProjectFrame
               Tag = 4
               Tag = 4
             end
             end
             item
             item
+              Caption = #20854#20182#21488#36134
+              Index = 5
+              IsDefault = False
+              LargeImage = 7
+              SmallImage = 7
+              StoredItem = dxsbsViewControlItem8
+              Tag = 5
+            end
+            item
               Caption = #25253#34920
               Caption = #25253#34920
               Hint = #25253#34920
               Hint = #25253#34920
-              Index = 5
+              Index = 6
               IsDefault = False
               IsDefault = False
               LargeImage = 6
               LargeImage = 6
               SmallImage = 6
               SmallImage = 6
               StoredItem = xbiReport
               StoredItem = xbiReport
-              Tag = 5
+              Tag = 6
             end>
             end>
         end>
         end>
       ActiveGroupIndex = 0
       ActiveGroupIndex = 0
@@ -116,13 +125,13 @@ object ProjectFrame: TProjectFrame
     Left = 65
     Left = 65
     Top = 0
     Top = 0
     Width = 1104
     Width = 1104
-    Height = 438
+    Height = 528
     Align = alClient
     Align = alClient
     TabOrder = 1
     TabOrder = 1
     object sprAssistant: TSplitter
     object sprAssistant: TSplitter
       Left = 904
       Left = 904
       Top = 22
       Top = 22
-      Height = 415
+      Height = 505
       Align = alRight
       Align = alRight
       Color = clBtnFace
       Color = clBtnFace
       ParentColor = False
       ParentColor = False
@@ -2725,7 +2734,7 @@ object ProjectFrame: TProjectFrame
       Left = 907
       Left = 907
       Top = 22
       Top = 22
       Width = 196
       Width = 196
-      Height = 415
+      Height = 505
       ActivePage = jpsAssistantBGL
       ActivePage = jpsAssistantBGL
       ActivePageIndex = 4
       ActivePageIndex = 4
       Align = alRight
       Align = alRight
@@ -2735,7 +2744,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'StandardBills'
         TabName = 'StandardBills'
         Caption = 'StandardBills'
         Caption = 'StandardBills'
       end
       end
@@ -2743,7 +2752,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'DealPayment'
         TabName = 'DealPayment'
         Caption = 'BlockLib'
         Caption = 'BlockLib'
       end
       end
@@ -2751,7 +2760,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'Search'
         TabName = 'Search'
         Caption = 'Seach'
         Caption = 'Seach'
       end
       end
@@ -2759,7 +2768,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'ZJJL'
         TabName = 'ZJJL'
         Caption = 'ZJJL'
         Caption = 'ZJJL'
       end
       end
@@ -2767,7 +2776,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'BGL'
         TabName = 'BGL'
         Caption = 'BGL'
         Caption = 'BGL'
       end
       end
@@ -2775,7 +2784,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'Checker'
         TabName = 'Checker'
         Caption = 'Checker'
         Caption = 'Checker'
       end
       end
@@ -2783,7 +2792,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'Bookmark'
         TabName = 'Bookmark'
         Caption = 'Bookmark'
         Caption = 'Bookmark'
       end
       end
@@ -2791,7 +2800,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'UpFile'
         TabName = 'UpFile'
         Caption = 'UpFile'
         Caption = 'UpFile'
       end
       end
@@ -2799,7 +2808,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 196
         Width = 196
-        Height = 415
+        Height = 505
         TabName = 'DealBills'
         TabName = 'DealBills'
         Caption = 'DealBills'
         Caption = 'DealBills'
       end
       end
@@ -2808,7 +2817,7 @@ object ProjectFrame: TProjectFrame
       Left = 1
       Left = 1
       Top = 22
       Top = 22
       Width = 903
       Width = 903
-      Height = 415
+      Height = 505
       ActivePage = jpsMainBillsCompile
       ActivePage = jpsMainBillsCompile
       ActivePageIndex = 0
       ActivePageIndex = 0
       Align = alClient
       Align = alClient
@@ -2818,7 +2827,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 903
         Width = 903
-        Height = 415
+        Height = 505
         TabName = 'BillsCompile'
         TabName = 'BillsCompile'
         Caption = 'BillsCompile'
         Caption = 'BillsCompile'
       end
       end
@@ -2827,7 +2836,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 903
         Width = 903
-        Height = 415
+        Height = 505
         TabName = 'BillsMeasure'
         TabName = 'BillsMeasure'
         Caption = 'Bills'
         Caption = 'Bills'
       end
       end
@@ -2836,7 +2845,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 903
         Width = 903
-        Height = 415
+        Height = 505
         TabName = 'BillsGather'
         TabName = 'BillsGather'
         Caption = 'PhaseCompare'
         Caption = 'PhaseCompare'
       end
       end
@@ -2845,7 +2854,7 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 903
         Width = 903
-        Height = 415
+        Height = 505
         TabName = 'PriceMargin'
         TabName = 'PriceMargin'
         Caption = 'PriceMargin'
         Caption = 'PriceMargin'
       end
       end
@@ -2854,10 +2863,19 @@ object ProjectFrame: TProjectFrame
         Left = 0
         Left = 0
         Top = 0
         Top = 0
         Width = 903
         Width = 903
-        Height = 415
+        Height = 505
         TabName = 'StageCompare'
         TabName = 'StageCompare'
         Caption = 'StageCompare'
         Caption = 'StageCompare'
       end
       end
+      object jpsMainOtherMeasure: TJimPage
+        Tag = -1
+        Left = 0
+        Top = 0
+        Width = 903
+        Height = 505
+        TabName = 'OtherMeasure'
+        Caption = 'OtherMeasure'
+      end
     end
     end
   end
   end
   object xpm: TXPMenu
   object xpm: TXPMenu
@@ -3127,9 +3145,10 @@ object ProjectFrame: TProjectFrame
       #21488#36134#20998#35299
       #21488#36134#20998#35299
       #35745#37327#21488#36134
       #35745#37327#21488#36134
       #28165#21333#27719#24635
       #28165#21333#27719#24635
-      #23457#26680#27604#36739
       #26448#26009#35843#24046
       #26448#26009#35843#24046
+      #23457#26680#27604#36739
       #24418#35937#36827#24230
       #24418#35937#36827#24230
+      #20854#20182#21488#36134
       #25253#34920)
       #25253#34920)
     DefaultLargeImage = -1
     DefaultLargeImage = -1
     DefaultSmallImage = -1
     DefaultSmallImage = -1
@@ -3157,7 +3176,7 @@ object ProjectFrame: TProjectFrame
     object xbiStageCompare: TdxStoredSideItem
     object xbiStageCompare: TdxStoredSideItem
       Tag = 4
       Tag = 4
       Caption = #23457#26680#27604#36739
       Caption = #23457#26680#27604#36739
-      Category = 3
+      Category = 4
       Enabled = True
       Enabled = True
       Hint = #23457#26680#27604#36739
       Hint = #23457#26680#27604#36739
       LargeImage = 3
       LargeImage = 3
@@ -3173,9 +3192,9 @@ object ProjectFrame: TProjectFrame
       SmallImage = 5
       SmallImage = 5
     end
     end
     object xbiReport: TdxStoredSideItem
     object xbiReport: TdxStoredSideItem
-      Tag = 5
+      Tag = 6
       Caption = #25253#34920
       Caption = #25253#34920
-      Category = 6
+      Category = 7
       Enabled = True
       Enabled = True
       Hint = #25253#34920
       Hint = #25253#34920
       LargeImage = 6
       LargeImage = 6
@@ -3192,11 +3211,20 @@ object ProjectFrame: TProjectFrame
     object xbiPriceMargin: TdxStoredSideItem
     object xbiPriceMargin: TdxStoredSideItem
       Tag = 3
       Tag = 3
       Caption = #26448#26009#35843#24046
       Caption = #26448#26009#35843#24046
-      Category = 4
+      Category = 3
       Enabled = True
       Enabled = True
       LargeImage = 4
       LargeImage = 4
       SmallImage = 4
       SmallImage = 4
     end
     end
+    object dxsbsViewControlItem8: TdxStoredSideItem
+      Tag = 5
+      Caption = #20854#20182#21488#36134
+      Category = 6
+      Enabled = True
+      Hint = #20854#20182#21488#36134
+      LargeImage = 7
+      SmallImage = 7
+    end
   end
   end
   object ilstLarge: TImageList
   object ilstLarge: TImageList
     Height = 32
     Height = 32

+ 19 - 6
Frames/ProjectFme.pas

@@ -6,7 +6,7 @@ uses
   BillsCompileFme, BillsMeasureFme, PhaseCompareFme, DealPaymentFme,
   BillsCompileFme, BillsMeasureFme, PhaseCompareFme, DealPaymentFme,
   BillsGatherFme, ZJJLFme, BGLFme, ReportsFrm, SearchFme, BookmarkFme,
   BillsGatherFme, ZJJLFme, BGLFme, ReportsFrm, SearchFme, BookmarkFme,
   ProjectData, UtilMethods, Globals, mEncryptEditions, DealBillsFme,
   ProjectData, UtilMethods, Globals, mEncryptEditions, DealBillsFme,
-  PriceMarginFme,
+  PriceMarginFme, OtherMeasureFme,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, ImgList, XPMenu, Buttons, ComCtrls, ToolWin, ExtCtrls, JimPages,
   Dialogs, ImgList, XPMenu, Buttons, ComCtrls, ToolWin, ExtCtrls, JimPages,
   StdCtrls, JimCombos, dxsbar, ActnList, dxBar, OrderCheckerFme, CheckerFme,
   StdCtrls, JimCombos, dxsbar, ActnList, dxBar, OrderCheckerFme, CheckerFme,
@@ -81,6 +81,8 @@ type
     actnAllPeg: TAction;
     actnAllPeg: TAction;
     jpsMainPriceMargin: TJimPage;
     jpsMainPriceMargin: TJimPage;
     xbiPriceMargin: TdxStoredSideItem;
     xbiPriceMargin: TdxStoredSideItem;
+    dxsbsViewControlItem8: TdxStoredSideItem;
+    jpsMainOtherMeasure: TJimPage;
     procedure tobtnStandardBillsClick(Sender: TObject);
     procedure tobtnStandardBillsClick(Sender: TObject);
     procedure jcbPhaseChanged(Sender: TObject);
     procedure jcbPhaseChanged(Sender: TObject);
     procedure sbtnExpendClick(Sender: TObject);
     procedure sbtnExpendClick(Sender: TObject);
@@ -107,6 +109,8 @@ type
     FBillsGatherFrame: TBillsGatherFrame;
     FBillsGatherFrame: TBillsGatherFrame;
     FPriceMarginFrame: TPriceMarginFrame;
     FPriceMarginFrame: TPriceMarginFrame;
     FPhaseCompareFrame: TPhaseCompareFrame;
     FPhaseCompareFrame: TPhaseCompareFrame;
+    FOtherMeasureFrame: TOtherMeasureFrame;
+
     FCheckerFrame: TCheckerFrame;
     FCheckerFrame: TCheckerFrame;
 
 
     FDealPaymentFrame: TDealPaymentFrame;
     FDealPaymentFrame: TDealPaymentFrame;
@@ -180,6 +184,7 @@ type
     property BillsMeasureFrame: TBillsMeasureFrame read FBillsMeasureFrame;
     property BillsMeasureFrame: TBillsMeasureFrame read FBillsMeasureFrame;
     property BillsGatherFrame: TBillsGatherFrame read FBillsGatherFrame;
     property BillsGatherFrame: TBillsGatherFrame read FBillsGatherFrame;
     property PriceMarginFrame: TPriceMarginFrame read FPriceMarginFrame;
     property PriceMarginFrame: TPriceMarginFrame read FPriceMarginFrame;
+    property OtherMeasureFrame: TOtherMeasureFrame read FOtherMeasureFrame;
 
 
     property CheckerFrame: TCheckerFrame read FCheckerFrame;
     property CheckerFrame: TCheckerFrame read FCheckerFrame;
     property UpFileManageView: TUpFileManageView read FUpFileManageView write SetUpFileManageView;
     property UpFileManageView: TUpFileManageView read FUpFileManageView write SetUpFileManageView;
@@ -256,6 +261,7 @@ destructor TProjectFrame.Destroy;
 begin
 begin
   FBookmarkFrame.Free;
   FBookmarkFrame.Free;
   FZJJLFrame.Free;
   FZJJLFrame.Free;
+  FOtherMeasureFrame.Free;
   FBillsGatherFrame.Free;
   FBillsGatherFrame.Free;
   FDealPaymentFrame.Free;
   FDealPaymentFrame.Free;
   FBillsCompileFrame.Free;
   FBillsCompileFrame.Free;
@@ -532,7 +538,7 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
     BeforeChangeView;
     BeforeChangeView;
     case Item.Tag of
     case Item.Tag of
       0, 2: jpsMain.ActivePageIndex := Item.Tag;
       0, 2: jpsMain.ActivePageIndex := Item.Tag;
-      1, 3: if CheckMeasureEdition then jpsMain.ActivePageIndex := Item.Tag;
+      1, 3, 5: if CheckMeasureEdition then jpsMain.ActivePageIndex := Item.Tag;
     end;
     end;
     AfterChangeView;
     AfterChangeView;
   end;
   end;
@@ -600,10 +606,10 @@ begin
   bCloseCompare := (Item.Tag in [0..3]) and (jpsMain.ActivePageIndex = 4);
   bCloseCompare := (Item.Tag in [0..3]) and (jpsMain.ActivePageIndex = 4);
 
 
   case Item.Tag of
   case Item.Tag of
-    0..2: ChangeView;
+    0..2, 5: ChangeView;
     3: DisplayPriceMargin;
     3: DisplayPriceMargin;
     4: DisplayCompare;
     4: DisplayCompare;
-    5: DisplayReports;
+    6: DisplayReports;
   end;
   end;
 
 
   if bCloseCompare then
   if bCloseCompare then
@@ -1152,10 +1158,16 @@ begin
   CreateBillsFrame;
   CreateBillsFrame;
   UpdateSysProgress(130, '正在解析数据');
   UpdateSysProgress(130, '正在解析数据');
   CreateDealPaymentFrame;
   CreateDealPaymentFrame;
-  UpdateSysProgress(140, '正在解析数据');
+  UpdateSysProgress(135, '正在解析数据');
   CreateBillsGatherFrame;
   CreateBillsGatherFrame;
+  UpdateSysProgress(140, '正在解析数据');
+  CreatePriceMarginFrame;                
+  UpdateSysProgress(145, '正在解析数据');
+
+  FOtherMeasureFrame := TOtherMeasureFrame.Create(FProjectData);
+  AlignControl(FOtherMeasureFrame, jpsMainOtherMeasure, alClient);
   UpdateSysProgress(150, '正在解析数据');
   UpdateSysProgress(150, '正在解析数据');
-  CreatePriceMarginFrame;
+
 
 
   FZJJLFrame := TZJJLFrame.Create(Self, FProjectData.PhaseData.ZJJLData);
   FZJJLFrame := TZJJLFrame.Create(Self, FProjectData.PhaseData.ZJJLData);
   FZJJLFrame.DataReadOnly := FProjectData.PhaseData.StageDataReadOnly;
   FZJJLFrame.DataReadOnly := FProjectData.PhaseData.StageDataReadOnly;
@@ -1393,6 +1405,7 @@ begin
   FBillsMeasureFrame.RefreshPhase_Stage;
   FBillsMeasureFrame.RefreshPhase_Stage;
   FDealPaymentFrame.RefreshPhase_Stage;
   FDealPaymentFrame.RefreshPhase_Stage;
   FPriceMarginFrame.ResetViewControl;
   FPriceMarginFrame.ResetViewControl;
+  FOtherMeasureFrame.ResetViewControl;
 end;
 end;
 
 
 procedure TProjectFrame.ExpandCurPhase;
 procedure TProjectFrame.ExpandCurPhase;

+ 1 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
 const
   ProductName = 'Measure';
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.6';
+  FileVersion = '1.0.1.7';
   EncryptVersion = 'Auto1.0';
   EncryptVersion = 'Auto1.0';
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
                    'User ID=Admin;Password='''';Persist Security Info=True';
                    'User ID=Admin;Password='''';Persist Security Info=True';

+ 63 - 4
Units/DataBaseTables.pas

@@ -691,12 +691,71 @@ const
     (FieldName: 'PrePhasePay'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
     (FieldName: 'PrePhasePay'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
   );
 
 
+  {其他台账 -- 全额计量}
+  SOtherMeasureOnce = 'OtherMeasureOnce';
+  tdOtherMeasureOnce: array [0..7] of TScFieldDef = (
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 排序
+    (FieldName: 'SerialNo'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 编号
+    (FieldName: 'Code'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 名称
+    (FieldName: 'Name'; FieldType: ftString; Size: 200; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 台账类型
+    (FieldName: 'MType'; FieldType: ftString; Size: 20; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 金额
+    (FieldName: 'TotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 备注
+    (FieldName: 'MemoStr'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 创建日期
+    (FieldName: 'CreatePhaseID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  {其他台账 -- 分期计量}
+  SOtherMeasurePhase = 'OtherMeasurePhase';
+  tdOtherMeasurePhase: array [0..11] of TScFieldDef =(
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    // 排序
+    (FieldName: 'SerialNo'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 编号
+    (FieldName: 'Code'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 名称
+    (FieldName: 'Name'; FieldType: ftString; Size: 200; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 台账类型
+    (FieldName: 'MType'; FieldType: ftString; Size: 20; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 台账金额
+    (FieldName: 'TotalPrice'; FieldType: ftString; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 备注
+    (FieldName: 'MemoStr'; FieldType: ftString; Size: 255; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 创建日期
+    (FieldName: 'CreatePhaseID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 以下为根据期数缓存DetailMeasure中数据
+    // 本期计量
+    (FieldName: 'CurTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止上期计量
+    (FieldName: 'PreTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 截止本期计量
+    (FieldName: 'EndTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 累计计量
+    (FieldName: 'AddTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
+  SOMPhaseDetail = 'OMPhaseDetail';
+  tdOMPhaseDetail: array [0..5] of TScFieldDef =(
+    (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    (FieldName: 'PhaseID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    (FieldName: 'StageID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    (FieldName: 'PreTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'CurTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'EndTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+  );
+
   {PhaseData}
   {PhaseData}
 
 
-  // Refer  :原报
-  // Audit1 :1审
-  // Audit2 :2审
-  // Audit3 :3审
+  // Refer  : 原报
+  // Audit1 : 1审
+  // Audit2 : 2审
+  // Audit3 : 3审
   // ......
   // ......
   SRefer = 'Refer';
   SRefer = 'Refer';
   SAudit = 'Audit';
   SAudit = 'Audit';

+ 71 - 0
Units/DataRecord/OMPhaseRecord.pas

@@ -0,0 +1,71 @@
+unit OMPhaseRecord;
+
+interface
+
+uses
+  sdDB, mDataRecord;
+
+type
+  TOMPhaseRecord = class(TMeasureBaseRecord)
+  private
+    FID: TsdValue;
+    FSerialNo: TsdValue;
+
+    FName: TsdValue;
+    FMType: TsdValue;
+    FTotalPrice: TsdValue;
+    FMemoStr: TsdValue;
+
+    FCreatePhaseID: TsdValue;
+    FCreateStageID: TsdValue;
+
+    FCurTotalPrice: TsdValue;
+    FPreTotalPrice: TsdValue;
+    FEndTotalPrice: TsdValue;
+    FAddTotalPrice: TsdValue;
+  protected
+    procedure DoAfterAddFields; override;
+  public
+    property ID: TsdValue read FID;
+    property SerialNo: TsdValue read FSerialNo;
+
+    property Name: TsdValue read FName;
+    property MType: TsdValue read FMType;
+    property TotalPrice: TsdValue read FTotalPrice;
+    property MemoStr: TsdValue read FMemoStr;
+
+    property CreatePhaseID: TsdValue read FCreatePhaseID;
+    property CreateStageID: TsdValue read FCreateStageID;
+
+    property CurTotalPrice: TsdValue read FCurTotalPrice;
+    property PreTotalPrice: TsdValue read FPreTotalPrice;
+    property EndTotalPrice: TsdValue read FEndTotalPrice;
+    property AddTotalPrice: TsdValue read FAddTotalPrice;
+  end;
+
+implementation
+
+{ TOMPhaseRecord }
+
+procedure TOMPhaseRecord.DoAfterAddFields;
+begin
+  inherited;
+  FID := ValueByName('ID');
+  FSerialNo := ValueByName('SerialNo');
+
+  FName := ValueByName('Name');
+  FMType := ValueByName('MType');
+  FTotalPrice := ValueByName('TotalPrice');
+  FMemoStr := ValueByName('MemoStr');
+
+  FCreatePhaseID := ValueByName('CreatePhaseID');
+  FCreateStageID := ValueByName('CreateStageID');
+
+  FCurTotalPrice := ValueByName('CurTotalPrice');
+  FPreTotalPrice := ValueByName('PreTotalPrice');
+  FEndTotalPrice := ValueByName('EndTotalPrice');
+
+  FAddTotalPrice := ValueByName('AddTotalPrice');
+end;
+
+end.

+ 1 - 18
Units/PhaseData.pas

@@ -29,8 +29,6 @@ type
 
 
     procedure UpdatePhaseDataBase;
     procedure UpdatePhaseDataBase;
 
 
-    procedure ExecuteSql(const ASql: string);
-
     procedure CopyPreStageData;
     procedure CopyPreStageData;
 
 
     procedure CheckAuditCount;
     procedure CheckAuditCount;
@@ -311,22 +309,7 @@ begin
   sPre := StageTableName[FPhaseProperty.AuditCount-1];
   sPre := StageTableName[FPhaseProperty.AuditCount-1];
   sCur := StageTableName[FPhaseProperty.AuditCount];
   sCur := StageTableName[FPhaseProperty.AuditCount];
   sSql := Format(sCopySql, [sCur, sPre]);
   sSql := Format(sCopySql, [sCur, sPre]);
-  ExecuteSql(sSql);
-end;
-
-procedure TPhaseData.ExecuteSql(const ASql: string);
-var
-  FQuery: TADOQuery;
-begin
-  FQuery := TADOQuery.Create(nil);
-  try
-    FQuery.Connection := FConnection.Connection;
-    FQuery.SQL.Clear;
-    FQuery.SQL.Add(ASql);
-    FQuery.ExecSQL;
-  finally
-    FQuery.Free;
-  end;
+  ExecuteSql(FConnection.Connection, sSql);
 end;
 end;
 
 
 procedure TPhaseData.SimpleOpen2(const AProjectName: string);
 procedure TPhaseData.SimpleOpen2(const AProjectName: string);

+ 84 - 1
Units/ProjectData.pas

@@ -7,7 +7,7 @@ uses
   PhaseCompareDm, DealPaymentDm, SearchDm, DealBillsDm, MainDataListDm,
   PhaseCompareDm, DealPaymentDm, SearchDm, DealBillsDm, MainDataListDm,
   BillsGatherDm, BGLDm, StaffDm, BillsCompileDm, BillsMeasureDm,
   BillsGatherDm, BGLDm, StaffDm, BillsCompileDm, BillsMeasureDm,
   BillsBookmarkDm, UpFileManageUnit, ProjectGLDm, PriceMarginBillsDm,
   BillsBookmarkDm, UpFileManageUnit, ProjectGLDm, PriceMarginBillsDm,
-  DetailGLDm,
+  DetailGLDm, OtherMeasureOnceDm, OtherMeasurePhaseDm,
   Classes, SysUtils, ADODB, sdDB, Checker;
   Classes, SysUtils, ADODB, sdDB, Checker;
 
 
 type
 type
@@ -46,6 +46,9 @@ type
     FDetailGLData: TDetailGLData;
     FDetailGLData: TDetailGLData;
     FPriceMarginBillsData: TPriceMarginBillsData;
     FPriceMarginBillsData: TPriceMarginBillsData;
 
 
+    FOtherMeasureOnceData: TOtherMeasureOnceData;
+    FOtherMeasurePhaseData: TOtherMeasurePhaseData;
+
     FCanUnlockInfo: Boolean;
     FCanUnlockInfo: Boolean;
 
 
     FWebID: Integer;
     FWebID: Integer;
@@ -128,6 +131,8 @@ type
     procedure OpenForReport2(const AFileName: string);
     procedure OpenForReport2(const AFileName: string);
     {OpenForReport3: OpenForReport2的基础上打开最后一个审核人数据,打开BillsMeasureTree不打开BillsCompileTree,链接BillsMeasureTree跟StageData}
     {OpenForReport3: OpenForReport2的基础上打开最后一个审核人数据,打开BillsMeasureTree不打开BillsCompileTree,链接BillsMeasureTree跟StageData}
     procedure OpenForReport3(const AFileName: string);
     procedure OpenForReport3(const AFileName: string);
+    {OpenForGather: BillsData, BillsMeasureTree, DealPaymentData, BGLData, PhaseData(根据PhaseIndex指定打开)}
+    procedure OpenForGather(const AFileName: string; APhaseIndex: Integer = -1);
     //-----------------------  End ---后台打开 ------------------------
     //-----------------------  End ---后台打开 ------------------------
 
 
     procedure SaveDebugFile(const AFileName: string);
     procedure SaveDebugFile(const AFileName: string);
@@ -209,6 +214,9 @@ type
     property DetailGLData: TDetailGLData read FDetailGLData;
     property DetailGLData: TDetailGLData read FDetailGLData;
     property PriceMarginBillsData: TPriceMarginBillsData read FPriceMarginBillsData;
     property PriceMarginBillsData: TPriceMarginBillsData read FPriceMarginBillsData;
 
 
+    property OtherMeasureOnceData: TOtherMeasureOnceData read FOtherMeasureOnceData;
+    property OtherMeasurePhaseData: TOtherMeasurePhaseData read FOtherMeasurePhaseData;
+
     // 台账、合同支付
     // 台账、合同支付
     property AllowInsert: Boolean read GetAllowInsert;
     property AllowInsert: Boolean read GetAllowInsert;
     property BaseDataReadOnly: Boolean read GetBaseDataReadOnly;
     property BaseDataReadOnly: Boolean read GetBaseDataReadOnly;
@@ -289,6 +297,8 @@ begin
   FProjectGLData := TProjectGLData.Create(Self);
   FProjectGLData := TProjectGLData.Create(Self);
   FDetailGLData := TDetailGLData.Create(Self);
   FDetailGLData := TDetailGLData.Create(Self);
   FPriceMarginBillsData := TPriceMarginBillsData.Create(Self);
   FPriceMarginBillsData := TPriceMarginBillsData.Create(Self);
+  FOtherMeasureOnceData := TOtherMeasureOnceData.Create(Self);
+  FOtherMeasurePhaseData := TOtherMeasurePhaseData.Create(Self);
   FAttachmentData := TUpFiles.Create;
   FAttachmentData := TUpFiles.Create;
   FPhaseIndex := 0;
   FPhaseIndex := 0;
 end;
 end;
@@ -309,6 +319,8 @@ destructor TProjectData.Destroy;
 begin
 begin
   try
   try
     FCheckers.Free;
     FCheckers.Free;
+    FOtherMeasurePhaseData.Free;
+    FOtherMeasureOnceData.Free;
     FPriceMarginBillsData.Free;
     FPriceMarginBillsData.Free;
     FDetailGLData.Free;
     FDetailGLData.Free;
     FProjectGLData.Free;
     FProjectGLData.Free;
@@ -449,6 +461,9 @@ begin
 
 
   //FBillsGatherData.RefreshBills;
   //FBillsGatherData.RefreshBills;
   FMainListData.Open(FConnection.Connection);
   FMainListData.Open(FConnection.Connection);
+  UpdateSysProgress(190, '正在读取数据');
+  FOtherMeasureOnceData.Open(FConnection.Connection);
+  FOtherMeasurePhaseData.Open(FConnection.Connection);
   UpdateSysProgress(200, '就绪');
   UpdateSysProgress(200, '就绪');
 
 
   if _IsDebugView then
   if _IsDebugView then
@@ -493,6 +508,10 @@ begin
     FBillsCompileData.ReLockBaseData;
     FBillsCompileData.ReLockBaseData;
     UpdateSysProgress(110, '正在保存数据');
     UpdateSysProgress(110, '正在保存数据');
     FBillsData.Save;
     FBillsData.Save;
+    UpdateSysProgress(165, '正在保存数据');
+
+    FOtherMeasureOnceData.Save;
+    FOtherMeasurePhaseData.Save;
     UpdateSysProgress(170, '正在保存数据');
     UpdateSysProgress(170, '正在保存数据');
 
 
     FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
     FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;
@@ -552,6 +571,8 @@ var
 begin
 begin
   SaveLastestPhaseMainData;
   SaveLastestPhaseMainData;
   FProjectGLData.Save;
   FProjectGLData.Save;
+  FOtherMeasurePhaseData.Save;
+
   iOrgPhaseIndex := FPhaseIndex;
   iOrgPhaseIndex := FPhaseIndex;
   FPhaseIndex := Value;
   FPhaseIndex := Value;
   ProjProperties.PhaseIndex := FPhaseIndex;
   ProjProperties.PhaseIndex := FPhaseIndex;
@@ -562,6 +583,8 @@ begin
   FProjectGLData.LoadCurPhaseInfoPrice;
   FProjectGLData.LoadCurPhaseInfoPrice;
   FProjectGLData.LoadStagePM_CalcData;
   FProjectGLData.LoadStagePM_CalcData;
   FProjectGLData.RefreshGatherData;
   FProjectGLData.RefreshGatherData;
+  // 须保存其他台账--分期计量数据
+  FOtherMeasurePhaseData.LoadCurStageData;
   //BillsGatherData.RefreshBills;
   //BillsGatherData.RefreshBills;
 end;
 end;
 
 
@@ -657,6 +680,17 @@ procedure TProjectData.UpdatePhaseData;
     ExecuteSql(sSql);
     ExecuteSql(sSql);
   end;
   end;
 
 
+  procedure UpdateOMPhaseDetailData;
+  const
+    sUpdateSql = 'Insert Into OMPhaseDetail (ID, PhaseID, StageID,' +
+                 '    PreTotalPrice, CurTotalPrice, EndTotalPrice)' +
+                 '  Select ID, %d, %d, PreTotalPrice, CurTotalPrice, EndTotalPrice' +
+                 '  From OMPhaseDetail Where (PhaseID = %d) and (StageID = -1)';
+  begin
+    if (ProjProperties.PhaseCount > 0) and (ProjProperties.AuditStatus > 0) then
+      ExecuteSql(Format(sUpdateSql, [FPhaseIndex, FProjProperties.AuditStatus, FPhaseIndex]));
+  end;
+
 var
 var
   iPhase: Integer;
   iPhase: Integer;
 begin
 begin
@@ -667,6 +701,7 @@ begin
     PhaseData.CreateNewAuditData;
     PhaseData.CreateNewAuditData;
     StaffData.UpdateDataForNewAudit;
     StaffData.UpdateDataForNewAudit;
     UpdateGLPriceData;
     UpdateGLPriceData;
+    UpdateOMPhaseDetailData;
   end;
   end;
 end;
 end;
 
 
@@ -1737,12 +1772,21 @@ procedure TProjectData.ResetFloatDigitView;
     FBGLData.cdsBGBillsViewUsedQuantity.DisplayFormat := FProjProperties.QuantityFormat;
     FBGLData.cdsBGBillsViewUsedQuantity.DisplayFormat := FProjProperties.QuantityFormat;
   end;
   end;
 
 
+  procedure SetOtherMeasureDigit;
+  begin
+    with FOtherMeasureOnceData.sdvOnce do
+    begin
+      Columns.FindColumn('TotalPrice').DisplayFormat := FProjProperties.TotalPriceFormat;
+    end;
+  end;
+
 begin
 begin
   SetBillsCompileDigit;
   SetBillsCompileDigit;
   SetBillsMeasureDigit;
   SetBillsMeasureDigit;
   SetDealPaymentDigit;
   SetDealPaymentDigit;
   SetBillsGatherDigit;
   SetBillsGatherDigit;
   SetBGLDigit;
   SetBGLDigit;
+  SetOtherMeasureDigit;
 end;
 end;
 
 
 function TProjectData.GetStageDataReadOnly: Boolean;
 function TProjectData.GetStageDataReadOnly: Boolean;
@@ -1866,12 +1910,25 @@ procedure TProjectData.CopyPreData;
       ExecuteSql(Format(sCopySql, [FProjProperties.PhaseCount, FProjProperties.PhaseCount - 1]));
       ExecuteSql(Format(sCopySql, [FProjProperties.PhaseCount, FProjProperties.PhaseCount - 1]));
   end;
   end;
 
 
+  procedure CopyPreOMPhaseDetail;
+  const
+    sCopySql = 'Insert Into OMPhaseDetail (ID, PhaseID, StageID,' +
+               '    PreTotalPrice, CurTotalPrice, EndTotalPrice)' +
+               '  Select ID, %d, 0, PreTotalPrice + CurTotalPrice, 0, PreTotalPrice + CurTotalPrice' +
+               '  From OMPhaseDetail Where (PhaseID = %d) and (StageID = -1)';
+  begin
+    if FProjProperties.PhaseCount > 1 then
+      ExecuteSql(Format(sCopySql, [FProjProperties.PhaseCount, FProjProperties.PhaseCount - 1]));
+  end;
+
 begin
 begin
   CopyPreGLPrice;
   CopyPreGLPrice;
+  CopyPreOMPhaseDetail;
   PhaseData.CopyPreData;
   PhaseData.CopyPreData;
   ProjectGLData.LoadCurPhaseInfoPrice;
   ProjectGLData.LoadCurPhaseInfoPrice;
   ProjectGLData.LoadStagePM_CalcData;
   ProjectGLData.LoadStagePM_CalcData;
   FProjectGLData.RefreshGatherData;
   FProjectGLData.RefreshGatherData;
+  FOtherMeasurePhaseData.LoadCurStageData;
   BillsMeasureData.ResetTreeNodeStageRec;
   BillsMeasureData.ResetTreeNodeStageRec;
 end;
 end;
 
 
@@ -1883,8 +1940,10 @@ end;
 procedure TProjectData.SetStageIndex(const Value: Integer);
 procedure TProjectData.SetStageIndex(const Value: Integer);
 begin
 begin
   FProjectGLData.Save;
   FProjectGLData.Save;
+  FOtherMeasurePhaseData.Save;
   FPhaseData.StageIndex := Value;
   FPhaseData.StageIndex := Value;
   FProjectGLData.LoadStagePM_CalcData;
   FProjectGLData.LoadStagePM_CalcData;
+  FOtherMeasurePhaseData.LoadCurStageData;
 end;
 end;
 
 
 procedure TProjectData.ClearReportCacheData;
 procedure TProjectData.ClearReportCacheData;
@@ -1955,4 +2014,28 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
+procedure TProjectData.OpenForGather(const AFileName: string;
+  APhaseIndex: Integer = -1);
+begin
+  FProjectID := -1;
+  UnZipFile(AFileName, TempPath);
+  FConnection.Open(MainFileName);
+  UpdateProjectDataBase;
+  FProjProperties.Open(FConnection.Connection);
+  UpdateOldData;
+  FBillsData.Open(FConnection.Connection);
+  FBillsCompileData.Open;
+  FDealPaymentData.Open(FConnection.Connection);
+  FBGLData.Open(FConnection.Connection);
+  if ProjProperties.PhaseCount > 0 then
+  begin
+    if (APhaseIndex <= ProjProperties.PhaseCount) and (APhaseIndex > 0) then
+      FPhaseIndex := APhaseIndex
+    else
+      FPhaseIndex := ProjProperties.PhaseCount;
+    FPhaseData.SimpleOpen2(Format('%sPhase%d.dat', [TempPath, FPhaseIndex]));
+  end;
+  FBillsMeasureData.ResetTreeNodeStageRec;
+end;
+
 end.
 end.

+ 3 - 0
Units/UpdateDataBase.pas

@@ -98,6 +98,9 @@ begin
     Updater.AddTableDef(SProjectGL, @tdProjectGL, Length(tdProjectGL), False, False);
     Updater.AddTableDef(SProjectGL, @tdProjectGL, Length(tdProjectGL), False, False);
     Updater.AddTableDef(SGLPrice, @tdGLPrice, Length(tdGLPrice), False, False);
     Updater.AddTableDef(SGLPrice, @tdGLPrice, Length(tdGLPrice), False, False);
     Updater.AddTableDef(SDetailGL, @tdDetailGL, Length(tdDetailGL), False, False);
     Updater.AddTableDef(SDetailGL, @tdDetailGL, Length(tdDetailGL), False, False);
+    Updater.AddTableDef(SOtherMeasureOnce, @tdOtherMeasureOnce, Length(tdOtherMeasureOnce), False, False);
+    Updater.AddTableDef(SOtherMeasurePhase, @tdOtherMeasurePhase, Length(tdOtherMeasurePhase), False, False);
+    Updater.AddTableDef(SOMPhaseDetail, @tdOMPhaseDetail, Length(tdOMPhaseDetail), False, False);
     Updater.ExcuteUpdate;
     Updater.ExcuteUpdate;
   finally
   finally
     Updater.Free;
     Updater.Free;

+ 27 - 2
Units/UtilMethods.pas

@@ -4,8 +4,8 @@ interface
 
 
 uses
 uses
   Controls, ZhAPI, ActnList, ZjIDTree, DB, ZjGridDBA, ZjGrid, Windows, Messages,
   Controls, ZhAPI, ActnList, ZjIDTree, DB, ZjGridDBA, ZjGrid, Windows, Messages,
-  sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math;
-  
+  sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math, ADODB;
+
 type
 type
   TBookmarkRefreshEvent = procedure (AExpandFrame: Boolean) of object;
   TBookmarkRefreshEvent = procedure (AExpandFrame: Boolean) of object;
 
 
@@ -21,6 +21,8 @@ type
 
 
   {DataBase Rela}
   {DataBase Rela}
   function GetsdDataSetNewID(ADataSet: TsdDataSet; const AIndex: string): Integer;
   function GetsdDataSetNewID(ADataSet: TsdDataSet; const AIndex: string): Integer;
+  procedure ExecuteSql(AConnection: TADOConnection; const ASql: string);
+  function QueryData(AConnection: TADOConnection; const ASql: string): TADOQuery;
 
 
   {Message}
   {Message}
   procedure WarningMessage(const AMsg: string; AHandle: THandle = 0);
   procedure WarningMessage(const AMsg: string; AHandle: THandle = 0);
@@ -181,6 +183,29 @@ begin
     Result := 1;
     Result := 1;
 end;
 end;
 
 
+procedure ExecuteSql(AConnection: TADOConnection; const ASql: string);
+var
+  vQuery: TADOQuery;
+begin
+  vQuery := TADOQuery.Create(nil);
+  try
+    vQuery.Connection := AConnection;
+    vQuery.SQL.Add(ASql);
+    vQuery.ExecSQL;
+  finally
+    vQuery.Free;
+  end;
+end;
+
+function QueryData(AConnection: TADOConnection; const ASql: string): TADOQuery;
+begin
+  Result := TADOQuery.Create(nil);
+  Result.Connection := AConnection;
+  Result.SQL.Clear;
+  Result.SQL.Add(ASql);
+  Result.Open;
+end;
+
 {Message}
 {Message}
 
 
 function GetValidHandle(AHandle: THandle = 0): THandle;
 function GetValidHandle(AHandle: THandle = 0): THandle;