Forráskód Böngészése

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

MaiXinRong 8 éve
szülő
commit
f6bc00f9ee
44 módosított fájl, 2425 hozzáadás és 107 törlés
  1. 14 0
      DataModules/PHPWebDm.pas
  2. 239 0
      DataModules/ReportManagerDM.dfm
  3. 759 0
      DataModules/ReportManagerDM.pas
  4. 2 2
      Dprs/CSL/Measure_Cloud.dof
  5. 4 1
      Dprs/CSL/Measure_Cloud.dpr
  6. BIN
      Dprs/CSL/Measure_Cloud.res
  7. 2 2
      Dprs/GSZG/Measure_Cloud.dof
  8. 6 1
      Dprs/GSZG/Measure_Cloud.dpr
  9. BIN
      Dprs/GSZG/Measure_Cloud.res
  10. 2 2
      Dprs/Pro/Measure.dof
  11. 6 1
      Dprs/Pro/Measure.dpr
  12. BIN
      Dprs/Pro/Measure.res
  13. 2 2
      Dprs/Pro/Measure_Cloud.dof
  14. 6 1
      Dprs/Pro/Measure_Cloud.dpr
  15. BIN
      Dprs/Pro/Measure_Cloud.res
  16. 2 2
      Dprs/Pro/Measure_GuangDong.dof
  17. 6 1
      Dprs/Pro/Measure_GuangDong.dpr
  18. BIN
      Dprs/Pro/Measure_GuangDong.res
  19. 2 2
      Dprs/Pro/Measure_GuangDong_Cloud.dof
  20. 6 1
      Dprs/Pro/Measure_GuangDong_Cloud.dpr
  21. BIN
      Dprs/Pro/Measure_GuangDong_Cloud.res
  22. 2 2
      Dprs/Pro/Measure_GuangDong_TZ.dof
  23. 6 1
      Dprs/Pro/Measure_GuangDong_TZ.dpr
  24. BIN
      Dprs/Pro/Measure_GuangDong_TZ.res
  25. 2 2
      Dprs/Pro/Measure_TZ.dof
  26. 6 1
      Dprs/Pro/Measure_TZ.dpr
  27. BIN
      Dprs/Pro/Measure_TZ.res
  28. 2 2
      Dprs/Trail/Measure.dof
  29. 6 1
      Dprs/Trail/Measure.dpr
  30. BIN
      Dprs/Trail/Measure.res
  31. 2 2
      Dprs/Trail/Measure_GuangDong.dof
  32. 6 1
      Dprs/Trail/Measure_GuangDong.dpr
  33. BIN
      Dprs/Trail/Measure_GuangDong.res
  34. 3 3
      Forms/MainFrm.dfm
  35. 1 1
      Forms/MainFrm.pas
  36. 105 0
      Forms/ReportHistoryFrm.dfm
  37. 89 0
      Forms/ReportHistoryFrm.pas
  38. 659 0
      Forms/ReportManagerFrm.dfm
  39. 265 0
      Forms/ReportManagerFrm.pas
  40. 66 59
      Forms/ReportsFrm.dfm
  41. 48 4
      Forms/ReportsFrm.pas
  42. 18 1
      Frames/ProjectFme.pas
  43. 1 1
      Frames/ProjectManagerFme.pas
  44. 80 8
      Units/UtilMethods.pas

+ 14 - 0
DataModules/PHPWebDm.pas

@@ -80,6 +80,8 @@ type
       var AOutRecords: TOVArr): Integer;
   public
     function SystemDateTime: TDateTime;
+    function Search(AURL: string; var AOutStrs: array of string): Integer; overload;
+    function Search(AURL: string; var AOutRecords: TOVArr): Integer; overload;
     function Search(AURL: string; AInFields, AInValues: array of string; var AOutStrs: array of string): Integer; overload;
     function Search(AURL: string; AInFields, AInValues: array of string; var AOutRecords: TOVArr): Integer; overload;
     function Search(AURL: string; AInFields, AInValues: array of string; var AOutStrs: array of string ; var AOutRecords: TOVArr): Integer; overload;
@@ -954,6 +956,18 @@ begin
   end;
 end;
 
+function TPHPWeb.Search(AURL: string; var AOutStrs: array of string): Integer;
+var vA: TOVArr;
+begin
+  Result := CustomSearch(AURL, [], [], 0, AOutStrs, vA);
+end;
+
+function TPHPWeb.Search(AURL: string; var AOutRecords: TOVArr): Integer;
+var vA: array of string;
+begin
+  Result := CustomSearch(AURL, [], [], 1, vA, AOutRecords);
+end;
+
 initialization
 
 finalization

+ 239 - 0
DataModules/ReportManagerDM.dfm

@@ -0,0 +1,239 @@
+object Reports: TReports
+  OldCreateOrder = False
+  OnCreate = DataModuleCreate
+  OnDestroy = DataModuleDestroy
+  Left = 765
+  Top = 357
+  Height = 283
+  Width = 280
+  object cdsOnline: TClientDataSet
+    Active = True
+    Aggregates = <>
+    FieldDefs = <
+      item
+        Name = 'ID'
+        DataType = ftInteger
+      end
+      item
+        Name = 'Category'
+        DataType = ftString
+        Size = 100
+      end
+      item
+        Name = 'Name'
+        DataType = ftString
+        Size = 100
+      end
+      item
+        Name = 'LocalVer'
+        DataType = ftString
+        Size = 20
+      end
+      item
+        Name = 'State'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'History'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'NewestVer'
+        DataType = ftString
+        Size = 20
+      end>
+    IndexDefs = <>
+    Params = <>
+    StoreDefs = True
+    Left = 112
+    Top = 16
+    Data = {
+      CC0000009619E0BD010000001800000007000000000003000000CC0002494404
+      000100000000000843617465676F727901004900000001000557494454480200
+      02006400044E616D650100490000000100055749445448020002006400084C6F
+      63616C5665720100490000000100055749445448020002001400055374617465
+      0100490000000100055749445448020002000A0007486973746F727901004900
+      00000100055749445448020002000A00094E6577657374566572010049000000
+      01000557494454480200020014000000}
+    object cdsOnlineID: TIntegerField
+      FieldName = 'ID'
+    end
+    object cdsOnlineCategory: TStringField
+      FieldName = 'Category'
+      Size = 100
+    end
+    object cdsOnlineName: TStringField
+      FieldName = 'Name'
+      Size = 100
+    end
+    object cdsOnlineVer: TStringField
+      FieldName = 'LocalVer'
+    end
+    object cdsOnlineState: TStringField
+      FieldName = 'State'
+      Size = 10
+    end
+    object cdsOnlineHistory: TStringField
+      FieldName = 'History'
+      Size = 10
+    end
+    object cdsOnlineNewest: TStringField
+      FieldName = 'NewestVer'
+    end
+  end
+  object cdsLocal: TClientDataSet
+    Active = True
+    Aggregates = <>
+    FieldDefs = <
+      item
+        Name = 'ID'
+        DataType = ftInteger
+      end
+      item
+        Name = 'Category'
+        DataType = ftString
+        Size = 100
+      end
+      item
+        Name = 'Name'
+        DataType = ftString
+        Size = 100
+      end
+      item
+        Name = 'LocalVer'
+        DataType = ftString
+        Size = 20
+      end
+      item
+        Name = 'State'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'History'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'NewestVer'
+        DataType = ftString
+        Size = 20
+      end>
+    IndexDefs = <>
+    Params = <>
+    StoreDefs = True
+    Left = 32
+    Top = 16
+    Data = {
+      CC0000009619E0BD010000001800000007000000000003000000CC0002494404
+      000100000000000843617465676F727901004900000001000557494454480200
+      02006400044E616D650100490000000100055749445448020002006400084C6F
+      63616C5665720100490000000100055749445448020002001400055374617465
+      0100490000000100055749445448020002000A0007486973746F727901004900
+      00000100055749445448020002000A00094E6577657374566572010049000000
+      01000557494454480200020014000000}
+    object cdsLocalID: TIntegerField
+      FieldName = 'ID'
+    end
+    object cdsLocalCategory: TStringField
+      FieldName = 'Category'
+      Size = 100
+    end
+    object cdsLocalName: TStringField
+      FieldName = 'Name'
+      Size = 100
+    end
+    object cdsLocalVer: TStringField
+      FieldName = 'LocalVer'
+    end
+    object cdsLocalState: TStringField
+      FieldName = 'State'
+      Size = 10
+    end
+    object cdsLocalHistory: TStringField
+      FieldName = 'History'
+      Size = 10
+    end
+    object cdsLocalNewest: TStringField
+      FieldName = 'NewestVer'
+    end
+  end
+  object cdsCustom: TClientDataSet
+    Active = True
+    Aggregates = <>
+    FieldDefs = <
+      item
+        Name = 'ID'
+        DataType = ftInteger
+      end
+      item
+        Name = 'Category'
+        DataType = ftString
+        Size = 100
+      end
+      item
+        Name = 'Name'
+        DataType = ftString
+        Size = 20
+      end
+      item
+        Name = 'LocalVer'
+        DataType = ftString
+        Size = 20
+      end
+      item
+        Name = 'State'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'History'
+        DataType = ftString
+        Size = 10
+      end
+      item
+        Name = 'NewestVer'
+        DataType = ftString
+        Size = 20
+      end>
+    IndexDefs = <>
+    Params = <>
+    StoreDefs = True
+    Left = 184
+    Top = 16
+    Data = {
+      CC0000009619E0BD010000001800000007000000000003000000CC0002494404
+      000100000000000843617465676F727901004900000001000557494454480200
+      02006400044E616D650100490000000100055749445448020002001400084C6F
+      63616C5665720100490000000100055749445448020002001400055374617465
+      0100490000000100055749445448020002000A0007486973746F727901004900
+      00000100055749445448020002000A00094E6577657374566572010049000000
+      01000557494454480200020014000000}
+    object cdsCustomID: TIntegerField
+      FieldName = 'ID'
+    end
+    object cdsCustomCategory: TStringField
+      FieldName = 'Category'
+      Size = 100
+    end
+    object cdsCustomName: TStringField
+      FieldName = 'Name'
+    end
+    object cdsCustomLocalVer: TStringField
+      FieldName = 'LocalVer'
+    end
+    object cdsCustomState: TStringField
+      FieldName = 'State'
+      Size = 10
+    end
+    object cdsCustomHistory: TStringField
+      FieldName = 'History'
+      Size = 10
+    end
+    object cdsCustomNewestVer: TStringField
+      FieldName = 'NewestVer'
+    end
+  end
+end

+ 759 - 0
DataModules/ReportManagerDM.pas

@@ -0,0 +1,759 @@
+unit ReportManagerDM;
+
+interface
+
+uses
+  SysUtils, Classes, DB, DBClient, Contnrs, UtilMethods, Archiver;
+
+const
+  P6 = '4鲐;d煬0痤踿8镊<x伡垁Zx鷹?	�';    // 报表模板文件密码
+  PA6: array [0..31] of Byte =
+    ($34, $F6, $D8, $0C, $3B, $64, $9F, $AC, $30, $08, $F0, $EE, $DB, $80, $38, $C4,
+     $F7, $3C, $78, $81, $BC, $88, $80, $5A, $78, $FA, $97, $8D, $1E, $09, $FA, $FD);
+
+type
+  TChangeType = (ctAdd, ctEdit);
+
+  TReport = class(TObject)
+  private
+    FID: Integer;
+    FLocalVer: string;
+    FName: string;
+    FFileName: string;
+    FCategory: string;
+    FNewestVer: string;
+    FHistoryVer1: string;
+    FHistoryVer2: string;
+//    FHistoryURL2: string;
+//    FHistoryURL1: string;
+//    FNewestURL: string;
+    FHistoryMemo2: string;
+    FHistoryMemo1: string;
+    FNewestMemo: string;
+    FKey: string;
+    FArchiver: TArchiver;
+    FOwner: TObject;
+    FArea: string;
+    procedure SetID(const Value: Integer);
+    procedure SetLocalVer(const Value: string);
+    procedure SetFileName(const Value: string);
+    procedure SetName(const Value: string);
+    procedure SetCategory(const Value: string);
+    procedure SetNewestVer(const Value: string);
+    procedure SetHistoryVer1(const Value: string);
+    procedure SetHistoryVer2(const Value: string);
+//    procedure SetHistoryURL1(const Value: string);
+//    procedure SetHistoryURL2(const Value: string);
+//    procedure SetNewestURL(const Value: string);
+    procedure SetHistoryMemo1(const Value: string);
+    procedure SetHistoryMemo2(const Value: string);
+    procedure SetNewestMemo(const Value: string);
+    procedure ArchiverEnterCryptKey(Sender: TObject; var Key: String);
+    procedure ArchiverRequestCryptKey(Sender: TObject; var Key: String);
+    procedure SetOwner(const Value: TObject);
+    function GetPath: string;
+    procedure SetArea(const Value: string);
+  public
+    property ID: Integer read FID write SetID;
+    property LocalVer: string read FLocalVer write SetLocalVer;
+    property Path: string read GetPath;
+
+    property NewestVer: string read FNewestVer write SetNewestVer;        // 线上最新版本
+//    property NewestURL: string read FNewestURL write SetNewestURL;
+    property NewestMemo: string read FNewestMemo write SetNewestMemo;
+
+    property HistoryVer1: string read FHistoryVer1 write SetHistoryVer1;  // 线上历史版本次新
+//    property HistoryURL1: string read FHistoryURL1 write SetHistoryURL1;
+    property HistoryMemo1: string read FHistoryMemo1 write SetHistoryMemo1;
+
+    property HistoryVer2: string read FHistoryVer2 write SetHistoryVer2;  // 线上历史版本次次新
+//    property HistoryURL2: string read FHistoryURL2 write SetHistoryURL2;
+    property HistoryMemo2: string read FHistoryMemo2 write SetHistoryMemo2;
+//    property Name: string read FName write SetName;         // 文件头中的文件名,仅用于大报表界面显示
+    property Area: string read FArea write SetArea;         // 全国1,广东2,通用3
+    property Category: string read FCategory write SetCategory;
+    property FileName: string read FFileName write SetFileName;     // 硬盘上的物理文件名
+
+    property Owner: TObject read FOwner write SetOwner;
+
+    constructor Create;
+    destructor Destroy; override;
+    // AVer报表的版本号
+    function Update(AVer: string): Boolean;
+    function EncryptReport: Boolean;
+    procedure DecryptReport;
+    procedure GetHistoryVer;
+  end;
+
+  TReports = class(TDataModule)
+    cdsOnline: TClientDataSet;
+    cdsOnlineCategory: TStringField;
+    cdsOnlineName: TStringField;
+    cdsOnlineVer: TStringField;
+    cdsOnlineState: TStringField;
+    cdsOnlineHistory: TStringField;
+    cdsOnlineNewest: TStringField;
+    cdsOnlineID: TIntegerField;
+    cdsLocal: TClientDataSet;
+    cdsLocalID: TIntegerField;
+    cdsLocalCategory: TStringField;
+    cdsLocalName: TStringField;
+    cdsLocalVer: TStringField;
+    cdsLocalState: TStringField;
+    cdsLocalHistory: TStringField;
+    cdsLocalNewest: TStringField;
+    cdsCustom: TClientDataSet;
+    cdsCustomID: TIntegerField;
+    cdsCustomName: TStringField;
+    cdsCustomCategory: TStringField;
+    cdsCustomLocalVer: TStringField;
+    cdsCustomState: TStringField;
+    cdsCustomHistory: TStringField;
+    cdsCustomNewestVer: TStringField;
+    procedure DataModuleCreate(Sender: TObject);
+    procedure DataModuleDestroy(Sender: TObject);
+  private
+    { Private declarations }
+    FList: TObjectList;
+    FPath: string;
+    // AChangeType: 1增加 2修改
+    procedure ChangeRec(ACDS: TClientDataSet; AReport: TReport; AChangeType: TChangeType);
+  public
+    { Public declarations }
+    procedure Load;
+    function LoadCustom(ACode: string): Boolean;
+    procedure Refresh(AReport: TReport; ANeedAddLocal: Boolean);
+    procedure CategoryList(AList: TStrings);
+    procedure CancelFilterCategory;
+    procedure FilterCategory(ACategory: string);
+    function FindReprot(AID: Integer): TReport;
+
+    property Path: string read FPath;
+  end;
+
+
+
+implementation
+
+  uses Variants, ScFileArchiverConsts, ArchiverRoot, PHPWebDm, CslJson,
+    XMLDoc, XMLIntf, Windows, Math, Forms;
+
+const G_ReportDNS = 'http://vc.6jlzf.cn';   // 最后不能带"/"
+
+
+var
+  Reports: TReports;
+
+{$R *.dfm}
+
+function ByteArrayToStr(AByteArray: array of Byte; ALength: Integer): string;
+begin
+  SetString(Result, PChar(@AByteArray[0]), ALength);
+end;
+
+{ TReport }
+
+constructor TReport.Create;
+begin
+  FArchiver := TArchiver.Create(nil);
+  FArchiver.Options := FArchiver.Options - [oOpenSingleSegment] + [oMaintainFileDirectory, oCrypt];
+  FArchiver.OnEnterCryptKey := ArchiverEnterCryptKey;
+  FArchiver.OnRequestCryptKey := ArchiverRequestCryptKey;
+end;
+
+destructor TReport.Destroy;
+begin
+  FArchiver.Free;
+  inherited;
+end;
+
+procedure TReport.SetCategory(const Value: string);
+begin
+  FCategory := Value;
+end;
+
+procedure TReport.SetFileName(const Value: string);
+begin
+  FFileName := Value;
+end;
+
+procedure TReport.SetID(const Value: Integer);
+begin
+  FID := Value;
+end;
+
+procedure TReport.SetName(const Value: string);
+begin
+  FName := Value;
+end;
+
+procedure TReport.SetLocalVer(const Value: string);
+begin
+  FLocalVer := Value;
+end;
+
+procedure TReport.SetNewestVer(const Value: string);
+begin
+  FNewestVer := Value;
+end;
+
+procedure TReports.DataModuleCreate(Sender: TObject);
+begin
+  FPath := ExtractFilePath(ParamStr(0)) + 'ReportTemplates\';
+  FList := TObjectList.Create;
+  
+  Load;
+end;
+
+procedure TReports.DataModuleDestroy(Sender: TObject);
+begin
+  FList.Free;
+end;
+
+procedure TReports.Load;
+var
+  vReport: TReport;
+  SRec: TSearchRec;
+  iRetval, i, iID: Integer;
+  FOnlineAry, VersArr: TOVArr;
+  vHead7: TScFile7Head;
+  vSL: TStringList;
+  sProp, sURL, sIDs, sArea: string;
+  vFS: TFileStream;
+begin
+  if FList.Count > 0 then
+    FList.Clear;
+
+  // 先读本地的
+  vSL := TStringList.Create;
+  iRetval := FindFirst(FPath + '*.srt', faAnyFile, sRec);
+  try
+    while iRetval = 0 do
+    begin
+      if (SRec.Attr and faDirectory) = 0 then
+      begin
+        vFS := TFileStream.Create(FPath + SRec.Name, fmOpenRead);
+        try
+          vFS.Read(vHead7, SizeOf(vHead7));
+        finally
+          vFS.Free;
+        end;
+
+        SetString(sProp, vHead7.ReportProperties, 256);
+        if sProp <> '' then
+        begin
+          vSL.Text := sProp;
+        end;
+
+        vReport := TReport.Create;
+        vReport.Owner := Self;
+        vReport.ID := StrToInt(vSL.Values['报表ID']);
+        vReport.Category := vSL.Values['分类名称'];
+        vReport.FileName := SRec.Name;
+        vReport.LocalVer := vSL.Values['版本'];
+        FList.Add(vReport);
+      end;
+      iRetval := FindNext(SRec);
+    end;
+
+  finally
+    SysUtils.FindClose(SRec);
+    vSL.Free;
+  end;
+
+  // 对比线上最新版本号,看是否需更新
+  if FList.Count > 0 then
+  begin
+    cdsLocal.DisableControls;
+    cdsLocal.First;
+    while cdsLocal.RecordCount > 0 do
+      cdsLocal.Delete;
+
+    try
+      for i := 0 to FList.Count - 1 do
+      sIDs := sIDs + ',' + IntToStr(TRePort(FList[i]).ID);
+
+      Delete(sIDs, 1, 1);
+      sURL := G_ReportDNS + '/api/report/update/get';
+
+      case PHPWeb.Search(sURL, ['idlist'], [sIDs], VersArr) of
+        1:
+        begin
+          for i := 0 to Length(VersArr) - 1 do
+          begin
+            iID := StrToInt(VersArr[i, 0]);
+            vReport := FindReprot(iID);
+            if vReport <> nil then
+              vReport.NewestVer := VersArr[i, 1];
+            ChangeRec(cdsLocal, vReport, ctAdd);
+          end;
+        end
+        else
+        begin
+          Application.MessageBox(PChar('报表更新检测失败,请检查网络!') , '提示', MB_OK + MB_ICONWARNING);
+          Exit;
+        end;
+      end;
+    finally
+      cdsLocal.First;
+      cdsLocal.EnableControls;
+    end;
+  end;
+
+  // 线上报表按地区获取;线下广东和全国分开装,报表不会混合,所以本地无需作区分
+  {$IFDEF _mGuangDong}
+     sArea := '2';   // 广东
+  {$ELSE}
+     sArea := '1';   // 全国
+  {$ENDIF}
+  PHPWeb.Search(G_ReportDNS + '/api/getreportmsg', ['areacate'], [sArea], FOnlineAry);
+  if Length(FOnlineAry) > 0 then
+  begin
+    cdsOnline.DisableControls;
+    cdsOnline.First;
+    while cdsOnline.RecordCount > 0 do
+      cdsOnline.Delete;
+
+    try
+      for i := Low(FOnlineAry) to High(FOnlineAry) do
+      begin
+        iID := StrToInt(FOnlineAry[i, 0]);
+        vReport := FindReprot(iID);
+
+        // 线上有,本地无
+        if vReport = nil then
+        begin
+          vReport := TReport.Create;
+          vReport.Owner := Self;
+          vReport.ID := iID;
+          vReport.FileName := CheckExt(FOnlineAry[i, 1], '.srt');
+          vReport.Area := FOnlineAry[i, 2];
+          vReport.NewestVer := FOnlineAry[i, 3];
+          vReport.Category := FOnlineAry[i, 5];
+          vReport.NewestMemo := FOnlineAry[i, 6];
+          vReport.LocalVer := '';
+
+          FList.Add(vReport);
+        end;
+
+        ChangeRec(cdsOnline, vReport, ctAdd);
+      end;
+    finally
+      cdsOnline.First;
+      cdsOnline.EnableControls;
+    end;
+  end;
+end;
+
+procedure TReports.CategoryList(AList: TStrings);
+var sCgy: string;
+  i: Integer;
+begin
+  AList.Clear;
+  AList.Add('按类别筛选');
+  for i := 0 to FList.Count - 1 do
+  begin
+    sCgy := TReport(FList[i]).Category;
+    if AList.IndexOf(sCgy) < 0 then
+      AList.Add(sCgy);
+  end;
+end;
+
+procedure TReports.CancelFilterCategory;
+begin
+  cdsOnline.Filtered := False;
+end;
+
+procedure TReports.FilterCategory(ACategory: string);
+begin
+  cdsOnline.Filter := Format('Category=''%s''', [ACategory]);
+  cdsOnline.Filtered := True;
+end;
+
+procedure TReport.SetHistoryVer1(const Value: string);
+begin
+  FHistoryVer1 := Value;
+end;
+
+procedure TReport.SetHistoryVer2(const Value: string);
+begin
+  FHistoryVer2 := Value;
+end;
+
+//procedure TReport.SetHistoryURL1(const Value: string);
+//begin
+//  FHistoryURL1 := Value;
+//end;
+//
+//procedure TReport.SetHistoryURL2(const Value: string);
+//begin
+//  FHistoryURL2 := Value;
+//end;
+//
+//procedure TReport.SetNewestURL(const Value: string);
+//begin
+//  FNewestURL := Value;
+//end;
+
+function TReports.FindReprot(AID: Integer): TReport;
+var i: Integer;
+  vReport: TReport;
+begin
+  Result := nil;
+  for i := 0 to FList.Count - 1 do
+  begin
+    vReport := TReport(FList[i]);
+    if vReport.ID = AID then
+    begin
+      Result := vReport;
+      Break;
+    end;
+  end;
+end;
+
+procedure TReport.SetHistoryMemo1(const Value: string);
+begin
+  FHistoryMemo1 := Value;
+end;
+
+procedure TReport.SetHistoryMemo2(const Value: string);
+begin
+  FHistoryMemo2 := Value;
+end;
+
+procedure TReport.SetNewestMemo(const Value: string);
+begin
+  FNewestMemo := Value;
+end;
+
+function TReport.Update(AVer: string): Boolean;
+var vArr: array of string;
+  sURL, sLocalFile: string;
+  ANeedAddLocal: Boolean;
+begin
+  Result := False;
+  vArr := VarArrayOf(['downloadurl']);
+  sURL := Format(G_ReportDNS + '/api/downloadurl/%d/%s', [FID, AVer]);
+  PHPWeb.Search(sURL, vArr);
+  sLocalFile := Path + CheckExt(FFileName, '.xml');
+
+  if PHPweb.DownFile(vArr[0], sLocalFile) then
+  begin
+    if EncryptReport then
+    begin
+      ANeedAddLocal := FLocalVer = '';
+      FLocalVer := AVer;
+      TReports(FOwner).Refresh(Self, ANeedAddLocal);
+      Result := True;
+    end;
+  end
+  else
+    Application.MessageBox(PChar('报表文件下载失败,请重试!') , '提示', MB_OK + MB_ICONWARNING);
+end;
+
+
+function TReport.EncryptReport: Boolean;
+
+  function GetReportPropertyFromXML(AFile: string): string;
+  var
+    I: Integer;
+    xmlDoc: IXMLDocument;
+    xmlNode: IXMLNode;
+    slstProperties: TStringList;
+  begin
+    slstProperties := TStringList.Create;
+    xmlDoc := TXMLDocument.Create(nil) as IXMLDocument;
+    try
+      xmlDoc.LoadFromFile(AFile);
+      xmlNode := xmlDoc.DocumentElement;
+      if xmlNode <> nil then
+      begin
+        for I := 0 to xmlNode.AttributeNodes.Count - 1 do
+        begin
+          slstProperties.Values[xmlNode.AttributeNodes[I].NodeName] := xmlNode.AttributeNodes[I].NodeValue;
+        end;
+      end;
+      Result := slstProperties.Text;
+    finally
+      slstProperties.Free;
+    end;
+  end;
+
+  procedure WriteReportProp(AFile: string; AProp: string);
+  var vHead7: TScFile7Head;
+    sTemp: string;
+    I: Integer;
+    vFS, vTempFS: TFileStream;
+  begin
+    ZeroMemory(@vHead7, Sizeof(TScFile7Head));
+    vHead7.ProductName := 'SmartCost';
+    vHead7.ProductVersion := '8.0';
+    vHead7.FileType := 6;
+    vHead7.ProjectFileType := 0;
+    vHead7.IsSysFile := True;
+    vHead7.ReadOnly := False;
+    vHead7.HasPassword := False;
+    vHead7.Password := '';
+    vHead7.FileVersion := '1.0.0.1';
+    if AProp <> '' then
+      StrPLCopy(@(vHead7.ReportProperties[0]), AProp, Length(AProp));
+
+    ZeroMemory(@(vHead7.Reserve[0]), Length(vHead7.Reserve));
+    for I := 0 to Length(vHead7.RandomData) - 1 do
+      vHead7.RandomData[I] := Char(RandomRange(0, 255));
+    vFS := TFileStream.Create(AFile, fmOpenReadWrite);
+    sTemp := ExtractFilePath(AFile) + TempName(16);
+    vTempFS := TFileStream.Create(sTemp, fmCreate);
+    try
+      vTempFS.Seek($00, soFromBeginning);
+      vTempFS.Write(vHead7, Sizeof(TScFile7Head));
+      vTempFS.CopyFrom(vFS, vFS.Size);
+    finally
+      vTempFS.Free;
+      vFS.Free;
+      CopyFile(PChar(sTemp), PCHar(AFile), False);
+      DeleteFile(PChar(sTemp));
+    end;
+  end;
+
+var sSource, sXMLProp, sTargetFile, sTempFile: string;
+begin
+  Result := False;
+  sSource := Path + CheckExt(FileName, '.xml');
+  if not FileExists(sSource) then
+    Exit;
+
+  try
+    try
+      FKey := ByteArrayToStr(PA6, Length(PA6));
+      sXMLProp := GetReportPropertyFromXML(sSource);
+
+      sTargetFile := CheckExt(sSource, '.srt');
+      if FileExists(sTargetFile) then
+        DeleteFile(PChar(sTargetFile));
+
+      FileSetAttr(sSource, 0);
+      sTempFile := sSource + '.~temp~';
+      CopyFile(PChar(sSource), PChar(sTempFile), False);
+
+      FArchiver.FileName := sTargetFile;
+      FArchiver.OpenNew;
+      FArchiver.AddFile(sTempFile);
+      FArchiver.Close;
+
+      WriteReportProp(sTargetFile, sXMLProp);
+      Result := True;
+    except
+      Application.MessageBox(PChar('报表文件损坏,加密失败无法使用,请重试!') , '提示', MB_OK + MB_ICONWARNING);
+    end;
+  finally
+    DeleteFile(PChar(sTempFile));
+    DeleteFile(PChar(sSource));
+  end;
+end;
+
+procedure TReport.ArchiverEnterCryptKey(Sender: TObject; var Key: String);
+begin
+  Key := FKey;
+end;
+
+procedure TReport.ArchiverRequestCryptKey(Sender: TObject;
+  var Key: String);
+begin
+  Key := FKey;
+end;
+
+procedure TReport.DecryptReport;
+var
+  sSource, sTemp, sDcyt: string;
+  TF, TS: TFileStream;
+  idx: Integer;
+  IsEmpty: Boolean;
+begin
+  sSource := Path + FileName;
+  if not FileExists(sSource) then
+    Exit;
+  FKey := ByteArrayToStr(PA6, Length(PA6));
+  sDcyt := ChangeFileExt(sSource, '.xml');
+  sTemp := Path + 'TempReport.~temp~';
+
+  FileSetAttr(sSource, 0);
+
+  TS := TFileStream.Create(sSource, fmOpenRead);
+  TF := TFileStream.Create(sTemp, fmCreate);
+  try
+    TS.Position := SizeOf(TScFile7Head);
+    TF.CopyFrom(TS, TS.Size - SizeOf(TScFile7Head));
+  finally
+    TS.Free;
+    TF.Free;
+  end;
+
+  try
+    FArchiver.FileName := sTemp;
+    FArchiver.Open;
+    FArchiver.EnumerateFiles;
+    if FArchiver.FileCount <=0 then
+      raise Exception.Create('读取文件出错!');
+    idx := FArchiver.FileCount - 1;
+
+    with FArchiver.Header do
+      IsEmpty := (ArchiveInfo.FileCount + SegmentInfo.FileCount) = 0;
+
+    if IsEmpty or (idx <= -1) then
+      raise Exception.Create('文件中没有数据!');
+
+    try
+      with FArchiver.Files[idx].FileEntry do
+        FArchiver.ExtractFileTo(Segment, Offset, ArchiveInfo.CompressedSize, sDcyt);
+    except
+      raise;
+    end;
+  finally
+    FArchiver.Close;
+    DeleteFile(PChar(sTemp));
+    DeleteFile(PChar(sSource));
+  end;
+end;
+
+procedure TReports.Refresh(AReport: TReport; ANeedAddLocal: Boolean);
+begin
+  if ANeedAddLocal then
+    ChangeRec(cdsLocal, AReport, ctAdd)
+  else
+    ChangeRec(cdsLocal, AReport, ctEdit);
+
+  ChangeRec(cdsOnline, AReport, ctEdit);
+  ChangeRec(cdsCustom, AReport, ctEdit);
+end;
+
+procedure TReport.SetOwner(const Value: TObject);
+begin
+  FOwner := Value;
+end;
+
+function TReport.GetPath: string;
+begin
+  Result := TReports(FOwner).Path;
+end;
+
+procedure TReports.ChangeRec(ACDS: TClientDataSet; AReport: TReport; AChangeType: TChangeType);
+begin
+  if AChangeType = ctAdd then
+    ACDS.Append
+  else if AChangeType = ctEdit then
+  begin
+    if ACDS.Locate('ID', AReport.ID, []) then
+      ACDS.Edit
+    else
+      Exit;
+  end;
+
+  ACDS.FieldByName('ID').AsInteger := AReport.ID;
+  ACDS.FieldByName('Category').AsString := AReport.Category;
+  ACDS.FieldByName('Name').AsString := AReport.FileName;
+  ACDS.FieldByName('LocalVer').AsString := AReport.LocalVer;
+  ACDS.FieldByName('NewestVer').AsString := AReport.NewestVer;
+
+  if AReport.LocalVer = '' then
+    ACDS.FieldByName('State').AsString := '下载'
+  else
+  begin
+    if SameText(AReport.LocalVer, AReport.NewestVer) then
+      ACDS.FieldByName('State').AsString := '已下载'
+    else
+      ACDS.FieldByName('State').AsString := '更新';
+  end;
+
+  ACDS.FieldByName('History').AsString := '查看';
+  ACDS.Post;
+end;
+
+procedure TReport.GetHistoryVer;
+var vArr: TOVArr;
+  sURL, sLocalFile: string;
+begin
+  sURL := Format('%s/api/getversionmsg/%d', [G_ReportDNS, FID]);
+  PHPWeb.Search(sURL, vArr);
+
+  try
+    if Length(vArr) > 0 then
+    begin
+      FNewestVer := vArr[0, 0];
+      FNewestMemo := ReplaceChars(vArr[0, 1]);
+//      FNewestURL := vArr[0, 2];
+    end;
+
+    if Length(vArr) > 1 then
+    begin
+      FHistoryVer1 := vArr[1, 0];
+      FHistoryMemo1 := ReplaceChars(vArr[1, 1]);
+//      FHistoryURL1 := vArr[1, 2];
+    end;
+
+    if Length(vArr) > 2 then
+    begin
+      FHistoryVer2 := vArr[2, 0];
+      FHistoryMemo2 := ReplaceChars(vArr[2, 1]);
+//      FHistoryURL2 := vArr[2, 2];
+    end;
+  except
+    Application.MessageBox('报表文件有错误!', '提示', MB_OK + MB_ICONWARNING);
+  end;
+end;
+
+function TReports.LoadCustom(ACode: string): Boolean;
+var FOnlineAry: TOVArr;
+  i, iID: Integer;
+  vReport: TReport;
+begin
+  Result := False;
+
+  PHPWeb.Search(G_ReportDNS + '/api/getreportmsg', ['itemcode'], [ACode], FOnlineAry);
+  if Length(FOnlineAry) > 0 then
+  begin
+    cdsCustom.DisableControls;
+    cdsCustom.First;
+    while cdsCustom.RecordCount > 0 do
+      cdsCustom.Delete;
+
+    try
+      for i := Low(FOnlineAry) to High(FOnlineAry) do
+      begin
+        iID := StrToInt(FOnlineAry[i, 0]);
+        vReport := FindReprot(iID);
+
+        // 线上有,本地无
+        if vReport = nil then
+        begin
+          vReport := TReport.Create;
+          vReport.Owner := Self;
+          vReport.ID := iID;
+          vReport.FileName := CheckExt(FOnlineAry[i, 1], '.srt');
+          vReport.Area := FOnlineAry[i, 2];
+          vReport.NewestVer := FOnlineAry[i, 3];
+          vReport.Category := FOnlineAry[i, 5];
+          vReport.NewestMemo := FOnlineAry[i, 6];
+          vReport.LocalVer := '';
+
+          FList.Add(vReport);
+        end;
+
+        ChangeRec(cdsCustom, vReport, ctAdd);
+      end;
+      Result := True;
+    finally
+      cdsCustom.First;
+      cdsCustom.EnableControls;
+    end;
+  end
+  else
+    Application.MessageBox('没有找到该领取码的定制报表!', '提示', MB_OK + MB_ICONINFORMATION);
+end;
+
+procedure TReport.SetArea(const Value: string);
+begin
+  FArea := Value;
+end;
+
+end.

