fix modify PU HT in devis

This commit is contained in:
Tolotsoa 2025-10-24 08:10:26 +03:00
parent 666c54dc83
commit 89e571d4bf
30 changed files with 60 additions and 53 deletions

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

View File

@ -332,6 +332,8 @@ OC.L10N.register(
"Quantity" : "Quantity",
"Unit price without VAT" : "Unit price (excluding VAT)",
"Total without VAT" : "Total (excluding VAT)",
"Unit price with VAT" : "Unit price (including VAT)",
"Total with VAT" : "Total (including VAT)",
"Add product" : "Add product",
"Save in Nextcloud" : "Save in Nextcloud",
"Send by email" : "Send by email",

View File

@ -331,6 +331,8 @@ OC.L10N.register(
"Offer valid for 1 month from" : "Offre valide 1 mois à compter du",
"Quantity" : "Quantité",
"Unit price without VAT" : "PU HT",
"Unit price with VAT" : "PU TTC",
"Total with VAT" : "Total TTC",
"Total without VAT" : "Total HT",
"Add product" : "Ajouter produit",
"Save in Nextcloud" : "Sauvegarder dans nextcloud",

View File

@ -41,7 +41,7 @@ class Bdd
public function __construct(IDbConnection $db, IL10N $l, LoggerInterface $logger)
{
$this->whiteColumn = array("date", "num", "id_client", "id_thanato", "entreprise", "nom", "prenom", "legal_one", "telephone", "mail", "adresse", "produit_id",
"quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "tva", "legal_two", "path", "tva_default", "coefficient_ik",
"quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "tva", "unit_price", "legal_two", "path", "tva_default", "coefficient_ik",
"mentions_default", "version", "mentions", "comment", "status_paiement", "devise", "auto_invoice_number", "changelog", "format", "comment", "user_id",
"facture_prefixe", "arrivee", "depart", "latitude", "longitude", "id_lieu", "rang", "mois", "annee", "id_trajet", "commentaire","source",
"date_habilitation", "sexe", "observations_generales", "ref_pacemaker", "id_defunt", "article_id", "corpulence", "lieu_deces",
@ -924,13 +924,14 @@ class Bdd
public function getListProduit($numdevis, $idNextcloud)
{
$sql = "SELECT ".
$this->tableprefix."produit.id as pid,"
.$this->tableprefix."produit_devis.id as pdid, reference, description,"
.$this->tableprefix."produit_devis.comment, quantite, prix_unitaire, "
.$this->tableprefix."produit_devis.tva, "
.$this->tableprefix."devis.id_client
FROM ".$this->tableprefix."produit, ".$this->tableprefix."devis, ".$this->tableprefix."produit_devis
WHERE ".$this->tableprefix."produit.id = produit_id AND ".$this->tableprefix."devis.id = devis_id AND ".$this->tableprefix."devis.id = ?";
$this->tableprefix."produit.id as pid,"
.$this->tableprefix."produit_devis.id as pdid, reference, description,"
.$this->tableprefix."produit_devis.comment, quantite, "
.$this->tableprefix."produit_devis.unit_price as prix_unitaire, "
.$this->tableprefix."produit_devis.tva, "
.$this->tableprefix."devis.id_client
FROM ".$this->tableprefix."produit, ".$this->tableprefix."devis, ".$this->tableprefix."produit_devis
WHERE ".$this->tableprefix."produit.id = produit_id AND ".$this->tableprefix."devis.id = devis_id AND ".$this->tableprefix."devis.id = ?";
$produits = $this->execSQLNoJsonReturn($sql, [$numdevis]);
@ -939,7 +940,7 @@ class Bdd
$client = $this->getClientById($clientId);
foreach($produits as &$produit) {
$productPrice = $this->getProductPriceByClientGroupId($client['fk_client_group_id'], $produit['pid']);
$produit['prix_unitaire'] = $productPrice ?? $produit['prix_unitaire'];
$produit['prix_unitaire'] = $produit['prix_unitaire'] ?? $productPrice;
}
}
return json_encode($produits);
@ -949,7 +950,8 @@ class Bdd
{
$sql = "SELECT ".$this->tableprefix."article.id as aid,"
.$this->tableprefix."article_devis.id as adid, reference, description,"
.$this->tableprefix."article_devis.comment, quantite, prix_unitaire, "
.$this->tableprefix."article_devis.comment, quantite, "
.$this->tableprefix."article_devis.unit_price as prix_unitaire, "
.$this->tableprefix."article_devis.tva "
."FROM "
.$this->tableprefix."article, ".$this->tableprefix."devis, ".$this->tableprefix."article_devis WHERE ".$this->tableprefix."article.id = article_id AND ".$this->tableprefix."devis.id = devis_id AND ".$this->tableprefix."devis.id = ?";
@ -3118,7 +3120,7 @@ class Bdd
produit_devis.discount,
produit_devis.devis_id,
produit_devis.tva,
produit.prix_unitaire as produit_price,
produit_devis.unit_price as produit_price,
produit.reference as produit_reference,
produit.description as produit_description,
produit.fk_product_type_id as fk_product_type_id,
@ -3139,7 +3141,7 @@ class Bdd
$client = $this->getClientById($clientId);
foreach($produitList as &$produit) {
$productPrice = $this->getProductPriceByClientGroupId($client['fk_client_group_id'], $produit['produit_id']);
$produit['produit_price'] = $productPrice ?? $produit['produit_price'];
$produit['produit_price'] = $produit['produit_price'] ?? $productPrice;
}
}

View File

@ -52,5 +52,5 @@ window.addEventListener("DOMContentLoaded", function () {
getArticlesById();
}
}, 500);
});
});
});

