Преглед изворни кода

1、本地报表同时按类别(升序)和更新时间(降序)排序。
2、自动检测并提醒用户有新报表要更新,点“确定”后直接弹出报表管理。
3、定制报表领取码本地记忆功能。

Chenshilong пре 8 година
родитељ
комит
003873bfde

+ 18 - 0
DataModules/ReportManagerDM.dfm

@@ -243,4 +243,22 @@ object Reports: TReports
     Left = 80
     Left = 80
     Top = 104
     Top = 104
   end
   end
+  object cdsCode: TClientDataSet
+    Active = True
+    Aggregates = <>
+    Params = <>
+    Left = 160
+    Top = 112
+    Data = {
+      4F0000009619E0BD0100000018000000020000000000030000004F000750726F
+      6A656374010049000000010005574944544802000200640004436F6465010049
+      00000001000557494454480200020014000000}
+    object cdsCodeProject: TStringField
+      FieldName = 'Project'
+      Size = 100
+    end
+    object cdsCodeCode: TStringField
+      FieldName = 'Code'
+    end
+  end
 end
 end

+ 77 - 1
DataModules/ReportManagerDM.pas

@@ -111,6 +111,9 @@ type
     cdsCustomHistory: TStringField;
     cdsCustomHistory: TStringField;
     cdsCustomNewestVer: TStringField;
     cdsCustomNewestVer: TStringField;
     cdsTemp: TClientDataSet;
     cdsTemp: TClientDataSet;
+    cdsCode: TClientDataSet;
+    cdsCodeProject: TStringField;
+    cdsCodeCode: TStringField;
     procedure DataModuleCreate(Sender: TObject);
     procedure DataModuleCreate(Sender: TObject);
     procedure DataModuleDestroy(Sender: TObject);
     procedure DataModuleDestroy(Sender: TObject);
   private
   private
@@ -134,6 +137,8 @@ type
     procedure FilterNeedUpdates(AFilter: Boolean);
     procedure FilterNeedUpdates(AFilter: Boolean);
     function HasNeedUpdateReport: Boolean;
     function HasNeedUpdateReport: Boolean;
     function HasReport: Boolean;
     function HasReport: Boolean;
+    procedure LoadCodes;
+    procedure saveCodes(AProjectName, ACode: string);
 
 
     property Path: string read FPath;
     property Path: string read FPath;
   end;
   end;
@@ -143,7 +148,7 @@ type
 implementation
 implementation
 
 
   uses Variants, ScFileArchiverConsts, ArchiverRoot, PHPWebDm, CslJson,
   uses Variants, ScFileArchiverConsts, ArchiverRoot, PHPWebDm, CslJson,
-    XMLDoc, XMLIntf, Windows, Math, Forms;
+    XMLDoc, XMLIntf, Windows, Math, Forms, iniFiles;
 
 
 const G_ReportDNS = 'http://vc.6jlzf.cn';   // 最后不能带"/"
 const G_ReportDNS = 'http://vc.6jlzf.cn';   // 最后不能带"/"
 
 
@@ -213,6 +218,8 @@ begin
   Load;
   Load;
 
 
   cdsTemp.CloneCursor(cdsLocal, True);
   cdsTemp.CloneCursor(cdsLocal, True);
+
+  LoadCodes;
 end;
 end;
 
 
 procedure TReports.DataModuleDestroy(Sender: TObject);
 procedure TReports.DataModuleDestroy(Sender: TObject);
@@ -314,6 +321,11 @@ begin
     end;
     end;
   end;
   end;
 
 
+  cdsLocal.AddIndex('idxCN','Category;NewestVer',[],'NewestVer');
+  cdsLocal.IndexName := 'idxCN';
+  // 这种不能指定降序。
+//  cdsLocal.IndexFieldNames := 'Category;NewestVer';
+
   // 线上报表按地区获取;线下广东和全国分开装,报表不会混合,所以本地无需作区分
   // 线上报表按地区获取;线下广东和全国分开装,报表不会混合,所以本地无需作区分
   {$IFDEF _mGuangDong}
   {$IFDEF _mGuangDong}
      sArea := '2';   // 广东
      sArea := '2';   // 广东
@@ -722,6 +734,7 @@ function TReports.LoadCustom(ACode: string): Boolean;
 var FOnlineAry: TOVArr;
 var FOnlineAry: TOVArr;
   i, iID: Integer;
   i, iID: Integer;
   vReport: TReport;
   vReport: TReport;
