⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 provicesearch.pas

📁 ProviceSystem-公积金监管系统中心端
💻 PAS
字号:
unit ProviceSearch;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, ComCtrls, StdCtrls, ExtCtrls, Menus, ImgList,
  ToolWin, DBCtrls, OleCtrls, CELLLib_TLB, Types;

type
  TFrmProviceSearch = class(TForm)
    CoolBar1: TCoolBar;
    ImageList1: TImageList;
    ImageList2: TImageList;
    ToolBar1: TToolBar;
    ToolButton8: TToolButton;
    ToolButton7: TToolButton;
    ToolButton5: TToolButton;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    cellInfo: TCell;
    pmnLevel: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    Panel1: TPanel;
    DBMemo1: TDBMemo;
    Label1: TLabel;
    ToolButton4: TToolButton;
    N5: TMenuItem;
    N6: TMenuItem;
    N7: TMenuItem;
    N8: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure ToolButton8Click(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure N4Click(Sender: TObject);
    procedure cellInfoRClickGrid(ASender: TObject; col, row: Integer;
      updn: WordBool);
    procedure cellInfoCellChange(ASender: TObject; oldcol, oldrow, newcol,
      newrow: Integer);
    procedure ToolButton1Click(Sender: TObject);
  private
    { Private declarations }
    fURL, fCityNum, fYearMonth: String;
    fPromptLevel, fType, fTypeItem, fSort: smallint;
    procedure SetCellTitle;
    procedure SetCellStyle;
    procedure SetLevel(const nLevel: smallint);
  public
    { Public declarations }
    function LoadSearchInfo: Boolean;
  end;

var
  FrmProviceSearch: TFrmProviceSearch;

implementation

{$R *.dfm}
uses ProviceSearchOption, uUserFunc, uDMFunc, ProvinceSearchDetailed, frmPJgMain;

function TFrmProviceSearch.LoadSearchInfo: Boolean;
var
  frmPSO: TFrmSearchOption;
  sCityNum,sYearMonth: String;
  nPromptLevel,nType,nSort,i: smallint;
begin
  Result := True;
  frmPSO := TFrmSearchOption.Create(application);
  frmPSO.SetOption(fCityNum, fYearMonth, fPromptLevel, fType, fSort);
  frmPSO.ShowModal;
  if frmPSO.GetOption(sCityNum,sYearMonth,nPromptLevel,nType,nSort) then
  begin
    fCityNum := sCityNum;
    fYearMonth := sYearMonth;
    fPromptLevel := nPromptLevel;
    fType := nType;
    fSort := nSort;
    for i:=0 to high(MainP.aNode) do
      if MainP.aNode[i].Number = fCityNum then
      begin
        fURL := MainP.aNode[i].URL;
        Break;
      end;

  end
  else
    Result := False;
  frmPSO.Free;
  if Result then
  begin
    ProviceResult(fCityNum,fYearMonth,fType,fTypeItem,fPromptLevel,fSort,cellInfo);
    SetCellStyle;
    CellInfo.OnCellChange(CellInfo,0,1,0,0);
  end;
end;

procedure TFrmProviceSearch.FormCreate(Sender: TObject);
begin
  cellInfo.DoLogin('北京金天鹏软件科技有限公司',363,'00FD18FF080193035CFE09FF9908');
  SetCellTitle;
  fCityNum := '';
  fYearMonth := DToS(Date);
  fPromptLevel := -1;
  fType := -1;
  fSort := 0;
  fTypeItem := -1;
end;

procedure TFrmProviceSearch.ToolButton8Click(Sender: TObject);
begin
  LoadSearchInfo;
end;

procedure TFrmProviceSearch.ToolButton3Click(Sender: TObject);
begin
  close;
end;

procedure TFrmProviceSearch.SetCellTitle;
var
  j: smallint;
begin
  CellInfo.DoSetCellString(0,-1,'日期');
  CellInfo.DoSetCellString(1,-1,'预警类型');
  CellInfo.DoSetCellString(2,-1,'类型小项');
  CellInfo.DoSetCellString(3,-1,'流水编号');
  CellInfo.DoSetCellString(4,-1,'数值');
  CellInfo.DoSetCellString(5,-1,'提示级别');
  CellInfo.DoSetCellString(6,-1,'相关信息');
  CellInfo.DoSetCellString(7,-1,'提示信息');
  for j :=0 to CellInfo.Cols -1 do
    CellInfo.DoSetCellFont(j,-1,9,0,'宋体');
  CellInfo.DoSetColWidth(0,80);
  CellInfo.DoSetColWidth(1,75);
  CellInfo.DoSetColWidth(2,75);
  CellInfo.DoSetColWidth(3,75);
  CellInfo.DoSetColWidth(4,150);
  CellInfo.DoSetColWidth(5,100);
  CellInfo.DoSetColWidth(6,160);
  CellInfo.DoSetColWidth(7,800);
  CellInfo.DoRedrawAll;
end;

procedure TFrmProviceSearch.SetCellStyle;
var
  i,j: integer;
  vLevel: OleVariant;
begin
  for i:= 0 to CellInfo.Rows -1 do
    for j :=0 to CellInfo.Cols -1 do
      CellInfo.DoSetCellFont(j,i,9,0,'宋体');
  for i:= 0 to CellInfo.Rows -1 do
     CellInfo.DoSetCellNumberStyle(4,i,0,false,2,-1,1,-1,false);

  for i:= 0 to CellInfo.Rows -1 do
  begin
    CellInfo.DoGetCellData(5,i,vLevel);
    if vLevel = '正常数据' then
      for j :=0 to CellInfo.Cols -1 do
        CellInfo.DoSetCellColor(j,i,rgb(128,128,128),rgb(255,255,255))
    else if vLevel = '一般关注' then
      for j :=0 to CellInfo.Cols -1 do
        CellInfo.DoSetCellColor(j,i,0,rgb(255,255,255))
    else if vLevel = '高度关注' then
      for j :=0 to CellInfo.Cols -1 do
        CellInfo.DoSetCellColor(j,i,rgb(0,0,255),rgb(255,255,255))
    else
      for j :=0 to CellInfo.Cols -1 do
        CellInfo.DoSetCellColor(j,i,rgb(255,0,0),rgb(255,255,255));
  end;
{  CellInfo.DoSetColWidth(0,65);
  CellInfo.DoSetColWidth(1,60);
  CellInfo.DoSetColWidth(2,60);
  CellInfo.DoSetColWidth(3,65);
  CellInfo.DoSetColWidth(4,100);
  CellInfo.DoSetColWidth(5,60);
  CellInfo.DoSetColWidth(6,160);
  CellInfo.DoSetColWidth(7,800);
}
  CellInfo.DoRedrawAll;
end;

procedure TFrmProviceSearch.SetLevel(const nLevel: smallint);
var
  nRow,nRow1,nCol,nCol1,i,j: integer;
  vType, vTypeItem, vNumber: OleVariant;
  aType,aTypeItem: TSmallintDynArray;
  aNumber: TIntegerDynArray;
begin

  if not CellInfo.DoGetSelectRange2(nCol,nRow,nCol1,nRow1) then
  begin
    nRow := CellInfo.DoGetCurrentRow ;
    nRow1 := nRow;
  end;
  j:=0;
  for i := nRow to nRow1 do
  begin
    CellInfo.DoGetCellData(1,i,vType);
    CellInfo.DoGetCellData(2,i,vTypeItem);
    CellInfo.DoGetCellData(3,i,vNumber);
    inc(j);
    setlength(aNumber,j+1);
    setlength(aType,j+1);
    setlength(aTypeItem,j+1);
    aNumber[j] := vNumber;
    aType[j] := vType;
    aTypeItem[j] := vTypeItem;
  end;
  if SetProvicePromptLevel(fCityNum,aType,aTypeItem,aNumber,nLevel)=0 then
  begin
    for i := nRow to nRow1 do
    begin
      case nLevel of
        0:
           begin
             CellInfo.DoSetCellString(5,i,'正常数据');
             for j :=0 to CellInfo.Cols -1 do
               CellInfo.DoSetCellColor(j,i,rgb(128,128,128),rgb(255,255,255));
           end;
        1:
           begin
             CellInfo.DoSetCellString(5,i,'一般关注');
             for j :=0 to CellInfo.Cols -1 do
               CellInfo.DoSetCellColor(j,i,0,rgb(255,255,255));
           end;
        2:
           begin
             CellInfo.DoSetCellString(5,i,'高度关注');
             for j :=0 to CellInfo.Cols -1 do
               CellInfo.DoSetCellColor(j,i,rgb(0,0,255),rgb(255,255,255));
           end;
        3:
           begin
             CellInfo.DoSetCellString(5,i,'严重关注');
             for j :=0 to CellInfo.Cols -1 do
               CellInfo.DoSetCellColor(j,i,rgb(255,0,0),rgb(255,255,255));
           end;
      end;
    end;
  end;

{  for i := nRow to nRow1 do
  begin
    CellInfo.DoGetCellData(1,i,vType);
    CellInfo.DoGetCellData(2,i,vTypeInfo);
    CellInfo.DoGetCellData(3,i,vNumber);

    SetProvicePromptLevel(fCityNum,vType,vTypeItem,vNumber,nLevel);
    case nLevel of
      0:
         begin
           CellInfo.DoSetCellString(5,i,'正常数据');
           for j :=0 to CellInfo.Cols -1 do
             CellInfo.DoSetCellColor(j,i,rgb(128,128,128),rgb(255,255,255));
         end;
      1:
         begin
           CellInfo.DoSetCellString(5,i,'一般关注');
           for j :=0 to CellInfo.Cols -1 do
             CellInfo.DoSetCellColor(j,i,0,rgb(255,255,255));
         end;
      2:
         begin
           CellInfo.DoSetCellString(5,i,'高度关注');
           for j :=0 to CellInfo.Cols -1 do
             CellInfo.DoSetCellColor(j,i,rgb(0,0,255),rgb(255,255,255));
         end;
      3:
         begin
           CellInfo.DoSetCellString(5,i,'严重关注');
           for j :=0 to CellInfo.Cols -1 do
             CellInfo.DoSetCellColor(j,i,rgb(255,0,0),rgb(255,255,255));
         end;
    end;
  end;
}
  CellInfo.DoRedrawAll;
end;

procedure TFrmProviceSearch.N1Click(Sender: TObject);
begin
  SetLevel(0);
end;

procedure TFrmProviceSearch.N2Click(Sender: TObject);
begin
  SetLevel(1);
end;

procedure TFrmProviceSearch.N3Click(Sender: TObject);
begin
  SetLevel(2);
end;

procedure TFrmProviceSearch.N4Click(Sender: TObject);
begin
  SetLevel(3);
end;

procedure TFrmProviceSearch.cellInfoRClickGrid(ASender: TObject; col,
  row: Integer; updn: WordBool);
var
  i, nLeftCol, nTopRow, nPos: Integer;
  nPosX,nPosY: Word;
begin
  nLeftCol := CellInfo.DoGetLeftCol;
  nTopRow := CellInfo.DoGetTopRow;
  nPosX := 0;
  nPosY := 0;
  for i := nTopRow to row-1 do
  begin
    CellInfo.DoGetRowHeight(i,nPos);
    nPosY := nPosY + nPos;
  end;
  for i := nLeftCol to col-1 do
  begin
    CellInfo.DoGetColWidth(i,nPos);
    nPosX := nPosX + nPos;
  end;
  pmnLevel.Popup(nPosX,nPosY);
end;

procedure TFrmProviceSearch.cellInfoCellChange(ASender: TObject; oldcol,
  oldrow, newcol, newrow: Integer);
var
  vNum, vType, vTypeItem: OleVariant;
begin
  if oldrow = newrow then
    exit;
  CellInfo.DoGetCellData(1,newrow,vType);
  CellInfo.DoGetCellData(2,newrow,vTypeItem);
  CellInfo.DoGetCellData(3,newrow,vNum);
  ProviceResultRevert(vType,vTypeItem,vNum,DBMemo1);
end;

procedure TFrmProviceSearch.ToolButton1Click(Sender: TObject);
var
  JGMx: TFrmSearchDetailed;
  nRow: integer;
  vData: oleVariant;
begin
  JGMx := TFrmSearchDetailed.Create(application);
  nRow := CellInfo.DoGetCurrentRow;
  CellInfo.DoGetCellData(0,nRow,vData);
  JGMx.sDate := vData;
  CellInfo.DoGetCellData(1,nRow,vData);
  JGMx.nType := Integer(vData);
  CellInfo.DoGetCellData(2,nRow,vData);
  JGMx.nTypeItem := Integer(vData);
  CellInfo.DoGetCellData(6,nRow,vData);
  JGMx.sOther := vData;
  JGMx.sCityNum := fCityNum ;
  JGMx.sMonth := fYearMonth;
  JGMx.sURL := fURL;
  JGMx.LoadDetailed;
  JGMx.ShowModal;
  JGMx.Free;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -