384 lines
14 KiB
PHP
384 lines
14 KiB
PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
<title>{{ $title }}</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
<style type="text/css">
|
|
html,
|
|
body {
|
|
/** page margins : 5mm */
|
|
position: relative;
|
|
width: 200mm;
|
|
height: 287mm;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
color: #333333;
|
|
background-color: #FFFFFF;
|
|
}
|
|
|
|
table {
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
#main-table {
|
|
margin: auto;
|
|
height: 274mm;
|
|
width: 100%;
|
|
/** Test Mise en page */
|
|
/* border-color: red;
|
|
border-width: 1px;
|
|
border-style: solid; */
|
|
}
|
|
|
|
/* 1pt=0,352778mm, 1pt=1.3333333333333333px font-size=10.5pt=13,9999999965px=3,704169mm*/
|
|
|
|
/* LOGO + INTRO LINES */
|
|
#top-row {
|
|
/* 35mm */
|
|
height: 132.28px;
|
|
}
|
|
|
|
#addresses-row {
|
|
/* 45mm */
|
|
height: 170.078px;
|
|
}
|
|
|
|
#billing-box {
|
|
float: right;
|
|
/* 85mm */
|
|
width: 321.259px;
|
|
/* 15mm */
|
|
margin-right: 56.69px;
|
|
padding-top: 3rem;
|
|
/** Test Mise en page */
|
|
/* background-color: rgb(253, 184, 255); */
|
|
}
|
|
|
|
#shipping-box {
|
|
/* 7 lines */
|
|
height: 6rem;
|
|
margin-top: 0.5rem;
|
|
margin-bottom: 0.5rem;
|
|
text-align: center;
|
|
/** Test Mise en page */
|
|
/* background-color: rgb(215, 255, 135); */
|
|
}
|
|
|
|
#logo-container {
|
|
/** Test Mise en page */
|
|
/* border: 1px solid blue; */
|
|
}
|
|
|
|
#intro-lines-container {
|
|
/** Test Mise en page */
|
|
/* border: 1px solid purple; */
|
|
}
|
|
|
|
.logo-container-pages {
|
|
/** Test Mise en page */
|
|
/* border: 1px solid blue; */
|
|
}
|
|
|
|
.intro-lines-container-pages {
|
|
/** Test Mise en page */
|
|
/* border: 1px solid purple; */
|
|
}
|
|
|
|
#intro-lines {
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
.font-typed {
|
|
font-family: serif;
|
|
}
|
|
|
|
.font-upper {
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.font-spaced {
|
|
letter-spacing: 6px;
|
|
}
|
|
|
|
.font-amount {
|
|
font-family: serif;
|
|
text-transform: uppercase;
|
|
text-align: right;
|
|
}
|
|
|
|
.page-footer {
|
|
margin: auto;
|
|
/** Test Mise en page */
|
|
/* border-color: red;
|
|
border-width: 1px;
|
|
border-style: solid; */
|
|
}
|
|
|
|
.page-footer td {
|
|
padding-top: 2mm;
|
|
border-top: double medium #CCCCCC;
|
|
}
|
|
|
|
td.bold-cell,
|
|
th.bold-cell {
|
|
padding: 1mm;
|
|
border: 1px solid #333333;
|
|
background-color: #dadada;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
}
|
|
|
|
td.bordered-cell,
|
|
th.bordered-cell {
|
|
border: 1px solid #333333;
|
|
}
|
|
|
|
table.bordered,
|
|
table.bordered thead,
|
|
table.bordered body,
|
|
table.bordered td,
|
|
table.bordered th {
|
|
border: 1px solid;
|
|
border-color: #333333;
|
|
}
|
|
|
|
table.bordered td,
|
|
table.bordered th {
|
|
padding-left: 1mm;
|
|
padding-right: 1mm;
|
|
}
|
|
|
|
table.bordered td {
|
|
border-top: none;
|
|
border-bottom: none;
|
|
border-color: #333333;
|
|
}
|
|
|
|
@page {
|
|
footer: page-footer;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="main-table" cellpadding="0" cellspacing="0">
|
|
|
|
{{-- LOGO and INTROLINES FROM GENERAL CONFIGS --}}
|
|
<div id="top-row">
|
|
<table width="100%" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
{{-- LOGO --}}
|
|
<td id="logo-container" valign="middle" width="25%" style="text-align: center;height: 30mm;">
|
|
<img style="width: 26mm;" src="{{ $logo }}" alt="{{ config('app.name') }}" />
|
|
</td>
|
|
{{-- INTROLINES --}}
|
|
<td id="intro-lines-container" width="75%" style="text-align: center;">
|
|
<h1>{{ config('app.name') }}</h1>
|
|
<p id="intro-lines">
|
|
@foreach ($introLines as $introLine)
|
|
<span>{{ $introLine }}</span>
|
|
@if(!$loop->last)<br />@endif
|
|
@endforeach
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
{{-- SHIPPING AND BILLING --}}
|
|
<div id="billing-box" class="font-typed font-upper">
|
|
<strong>{{ Str::limit(Str::transliterate($billing->lastname) . ' '. Str::transliterate($billing->firstname), 37, '.') }}</strong><br />
|
|
{{ Str::limit(Str::transliterate($billing->line1), 37, '.') }}<br />
|
|
@if(!empty($billing->line2)){{ Str::limit(Str::transliterate($billing->line2), 37, '.') }}<br />@endif
|
|
{!! Str::limit(Str::transliterate(clean($billing->postal_code)) . ' '. Str::transliterate(clean($billing->city)), 37, '.') !!}
|
|
</div>
|
|
|
|
<div id="addresses-row">
|
|
<table width="100%" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
{{-- TYPE --}}
|
|
<td width="80%" class="bold-cell font-spaced">
|
|
<h2>{{ Str::upper($documentType) }}</h2>
|
|
</td>
|
|
{{-- BILLING --}}
|
|
<td rowspan="4" valign="middle"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="bold-cell">
|
|
<h3>{{ Str::upper(__('Adresse de livraison')) }}</h3>
|
|
</td>
|
|
</tr>
|
|
{{-- SHIPPING --}}
|
|
<tr>
|
|
<td id="shipping-box" class="bordered-cell font-typed font-upper">
|
|
<strong>{{ Str::transliterate($shipping->lastname) }} {{ Str::transliterate($shipping->firstname) }}</strong><br />
|
|
{{ Str::transliterate($shipping->line1) }}<br />
|
|
@if(!empty($shipping->line2)){{ Str::transliterate($shipping->line2) }}<br />@endif
|
|
{{ Str::transliterate($shipping->postal_code) }} {{ Str::transliterate($shipping->city) }}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
{{-- DATE AND REFERENCES --}}
|
|
<table class="bordered" width="100%" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td class="bold-cell">{{ __('Date') }}</td>
|
|
<td class="font-typed font-upper" style="text-align: center;">{{
|
|
$date->isoFormat('DD\/MM\/YYYY')
|
|
}}</td>
|
|
<td class="bold-cell">{{ __('N° Commande') }}</td>
|
|
<td class="font-typed font-upper" style="text-align: center;">{{ $orderReference }}</td>
|
|
<td class="bold-cell">{{ __('N° Facture') }}</td>
|
|
<td class="font-typed font-upper" style="text-align: center;">{{ $transactionReference }}</td>
|
|
</tr>
|
|
</tr>
|
|
</table>
|
|
|
|
@php
|
|
$basket = collect($basket);
|
|
$hasOnlyVirtalColumn = $basket->map(function ($basketItem) {
|
|
return collect(((object)$basketItem)->options)->get('virtual', false);
|
|
})->reduce(function ($prev, bool $isVirtual) {
|
|
return (is_null($prev) ? true : $prev) and $isVirtual;
|
|
});
|
|
$hasTaxes = !$hasOnlyVirtalColumn;
|
|
$columns = 4 + ($hasTaxes ? 1 : 0);
|
|
$isOnFirstPage = true;
|
|
$page = 1;
|
|
$perPage = 15;
|
|
$perPageAfterFirstPage = max(22, $perPage);
|
|
$basketPagedList = \App\Lib\Helpers\CollectionHelper::paginateManually(collect($basket), $perPage, $page);
|
|
@endphp
|
|
@while($basketPagedList->lastPage() >= $page)
|
|
@if(!$isOnFirstPage)
|
|
<table width="100%" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
{{-- LOGO --}}
|
|
<td class="logo-container-pages" valign="middle" width="25%" style="text-align: center;height: 15mm;">
|
|
<img style="width: 16mm;" src="{{ $logo }}" alt="{{ config('app.name') }}" />
|
|
</td>
|
|
{{-- APPNAME --}}
|
|
<td class="intro-lines-container-pages" width="75%" style="text-align: center;">
|
|
<h2>{{ config('app.name') }}</h2>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
@endif
|
|
<table class="bordered" width="100%" cellspacing="0" cellpadding="2" @if(!$isOnFirstPage) style="margin-top: 5mm;" @endif>
|
|
{{-- TABLE HEADER --}}
|
|
<thead>
|
|
<tr>
|
|
<th width="40%" class="bold-cell font-upper"><strong>{{ __('Désignation') }}</strong></th>
|
|
<th class="bold-cell font-upper"><strong>{{ __('Qte') }}</strong></th>
|
|
<th class="bold-cell font-upper"><strong>{{ __('Prix U. TTC') }}</strong></th>
|
|
@if($hasTaxes)
|
|
<th class="bold-cell font-upper"><strong>{{ __('Tva') }}</strong></th>
|
|
@endif
|
|
<th class="bold-cell font-upper"><strong>{{ __('S.Tot TTC') }}</strong></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($basketPagedList as $basketItem)
|
|
<tr>
|
|
<td valign="top" class="font-typed">
|
|
<strong>{{ Str::limit($basketItem->name, 45, '.') }}</strong><br />
|
|
<i>{{ $basketItem->options->reference }}</i>
|
|
</td>
|
|
<td valign="top" class="font-amount">{{ $basketItem->qty }}</td>
|
|
<td valign="top" class="font-amount">{{ \App\Lib\Helpers\ToolboxHelper::fmtCurrency($basketItem->options->price_ttc, '') }}</td>
|
|
@if($hasTaxes)
|
|
<td valign="top" class="font-amount">
|
|
@if(!(optional($basketItem->options)->virtual and !$basketItem->tax))
|
|
{{ \App\Lib\Helpers\ToolboxHelper::fmtCurrency($basketItem->tax, '') }}
|
|
@endif
|
|
</td>
|
|
@endif
|
|
<td valign="top" class="font-amount">{{ \App\Lib\Helpers\ToolboxHelper::fmtCurrency($basketItem->subtotal, '') }}</td>
|
|
</tr>
|
|
@endforeach
|
|
@for ($i = $perPage - $basketPagedList->count(); $i > 0; $i--)
|
|
<tr>
|
|
@for ($k = $columns; $k > 0; $k--)
|
|
<td valign="top"> <br> </td>
|
|
@endfor
|
|
</tr>
|
|
@endfor
|
|
</tbody>
|
|
</table>
|
|
@if($page < $basketPagedList->lastPage())
|
|
<pagebreak>
|
|
@endif
|
|
@php
|
|
$page++;
|
|
if($isOnFirstPage and $basketPagedList->lastPage() !== 1) {
|
|
$isOnFirstPage = false;
|
|
$basket = $basket->skip($perPage);
|
|
$perPage = $perPageAfterFirstPage;
|
|
$basketPagedList = \App\Lib\Helpers\CollectionHelper::paginateManually($basket, $perPage);
|
|
// * Reset page since new paginator for additional pages.
|
|
$page = 1;
|
|
}
|
|
@endphp
|
|
@endwhile
|
|
|
|
<table width="100%" cellspacing="0" cellpadding="2">
|
|
<tr>
|
|
<td style="width:50%;"><strong> </strong></td>
|
|
<td>
|
|
<table width="100%" cellspacing="0" cellpadding="2">
|
|
@if($hasTaxes)
|
|
<tr>
|
|
<td align="right"><u>{{ __('Tva') }}</u></td>
|
|
<td align="right" class="font-amount">{{
|
|
\App\Lib\Helpers\ToolboxHelper::fmtCurrency($totalTaxes)
|
|
}}</td>
|
|
</tr>
|
|
@endif
|
|
<tr>
|
|
<td align="right"><strong>{{ __('Total TTC') }}</strong></td>
|
|
<td align="right" class="font-amount"><strong>{{
|
|
\App\Lib\Helpers\ToolboxHelper::fmtCurrency($totalTtc)
|
|
}}</strong></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<htmlpagefooter name="page-footer">
|
|
<table width="100%" cellspacing="0" cellpadding="2" class="page-footer">
|
|
<tr>
|
|
<td width="16%" style="text-align: right;" valign="top">
|
|
{{ __('N° Commande') }} :<br />
|
|
{{ __('N° Facture') }} :
|
|
</td>
|
|
<td width="22%">
|
|
<span>{{ $orderReference }}</span><br />
|
|
<span>{{ $transactionReference }}</span>
|
|
</td>
|
|
<td width="45%" style="text-align: right;"> </td>
|
|
<td width="7%" style="text-align: right;">
|
|
<span>{{ __('date') }} :</span>
|
|
<span>{{ __('page') }} :</span>
|
|
</td>
|
|
<td valign="bottom" width="10%" style="text-align: left;">
|
|
<span>{{ $date->isoFormat('DD\/MM\/YY') }}</span>
|
|
<span>{PAGENO} / {nbpg}</span>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</htmlpagefooter>
|
|
</body>
|
|
|
|
</html>
|