+ 2 - 2
Dprs/CSL/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=3
-Build=1130
+Build=1135
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.3.1130
+FileVersion=3.1.3.1135
 InternalName=
 LegalCopyright=
 LegalTrademarks=

+ 4 - 1
Dprs/CSL/Measure_Cloud.dpr

@@ -225,7 +225,10 @@ uses
   SignReports in '..\..\Units\SignReports.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas' {ReportManagerForm},
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule};
 
 {$R *.res}
 

BIN
Dprs/CSL/Measure_Cloud.res


+ 2 - 2
Dprs/GSZG/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=142
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.142
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/GSZG/Measure_Cloud.dpr

@@ -220,7 +220,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -304,6 +308,7 @@ begin
     if CheckDogExists then
     begin
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end;
     Application.Run;
   end;

BIN
Dprs/GSZG/Measure_Cloud.res


+ 2 - 2
Dprs/Pro/Measure.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=143
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化专业版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.143
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -235,6 +239,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Pro/Measure.res


+ 2 - 2
Dprs/Pro/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=146
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.146
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure_Cloud.dpr

@@ -220,7 +220,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -304,6 +308,7 @@ begin
     if CheckDogExists then
     begin
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end;
     Application.Run;
   end;

BIN
Dprs/Pro/Measure_Cloud.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=144
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东专业版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.144
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure_GuangDong.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -234,6 +238,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Pro/Measure_GuangDong.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=143
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东云版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.143
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure_GuangDong_Cloud.dpr

