📄 salary_win.~pas
字号:
unit salary_win;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls,report3;
type
Tsal_win = class(TForm)
Panel1: TPanel;
Label1: TLabel;
ComboBox1: TComboBox;
Label2: TLabel;
ComboBox2: TComboBox;
BitBtn1: TBitBtn;
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
sal_win: Tsal_win;
implementation
{$R *.dfm}
procedure Tsal_win.ComboBox1Change(Sender: TObject);
begin
ComboBox2.SetFocus;
end;
procedure Tsal_win.ComboBox2Change(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure Tsal_win.BitBtn1Click(Sender: TObject);
var str1,str2 :string;
begin
salary_report3.Query1.Active:=false;
str1:=ComboBox1.Text+'-'+ComboBox2.Text+'-'+inttostr(1);
str2:=ComboBox1.Text+'-'+ComboBox2.Text+'-'+inttostr(31);
with salary_report3.Query1 do
begin
close;
SQL.Clear;
SQL.Add('create table #salary(工号 [varchar](10) not null , 修理小时 float)');
SQL.Add('insert into #salary(工号,修理小时) ');
SQL.Add('select 工号,sum(修理小时) as 修理小时 from z3 where 完修日期>:a and 完修日期<:b group by 工号');
SQL.Add('select z2.姓名,#salary.工号,#salary.修理小时,z2.小时工资,(#salary.修理小时*z2.小时工资) as 月工资 from z2,#salary where #salary.工号=z2.工号');
SQL.Add('drop table #salary');
parambyName('a').AsString:=str1;
parambyName('b').AsString:=str2;
ExecSQL;
salary_report3.Query1.Active:=true;
if salary_report3.Query1.Eof then
begin
messagebeep(0);
showmessage('没有这个月的记录!!');
exit;
end;
salary_report3.QuickRep1.Preview;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -