unit uEditorExportacionNorma19; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, pngimage, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, uIEditorExportacionNorma19, JvExControls, JvComponent, JvgWizardHeader, JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, JvDialogs, Mask, JvExMask, JvToolEdit, ActnList; type TfEditorExportacionNorma19 = class(TForm, IEditorExportacionNorma19) OKBtn: TButton; CancelBtn: TButton; Image1: TImage; edtFechaCargo: TcxDateEdit; Label2: TLabel; Label3: TLabel; Label4: TLabel; edtCodEntidad: TcxTextEdit; edtCodAgencia: TcxTextEdit; Bevel1: TBevel; JvFormStorage: TJvFormStorage; JvAppRegistryStorage: TJvAppRegistryStorage; Label1: TLabel; Bevel2: TBevel; JvFilenameEdit1: TJvFilenameEdit; ActionList1: TActionList; actVolcar: TAction; Label5: TLabel; Label6: TLabel; procedure OKBtnClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure CancelBtnClick(Sender: TObject); procedure actVolcarUpdate(Sender: TObject); procedure actVolcarExecute(Sender: TObject); private FFichero : String; protected procedure SetCodigoEntidad(const AValue: String); function GetCodigoEntidad : String; procedure SetCodigoAgencia(const AValue: String); function GetCodigoAgencia : String; procedure SetFechaCargo(const AValue: TDateTime); function GetFechaCargo : TDateTime; procedure SetFichero(const AValue: String); function GetFichero : String; public property CodigoEntidad : String read GetCodigoEntidad write SetCodigoEntidad; property CodigoAgencia : String read GetCodigoAgencia write SetCodigoAgencia; property FechaCargo : TDateTime read GetFechaCargo write SetFechaCargo; property Fichero : String read GetFichero write SetFichero; end; implementation {$R *.dfm} uses uDialogUtils; { TfEditorExportacionNorma19 } procedure TfEditorExportacionNorma19.actVolcarExecute(Sender: TObject); begin FFichero := JvFilenameEdit1.FileName; ModalResult := mrOk; end; procedure TfEditorExportacionNorma19.actVolcarUpdate(Sender: TObject); begin (Sender as TAction).Enabled := (Length(edtCodEntidad.Text) = 4) and (Length(edtCodAgencia.Text) = 4) and (Length(JvFilenameEdit1.Text) > 0) end; procedure TfEditorExportacionNorma19.CancelBtnClick(Sender: TObject); begin Close; end; procedure TfEditorExportacionNorma19.FormCreate(Sender: TObject); var APath : String; begin inherited; with JvFormStorage do begin if Pos('_', Self.Name) = 0 then APath := Self.Name else APath := Copy(Self.Name, 0, (Pos('_', Self.Name)-1)); AppStoragePath := APath; end; edtFechaCargo.Date := Now; end; function TfEditorExportacionNorma19.GetCodigoAgencia: String; begin Result := edtCodAgencia.Text; end; function TfEditorExportacionNorma19.GetCodigoEntidad: String; begin Result := edtCodEntidad.Text; end; function TfEditorExportacionNorma19.GetFechaCargo: TDateTime; begin Result := edtFechaCargo.Date; end; function TfEditorExportacionNorma19.GetFichero: String; begin Result := FFichero; end; procedure TfEditorExportacionNorma19.OKBtnClick(Sender: TObject); var ASaveDialog : TSaveDialog; // Save dialog variable AArchivo : string; ARuta : String; begin AArchivo := FFichero; ARuta := ExtractFilePath(Application.ExeName); // ASaveDialog := TSaveDialog.Create(nil); // try // ASaveDialog.Title := 'Volcar a disco la remesa'; // ASaveDialog.FileName := FFichero; // // ASaveDialog.InitialDir := GetCurrentDir; // // ASaveDialog.Filter := 'Ficheros de norma 19 (*.C19)|*.C19'; // ASaveDialog.DefaultExt := 'C19'; // ASaveDialog.FilterIndex := 1; // // try // if ASaveDialog.Execute then // begin // FFichero := ASaveDialog.FileName; // ModalResult := mrOk // end // else begin // ModalResult := mrCancel; // end; // except // on e: exception do // ShowErrorMessage('error', 'error', e); // end; // finally // FreeAndNIL(ASaveDialog); // end; { if SaveFileDialog(Application.Handle, 'C19', 'Ficheros de norma 19 (*.C19)|*.C19', 'c:\', 'Volcar a disco la remesa', FFichero) then} if SaveFileDialog(Application.Handle, 'C19', 'Ficheros de norma 19 (*.C19)|*.C19', ARuta, 'Volcar a disco la remesa', AArchivo) then ModalResult := mrOk else ModalResult := mrCancel; end; procedure TfEditorExportacionNorma19.SetCodigoAgencia(const AValue: String); begin edtCodAgencia.Text := AValue; end; procedure TfEditorExportacionNorma19.SetCodigoEntidad(const AValue: String); begin edtCodEntidad.Text := AValue; end; procedure TfEditorExportacionNorma19.SetFechaCargo(const AValue: TDateTime); begin edtFechaCargo.Date := AValue; end; procedure TfEditorExportacionNorma19.SetFichero(const AValue: String); begin FFichero := AValue; JvFilenameEdit1.InitialDir := ExtractFilePath(Application.ExeName); JvFilenameEdit1.FileName := JvFilenameEdit1.InitialDir + PathDelim + FFichero; end; end.