📄 sprubb.~pas
字号:
unit sprubb;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RpDefine, RpBase, RpSystem, DB, StdCtrls, Grids, DBGrids,
Buttons, ExtCtrls, ComCtrls;
type
TForm64 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
SpeedButton1: TSpeedButton;
BitBtn8: TBitBtn;
BitBtn1: TBitBtn;
ComboBox1: TComboBox;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
d: TRvSystem;
Panel4: TPanel;
Label2: TLabel;
Label9: TLabel;
CheckBox2: TCheckBox;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
procedure FormShow(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure dPrint(Sender: TObject);
procedure BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form64: TForm64;
implementation
uses DataModal, ckglxt;
{$R *.dfm}
procedure TForm64.FormShow(Sender: TObject);
begin
ComboBox1.Clear;
with Data.ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select Distinct 商品名称 from 入库表');
Open;
end;
while Not Data.ADOQuery1.Eof do
begin
ComboBox1.Items.Add(Data.ADOQuery1.FieldByName('商品名称').Value);
Data.ADOQuery1.Next;
end;
DataSource1.DataSet := Nil;
end;
procedure TForm64.SpeedButton1Click(Sender: TObject);
begin
if Trim(ComboBox1.Text)<>'' then
begin
with Data.ADOQuery1 do
begin
Close;
SQL.Clear;
if CheckBox2.Checked = False then
SQL.Add('select * from 入库表 where 商品名称 =:a')
else
begin
SQL.Add('select * from 入库表 where 商品名称 =:a');
SQL.Add('and 入库票号 in (select 入库票号 from 入库票号表 where 入库时间>= :b and 入库时间<= :c )');
Parameters.ParamByName('b').Value := Trunc(DateTimePicker1.Date)-2;
Parameters.ParamByName('c').Value := Trunc(DateTimePicker2.Date)-2+0.9998;
end;
Parameters.ParamByName('a').Value := Trim(ComboBox1.Text);
Open;
end;
if Data.ADOQuery1.RecordCount>0 then
begin
DataSource1.DataSet := Data.ADOQuery1;
BitBtn1.Enabled :=True;
end
else
begin
DataSource1.DataSet := Nil;
BitBtn1.Enabled :=False;
end;
end;
end;
procedure TForm64.BitBtn1Click(Sender: TObject);
begin
if Data.ADOQuery1.RecordCount>0 then
d.Execute;
end;
procedure TForm64.dPrint(Sender: TObject);
begin
with Sender as TBaseRePort do
begin
setfont('宋体',18);
TBaseRePort(sender).Canvas.Font.Color := clRed;
Bold := True;
underline := True;
ypos := 1.0;
PrintCenter('商品入库单',pagewidth / 2);
setFont('宋体',10);
TBaseRePort(sender).Canvas.Font.Color := clBlue;
ypos := 1.45 ;
printLeft('操作员姓名:',0.9);
printleft(czy,1.75);
printleft('时间:',pageWidth-2.3);
PrintLeft(FormatDateTime('yyyy-mm-dd',Now),pageWidth-1.8);
ypos := 1.7;
Cleartabs;
setFont('宋体',12);
TBaseRePort(sender).Canvas.Font.Color := clBlue;
setpen(clblack,pssolid,1,pmcopy);
settab(0.9,pjcenter,1.0,0,boxlineall,0);
settab(na,pjcenter,1.0,0,boxlineall,0);
settab(na,pjcenter,1.0,0,boxlineall,0);
settab(na,pjcenter,1.0,0,boxlineall,0);
settab(na,pjcenter,0.6,0,boxlineall,0);
settab(na,pjcenter,0.6,0,boxlineall,0);
settab(na,pjcenter,1.1,0,boxlineall,0);
bold := True;
tab(-2,na,-2,-2,10);
Print('商品编号');
tab(na,na,-2,-2,10);
Print('商品名称');
Tab(na,na,-2,-2,10);
Print('供应商编号');
Tab(na,na,-2,-2,10);
Print('供应商全称');
Tab(na,na,-2,-2,10);
Print('数量');
Tab(na,na,-2,-2,10);
Print('金额');
Tab(na,-2,-2,-2,10);
Print('销售票号');
Bold := False;
ypos := 1.9;
ClearTabs;
setFont('宋体',10);
TBaseRePort(sender).Canvas.Font.Color := clBlue;
settab(0.9,pjcenter,1.0,2,boxlineall,0);
settab(na,pjcenter,1.0,2,boxlineall,0);
settab(na,pjcenter,1.0,2,boxlineall,0);
settab(na,pjcenter,1.0,2,boxlineall,0);
settab(na,pjcenter,0.6,2,boxlineall,0);
settab(na,pjcenter,0.6,2,boxlineall,0);
settab(na,pjcenter,1.1,2,boxlineall,0);
Data.ADOQuery1.First;
ypos := 1.85;
while Not Data.ADOQuery1.Eof do
begin
Tab(-2,na,na,na,0);
print(Data.ADOQuery1.Fields[0].Value);
tab(na,na,na,na,0);
print(Data.ADOQuery1.Fields[1].Value);
tab(na,na,na,na,0);
print(Data.ADOQuery1.Fields[2].Value);
tab(na,na,na,na,0);
print(Data.ADOQuery1.Fields[3].Value);
tab(na,na,na,na,0);
print(FloatToStr(Data.ADOQuery1.Fields[5].Value));
tab(na,na,na,na,0);
print(FloatToStr(Data.ADOQuery1.Fields[6].Value));
tab(na,-2,na,na,0);
print(Data.ADOQuery1.Fields[8].Value);
Println('');
Data.ADOQuery1.Next;
end;
end;
end;
procedure TForm64.BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TBitBtn(Sender).Font.Color := clRed;
end;
procedure TForm64.BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TBitBtn(Sender).Font.Color := clBlue;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -