Автор работы: Пользователь скрыл имя, 17 Декабря 2013 в 20:15, курсовая работа
В данной курсовой работе рассматривается программа автоматизированного ведения продажи, завоза и учета медикаментов в аптеке. Прилагаются описания структуры и каждой таблицы (вплоть до каждого поля) созданной базы данных, каждой формы программы, поясняется назначение каждого элемента формы.
end;
QueryPost.Active:=true;
end;
end;
Close;
end;
procedure TSelectForm.RadioGroup1Click(
begin
case RadioGroup1.ItemIndex of
0:begin ComboBox1.Items:=MainForm.
1:begin ComboBox1.Items:=MainForm.
2:begin ComboBox1.Items:=MainForm.
end;
end;
procedure TSelectForm.ComboBox1Change(
begin
Combobox2.Items.Clear;
If (ComboBox1.Text='Price') or
(ComboBox1.Text='Col') or
(ComboBox1.Text='Recieved') or
(ComboBox1.Text='Sum')
then begin
Combobox2.Items.Add('=');
Combobox2.Items.Add('>');
Combobox2.Items.Add('<');
Combobox2.Items.Add('>=');
Combobox2.Items.Add('<=');
Combobox2.Items.Add('<>');
Selecttype:=true;
end
else If (ComboBox1.Text='TovarCode') or
(ComboBox1.Text='NaklNum') or
(ComboBox1.Text='PostCode')
then begin
Combobox2.Items.Add('=');
Combobox2.ItemIndex:=0;
Selecttype:=true;
end
else If (ComboBox1.Text='TovarName') or
(ComboBox1.Text='PostName')
then begin
Combobox2.Items.Add('
Combobox2.ItemIndex:=0;
Selecttype:=false;
end;
end;
procedure TSelectForm.SortClick(Sender: TObject);
Var txt:string;
begin
txt:=ComboBox1.Text;
With MainForm do
case RadioGroup1.ItemIndex of
0:begin
QueryTov.Active:=false;
QueryTov.SQL.Clear;
DataSourceTov.DataSet:=
QueryTov.SQL.Add('Select * From Tovar where '+txt+'='+Txt+' order by '+txt);
QueryTov.Active:=true;
end;
1:begin
QueryNakl.Active:=false;
QueryNakl.SQL.Clear;
DataSourceNakl.DataSet:=
QueryNakl.SQL.Add('Select * From Nakladnie where '+Txt+'='+txt+' order by '+Txt);
QueryNakl.Active:=true;
end;
2:begin
QueryPost.Active:=false;
QueryPost.SQL.Clear;
DataSourcePost.DataSet:=
QueryPost.SQL.Add('Select * From Postavschik where '+Txt+'='+Txt+' order by '+Txt);
QueryPost.Active:=true;
end;
end;
Close;
end;end.
unit PassUnit;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Registry;
type TPassForm = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
PassButton: TButton;
CancelButton: TButton;
procedure ComboBoxChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ChMode;
procedure PassButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
function regexists:boolean;
private { Private declarations }
public { Public declarations }
end;
var PassForm: TPassForm;
Mode:string[20];
SalerPwd, RecieverPwd, AdminPwd:string[10];
implementation
uses mainunit;
{$R *.DFM}
Function TPassForm.regexists:boolean;
Var reg:tregistry;
begin
regexists:=true;
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_
If REG.OpenKey('Software\OM',
if REG.ValueExists('Продажа')
then SalerPwd:=REG.ReadString('
else regexists:=false;
if REG.ValueExists('Завоз') then
RecieverPwd:=REG.ReadString('
else regexists:=false;
if REG.ValueExists('
else regexists:=false;
end
else ShowMessage('Ошибка работы с реестром');
REG.CloseKey;
Reg.Destroy;
end;
Procedure TPassForm.ChMode;
begin
If ComboBox1.Text='Просмотр' then begin
Label2.enabled:=false;
end
else begin
Label2.enabled:=true;
edit1.enabled:=true;
end;
end;
procedure TPassForm.ComboBoxChange(
begin
ChMode;
end;
procedure TPassForm.FormCreate(Sender: TObject);
var Reg:TRegistry;
begin
ChMode;
end;
procedure TPassForm.PassButtonClick(
var modestr,pwd:shortstring;
begin
modestr:=AnsiUppercase(
pwd:=Edit1.text;
If (modestr='ПРОСМОТР') or
((modestr='АДМИНИСТРИРОВАНИЕ') and (pwd=AdminPwd)) or
((modestr='ПРОДАЖА') and (pwd=SalerPwd)) or
((modestr='ЗАВОЗ') and (pwd=RecieverPwd))
then Mode:=Combobox1.text
else ShowMessage('Не
верно задан режим '+modestr+#
Close;
end;
procedure TPassForm.CancelButtonClick(
begin
Close;
end;end.
unit PropUnit;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Registry;
type TPropForm = class(TForm)
ChPassButton: TButton;
ExitButton: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Edit2: TEdit;
procedure ExitButtonClick(Sender: TObject);
procedure ChPassButtonClick(Sender: TObject);
Procedure writereg(name,value:string);
private { Private declarations }
public { Public declarations }
end;
var PropForm: TPropForm;
implementation
{$R *.DFM}
Procedure TPropForm.writereg(name,value:
var Reg:TRegistry;
begin
Reg:=Tregistry.Create;
Reg.Rootkey:=HKEY_CURRENT_
Reg.OpenKey('Software\OM',
Reg.WriteString(name,value);
Reg.CloseKey;
Reg.Destroy;
end;
procedure TPropForm.ExitButtonClick(
begin
Close;
end;
procedure TPropForm.ChPassButtonClick(
begin
If Edit1.text<>Edit2.text then ShowMessage('Пароли не совппадают')
else if length(Edit1.text)>10 then Showmessage('Пароль должен быть не более 10 символов')
else writereg(ComboBox1.text,Edit1.
end;
end.
unit RecieveUnit;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DBCtrls, Spin, ExtCtrls, ComCtrls;
type TRecieveForm = class(TForm)
AddButton: TButton;
CancelButton: TButton;
DBLookupComboBox1: TDBLookupComboBox;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
DateTimePicker1: TDateTimePicker;
Label7: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
Label8: TLabel;
CheckBox1: TCheckBox;
Edit1: TEdit;
ComboBox1: TComboBox;
Label9: TLabel;
Label10: TLabel;
CheckBox2: TCheckBox;
Edit2: TEdit;
Edit3: TEdit;
Label11: TLabel;
Edit4: TEdit;
procedure CancelButtonClick(Sender: TObject);
procedure NewPostButtonClick(Sender: TObject);
procedure AddButtonClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var RecieveForm: TRecieveForm;
implementation
uses mainunit;
{$R *.DFM}
procedure TRecieveForm.
begin
Close;
end;
procedure TRecieveForm.AddButtonClick(
begin
with MainForm do begin
If CheckBox1.checked then
begin
TableTov.Insert;
TableTov.FieldByName('
TableTov.FieldByName('EdIzm').
TableTov.FieldByName('Price').
TableTov.FieldByName('Col').
TableTov.Post;
end
//Увеличиваем количество в таблице "медикаменты"
else begin
TableTov.edit;
TableTov.FieldByName('Col').
TableTov.post;
end;
//Дополняем таблицу "Накладные"
TableNakl.Insert;
If not (CheckBox1.checked) then TableNakl.FieldByName('
else TableNakl.FieldByName('
TableNakl.FieldByName('Date').
TableNakl.FieldByName('Sum').
TableNakl.FieldByName('
If CheckBox2.checked then
begin
TablePost.Insert;
TablePost.FieldByName('
TablePost.FieldByName('
TablePost.Post;
TableNakl.FieldByName('
end
else TableNakl.FieldByName('
TableNakl.Post;
end;
end;
procedure TRecieveForm.CheckBox1Click(
begin
DBLookupComboBox1.enabled:=
edit1.enabled:=not(edit1.
ComboBox1.enabled:=not(
Edit4.enabled:=not(Edit4.
end;
procedure TRecieveForm.FormCreate(
begin
Edit1.enabled:=false;
ComboBox1.enabled:=false;
Edit4.enabled:=false;
Edit2.enabled:=false;
Edit3.enabled:=false;
end;
procedure TRecieveForm.CheckBox2Click(
begin
DBLookupComboBox2.enabled:=
Edit2.enabled:=not(Edit2.
Edit3.enabled:=not(Edit3.
end;
end.
unit reportUnit;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type TReportForm = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var ReportForm: TReportForm;
implementation
{$R *.DFM}
procedure TReportForm.Button1Click(
begin
Close;
end;
procedure TReportForm.FormCreate(Sender: TObject);
begin
if fileexists('report.txt') then Memo1.Lines.LoadFromFile('
else ShowMessage('Файл report.txt в текущем каталоге не найден');
end;end.
unit SaleUnit;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBCtrls, StdCtrls, Db, DBTables, Mask, Spin, Printers;
type TSaleForm = class(TForm)
Label1: TLabel;
SaleYesButton: TButton;
SailCancelButton: TButton;
SpinEdit1: TSpinEdit;
NaklButton: TButton;
procedure SailCancelButtonClick(Sender: TObject);
procedure SaleYesButtonClick(Sender: TObject);
procedure NaklButtonClick(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var SaleForm: TSaleForm;
implementation
uses mainunit;
{$R *.DFM}
procedure TSaleForm.
begin
Close;
end;
procedure TSaleForm.SaleYesButtonClick(
begin
with MainForm do begin
TableTov.Edit;
TableTov.Fields[4].AsInteger:=
TableTov.Post;
end;
end;
procedure TSaleForm.NaklButtonClick(
begin
printer.begindoc;
with printer.canvas do begin
textout(200,80,'Накладная №___
textout(80,100,'Дата');
textout(280,100,'Продавец');
textout(480,100,'Адрес');
DateSeparator := '.';
textout(80,120,DateToStr(Date)
textout(280,120,'АО АРГО');
textout(480,120,'Махачкала, пр. Шамиля 1');
textout(80,220,'Товар');
textout(280,220,'Количество')
textout(480,220,'Общая стоимость');
textout(80,240,MainForm.
textout(280,240,inttostr(
textout(480,240,inttostr(
end;
printer.enddoc;
end;
end.