Generowanie pliku z przelewami w formacie Elixir-0 (mBank)

0

Witam,
muszę wygenerować plik z przelewami w formacie Elixir-0 (mbank).
Robił już może ktoś coś podobnego i zechciałby się podzielić - stawiam piwo w zamian?

0

dzięki za szybką reakcję,
plik już widziałem, potrzebuję rozwiązania na 'szybko' - więc stąd pytam o pomoc - żeby nie mówić gotowca.

1

i pewnie jeszcze za darmo i z gwarancją...

0

za piwo i bez gwarancji :) - pasuje?

Zabieram się za to sam, jak zrobię to postaram się tu wkleić jakiś kod.

0

Na szybko, browara wypiłem sam:

unit UElixir;

interface

uses
  Dialogs, SysUtils, Classes;
  
type
  TElixir = class
  private
    FText: String;
    procedure AddDelimeter(const AValue: String = ',');
  public
    property Text: String read FText;

    procedure AddCommandType(const AValue: String = '110');  //zlecenie przelewu krajowego
    procedure AddPaymentDate(AValue: TDate);  //data przelewu w formacie RRRRMMDD
    procedure AddPaymentAmount(AValue: Currency); //kwota do zaplaty bez separatorow, pomnozona przez 100
    procedure AddPayerBankNumber(const AValue: String = '24900005'); //8 cyfrowy numer rozliczeniowy banku zleceniodawcy
    procedure AddPaymentMode(AValue: Integer = 0); //tryb realizacji płatności
    procedure AddPayerAccountNumber(const AValue: String); //nr rachunku zleceniodawcy w formacie NRB
    procedure AddCustomerAccountNumber(const AValue: String); //nr rachunku kontrahenta w formacie NRB
    procedure AddPayerNameAndAddress(const AValue: String = ''); //nazwa i adres zleceniodawcy
    procedure AddCustomerNameAndAddress(const AValue: String); //nazwa i adres kontrahenta
    procedure AddFees(AValue: Currency = 0); //oplaty i prowizje
    procedure AddCustomerBankNumber(const AValue: String); //8 cyfrowy numer rozliczeniowy banku kontrahenta
    procedure AddPaymentDetails(const AValue: String = ''); //szczegoly platnosci
    procedure AddEmptyField(const AValue: String = ''); //pole puste (wystepuje 2 razy obok siebie)
    procedure AddCommandClassification(const AValue: String = '51'); //klasyfikacja polecenia
    procedure AddPayerBankInfo(const AValue: String = ''); //informacje Klient-Bank
    procedure AddEndOfFile(const AValue: String = #13#10); //koniec polecenia
  end;

implementation

{ TElixir }

procedure TElixir.AddDelimeter(const AValue: String = ',');
begin
  FText := FText + AValue;
end;

procedure TElixir.AddCommandType(const AValue: String = '110');
begin
  FText := FText + AValue;
end;

procedure TElixir.AddPaymentDate(AValue: TDate);
var
  Year, Month, Day: Word;
  MonthStr, DayStr: String;
begin
  DecodeDate(AValue, Year, Month, Day);

  MonthStr := Month.ToString;
  DayStr := Day.ToString;
  if Month < 10 then
    MonthStr := '0' + Month.ToString;
  if Day < 10 then
    DayStr := '0' + Day.ToString;

  AddDelimeter;
  FText := FText + Year.ToString + MonthStr + DayStr;
end;

procedure TElixir.AddPaymentAmount(AValue: Currency);
var
  Temp: String;
begin
  Temp := StringReplace(CurrToStr(AValue), ' ', '', [rfReplaceAll]);
  Temp := StringReplace(Temp, ',', '', [rfReplaceAll]);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddPayerBankNumber(const AValue: String = '24900005');
var
  Temp: String;
begin
  Temp := StringReplace(AValue, ' ', '', [rfReplaceAll]);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddPaymentMode(AValue: Integer = 0);
begin
  AddDelimeter;
  FText := FText + AValue.ToString;
end;

procedure TElixir.AddPayerAccountNumber(const AValue: String);
var
  Temp: String;
begin
  Temp := StringReplace(AValue, ' ', '', [rfReplaceAll]);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddCustomerAccountNumber(const AValue: String);
var
  Temp: String;
begin
  Temp := StringReplace(AValue, ' ', '', [rfReplaceAll]);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddPayerNameAndAddress(const AValue: String = '');
begin
  AddDelimeter;
  FText := FText + AValue;
end;

procedure TElixir.AddCustomerNameAndAddress(const AValue: String);
var
  Temp: String;
begin
  Temp := StringReplace(AValue, ' ', '', [rfReplaceAll]);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddFees(AValue: Currency = 0);
begin
  AddDelimeter;
  FText := FText + CurrToStr(AValue);
end;

procedure TElixir.AddCustomerBankNumber(const AValue: String);
var
  Temp: String;
begin
  Temp := StringReplace(AValue, ' ', '', [rfReplaceAll]);
  Temp := Copy(Temp, 3, 8);

  AddDelimeter;
  FText := FText + Temp;
end;

procedure TElixir.AddPaymentDetails(const AValue: String = '');
begin
  AddDelimeter;
  FText := FText + AValue;
end;

procedure TElixir.AddEmptyField(const AValue: String = '');
begin
  AddDelimeter;
  FText := FText + AValue;
end;

procedure TElixir.AddCommandClassification(const AValue: String = '51');
begin
  AddDelimeter;
  FText := FText + AValue;
end;

procedure TElixir.AddPayerBankInfo(const AValue: String = '');
begin
  if AValue <> '' then
    AddDelimeter;
  FText := FText + AValue;
end;

procedure TElixir.AddEndOfFile(const AValue: String = #13#10);
begin
  FText := FText + AValue;
end;


end.

1 użytkowników online, w tym zalogowanych: 0, gości: 1