📄 untgoodcodeselstr.pas
字号:
unit UntgoodCodeSelStr;
///2004-2-19 根据基础窗口fm_basequery 来写的 ydy
//2004-3-23ydy 根据新的商品编码来写
////2004-4-12 ydy create 用于选择商品编码和条码等信息 专门用于对stringgrid的赋值
////不弹出条件来选择 支持多次取数据
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, Buttons,DB, fm_BaseQueryStr,
DBClient;
type
TfmgoodCodeSelStr = class(TfmBaseQueryStr)
Panel3: TPanel;
Label2: TLabel;
CBType: TComboBox;
Label4: TLabel;
cbBrand: TComboBox;
Label3: TLabel;
CbBreed: TComboBox;
DataSource1: TDataSource;
procedure btnpagedownClick(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CBTypeChange(Sender: TObject);
procedure cbBrandChange(Sender: TObject);
procedure CbBreedChange(Sender: TObject);
procedure btnQueryClick(Sender: TObject);
procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
procedure DBGrid1TitleClick(Column: TColumn);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
LocalCount:integer; //直接根据本地的值上传查询
Sqlstr:wideString;
public
{ Public declarations }
show_mode:string;
end;
var
fmgoodCodeSelStr: TfmgoodCodeSelStr;
// LocalCount:integer; //直接根据本地的值上传查询
// Sqlstr:wideString;
implementation
uses fm_Scrap, fm_Check,
fm_Overflow,untdatadm, func, Stock_Contract, Goods_Write, Umanage_Fad,
Uinstock, Uflat, Goods_Requirement, Untnewshopgoods, UntZsManager,
UStock_cancel;
{$R *.dfm}
////只需要选一行
procedure TfmgoodCodeSelStr.DBGrid1DblClick(Sender: TObject);
var
rows:integer;
begin
inherited;
if not dbgrid1.DataSource.DataSet.Active then
begin
application.MessageBox('请选择商品!',pchar(application.Title),mb_iconinformation);
exit;
end;
///报损单2004-4-14
if show_mode='2' then
begin
with fmScrap do
begin
rows:=sgorder.RowCount;
if sgorder.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else sgorder.RowCount := sgorder.RowCount + 1;
sgorder.Cells[0,rows] := inttostr(rows); //编号
sgorder.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
sgorder.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
sgorder.Cells[3,rows]:=trim(dmmain.dsquery.fieldbyname('singleprice').AsString);
StockNum_List.Add(dmmain.dsquery.fieldbyname('Stock_amount').AsString);
sgorder.Cells[8,rows]:=trim(dmmain.dsquery.fieldbyname('baseprice').AsString);//成本假
maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
if show_mode='3' then //商品盘点查询
begin
with fmcheck do
begin
rows:=sgorder.RowCount;
if sgorder.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else sgorder.RowCount := sgorder.RowCount + 1;
sgorder.Cells[0,rows] := inttostr(rows); //编号
sgorder.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
sgorder.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
sgorder.Cells[3,rows]:=trim(dmmain.dsquery.fieldbyname('singleprice').AsString);
sgorder.Cells[7,rows]:=trim(dmmain.dsquery.fieldbyname('stock_amount').AsString);
pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
if show_mode='4' then //商品报益单据 //WG EDIT 2004-2-26
begin
with fmOverflow do
begin
rows:=sgorder.RowCount;
if sgorder.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else sgorder.RowCount := sgorder.RowCount + 1;
sgorder.Cells[0,rows] := inttostr(rows); //编号
sgorder.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
sgorder.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
sgorder.Cells[3,rows]:=trim(dmmain.dsquery.fieldbyname('singleprice').AsString);
sgorder.Cells[8,rows]:=trim(dmmain.dsquery.fieldbyname('baseprice').AsString); //成本价
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
if show_mode='5' then //采购伙同 //WG EDIT 2004-4-16
begin
with frm_Stock_Contract do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
stringgrid1.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid1.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid1.Cells[3,rows]:='0';
stringgrid1.Cells[4,rows]:='0';
stringgrid1.Cells[5,rows]:='0';
stringgrid1.Cells[6,rows]:=trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid1.Cells[7,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
if show_mode='6' then //来货登记 //WG EDIT 2004-4-16
begin
with frm_Goods_Write do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
stringgrid1.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid1.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid1.Cells[6,rows]:=trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid1.Cells[7,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
/////////////////
if show_mode='7' then //非营业出库 //WG EDIT 2004-4-16
begin
with frm_Umanage_Fad do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
stringgrid1.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid1.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid1.Cells[4,rows]:=trim(dmmain.dsquery.fieldbyname('baseprice').AsString);
stringgrid1.Cells[6,rows]:=trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid1.Cells[7,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
stringgrid1.Cells[8,rows]:=trim(dmmain.dsquery.fieldbyname('stock_amount').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
//////////////////
if show_mode='8' then //非营业入库 //WG EDIT 2004-4-16
begin
with frmin_stock do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
stringgrid1.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid1.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid1.Cells[3,rows]:=trim(dmmain.dsquery.fieldbyname('baseprice').AsString);
stringgrid1.Cells[5,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
////////////////////
if show_mode='9' then //套餐管理 //WG EDIT 2004-4-16
begin
with fmflat do
begin
rows:=stringgrid2.RowCount;
if stringgrid2.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid2.RowCount := stringgrid2.RowCount + 1;
stringgrid2.Cells[0,rows] := inttostr(rows); //编号
stringgrid2.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid2.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid2.Cells[3,rows]:=trim(dmmain.dsquery.fieldbyname('baseprice').AsString);
stringgrid2.Cells[6,rows]:=trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid2.Cells[7,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
psum.Add(dmmain.dsquery.fieldbyname('stock_amount').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
/////////////////////
if show_mode='10' then //商品需求 //WG EDIT 2004-4-16
begin
with frm_Goods_Requirement do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
StringGrid1.Cells[1,rows]:=trim(dmmain.dsquery.FieldByName('Goods_NO').AsString);
StringGrid1.Cells[2,rows]:=trim(dmmain.dsquery.FieldByName('Goods_Name').AsString);
StringGrid1.Cells[4,rows]:=trim(dmmain.dsquery.FieldByName('Base_unit').AsString);
StringGrid1.Cells[5,rows]:=trim(dmmain.dsquery.FieldByName('Norms_Type').AsString);
StringGrid1.Cells[6,rows]:=trim(dmmain.dsquery.FieldByName('type').AsString);
StringGrid1.Cells[7,rows]:=trim(dmmain.dsquery.FieldByName('brand').AsString);
StringGrid1.Cells[8,rows]:=trim(dmmain.dsquery.FieldByName('breed').AsString);
StringGrid1.Cells[9,rows]:=trim(dmmain.dsquery.FieldByName('Color').AsString);
StringGrid1.Cells[10,rows]:=trim(dmmain.dsquery.FieldByName('ball').AsString);
StringGrid1.Cells[11,rows]:=trim(dmmain.dsquery.FieldByName('poll').AsString);
StringGrid1.Cells[12,rows]:=trim(dmmain.dsquery.FieldByName('provider').AsString);
StringGrid1.Cells[13,rows]:=trim(dmmain.dsquery.FieldByName('barcode').AsString);
StringGrid1.Cells[14,rows]:=trim(dmmain.dsquery.FieldByName('brand').AsString);
StringGrid1.Cells[15,rows]:=trim(dmmain.dsquery.FieldByName('memo').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
if show_mode='12' then //新店铺货 //WG EDIT 2004-6-4
begin
with fmshopgoods do
begin
rows:=gridbase.RowCount;
if gridbase.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else gridbase.RowCount := gridbase.RowCount + 1;
gridbase.Cells[0,rows] := inttostr(rows); //编号
gridbase.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
gridbase.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
gridbase.Cells[3,rows]:=trim('0');
gridbase.Cells[4,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
gridbase.Cells[5,rows]:=trim(dmmain.dsquery.fieldbyname('memo').AsString);
gridbase.Cells[6,rows]:=trim(dmmain.dsquery.fieldbyname('Stock_amount').AsString);
// pd_maxnumber:=dmmain.dsquery.fieldbyname('Stock_amount').AsInteger;
dmmain.dsquery.Close;
self.close;
end;
end;
/////////////////////
if show_mode='13' then //赠品定义 //WG EDIT 2004-6-4
begin
with fmZSmanager do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.Cells[0,rows] := inttostr(rows); //编号
stringgrid1.Cells[1,rows]:=trim(dmmain.dsquery.fieldbyname('goods_no').AsString);
stringgrid1.Cells[2,rows]:=trim(dmmain.dsquery.fieldbyname('goods_name').AsString);
stringgrid1.Cells[4,rows]:=trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid1.Cells[5,rows]:=trim(dmmain.dsquery.fieldbyname('provider').AsString);
dmmain.dsquery.Close;
self.close;
end;
end;
////////////////////////////////
if show_mode='14' then //赠品定义 //WG EDIT 2004-6-4
begin
with fmcancel do
begin
rows:=stringgrid1.RowCount;
if stringgrid1.Cells[1,rows-1] = '' then rows := rows -1 //ydy 2004-14 add
else stringgrid1.RowCount := stringgrid1.RowCount + 1;
stringgrid1.cells[0,rows] := inttostr(rows);
stringgrid1. Cells[1,rows] := trim(dmmain.dsquery.Fieldbyname('Goods_NO').AsString);
stringgrid1.Cells[2,rows] := trim(dmmain.dsquery.Fieldbyname('Goods_Name').AsString);
stringgrid1.Cells[4,rows] := trim(dmmain.dsquery.fieldbyname('type').AsString);
stringgrid1.Cells[6,rows] := trim(dmmain.dsquery.fieldbyname('stock_amount').AsString);
dmmain.dsquery.Close;
self.close;
end;
end;
/////////////////////////////////
end;
procedure TfmgoodCodeSelStr.FormActivate(Sender: TObject);
begin
inherited;
// btnQueryClick(sender);
end;
///
procedure TfmgoodCodeSelStr.btnpagedownClick(Sender: TObject);
var
i:Integer;
t_sql,str1,strend:wideString;
quedata:olevariant;
//2004-2-10为了优化程序性能 速度已提高到52秒
lStart, lEnd : Integer;
begin
inherited;
// lStart := GetTickCount;
quedata:=null;
if not dmmain.DSquery.Active then exit;
screen.Cursor := crhourglass;
//关掉与DBGRID 的互动
dmmain.dsquery.DisableControls;
IF strtoint(SHOW_MODE) IN [2..4,7,9,12,14] then
begin
if combobox1.Text = '全部' then
begin
t_sql:='select * from [vSelectGoods] where type ='+''''+trim(cbtype.text)+'''' +' and brand =' +''''+trim(cbbrand.text)+'''';
T_sql := t_sql + ' and breed = ' + ''''+trim(cbbreed.text)+'''';
end else
begin
t_sql:='select top ' + trim(ComboBox1.Text) +' * from [vSelectGoods] where type ='+''''+trim(cbtype.text)+'''' +' and brand =' +''''+trim(cbbrand.text)+'''';
end;
T_sql := t_sql + ' and breed = ' + ''''+trim(cbbreed.text)+''''+' and storage_no='+''''+trim(shopid)+'''';
end else
begin
if combobox1.Text = '全部' then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -