unit kkotchform;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ScadaBase, VisMachine, VisMcha, ExtCtrls, VisDltB,
  VisStatusShape, VisZDVH, VisZDVT, jpeg, SimpleLine, VisDynamicPict,
  VisZDVC, VisZDVA, Buttons, VisLabel, VisNumericPanel, VisDataboard,
  ComCtrls;

type
  TkkotchformForm = class(TForm)
    MonthCalendar1: TMonthCalendar;
    MonthCalendar2: TMonthCalendar;
    Label1: TLabel;
    Label2: TLabel;
    OkButton: TButton;
    CancelButton: TButton;
    Place: TButton;
    Edit1: TEdit;
    SaveDialog1: TSaveDialog;
    procedure FormCreate(Sender: TObject);
    procedure CancelButtonClick(Sender: TObject);
    procedure OkButtonClick(Sender: TObject);
    procedure PlaceClick(Sender: TObject);
  private
    { Private declarations }
  public
    s1:string;
    s2:string;
    ff : string;
    rez : boolean;
    { Public declarations }
  end;


implementation
uses
 kkotch;
{$R *.dfm}


procedure TkkotchformForm.FormCreate(Sender: TObject);
begin
 rez := false;
 s1 := '2000-01-01 00:00:00';
 s2 := '2000-01-02 00:00:00';
 ff := 'D:\otch.csv';
 MonthCalendar1.Date := now;
 MonthCalendar2.Date := now;
// SaveDialog1.InitialDir := GetNamePath

end;

procedure TkkotchformForm.CancelButtonClick(Sender: TObject);
begin
  rez := false;
  Close;
end;

procedure TkkotchformForm.OkButtonClick(Sender: TObject);
var t:TDate;
    s:string;
begin
  if MonthCalendar2.Date < MonthCalendar1.Date then
    begin
      ShowMessage('Конечная дата до начальной');
      exit;
    end;

  rez:=true;

  s1 := FormatDateTime('yyyy.mm.dd hh:nn:ss', MonthCalendar1.Date);
  t:=MonthCalendar2.Date;
  t := t + 1;
  s2 := FormatDateTime('yyyy.mm.dd hh:nn:ss', t);

//  ShowMessage(s);
//  if MessageDlg('Установить позицию для телеги ', mtConfirmation, [mbYes, mbNo], 0) = mrYes then

  close;
end;

procedure TkkotchformForm.PlaceClick(Sender: TObject);
begin
  if SaveDialog1.Execute then
    begin
      ff := SaveDialog1.FileName;
      Edit1.Text := ff;
    end;

end;

end.
