Compare commits
9 Commits
production
...
production
| Author | SHA1 | Date | |
|---|---|---|---|
| 796bea7d41 | |||
| ece8666881 | |||
| 9a1c8bca86 | |||
|
|
d10dce3880 | ||
|
|
63ff1428d8 | ||
|
|
1983f506c8 | ||
|
|
458ad6588a | ||
|
|
7dd75e4076 | ||
|
|
5a880677c4 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,6 +5,10 @@
|
||||
!.gitignore
|
||||
!Jenkinsfile
|
||||
|
||||
# Dossiers à inclure
|
||||
!calendar/
|
||||
!gestion/
|
||||
|
||||
# Inclure tout le contenu de ces dossiers
|
||||
!calendar/**
|
||||
!gestion/**
|
||||
|
||||
@ -13,7 +13,4 @@ abstract class BddConstant
|
||||
const ISLEAVEPROPERTYONVCALENDAR = "ISLEAVE";
|
||||
|
||||
const DEFAULT_THANATOS_GROUP_NAME = "Thanatos";
|
||||
|
||||
const DEFAULT_ATTESTATION_CC_EMAIL = "attestation@h-f-c.info";
|
||||
const DEFAULT_INVOICE_CC_EMAIL = "attestation@h-f-c.info";
|
||||
}
|
||||
@ -116,8 +116,10 @@ class InvoiceController extends Controller
|
||||
"<p> Vous trouverez en pièce jointe la facture des soins de " . $factureDate . ".</p>".
|
||||
$signature
|
||||
);
|
||||
$appAdminEmail = BddConstant::DEFAULT_INVOICE_CC_EMAIL;
|
||||
$message->setCc([$appAdminEmail]);
|
||||
$appAdminEmail = $this->gestionRepository->getUserEmailByNextcloudId(BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
|
||||
if ($appAdminEmail) {
|
||||
$message->setCc([$appAdminEmail]);
|
||||
}
|
||||
|
||||
$this->mailer->send($message);
|
||||
$this->gestionRepository->setFactureSentDate($factureId);
|
||||
|
||||
@ -1844,48 +1844,51 @@ class PageController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $to,$subject, $body, $addName = false){
|
||||
$devis = $this->myDb->getDevisOfDefunt($defuntId);
|
||||
if($devis != null){
|
||||
// try {
|
||||
$senderEmailAddress = $this->config->getSystemValue('mail_from_address') ?? null;
|
||||
$senderEmailDomain = $this->config->getSystemValue('mail_domain') ?? null;
|
||||
$senderEmail = null;
|
||||
if($senderEmailAddress && $senderEmailDomain){
|
||||
$senderEmail = $senderEmailAddress.'@'.$senderEmailDomain;
|
||||
}
|
||||
$client_email = $to;
|
||||
$client_nom = $devis['client_nom'];
|
||||
$data = $this->storage->get($ff_pdf)->getContent();
|
||||
$message = $this->mailer->createMessage();
|
||||
$message->setTo(recipients: [$client_email => $client_nom]);
|
||||
// $message->setFrom([$client_email => $client_nom]);
|
||||
$content = $this->mailer->createAttachment($data, basename($ff_pdf), "application/pdf");
|
||||
$message->attach($content);
|
||||
$message->setSubject($subject);
|
||||
$body_text = $addName ? ($body." de ".$devis['defunt_nom'] ) : $body;
|
||||
$cautionText = "MERCI DE NE PAS REPONDRE A CET EMAIL.";
|
||||
$signature = $this->mailerService->getFooterContent($this->getUserNameForEmailSignature());
|
||||
$message->setHtmlBody(
|
||||
"<p>Bonjour.</p>".
|
||||
"<p>$body_text</p>".
|
||||
"<p>$cautionText</p>"
|
||||
);
|
||||
|
||||
$appAdminEmail = BddConstant::DEFAULT_ATTESTATION_CC_EMAIL;
|
||||
$message->setCc([$appAdminEmail]);
|
||||
$this->mailer->send($message);
|
||||
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
|
||||
// } catch (Exception $e) {
|
||||
// return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
|
||||
// }
|
||||
}
|
||||
}
|
||||
public function getUserNameForEmailSignature (){
|
||||
$configs = json_decode($this->myDb->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||
$currentConfig = $configs[0];
|
||||
return $currentConfig->nom . " " . $currentConfig->prenom;
|
||||
}
|
||||
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $to, $subject, $body, $addName = false)
|
||||
{
|
||||
$devis = $this->myDb->getDevisOfDefunt($defuntId);
|
||||
if($devis != null) {
|
||||
// try {
|
||||
$senderEmailAddress = $this->config->getSystemValue('mail_from_address') ?? null;
|
||||
$senderEmailDomain = $this->config->getSystemValue('mail_domain') ?? null;
|
||||
$senderEmail = null;
|
||||
if($senderEmailAddress && $senderEmailDomain) {
|
||||
$senderEmail = $senderEmailAddress.'@'.$senderEmailDomain;
|
||||
}
|
||||
$client_email = $to;
|
||||
$client_nom = $devis['client_nom'];
|
||||
$data = $this->storage->get($ff_pdf)->getContent();
|
||||
$message = $this->mailer->createMessage();
|
||||
$message->setTo(recipients: [$client_email => $client_nom]);
|
||||
// $message->setFrom([$client_email => $client_nom]);
|
||||
$content = $this->mailer->createAttachment($data, basename($ff_pdf), "application/pdf");
|
||||
$message->attach($content);
|
||||
$message->setSubject($subject);
|
||||
$body_text = $addName ? ($body." de ".$devis['defunt_nom']) : $body;
|
||||
$signature = $this->mailerService->getFooterContent($this->getUserNameForEmailSignature());
|
||||
$message->setHtmlBody(
|
||||
"<p>Bonjour.</p>".
|
||||
"<p>$body_text</p>".
|
||||
$signature
|
||||
);
|
||||
|
||||
$appAdminEmail = $this->myDb->getUserEmailByNextcloudId(BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
|
||||
if ($appAdminEmail) {
|
||||
$message->setCc([$appAdminEmail]);
|
||||
}
|
||||
$this->mailer->send($message);
|
||||
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
|
||||
// } catch (Exception $e) {
|
||||
// return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
|
||||
// }
|
||||
}
|
||||
}
|
||||
public function getUserNameForEmailSignature()
|
||||
{
|
||||
$configs = json_decode($this->myDb->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||
$currentConfig = $configs[0];
|
||||
return $currentConfig->nom . " " . $currentConfig->prenom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
|
||||
@ -4723,11 +4723,11 @@ COMMENTAIRES: ".$comment;
|
||||
FROM ".self::DEFAULT_TABLE_PREFIX."users as users
|
||||
JOIN .".self::DEFAULT_TABLE_PREFIX."group_user group_user ON users.uid = group_user.uid
|
||||
LEFT JOIN ".$this->tableprefix."thanato as thanato on users.uid = thanato.fk_user_uuid
|
||||
WHERE LOWER(group_user.gid) = ? AND
|
||||
WHERE group_user.gid = ? AND
|
||||
thanato.fk_user_uuid IS NULL;
|
||||
";
|
||||
|
||||
return $this->execSQL($sql,[strtolower(BddConstant::DEFAULT_THANATOS_GROUP_NAME)]);
|
||||
return $this->execSQL($sql, [BddConstant::DEFAULT_THANATOS_GROUP_NAME]);
|
||||
}
|
||||
|
||||
public function doDevisIdsListIdsBelongsToTheSameClientFacturationGroup(array $devisIds)
|
||||
@ -5318,7 +5318,7 @@ COMMENTAIRES: ".$comment;
|
||||
$configuration = $this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
|
||||
$configuration = json_decode($configuration);
|
||||
$currentConfig = $configuration[0];
|
||||
|
||||
$tvaValue = $currentConfig->tva_default;
|
||||
$isFactureSingleClient = $facture['fk_client_id'] != null
|
||||
&& $facture['fk_client_id'] != 0;
|
||||
|
||||
@ -5329,21 +5329,6 @@ COMMENTAIRES: ".$comment;
|
||||
$devis = $this->getDevisByFkFactureId($factureId);
|
||||
$factureGroupIsRelatedToAnyDevis = $devis != null;
|
||||
|
||||
// LOGIQUE TVA SIMPLIFIÉE
|
||||
$tvaValue = (float)$currentConfig->tva_default;
|
||||
$isTvaApplicable = true;
|
||||
|
||||
// Récupérer le statut TVA du client de cette facture
|
||||
$clientId = $facture['fk_client_id'];
|
||||
if ($clientId != null && $clientId != 0) {
|
||||
$client = $this->getClientById($clientId);
|
||||
|
||||
$client = $this->getClientById($clientId);
|
||||
if (isset($client['tva']) && $client['tva'] == 0) {
|
||||
$isTvaApplicable = false;
|
||||
$tvaValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($isFactureSingleClient) {
|
||||
$client = $this->getClientById($facture['fk_client_id']);
|
||||
@ -5352,7 +5337,6 @@ COMMENTAIRES: ".$comment;
|
||||
$facture['client_address'] = $client["client_address"];
|
||||
$facture['siret'] = $client["client_legal_one"];
|
||||
$facture['mail'] = $client["client_mail"];
|
||||
|
||||
if (!$factureGroupIsRelatedToAnyDevis) {
|
||||
$devisList = $this->getDevisDataByClientIdAndMonthYear(
|
||||
$facture['fk_client_id'],
|
||||
@ -5360,6 +5344,7 @@ COMMENTAIRES: ".$comment;
|
||||
$facture['year'],
|
||||
$devisMentionFilters
|
||||
);
|
||||
|
||||
} else {
|
||||
$devisList = $this->getDevisDataGroupByFactureId($factureId, $devisMentionFilters);
|
||||
}
|
||||
@ -5370,7 +5355,6 @@ COMMENTAIRES: ".$comment;
|
||||
$facture['client_address'] = $clientGroupFacturation["address"] . ' - ' .$clientGroupFacturation["postal_code"] . ' ' . $clientGroupFacturation['city'];
|
||||
$facture['siret'] = $clientGroupFacturation["siret_number"];
|
||||
$facture['mail'] = $clientGroupFacturation["email"];
|
||||
|
||||
if (!$factureGroupIsRelatedToAnyDevis) {
|
||||
$devisList = $this->getDevisDataByClientGroupFacturationIdAndMonthYear(
|
||||
$facture['fk_client_group_facturation_id'],
|
||||
@ -5382,36 +5366,22 @@ COMMENTAIRES: ".$comment;
|
||||
$devisList = $this->getDevisDataGroupByFactureId($factureId, $devisMentionFilters);
|
||||
}
|
||||
}
|
||||
|
||||
$factureTotalHt = 0;
|
||||
$factureTotalTva = 0;
|
||||
$factureTotalTtc = 0;
|
||||
|
||||
foreach($devisList as &$currentDevis) {
|
||||
$totalHt = 0;
|
||||
$totalTva = 0;
|
||||
$totalTtc = 0;
|
||||
$devisProducts = $this->getDevisProduits($currentDevis['devis_id']);
|
||||
|
||||
foreach($devisProducts as $currentProduct) {
|
||||
$valueHt = $currentProduct['produit_price'] * $currentProduct['quantite'];
|
||||
|
||||
// CALCUL SIMPLE : TVA OU PAS TVA
|
||||
if ($isTvaApplicable) {
|
||||
// Client soumis à TVA : utiliser le taux par défaut
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue);
|
||||
$tvaAmount = $valueTtc - $valueHt;
|
||||
} else {
|
||||
// Client exonéré : TTC = HT
|
||||
$valueTtc = $valueHt;
|
||||
$tvaAmount = 0;
|
||||
}
|
||||
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue);
|
||||
$totalHt += $valueHt;
|
||||
$totalTtc += $valueTtc;
|
||||
$tvaAmount = $valueTtc - $valueHt;
|
||||
$totalTva += $tvaAmount;
|
||||
}
|
||||
|
||||
$currentDevis["totalHt"] = $totalHt;
|
||||
$currentDevis["totalTtc"] = $totalTtc;
|
||||
$currentDevis["totalTva"] = $totalTva;
|
||||
@ -5420,19 +5390,10 @@ COMMENTAIRES: ".$comment;
|
||||
$factureTotalTva += $totalTva;
|
||||
$facture["devisList"][] = $currentDevis;
|
||||
}
|
||||
|
||||
$facture["totalHt"] = $factureTotalHt;
|
||||
$facture["totalTtc"] = $factureTotalTtc;
|
||||
$facture["totalTva"] = $factureTotalTva;
|
||||
$facture["isFactureClientGroup"] = !$isFactureSingleClient;
|
||||
|
||||
// INFOS TVA POUR LE TEMPLATE
|
||||
$facture["tvaInfo"] = [
|
||||
'is_applicable' => $isTvaApplicable,
|
||||
'rate' => $tvaValue,
|
||||
'is_exempt' => !$isTvaApplicable
|
||||
];
|
||||
|
||||
return $facture;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ declare(strict_types=1);
|
||||
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
|
||||
|
||||
use DateTime;
|
||||
use FPDF;
|
||||
use \FPDF;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
@ -54,11 +54,11 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
public $additionalArticlesLineBasedOnMultiline = 0;
|
||||
public $interLigneHeader = 5;
|
||||
|
||||
public function Header()
|
||||
function Header()
|
||||
{
|
||||
if ($this->logo != "nothing") {
|
||||
$this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
|
||||
//$this->AddWatermark();
|
||||
$this->AddWatermark();
|
||||
} else {
|
||||
$this->Cell(55, 30, '');
|
||||
}
|
||||
@ -66,32 +66,32 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$this->DrawInvoiceCompanyAndClientInfo();
|
||||
$this->DrawInvoiceInfoTable();
|
||||
}
|
||||
public function AddWatermark()
|
||||
function AddWatermark()
|
||||
{
|
||||
$this->SetAlpha(0.2);
|
||||
|
||||
$imagePath = $this->logoPath . "filigrane_pdf.png";
|
||||
list($originalWidth, $originalHeight) = getimagesize($imagePath);
|
||||
|
||||
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
|
||||
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
|
||||
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
|
||||
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
|
||||
$originalWidth = $originalWidth * 0.264583;
|
||||
$originalHeight = $originalHeight * 0.264583;
|
||||
|
||||
// Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine
|
||||
// Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine
|
||||
$scale = 1.7;
|
||||
$width = $originalWidth * $scale;
|
||||
$height = $originalHeight * $scale;
|
||||
// Calculer la position pour centrer l'image
|
||||
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
|
||||
$y = ((297 - $height) / 2) + 21; // 297 mm est la hauteur d'une page A4
|
||||
// Calculer la position pour centrer l'image
|
||||
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
|
||||
$y = ((297 - $height) / 2) + 21; // 297 mm est la hauteur d'une page A4
|
||||
|
||||
// Ajouter l'image en filigrane
|
||||
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
|
||||
$this->SetAlpha(0.1); // Définir l'opacité
|
||||
// Ajouter l'image en filigrane
|
||||
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
|
||||
$this->SetAlpha(0.1); // Définir l'opacité
|
||||
}
|
||||
|
||||
public function SetAlpha($alpha)
|
||||
function SetAlpha($alpha)
|
||||
{
|
||||
// Appliquer la transparence au document
|
||||
$this->SetFillColor(255, 255, 255, $alpha * 255);
|
||||
@ -106,7 +106,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
|
||||
}
|
||||
|
||||
public function Footer()
|
||||
function Footer()
|
||||
{
|
||||
$this->SetY(-34);
|
||||
$this->SetFont('ComicSans', '', 7);
|
||||
@ -325,7 +325,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
|
||||
public function DrawArticlesTableValue()
|
||||
{
|
||||
// Set espacement avant de continue
|
||||
// Set espacement avant de continue
|
||||
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$devisData = $this->factureData['devis'];
|
||||
@ -335,7 +335,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$totalTva = 0;
|
||||
$yValue = $this->startingYOfArticlesTable + 13;
|
||||
// $maxDescriptionWidth = 102;
|
||||
$maxDescriptionWidth = 104.3;
|
||||
$maxDescriptionWidth = 104.3;
|
||||
$currentIndexPosition = $this->currentIndexPosition;
|
||||
for ($currentIndexPosition; $currentIndexPosition < ($this->initialIndexPosition + $this->devisCountToGet); $currentIndexPosition++) {
|
||||
$currentDevis = $devisData[$currentIndexPosition];
|
||||
@ -449,7 +449,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$this->DrawBankAndTotalPriceInfo();
|
||||
}
|
||||
|
||||
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
{
|
||||
// Store reset values for (x,y) positions
|
||||
$x = $this->GetX() + $w;
|
||||
@ -464,22 +464,19 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
}
|
||||
}
|
||||
|
||||
public function NbLines($w, $txt)
|
||||
function NbLines($w, $txt)
|
||||
{
|
||||
// Compute the number of lines a MultiCell of width w will take
|
||||
if (!isset($this->CurrentFont)) {
|
||||
if (!isset($this->CurrentFont))
|
||||
$this->Error('No font has been set');
|
||||
}
|
||||
$cw = $this->CurrentFont['cw'];
|
||||
if ($w == 0) {
|
||||
if ($w == 0)
|
||||
$w = $this->w - $this->rMargin - $this->x;
|
||||
}
|
||||
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||
$s = str_replace("\r", '', (string) $txt);
|
||||
$nb = strlen($s);
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n") {
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n")
|
||||
$nb--;
|
||||
}
|
||||
$sep = -1;
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
@ -495,25 +492,21 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$nl++;
|
||||
continue;
|
||||
}
|
||||
if ($c == ' ') {
|
||||
if ($c == ' ')
|
||||
$sep = $i;
|
||||
}
|
||||
$l += $cw[$c];
|
||||
if ($l > $wmax) {
|
||||
if ($sep == -1) {
|
||||
if ($i == $j) {
|
||||
if ($i == $j)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
$i = $sep + 1;
|
||||
}
|
||||
$sep = -1;
|
||||
$j = $i;
|
||||
$l = 0;
|
||||
$nl++;
|
||||
} else {
|
||||
} else
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $nl;
|
||||
}
|
||||
@ -523,42 +516,38 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
{
|
||||
$k = $this->k;
|
||||
$hp = $this->h;
|
||||
if ($style == 'F') {
|
||||
if ($style == 'F')
|
||||
$op = 'f';
|
||||
} elseif ($style == 'FD' || $style == 'DF') {
|
||||
elseif ($style == 'FD' || $style == 'DF')
|
||||
$op = 'B';
|
||||
} else {
|
||||
else
|
||||
$op = 'S';
|
||||
}
|
||||
$MyArc = 4 / 3 * (sqrt(2) - 1);
|
||||
$this->_out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
|
||||
|
||||
$xc = $x + $w - $r;
|
||||
$yc = $y + $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
|
||||
if (strpos($corners, '2') === false) {
|
||||
if (strpos($corners, '2') === false)
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
|
||||
} else {
|
||||
else
|
||||
$this->_Arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
|
||||
}
|
||||
|
||||
$xc = $x + $w - $r;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
|
||||
if (strpos($corners, '3') === false) {
|
||||
if (strpos($corners, '3') === false)
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
|
||||
} else {
|
||||
else
|
||||
$this->_Arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
|
||||
}
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
|
||||
if (strpos($corners, '4') === false) {
|
||||
if (strpos($corners, '4') === false)
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
|
||||
} else {
|
||||
else
|
||||
$this->_Arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
|
||||
}
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $r;
|
||||
@ -566,9 +555,8 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
if (strpos($corners, '1') === false) {
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
|
||||
} else {
|
||||
} else
|
||||
$this->_Arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
|
||||
}
|
||||
$this->_out($op);
|
||||
}
|
||||
|
||||
|
||||
@ -2,17 +2,16 @@
|
||||
|
||||
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;
|
||||
$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 class="mt-3 mb-3 text-center"> <?php echo ('Facture n° '.$facture->num); ?>
|
||||
</h2>
|
||||
<hr />
|
||||
<div class="row">
|
||||
@ -35,7 +34,7 @@ $currentConfig = json_decode($_['configuration'])[0];
|
||||
} 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')); ?>
|
||||
@ -43,7 +42,7 @@ $currentConfig = json_decode($_['configuration'])[0];
|
||||
<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) {
|
||||
<?php if($isFactureClientGroup == false){
|
||||
?>
|
||||
<span><?php echo $facture->client_name; ?></span><br />
|
||||
<?php }?>
|
||||
@ -89,8 +88,8 @@ $currentConfig = json_decode($_['configuration'])[0];
|
||||
<tbody>
|
||||
<?php
|
||||
$devisList = $facture->devisList;
|
||||
foreach ($devisList as $currentDevis) {
|
||||
?>
|
||||
foreach ($devisList as $currentDevis) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $currentDevis->devis_full_number; ?></td>
|
||||
<td><?php echo $currentDevis->defunt_nom; ?></td>
|
||||
@ -114,43 +113,26 @@ foreach ($devisList as $currentDevis) {
|
||||
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
|
||||
// Affichage simple : Exonéré ou taux par défaut
|
||||
if (isset($facture->tvaInfo) && $facture->tvaInfo->is_exempt) {
|
||||
echo 'Exonéré';
|
||||
} else {
|
||||
echo PriceHelpers::formatDecimalPrice($facture->tvaInfo->rate).'%';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?php
|
||||
if (isset($facture->tvaInfo) && $facture->tvaInfo->is_exempt) {
|
||||
echo '0,00€';
|
||||
} else {
|
||||
echo PriceHelpers::formatDecimalPrice($facture->totalTva).'€';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center"><?php echo PriceHelpers::formatDecimalPrice($facture->totalTtc).'€'; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user