end;
end;
procedure TInputForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key=#13) and not(ActiveControl is TStringGrid) then
begin
if (ActiveControl is TEdit) then
begin
if ((ActiveControl as TEdit).Name <>'mcEdit') then
Perform(WM_NEXTDLGCTL,0,0);
end else
Perform(WM_NEXTDLGCTL,0,0);
end;
end;
procedure TInputForm.InputSpeedButtonClick(Sender: TObject);
var qdbh:string;
inno:integer;
SaveBreed :boolean;
begin
try
with MDataForm.FreeFind_ADOQuery do
begin
close;
SQL.Clear;
SQL.Add('select max(清单编号) as 编号 from MasterData where 录入日期=:Today');
Parameters.ParamByName('Today').Value := FormatDateTime('yyyy-mm-dd',date);
Open;
OrderNoEdit.Text := fieldbyname('编号').AsString;
Close;
end;
if OrderNoEdit.text ='' then
OrderNoEdit.text := FormatDateTime('yyyymmdd',date)+'001'
else
begin
qdbh := IntToStr(StrToInt(copy(OrderNoEdit.text,9,3))+1);
if Length(qdbh)=3 then OrderNoEdit.text :=copy(OrderNoEdit.text,1,8)+qdbh;
if Length(qdbh)=2 then OrderNoEdit.text :=copy(OrderNoEdit.text,1,8)+'0'+qdbh;
if Length(qdbh)=1 then OrderNoEdit.text :=copy(OrderNoEdit.text,1,8)+'00'+qdbh;
end;
except
MainForm.PshowMessage('系统错误','产生清单编号时失败!',0);
end;
for inno:=1 to DataInputStringGrid.RowCount-1 do
begin
DataInputStringGrid.Cells[0,inno] := IntToStr(inno);
DataInputStringGrid.Cells[1,inno] := '';
DataInputStringGrid.Cells[2,inno] := '';
DataInputStringGrid.Cells[3,inno] := '';
DataInputStringGrid.Cells[4,inno] := '';
end;
mcEdit.ReadOnly := false;
mcEdit.SetFocus;
//检查客户名称及品种名称是否已有,保存数据
try
with MDataForm.FreeFind_ADOQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from ClientName where 客户名称=:cm');
Parameters.ParamByName('cm').Value :=ClientNameComboBox.Text;
Open;
if RecordCount<1 then
begin //新客户
if MainForm.PshowMessage('提示','该客户名称是新客户名称,是否保存?',1) then