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

📄 invaccountage.~pas

📁 文件包含程序源原文件
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit InvAccountAge;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, EnhLV, GLLV, StdCtrls, Buttons, Ex2nmedt, ExtCtrls, xlsConst,
  ClipBrd, ComObj, dpConst, InvDef, Math;


type
  TfrmAccountAge = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    rdogrpView: TRadioGroup;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    edtMatCode: TEdit;
    BitBtn1: TBitBtn;
    Panel3: TPanel;
    btnClose: TBitBtn;
    BitBtn2: TBitBtn;
    ListView: TGradLineListView;
    stsBarCnt: TStatusBar;
    Panel4: TPanel;
    Panel5: TPanel;
    chkStkLess0: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn2Click(Sender: TObject);
    procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
    procedure BitBtn1Click(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
  private
    { Private declarations }
    /////////////////////////////////////////////
    procedure SetListColumn(iMode: integer);
    procedure SetListView(iMode: integer);
    function  Set_QryCondition(lcP: PInvAgeInfo): Boolean;
    procedure MakeItemCaption(Item: TListItem; iMode: integer);
    procedure Read_InvAgeInfo;

    /////////////////////////////////////////////
    Procedure PrintProc;
    function  CopyToClipBoard(var RecCnt, ColCnt: Integer): string;
  public
    { Public declarations }
  end;

var
  frmAccountAge: TfrmAccountAge;
  FInvAgeList: TList;
  FColumnCount: Integer;
  ListSortKey:  Integer;

implementation

uses Main, InvDM;

{$R *.dfm}


/////////////////////////////////////////////////////////////////////////////
function ListSortCompare(Item1, Item2: Pointer): Longint;
var DataType: Integer;
    Str1, Str2: string;
    Int1, Int2: Integer;
    Dbl1, Dbl2: Double;
    Dat1, Dat2: TDateTime;
begin
  Result := 0;
  Str1 := ''; Str2 := '';
  Int1 := 0;  Int2 := 0;
  Dbl1 := 0;  Dbl2 := 0;
  Dat1 := 0;  Dat2 := 0;
  case Abs(ListSortKey) of
    1: begin //--
        Str1 := dm_inventory.GetMaterialCode(TInvAgeInfo(Item1^).mat_rec_id);
        Str2 := dm_inventory.GetMaterialCode(TInvAgeInfo(Item2^).mat_rec_id);
        DataType := 0;
       end;
    2: begin //--
        Str1 := dm_inventory.GetMaterialName(TInvAgeInfo(Item1^).mat_rec_id);
        Str2 := dm_inventory.GetMaterialName(TInvAgeInfo(Item2^).mat_rec_id);
        DataType := 0;
       end;
    3: begin //--
        Int1 := TInvAgeInfo(Item1^).guage_id;
        Int2 := TInvAgeInfo(Item2^).guage_id;
        DataType := 1;
       end;
    5: begin //--
        Str1 := dm_inventory.GetUnitTypeName(TInvAgeInfo(Item1^).mat_rec_id);
        Str2 := dm_inventory.GetUnitTypeName(TInvAgeInfo(Item2^).mat_rec_id);
        DataType := 0;
       end;
    6: begin //--
        Dbl1 := TInvAgeInfo(Item1^).curr_qty;
        Dbl2 := TInvAgeInfo(Item2^).curr_qty;
        DataType := 2;
       end;
    7: begin //--
        Dbl1 := TInvAgeInfo(Item1^).curr_amount;
        Dbl2 := TInvAgeInfo(Item2^).curr_amount;
        DataType := 2;
       end;
  else Exit;
  end;
  case DataType of
    0: if Str1 < Str2 then  Result := -1
       else if Str1 > Str2 then Result := 1
       else Result := 0;
    1: if Int1 < Int2 then  Result := -1
       else if Int1 > Int2 then Result := 1
       else Result := 0;
    2: if Dbl1 < Dbl2 then  Result := -1
       else if Dbl1 > Dbl2 then Result := 1
       else Result := 0;
    3: if Dat1 < Dat2 then  Result := -1
       else if Dat1 > Dat2 then Result := 1
       else Result := 0;
  else Result := 0;
  end;
  if ListSortKey < 0 then Result := Result * -1;
end;

procedure TfrmAccountAge.FormCreate(Sender: TObject);
begin
  FInvAgeList := TList.Create;
  FInvAgeList.Clear;
end;

procedure TfrmAccountAge.FormShow(Sender: TObject);
begin
  Top    := frmMain.Height;
  Left   := 0;
  Width  := Screen.Width;
  Height := Screen.Height-(frmMain.Height+stsBarCnt.Height+8);

  edtMatCode.Text      := '';
  rdogrpView.ItemIndex := 0;
  chkStkLess0.Checked  := true;
  Read_InvAgeInfo;
end;

procedure TfrmAccountAge.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  WindowState := wsMinimized;
  Action := cafree;
end;

procedure TfrmAccountAge.BitBtn2Click(Sender: TObject);
begin
  close;
end;

procedure TfrmAccountAge.SetListColumn(iMode: integer);
var Column: TListColumn;
begin
  FColumnCount := 0;
  ListView.Columns.Clear;

  Column := ListView.Columns.Add;
  Column.Width   := ListView.Font.Size * 14;
  Column.Caption := GetMultiLingalMsg(90028, 'Material Code');
  Inc(FColumnCount);
  Column := ListView.Columns.Add;
  Column.Width   := ListView.Font.Size * 14;
  Column.Caption := GetMultiLingalMsg(90029, 'Material Name');
  Inc(FColumnCount);
  Column := ListView.Columns.Add;
  Column.Width   := ListView.Font.Size * 7;
  Column.Caption := GetMultiLingalMsg(90030, 'Guage ID');
  Inc(FColumnCount);
  Column := ListView.Columns.Add;
  Column.Width   := ListView.Font.Size * 18;
  Column.Caption := GetMultiLingalMsg(90031, 'Guage Name');
  Inc(FColumnCount);
  Column := ListView.Columns.Add;
  Column.Width   := ListView.Font.Size * 6;
  Column.Caption := GetMultiLingalMsg(90032, 'Unit Name');
  Inc(FColumnCount);
  Column := ListView.Columns.Add;
  Column.Width     := ListView.Font.Size * 10;
  Column.Alignment := taRightJustify;
  Column.Caption   := GetMultiLingalMsg(90156, 'Final Stock Quantity');
  Inc(FColumnCount);

  Column := ListView.Columns.Add;
  Column.Width     := ListView.Font.Size * 12;
  Column.Alignment := taRightJustify;
  Column.Caption   := GetMultiLingalMsg(90162, 'Final Stock Amount');
  Inc(FColumnCount);
  if (iMode=0) then
  begin
    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '1个月';
    Inc(FColumnCount);
    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '2个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '3个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '4个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '5个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '6个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '7个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '8个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '9个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '10个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '11个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '12个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '13个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '14个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '15个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '16个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '17个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '18个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '19个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '20个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '21个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '22个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '23个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '24个月';
    Inc(FColumnCount);

    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 8;
    Column.Alignment := taRightJustify;
    Column.Caption   := '2年以上';
    Inc(FColumnCount);
  end
  else begin
    Column := ListView.Columns.Add;
    Column.Width     := ListView.Font.Size * 10;
    Column.Alignment := taRightJustify;
    Column.Caption   := '1年期';
    Inc(FColumnCount);

⌨️ 快捷键说明

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