@@ -219,7 +219,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -265,6 +269,7 @@ begin
     if CheckDogExists then
     begin
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end;
     Application.Run;
   end;

BIN
Dprs/Pro/Measure_GuangDong_Cloud.res


+ 2 - 2
Dprs/Pro/Measure_GuangDong_TZ.dof

@@ -115,7 +115,7 @@ AutoIncBuild=0
 MajorVer=3
 MinorVer=1
 Release=7
-Build=114
+Build=140
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账广东专业版
-FileVersion=3.1.7.114
+FileVersion=3.1.7.140
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure_GuangDong_TZ.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -235,6 +239,7 @@ begin
     begin
 	    HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Pro/Measure_GuangDong_TZ.res


+ 2 - 2
Dprs/Pro/Measure_TZ.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=142
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横0号台账专业版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.142
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Pro/Measure_TZ.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -236,6 +240,7 @@ begin
     begin
 	    HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Pro/Measure_TZ.res


+ 2 - 2
Dprs/Trail/Measure.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=142
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化学习版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.142
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Trail/Measure.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -234,6 +238,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Trail/Measure.res


+ 2 - 2
Dprs/Trail/Measure_GuangDong.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=7
-Build=115
+Build=142
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化广东学习版
-FileVersion=3.1.7.115
+FileVersion=3.1.7.142
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 1
Dprs/Trail/Measure_GuangDong.dpr

@@ -214,7 +214,11 @@ uses
   VirtualTrees in '..\..\..\SmartCost\Components\virtualtree\VirtualTrees.pas',
   TemplateManagerHelper in '..\..\Units\TemplateManagerHelper.pas',
   RenameSignReportFrm in '..\..\Forms\RenameSignReportFrm.pas' {RenameSignReportForm},
-  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule};
+  rmWeiWuZjjlGatherDm in '..\..\DataModules\ReportMemoryDm\rmWeiWuZjjlGatherDm.pas' {rmWeiWuZjjlGatherData: TDataModule},
+  SetGuestFrm in '..\..\Forms\SetGuestFrm.pas' {SetGuestForm},
+  ReportManagerFrm in '..\..\Forms\ReportManagerFrm.pas',
+  ReportManagerDM in '..\..\DataModules\ReportManagerDM.pas' {Reports: TDataModule},
+  ReportHistoryFrm in '..\..\Forms\ReportHistoryFrm.pas' {ReportHistoryForm};
 
 {$R *.res}
 
@@ -234,6 +238,7 @@ begin
     begin
       HideWelcome;
       Application.CreateForm(TMainForm, MainForm);
+  Application.CreateForm(TSetGuestForm, SetGuestForm);
   end
     else  HideWelcome;
     Application.Run;

BIN
Dprs/Trail/Measure_GuangDong.res


+ 3 - 3
Forms/MainFrm.dfm

@@ -4,7 +4,7 @@ object MainForm: TMainForm
   Width = 750
   Height = 538
   ActiveControl = jpsMainProjectsManager
-  Caption = #32437#27178#20844#36335#24037#31243#35745#37327#25903#20184#20915#31639#19968#20307#21270#36719#20214
+  Caption = 'me'
   Color = clBtnFace
   Font.Charset = ANSI_CHARSET
   Font.Color = clWindowText
@@ -465,12 +465,12 @@ object MainForm: TMainForm
           Visible = True
         end
         item
-          Item = dxbtnOptions
+          Item = dxbtnHelpCenter
           Visible = True
         end
         item
           BeginGroup = True
-          Item = dxbtnHelpCenter
+          Item = dxbtnOptions
           Visible = True
         end
         item

+ 1 - 1
Forms/MainFrm.pas

@@ -410,7 +410,7 @@ function TMainForm.CreateProjectView(ARec: TsdDataRecord): TProjectFrame;
     Result.Pages := jpsProjects;
     jpsProjects.ActivePage := Result;
   end;
-
+                                                     
   function CreateNewProjectTab(const ATabName: string; APage: TJimPage): Integer;
   begin
     Result := jtsProjects.Tabs.AddObject(ATabName, APage);

+ 105 - 0
Forms/ReportHistoryFrm.dfm

@@ -0,0 +1,105 @@
+object ReportHistoryForm: TReportHistoryForm
+  Left = 445
+  Top = 436
+  ActiveControl = mmMemo
+  BorderStyle = bsDialog
+  Caption = #21382#21490#29256#26412
+  ClientHeight = 284
+  ClientWidth = 450
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -13
+  Font.Name = #23435#20307
+  Font.Style = []
+  OldCreateOrder = False
+  Position = poScreenCenter
+  PixelsPerInch = 96
+  TextHeight = 13
+  object Label1: TLabel
+    Left = 8
+    Top = 8
+    Width = 80
+    Height = 20
+    Caption = #21382#21490#29256#26412
+    Font.Charset = DEFAULT_CHARSET
+    Font.Color = clWindowText
+    Font.Height = -20
+    Font.Name = #23435#20307
+    Font.Style = []
+    ParentFont = False
+  end
+  object Label2: TLabel
+    Left = 8
+    Top = 32
+    Width = 260
+    Height = 19
+    Caption = #25105#20204#26368#22810#20165#25552#20379#19977#20010#21382#21490#29256#26412#20379#20320#19979#36733#20351#29992#12290
+    Font.Charset = DEFAULT_CHARSET
+    Font.Color = 6250335
+    Font.Height = -13
+    Font.Name = #24494#36719#38597#40657
+    Font.Style = []
+    ParentFont = False
+  end
+  object lblReportName: TLabel
+    Left = 8
+    Top = 60
+    Width = 92
+    Height = 19
+    Caption = 'lblReportName'
+    Font.Charset = DEFAULT_CHARSET
+    Font.Color = clWindowText
+    Font.Height = -13
+    Font.Name = #24494#36719#38597#40657
+    Font.Style = []
+    ParentFont = False
+  end
+  object tcHistory: TTabControl
+    Left = 8
+    Top = 84
+    Width = 433
+    Height = 194
+    Font.Charset = DEFAULT_CHARSET
+    Font.Color = clWindowText
+    Font.Height = -13
+    Font.Name = #24494#36719#38597#40657
+    Font.Style = []
+    ParentFont = False
+    TabOrder = 0
+    Tabs.Strings = (
+      '2016-08-01'
+      '2016-08-02'
+      '2016-08-03')
+    TabIndex = 0
+    TabStop = False
+    OnChange = tcHistoryChange
+    object btnDown: TSpeedButton
+      Left = 118
+      Top = 157
+      Width = 163
+      Height = 30
+      Caption = #19979#36733#27492#29256#26412
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clBlue
+      Font.Height = -13
+      Font.Name = #24494#36719#38597#40657
+      Font.Style = []
+      ParentFont = False
+      OnClick = btnDownClick
+    end
+    object mmMemo: TMemo
+      Left = 4
+      Top = 30
+      Width = 425
+      Height = 122
+      TabStop = False
+      Align = alTop
+      Lines.Strings = (
+        #35828#26126)
+      ReadOnly = True
+      ScrollBars = ssVertical
+      TabOrder = 0
+    end
+  end
+end

+ 89 - 0
Forms/ReportHistoryFrm.pas

@@ -0,0 +1,89 @@
+unit ReportHistoryFrm;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, ComCtrls, StdCtrls, Buttons, ReportManagerDM,
+  cxLookAndFeelPainters, cxButtons;
+
+type
+  TReportHistoryForm = class(TForm)
+    Label1: TLabel;
+    Label2: TLabel;
+    lblReportName: TLabel;
+    tcHistory: TTabControl;
+    mmMemo: TMemo;
+    btnDown: TSpeedButton;
+    procedure tcHistoryChange(Sender: TObject);
+    procedure btnDownClick(Sender: TObject);
+  private
+    FReport: TReport;
+    procedure SetReport(const Value: TReport);
+    { Private declarations }
+  public
+    { Public declarations }
+    constructor Create(AReport: TReport);
+    procedure Init;
+    property Report: TReport read FReport write SetReport;
+  end;
+
+implementation
+
+{$R *.dfm}
+
+procedure TReportHistoryForm.tcHistoryChange(Sender: TObject);
+begin
+  case tcHistory.TabIndex of
+    0: mmMemo.Text := FReport.NewestMemo;
+    1: mmMemo.Text := FReport.HistoryMemo1;
+    2: mmMemo.Text := FReport.HistoryMemo2;
+  end;
+  btnDown.Enabled := (tcHistory.Tabs[tcHistory.TabIndex] <> '') and (tcHistory.Tabs[tcHistory.TabIndex] <> FReport.LocalVer);
+
+  if (tcHistory.Tabs[tcHistory.TabIndex] <> '') and (tcHistory.Tabs[tcHistory.TabIndex] = FReport.LocalVer) then
+    btnDown.Caption := '正在使用'
+  else
+    btnDown.Caption := '下载此版本';
+end;
+
+constructor TReportHistoryForm.Create(AReport: TReport);
+begin
+  inherited create(nil);
+  FReport := AReport;
+  Init;
+end;
+
+procedure TReportHistoryForm.SetReport(const Value: TReport);
+begin
+  FReport := Value;
+end;
+
+procedure TReportHistoryForm.Init;
+begin
+  lblReportName.Caption := FReport.FileName;
+  lblReportName.Update;
+
+
+
+  tcHistory.Tabs[0] := FReport.NewestVer;
+  tcHistory.Tabs[1] := FReport.HistoryVer1;
+  tcHistory.Tabs[2] := FReport.HistoryVer2;
+  tcHistory.OnChange(nil);
+end;
+
+procedure TReportHistoryForm.btnDownClick(Sender: TObject);
+begin
+  if FReport.Update(tcHistory.Tabs[tcHistory.TabIndex]) then
+  begin
+    btnDown.Caption := '正在使用';
+    btnDown.Enabled := False;
+  end
+  else
+  begin
+    btnDown.Caption := '下载此版本';
+    btnDown.Enabled := True;
+  end;
+end;
+
+end.

+ 659 - 0
Forms/ReportManagerFrm.dfm

@@ -0,0 +1,659 @@
+object ReportManagerForm: TReportManagerForm
+  Left = 996
+  Top = 209
+  BorderStyle = bsDialog
+  Caption = #25253#34920#27169#26495
+  ClientHeight = 535
+  ClientWidth = 841
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -13
+  Font.Name = #23435#20307
+  Font.Style = []
+  OldCreateOrder = False
+  Position = poScreenCenter
+  OnCreate = FormCreate
+  OnDestroy = FormDestroy
+  PixelsPerInch = 96
+  TextHeight = 13
+  object pcReport: TPageControl
+    Left = 0
+    Top = 0
+    Width = 841
+    Height = 535
+    ActivePage = tsOnline
+    Align = alClient
+    Font.Charset = DEFAULT_CHARSET
+    Font.Color = clWindowText
+    Font.Height = -24
+    Font.Name = #24494#36719#38597#40657
+    Font.Style = [fsBold]
+    ParentFont = False
+    TabHeight = 50
+    TabOrder = 0
+    OnChange = pcReportChange
+    object tsLocal: TTabSheet
+      Caption = '  '#26412#22320#25253#34920'  '
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -19
+      Font.Name = #23435#20307
+      Font.Style = []
+      ParentFont = False
+      object zgLoacl: TZJGrid
+        Left = 0
+        Top = 0
+        Width = 833
+        Height = 475
+        Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
+        OptionsEx = []
+        ColCount = 7
+        RowCount = 1
+        ShowGridLine = False
+        DefaultColWidth = 73
+        DefaultFixedColWidth = 30
+        DefaultFixedRowHeight = 29
+        DefaultRowHeight = 30
+        Selection.AlphaBlend = False
+        Selection.TransparentColor = False
+        FrozenCol = 0
+        FrozenRow = 0
+        OnShowHint = zgLoaclShowHint
+        OnCellGetFont = zgLoaclCellGetFont
+        OnMouseDown = zgLoaclMouseDown
+        Font.Charset = DEFAULT_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #24494#36719#38597#40657
+        Font.Style = []
+        ParentFont = False
+        Align = alClient
+      end
+      object pnlHint: TPanel
+        Left = 0
+        Top = 0
+        Width = 833
+        Height = 475
+        Align = alClient
+        BevelOuter = bvNone
+        Caption = #26412#22320#36824#27809#26377#25253#34920#65292#35831#20351#29992#8220#32447#19978#25253#34920#24211#8221#19979#36733#25253#34920
+        Font.Charset = DEFAULT_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -27
+        Font.Name = #24494#36719#38597#40657
+        Font.Style = [fsBold]
+        ParentFont = False
+        TabOrder = 1
+      end
+    end
+    object tsOnline: TTabSheet
+      Caption = '  '#32447#19978#25253#34920#24211'  '
+      ImageIndex = 1
+      object Panel1: TPanel
+        Left = 0
+        Top = 0
+        Width = 833
+        Height = 33
+        Align = alTop
+        BevelOuter = bvNone
+        TabOrder = 0
+        object cbCategory: TComboBox
+          Left = 1
+          Top = 2
+          Width = 273
+          Height = 27
+          Style = csDropDownList
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -13
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ItemHeight = 19
+          ParentFont = False
+          TabOrder = 0
+          TabStop = False
+          OnChange = cbCategoryChange
+        end
+      end
+      object zgOnline: TZJGrid
+        Left = 0
+        Top = 33
+        Width = 833
+        Height = 442
+        Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
+        OptionsEx = []
+        ColCount = 7
+        RowCount = 1
+        ShowGridLine = False
+        DefaultColWidth = 73
+        DefaultFixedColWidth = 30
+        DefaultFixedRowHeight = 29
+        DefaultRowHeight = 30
+        Selection.AlphaBlend = False
+        Selection.TransparentColor = False
+        FrozenCol = 0
+        FrozenRow = 0
+        OnShowHint = zgOnlineShowHint
+        OnCellGetFont = zgOnlineCellGetFont
+        OnMouseDown = zgOnlineMouseDown
+        Font.Charset = DEFAULT_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #24494#36719#38597#40657
+        Font.Style = []
+        ParentFont = False
+        Align = alClient
+      end
+    end
+    object tsCustom: TTabSheet
+      Caption = '  '#23450#21046#25253#34920'  '
+      ImageIndex = 2
+      object pnlCustom: TPanel
+        Left = 0
+        Top = 0
+        Width = 833
+        Height = 475
+        Align = alClient
+        BevelOuter = bvNone
+        Caption = 'pnlCustom'
+        TabOrder = 1
+        object zgCustom: TZJGrid
+          Left = 0
+          Top = 0
+          Width = 833
+          Height = 475
+          Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
+          OptionsEx = []
+          ColCount = 7
+          RowCount = 1
+          ShowGridLine = False
+          DefaultColWidth = 73
+          DefaultFixedColWidth = 30
+          DefaultFixedRowHeight = 29
+          DefaultRowHeight = 30
+          Selection.AlphaBlend = False
+          Selection.TransparentColor = False
+          FrozenCol = 0
+          FrozenRow = 0
+          OnShowHint = zgCustomShowHint
+          OnCellGetFont = zgCustomCellGetFont
+          OnMouseDown = zgCustomMouseDown
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -12
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ParentFont = False
+          Align = alClient
+        end
+      end
+      object pnlInputCode: TPanel
+        Left = 0
+        Top = 0
+        Width = 833
+        Height = 475
+        Align = alClient
+        BevelOuter = bvNone
+        TabOrder = 0
+        object Label2: TLabel
+          Left = 176
+          Top = 170
+          Width = 455
+          Height = 19
+          Caption = #26356#22810#20851#20110#8220#23450#21046#25253#34920#8221#21644#8220#25253#34920#39046#21462#30721#8221#30340#35814#24773#21487#20197#32852#31995#30456#20851#32437#27178#38144#21806#24037#31243#24072#12290
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -13
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ParentFont = False
+        end
+        object Label1: TLabel
+          Left = 176
+          Top = 93
+          Width = 195
+          Height = 19
+          Caption = #36755#20837#8220#25253#34920#39046#21462#30721#8221#33719#21462#23450#21046#25253#34920
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -13
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ParentFont = False
+        end
+        object edtCode: TEdit
+          Left = 176
+          Top = 114
+          Width = 324
+          Height = 48
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clBlue
+          Font.Height = -40
+          Font.Name = #23435#20307
+          Font.Style = [fsBold]
+          ParentFont = False
+          TabOrder = 0
+        end
+        object btnGet: TcxButton
+          Left = 502
+          Top = 97
+          Width = 121
+          Height = 65
+          Cursor = crHandPoint
+          Caption = #39046#21462
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -27
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = [fsBold]
+          ParentFont = False
+          TabOrder = 1
+          OnClick = btnGetClick
+          Colors.Default = clWindow
+          Colors.Normal = clWindow
+          Colors.Pressed = clHotLight
+        end
+      end
+    end
+  end
+  object zaLocal: TZjGridDBA
+    Columns = <
+      item
+        Title.Caption = #31867#21035
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Category'
+        Width = 120
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #25253#34920#21517#31216
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Name'
+        Width = 290
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26412#22320#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'LocalVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26368#26032#26356#26032
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'NewestVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #29366#24577
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'State'
+        Width = 80
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #21382#21490#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'History'
+        Width = 65
+        ReadOnly = True
+      end
+      item
+        Title.Caption = 'ID'
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'ID'
+        Visible = False
+        ReadOnly = False
+      end>
+    Grid = zgLoacl
+    ExtendRowCount = 0
+    Left = 644
+    Top = 72
+  end
+  object zaOnline: TZjGridDBA
+    Columns = <
+      item
+        Title.Caption = #31867#21035
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Category'
+        Width = 120
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #25253#34920#21517#31216
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Name'
+        Width = 290
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26412#22320#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'LocalVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26368#26032#26356#26032
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'NewestVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #29366#24577
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'State'
+        Width = 80
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #21382#21490#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'History'
+        Width = 65
+        ReadOnly = True
+      end
+      item
+        Title.Caption = 'ID'
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'ID'
+        Visible = False
+        ReadOnly = False
+      end>
+    Grid = zgOnline
+    ExtendRowCount = 0
+    Left = 676
+    Top = 72
+  end
+  object zaCustom: TZjGridDBA
+    Columns = <
+      item
+        Title.Caption = #31867#21035
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Category'
+        Width = 120
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #25253#34920#21517#31216
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Name'
+        Width = 290
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26412#22320#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'LocalVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #26368#26032#26356#26032
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'NewestVer'
+        Width = 93
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #29366#24577
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'State'
+        Width = 80
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #21382#21490#29256#26412
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'History'
+        Width = 65
+        ReadOnly = True
+      end
+      item
+        Title.Caption = 'ID'
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'ID'
+        Visible = False
+        ReadOnly = False
+      end>
+    Grid = zgCustom
+    ExtendRowCount = 0
+    Left = 732
+    Top = 72
+  end
+end

+ 265 - 0
Forms/ReportManagerFrm.pas

@@ -0,0 +1,265 @@
+unit ReportManagerFrm;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, ComCtrls, DB, DBClient, ZJGrid, StdCtrls, ExtCtrls, ZjGridDBA,
+  cxLookAndFeelPainters, cxButtons;
+
+type
+  TReportManagerForm = class(TForm)
+    pcReport: TPageControl;
+    tsLocal: TTabSheet;
+    tsOnline: TTabSheet;
+    tsCustom: TTabSheet;
+    zgLoacl: TZJGrid;
+    Panel1: TPanel;
+    pnlInputCode: TPanel;
+    edtCode: TEdit;
+    Label2: TLabel;
+    zaLocal: TZjGridDBA;
+    Label1: TLabel;
+    zgOnline: TZJGrid;
+    zaOnline: TZjGridDBA;
+    btnGet: TcxButton;
+    pnlCustom: TPanel;
+    pnlHint: TPanel;
+    zgCustom: TZJGrid;
+    zaCustom: TZjGridDBA;
+    cbCategory: TComboBox;
+    procedure FormCreate(Sender: TObject);
+    procedure FormDestroy(Sender: TObject);
+    procedure zgLoaclCellGetFont(Sender: TObject; ACoord: TPoint;
+      AFont: TFont);
+    procedure zgOnlineCellGetFont(Sender: TObject; ACoord: TPoint;
+      AFont: TFont);
+    procedure zgLoaclMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    procedure zgOnlineMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    procedure cbCategoryChange(Sender: TObject);
+    procedure btnGetClick(Sender: TObject);
+    procedure zgCustomCellGetFont(Sender: TObject; ACoord: TPoint;
+      AFont: TFont);
+    procedure zgCustomMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    procedure pcReportChange(Sender: TObject);
+    procedure zgOnlineShowHint(var HintStr: String; var CanShow: Boolean;
+      var HintInfo: THintInfo; const ACoord: TPoint);
+    procedure zgLoaclShowHint(var HintStr: String; var CanShow: Boolean;
+      var HintInfo: THintInfo; const ACoord: TPoint);
+    procedure zgCustomShowHint(var HintStr: String; var CanShow: Boolean;
+      var HintInfo: THintInfo; const ACoord: TPoint);
+  private
+    { Private declarations }
+    FReports: TObject;
+    function CurValue(AGridDBA: TZjGridDBA; FieldName: string): Variant;
+    function Col(AGridDBA: TZjGridDBA; FieldName: string): Integer;
+    procedure GridGetFont(Sender: TObject; ACoord: TPoint; AFont: TFont; AGrid: TZjGrid; AGridDBA: TZjGridDBA);
+    procedure GridMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer; AGrid: TZjGrid; AGridDBA: TZjGridDBA);
+    procedure GridShowHint(var HintStr: String; var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint; AGrid: TZjGrid; AGridDBA: TZjGridDBA);
+  public
+    { Public declarations }
+  end;
+
+
+implementation
+
+uses ReportManagerDM, ReportHistoryFrm;
+
+{$R *.dfm}
+
+function TReportManagerForm.Col(AGridDBA: TZjGridDBA; FieldName: string): Integer;
+begin
+  Result := AGridDBA.ColumnIndex(FieldName) + 1;
+end;
+
+function TReportManagerForm.CurValue(AGridDBA: TZjGridDBA; FieldName: string): Variant;
+begin
+  Result := AGridDBA.DataSet.FieldByName(FieldName).AsVariant;
+end;
+
+procedure TReportManagerForm.FormCreate(Sender: TObject);
+begin
+  FReports := TReports.Create(nil);
+  zaLocal.DataSet := TReports(FReports).cdsLocal;
+  zaLocal.Grid := zgLoacl;
+  zaOnline.DataSet := TReports(FReports).cdsOnline;
+  zaOnline.Grid := zgOnline;
+  zaCustom.DataSet := TReports(FReports).cdsCustom;
+  zaCustom.Grid := zgCustom;
+
+  pnlHint.Visible := zaLocal.DataSet.RecordCount = 0;
+  TReports(FReports).CategoryList(cbCategory.Items);
+  cbCategory.ItemIndex := 0;
+  pcReport.ActivePage := tsLocal;
+end;
+
+procedure TReportManagerForm.FormDestroy(Sender: TObject);
+begin
+  FReports.Free;
+end;
+
+procedure TReportManagerForm.GridGetFont(Sender: TObject; ACoord: TPoint;
+  AFont: TFont; AGrid: TZjGrid; AGridDBA: TZjGridDBA);
+var
+  OldActiveRecd: Integer;
+begin
+  if ACoord.X = Col(AGridDBA, 'State') then
+  begin
+    if AGridDBA.ChangeActiveRecord(ACoord.Y - AGrid.FixedRowCount, OldActiveRecd)then
+    begin
+      try
+        if (CurValue(AGridDBA, 'State') = '¸üÐÂ') or (CurValue(AGridDBA, 'State') = 'ÏÂÔØ') then
+          AFont.Color := clBlue;
+      finally
+        AGridDBA.ChangeActiveRecord(OldActiveRecd, OldActiveRecd);
+      end;
+    end;
+  end
+  else if ACoord.X = Col(AGridDBA, 'History') then
+    AFont.Color := clBlue;
+end;
+
+procedure TReportManagerForm.GridMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer; AGrid: TZjGrid;
+  AGridDBA: TZjGridDBA);
+var
+  vForm: TReportHistoryForm;
+  vReport: TReport;
+  iID: Integer;
+begin
+  if CurValue(AGridDBA, 'ID') = null then Exit;
+
+  Screen.Cursor := crHourGlass;
+  try
+    iID := CurValue(AGridDBA, 'ID');
+    vReport := TReports(FReports).FindReprot(iID);
+
+    if AGrid.CurCol = Col(AGridDBA, 'State') then
+    begin
+      if not SameText(vReport.LocalVer, vReport.NewestVer) then
+        vReport.Update(vReport.NewestVer);
+    end
+    else if AGrid.CurCol = Col(AGridDBA, 'History') then
+    begin
+      vReport.GetHistoryVer;
+      vForm := TReportHistoryForm.Create(vReport);
+      try
+        vForm.ShowModal;
+      finally
+        vForm.Free;
+      end;
+    end;
+  finally
+    Screen.Cursor := crDefault;
+  end;
+end;
+
+procedure TReportManagerForm.zgLoaclCellGetFont(Sender: TObject;
+  ACoord: TPoint; AFont: TFont);
+begin
+  GridGetFont(Sender, ACoord, AFont, zgLoacl, zaLocal);
+end;
+
+procedure TReportManagerForm.zgOnlineCellGetFont(Sender: TObject;
+  ACoord: TPoint; AFont: TFont);
+begin
+  GridGetFont(Sender, ACoord, AFont, zgOnline, zaOnline);
+end;
+
+procedure TReportManagerForm.zgLoaclMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  GridMouseDown(Sender, Button, Shift, X, Y, zgLoacl, zaLocal);
+end;
+
+procedure TReportManagerForm.zgOnlineMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  GridMouseDown(Sender, Button, Shift, X, Y, zgOnline, zaOnline);
+end;
+
+procedure TReportManagerForm.cbCategoryChange(Sender: TObject);
+begin
+  if cbCategory.ItemIndex = 0 then
+    TReports(FReports).CancelFilterCategory
+  else
+    TReports(FReports).FilterCategory(cbCategory.Text);
+end;
+
+procedure TReportManagerForm.btnGetClick(Sender: TObject);
+begin
+  if Trim(edtCode.Text) = '' then Exit;
+  if TReports(FReports).LoadCustom(Trim(edtCode.Text)) then
+  begin
+    pnlInputCode.Visible := False;
+  end;
+end;
+
+procedure TReportManagerForm.zgCustomCellGetFont(Sender: TObject;
+  ACoord: TPoint; AFont: TFont);
+begin
+  GridGetFont(Sender, ACoord, AFont, zgCustom, zaCustom);
+end;
+
+procedure TReportManagerForm.zgCustomMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  GridMouseDown(Sender, Button, Shift, X, Y, zgCustom, zaCustom);
+end;
+
+procedure TReportManagerForm.pcReportChange(Sender: TObject);
+begin
+  if pcReport.ActivePage = tsLocal then
+    pnlHint.Visible := zaLocal.DataSet.RecordCount = 0;
+end;
+
+procedure TReportManagerForm.GridShowHint(var HintStr: String; var CanShow: Boolean;
+  var HintInfo: THintInfo; const ACoord: TPoint; AGrid: TZjGrid; AGridDBA: TZjGridDBA);
+var vReport: TReport;
+  OldActiveRecd, iID: Integer;
+begin
+  if ACoord.X = 4 then
+  begin
+    if AGridDBA.ChangeActiveRecord(ACoord.Y - AGrid.FixedRowCount, OldActiveRecd) then
+    begin
+      try
+        if CurValue(AGridDBA, 'ID') = null then Exit;
+
+        iID := CurValue(AGridDBA, 'ID');
+        vReport := TReports(FReports).FindReprot(iID);
+        if vReport.NewestMemo = '' then
+          HintInfo.HintStr := '[ÔÝÎÞ¸üÐÂ˵Ã÷]'
+        else
+          HintInfo.HintStr := vReport.NewestMemo;
+        CanShow := True;
+        HintInfo.HintMaxWidth := 250;
+        HintInfo.HideTimeout := 30000;
+      finally
+        AGridDBA.ChangeActiveRecord(OldActiveRecd, OldActiveRecd);
+      end;
+    end;
+  end;
+end;
+
+procedure TReportManagerForm.zgOnlineShowHint(var HintStr: String;
+  var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint);
+begin
+  GridShowHint(HintStr, CanShow, HintInfo, ACoord, zgOnline, zaOnline);
+end;
+
+procedure TReportManagerForm.zgLoaclShowHint(var HintStr: String;
+  var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint);
+begin
+  GridShowHint(HintStr, CanShow, HintInfo, ACoord, zgLoacl, zaLocal);
+end;
+
+procedure TReportManagerForm.zgCustomShowHint(var HintStr: String;
+  var CanShow: Boolean; var HintInfo: THintInfo; const ACoord: TPoint);
+begin
+  GridShowHint(HintStr, CanShow, HintInfo, ACoord, zgCustom, zaCustom);
+end;
+
+end.

