Skip to content

Commit

Permalink
csv add data
Browse files Browse the repository at this point in the history
  • Loading branch information
mrothauer committed Dec 5, 2024
1 parent 2349528 commit 47cba43
Showing 1 changed file with 70 additions and 7 deletions.
77 changes: 70 additions & 7 deletions plugins/Admin/src/Controller/FundingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,48 @@ public function bankExport() {

$writer = Writer::createFromString();

//Währung;VorzBetrag;RechNr;Belegdatum;InterneRechNr;KundeName;KundeOrt;KundeKonto;BU;Konto;Kontobezeichnung;Ware/Leistung;Fällig_am;gezahlt_am;UStSatz;USt-IdNr.Kunde;Kunden-Nr.;KOST1;KOST2;KOSTmenge;Kurs;Skonto;Nachricht;Skto_Fällig_am;BankKonto;BankBlz;Bankname;BankIban;BankBic;Skto_Proz

/*
$writer->insertOne(['VorzBetrag']);
foreach($validFundings as &$record) {
$record['VorzBetrag'] = $record->budgetplan_total_with_limit;
$writer->insertOne($this->getCsvHeader());
$records = [];
foreach($validFundings as $funding) {
$record = [];
$record = [
'EUR', // Währung
$funding->budgetplan_total_with_limit, // VorzBetrag
'Antrag-' . $funding->uid, // RechNr
date('d.m.Y'), // Belegdatum
'', // InterneRechNr
$funding->fundingsupporter->name, // LieferantName
$funding->fundingsupporter->city, // LieferantOrt
$funding->owner_user->uid, // LieferantKonto
'', // BU
'5010', // Konto
'', // Kontobezeichnung
'Reparaturförderung', // Ware/Leistung
date('Y.m.d'), // Fällig_am
'', // gezahlt_am
'', // UStSatz
'', // USt-IdNr.Kunde
'', // Kunden-Nr.
'', // KOST1
'', // KOST2
'', // KOSTmenge
'', // Kurs
'', // Skonto
'', // Nachricht
'', // Skto_Fällig_am
$funding->fundingsupporter->bank_institute, // Bankname
$funding->fundingsupporter->iban, // BankKonto
$funding->fundingsupporter->bic, // BankBlz
'', // Skto_Proz
];
$records[] = $record;
}
$writer->insertAll($records);

$this->disableAutoRender();

pr($writer->toString());
exit;
*/

$response = $this->response;
$response = $response->withStringBody($writer->toString());
Expand All @@ -90,6 +118,41 @@ public function bankExport() {

}

private function getCsvHeader() {
return [
'Währung',
'VorzBetrag',
'RechNr',
'Belegdatum',
'InterneRechNr',
'LieferantName',
'LieferantOrt',
'LieferantKonto',
'BU',
'Konto',
'Kontobezeichnung',
'Ware/Leistung',
'Fällig_am',
'gezahlt_am',
'UStSatz',
'USt-IdNr.Kunde',
'Kunden-Nr.',
'KOST1',
'KOST2',
'KOSTmenge',
'Kurs',
'Skonto',
'Nachricht',
'Skto_Fällig_am',
'BankKonto',
'BankBlz',
'Bankname',
'BankIban',
'BankBic',
'Skto_Proz',
];
}

public function edit($uid)
{

Expand Down

0 comments on commit 47cba43

Please sign in to comment.