📄 gztunit.pas
字号:
unit gztunit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons,shellapi, Animate, GIFCtrl;
type
TGzt = class(TForm)
ListBox1: TListBox;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
ListBox2: TListBox;
SpeedButton1: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton3: TSpeedButton;
Panel2: TPanel;
rg: TRadioGroup;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
OpenDialog1: TOpenDialog;
RG2: TRadioGroup;
rg4: TRadioGroup;
Label3: TLabel;
Edit1: TEdit;
procedure BitBtn3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure ListBox2Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure Panel1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Gzt: TGzt;
implementation
uses gzdata, GZPUNIT, PrintShowUnit, DataTUnit,PassWordUnit, previewt;
{$R *.DFM}
procedure TGzt.BitBtn3Click(Sender: TObject);
begin
data.query1.close;
close;
end;
procedure TGzt.FormShow(Sender: TObject);
begin
gzt.Caption:='工资条打印';
listbox2.Items.Clear;
listbox1.Items.Clear;
with datat.BmTable2 do
begin
datat.BmTable2.DisableControls;
close;
open;
first;
while not eof do
begin
listbox2.Items.Add(datat.bmtable2.Fields[0].AsString+datat.bmtable2.Fields[1].AsString);
next;
end;
datat.BmTable2.EnableControls;
end;
// listbox1.ItemIndex:=0;
listbox2.ItemIndex:=0;
// gzt.Top:=gzt.top+1100;
// gzt.Position.x:=gzt.top+1100;
end;
procedure TGzt.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then Close;
end;
procedure TGzt.SpeedButton1Click(Sender: TObject);
var mm,ll,ddd:string;
r,i,j,k,llll,mmmm,n,jj:integer;
begin
if listbox1.Items.Count<=0 then abort;
if printshowform=nil then
Application.CreateForm(TPrintShowForm, PrintShowForm);
ddd:='';
ddd:=password.maskedit1.text+'-'+inttostr(strtoint(password.edit4.text));
IF (application.messagebox(pchar('您所选择的打印数据是: '+ddd+'月,正确吗?'),'消息框',mb_okcancel+mb_defbutton1+mb_iconquestion)
=idcancel) then abort;
datat.Table2.DisableControls;
datat.Table5.DisableControls;
data.Query1.DisableControls;
data.Query4.DisableControls;
for jj:=0 to listbox1.Items.Count-1 do
begin
data.Query1.Close;
PrintShowForm.Show;
PrintShowForm.Label1.Caption:='正在整理数据、计算每页合计数请稍候...';
printshowForm.Label1.Update;
PrintShowForm.Update;
Application.ProcessMessages;
with data.Query1.SQL do
begin
ll:='';
mm:='';
ll:=copy(listbox1.Items[jj],1,5);
mm:=listbox1.Items[jj];
PrintShowForm.Label1.Caption:=mm+'正在输出打印数据,请稍候...';
printshowForm.Label1.Update;
clear;
add('select * from lyk.dbf');
add('where bmno='''+ll+'''');
add('and riqi='''+ddd+'''');
case rg2.ItemIndex of
0:
begin
add('order by bz_gw desc,sfe desc ');
end;
1:
begin
add('order by zjqt6 desc');
end;
end;
end;
data.Query1.Open;
Application.ProcessMessages;
if Data.Query1.IsEmpty then
begin
ddd:=ddd+'数据不存在,请重新选择日期或者重新生成本月数据!!!';
printshowform.Hide;
application.messagebox(pchar(ddd),'消息框',mb_ok+mb_iconinformation);
data.Query1.Close;
abort;
end;
Application.ProcessMessages;
with data.Query1 do
begin
first;
try
if datat.Table5.Active then
datat.Table5.Close;
datat.Table5.Close;
datat.Table5.EmptyTable;
if not(datat.Table5.Active) then
datat.Table5.Active:=true;
datat.Table5.Open;
except
end;
llll:=data.Query1.RecordCount;
mmmm:=data.Query1.RecordCount;
llll:=llll div 8 ;
if (mmmm mod 8)=0 then
llll:=llll-1;
i:=0;
while i<=llll do
begin
try
if datat.Table2.Active then
datat.table2.Close;
datat.Table2.Close;
datat.Table2.EmptyTable;
if not(datat.table2.Active) then
datat.table2.Active:=true;
datat.Table2.Open;
except
end;
r:=0;
for j:=1 to 8 do
begin
if not eof then
begin
datat.table2.Append;
for k:=0 to data.query1.FieldCount-1 do
begin
datat.Table2.Edit;
datat.Table2.Fields[k].assign(data.query1.Fields[k]);
case rg.ItemIndex of
0:
begin
datat.Table2.FieldByName('tj').AsString:=ddd+'--'+inttostr(strtoint(data.query1.FieldByName('code').asstring));//copy(dateto
end;
1:
begin
datat.Table2.FieldByName('tj').AsString:=ddd;//copy(dateto
end;
end;
//datat.Table2.FieldByName('tj').AsString:=ddd;//copy(datetostr(date),1,7);
datat.Table2.Post;
end;
r:=r+1;
next;
end //eof
else
begin
datat.table2.edit;
datat.Table2.append;
datat.table2.post;
end;
end; //eof
i:=i+1;
Application.ProcessMessages;
//计算每页合计数
data.query4.close;
data.Query4.open;
datat.Table2.Append;
datat.Table2.Edit;
datat.table2.fieldbyname('bz_gw').asfloat:=data.query4.fields[0].asfloat;
datat.Table2.FieldByName('name').asstring:='合计 '+inttostr(r)+'人';
datat.table2.fieldbyname('bz_jn').asfloat:=data.query4.fields[1].asfloat;
datat.table2.fieldbyname('jb_js_d').asfloat:=data.query4.fields[2].asfloat;
datat.table2.fieldbyname('jb_js').asfloat:=data.query4.fields[3].asfloat;
datat.table2.fieldbyname('jb_jj').asfloat:=data.query4.fields[4].asfloat;
datat.table2.fieldbyname('jb_jc').asfloat:=data.query4.fields[5].asfloat;
datat.table2.fieldbyname('jb_nt_d').asfloat:=data.query4.fields[6].asfloat;
datat.table2.fieldbyname('jb_nt').asfloat:=data.query4.fields[7].asfloat;
datat.table2.fieldbyname('jb_bj_d').asfloat:=data.query4.fields[8].asfloat;
datat.table2.fieldbyname('jb_bj').asfloat:=data.query4.fields[9].asfloat;
datat.table2.fieldbyname('jb_gs_d').asfloat:=data.query4.fields[10].asfloat;
datat.table2.fieldbyname('jb_gs').asfloat:=data.query4.fields[11].asfloat;
datat.table2.fieldbyname('jb_hc_d').asfloat:=data.query4.fields[12].asfloat;
datat.table2.fieldbyname('jb_hc').asfloat:=data.query4.fields[13].asfloat;
datat.table2.fieldbyname('jb_by').asfloat:=data.query4.fields[14].asfloat;
datat.table2.fieldbyname('jb_qt').asfloat:=data.query4.fields[15].asfloat;
datat.table2.fieldbyname('jl_jj').asfloat:=data.query4.fields[16].asfloat;
datat.table2.fieldbyname('jl_ce').asfloat:=data.query4.fields[17].asfloat;
datat.table2.fieldbyname('jl_qt').asfloat:=data.query4.fields[18].asfloat;
datat.table2.fieldbyname('jt_xj_d').asfloat:=data.query4.fields[19].asfloat;
datat.table2.fieldbyname('jt_xj').asfloat:=data.query4.fields[20].asfloat;
datat.table2.fieldbyname('jt_gt').asfloat:=data.query4.fields[21].asfloat;
datat.table2.fieldbyname('jt_zr').asfloat:=data.query4.fields[22].asfloat;
datat.table2.fieldbyname('jt_yb').asfloat:=data.query4.fields[23].asfloat;
datat.table2.fieldbyname('jt_jg').asfloat:=data.query4.fields[24].asfloat;
datat.table2.fieldbyname('jt_st').asfloat:=data.query4.fields[25].asfloat;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -