Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoluments bugfix #755

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ VUE_APP_API_URL="{API_URL}"

PUBLIC_PATH = "{PUBLIC_PATH}"
VUE_APP_STATUS = "development"
VUE_APP_VERSION = "1.11.4"
VUE_APP_VERSION = "1.11.5"


#==================================
Expand Down
41 changes: 19 additions & 22 deletions front/src/components/Affaires/Facturation/Emoluments/Emoluments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default {
disabled: false,
emolument_facture_repartition_ctrl: false,
emolumentsGeneral_list: [],
emolument_priorite: true,
facture_parametres : {
indice_application: null,
tva_pc: null,
Expand Down Expand Up @@ -213,7 +212,6 @@ export default {
// ================================================================================================================================================
async openEmolumentDialog(emolument_affaire_id) {
await this.getEmolument(emolument_affaire_id);
this.emolument_priorite = true;
this.getEmolumentAffaireRepartition(emolument_affaire_id).then(response => {
if (response && response.data) {
this.initFactureRepartition(response.data);
Expand Down Expand Up @@ -516,10 +514,11 @@ export default {
.catch(err => handleException(err, this));
},

handleUpdateEmolument(position, idx) {
async handleUpdateEmolument(position, idx) {
this.updateMontant(position, idx);
this.automaticUpdateNombres();
await this.automaticUpdateNombres(position);
this.update_sommesPartielles();
return;
},

// ================================================================================================================================================
Expand Down Expand Up @@ -712,13 +711,6 @@ export default {
* Download emoluments pdf
*/
async downloadEmoluments() {
// show the entire table
let last_emolument_priorite = false;
if (this.emolument_priorite === true) {
last_emolument_priorite = true;
this.emolument_priorite = false;
}

// tableau emoluments
let tableau_emoluments_html = JSON.parse(JSON.stringify(document.getElementById("tableau_emoluments").outerHTML));
let inputs = tableau_emoluments_html.matchAll(/(md-input-)\w+/g);
Expand Down Expand Up @@ -778,8 +770,6 @@ export default {
fileLink.click();
}).catch(err => {
handleException(err, this);
}).finally(() => {
this.emolument_priorite = last_emolument_priorite;
});
},

Expand All @@ -802,28 +792,34 @@ export default {
f = Number(this.form_general.batiment_f[idx-1]);
}
position.prix[idx] = this.round(f * Number(position.nombre[idx]) * Number(position.montant), 0.05);
return;
},

automaticUpdateNombres() {
async automaticUpdateNombres(current_position) {
let base = [];
let tmp = JSON.parse(JSON.stringify(this.tableauEmolumentsNew));
this.tableauEmolumentsNew.forEach(cat=> {
let base_second = []
this.tableauEmolumentsNew.forEach(cat => {
cat.forEach(scat => {
scat.forEach(pos => {
if (pos.calcul_auto) {
base = pos.calcul_auto.split('+');
for (let i=0; i<this.form_general.nb_batiments+1; i++) {
if (Number(pos.nombre[i])===0) {
pos.nombre[i] = tmp.reduce((partialSum, a) => partialSum + a.reduce((partialSum, a) => partialSum + a.reduce((partialSum, a) => partialSum + (base.includes(a.id_html)? Number(a.nombre[i]): 0), 0), 0), 0);
base_second.filter(x => x !== pos.id_html);
if (base.includes(current_position.id_html) || base_second.some(x => base.includes(x))) {
for (let i=0; i<this.form_general.nb_batiments+1; i++) {
pos.nombre[i] = this.tableauEmolumentsNew.reduce((partialSum, a) => partialSum + a.reduce((partialSum, a) => partialSum + a.reduce((partialSum, a) => partialSum + (base.includes(a.id_html)? Number(a.nombre[i]): 0), 0), 0), 0);
base_second.push(pos.id_html);
this.updateMontant(pos, i);
}
}
}
})
})
})
});
});
});

return;
},


update_sommesPartielles() {
//sommes partielles du tableau récapitulatif
this.total.montant_recapitulatif_mandat = 0;
Expand Down Expand Up @@ -901,6 +897,7 @@ export default {
this.total.montant_recapitulatif_somme7 = this.total.montant_recapitulatif_somme6 + this.total.montant_recapitulatif_tva;
this.total.montant_recapitulatif_total = this.total.montant_recapitulatif_somme7 + this.total.montant_recapitulatif_registre_foncier;

return;
},

addDivers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@

#emolumentsDialog .customTable .customTableBody {
overflow-y: scroll;
max-height: calc(92vh - 200px);
/* max-height: 610px; */
max-height: calc(94vh - 200px);
}

#emolumentsDialog th, #emolumentsDialog td {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ <h3>Répartition des émoluments dans les factures</h3>


<md-tab md-label="Tableau des émoluments" ref="tabRecapitulatif">
<md-switch v-model="emolument_priorite">Afficher le tableau restreint</md-switch>
<table class="tg customTable" id="tableau_emoluments">
<thead class="customTableHead">
<template v-if="form_general.nb_batiments > 0">
Expand Down Expand Up @@ -168,7 +167,7 @@ <h3>Répartition des émoluments dans les factures</h3>
<td class="alignRight batiment-separator" colspan="2" style="background-color: rgba(34, 139, 34, 0.2);"><b>{{ scategory.reduce((partialSum, a) => partialSum + a.prix[i], 0).toFixed(2) }} CHF</b></td>
</template>
</tr>
<tr v-for="position in scategory" id="" :class="{'selected': (position.id == selectedHighlightRow)}" @click="highlithtSelectedRow(position.id)" v-show="emolument_priorite? position.priorite===true: position">
<tr v-for="position in scategory" id="" :class="{'selected': (position.id == selectedHighlightRow)}" @click="highlithtSelectedRow(position.id)">
<!-- code -->
<td class="tg-0lax code">{{ [position.categorie_id, position.code].join('') }}</td>

Expand Down
1 change: 0 additions & 1 deletion front/src/components/Affaires/Facturation/Facturation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ export default {
async openEmolumentsDialog() {
await this.$refs.emoluments.initForm();
this.$refs.emoluments.initFactureRepartition([]);
this.$refs.emoluments.emolument_priorite = true;
this.$refs.emoluments.showEmolumentsDialog = true;
},

Expand Down