+ 66 - 59
Forms/ReportsFrm.dfm

@@ -89,7 +89,7 @@ object ReportsForm: TReportsForm
     BevelOuter = bvNone
     TabOrder = 6
     object sprReportPreview: TSplitter
-      Left = 211
+      Left = 225
       Top = 0
       Height = 425
       AutoSnap = False
@@ -97,7 +97,7 @@ object ReportsForm: TReportsForm
     object pnlReportsList: TPanel
       Left = 0
       Top = 0
-      Width = 211
+      Width = 225
       Height = 425
       Align = alLeft
       BevelOuter = bvNone
@@ -105,7 +105,7 @@ object ReportsForm: TReportsForm
       object extvReport: TExTreeView
         Left = 0
         Top = 35
-        Width = 211
+        Width = 225
         Height = 390
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
@@ -138,7 +138,7 @@ object ReportsForm: TReportsForm
       object pnlTopButton: TPanel
         Left = 0
         Top = 0
-        Width = 211
+        Width = 225
         Height = 35
         Align = alTop
         BevelOuter = bvNone
@@ -146,7 +146,7 @@ object ReportsForm: TReportsForm
         object tobaTemplateManager: TToolBar
           Left = 0
           Top = 0
-          Width = 211
+          Width = 225
           Height = 35
           AutoSize = True
           ButtonHeight = 35
@@ -156,10 +156,17 @@ object ReportsForm: TReportsForm
           Images = ilstTemplateContorl
           ShowCaptions = True
           TabOrder = 0
-          object tbImportSrt: TToolButton
+          object btnRMgr: TToolButton
             Left = 0
             Top = 0
-            Hint = #23548#20837#25253#34920#27169#26495
+            Caption = #25253#34920#31649#29702
+            ImageIndex = 7
+            OnClick = btnRMgrClick
+          end
+          object tbImportSrt: TToolButton
+            Left = 55
+            Top = 0
+            Hint = #23548#20837#27169#26495
             Caption = #23548#20837#27169#26495
             ImageIndex = 5
             ParentShowHint = False
