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