2025-03-11 16:27:15 +03:00

185 lines
9.8 KiB
PHP

<?php
$facture = $_['facture'][0];
$clientMail = $facture->client_id != null ? $facture->client_mail : $facture->group_client_mail;
?>
<div class="bootstrap-iso d-flex flex-column justify-content-between">
<div class="d-flex flex-column w-100">
<h2 class="mt-3 mb-3 text-center"><?php p($l->t('Invoice #'));?>
<div id="factureid" style="display:inline"><?php echo $_['facture'][0]->num;?></div>
<div id="factureIdentifier" data-id="<?php echo $_['facture'][0]->id;?>" class="d-none"></div>
</h2>
<hr/>
<div class="row">
<div class="col-5 h-100 m-0" style="min-height:250px;">
<?php $res = json_decode($_['configuration'])[0]; ?>
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('FROM'));?> <?php echo $res->entreprise; ?></h5>
<p class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark">
<?php echo $res->prenom . " " . $res->nom; ?><br />
<?php echo $res->adresse; ?><br />
<?php echo $res->mail; ?><br />
<?php echo $res->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 id="entreprise"></span></h6>
<p class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark">
<span id="nomprenom" data-id="0" data-table="devis" data-column="id_client"></span><br />
<span id="adresse"></span><br />
<span id="mail"></span><br />
<span id="telephone"></span><br />
<span id="legal_one"></span><br />
<span id="dateContext" class="d-none"></span>
<span id="nomcli" class="d-none"></span>
<span id="idcli" class="d-none"></span>
<span id="etp" class="d-none"></span>
<span id="lieusoin" class="d-none"><?php echo $_['devis'][0]->lieu; ?></span>
<span id="nomdefunt" class="d-none"><?php echo $_['facture'][0]->nom_defunt;?></span>
</p>
</div>
</div>
<div class="row">
<div class="col col-md">
<hr/>
<div class="col col-xl mb-3 text-center">
<span>Date de facture : <b><?php echo (new DateTime($_['facture'][0]->date_paiement))->format('d-m-Y');?></b>, </span><span><?php p($l->t('Date of service'));?> : <b><?php echo (new DateTime($_['facture'][0]->date))->format('d-m-Y');?></b></span><br/>
<span id="devisid" data-id=<?php echo $_['facture'][0]->id_devis;?>>Defunt associé : <b><?php echo $_['facture'][0]->nom_defunt;?></b>, </span><span><?php p($l->t('Means of payment'));?> : <b><?php echo $_['facture'][0]->facture_payment_type_label ?? "Aucun";?></b></span><br/>
<span>Lieu : <b><?php echo $_['facture'][0]->lieu;?> (<?php echo $_['facture'][0]->adresse_soin;?>)</b>
</div>
<hr/>
</div>
</div>
<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="devis" data-column="order_number"
data-id="<?php echo $_['facture'][0]->id_devis;?>">
<?php echo ($_['facture'][0]->order_number == "" ) ? "-" : $_['facture'][0]->order_number ; ?>
</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="devis" data-column="case_number"
data-id="<?php echo $_['facture'][0]->id_devis;?>">
<?php echo ($_['facture'][0]->case_number == "" ) ? "-" : $_['facture'][0]->case_number ; ?>
</div>
</div>
<hr />
</div>
<div class="d-flex justify-content-between align-items-center">
<div><h2>Articles</h2></div>
<button id="devisAdd" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore>Ajouter article</button>
</div>
<hr>
<div class="table-responsive">
<table id="produits" 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('Comment'));?></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>
<div class="d-flex justify-content-between align-items-center">
<div><h2>Produits</h2></div>
<button id="devisAddProduit" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore>Ajouter produit</button>
</div>
<hr>
<div class="table-responsive">
<table id="articles" 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('Comment'));?></th>
<th><?php p($l->t('Quantity'));?>(ml)</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="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="totaldevis" 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>
<div class="d-flex flex-column w-100">
<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 $res->entreprise; ?><br /><?php echo $res->adresse; ?><br /><?php echo $res->legal_one; ?><br/><?php echo $res->legal_two; ?></p>
</div>
</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="<?= $clientMail; ?>"
data-init-value="<?= $clientMail; ?>"
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>