@@ -167,7 +174,7 @@ object ReportsForm: TReportsForm
             OnClick = tbImportSrtClick
           end
           object tbExportSrt: TToolButton
-            Left = 55
+            Left = 110
             Top = 0
             Hint = #23548#20986#25253#34920#27169#26495
             Caption = #23548#20986#27169#26495
@@ -177,7 +184,7 @@ object ReportsForm: TReportsForm
             OnClick = tbExportSrtClick
           end
           object tbDeleteSrt: TToolButton
-            Left = 110
+            Left = 165
             Top = 0
             Hint = #21024#38500#25253#34920#27169#26495
             Caption = #21024#38500#27169#26495
@@ -190,9 +197,9 @@ object ReportsForm: TReportsForm
       end
     end
     object sbReportsPreview: TScrollBox
-      Left = 214
+      Left = 228
       Top = 0
-      Width = 893
+      Width = 879
       Height = 425
       HorzScrollBar.Increment = 48
       HorzScrollBar.Tracking = True
@@ -2503,7 +2510,7 @@ object ReportsForm: TReportsForm
     Left = 184
     Top = 76
     Bitmap = {
-      494C010107000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+      494C010108000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
       0000000000003600000028000000400000003000000001002000000000000030
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
@@ -2647,113 +2654,113 @@ object ReportsForm: TReportsForm
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFFFFF00B57B080000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
-      FF00FFFFFF00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000D6A57300FFF7EF00F7F7
+      FF00FFFFFF00FFFFFF00B57B080000000000000000000000000000000000C070
+      40FF0000000000000000B06840FF0000000000000000A06030FF000000000000
+      0000A05830FF00000000000000000000000000000000D6A57300FFF7EF00F7F7
       EF00F7EFE700F7EFE700F7E7DE00F7E7DE005A52B5002121C6003939E7002121
       C6002121C6003942E7002121CE005252BD00B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BD
       A500FFFFFF00FFFFFF00B57B080000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BD
-      A500FFFFFF00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000DEA57B00FFF7EF00EFD6
+      A500FFFFFF00FFFFFF00B57B080000000000000000000000000000000000C078
+      50FF0000000000000000B06840FF0000000000000000A06030FF000000000000
+      0000A05830FF00000000000000000000000000000000DEA57B00FFF7EF00EFD6
       BD00FFFFFF00EFD6BD00FFFFFF00FFFFFF00FFFFFF00EFC6AD002121CE004A4A
       EF004A4AEF002929D600C68C5A0000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BDA500B5CED600B5CED600D6BD
       A500FFFFFF00FFFFFF00B57B080000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BDA500FFFFFF00FFFFFF00D6BD
-      A500FFFFFF00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000DEAD7B00FFF7EF00EFD6
+      A500FFFFFF00FFFFFF00B57B08000000000000000000C08050FFC08050FFC078
+      50FFC07850FFC07040FFB07040FFB06840FFB06830FFB06030FFB06030FFA058
+      30FFA05830FFA05830FFA05830FF0000000000000000DEAD7B00FFF7EF00EFD6
       BD00EFD6BD00EFD6BD00EFD6BD00EFD6BD00EFD6BD00EFCEB5003939E7005A5A
       FF006363FF004242E700C68C5A0000000000B57B0800FFFFFF00D6BD9C00D6BD
       9C00D6BD9C00DEBDA500D6BD9C00D6BD9C008C9C8C00006B8C00006B8C008C9C
       8C00D6BD9C00FFFFFF00B57B080000000000B57B0800FFFFFF00D6BD9C00D6BD
       9C00D6BD9C00DEBDA500D6BD9C00D6BD9C00108C9400006B8400006B8400108C
-      9400D6BD9C00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000DEAD8400FFF7EF00EFCE
+      9400D6BD9C00FFFFFF00B57B080000000000000000000000000000000000C080
+      50FF0000000000000000C07040FF0000000000000000B06840FF000000000000
+      0000A06030FF00000000000000000000000000000000DEAD8400FFF7EF00EFCE
       B500FFFFFF00EFD6BD00FFFFFF00FFFFFF004A4ADE004A4AF7006B6BFF004242
       EF003939E7007373FF005252F7004242D600B57B0800FFFFFF00FFFFF700FFFF
       F700FFFFF700D6BD9C00FFFFFF00ADCED600006B8400009CCE00009CCE00006B
       8400ADCED600FFFFFF00B57B080000000000B57B0800FFFFFF00FFFFF700FFFF
       F700FFFFF700D6BD9C00FFFFFF00FFFFFF00006B840084E7FF0039D6FF00006B
-      8400FFFFF700FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000E7AD8400FFF7F700EFCE
+      8400FFFFF700FFFFFF00B57B080000000000000000000000000000000000C080
+      50FF0000000000000000C07840FF0000000000000000B06840FF000000000000
+      0000B06030FF00000000000000000000000000000000E7AD8400FFF7F700EFCE
       B500EFCEB500EFCEB500EFCEB500EFCEB5001010CE00A5A5E7005252DE00EFCE
       B500EFCEAD005252DE00A5A5E7001818CE00B57B0800FFFFFF00FFFFEF00FFFF
       EF00FFFFF700D6BD9400ADCECE00006B8400009CC60000B5EF0000B5EF00009C
       C600006B8400B5CED600B57B080000000000B57B0800FFFFFF00FFFFEF00FFFF
       EF00FFFFF700D6BD9400FFFFF700FFFFF7000063840063DEFF0000A5D600006B
-      8400FFFFEF00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000E7B58C00FFF7F700EFCE
+      8400FFFFEF00FFFFFF00B57B08000000000000000000D09060FFD08860FFD088
+      60FFC08050FFC08050FFC07850FFC07850FFC07040FFB06840FFB06840FFB068
+      30FFB06030FFB06030FFA05830FF0000000000000000E7B58C00FFF7F700EFCE
       AD00FFFFFF00EFCEB500FFFFFF00FFFFFF00E7E7FF002121CE005252DE00FFFF
       FF00FFFFFF00635AD6002118C600D6D6F700B57B0800FFFFFF00D6B58C00D6B5
       8C00D6BD9400DEBD9400006B8C0000C6FF0042D6FF0000B5E70000B5E70042D6
       FF0000C6FF00006B8C00B57B080000000000B57B0800FFFFFF00D6B58C00D6B5
       8C00D6BD9400DEBD9400D6BD9400D6BD9400006384004AD6FF0000A5D600006B
-      8400D6B58C00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000E7B58C00FFF7F700EFC6
+      8400D6B58C00FFFFFF00B57B080000000000000000000000000000000000D088
+      60FF0000000000000000C08050FF0000000000000000C07040FF000000000000
+      0000B06840FF00000000000000000000000000000000E7B58C00FFF7F700EFC6
       AD00EFC6AD00EFC6AD00EFC6AD00EFCEAD00EFCEB500EFC6AD00EFCEB500EFCE
       B500EFCEB500F7E7DE00CE8C5A0000000000B57B0800FFFFFF00FFF7DE00FFFF
       E700FFFFE700006B84001094A500006384000094C60000ADE70000ADE7000094
       C600006B84001094AD00006B840000000000B57B0800FFFFFF00FFF7DE00FFFF
       E700FFFFE700D6B58C00FFFFE700FFFFE7000063840039D6FF0000A5DE00006B
-      8400FFFFE700FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000E7B59400FFF7F700EFC6
+      8400FFFFE700FFFFFF00B57B080000000000000000000000000000000000D090
+      60FF0000000000000000C08050FF0000000000000000C07850FF000000000000
+      0000B06840FF00000000000000000000000000000000E7B59400FFF7F700EFC6
       A500FFFFFF00EFC6AD00FFFFFF00FFFFFF00FFFFFF00EFC6AD00FFFFFF00FFFF
       FF00FFFFFF00F7F7EF00CE8C5A0000000000B57B0800FFFFFF00FFF7D600FFF7
       DE00FFFFDE00D6B58C00FFFFDE00FFFFDE000063840000BDF70000B5E7000063
       8400FFFFDE00FFFFFF00B57B080000000000B57B0800FFFFFF00FFF7D600FFF7
       DE00FFFFDE00D6B58C00FFFFDE00FFFFDE000063840000BDFF0000ADE700006B
-      8400FFFFDE00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000EFBD9C00FFF7F700EFC6
+      8400FFFFDE00FFFFFF00B57B08000000000000000000E09870FFE09870FFD090
+      60FFD09060FFD08860FFD08860FFC08050FFC08050FFC07850FFC07840FFB070
+      40FFB07040FFB06840FFB06840FF0000000000000000EFBD9C00FFF7F700EFC6
       A500EFC6A500EFC6A500EFC6A500EFC6A500EFC6A500EFC6A500EFC6A500EFC6
       A500EFC6A500FFF7F700CE94630000000000B57B0800FFFFFF00DEB57B00E7B5
       7B00E7B58400DEB58400DEB58400DEB584000063840000BDFF0000ADE700006B
       8400DEB57B00FFFFFF00B57B080000000000B57B0800FFFFFF00DEB57B00E7B5
       7B00E7B58400DEB58400DEB58400DEB584000063840000BDF70000B5E7000063
-      8400DEB57B00FFFFFF00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000EFBD9C00FFF7F700FFFF
+      8400DEB57B00FFFFFF00B57B080000000000000000000000000000000000E098
+      60FF0000000000000000D08860FF0000000000000000C08050FF000000000000
+      0000C07040FF00000000000000000000000000000000EFBD9C00FFF7F700FFFF
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFF7F700D6946B0000000000B57B0800FFFFFF0042C6FF004AC6
       FF0042C6FF00E7B57B0042C6FF0042C6FF000063840039D6FF0000A5DE00006B
       840042C6FF00FFFFFF00B57B080000000000B57B0800FFFFFF0042C6FF004AC6
       FF0042C6FF00006B840000849C00006384000094C60000ADE70000ADE7000094
-      C600006B84001094AD00006B8400000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000EFBD9C00FFF7F7009CD6
+      C600006B84001094AD00006B840000000000000000000000000000000000E098
+      70FF0000000000000000D09060FF0000000000000000C08050FF000000000000
+      0000C07850FF00000000000000000000000000000000EFBD9C00FFF7F7009CD6
       A5009CD6A50094D69C0094CE9C008CCE940084CE8C0084C68C007BC684007BC6
       840073BD7B00FFF7F700D69C6B0000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00006384004AD6FF0000A5D600006B
       8400FFFFFF00FFFFFF00B57B080000000000B57B0800FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFFFFF00006B8C0000C6FF0042D6FF0000B5E70000B5E70042D6
-      FF0000C6FF00006B8C00B57B0800000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000EFC6AD00FFF7F700FFF7
+      FF0000C6FF00006B8C00B57B08000000000000000000E09870FFE09870FFE098
+      70FFE09870FFE09860FFD09060FFD09060FFD08860FFD08860FFD08050FFC080
+      50FFC07850FFC07850FFB07040FF0000000000000000EFC6AD00FFF7F700FFF7
       F700FFF7F700FFF7F700FFF7F700FFF7F700FFF7F700FFF7F700FFF7F700FFF7
       F700FFF7F700FFF7F700DEA5730000000000CE9C4A00B57B0800B57B0800B57B
       0000B57B0800B57B0800B57B0800B57B08000063840063DEFF0000A5D600006B
       8400B57B0800B57B0800C694390000000000CE9C4A00B57B0800B57B0800B57B
       0000B57B0800B57B0800735A1800006B8400009CC60000B5EF0000B5EF00009C
-      C600006B840073631800C6943900000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000000000000000F7E7D600F7C6AD00EFC6
+      C600006B840073631800C694390000000000000000000000000000000000E098
+      70FF0000000000000000E09060FF0000000000000000D08860FF000000000000
+      0000C08050FF00000000000000000000000000000000F7E7D600F7C6AD00EFC6
       9C00EFBD9C00EFBD9C00EFBD9400E7B59400E7B59400E7B58C00E7AD8C00E7AD
       8400DEAD8400DEA57B00E7B59400000000000000000000000000000000000000
       000000000000000000000000000000000000006B840084E7FF0039D6FF00006B
       8400000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000A5C6CE00006B8400009CCE00009CCE00006B
-      8400A5C6CE000000000000000000000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
-      0000000000000000000000000000000000000000000000000000000000000000
+      8400A5C6CE00000000000000000000000000000000000000000000000000E098
+      70FF0000000000000000E09870FF0000000000000000D09060FF000000000000
+      0000D08050FF0000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000001894A500006B8400006B84001894
@@ -2895,11 +2902,11 @@ object ReportsForm: TReportsForm
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
-      00000000000000000000000000000000FF000001000100008000000100010000
-      8000000100010000800100010001000080010001000100008000000100010000
-      8000000100010000800000010001000080010001000100008001000100010000
-      8001000100010000800100010001000080010001000100008001000100010000
-      8001FF0FFE070000FFFFFF0FFF0F0000FFCFFFC7FFC1FFC18001800180008000
+      00000000000000000000000000000000FF0000010001FFFF800000010001EDB7
+      800000010001EDB78001000100018001800100010001EDB7800000010001EDB7
+      8000000100018001800000010001EDB7800100010001EDB78001000100018001
+      800100010001EDB7800100010001EDB78001000100018001800100010001EDB7
+      8001FF0FFE07EDB7FFFFFF0FFF0FFFFFFFCFFFC7FFC1FFC18001800180008000
       8001800180008000800180008000800080008000800080008001800080008000
       8001800180018001800180018001800180018001800180018001800180018001
       8001800180018001800180018001800180018001800180018001800180018001

+ 48 - 4
Forms/ReportsFrm.pas

@@ -61,6 +61,7 @@ type
     dxcciExcelMode: TdxBarControlContainerItem;
     pnlReports: TPanel;
     BatchPrintXml: TPrintComXML;
+    btnRMgr: TToolButton;
     procedure PreviewComXMLGetDataConnection(var ADOCon: TADOConnection);
     procedure xlbRealSizeClick(Sender: TObject);
     procedure xlbOnePageClick(Sender: TObject);
@@ -91,6 +92,7 @@ type
     procedure chkFillZeroClick(Sender: TObject);
     procedure PreviewComXMLGetDatasetEvent(DatasetInfo: PDatasetInfoRec;
       var ADataset: TDataSet);
+    procedure btnRMgrClick(Sender: TObject);
   private
     FProjectData: TProjectData;
     FCurPage: Integer;
@@ -177,7 +179,7 @@ implementation
 uses
   UtilMethods, Math, Globals, ZhAPI, ReportAdjustFrm,
   Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm, ConstUnit,
-  GclBillsGatherModel, ReportPdfHelper;
+  GclBillsGatherModel, ReportPdfHelper, ReportManagerFrm;
 
 {$R *.dfm}
 
@@ -760,11 +762,29 @@ begin
         contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3);
       end else if (isPrinting) then
       begin
