fix disabled devis invoice facturé
This commit is contained in:
parent
f16830c5a0
commit
eccc085124
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,11 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Constants;
|
||||
|
||||
abstract class DevisMentionConstant
|
||||
{ const FACTURED = "facturé";
|
||||
const FACTURED_FORMATTED = "facturé";
|
||||
const MENTION = "Mention";
|
||||
const NEW = "Nouveau";
|
||||
const CANCELED = "CANCELED";
|
||||
{
|
||||
public const FACTURED = "facturé";
|
||||
public const FACTURED_FORMATTED = "facturé";
|
||||
public const MENTION = "Mention";
|
||||
public const NEW = "Nouveau";
|
||||
public const CANCELED = "CANCELED";
|
||||
}
|
||||
@ -894,7 +894,7 @@ class Bdd
|
||||
public function getOneDevis($numdevis, $idNextcloud)
|
||||
{
|
||||
|
||||
$sql = "SELECT ".$this->tableprefix."devis.id as devisid, ".$this->tableprefix."devis.version, ".$this->tableprefix."devis.comment, ".$this->tableprefix."devis.date, num,"
|
||||
$sql = "SELECT ".$this->tableprefix."devis.id as devisid, ".$this->tableprefix."devis.version, ".$this->tableprefix."devis.comment, ".$this->tableprefix."devis.date, ".$this->tableprefix."devis.mentions, num,"
|
||||
.$this->tableprefix."devis.id_nextcloud as didnextcloud,".$this->tableprefix."devis.id_client, id_lieu, id_thanato,case_number,order_number,"
|
||||
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt,"
|
||||
.$this->tableprefix."client.id as clientid, ".$this->tableprefix."client.nom, "
|
||||
|
||||
@ -9,6 +9,7 @@ import { Client } from "./objects/client.mjs";
|
||||
import { capture, sendMail, captureDevisFacture } from "./pdf";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
window.isDevisFacture = $('.bootstrap-iso').data('is-facture') === 1;
|
||||
globalConfiguration();
|
||||
|
||||
const devisId = $("#devisid").data("id");
|
||||
@ -16,6 +17,12 @@ window.addEventListener("DOMContentLoaded", function () {
|
||||
getProduitsById();
|
||||
getArticlesById();
|
||||
|
||||
if (window.isDevisFacture) {
|
||||
$('#devisAdd').hide();
|
||||
$('#devisAddProduit').hide();
|
||||
$('.editable').removeClass('editable');
|
||||
}
|
||||
|
||||
var exportDevisToPdfButton = this.document.getElementById("exportDevisToPdf");
|
||||
exportDevisToPdfButton.addEventListener("click",function(){
|
||||
exportDevisToPdf(devisId);
|
||||
|
||||
@ -357,10 +357,9 @@ export function getProduitsByIdDevis(id_devis) {
|
||||
/**
|
||||
* Get a product in database using id
|
||||
*/
|
||||
export function getProduitsById() {
|
||||
export function getProduitsById() {
|
||||
var devis_id = $('#devisid').data('id');
|
||||
var myData = { numdevis: devis_id, };
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/getProduitsById',
|
||||
type: 'POST',
|
||||
@ -371,20 +370,36 @@ export function getProduitsByIdDevis(id_devis) {
|
||||
$('#produits tbody').empty();
|
||||
var total = 0;
|
||||
var deleteDisable = "";
|
||||
if ($('#produits').data("type") === "facture") {
|
||||
var isFacture = window.isDevisFacture || false;
|
||||
|
||||
if ($('#produits').data("type") === "facture" || isFacture) {
|
||||
deleteDisable = "d-none";
|
||||
}
|
||||
|
||||
$.each(JSON.parse(response), function (arrayID, myresp) {
|
||||
$('#produits tbody').append('<tr><td><div data-html2canvas-ignore data-modifier="getProduitsById" data-id="' + myresp.pdid + '" data-table="produit_devis" class="' + deleteDisable + ' deleteItem icon-delete"></div><div style="display:inline;" data-val="' + myresp.pid + '" data-id="' + myresp.pdid + '" class="selectable">' + myresp.reference + '</div></td>' +
|
||||
// Référence : sélectionnable ou simple affichage
|
||||
var referenceHtml = isFacture
|
||||
? '<div style="display:inline;">' + myresp.reference + '</div>'
|
||||
: '<div style="display:inline;" data-val="' + myresp.pid + '" data-id="' + myresp.pdid + '" class="selectable">' + myresp.reference + '</div>';
|
||||
|
||||
// Quantité : éditable ou simple affichage selon statut
|
||||
var quantiteHtml = isFacture
|
||||
? '<div>' + myresp.quantite + '</div>'
|
||||
: '<div class="editableNumber getProduitsById" style="display:inline;" data-modifier="getProduitsById" data-table="produit_devis" data-column="quantite" data-id=' + myresp.pdid + '>' + myresp.quantite + '</div>';
|
||||
|
||||
// Commentaire : éditable ou simple affichage
|
||||
var commentHtml = isFacture
|
||||
? '<div>' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div>'
|
||||
: '<div class="editable" data-table="produit_devis" data-column="comment" data-id="' + myresp.pdid + '">' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div>';
|
||||
|
||||
$('#produits tbody').append('<tr><td><div data-html2canvas-ignore data-modifier="getProduitsById" data-id="' + myresp.pdid + '" data-table="produit_devis" class="' + deleteDisable + ' deleteItem icon-delete"></div>' + referenceHtml + '</td>' +
|
||||
'<td>' + myresp.description + '</td>' +
|
||||
'<td><div class="editable" data-table="produit_devis" data-column="comment" data-id="' + myresp.pdid + '">' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div></td>' +
|
||||
'<td><div class="editableNumber getProduitsById" style="display:inline;" data-modifier="getProduitsById" data-table="produit_devis" data-column="quantite" data-id=' + myresp.pdid + '>' + myresp.quantite + '</div> </td>' +
|
||||
'<td>' + commentHtml + '</td>' +
|
||||
'<td>' + quantiteHtml + '</td>' +
|
||||
'<td>' + cur.format(myresp.prix_unitaire) + '</td>' +
|
||||
'<td>' + cur.format((myresp.quantite * myresp.prix_unitaire)) + '</td></tr>');
|
||||
total += (myresp.quantite * myresp.prix_unitaire);
|
||||
});
|
||||
|
||||
$("#totaldevis tbody").empty();
|
||||
getGlobal(devis_id);
|
||||
}).fail(function (response, code) {
|
||||
@ -398,7 +413,6 @@ export function getProduitsByIdDevis(id_devis) {
|
||||
export function getArticlesById() {
|
||||
var devis_id = $('#devisid').data('id');
|
||||
var myData = { numdevis: devis_id };
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/getArticlesById',
|
||||
type: 'POST',
|
||||
@ -409,20 +423,36 @@ export function getArticlesById() {
|
||||
$('#articles tbody').empty();
|
||||
var total = 0;
|
||||
var deleteDisable = "";
|
||||
if ($('#articles').data("type") === "facture") {
|
||||
var isFacture = window.isDevisFacture || false;
|
||||
|
||||
if ($('#articles').data("type") === "facture" || isFacture) {
|
||||
deleteDisable = "d-none";
|
||||
}
|
||||
|
||||
$.each(JSON.parse(response), function (arrayID, myresp) {
|
||||
$('#articles tbody').append('<tr><td><div data-html2canvas-ignore data-modifier="getArticlesById" data-id="' + myresp.adid + '" data-table="article_devis" class="' + deleteDisable + ' deleteItem icon-delete"></div><div style="display:inline;" data-val="' + myresp.aid + '" data-id="' + myresp.adid + '" class="articleSelectable">' + myresp.reference + '</div></td>' +
|
||||
// Référence : sélectionnable ou simple affichage
|
||||
var referenceHtml = isFacture
|
||||
? '<div style="display:inline;">' + myresp.reference + '</div>'
|
||||
: '<div style="display:inline;" data-val="' + myresp.aid + '" data-id="' + myresp.adid + '" class="articleSelectable">' + myresp.reference + '</div>';
|
||||
|
||||
// Quantité : éditable ou simple affichage selon statut
|
||||
var quantiteHtml = isFacture
|
||||
? '<div>' + myresp.quantite + '</div>'
|
||||
: '<div class="editableNumber getArticlesById" style="display:inline;" data-modifier="getArticlesById" data-table="article_devis" data-column="quantite" data-id=' + myresp.adid + '>' + myresp.quantite + '</div>';
|
||||
|
||||
// Commentaire : éditable ou simple affichage
|
||||
var commentHtml = isFacture
|
||||
? '<div>' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div>'
|
||||
: '<div class="editable" data-table="article_devis" data-column="comment" data-id="' + myresp.adid + '">' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div>';
|
||||
|
||||
$('#articles tbody').append('<tr><td><div data-html2canvas-ignore data-modifier="getArticlesById" data-id="' + myresp.adid + '" data-table="article_devis" class="' + deleteDisable + ' deleteItem icon-delete"></div>' + referenceHtml + '</td>' +
|
||||
'<td>' + myresp.description + '</td>' +
|
||||
'<td><div class="editable" data-table="article_devis" data-column="comment" data-id="' + myresp.adid + '">' + ((myresp.comment.length === 0) ? '-' : myresp.comment) + '</div></td>' +
|
||||
'<td><div class="editableNumber getArticlesById" style="display:inline;" data-modifier="getArticlesById" data-table="article_devis" data-column="quantite" data-id=' + myresp.adid + '>' + myresp.quantite + '</div> </td>' +
|
||||
'<td>' + commentHtml + '</td>' +
|
||||
'<td>' + quantiteHtml + '</td>' +
|
||||
'<td>' + cur.format(myresp.prix_unitaire) + '</td>' +
|
||||
'<td>' + cur.format((myresp.quantite * myresp.prix_unitaire)) + '</td></tr>');
|
||||
total += (myresp.quantite * myresp.prix_unitaire);
|
||||
});
|
||||
|
||||
$("#totaldevis tbody").empty();
|
||||
getGlobal(devis_id);
|
||||
}).fail(function (response, code) {
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
<div class="bootstrap-iso">
|
||||
<?php
|
||||
$isFacture = isset($_['devis'][0]->mentions) && ($_['devis'][0]->mentions == \OCA\Gestion\Constants\DevisMentionConstant::FACTURED || $_['devis'][0]->mentions == \OCA\Gestion\Constants\DevisMentionConstant::FACTURED_FORMATTED);
|
||||
?>
|
||||
<div class="bootstrap-iso" data-is-facture="<?php echo $isFacture ? '1' : '0'; ?>">
|
||||
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Quote'));?>
|
||||
<div id="devisid" style="display:inline" class="editable" data-table="devis" data-column="num" data-id="<?php echo $_['devis'][0]->devisid; ?>">sur le defunt <?php echo $_['devis'][0]->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 $_['devis'][0]->id; ?>"><?php echo $_['devis'][0]->lieu; ?>)</div>
|
||||
@ -19,12 +22,12 @@
|
||||
</div>
|
||||
<div class="col-2 h-100 m-0" style="min-height:250px;">
|
||||
<?php
|
||||
if(isset($_['logo']) && $_['logo'] !== "nothing"){
|
||||
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{
|
||||
} 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></h5>
|
||||
@ -66,7 +69,7 @@
|
||||
style="display:inline"
|
||||
data-table="devis" data-column="order_number"
|
||||
data-id="<?php echo $_['devis'][0]->devisid;?>">
|
||||
<?php echo ($_['devis'][0]->order_number == "" ) ? "-" : $_['devis'][0]->order_number ; ?>
|
||||
<?php echo ($_['devis'][0]->order_number == "") ? "-" : $_['devis'][0]->order_number ; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
@ -78,14 +81,16 @@
|
||||
style="display:inline"
|
||||
data-table="devis" data-column="case_number"
|
||||
data-id="<?php echo $_['devis'][0]->devisid;?>">
|
||||
<?php echo ($_['devis'][0]->case_number == "" ) ? "-" : $_['devis'][0]->case_number ; ?>
|
||||
<?php echo ($_['devis'][0]->case_number == "") ? "-" : $_['devis'][0]->case_number ; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div><h2>Articles</h2></div>
|
||||
<?php if (!$isFacture): ?>
|
||||
<button id="devisAdd" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore>Ajouter article</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
@ -106,7 +111,9 @@
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div><h2>Produits</h2></div>
|
||||
<?php if (!$isFacture): ?>
|
||||
<button id="devisAddProduit" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore>Ajouter produit</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user