finish export group devis to facture on frontend , wip facture details
This commit is contained in:
parent
ab961fffd1
commit
839e4f62e5
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,6 +4,7 @@ import "../css/mycss.css";
|
|||||||
|
|
||||||
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
||||||
import "./listener/main_listener";
|
import "./listener/main_listener";
|
||||||
|
import "./listener/devisListener";
|
||||||
import { exportClientDevisByMonthAndYearToPdf } from "./modules/ajaxRequest.mjs";
|
import { exportClientDevisByMonthAndYearToPdf } from "./modules/ajaxRequest.mjs";
|
||||||
import 'select2/dist/css/select2.css';
|
import 'select2/dist/css/select2.css';
|
||||||
import 'select2';
|
import 'select2';
|
||||||
|
|||||||
@ -141,3 +141,59 @@ document.onchange = function(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$('body').on('click', '#showGroupDevisFacturationModal', function () {
|
||||||
|
console.log("sdsfs");
|
||||||
|
$('#groupDevisFacturationModal').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('body').on('click', '#closeGroupDevisModal', function () {
|
||||||
|
$('#groupDevisFacturationModal').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('body').on('click', '#invoiceGroupQuote', function () {
|
||||||
|
var dateValue = document.getElementById("facturationDate").value;
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const filter = urlParams.get('cli');
|
||||||
|
const year = urlParams.get('annee');
|
||||||
|
const month = urlParams.get('mois');
|
||||||
|
const filterType = urlParams.get('filterType');
|
||||||
|
var invoiceGroupQuotePayload = {
|
||||||
|
clientId : filter,
|
||||||
|
month : month,
|
||||||
|
year : year,
|
||||||
|
clientType : filterType,
|
||||||
|
facturationDate : dateValue
|
||||||
|
};
|
||||||
|
|
||||||
|
showLoader();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/devis/exportGroupOfDevisIntoFacture',
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify(invoiceGroupQuotePayload)
|
||||||
|
}).done(function (response) {
|
||||||
|
var fileNames = response;
|
||||||
|
if(fileNames != null){
|
||||||
|
let fileNamesArray = JSON.parse(fileNames);
|
||||||
|
if(fileNamesArray.length > 0){
|
||||||
|
fileNamesArray.forEach((filename) => {
|
||||||
|
showSuccess('Sauvegardé dans' + filename);
|
||||||
|
})
|
||||||
|
$('#groupDevisFacturationModal').hide();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showError(t('gestion', "Les données pour sauvegarde sont vides"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showError(t('gestion', "Les données pour sauvegarde sont vides"));
|
||||||
|
}
|
||||||
|
}).fail(function (response, code) {
|
||||||
|
showError(t('gestion', "Erreur dans la génération de facture multiple"));
|
||||||
|
}).always(function () {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@ -5,13 +5,11 @@
|
|||||||
<?php
|
<?php
|
||||||
foreach ($_['clients'] as $key => $client) {
|
foreach ($_['clients'] as $key => $client) {
|
||||||
?>
|
?>
|
||||||
<option
|
<option <?php
|
||||||
<?php
|
|
||||||
if ($_GET['cli'] == $client->id && $_GET['filterType'] == $client->client_type) {
|
if ($_GET['cli'] == $client->id && $_GET['filterType'] == $client->client_type) {
|
||||||
echo 'selected';
|
echo 'selected';
|
||||||
}
|
}
|
||||||
?>
|
?> value='<?php echo $client->id; ?>' data-type='<?php echo $client->client_type ?>'>
|
||||||
value='<?php echo $client->id; ?>'>
|
|
||||||
<?php echo strtoupper(html_entity_decode($client->nom)); ?>
|
<?php echo strtoupper(html_entity_decode($client->nom)); ?>
|
||||||
</option>
|
</option>
|
||||||
<?php
|
<?php
|
||||||
@ -19,7 +17,8 @@
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<select name="annee" id="yearselector">
|
<select name="annee" id="yearselector">
|
||||||
<option value="-1" <?php if ((int)$_GET['annee'] == -1) echo 'selected' ?>>Toutes les années</option>
|
<option value="-1" <?php if ((int) $_GET['annee'] == -1)
|
||||||
|
echo 'selected' ?>>Toutes les années</option>
|
||||||
<?php
|
<?php
|
||||||
$currentYear = date('Y');
|
$currentYear = date('Y');
|
||||||
for ($year = $currentYear; $year >= $currentYear - 10; $year--) {
|
for ($year = $currentYear; $year >= $currentYear - 10; $year--) {
|
||||||
@ -28,21 +27,35 @@
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<select name="mois" id="monthselector">
|
<select name="mois" id="monthselector">
|
||||||
<option value="0" <?php if((int) $_GET['mois'] == 0) echo 'selected' ?>>Tous les mois</option>
|
<option value="0" <?php if ((int) $_GET['mois'] == 0)
|
||||||
<option value="1" <?php if((int) $_GET['mois'] == 1) echo 'selected' ?>>Janvier</option>
|
echo 'selected' ?>>Tous les mois</option>
|
||||||
<option value="2" <?php if((int) $_GET['mois'] == 2) echo 'selected' ?>>Fevrier</option>
|
<option value="1" <?php if ((int) $_GET['mois'] == 1)
|
||||||
<option value="3" <?php if((int) $_GET['mois'] == 3) echo 'selected' ?>>Mars</option>
|
echo 'selected' ?>>Janvier</option>
|
||||||
<option value="4" <?php if((int) $_GET['mois'] == 4) echo 'selected' ?>>Avril</option>
|
<option value="2" <?php if ((int) $_GET['mois'] == 2)
|
||||||
<option value="5" <?php if((int) $_GET['mois'] == 5) echo 'selected' ?>>Mai</option>
|
echo 'selected' ?>>Fevrier</option>
|
||||||
<option value="6" <?php if((int) $_GET['mois'] == 6) echo 'selected' ?>>Juin</option>
|
<option value="3" <?php if ((int) $_GET['mois'] == 3)
|
||||||
<option value="7" <?php if((int) $_GET['mois'] == 7) echo 'selected' ?>>Juillet</option>
|
echo 'selected' ?>>Mars</option>
|
||||||
<option value="8" <?php if((int) $_GET['mois'] == 8) echo 'selected' ?>>Août</option>
|
<option value="4" <?php if ((int) $_GET['mois'] == 4)
|
||||||
<option value="9" <?php if((int) $_GET['mois'] == 9) echo 'selected' ?>>Septembre</option>
|
echo 'selected' ?>>Avril</option>
|
||||||
<option value="10" <?php if((int) $_GET['mois'] == 10) echo 'selected' ?>>Octobre</option>
|
<option value="5" <?php if ((int) $_GET['mois'] == 5)
|
||||||
<option value="11" <?php if((int) $_GET['mois'] == 11) echo 'selected' ?>>Novembre</option>
|
echo 'selected' ?>>Mai</option>
|
||||||
<option value="12" <?php if((int) $_GET['mois'] == 12) echo 'selected' ?>>Decembre</option>
|
<option value="6" <?php if ((int) $_GET['mois'] == 6)
|
||||||
|
echo 'selected' ?>>Juin</option>
|
||||||
|
<option value="7" <?php if ((int) $_GET['mois'] == 7)
|
||||||
|
echo 'selected' ?>>Juillet</option>
|
||||||
|
<option value="8" <?php if ((int) $_GET['mois'] == 8)
|
||||||
|
echo 'selected' ?>>Août</option>
|
||||||
|
<option value="9" <?php if ((int) $_GET['mois'] == 9)
|
||||||
|
echo 'selected' ?>>Septembre</option>
|
||||||
|
<option value="10" <?php if ((int) $_GET['mois'] == 10)
|
||||||
|
echo 'selected' ?>>Octobre</option>
|
||||||
|
<option value="11" <?php if ((int) $_GET['mois'] == 11)
|
||||||
|
echo 'selected' ?>>Novembre</option>
|
||||||
|
<option value="12" <?php if ((int) $_GET['mois'] == 12)
|
||||||
|
echo 'selected' ?>>Decembre</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" name="filterType" id="filterType" value="<?php echo ($_GET['filterType'] ?? 'group'); ?>">
|
<input type="hidden" name="filterType" id="filterType"
|
||||||
|
value="<?php echo ($_GET['filterType'] ?? 'group'); ?>">
|
||||||
<input type="submit" value="Filtrer" />
|
<input type="submit" value="Filtrer" />
|
||||||
</form>
|
</form>
|
||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
@ -63,15 +76,13 @@
|
|||||||
if ($clientIsNotSelected) {
|
if ($clientIsNotSelected) {
|
||||||
if ($filterType == "group") {
|
if ($filterType == "group") {
|
||||||
$checkClient = $_['clients'][0]->fk_client_group_facturation_id == $currentDevis->cid;
|
$checkClient = $_['clients'][0]->fk_client_group_facturation_id == $currentDevis->cid;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$checkClient = $_['clients'][0]->id == $currentDevis->cid;
|
$checkClient = $_['clients'][0]->id == $currentDevis->cid;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($filterType == "group") {
|
if ($filterType == "group") {
|
||||||
$checkClient = $currentDevis->fk_client_group_facturation_id == $_GET['cli'];
|
$checkClient = $currentDevis->fk_client_group_facturation_id == $_GET['cli'];
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$checkClient = $currentDevis->cid == $_GET['cli'];
|
$checkClient = $currentDevis->cid == $_GET['cli'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +94,12 @@
|
|||||||
});
|
});
|
||||||
if (strcmp($_GET['cli'], '') != 0 && sizeof($devis) > 0) {
|
if (strcmp($_GET['cli'], '') != 0 && sizeof($devis) > 0) {
|
||||||
?>
|
?>
|
||||||
<button class="btn btn-secondary" type="button" id="exportMultipleDevisToPdf"><?php p($l->t('Save in Nextcloud'));?></button>
|
<button class="btn btn-secondary" type="button"
|
||||||
|
id="exportMultipleDevisToPdf"><?php p($l->t('Save in Nextcloud')); ?></button>
|
||||||
|
<button class="btn btn-secondary" type="button" id="showGroupDevisFacturationModal" data-toggle="modal"
|
||||||
|
data-target="#groupDevisFacturationModal">
|
||||||
|
Facturer
|
||||||
|
</button>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,23 +110,30 @@
|
|||||||
<div id="gestion-canvas" class="canvas_div_pdf">
|
<div id="gestion-canvas" class="canvas_div_pdf">
|
||||||
<?php
|
<?php
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' && strcmp($_GET['cli'], '') != 0) {
|
if ($_SERVER['REQUEST_METHOD'] == 'GET' && strcmp($_GET['cli'], '') != 0) {
|
||||||
if(sizeof($devis)==0) echo "Aucun devis trouvé.";
|
if (sizeof($devis) == 0)
|
||||||
};
|
echo "Aucun devis trouvé.";
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
foreach ($devis as $key => $d) {
|
foreach ($devis as $key => $d) {
|
||||||
?>
|
?>
|
||||||
<div class="bootstrap-iso d-flex flex-column justify-content-between">
|
<div class="bootstrap-iso d-flex flex-column justify-content-between">
|
||||||
<div class="d-flex flex-column w-100">
|
<div class="d-flex flex-column w-100">
|
||||||
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Quote')); ?>
|
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Quote')); ?>
|
||||||
<div id="devisid" style="display:inline" data-table="devis" data-column="num" data-id="<?php echo $d->id; ?>">sur le defunt <?php echo $d->nom_defunt; ?></div>
|
<div id="devisid" style="display:inline" data-table="devis" data-column="num"
|
||||||
<span data-html2canvas-ignore>(</span> <div data-html2canvas-ignore id="devisversion" style="display:inline" data-table="devis" data-column="version" data-id="<?php echo $d->id; ?>"><?php echo $d->lieu; ?>)</div>
|
data-id="<?php echo $d->id; ?>">sur le defunt <?php echo $d->nom_defunt; ?></div>
|
||||||
|
<span data-html2canvas-ignore>(</span>
|
||||||
|
<div data-html2canvas-ignore id="devisversion" style="display:inline" data-table="devis"
|
||||||
|
data-column="version" data-id="<?php echo $d->id; ?>"><?php echo $d->lieu; ?>)</div>
|
||||||
</h2>
|
</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
||||||
<?php $res = json_decode($_['configuration'])[0]; ?>
|
<?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>
|
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('FROM')); ?>
|
||||||
<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->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->prenom . " " . $res->nom; ?><br />
|
||||||
<?php echo $res->adresse; ?><br />
|
<?php echo $res->adresse; ?><br />
|
||||||
<?php echo $res->mail; ?><br />
|
<?php echo $res->mail; ?><br />
|
||||||
@ -128,9 +151,12 @@
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
<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"><?php echo $d->entreprise ?></span></h6>
|
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO')); ?>
|
||||||
<p class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark">
|
<span id="entreprise"><?php echo $d->entreprise ?></span></h6>
|
||||||
<span id="nomprenom" data-id="0" data-table="devis" data-column="id_client"><?php echo $d->prenom.' '.$d->nom ?></span><br />
|
<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"><?php echo $d->prenom . ' ' . $d->nom ?></span><br />
|
||||||
<span id="adresse"><?php echo $d->adresse_cli ?></span><br />
|
<span id="adresse"><?php echo $d->adresse_cli ?></span><br />
|
||||||
<span id="mail"><?php echo $d->mail_cli ?></span><br />
|
<span id="mail"><?php echo $d->mail_cli ?></span><br />
|
||||||
<span id="telephone"><?php echo $d->telephone_cli ?></span><br />
|
<span id="telephone"><?php echo $d->telephone_cli ?></span><br />
|
||||||
@ -139,21 +165,27 @@
|
|||||||
<span id="nomcli" style="display: none"><?php echo $d->prenom . ' ' . $d->nom ?></span>
|
<span id="nomcli" style="display: none"><?php echo $d->prenom . ' ' . $d->nom ?></span>
|
||||||
<span id="idcli" style="display: none"><?php echo $d->id_cli ?></span>
|
<span id="idcli" style="display: none"><?php echo $d->id_cli ?></span>
|
||||||
<span id="etp" style="display: none"><?php echo $d->entreprise ?></span>
|
<span id="etp" style="display: none"><?php echo $d->entreprise ?></span>
|
||||||
<span class="pdf" style="display: none"><?php echo $d->entreprise."_".$d->id."_v".$d->version?></span>
|
<span class="pdf"
|
||||||
|
style="display: none"><?php echo $d->entreprise . "_" . $d->id . "_v" . $d->version ?></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md">
|
<div class="col col-md">
|
||||||
<hr />
|
<hr />
|
||||||
<div class="col col-xl mb-3 text-center"><b><span><?php p($l->t('Offer valid for 1 month from'));?> : </span><span><?php echo (new DateTime($d->date))->format('d-m-Y'); ?></span></b></div>
|
<div class="col col-xl mb-3 text-center">
|
||||||
|
<b><span><?php p($l->t('Offer valid for 1 month from')); ?> :
|
||||||
|
</span><span><?php echo (new DateTime($d->date))->format('d-m-Y'); ?></span></b></div>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md">
|
<div class="col col-md">
|
||||||
<div class="col col-xl text-center">
|
<div class="col col-xl text-center">
|
||||||
<span>Date de soin : <b><?php echo (new DateTime($d->date))->format('d-m-Y');?></b>,</span> <span id="devisid" data-id=<?php echo $d->id;?>>Defunt associé : <b><?php echo $d->num;?></b></span><br/>
|
<span>Date de soin :
|
||||||
|
<b><?php echo (new DateTime($d->date))->format('d-m-Y'); ?></b>,</span> <span
|
||||||
|
id="devisid" data-id=<?php echo $d->id; ?>>Defunt associé :
|
||||||
|
<b><?php echo $d->num; ?></b></span><br />
|
||||||
<span>Lieu : <b><?php echo $d->lieu; ?> (<?php echo $d->adresse_soin; ?>)</b>
|
<span>Lieu : <b><?php echo $d->lieu; ?> (<?php echo $d->adresse_soin; ?>)</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -161,7 +193,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md">
|
<div class="col col-md">
|
||||||
<hr />
|
<hr />
|
||||||
<div class="col col-xl mb-3 text-center editable" id="deviscomment" style="display:inline" data-table="devis" data-column="comment" data-id="<?php echo $d->id; ?>"><?php echo ($d->comment == "" ) ? "-" : $d->comment ; ?></div>
|
<div class="col col-xl mb-3 text-center editable" id="deviscomment" style="display:inline"
|
||||||
|
data-table="devis" data-column="comment" data-id="<?php echo $d->id; ?>">
|
||||||
|
<?php echo ($d->comment == "") ? "-" : $d->comment; ?></div>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -185,7 +219,8 @@
|
|||||||
<td><?php echo $produit->comment ?></td>
|
<td><?php echo $produit->comment ?></td>
|
||||||
<td><?php echo $produit->quantite ?></td>
|
<td><?php echo $produit->quantite ?></td>
|
||||||
<td>€<?php echo number_format($produit->prix_unitaire, 2) ?></td>
|
<td>€<?php echo number_format($produit->prix_unitaire, 2) ?></td>
|
||||||
<td>€<?php echo number_format($produit->prix_unitaire*$produit->quantite, 2) ?></td>
|
<td>€<?php echo number_format($produit->prix_unitaire * $produit->quantite, 2) ?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -229,7 +264,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="col m-0 pb-0 alert alert-info text-center">
|
<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>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -240,4 +276,20 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal" id="groupDevisFacturationModal" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel">Choisir la date de facturation souhaitée</h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="date" id="facturationDate">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button id="closeGroupDevisModal" type="button" class="btn btn-secondary">Annuler</button>
|
||||||
|
<button id="invoiceGroupQuote" type="button" class="btn btn-primary">Facturer</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
x
Reference in New Issue
Block a user