THANASOFT-HFC/gestion/templates/content/factureGroupDetails.php
2025-03-11 17:51:33 +03:00

169 lines
8.5 KiB
PHP

<?php
use OC\URLGenerator;
use OCA\Gestion\Helpers\PriceHelpers;
$facture = $_['facture'];
$factureOrderNumber = $facture->facture_order_number == '' ? '-' : $facture->facture_order_number;
$factureCaseNumber = $facture->facture_case_number == '' ? '-' : $facture->facture_case_number;
$isFactureClientGroup = $facture->isFactureClientGroup;
$currentConfig = json_decode($_['configuration'])[0];
?>
<div class="bootstrap-iso">
<div id="factureId" data-id="<?php echo $facture->id; ?>"></div>
<div id="factureIdentifier" data-id="<?php echo $facture->id; ?>"></div>
<h2 class="mt-3 mb-3 text-center"> <?php echo ('Facture n° '.$facture->num); ?>
</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 $currentConfig->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 $currentConfig->prenom . " " . $currentConfig->nom; ?><br />
<?php echo $currentConfig->adresse; ?><br />
<?php echo $currentConfig->mail; ?><br />
<?php echo $currentConfig->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 $facture->group_name; ?></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 $facture->group_name; ?></span><br />
<?php if($isFactureClientGroup == false){
?>
<span><?php echo $facture->client_name; ?></span><br />
<?php }?>
<span><?php echo $facture->client_address; ?></span><br />
<span><?php echo $facture->mail; ?></span><br />
<span><?php echo $facture->siret; ?></span><br />
</p>
</div>
</div>
<hr />
<div class="row">
<div class="col col-md">
<label class="fw-bold">Commande :</label>
<div class="col col-xl mb-3 text-center editable" style="display:inline" data-table="facture"
data-column="facture_order_number" data-id="<?php echo $facture->id; ?>">
<?php echo $factureOrderNumber; ?>
</div>
</div>
<hr />
</div>
<div class="row">
<div class="col col-md">
<label class="fw-bold">Numéro de dossier :</label>
<div class="col col-xl mb-3 text-center editable" style="display:inline" data-table="facture"
data-column="facture_case_number" data-id="<?php echo $facture->id; ?>">
<?php echo $factureCaseNumber; ?>
</div>
</div>
<hr />
</div>
<div class="table-responsive">
<table id="factureGroupId" class="table table-striped">
<thead>
<tr>
<th><?php p($l->t('Devis')); ?></th>
<th><?php p($l->t('Defunt')); ?></th>
<th><?php p($l->t('Agence')); ?></th>
<th><?php p($l->t('Prix HT')); ?></th>
<th><?php p($l->t('Prix TTC')); ?></th>
<th><?php p($l->t('Actions')); ?></th>
</tr>
</thead>
<tbody>
<?php
$devisList = $facture->devisList;
foreach ($devisList as $currentDevis) {
?>
<tr>
<td><?php echo $currentDevis->devis_full_number; ?></td>
<td><?php echo $currentDevis->defunt_nom; ?></td>
<td><?php echo $currentDevis->client_nom; ?></td>
<td><?php echo PriceHelpers::formatDecimalPrice($currentDevis->totalHt).'€'; ?></td>
<td><?php echo PriceHelpers::formatDecimalPrice($currentDevis->totalTtc).'€'; ?></td>
<td>
<div style="display:inline-block;margin-right:0px;width:80%;">
<button class="goToDevisDetails" data-devis-id="<?php echo $currentDevis->devis_id; ?>">Ouvrir</button>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div>
<button id="exportFactureToPdf" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore data-name=""><?php p($l->t('Save in Nextcloud'));?></button>
<button id="showSendFacturePdfMailModal"
type="button"
class="mb-2 btn btn-outline-success sendmail"
><?php p($l->t('Send by email'));?></button>
</div>
<div class="mt-0 table-responsive">
<table id="totalFactureGroupPrice" 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>
<tr>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalHt).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($currentConfig->tva_default).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTva).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTtc).'€'); ?></td>
</tr>
</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 $currentConfig->entreprise; ?><br /><?php echo $currentConfig->adresse; ?><br /><?php echo $currentConfig->legal_one; ?><br /><?php echo $currentConfig->legal_two; ?>
</p>
</div>
<div class="modal" id="sendFacturePdfMail" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Envoyer la facture par email ?</h5>
</div>
<div class="form-group px-4">
<input
type="text"
class="form-control"
id="valueFacturePdfMail"
value="<?= $facture->mail; ?>"
data-init-value="<?= $facture->mail; ?>"
placeholder="Adresse email"
/>
</div>
<div class="modal-footer">
<button id="showPdfPreview" type="button" class="btn btn-secondary">Voir l'aperçu</button>
<button id="closeSendFacturePdfMail" type="button" class="btn btn-secondary">Annuler</button>
<button id="sendFacturePdf" type="button" class="btn btn-primary">Envoyer</button>
</div>
</div>
</div>
</div>
</div>