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