+  sProjName: string;
 begin
 begin
   Result := False;
   Result := False;
 
 
@@ -757,7 +770,9 @@ begin
 
 
         ChangeRec(cdsCustom, vReport, ctAdd);
         ChangeRec(cdsCustom, vReport, ctAdd);
       end;
       end;
+      sProjName := FOnlineAry[0, 7];
       Result := True;
       Result := True;
+      saveCodes(sProjName, ACode);
     finally
     finally
       cdsCustom.First;
       cdsCustom.First;
       cdsCustom.EnableControls;
       cdsCustom.EnableControls;
@@ -810,4 +825,65 @@ begin
   Result := cdsTemp.RecordCount > 0;
   Result := cdsTemp.RecordCount > 0;
 end;
 end;
 
 
+procedure TReports.LoadCodes;
+var ini: TIniFile;
+  vSL: TStringList;
+  i: Integer;
+  sCode: String;
+begin
+  cdsCode.DisableControls;
+  vSL := TStringList.Create;
+  ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Cloud.ini');
+  try
+    cdsCode.First;
+    while cdsCode.RecordCount > 0 do
+      cdsCode.Delete;
+
+    Ini.ReadSection('Codes', vSL);
+
+    for i := vSL.Count - 1 downto 0 do
+    begin
+      sCode := Ini.ReadString('Codes', vSL[i], '');
+      cdsCode.Append;
+      cdsCodeProject.AsString :=  vSL[i];
+      cdsCodeCode.AsString := sCode;
+      cdsCode.Post;
+    end;
+
+    cdsCode.First;
+  finally
+    vSL.Free;
+    ini.Free;
+    cdsCode.EnableControls;
+  end;
+end;
+
+procedure TReports.saveCodes(AProjectName, ACode: string);
+var ini: TIniFile;
+  vSL: TStringList;
+  i: Integer;
+  sCode: String;
+  bExist: Boolean;
+begin
+  bExist := False;
+  vSL := TStringList.Create;
+  ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Cloud.ini');
+  try
+    Ini.ReadSection('Codes', vSL);
+
+    for i := 0 to vSL.Count - 1 do
+    begin
+      sCode := Ini.ReadString('Codes', vSL[i], '');
+      if SameText(sCode, ACode) then
+        Exit;
+    end;
+
+    ini.WriteString('Codes', AProjectName, ACode);
+
+  finally
+    vSL.Free;
+    ini.Free;
+  end;
+end;
+
 end.
 end.

+ 2 - 2
Dprs/CSL/Measure_Cloud.dof

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

BIN
Dprs/CSL/Measure_Cloud.res


+ 82 - 1
Forms/ReportManagerFrm.dfm

@@ -22,7 +22,7 @@ object ReportManagerForm: TReportManagerForm
     Top = 0
     Top = 0
     Width = 841
     Width = 841
     Height = 549
     Height = 549
-    ActivePage = tsLocal
+    ActivePage = tsCustom
     Align = alClient
     Align = alClient
     Font.Charset = DEFAULT_CHARSET
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Color = clWindowText
@@ -305,6 +305,19 @@ object ReportManagerForm: TReportManagerForm
           Font.Style = []
           Font.Style = []
           ParentFont = False
           ParentFont = False
         end
         end
+        object Label4: TLabel
+          Left = 176
+          Top = 255
+          Width = 52
+          Height = 19
+          Caption = #26368#36817#39046#21462
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -13
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ParentFont = False
+        end
         object edtCode: TEdit
         object edtCode: TEdit
           Left = 176
           Left = 176
           Top = 114
           Top = 114
@@ -337,6 +350,30 @@ object ReportManagerForm: TReportManagerForm
           Colors.Normal = clWindow
           Colors.Normal = clWindow
           Colors.Pressed = clHotLight
           Colors.Pressed = clHotLight
         end
         end
+        object zgCode: TZJGrid
+          Left = 176
+          Top = 276
+          Width = 449
+          Height = 181
+          Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
+          OptionsEx = []
+          ColCount = 3
+          RowCount = 1
+          ShowGridLine = False
+          DefaultColWidth = 73
+          DefaultFixedRowHeight = 29
+          DefaultRowHeight = 25
+          Selection.AlphaBlend = False
+          Selection.TransparentColor = False
+          FrozenCol = 0
+          FrozenRow = 0
+          Font.Charset = DEFAULT_CHARSET
+          Font.Color = clWindowText
+          Font.Height = -13
+          Font.Name = #24494#36719#38597#40657
+          Font.Style = []
+          ParentFont = False
+        end
       end
       end
     end
     end
   end
   end