-        contentFontRec.FontName := 'Arial Narrow';
-        contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 7 div 6;
+        if (dataType = DATA_TYPE_DOUBLE) or (dataType = DATA_TYPE_FLOAT) then
+        begin
+          contentFontRec.FontName := 'Arial Narrow';
+          contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 7 div 6;
+        end else
+        begin
+          contentFontRec.FontName := ReportConfig.ContentFont.Name;
+          contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3);
+        end;
+//        contentFontRec.FontName := 'Arial Narrow';
+//        contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 7 div 6;
       end else
       begin
-        contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 4 div 3;
+        if (dataType = DATA_TYPE_DOUBLE) or (dataType = DATA_TYPE_FLOAT) then
+        begin
+          contentFontRec.FontName := 'Arial Narrow';
+          contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 4 div 3;
+        end else
+        begin
+          contentFontRec.FontName := ReportConfig.ContentFont.Name;
+          contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3);
+        end;
+//        contentFontRec.FontHeight := Round(ReportConfig.ContentFont.Size*4/3) * 4 div 3;
       end;
     end;
   end;
@@ -1318,6 +1338,16 @@ begin
   rdbtnA3.Checked := SameText(rdbtnA3.Caption, ReportConfig.PageSize);
   rdbtnA4.Checked := SameText(rdbtnA4.Caption, ReportConfig.PageSize);
   SetPrinterPageSize(ReportConfig.PageSize);
+  if G_IsCloud then
+  begin
+    btnRMgr.Visible := True;
+    tbImportSrt.Visible := False;
+  end
+  else
+  begin
+    btnRMgr.Visible := False;
+    tbImportSrt.Visible := True;
+  end;
 end;
 
 procedure TReportsForm.LoadExcelBorder(var Border: TColumnLineRec);
@@ -1556,4 +1586,18 @@ begin
   inherited;
 end;
 
+//  启用报表模板管理器,报表导入功能取消。
+procedure TReportsForm.btnRMgrClick(Sender: TObject);
+var vRDForm: TReportManagerForm;
+begin
+  Screen.Cursor := crHourGlass;
+  vRDForm := TReportManagerForm.Create(nil);
+  try
+    vRDForm.ShowModal;
+  finally
+    vRDForm.Free;
+    Screen.Cursor := crDefault;
+  end;
+end;
+
 end.

+ 18 - 1
Frames/ProjectFme.pas

@@ -210,7 +210,7 @@ uses
   PhaseData, BGLDm, MainFrm, ZhAPI, SearchDm, PHPWebDm, ActiveX,
   ConstUnit, MD5Unit, sdIDTree, sdDB, mProgressFrm, ConditionalDefines,
   ProjectCommands, ProjectProperty, CheckerMemoFrm, BillsMeasureDm,
-  ProgressHintFrm, mProgressProFrm;
+  ProgressHintFrm, mProgressProFrm, ReportManagerFrm;
 
 {$R *.dfm}
 
@@ -559,7 +559,24 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
   *)
 
   procedure DisplayReports;
+  var vRDForm: TReportManagerForm;
+    sPath: string;
   begin
+    if G_IsCloud then
+    begin
+      sPath := ExtractFilePath(ParamStr(0)) + 'ReportTemplates\';
+      if FileCount(sPath, '.srt') = 0 then
+      begin
+        Screen.Cursor := crHourGlass;
+        vRDForm := TReportManagerForm.Create(nil);
+        try
+          vRDForm.ShowModal;
+        finally
+          vRDForm.Free;
+          Screen.Cursor := crDefault;
+        end;
+      end;
+    end;
     // ×¼±¸Êý¾Ý
     if Item.Tag = xbiReport.Tag then
       FProjectData.CopyPhaseData;

+ 1 - 1
Frames/ProjectManagerFme.pas

@@ -1630,7 +1630,7 @@ function TProjectManagerFrame.AttachmentFileCountsWithoutManageFile(ANode: TsdID
     else
     begin
       sPath := GetMyProjectsFilePath + 'Attachment\' + ANode.Rec.ValueByName('FileName').AsString + '\';
-      Result := Result + FileCount(sPath) - 1;
+      Result := Result + FileCount(sPath, '.*') - 1;
     end;
 
     if Assigned(ANode.FirstChild) then

+ 80 - 8
Units/UtilMethods.pas

@@ -109,18 +109,23 @@ type
 
   procedure AppendTestLog(const AFileName, ALog: string);
 
-  // Add by chenshilong, 2014-04-11
+  // From here, Add by chenshilong, 2014-04-11
   function GetVersion(APartCount: Integer = 4): string;
   function ExtractFileNameWithoutExt(const AFileName: string): string;
-  function ShortText(AText: string; AWidth: Integer): string;                     // 文本缩略显示
+  function ShortText(AText: string; AWidth: Integer): string;                   // 文本缩略显示
   function CustomWidthText(AText: string; AWidth: Integer): string;
-  function ReplaceCharsForJson(AText: string): string;                                  // 替换Json文本中的特殊字符
-  function RecoverCharsFromJson(AText: string): string;                             // 下载得到的Json文本恢复成用户需要的文本
+  function ReplaceCharsForJson(AText: string): string;                          // 替换Json文本中的特殊字符
+  function RecoverCharsFromJson(AText: string): string;                         // 下载得到的Json文本恢复成用户需要的文本
   procedure FindFiles(APath, AExtName: string; AFileList: TStrings);
   function DeleteFolder(const FolderStr: string): Boolean;
   function HasExt(const AFileName: string): Boolean;
   function CopyFolder(const SrcFolder, DstFolder: string): Boolean;
-  function FileCount(APath: string): Integer;
+  function FileCount(APath, AExt: string): Integer;
+  function ChangeExt(AFile, ANewExt: string): string;
+  function CheckExt(AName, AExt: string): string;
+  function TempName(ALength: Integer): string;
+  function URLFileName(AURL: string): string;
+  function ReplaceChars(AStr: string): string;
 
 implementation
 
@@ -1330,15 +1335,15 @@ begin
   Result     := SHFileOperation(fos) <> 0;
 end;
 
-function FileCount(APath: string): Integer;
+function FileCount(APath, AExt: string): Integer;
 var
   vSR: TSearchRec;
   iRetval: Integer;
   vSL: TStringList;
 begin
   vSL := TStringList.Create;
-  iRetval := FindFirst(APath + '*.*', faAnyFile, vSR);
-  try 
+  iRetval := FindFirst(APath + '*' + AExt, faAnyFile, vSR);
+  try
     while iRetval = 0 do
     begin
       if (vSR.Attr and faDirectory) = 0 then
@@ -1352,4 +1357,71 @@ begin
   end;
 end;
 
+
+function ChangeExt(AFile, ANewExt: string): string;
+var i, iPos: Integer;
+begin
+  for i := Length(AFile) Downto 1 do
+  begin
+    if AFile[i] = '.' then
+    begin
+      iPos := i;
+      Break;
+    end;
+  end;
+  Result := Copy(AFile, 1, iPos - 1) + ANewExt;
+end;
+
+function CheckExt(AName, AExt: string): string;
+var bHasExt: Boolean;
+begin
+  bHasExt := ExtractFileExt(AName) <> '';
+  if not bHasExt then
+    Result := AName + AExt
+  else
+  begin
+    if (UpperCase(ExtractFileExt(AName)) <> AExt) then
+      Result := ChangeExt(AName, AExt)
+    else
+      Result := AName;
+  end;
+end;
+
+function TempName(ALength: Integer): string;
+const 
+  CodedBuf: array[0..35] of Char = ('0', '1', '2', '3', '4', '5',
+  '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 
+  'J', 'K', 'L', 'M', 'N',
+'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 
+  'W', 'X', 'Y', 'Z');
+begin
+  Result := '';
+  Randomize;
+  while Length(Result) < ALength do
+    Result := Result + CodedBuf[Random(36)];
+end;
+
+function URLFileName(AURL: string): string;
+var
+  i: integer;
+  s: string;
+begin
+  s := AURL;
+  i := Pos('/', s);
+  while i <> 0 do
+  begin
+    Delete(s, 1, i);
+    i := Pos('/', s);
+  end;
+  Result := s;
+end;
+
+function ReplaceChars(AStr: string): string;
+var s: string;
+begin
+  s := Trim(AStr);
+  s := StringReplace(s, '\r\n', #$D#$A, [rfReplaceAll]);
+  Result := s;
+end;
+
 end.