finish send pdf from frontend, wip save pdf state

This commit is contained in:
Tiavina 2025-03-07 17:10:49 +03:00
parent 565ee75b56
commit 4f3707adaa
4 changed files with 29 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -547,18 +547,22 @@ class Bdd {
}
public function getOneFacture($numfacture, $idNextcloud){
// $sql = "SELECT ".$this->tableprefix."facture.id," . $this->tableprefix . "facture.version," . $this->tableprefix . "facture.num, ".$this->tableprefix."facture.date, ".$this->tableprefix."devis.num as dnum, comment, date_paiement, type_paiement, id_devis, nom, prenom, entreprise FROM (".$this->tableprefix."facture LEFT JOIN ".$this->tableprefix."devis on ".$this->tableprefix."facture.id_devis = ".$this->tableprefix."devis.id AND ".$this->tableprefix."facture.id_nextcloud = ".$this->tableprefix."devis.id_nextcloud) LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id AND ".$this->tableprefix."devis.id_nextcloud = ".$this->tableprefix."client.id_nextcloud WHERE ".$this->tableprefix."facture.id = ? AND ".$this->tableprefix."facture.id_nextcloud = ?";
$sql = "SELECT ".$this->tableprefix."facture.id," . $this->tableprefix . "facture.version," . $this->tableprefix . "facture.num, "
.$this->tableprefix."facture.date, ".$this->tableprefix."devis.num as dnum, comment, date_paiement, type_paiement, id_devis, ".$this->tableprefix."client.nom, prenom, entreprise,"
.$this->tableprefix."devis.comment as dcomment,".$this->tableprefix."lieu.nom as lieu, ".$this->tableprefix."lieu.adresse as adresse_soin,"
.$this->tableprefix."defunt.nom as nom_defunt, "
.$this->tableprefix."devis.order_number as order_number, "
.$this->tableprefix."devis.case_number as case_number, "
.$this->tableprefix."client.id as client_id, "
.$this->tableprefix."client.mail as client_mail, "
.$this->tableprefix."client_group_facturation.id as group_client_id, "
.$this->tableprefix."client_group_facturation.email as group_client_mail, "
.$this->tableprefix."facture_payment_type.facture_payment_type_label as facture_payment_type_label
FROM (".$this->tableprefix."facture
LEFT JOIN ".$this->tableprefix."devis on ".$this->tableprefix."facture.id_devis = ".$this->tableprefix."devis.id
LEFT JOIN ".$this->tableprefix."lieu on ".$this->tableprefix."devis.id_lieu = ".$this->tableprefix."lieu.id)
LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id
LEFT JOIN ".$this->tableprefix."client_group_facturation on ".$this->tableprefix."client.fk_client_group_facturation_id = ".$this->tableprefix."client_group_facturation.id
LEFT JOIN ".$this->tableprefix."defunt on ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
LEFT JOIN ".$this->tableprefix."facture_payment_type on ".$this->tableprefix."facture.fk_facture_payment_type_id = ".$this->tableprefix."facture_payment_type.id
WHERE ".$this->tableprefix."facture.id = ?";

View File

@ -5,6 +5,7 @@ import "../css/mycss.css";
import { getArticlesById, getMailServerFrom, getProduitsById, saveNextcloud, savePdfToNextcloud} from "./modules/ajaxRequest.mjs";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener";
import "./listener/factureSendMailListener";
import { Client } from "./objects/client.mjs";
import { capture, captureDevisFacture, sendMail } from "./pdf";

View File

@ -1,3 +1,7 @@
<?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 #'));?>
@ -123,7 +127,10 @@
<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="mailGestion" type="button" class="mb-2 btn btn-outline-success sendmail" data-html2canvas-ignore data-name=""><?php p($l->t('Send by email'));?></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">
@ -149,5 +156,19 @@
<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 à <?= $clientMail; ?></h5>
</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>