View File

@ -409,7 +409,7 @@ export function getProduitsById() {
'<td>' + cur.format(prixUnitaireTTC) + '</td>' +
// Colonne 7: Unit price without VAT (Prix unitaire HT)
'<td>' + cur.format(prixUnitaireHT) + '</td>' +
'<td><div class="editableNumber getProduitsById" style="display:inline;" data-modifier="getProduitsById" data-table="produit_devis" data-column="unit_price" data-id="' + myresp.pdid + '">' + prixUnitaireHT.toFixed(2) + '</div><span> €</span></td>' +
// Colonne 8: Total with VAT (Total TTC)
'<td>' + cur.format(totalTTC) + '</td>' +
@ -456,8 +456,9 @@ export function getArticlesById() {
var quantite = parseFloat(myresp.quantite);
// Calculs
var prixUnitaireTTC = prixUnitaireHT * (1 + tvaValue / 100);
var totalHT = prixUnitaireHT * quantite;
var totalTTC = totalHT * (1 + tvaValue / 100);
var totalTTC = prixUnitaireTTC * quantite;
$('#articles tbody').append('<tr>' +
// Colonne 1: Reference (avec delete et selectable)
@ -479,16 +480,16 @@ export function getArticlesById() {
// Colonne 5: Quantity (ml) (editable)
'<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>' +
// Colonne 6: Unit price without VAT (Prix unitaire HT)
'<td>' + cur.format(prixUnitaireHT) + '</td>' +
// Colonne 6: Unit price with VAT (Prix unitaire TTC)
'<td>' + cur.format(prixUnitaireTTC) + '</td>' +
// Colonne 7: Total without VAT (Total HT)
'<td>' + cur.format(totalHT) + '</td>' +
// Colonne 7: Unit price without VAT (Prix unitaire HT)
'<td><div class="editableNumber getArticlesById" style="display:inline;" data-modifier="getArticlesById" data-table="article_devis" data-column="unit_price" data-id="' + myresp.adid + '">' + prixUnitaireHT.toFixed(2) + '</div><span> €</span></td>' +
// Colonne 8: Total with VAT (Total TTC)
'<td>' + cur.format(totalTTC) + '</td>' +
// Colonne 9: Total without VAT (Total HT - duplicate)
// Colonne 9: Total without VAT (Total HT)
'<td>' + cur.format(totalHT) + '</td>' +
'</tr>'

View File

@ -204,7 +204,7 @@
<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>
<th><?php p($l->t('Total with VAT'));?></th>
<th>Total TTC</th>
</tr>
</thead>
<tbody>

View File

@ -19,12 +19,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 +66,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,7 +78,7 @@
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 />
@ -97,9 +97,9 @@
<th><?php p($l->t('Comment'));?></th>
<th><?php p($l->t('TVA'));?></th>
<th><?php p($l->t('Quantity'));?></th>
<th><?php p($l->t('Unit price with VAT'));?></th>
<th>PU TTC</th>
<th><?php p($l->t('Unit price without VAT'));?></th>
<th><?php p($l->t('Total with VAT'));?></th>
<th>Total TTC</th>
<th><?php p($l->t('Total without VAT'));?></th>
</tr>
</thead>
@ -121,9 +121,9 @@
<th><?php p($l->t('Comment'));?></th>
<th><?php p($l->t('TVA'));?></th>
<th><?php p($l->t('Quantity'));?>(ml)</th>
<th>PU TTC</th>
<th><?php p($l->t('Unit price without VAT'));?></th>
<th><?php p($l->t('Total without VAT'));?></th>
<th><?php p($l->t('Total with VAT'));?></th>
<th>Total TTC</th>
<th><?php p($l->t('Total without VAT'));?></th>
</tr>
</thead>