📄 uprice.pas
字号:
unit Uprice;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
OutlookBtn, Grids, DBGrids, Db, DBTables, ExtCtrls, StdCtrls, Buttons;
type
Tprice = class(TForm)
Panel1: TPanel;
Image2: TImage;
OutlookBtn1: TOutlookBtn;
OutlookBtn2: TOutlookBtn;
Image1: TImage;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
QueryPrice: TQuery;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure OutlookBtn2Click(Sender: TObject);
procedure OutlookBtn1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
price: Tprice;
implementation
uses UPriceUpdate, main;
{$R *.DFM}
procedure AlignGrid(dbgrid:Tdbgrid);
var
Loop,Stop:integer;
begin
Stop:=dbgrid.Columns.Count;
for Loop:=0 to Stop-1 do
begin
dbgrid.Columns[loop].Alignment:=taCenter;
dbgrid.Columns[loop].Title.Alignment:=taCenter;
end;
end;
procedure Tprice.FormCreate(Sender: TObject);
var
TmpSql,Code,biaozhiwei:string;
begin
try
biaozhiwei:='';
Code:=mainfm.TmpChangJia;
TmpSql:='select * from goodsbase where 供货商 like ''%'+Trim(Code)+'%'' and 合同号<>'''+biaozhiwei+'''';
QueryPrice.Close;
QueryPrice.SQL.Clear;
QueryPrice.SQL.Add(TmpSql);
QueryPrice.Prepare;
QueryPrice.Open;
AlignGrid(dbgrid1);
except
Application.MessageBox('系统忙!','消息',MB_IconInformation);
end;
OutlookBtn1.Enabled:=false;
end;
procedure Tprice.OutlookBtn2Click(Sender: TObject);
begin
Close;
end;
procedure Tprice.OutlookBtn1Click(Sender: TObject);
begin
if queryprice['进货数量']=queryprice['结算数量'] then
begin
showmessage('该商品不能做价格变更');
exit;
end;
Application.CreateForm(TPriceUpdate,PriceUpdate);
PriceUpdate.ShowModal;
end;
procedure Tprice.FormActivate(Sender: TObject);
begin
AlignGrid(dbgrid1);
end;
procedure Tprice.BitBtn1Click(Sender: TObject);
var
tmpsql:string;
i:integer;
begin
tmpsql:='select * from goodsbase';
if trim(Edit1.Text)='' then
begin
i:=0;
tmpsql:=tmpsql
end
else
begin
i:=1;
tmpsql:=tmpsql+' where 品名 like ''%'+trim(Edit1.Text)+'%''';
end;
if trim(Edit2.Text)='' then
begin
if i=0 then
begin
showmessage('没有查询条件');
exit;
end;
end
else
begin
if i=0 then tmpsql:=tmpsql+' where 条码='''+trim(Edit2.Text)+''''
else tmpsql:=tmpsql+' and 条码='''+trim(Edit2.Text)+'''';
end;
QueryPrice.Close;
QueryPrice.SQL.Clear;
QueryPrice.SQL.Add(tmpsql);
QueryPrice.Prepare;
QueryPrice.Open;
if not QueryPrice.Eof then
begin
OutlookBtn1.Enabled:=true;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -