if fileexists('report.txt') then Memo1.Lines.LoadFromFile('report.txt')
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.SailCancelButtonClick(Sender: TObject);
begin
Close;
end;
procedure TSaleForm.SaleYesButtonClick(Sender: TObject);
begin
with MainForm do begin
TableTov.Edit;
TableTov.Fields[4].AsInteger:=TableTov.Fields[4].AsInteger - SaleForm.SpinEdit1.Value;
TableTov.Post;
end;
end;
procedure TSaleForm.NaklButtonClick(Sender: TObject);
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.TableTov.Fields[1].AsString);
textout(280,240,inttostr(SpinEdit1.value));
textout(480,240,inttostr(SpinEdit1.value*MainForm.TableTov.Fields[3].AsInteger));
end;
printer.enddoc;
end;
end.