📄 log.pas
字号:
unit log;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, DBTables, Db, Mask, ExtCtrls, Registry;
type
Tfrm_log = class(TForm)
pe_1: TPanel;
Label1: TLabel;
Label2: TLabel;
txt_name: TEdit;
txt_password: TMaskEdit;
db_qp3: TDatabase;
qe_log: TQuery;
se_qp3: TSession;
cmdOK: TBitBtn;
cmdCancel: TBitBtn;
qe_pj: TQuery;
a: TQuery;
jm: TComboBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure txt_nameChange(Sender: TObject);
procedure cmdOKClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure txt_nameKeyPress(Sender: TObject; var Key: Char);
procedure txt_passwordKeyPress(Sender: TObject; var Key: Char);
procedure txt_zcKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
zArray: array[0..9] of string;
wArray: array[1..2, 1..16] of string;
//
procedure arrayInit;
public
{ Public declarations }
yj_jsfs: integer;
//
cur_gs_name: string;
cur_gs_addr: string;
cur_gs_tel: string;
bx_z_title: string;
bx_f_title: string;
//
intPrint: integer;
//
receiveDays: integer;
//
function controlDate(strDate: string): string;
function shiftNum(fNum: Double): string;
function ControlNum(strNum: string): string;
function GetRandomX(intX, intY, intZ: integer): integer;
end;
var
frm_log: Tfrm_log;
//
mHandle: THandle;
PreviousInstanceWindow: HWND;
Project: String;
AppName: string;
NoRegistry: boolean;
SpareDays: integer;
implementation
{$R *.DFM}
uses
main, Des, zc;
function Tfrm_log.GetRandomX(intX, intY, intZ: integer): integer;
begin
Result := (intZ - intY * intY + 3* intX - 35467128) xor intY;
end;
procedure Tfrm_log.arrayInit;
begin
wArray[1, 1] := '0000';
wArray[2, 1] := '';
wArray[1, 2] := '0001';
wArray[2, 2] := '一';
wArray[1, 3] := '0011';
wArray[2, 3] := '一拾一';
wArray[1, 4] := '0010';
wArray[2, 4] := '一拾';
wArray[1, 5] := '0111';
wArray[2, 5] := '一佰一拾一';
wArray[1, 6] := '0101';
wArray[2, 6] := '一佰零一';
wArray[1, 7] := '0110';
wArray[2, 7] := '一佰一拾';
wArray[1, 8] := '0100';
wArray[2, 8] := '一佰';
wArray[1, 9] := '1000';
wArray[2, 9] := '一仟';
wArray[1, 10] := '1100';
wArray[2, 10] := '一仟一佰';
wArray[1, 11] := '1010';
wArray[2, 11] := '一仟零一拾';
wArray[1, 12] := '1001';
wArray[2, 12] := '一仟零一';
wArray[1, 13] := '1110';
wArray[2, 13] := '一仟一佰一拾';
wArray[1, 14] := '1101';
wArray[2, 14] := '一仟一佰零一';
wArray[1, 15] := '1011';
wArray[2, 15] := '一仟零一拾一';
wArray[1, 16] := '1111';
wArray[2, 16] := '一仟一佰一拾一';
//
zArray[0] := '零';
zArray[1] := '壹';
zArray[2] := '贰';
zArray[3] := '叁';
zArray[4] := '肆';
zArray[5] := '伍';
zArray[6] := '陆';
zArray[7] := '柒';
zArray[8] := '捌';
zArray[9] := '玖';
end;
function Tfrm_log.ControlNum(strNum: string): string;
var
strSub: string;
intPos: integer;
strResult: string;
begin
intPos := Pos('.', strNum);
if intPos > 0 then begin
strSub := Trim(Copy(strNum, intPos + 1, Length(strNum)));
if Length(strSub) = 1 then
strResult := strNum + '0'
else
strResult := strNum;
end else
strResult := strNum + '.00';
//
Result := strResult;
end;
function Tfrm_log.shiftNum(fNum: Double): string;
//人民币金额大小写转换函数(如发现更为精简的,请告诉我)
//作者:方小庆(上海) inrm@263.net
Function IIF(b :boolean; s1,s2 :string):string;
begin {本函数在VFP和VB里均为内部函数}
if b then IIF:=s1 else IIF:=s2;
end;
Const c:WideString = '零壹贰叁肆伍陆柒捌玖◇分角元拾佰仟万拾佰仟亿拾佰仟万';
var L,i,n :integer;
Z,a :boolean;
s, st :WideString;
begin
s:= FormatFloat('0',fNum*100);
L:= Length(s);
Z:= false;
For i:=1 to L do
begin
n:= ord( s[L-i+1])-48;// StrToInt( s[L-i+1]);
a:= (i=11)or(i=7)or(i=3)or(i=1); //亿、万、元、分位
st:=IIF((n=0)and(Z or a), '', c[n+1]) //数值
+ IIF((n=0)and(i=1),'整', //分位为零
IIF((n>0)or a, c[i+11], '')) //单位
+ IIF((n=0)and(not Z)and(i>1)and a,'零','') //亿、万、元位为零而千万、千、角位不为零
+ st;
Z:= n=0;
end;
For i:=1 To Length(st) do
If Copy(st,i,2)='亿万' Then Delete(st,i+1,1); //亿位和万位之间都是零时会出现’亿万’
result:= IIF(fNum>9999999999999.99, '溢出', IIf(fNum = 0, '零', st));
End;
{
function Tfrm_log.shiftNum(fNum: Double): string;
var
intVal: double;
fltVal: double;
//
strInt: string;
strInt_x: string;
strInt_s: string;
strInt_x1: string;
strInt_s1: string;
intLen, intPos: integer;
//
i: integer;
strC, strC1: string;
strResult: string;
begin
intVal := Int(fNum);
fltVal := Frac(fNum);
fltVal := Int(fltVal) + Round((Frac(fltVal)*100))/100;
//
strInt := FloatToStr(intVal);
intLen := Length(strInt);
if intLen <= 4 then begin
if intLen = 1 then
strInt_x := '000' + strInt
else if intLen = 2 then
strInt_x := '00' + strInt
else if intLen = 3 then
strInt_x := '0' + strInt
else if intLen = 4 then
strInt_x := strInt;
//
strInt_s := '';
end else begin
if intLen = 5 then begin
strInt_s := '000' + Copy(strInt, 1, 1);
strInt_x := Copy(strInt, 2, 4);
end else if intLen = 6 then begin
strInt_s := '00' + Copy(strInt, 1, 2);
strInt_x := Copy(strInt, 3, 4);
end else if intLen = 7 then begin
strInt_s := '0' + Copy(strInt, 1, 3);
strInt_x := Copy(strInt, 4, 4);
end else if intLen = 8 then begin
strInt_s := Copy(strInt, 1, 4);
strInt_x := Copy(strInt, 5, 4);
end;
end;
//
if strInt_s <> '' then begin
strInt_s1 := strInt_s;
for i := 1 to 4 do
if strInt_s1[i] <> '0' then strInt_s1[i] := '1';
for i := 1 to 16 do begin
if wArray[1, i] = strInt_s1 then begin
strInt_s1 := wArray[2, i];
Break;
end;
end;
//
for i := 1 to 4 do begin
if strInt_s[i] <> '0' then begin
strC := strInt_s[i];
strC1 := zArray[StrToInt(strC)];
strInt_s1 := StringReplace(strInt_s1, '一', strC1,[]);
end;
end;
//
strInt_s1 := Trim(strInt_s1) + '万';
end;
//
if strInt_x <> '0000' then begin
strInt_x1 := strInt_x;
for i := 1 to 4 do
if strInt_x1[i] <> '0' then strInt_x1[i] := '1';
for i := 1 to 16 do begin
if wArray[1, i] = strInt_x1 then begin
strInt_x1 := wArray[2, i];
Break;
end;
end;
//
for i := 1 to 4 do begin
if strInt_x[i] <> '0' then begin
strC := strInt_x[i];
strC1 := zArray[StrToInt(strC)];
strInt_x1 := StringReplace(strInt_x1, '一', strC1,[]);
end;
end;
//
strInt_x1 := Trim(strInt_x1) + '元';
end else
strInt_x1 := '元';
//
if strInt_s <> '' then begin
if strInt_x <> '0000' then begin
if (strInt_s[4] = '0') or (strInt_x[1] = '0') then
strResult := '币' + strInt_s1 + '零' + strInt_x1
else
strResult := '币' + strInt_s1 + strInt_x1;
end else
strResult := '币' + strInt_s1 + strInt_x1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -