diff --git a/composer.json b/composer.json index a02b6ad..7268ef2 100644 --- a/composer.json +++ b/composer.json @@ -10,5 +10,22 @@ } ], "minimum-stability": "stable", - "require": {} + "require": { + "apphostbd/laravel-fpdf": "^1.0" + }, + "autoload": { + "psr-4": { + "Checkitsedo\\Esrpaymentslip\\": "packages/checkitsedo/esrpaymentslip/src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "Checkitsedo\\Esrpaymentslip\\EsrpaymentslipServiceProvider" + ], + "aliases": { + "EsrpaymentslipHelper": "Checkitsedo\\Esrpaymentslip\\Helpers\\EsrpaymentslipHelper" + } + } + } } diff --git a/src/Controllers/EsrpaymentslipController.php b/src/Controllers/EsrpaymentslipController.php new file mode 100644 index 0000000..8c5f974 --- /dev/null +++ b/src/Controllers/EsrpaymentslipController.php @@ -0,0 +1,165 @@ +paginate(5); + + return view('esrpaymentslips::esrpaymentslips.index',compact('esrpaymentslips')) + ->with('i', (request()->input('page', 1) - 1) * 5); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('esrpaymentslips::esrpaymentslips.create'); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + $esrpaymentslip = new Esrpaymentslip(); + $esrpaymentslip->bankName = $request->bankName; + $esrpaymentslip->bankCity = $request->bankCity; + $esrpaymentslip->bankingAccount = $request->bankingAccount; + $esrpaymentslip->bankingCustomerIdentification = $request->bankingCustomerIdentification; + $esrpaymentslip->recipientName = $request->recipientName; + $esrpaymentslip->recipientAddress = $request->recipientAddress; + $esrpaymentslip->recipientCity = $request->recipientCity; + $esrpaymentslip->payerLine1 = $request->payerLine1; + $esrpaymentslip->payerLine2 = $request->payerLine2; + $esrpaymentslip->payerLine3 = $request->payerLine3; + $esrpaymentslip->payerLine4 = $request->payerLine4; + $esrpaymentslip->amount = $request->amount; + $esrpaymentslip->invoiceNumber = $request->invoiceNumber; + $tempInvoiceNumber = $request->invoiceNumber; + $esrpaymentslip->referenceNumber = EsrpaymentslipHelper::calculateReference($tempInvoiceNumber); + $esrpaymentslip->save(); + + return redirect()->route('esrpaymentslips.index') + ->with('success','ESR Payment Slip created successfully.'); + } + + /** + * Display the specified resource. + * + * @param \Checkitsedo\Esrpaymentslip $esrpaymentslip + * @return \Illuminate\Http\Response + */ + public function show(Esrpaymentslip $esrpaymentslip, $id) + { + $esrpaymentslip = Esrpaymentslip::find($id); + return view('esrpaymentslips::esrpaymentslips.show',compact('esrpaymentslip')); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Esrpaymentslip $esrpaymentslip + * @return \Illuminate\Http\Response + */ + public function edit(Esrpaymentslip $esrpaymentslip, $id) + { + $esrpaymentslip = Esrpaymentslip::find($id); + return view('esrpaymentslips::esrpaymentslips.edit',compact('esrpaymentslip')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Esrpaymentslip $esrpaymentslip + * @return \Illuminate\Http\Response + */ + public function update(Request $request, $id) + { + $request->validate([ + 'bankName' => 'required', + 'bankCity' => 'required', + 'bankingAccount' => 'required', + 'bankingCustomerIdentification' => 'required', + 'recipientName' => 'required', + 'recipientAddress' => 'required', + 'recipientCity' => 'required', + 'payerLine1' => 'nullable', + 'payerLine2' => 'nullable', + 'payerLine3' => 'nullable', + 'payerLine4' => 'nullable', + 'amount' => 'required', + 'invoiceNumber' => 'required', + 'referenceNumber' => 'nullable', + ]); + + $tempInvoiceNumber = $request->invoiceNumber; + + $update = [ + 'bankName' => $request->bankName, + 'bankCity' => $request->bankCity, + 'bankingAccount' => $request->bankingAccount, + 'bankingCustomerIdentification' => $request->bankingCustomerIdentification, + 'recipientName' => $request->recipientName, + 'recipientAddress' => $request->recipientAddress, + 'recipientCity' => $request->recipientCity, + 'payerLine1' => $request->payerLine1, + 'payerLine2' => $request->payerLine2, + 'payerLine3' => $request->payerLine3, + 'payerLine4' => $request->payerLine4, + 'amount' => $request->amount, + 'invoiceNumber' => $request->invoiceNumber, + 'referenceNumber' => EsrpaymentslipHelper::calculateReference($tempInvoiceNumber), + ]; + + Esrpaymentslip::where('id', $id)->update($update); + + return redirect()->route('esrpaymentslips.index') + ->with('success','ESR Payment Slip updated successfully'); + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Esrpaymentslip $esrpaymentslip + * @return \Illuminate\Http\Response + */ + public function destroy(Esrpaymentslip $esrpaymentslip, $id) + { + $esrpaymentslip = Esrpaymentslip::find($id); + $esrpaymentslip->delete(); + + return redirect()->route('esrpaymentslips.index') + ->with('success','ESR Payment Slip deleted successfully'); + } + + public function download($id) + { + $esrpaymentslip = Esrpaymentslip::find($id); + + $download = new Download($esrpaymentslip); + $esr = $download->esr($esrpaymentslip); + + exit; + } +} diff --git a/src/Controllers/HomeController.php b/src/Controllers/HomeController.php new file mode 100644 index 0000000..9db3811 --- /dev/null +++ b/src/Controllers/HomeController.php @@ -0,0 +1,25 @@ +app->make('Checkitsedo\Esrpaymentslip\Controllers\EsrpaymentslipController'); + $this->loadViewsFrom(__DIR__.'/views','esrpaymentslips'); + + require_once __DIR__.'/Helpers/EsrpaymentslipHelper.php'; + require_once __DIR__.'/Pdf/Download.php'; + } + + /** + * Bootstrap services. + * + * @return void + */ + public function boot() + { + $this->loadRoutesFrom(__DIR__.'/routes.php'); + + $this->loadMigrationsFrom(__DIR__.'/database/migrations'); + + $this->publishes([ + __DIR__.'/public/images' => public_path('checkitsedo/images'), + ], 'public'); + } +} diff --git a/src/Helpers/EsrpaymentslipHelper.php b/src/Helpers/EsrpaymentslipHelper.php new file mode 100644 index 0000000..27b74f0 --- /dev/null +++ b/src/Helpers/EsrpaymentslipHelper.php @@ -0,0 +1,40 @@ +marginTop = $marginTop; + $this->marginLeft = $marginLeft; + $this->landscapeOrPortrait = $landscapeOrPortrait; + $this->format = $format; + + if($pdfObject != false){ + $this->pdf = $pdfObject; + }//if + + } + + + /** + * Verarbeiten der Eingaben aus dem Formular + */ + + public function esr($esrpaymentslip) { + + //Create a new pdf to create your invoice, already using FPDF + //(if you don't understand this part you should have a look at the FPDF documentation) + $pdf = new Fpdf('P','mm','A4'); + Fpdf::AddPage(); + Fpdf::SetAutoPageBreak(0,0); + Fpdf::SetFont('Helvetica','B',5.975); + Fpdf::SetTextColor(205,81,56); + Fpdf::SetXY(4.5, 0); + Fpdf::Cell(50, 377, utf8_decode("--> Sie können die unten stehenden Daten kopieren und in Ihr e-Banking-Zahlungsformular einfügen. Der folgende Abschnitt kann nicht als Einzahlungsschein am Postschalter verwendet werden. <--")); + Fpdf::SetTextColor(0,0,0); + + //Fügen Sie jetzt einfach Ihren Einzahlungsschein hinzu. Senden Sie Ihre PDF-Instanz an die Klasse Einzahlungsschein + $ezs = new Download(191, 0, $pdf); + + $bankName = $esrpaymentslip->bankName; + $bankCity = $esrpaymentslip->bankCity; + $bankingAccount = $esrpaymentslip->bankingAccount; + $bankingCustomerIdentification = $esrpaymentslip->bankingCustomerIdentification; + + $recipientName = $esrpaymentslip->recipientName; + $recipientAddress = $esrpaymentslip->recipientAddress; + $recipientCity = $esrpaymentslip->recipientCity; + + $payerLine1 = $esrpaymentslip->payerLine1; + $payerLine2 = $esrpaymentslip->payerLine2; + $payerLine3 = $esrpaymentslip->payerLine3; + $payerLine4 = $esrpaymentslip->payerLine4; + + $invoiceNumber = $esrpaymentslip->invoiceNumber; + $referenceNumber = $esrpaymentslip->referenceNumber; + $amount = $esrpaymentslip->amount; + + $ezs->setBankData($bankName, $bankCity, $bankingAccount); + $ezs->setRecipientData($recipientName, $recipientAddress, $recipientCity, $bankingCustomerIdentification); + $ezs->setPayerData($payerLine1, $payerLine2, $payerLine3, $payerLine4); + $ezs->setPaymentData($amount, $referenceNumber); + $ezs->createEinzahlungsschein(false, true); + + Fpdf::output('D', "Einzahlungsschein.pdf", true); + } + + + //Typ setzen + public function setType($type){ + $this->type = $type; + } + + + /** + * Set name, address and banking account of bank + * @param string $bankName + * @param string $bankCity + * @param string $bankingAccount + * @return bool + */ + public function setBankData($bankName, $bankCity, $bankingAccount) + { + $this->ezs_bankName = utf8_decode($bankName); + $this->ezs_bankCity = utf8_decode($bankCity); + $this->ezs_bankingAccount = $bankingAccount; + return true; + } + + + /** + * Set name and address of recipient of money (= you, I guess) + * @param string $recipientName + * @param string $recipientAddress + * @param string $recipientCity + * @param int $bankingCustomerIdentification + * @return bool + */ + public function setRecipientData($recipientName, $recipientAddress, $recipientCity, $bankingCustomerIdentification) + { + $this->ezs_recipientName = $recipientName; + $this->ezs_recipientAddress = $recipientAddress; + $this->ezs_recipientCity = $recipientCity; + $this->ezs_bankingCustomerIdentification = $bankingCustomerIdentification; + return true; + } + + + /** + * Set name and address of payer (very flexible four lines of text) + * @param string $payerLine1 + * @param string $payerLine2 + * @param string $payerLine3 + * @param string $payerLine4 + * @return bool + */ + public function setPayerData($payerLine1, $payerLine2, $payerLine3, $payerLine4) + { + $this->ezs_payerLine1 = $payerLine1; + $this->ezs_payerLine2 = $payerLine2; + $this->ezs_payerLine3 = $payerLine3; + $this->ezs_payerLine4 = $payerLine4; + return true; + } + + + /** + * Set name and address of payer (very flexible four lines of text) + * @param string $payerLine1 + * @param string $payerLine2 + * @param string $payerLine3 + * @param string $payerLine4 + * @return bool + */ + public function setPayerFullAddress($address) + { + $this->ezs_payerFullAddress = $address; + return true; + } + + + /** + * Set payment data + * @param float $amount + * @param int $referenceNumber ( + * @return bool + */ + public function setPaymentData($amount, $referenceNumber=null) + { + $this->ezs_amount = sprintf("%01.2f",$amount); + $this->ezs_referenceNumber = $referenceNumber; + return true; + } + + + /** + * Set payment reason + * @param string $txt + * @return bool + */ + public function setPaymentReason($txt) + { + $this->paymentReason = utf8_decode($txt); + return true; + } + + + /** + * Does the magic! + * @param bool $doOutput + * @param string $filename + * @param string $saveAction (I, D, F, or S -> see http://www.fpdf.de/funktionsreferenz/?funktion=Output) + * @return string or file + */ + public function createEinzahlungsschein($doOutput=true, $displayImage=false, $fileName='', $saveAction=''){ + + //Set basic stuff + if(!$this->pdf){ + $this->pdf = new Fpdf($this->landscapeOrPortrait,'mm',$this->format); + $this->pdf->AddPage(); + $this->pdf->SetAutoPageBreak(0); + }//if + + + //Place image + if($displayImage){ + Fpdf::Image($this->pathToImage."ezs_".$this->type.".png", $this->marginLeft, $this->marginTop, 210, 106, "PNG"); + }//if + + //Set font + Fpdf::SetFont('Helvetica','',9); + + + //Place name of bank (twice) + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+9); + Fpdf::Cell(50, 4,$this->ezs_bankName); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+13); + Fpdf::Cell(50, 4,$this->ezs_bankCity); + + Fpdf::SetXY($this->marginLeft+62.6, $this->marginTop+9); + Fpdf::Cell(50, 4,$this->ezs_bankName); + Fpdf::SetXY($this->marginLeft+62.6, $this->marginTop+13); + Fpdf::Cell(50, 4,$this->ezs_bankCity); + + + //Place banking account (twice) + Fpdf::SetXY($this->marginLeft+27, $this->marginTop+42.75); + Fpdf::Cell(30, 4,$this->ezs_bankingAccount); + + Fpdf::SetXY($this->marginLeft+87.5, $this->marginTop+42.75); + Fpdf::Cell(30, 4,$this->ezs_bankingAccount); + + + //Place money amount (twice) + if($this->ezs_amount > 0){ + $amountParts = explode(".", $this->ezs_amount); + }else{ + $amountParts[0] = "--"; + $amountParts[1] = "--"; + }//if + + + $offset = 50.5; + if($this->type == 'red'){$offset = 51.5;}; + + Fpdf::SetFont('Helvetica','',12); + + Fpdf::SetXY($this->marginLeft+7, $this->marginTop+$offset+0.7); + Fpdf::Cell(35, 4,$amountParts[0], 0, 0, "R"); + Fpdf::SetXY($this->marginLeft+48.5, $this->marginTop+$offset+0.7); + Fpdf::Cell(6, 4,$amountParts[1], 0, 0, "C"); + + Fpdf::SetXY($this->marginLeft+67.6, $this->marginTop+$offset+0.7); + Fpdf::Cell(35, 4,$amountParts[0], 0, 0, "R"); + Fpdf::SetXY($this->marginLeft+109.2, $this->marginTop+$offset+0.7); + Fpdf::Cell(6, 4,$amountParts[1], 0, 0, "C"); + + + //Place name of receiver (twice) + if($this->type == 'red'){ + + $this->pdf->SetFont('Helvetica','',9); + + $this->pdf->SetXY($this->marginLeft+2, $this->marginTop+23); + $this->pdf->Cell(50, 4,$this->formatIban(utf8_decode($this->ezs_bankingCustomerIdentification))); + $this->pdf->SetXY($this->marginLeft+2, $this->marginTop+27); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientName)); + $this->pdf->SetXY($this->marginLeft+2, $this->marginTop+31); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientAddress)); + $this->pdf->SetXY($this->marginLeft+2, $this->marginTop+35); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientCity)); + + $this->pdf->SetXY($this->marginLeft+62.6, $this->marginTop+23); + $this->pdf->Cell(50, 4,$this->formatIban(utf8_decode($this->ezs_bankingCustomerIdentification))); + $this->pdf->SetXY($this->marginLeft+62.6, $this->marginTop+27); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientName)); + $this->pdf->SetXY($this->marginLeft+62.6, $this->marginTop+31); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientAddress)); + $this->pdf->SetXY($this->marginLeft+62.6, $this->marginTop+35); + $this->pdf->Cell(50, 4,utf8_decode($this->ezs_recipientCity)); + + }else{ + + Fpdf::SetFont('Helvetica','',9); + + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+21.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientName)); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+25.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientAddress)); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+29.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientCity)); + + Fpdf::SetXY($this->marginLeft+62.6, $this->marginTop+21.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientName)); + Fpdf::SetXY($this->marginLeft+62.6, $this->marginTop+25.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientAddress)); + Fpdf::SetXY($this->marginLeft+62.6, $this->marginTop+29.5); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_recipientCity)); + + } + + + + //Place name of Payer (twice) + if($this->ezs_payerFullAddress){ + + $this->pdf->SetXY($this->marginLeft+2, $this->marginTop+64); + $this->pdf->MultiCell(50, 4, utf8_decode($this->ezs_payerFullAddress), 0, 'L'); + + $this->pdf->SetXY($this->marginLeft+123, $this->marginTop+48); + $this->pdf->MultiCell(50, 4, utf8_decode($this->ezs_payerFullAddress), 0, 'L'); + + }else{ + + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+66); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine1)); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+70); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine2)); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+74); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine3)); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+78); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine4)); + + + Fpdf::SetXY($this->marginLeft+123.2, $this->marginTop+47); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine1)); + Fpdf::SetXY($this->marginLeft+123.2, $this->marginTop+51); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine2)); + Fpdf::SetXY($this->marginLeft+123.2, $this->marginTop+55); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine3)); + Fpdf::SetXY($this->marginLeft+123.2, $this->marginTop+59); + Fpdf::Cell(50, 4,utf8_decode($this->ezs_payerLine4)); + + } + + + + //Reference number + if($this->type == 'orange'){ + + //create complete reference number + $completeReferenceNumber = $this->createCompleteReferenceNumber(); + + //Place Reference Number (twice) + Fpdf::SetFont('Helvetica','',10); + Fpdf::SetXY($this->marginLeft+125, $this->marginTop+34.25); + Fpdf::Cell(80, 4, $this->breakStringIntoBlocks($completeReferenceNumber)); + + Fpdf::SetFont('Helvetica','',7); + Fpdf::SetXY($this->marginLeft+2, $this->marginTop+60); + Fpdf::Cell(50, 4, $this->breakStringIntoBlocks($completeReferenceNumber)); + + }//if + + + //Payment reason + if($this->type == 'red'){ + + $this->pdf->SetXY($this->marginLeft+125, $this->marginTop+12); + $this->pdf->MultiCell(50, 4, $this->paymentReason, 0, 'L'); + + }//if + + + //Bottom line + if($this->type == 'orange'){ + + //create bottom line string + $bottomLineString = ''; + + //EZS with amount or not? + if($this->ezs_amount == 0){ + $bottomLineString .= "042>"; + }else{ + $amountParts = explode(".", $this->ezs_amount); + $bottomLineString .= "01"; + $bottomLineString .= str_pad($amountParts[0], 8 ,'0', STR_PAD_LEFT); + $bottomLineString .= str_pad($amountParts[1], 2 ,'0', STR_PAD_RIGHT); + $bottomLineString .= $this->modulo10($bottomLineString); + $bottomLineString .= ">"; + }//if + + //add reference number + $bottomLineString .= $this->createCompleteReferenceNumber(); + $bottomLineString .= "+ "; + + //add banking account + $bankingAccountParts = explode("-", $this->ezs_bankingAccount); + $bottomLineString .= str_pad($bankingAccountParts[0], 2 ,'0', STR_PAD_LEFT); + $bottomLineString .= str_pad($bankingAccountParts[1], 6 ,'0', STR_PAD_LEFT); + $bottomLineString .= str_pad($bankingAccountParts[2], 1 ,'0', STR_PAD_LEFT); + $bottomLineString .= ">"; + + + //Set bottom line + Fpdf::AddFont('OCRB10'); + Fpdf::SetFont('OCRB10','',10); + Fpdf::SetXY($this->marginLeft+63, $this->marginTop+85); + Fpdf::Cell(140,4,$bottomLineString, 0, 0, "R"); + + }else{ + + //set font + Fpdf::AddFont('OCRB10'); + Fpdf::SetFont('OCRB10','',10); + + + //add banking account + $bottomLineString = ''; + $bottomLineString .= str_pad(substr($this->ezs_bankingCustomerIdentification, 8), 26 ,'0', STR_PAD_LEFT); + $bottomLineString .= $this->modulo10($bottomLineString); + $bottomLineString .= "+"; + + $bottomLineString2 = ''; + $bcNummer = substr($this->ezs_bankingCustomerIdentification, 4, 5); + $bottomLineString2 .= " 07".$bcNummer; + $bottomLineString2 .= $this->modulo10($bcNummer); + $bottomLineString2 .= $this->modulo10($bottomLineString2); + $bottomLineString2 .= ">"; + $bottomLineString .= $bottomLineString2; + + + //Set bottom line + Fpdf::SetXY($this->marginLeft+67, $this->marginTop+85); + Fpdf::Cell(140,4,$bottomLineString, 0, 0, "R"); + + + //add banking account + $bottomLineString = ''; + $bankingAccountParts = explode("-", $this->ezs_bankingAccount); + $bottomLineString .= str_pad($bankingAccountParts[0], 2 ,'0', STR_PAD_LEFT); + $bottomLineString .= str_pad($bankingAccountParts[1], 6 ,'0', STR_PAD_LEFT); + $bottomLineString .= str_pad($bankingAccountParts[2], 1 ,'0', STR_PAD_LEFT); + $bottomLineString .= ">"; + + //Set bottom line + Fpdf::SetXY($this->marginLeft+67, $this->marginTop+92); + Fpdf::Cell(140,4,$bottomLineString, 0, 0, "R"); + + }//if + + + //Output + if($doOutput){ + Fpdf::Output($fileName, $saveAction); + if($fileName != ''){ + return $fileName; + }//if + }//if + + } + + + + /** + * Creates Modulo10 recursive check digit + * + * as found on http://www.developers-guide.net/forums/5431,modulo10-rekursiv + * (thanks, dude!) + * + * @param string $number + * @return int + */ + private function modulo10($number) { + $table = array(0,9,4,6,8,2,7,1,3,5); + $next = 0; + for ($i=0; $iezs_referenceNumber, (26 - strlen($this->ezs_bankingCustomerIdentification)) ,'0', STR_PAD_LEFT); + + //add customer identification code + $completeReferenceNumber = $this->ezs_bankingCustomerIdentification.$completeReferenceNumber; + + //add check digit + $completeReferenceNumber .= $this->modulo10($completeReferenceNumber); + + //return + return $completeReferenceNumber; + } + + + + + + /** + * Displays a string in blocks of a certain size. + * Example: 00000000000000000000 becomes more readable 00000 00000 00000 + * @param string $string + * @param int $blocksize + * @return string + */ + private function breakStringIntoBlocks($string, $blocksize=5, $alignFromRight=true) { + + //lets reverse the string (because we want the block to be aligned from the right) + if($alignFromRight){ + $string = strrev($string); + }//if + + //chop it into blocks + $string = trim(chunk_split($string, $blocksize, ' ')); + + //re-reverse + if($alignFromRight){ + $string = strrev($string); + }//if + + return $string; + + } + + + + /** + * Formats IBAN number in human readable format + * @return string + */ + private function formatIban($iban){ + return $this->breakStringIntoBlocks($iban, 4, false); + } + +} \ No newline at end of file diff --git a/src/database/migrations/2019_12_16_090734_create_esrpaymentslips_table.php b/src/database/migrations/2019_12_16_090734_create_esrpaymentslips_table.php new file mode 100644 index 0000000..5fcaa79 --- /dev/null +++ b/src/database/migrations/2019_12_16_090734_create_esrpaymentslips_table.php @@ -0,0 +1,45 @@ +bigIncrements('id'); + $table->string('bankName'); + $table->string('bankCity'); + $table->string('bankingAccount'); + $table->string('bankingCustomerIdentification'); + $table->string('recipientName'); + $table->string('recipientAddress'); + $table->string('recipientCity'); + $table->string('payerLine1'); + $table->string('payerLine2'); + $table->string('payerLine3'); + $table->string('payerLine4'); + $table->string('amount'); + $table->string('invoiceNumber'); + $table->string('referenceNumber'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('esrpaymentslips'); + } +} diff --git a/src/public/images/ezs_orange.png b/src/public/images/ezs_orange.png new file mode 100644 index 0000000..252a115 Binary files /dev/null and b/src/public/images/ezs_orange.png differ diff --git a/src/routes.php b/src/routes.php new file mode 100644 index 0000000..7350339 --- /dev/null +++ b/src/routes.php @@ -0,0 +1,20 @@ +name('home'); + +Route::get('admin/routes', 'Checkitsedo\Esrpaymentslip\Controllers\HomeController@admin')->middleware('admin'); + +Route::get('/pdf/{id}', 'Checkitsedo\Esrpaymentslip\Controllers\EsrpaymentslipController@download')->name('esrpaymentslips.download'); + +Route::resource('esrpaymentslips','Checkitsedo\Esrpaymentslip\Controllers\EsrpaymentslipController'); diff --git a/src/views/esrpaymentslips/create.blade.php b/src/views/esrpaymentslips/create.blade.php new file mode 100644 index 0000000..eb75fda --- /dev/null +++ b/src/views/esrpaymentslips/create.blade.php @@ -0,0 +1,168 @@ +@extends('esrpaymentslips::layouts.app') + +@section('title', 'Home ESR Tools - Dominik Senti') + +@section('content') +
+
+
+

Add New ESR Payment Slip

+
+
+ Back +
+
+
+ +
+ @csrf + +
+
+

Einzahlung von/Versé par:

+ + + +
+ + + +
+ + + +
+ + +
+ +
+

Einzahlung für/Versement pour:

+ + + +
+ + + +
+ + + +
+ + +
+ +
+
+ +
+

Zungunsten von/En faveur de:

+ + + +
+ + + +
+ + +
+ +
+

Zahlungsinformationen/données de paiement:

+ + + +
+ + + +
+ + +
+ +
+
+ +
+ +
+
+ +
+ +@endsection \ No newline at end of file diff --git a/src/views/esrpaymentslips/edit.blade.php b/src/views/esrpaymentslips/edit.blade.php new file mode 100644 index 0000000..e9632c5 --- /dev/null +++ b/src/views/esrpaymentslips/edit.blade.php @@ -0,0 +1,169 @@ +@extends('esrpaymentslips::layouts.app') + +@section('title', 'Home ESR Tools - Dominik Senti') + +@section('content') +
+
+
+

Edit ESR Payment Slip

+
+
+ Back +
+
+
+ +
+ @csrf + @method('PATCH') + +
+
+

Einzahlung von/Versé par:

+ + + +
+ + + +
+ + + +
+ + +
+ +
+

Einzahlung für/Versement pour:

+ + + +
+ + + +
+ + + +
+ + +
+ +
+
+ +
+

Zungunsten von/En faveur de:

+ + + +
+ + + +
+ + +
+ +
+

Zahlungsinformationen/données de paiement:

+ + + +
+ + + +
+ + +
+ +
+
+ +
+ +
+
+ +
+ +@endsection \ No newline at end of file diff --git a/src/views/esrpaymentslips/index.blade.php b/src/views/esrpaymentslips/index.blade.php new file mode 100644 index 0000000..22607c1 --- /dev/null +++ b/src/views/esrpaymentslips/index.blade.php @@ -0,0 +1,144 @@ +@extends('esrpaymentslips::layouts.app') + +@section('title', 'Home ESR Tools - Dominik Senti') + +@section('content') + +
+
+
+

ESR Payment Slips Tool

+
+ +
+
+ + @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @endif + + @if (count($esrpaymentslips) > 0) + + + + + + + + + + + + + + @foreach ($esrpaymentslips as $esrpaymentslip) + + + + + + + + + + + + + @endforeach + +
#Payer Line 1Invoice NumberReference NumberAmount
+ {{ $esrpaymentslip->id }} + + {{ $esrpaymentslip->payerLine1 }} + {{ $esrpaymentslip->invoiceNumber }}{{ $esrpaymentslip->referenceNumber }}{{ $esrpaymentslip->amount }} +
+
+ + + + @csrf + @method('DELETE') + +
+
+
+
+
+
+
Einzahlung von:
+
+
+ {{ $esrpaymentslip->payerLine1 }} +
+
+ {{ $esrpaymentslip->payerLine2 }}
+
+
+ {{ $esrpaymentslip->payerLine3 }} +
+
+ {{ $esrpaymentslip->payerLine4 }} +
+
+
+
+
Einzahlung für:
+
+
+ {{ $esrpaymentslip->bankName }} +
+
+ {{ $esrpaymentslip->bankCity }}
+
+
+ {{ $esrpaymentslip->bankingAccount }} +
+
+ {{ $esrpaymentslip->bankingCustomerIdentification }} +
+
+
+
+
Zugunsten von:
+
+
+ {{ $esrpaymentslip->recipientName }} +
+
+ {{ $esrpaymentslip->recipientAddress }}
+
+
+ {{ $esrpaymentslip->recipientCity }} +
+
+
+
+
Zahlungsinformationen:
+
+
+ {{ $esrpaymentslip->amount }} +
+
+ {{ $esrpaymentslip->invoiceNumber }}
+
+
+ {{ $esrpaymentslip->referenceNumber }} +
+
+
+
+
+

Created: {{ $esrpaymentslip->created_at->diffForHumans() }}

+
+
+ @else +

No ESR Payment Slips found

+ @endif + + {!! $esrpaymentslips->links() !!} + +@endsection diff --git a/src/views/esrpaymentslips/layout.blade.php b/src/views/esrpaymentslips/layout.blade.php new file mode 100644 index 0000000..79e443d --- /dev/null +++ b/src/views/esrpaymentslips/layout.blade.php @@ -0,0 +1,332 @@ + + + + @yield('title') + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+ + + +
+ @yield('content') +
+ + + + + + + + + + \ No newline at end of file diff --git a/src/views/esrpaymentslips/show.blade.php b/src/views/esrpaymentslips/show.blade.php new file mode 100644 index 0000000..47ef1f9 --- /dev/null +++ b/src/views/esrpaymentslips/show.blade.php @@ -0,0 +1,104 @@ +@extends('esrpaymentslips::layouts.app') + +@section('title', 'Home ESR Tools - Dominik Senti') + +@section('content') +
+
+
+

Show ESR Payment Slip

+
+
+ Back +
+
+
+ +
+
+
+ Bank Name: + {{ $esrpaymentslip->bankName }} +
+
+
+
+ Bank City: + {{ $esrpaymentslip->bankCity }} +
+
+
+
+ Banking Account: + {{ $esrpaymentslip->bankingAccount }} +
+
+
+
+ Banking CID: + {{ $esrpaymentslip->bankingCustomerIdentification }} +
+
+
+
+ Recipient Name: + {{ $esrpaymentslip->recipientName }} +
+
+
+
+ Recipient Address: + {{ $esrpaymentslip->recipientAddress }} +
+
+
+
+ Recipient City: + {{ $esrpaymentslip->recipientCity }} +
+
+
+
+ Payer Line 1: + {{ $esrpaymentslip->payerLine1 }} +
+
+
+
+ Payer Line 2: + {{ $esrpaymentslip->payerLine2 }} +
+
+
+
+ Payer Line 3: + {{ $esrpaymentslip->payerLine3 }} +
+
+
+
+ Payer Line 4: + {{ $esrpaymentslip->payerLine4 }} +
+
+
+
+ Amount: + {{ $esrpaymentslip->amount }} +
+
+
+
+ Invoice Number: + {{ $esrpaymentslip->invoiceNumber }} +
+
+
+
+ Reference Number: + {{ $esrpaymentslip->referenceNumber }} +
+
+
+ +@endsection \ No newline at end of file diff --git a/src/views/home.blade.php b/src/views/home.blade.php new file mode 100644 index 0000000..26fa1a4 --- /dev/null +++ b/src/views/home.blade.php @@ -0,0 +1,25 @@ +@extends('esrpaymentslips::layouts.app') + +@section('content') +
+
+
+
+
Dashboard
+ +
+ @if (session('status')) + + @endif + + Admin + ESR Payment Slips + +
+
+
+
+
+@endsection diff --git a/src/views/layouts/app.blade.php b/src/views/layouts/app.blade.php new file mode 100644 index 0000000..c2598ba --- /dev/null +++ b/src/views/layouts/app.blade.php @@ -0,0 +1,68 @@ + + + + + + + + + + {{ config('app.name', 'Laravel') }} + + + + + + + + + + + + + + + + + +
+ + +
+ @yield('content') +
+
+ +