unit udatosbin2xlt;

{$MODE Delphi}

interface

uses
	LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
	StdCtrls,
        udatoshorariosdetallados;
//        ExtCtrls;

type
  TDatosBin2XLT = class(TForm)
		OpenDialog1: TOpenDialog;
    Button1: TButton;
    SaveDialog1: TSaveDialog;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DatosBin2XLT: TDatosBin2XLT;

implementation

uses uConstantesSimSEE;

{$R *.lfm}

procedure TDatosBin2XLT.Button1Click(Sender: TObject);
var
	archibin, archixlx: string;
	fdh: TDatosHorariosDetallados;
begin
  OpenDialog1.InitialDir:= getDir_DatosComunes;
	if OpenDialog1.Execute then
	begin
          (*
    OpenDialog1.FileName:=
    quitarRaiz(OpenDialog1.FileName);
    *)
    archibin:= OpenDialog1.FileName;
		archixlx:= copy(archibin, 1, length(archibin) -3 );

 		archixlx:= archixlx + 'xlt';
    SaveDialog1.FileName:= archixlx;
    if SaveDialog1.Execute then
    begin
      fdh:= TDatosHorariosDetallados.CreateFromArchi_bin( archibin );
      fdh.WriteToXLT( archixlx );

      ShowMessage('Los datos se han convertido satisfactoriamente');

      fdh.Free;
    end;

{  	if fileexists( archixlx ) then
	  	if IDOK	<> Application.messagebox(PChar('El archivo ' + archixlx + ' ya existe, desea sobre-escribirlo?'), 'Confirmar sobreescritura', MB_OKCANCEL) then
			  exit;}

	end;
end;

procedure TDatosBin2XLT.FormCreate(Sender: TObject);
begin
	sysutils.DecimalSeparator := '.';
	DecimalSeparator:= '.';
	DateSeparator:= '/';
	ShortDateFormat:='d/m/y';
end;

end.