@@ -739,4 +776,48 @@ object ReportManagerForm: TReportManagerForm
     Left = 732
     Left = 732
     Top = 72
     Top = 72
   end
   end
+  object zaCode: TZjGridDBA
+    Columns = <
+      item
+        Title.Caption = #39033#30446
+        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 = 'Project'
+        Width = 220
+        ReadOnly = True
+      end
+      item
+        Title.Caption = #39046#21462#30721
+        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 = clBlue
+        Font.Height = -13
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'Code'
+        Width = 150
+        ReadOnly = True
+      end>
+    DataSet = Reports.cdsCode
+    Grid = zgCode
+    ExtendRowCount = 0
+    Left = 780
+    Top = 72
+  end
 end
 end

+ 3 - 0
Forms/ReportManagerFrm.pas

@@ -33,6 +33,9 @@ type
     imgfilter: TImage;
     imgfilter: TImage;
     chkFilter: TCheckBox;
     chkFilter: TCheckBox;
     zgLoacl: TZJGrid;
     zgLoacl: TZJGrid;
+    zgCode: TZJGrid;
+    zaCode: TZjGridDBA;
+    Label4: TLabel;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure zgLoaclCellGetFont(Sender: TObject; ACoord: TPoint;
     procedure zgLoaclCellGetFont(Sender: TObject; ACoord: TPoint;

+ 1 - 0
Forms/ReportsFrm.dfm

@@ -15,6 +15,7 @@ object ReportsForm: TReportsForm
   Font.Style = []
   Font.Style = []
   OldCreateOrder = False
   OldCreateOrder = False
   Position = poMainFormCenter
   Position = poMainFormCenter
+  OnActivate = FormActivate
   PixelsPerInch = 96
   PixelsPerInch = 96
   TextHeight = 12
   TextHeight = 12
   object pnlPaperSize: TPanel
   object pnlPaperSize: TPanel

+ 19 - 1
Forms/ReportsFrm.pas

@@ -93,6 +93,7 @@ type
     procedure PreviewComXMLGetDatasetEvent(DatasetInfo: PDatasetInfoRec;
     procedure PreviewComXMLGetDatasetEvent(DatasetInfo: PDatasetInfoRec;
       var ADataset: TDataSet);
       var ADataset: TDataSet);
     procedure btnRMgrClick(Sender: TObject);
     procedure btnRMgrClick(Sender: TObject);
+    procedure FormActivate(Sender: TObject);
   private
   private
     FProjectData: TProjectData;
     FProjectData: TProjectData;
     FCurPage: Integer;
     FCurPage: Integer;
@@ -179,13 +180,14 @@ implementation
 uses
 uses
   UtilMethods, Math, Globals, ZhAPI, ReportAdjustFrm,
   UtilMethods, Math, Globals, ZhAPI, ReportAdjustFrm,
   Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm, ConstUnit,
   Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm, ConstUnit,
-  GclBillsGatherModel, ReportPdfHelper, ReportManagerFrm;
+  GclBillsGatherModel, ReportPdfHelper, ReportManagerFrm, ReportManagerDM;
 
 
 {$R *.dfm}
 {$R *.dfm}
 
 
 procedure DisplayReportsForm(AProjectData: TProjectData);
 procedure DisplayReportsForm(AProjectData: TProjectData);
 var
 var
   ReportsForm: TReportsForm;
   ReportsForm: TReportsForm;
+
 begin
 begin
   ReportsForm := TReportsForm.Create(nil);
   ReportsForm := TReportsForm.Create(nil);
   {ReportsForm.BorderIcons := ReportsForm.BorderIcons - [biMaximize];
   {ReportsForm.BorderIcons := ReportsForm.BorderIcons - [biMaximize];
@@ -1612,4 +1614,20 @@ begin
 end;
 end;
 
 
 
 
+procedure TReportsForm.FormActivate(Sender: TObject);
+var vReports: TReports;
+begin
+  // 自动检测并提醒用户有新报表要更新
+  vReports := TReports.Create(nil);
+  try
+    if vReports.HasNeedUpdateReport then
+    begin
+      Application.MessageBox('系统检测到有新的报表可以更新!', '提示', MB_OK + MB_ICONINFORMATION);
+      btnRMgr.Click;
+    end;
+  finally
+    vReports.Free;
+  end;
+end;
+
 end.
 end.