unit_goods.~pas
来自「美汇美容网网站管理系统」· ~PAS 代码 · 共 481 行 · 第 1/2 页
~PAS
481 行
{添加分类}
if length(Form_Class_Add.Edit1.Text)>1 then
begin
with dm.atCommClass do
begin
append;
fieldvalues['iUpNo']:=upNo;
fieldValues['vName']:=Form_Class_Add.edit1.text;
post;
updatebatch();
Refresh;
end;
end;
Form_Class_Add.Free;
end
else
application.MessageBox('请选择上级分类或不能再添加下级分类.','提示',MB_OK);
end;
procedure TForm_Goods.N3Click(Sender: TObject);
begin
if dbtvClass.Selected<>nil then
dbtvClass.Selected.EditText;
end;
procedure TForm_Goods.N6Click(Sender: TObject);
begin
if dbtvClass.Selected<>nil then
begin
if application.MessageBox('你确定要删除这个分类吗?'+#13+'[注意] 删除分类的同时将删除分类下的所有商品.','警告',MB_YESNO)=IDYES then
begin
case dbtvclass.Selected.Level of
0:dm.adocm.CommandText:='DELETE FROM goods WHERE iClass1No='+inttostr(dbtvClass.DBTreeNodes.GetKeyFieldValue(dbtvClass.Selected));
1:dm.adocm.CommandText:='DELETE FROM goods WHERE iClass2No='+inttostr(dbtvClass.DBTreeNodes.GetKeyFieldValue(dbtvClass.Selected));
//2:dm.adocm.CommandText:='DELETE FROM goods WHERE iClass3No='+inttostr(dbtvClass.DBTreeNodes.GetKeyFieldValue(dbtvClass.Selected));
end;
try
dm.adocm.Execute;
dbtvclass.Selected.Delete;
except
application.MessageBox('删除这个分类下的所有商品不成功.'+#13+'删除分类操作失败.','错误',MB_OK);
end;
end;
end;
end;
procedure TForm_Goods.N11Click(Sender: TObject);
begin
with dm.adsComm do
begin
close;
commandtext:='select * from goods';
open;
end;
end;
procedure TForm_Goods.DBGrid1DblClick(Sender: TObject);
begin
if dm.adsComm.RecordCount>0 then
begin
pcgoods.ActivePage:=tsParticular;
if (length(dm.adsComm.FieldValues['vImageType'])>0) and (dm.adsComm.FieldValues['vImageType']<>'del') and (length(dm.adsComm.FieldValues['vImage'])>5) and (FileExists(format('%s%s',[form_goods.localdir,dm.adsComm.FieldValues['vImage']]))) then
begin
image1.Picture.LoadFromFile(format('%s%s',[localdir,dm.adsComm.FieldValues['vImage']]));
image1.Show;
end
else
image1.Hide;
end;
end;
procedure TForm_Goods.dbtvClassChange(Sender: TObject; Node: TTreeNode);
begin
if dbtvClass.Selected<>nil then
begin
with dm.adsComm do
begin
close;
case dbtvclass.Selected.Level of
0:CommandText:='select * from goods where iClass1No=' + inttostr(dbtvclass.DBTreeNodes.GetKeyFieldValue(dbtvclass.Selected));
1:CommandText:='select * from goods where iClass2No=' + inttostr(dbtvclass.DBTreeNodes.GetKeyFieldValue(dbtvclass.Selected));
//2:CommandText:='select * from news_info where iClass3No=' + inttostr(dbtvclass.DBTreeNodes.GetKeyFieldValue(dbtvclass.Selected));
else
CommandText:='select * from news_info';
end;
open;
end;
end;
end;
procedure TForm_Goods.tbInfoDelClick(Sender: TObject);
begin
if (dm.adsComm.RecordCount>0) and (application.MessageBox('你确定要删除这件商品吗?','提示',MB_YESNO)=IDYES) then
begin
dm.adsComm.Delete;
dm.adsComm.UpdateBatch();
end;
end;
procedure TForm_Goods.tbInfoListClick(Sender: TObject);
begin
pcGoods.ActivePage:=tsList;
end;
procedure TForm_Goods.N7Click(Sender: TObject);
begin
pcGoods.ActivePage:=tslist;
application.CreateForm(TForm_Locate,Form_Locate);
AnimateWindow(Form_Locate.Handle,500,AW_BLEND);
{参数说明:
1。hwnd : 一个你要显示窗体的句柄。
2。dwTime : 完成显示操作的时间。(一般为500-1000,你可以自己调 节)
3。dwFlags : 这是一个关键的东东,它决定了你的子窗体弹出的方 式。
dwFlags其中包括9种基本弹出方式,当然你可以组合它们使用,下面我就对者9种方法做个简单的介绍:
a. AW_SLIDE : 表示用滑动方式显示;
b. AW_BLEND : 表示用淡出或淡入方式显示;(Windows 2000菜单显示)
c. AW_CENTER : 表示窗体从小窗体沿对角线扩大至窗体定义的大小;
d. AW_HIDE : 顾名思义,就是隐藏窗体;
e. AW_HOR_POSITIVE :窗体从左向右生成生成显示
f. AW_HOR_NEGATIVE :窗体从右向左生成生成显示
g. AW_VER_NEGATIVE :窗体从下向上生成生成显示
h: AW_VER_POSITIVE :窗体从上向下生成生成显示
i: AW_ACTIVATE :顾名思义,就是激活窗体;}
Form_Locate.label1.Caption:='商品编号';
Form_Locate.Show;
Form_Locate.Visible:=false;
Form_Locate.ShowModal;
dm.adsComm.Locate('vSN',Form_Locate.edit1.text,[loPartialKey]);
Form_Locate.Free;
end;
procedure TForm_Goods.N8Click(Sender: TObject);
begin
pcGoods.ActivePage:=tslist;
application.CreateForm(TForm_Goods_Search,Form_Goods_Search);
AnimateWindow(Form_Goods_Search.Handle,500,AW_BLEND);
{参数说明:
1。hwnd : 一个你要显示窗体的句柄。
2。dwTime : 完成显示操作的时间。(一般为500-1000,你可以自己调 节)
3。dwFlags : 这是一个关键的东东,它决定了你的子窗体弹出的方 式。
dwFlags其中包括9种基本弹出方式,当然你可以组合它们使用,下面我就对者9种方法做个简单的介绍:
a. AW_SLIDE : 表示用滑动方式显示;
b. AW_BLEND : 表示用淡出或淡入方式显示;(Windows 2000菜单显示)
c. AW_CENTER : 表示窗体从小窗体沿对角线扩大至窗体定义的大小;
d. AW_HIDE : 顾名思义,就是隐藏窗体;
e. AW_HOR_POSITIVE :窗体从左向右生成生成显示
f. AW_HOR_NEGATIVE :窗体从右向左生成生成显示
g. AW_VER_NEGATIVE :窗体从下向上生成生成显示
h: AW_VER_POSITIVE :窗体从上向下生成生成显示
i: AW_ACTIVATE :顾名思义,就是激活窗体;}
Form_Goods_Search.Show;
Form_Goods_Search.Visible:=false;
Form_Goods_Search.ShowModal;
Form_Goods_Search.Free;
end;
procedure TForm_Goods.tbInfoAddClick(Sender: TObject);
begin
pcGoods.ActivePage:=tsList;
application.CreateForm(TForm_Goods_Manage,Form_Goods_Manage);
AnimateWindow(Form_Goods_Manage.Handle,500,AW_BLEND);
{参数说明:
1。hwnd : 一个你要显示窗体的句柄。
2。dwTime : 完成显示操作的时间。(一般为500-1000,你可以自己调 节)
3。dwFlags : 这是一个关键的东东,它决定了你的子窗体弹出的方 式。
dwFlags其中包括9种基本弹出方式,当然你可以组合它们使用,下面我就对者9种方法做个简单的介绍:
a. AW_SLIDE : 表示用滑动方式显示;
b. AW_BLEND : 表示用淡出或淡入方式显示;(Windows 2000菜单显示)
c. AW_CENTER : 表示窗体从小窗体沿对角线扩大至窗体定义的大小;
d. AW_HIDE : 顾名思义,就是隐藏窗体;
e. AW_HOR_POSITIVE :窗体从左向右生成生成显示
f. AW_HOR_NEGATIVE :窗体从右向左生成生成显示
g. AW_VER_NEGATIVE :窗体从下向上生成生成显示
h: AW_VER_POSITIVE :窗体从上向下生成生成显示
i: AW_ACTIVATE :顾名思义,就是激活窗体;}
Form_Goods_Manage.manage_type:='add';
Form_Goods_Manage.caption:='新增商品';
Form_Goods_Manage.Show;
Form_Goods_Manage.Visible:=false;
Form_Goods_Manage.ShowModal;
Form_Goods_Manage.Free;
end;
procedure TForm_Goods.tbInfoEditClick(Sender: TObject);
begin
if dbgrid1.DataSource.DataSet.RecordCount<1 then
exit;
pcGoods.ActivePage:=tsList;
application.CreateForm(TForm_Goods_Manage,Form_Goods_Manage);
AnimateWindow(Form_Goods_Manage.Handle,500,AW_BLEND);
{参数说明:
1。hwnd : 一个你要显示窗体的句柄。
2。dwTime : 完成显示操作的时间。(一般为500-1000,你可以自己调 节)
3。dwFlags : 这是一个关键的东东,它决定了你的子窗体弹出的方 式。
dwFlags其中包括9种基本弹出方式,当然你可以组合它们使用,下面我就对者9种方法做个简单的介绍:
a. AW_SLIDE : 表示用滑动方式显示;
b. AW_BLEND : 表示用淡出或淡入方式显示;(Windows 2000菜单显示)
c. AW_CENTER : 表示窗体从小窗体沿对角线扩大至窗体定义的大小;
d. AW_HIDE : 顾名思义,就是隐藏窗体;
e. AW_HOR_POSITIVE :窗体从左向右生成生成显示
f. AW_HOR_NEGATIVE :窗体从右向左生成生成显示
g. AW_VER_NEGATIVE :窗体从下向上生成生成显示
h: AW_VER_POSITIVE :窗体从上向下生成生成显示
i: AW_ACTIVATE :顾名思义,就是激活窗体;}
Form_Goods_Manage.manage_type:='edit';
Form_Goods_Manage.caption:='修改商品信息';
Form_Goods_Manage.edSN.Text:=dbeSN.Text;
Form_Goods_Manage.edName.Text:=dbeName.Text;
Form_Goods_Manage.edProducer.Text:=dbeProducer.Text;
Form_Goods_Manage.cbbclass1.Text:=inttostr(dm.adsComm.FieldValues['iClass1No'])+'.'+dbeClass1name.Text;
Form_Goods_Manage.cbbclass2.Text:=inttostr(dm.adsComm.FieldValues['iClass2No'])+'.'+dbeClass2name.Text;
Form_Goods_Manage.edCPrice.Text:=dbeCPrice.Text;
Form_Goods_Manage.edSPrice.Text:=dbeSPrice.Text;
Form_Goods_Manage.edPPrice.Text:=dbePPrice.Text;
Form_Goods_Manage.edEPrice.Text:=dbeEPrice.Text;
Form_Goods_Manage.mmIntro.Text:=dbmIntro.Text;
if (length(dm.adsComm.FieldValues['vImageType'])>0) and (dm.adsInfo.FieldValues['vImageType']<>'del') and (length(dm.adsComm.FieldValues['vImage'])>4) and (FileExists(format('%s%s',[form_info_manage.localdir,dm.adsComm.FieldValues['vImage']]))) then
begin
Form_Goods_Manage.image1.Picture.LoadFromFile(format('%s%s',[form_goods_manage.localdir,dm.adsComm.FieldValues['vImage']]));
Form_Goods_Manage.imagefilename:=dm.adsComm.FieldValues['vImage'];
Form_Goods_Manage.imageType:=dm.adsComm.FieldValues['vImageType'];
end;
Form_Goods_Manage.Show;
Form_Goods_Manage.Visible:=false;
Form_Goods_Manage.ShowModal;
form_info_manage.Free;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?