162 lines
7.4 KiB
PHP
162 lines
7.4 KiB
PHP
<?php
|
|
|
|
use OCA\Gestion\Constants\OrderTypeConstant;
|
|
$order = $_['order'];
|
|
$configuration = $_['configuration'];
|
|
$isOrderDevis = $order->fk_order_type_key == OrderTypeConstant::ORDER_TYPE_DEVIS;
|
|
$isOrderPurchase = $order->fk_order_type_key == OrderTypeConstant::ORDER_TYPE_PURCHASE;
|
|
$orderComment = $order->order_comment == null || $order->order_comment == "" ? "-": $order->order_comment;
|
|
|
|
$clientCompany = $isOrderDevis ?
|
|
$order->client_entreprise :
|
|
"FOURNISSEUR";
|
|
|
|
$clientFullName = $isOrderDevis ?
|
|
$order->client_prenom . " " . $order->client_nom :
|
|
$order->provider_name . " " . $order->provider_last_name;
|
|
|
|
$clientAddress = $isOrderDevis ?
|
|
$order->client_adresse :
|
|
$order->provider_address.' '.$order->provider_city;
|
|
|
|
$clientEmail = $isOrderDevis ?
|
|
$order->client_mail :
|
|
$order->provider_email;
|
|
|
|
$clientPhone = $isOrderDevis ?
|
|
$order->client_phone :
|
|
$order->provider_phone;
|
|
|
|
$clientSiret = $isOrderDevis ?
|
|
$order->client_legal_one :
|
|
$order->provider_company_name;
|
|
?>
|
|
<div class="bootstrap-iso">
|
|
<div id="orderId" data-id="<?php echo $order->id; ?>"></div>
|
|
<?php if($isOrderDevis){
|
|
?>
|
|
<div id="devisId" style="display:none;" data-id="<?php echo $order->fk_devis_id; ?>"></div>
|
|
<?php } ?>
|
|
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Commande'));?>
|
|
<?php if($isOrderDevis) {
|
|
?>
|
|
<div style="display:inline">sur le defunt <?php echo $order->defunt_nom; ?></div>
|
|
<span>(</span> <div style="display:inline"><?php echo $order->lieu_nom; ?>)</div>
|
|
<?php } ?>
|
|
</h2>
|
|
<hr />
|
|
<div class="row">
|
|
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
|
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('FROM'));?> <?php echo $configuration->entreprise; ?></h5>
|
|
<p style="min-height:180px;" class="p-3 m-0 h-100 text-center text-dark text-center border border-top-0 border-2 border-dark">
|
|
<?php echo $configuration->prenom . " " . $configuration->nom; ?><br />
|
|
<?php echo $configuration->adresse; ?><br />
|
|
<?php echo $configuration->mail; ?><br />
|
|
<?php echo $configuration->telephone; ?><br/>
|
|
<span id="nothing"></span><br />
|
|
</p>
|
|
</div>
|
|
<div class="col-2 h-100 m-0" style="min-height:250px;">
|
|
<?php
|
|
if(isset($_['logo']) && $_['logo'] !== "nothing"){
|
|
echo "<center><a><img alt='".$l->t('Company logo')."' class=\"img-fluid\" src=\"data:image/png;base64, ".$_['logo']."\"/></a></center>";
|
|
}else{
|
|
echo "<span style='font-size:12px' id='Company-logo' data-html2canvas-ignore><b><center>".$l->t('You can add your company logo here.')."</center></b><br/><i>".$l->t('To add a logo, drop the logo.png file in ".gestion" folder at the root of your Nextcloud Files app. Remember to set "Show hidden files".')."</i><br/><br/><center>".$l->t('This message will not appear on generated PDF.')."</center></span>";
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
|
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO'));?> <span><?php echo $clientCompany; ?></span></h5>
|
|
<p style="min-height:180px;" class="p-3 m-0 h-100 text-center text-dark text-center border border-top-0 border-2 border-dark">
|
|
<span><?php echo $clientFullName; ?></span><br/>
|
|
<span><?php echo $clientAddress; ?></span><br/>
|
|
<span><?php echo $clientEmail; ?></span><br/>
|
|
<span><?php echo $clientPhone; ?></span><br/>
|
|
<span><?php echo $clientSiret; ?></span><br/>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php if($isOrderDevis){
|
|
?>
|
|
<div class="row">
|
|
<div class="col col-md">
|
|
<div class="col col-xl text-center">
|
|
<span>Date de soin : <b><?php echo (new DateTime($order->order_date))->format('d-m-Y');?></b>,</span> <span>Défunt associé : <b><?php echo $order->defunt_nom;?></b></span><br/>
|
|
<span>Lieu : <b><?php echo $order->lieu_nom;?> (<?php echo $order->lieu_adresse;?>)</b>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<hr/>
|
|
<div class="row">
|
|
<div class="col col-md">
|
|
<label class="fw-bold">Commentaires :</label>
|
|
<div class="col col-xl mb-3 text-center editable"
|
|
style="display:inline"
|
|
data-table="orders" data-column="order_comment"
|
|
data-id="<?php echo $order->id;?>">
|
|
<?php echo $orderComment; ?>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<div><h2>Articles</h2></div>
|
|
<?php if($isOrderPurchase){?>
|
|
<button id="addOrderItems" type="button" class="mb-2 btn btn-outline-success">Ajouter un article</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<hr>
|
|
<div class="table-responsive">
|
|
<?php
|
|
$tableProductId = $isOrderDevis ?
|
|
"produits" :
|
|
"orderItems";
|
|
?>
|
|
<table id="<?php echo $tableProductId ?>" class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php p($l->t('Reference'));?></th>
|
|
<th><?php p($l->t('Designation'));?></th>
|
|
<th><?php p($l->t('Quantity'));?></th>
|
|
<th><?php p($l->t('Unit price without VAT'));?></th>
|
|
<th><?php p($l->t('Total without VAT'));?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<hr>
|
|
<div>
|
|
<button id="exportOrderToPdf" type="button" class="mb-2 btn btn-outline-success"><?php p($l->t('Save in Nextcloud'));?></button>
|
|
</div>
|
|
<div class="mt-0 table-responsive">
|
|
<?php
|
|
$tableTotalProductAmountId = $isOrderDevis?
|
|
"totaldevis" :
|
|
"totalOrderItems";
|
|
?>
|
|
<table id="<?php echo $tableTotalProductAmountId ?>" class="table table-striped table-xl">
|
|
<thead class="bg-dark text-white">
|
|
<tr>
|
|
<th class="text-center"><?php p($l->t('Total without VAT'));?></th>
|
|
<th class="text-center"><?php p($l->t('VAT Rate'));?></th>
|
|
<th class="text-center"><?php p($l->t('Total VAT'));?></th>
|
|
<th class="text-center"><?php p($l->t('Total Price'));?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="col m-0 pb-0 alert alert-info text-center">
|
|
<p><span id="mentions_default"><?php p($l->t('Please set in global configuration'));?></span></p>
|
|
</div>
|
|
<hr />
|
|
<div class="col m-0 pb-0 alert alert-info text-center">
|
|
<p><?php echo $configuration->entreprise; ?><br /><?php echo $configuration->adresse; ?><br /><?php echo $configuration->legal_one; ?><br/><?php echo $configuration->legal_two; ?></p>
|
|
</div>
|
|
</div>
|