diff --git a/app/Entities/Invoices/Invoice.php b/app/Entities/Invoices/Invoice.php index 2f35e70..f373d4c 100755 --- a/app/Entities/Invoices/Invoice.php +++ b/app/Entities/Invoices/Invoice.php @@ -25,10 +25,8 @@ class Invoice extends Model { $prefix = date('ym'); - $lastInvoice = $this->orderBy('number', 'desc')->first(); - if (!is_null($lastInvoice)) { $lastInvoiceNo = $lastInvoice->number; if (substr($lastInvoiceNo, 0, 4) == $prefix) { @@ -37,4 +35,11 @@ class Invoice extends Model } return $prefix.'001'; } + + public function getItemsCountAttribute($value) + { + $pcsCount = 0; + + return count($this->items); + } } diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index e13e8f7..cd3029b 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -11,4 +11,9 @@ class InvoicesController extends Controller { return view('invoices.show', compact('invoice')); } + + public function pdf(Invoice $invoice) + { + return view('invoices.pdf', compact('invoice')); + } } diff --git a/public/assets/css/app.s.css b/public/assets/css/app.s.css index 80dcef7..6a87081 100644 --- a/public/assets/css/app.s.css +++ b/public/assets/css/app.s.css @@ -248,7 +248,7 @@ html { -webkit-tap-highlight-color: transparent; } body { - font-family: "Liberation Serif", Helvetica, Arial, sans-serif; + font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.428571429; color: #333333; diff --git a/resources/lang/id/app.php b/resources/lang/id/app.php index e1d4d59..055b39d 100644 --- a/resources/lang/id/app.php +++ b/resources/lang/id/app.php @@ -38,4 +38,5 @@ return [ 'end_date' => 'Tanggal Selesai', 'change_photo' => 'Ganti Foto', 'welcome' => 'Selamat Datang', + 'to' => 'Kepada', ]; \ No newline at end of file diff --git a/resources/lang/id/invoice.php b/resources/lang/id/invoice.php index ff4fb70..2e416ff 100644 --- a/resources/lang/id/invoice.php +++ b/resources/lang/id/invoice.php @@ -24,6 +24,7 @@ return [ 'deleted' => 'Hapus data Invoice telah berhasil.', 'undeleted' => 'Data Invoice gagal dihapus.', 'undeleteable' => 'Data Invoice tidak dapat dihapus.', + 'print' => 'Cetak Invoice', // Attributes 'number' => 'No. Invoice', @@ -31,6 +32,8 @@ return [ 'items' => 'Item Invoice', 'notes' => 'Catatan', 'amount' => 'Tagihan', + 'customer' => 'Customer', 'item_description' => 'Deskripsi', 'item_amount' => 'Biaya', + 'items_count' => 'Jumlah Item', ]; diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php new file mode 100755 index 0000000..ca729bb --- /dev/null +++ b/resources/views/invoices/pdf.blade.php @@ -0,0 +1,107 @@ + + +
+ +| + {{ Html::image(url('assets/imgs/logo.png'), '', ['style' => 'width:100%']) }} + | +
+
+
+ JasaWebsiteBanjarmasin.com+Jasa Pembuatan Website dan Aplikasi Berbasis Web
+ |
+
+ {{ trans('invoice.invoice') }}+{{ trans('invoice.number') }} : INV-{{ $invoice->number }}
+ {{ trans('app.date') }} : {{ dateId($invoice->created_at->format('Y-m-d')) }}
+ |
+ ||||||||||
+ {{ trans('app.to') }} :+{{ $invoice->project->customer->name }} + |
+ ||||||||||||
| {{ trans('project.features') }} : | ||||||||||||
+
|
+ ||||||||||||
| Terbilang : | ++ {{ ucwords(Terbilang::make($invoice->amount)) }} Rupiah + | +|||||||||||
|
+ Pembayaran dapat dilakukan melalui transfer ke rekening berikut: + No. Rek : BCA // 782-0088-543+ An. NAFIES LUTHFI + Terima kasih atas kerjasamanya. + |
+ ||||||||||||
|
+ Banjarmasin, {{ dateId($invoice->created_at->format('Y-m-d')) }} + JasaWebsiteBanjarmasin.com
+ |
+ ||||||||||||