Invoicing in Delphi: Show Me the Money - Rest of the Code and the Conclusion
(Page 5 of 5 )
procedure TForm1.Statistics1Click(Sender: TObject);
begin
form4.show;
end;
procedure TForm1.btnsearchClick(Sender: TObject);
begin
if edsearch.Text = '' then showmessage('Please enter a term for the search!') else
begin
//now check to see that the user selected a search method
if not rb1.Checked and not rb2.Checked then begin
messagedlg('Either select to search by: '+#13#10+' Invoice number OR Invoice name', mtError , [mbOK], 0);
exit;
end;
//search by invoice name
if rb1.Checked then
begin
if not form1.ado1.Locate('invname',edsearch.Text,[]) then
messagedlg(' Invoice for "' +edsearch.Text+ '" was not found', mtError ,[mbOK], 0);
end;
//search by invoice number
if rb2.Checked then
begin
//check to see if entered value is number, before continuing
try
StrToInt(edsearch.Text);
except
messagedlg('Please enter a number in the search box.'+#13#10+' You entered "' +edsearch.Text+ '" which is not a number!', mtError , [mbOK],0);
exit;
end;
if not form1.ado1.Locate('invno',edsearch.Text,[]) then
messagedlg(' Invoice number ' +edsearch.Text+ ' could not be found',
mtError , [mbOK], 0);
end;//end rb2 search
end;//edsearch check
end;
procedure TForm1.Settings1Click(Sender: TObject);
begin
form3.show
end;
procedure TForm1.ViewAllClients1Click(Sender: TObject);
begin
form6.show;
end;
procedure TForm1.About1Click(Sender: TObject);
begin
form7.show;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.ado1AfterPost(DataSet: TDataSet);
begin
showmessage('It is done');
label1.caption:=inttostr(ado1.RecordCount);
end;
procedure TForm1.ado1AfterScroll(DataSet: TDataSet);
begin
label2.caption:=inttostr(ado1.Recno);
end;
end.
Conclusion
In the next article we will not focus so much on the design of the application, but rather on the code that makes it work. We will also be introducing invoice reporting using Rave Reporting components.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |