# Formules de calcul Transaction

<table id="bkmrk-nom-de-la-m%C3%A9thode-pa" style="height: 3245.15px; width: 100.476%;"><thead><tr style="height: 29.7969px;"><th style="width: 25.0298%; height: 29.7969px;">**Nom de la méthode**</th><th style="width: 25.0298%; height: 29.7969px;">**Paramètres principaux**</th><th style="width: 23.4803%; height: 29.7969px;">**Résumé / Fonction**</th><th style="width: 26.5793%; height: 29.7969px;">**Formule / Calcul**</th></tr></thead><tbody><tr style="height: 264.953px;"><td style="width: 25.0298%; height: 264.953px;">**CalculerDateDernierCouponTransaction**</td><td style="width: 25.0298%; height: 264.953px;">dateTransaction, valMobId</td><td style="width: 23.4803%; height: 264.953px;">Détermine la dernière date de coupon avant la transaction en fonction de **valMob.DateJouissance**, des **échéances valMob.ValMobEcheances.DateEcheanceModifiee** et de **valMob.DateEcheanceRadiation**. Si la date de transaction dépasse la radiation ou qu’aucune échéance valide n’existe, retourne null ou la date de jouissance selon le cas.</td><td style="width: 26.5793%; height: 264.953px;">N/A</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerDateEcheanceTransaction**</td><td style="width: 25.0298%; height: 113.781px;">valMobId</td><td style="width: 23.4803%; height: 113.781px;">Retourne la date d’échéance de radiation (**valMob.DateEcheanceRadiation**) d’un instrument financier. Null si l’instrument n’existe pas.</td><td style="width: 26.5793%; height: 113.781px;">N/A</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerMntCouponcouruAchatTransaction**</td><td style="width: 25.0298%; height: 113.781px;">qte, nbreJourTotalAnne, nominal, formuleCalcul, formIntDenom0, tauxInteret, dateDenouementTheorique, dateDernierCoupon, nbDecimales</td><td style="width: 23.4803%; height: 113.781px;">Calcule le montant des intérêts courus pour un achat (**coupon couru**). Retourne null si la date de dénouement est avant le dernier coupon.</td><td style="width: 26.5793%; height: 113.781px;">`mntCouponcouruAchat = qte × InteretsCourusTotal(...)`</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculermntInteretsIntercalairesBrutTransaction**</td><td style="width: 25.0298%; height: 113.781px;">qte, nbreJourTotalAnne, nominal, formuleCalcul, formIntDenom0, tauxInteret, dateDenouementTheorique, dateDernierCoupon, nbDecimales</td><td style="width: 23.4803%; height: 113.781px;">Calcule le montant brut des intérêts intercalaires. Retourne null si la date de dénouement est après le dernier coupon.</td><td style="width: 26.5793%; height: 113.781px;">`mntInteretsIntercalairesBrut = qte × InteretsCourusTotal(...)`</td></tr><tr style="height: 130.578px;"><td style="width: 25.0298%; height: 130.578px;">**CalculermntInteretsIntercalairesTransaction**</td><td style="width: 25.0298%; height: 130.578px;">qte, nbreJourTotalAnne, nominal, formuleCalcul, formIntDenom0, tauxInteret, dateDenouementTheorique, dateDernierCoupon, nbDecimales, retenueALaSource</td><td style="width: 23.4803%; height: 130.578px;">Calcule le montant net des intérêts intercalaires après retenue à la source.</td><td style="width: 26.5793%; height: 130.578px;">`mntInteretsIntercalaires = mntInteretsIntercalairesBrut `

`× (1 - retenueALaSource)`

</td></tr><tr style="height: 64.3281px;"><td style="width: 25.0298%; height: 64.3281px;">**CalculerMntPiedCouponTransaction**</td><td style="width: 25.0298%; height: 64.3281px;">txPiedCoupon, nominal, qte</td><td style="width: 23.4803%; height: 64.3281px;">Calcule le montant du pied de coupon.</td><td style="width: 26.5793%; height: 64.3281px;">`mntPiedCoupon = (txPiedCoupon / 100) × nominal × qte`</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerTauxCouponcouruAchatTransaction**</td><td style="width: 25.0298%; height: 113.781px;">nbreTotalJourAnne, nominal, formuleCalcul, formIntDenom0, tauxInteret, dateDenouementTheorique, dateDernierCoupon, nbDecimales</td><td style="width: 23.4803%; height: 113.781px;">Calcule le taux du coupon couru pour un achat. Retourne le montant des intérêts divisé par le nominal.</td><td style="width: 26.5793%; height: 113.781px;">`tauxCoupon = Interets(...) / nominal`</td></tr><tr style="height: 147.375px;"><td style="width: 25.0298%; height: 147.375px;">**CalculerMntCouponCouruTransaction**</td><td style="width: 25.0298%; height: 147.375px;">nbreJourTotalAnne, formuleCalcul, formIntDenom0, txPiedCoupon, nbDecimales, tauxInteretTransaction, dateDernierCoupon, dateDenouementTheorique, nominal, nbre</td><td style="width: 23.4803%; height: 147.375px;">Calcule le montant total du coupon couru pour la transaction : somme du coupon couru et du pied de coupon.</td><td style="width: 26.5793%; height: 147.375px;">`mntTotalCoupon = mntCouponcouruAchat + mntPiedCoupon`</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerTauxInteretTransaction**</td><td style="width: 25.0298%; height: 113.781px;">dateTransaction, valMobId</td><td style="width: 23.4803%; height: 113.781px;">Retourne le taux d’intérêt applicable à la transaction en fonction de **valMob.TauxInteret** ou de l’indice (**valMob.Indice**) si défini.</td><td style="width: 26.5793%; height: 113.781px;">N/A</td></tr><tr style="height: 29.7969px;"><td style="width: 25.0298%; height: 29.7969px;"> </td><td style="width: 25.0298%; height: 29.7969px;"> </td><td style="width: 23.4803%; height: 29.7969px;"> </td><td style="width: 26.5793%; height: 29.7969px;">  
</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerDateDénouementThéorique**</td><td style="width: 25.0298%; height: 113.781px;">dateTransaction, typeOpeId</td><td style="width: 23.4803%; height: 113.781px;">Détermine la date théorique de dénouement en fonction du **typeOpe.DelaiDenouement**, en excluant les jours non ouvrés et jours fériés.</td><td style="width: 26.5793%; height: 113.781px;">`dateDénouement = dateTransaction + delaiValide`</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**CalculerNbreJourCouruTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">dateDernierCoupon, dateDenouementTheorique</td><td style="width: 23.4803%; height: 80.1875px;">Calcule le nombre de jours courus entre le dernier coupon et la date de dénouement théorique.</td><td style="width: 26.5793%; height: 80.1875px;">`nbreJourCouru =dateDenouementTheorique-dateDernierCoupon

</td></tr><tr style="height: 29.7969px;"><th style="width: 25.0298%; height: 29.7969px;"> </th><th style="width: 25.0298%; height: 29.7969px;"> </th><th style="width: 23.4803%; height: 29.7969px;"> </th><th style="width: 26.5793%; height: 29.7969px;"> </th></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetNominalTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">valMob</td><td style="width: 23.4803%; height: 80.1875px;">Retourne le nominal (**valMob.Nominal**) d’un instrument financier. Null si l’instrument n’existe pas.</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetNbDecimalesTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">clientCompte</td><td style="width: 23.4803%; height: 80.1875px;">Retourne le nombre de décimales associé à la devise du compte (**Devise.NbDecimales**).</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**GetDateTransaction**</td><td style="width: 25.0298%; height: 96.9844px;">clientCompte</td><td style="width: 23.4803%; height: 96.9844px;">Retourne la date de transaction (**ClientCompte.JourneeEnCours**) pour un compte donné.</td><td style="width: 26.5793%; height: 96.9844px;">N/A</td></tr><tr style="height: 63.3906px;"><td style="width: 25.0298%; height: 63.3906px;">**GetDeviseTransaction**</td><td style="width: 25.0298%; height: 63.3906px;">clientCompte</td><td style="width: 23.4803%; height: 63.3906px;">Retourne l’ID de la devise associée au compte (**ClientCompte.Devise**).</td><td style="width: 26.5793%; height: 63.3906px;">N/A</td></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**GetContrepartieTransaction**</td><td style="width: 25.0298%; height: 96.9844px;">clientCompte</td><td style="width: 23.4803%; height: 96.9844px;">Retourne l’ID de la contrepartie associée au compte (**ClientCompte.Contrepartie**).</td><td style="width: 26.5793%; height: 96.9844px;">N/A</td></tr><tr style="height: 63.3906px;"><td style="width: 25.0298%; height: 63.3906px;">**GetCurrencyDeviseTransaction**</td><td style="width: 25.0298%; height: 63.3906px;">clientCompte</td><td style="width: 23.4803%; height: 63.3906px;">Retourne le symbole de la devise du compte (**Devise.Symbole**).</td><td style="width: 26.5793%; height: 63.3906px;">N/A</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetDepositaireTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">clientCompte</td><td style="width: 23.4803%; height: 80.1875px;">Retourne l’ID du dépositaire par défaut pour le compte (**ClientCompte.DepositaireParDefaut**).</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**GetRetenueALaSourceTransaction**</td><td style="width: 25.0298%; height: 96.9844px;">valMob</td><td style="width: 23.4803%; height: 96.9844px;">Retourne le taux de retenue à la source d’un instrument financier (**valMob.RetenueALaSource**).</td><td style="width: 26.5793%; height: 96.9844px;">N/A</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**GetNbreTotalJourAnneTransaction**</td><td style="width: 25.0298%; height: 113.781px;">valMobId, dateDenouementTheorique</td><td style="width: 23.4803%; height: 113.781px;">Retourne le nombre de jours par an utilisé pour le calcul des intérêts (**valMob.BaseCalculNavigation.NbreJourAn** ou par défaut via les échéances).</td><td style="width: 26.5793%; height: 113.781px;">N/A</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetFormuleCalculTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">valMob</td><td style="width: 23.4803%; height: 80.1875px;">Retourne la formule de calcul des intérêts pour l’instrument financier (**valMob.FormuleCalcul**).</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetFormIntDenom0Transaction**</td><td style="width: 25.0298%; height: 80.1875px;">valMob</td><td style="width: 23.4803%; height: 80.1875px;">Retourne la valeur du dénominateur utilisé dans la formule d’intérêts (**valMob.FormIntDenom0**).</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**GetPrixUnitaire**</td><td style="width: 25.0298%; height: 113.781px;">valMob, compte</td><td style="width: 23.4803%; height: 113.781px;">Retourne le prix unitaire applicable : soit le nominal, soit selon la méthode de valorisation du compte **(Cours.CMP** ou **Cours.Cloture**).</td><td style="width: 26.5793%; height: 113.781px;">N/A</td></tr><tr style="height: 63.3906px;"><td style="width: 25.0298%; height: 63.3906px;">**CalculMntBrutTransaction**</td><td style="width: 25.0298%; height: 63.3906px;">prixUnitaire, nbre</td><td style="width: 23.4803%; height: 63.3906px;">Calcule le montant brut d’une transaction : prix unitaire × quantité.</td><td style="width: 26.5793%; height: 63.3906px;">`mntBrut = prixUnitaire × nbre`</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**GetSensTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">typeOpe</td><td style="width: 23.4803%; height: 80.1875px;">Retourne le sens de la transaction associé au type d’opération (**TypeOpe.SensTransaction**).</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 29.7969px;"><th style="width: 25.0298%; height: 29.7969px;"> </th><th style="width: 25.0298%; height: 29.7969px;"> </th><th style="width: 23.4803%; height: 29.7969px;"> </th><th style="width: 26.5793%; height: 29.7969px;"> </th></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**CalculerMntPrixRevientTransaction**</td><td style="width: 25.0298%; height: 96.9844px;">transactionsDossiers, clientCompte, valmob, dateTransaction, deviseId, prixUnitaire, qte, sensTransaction</td><td style="width: 23.4803%; height: 96.9844px;">Calcule le prix de revient d’une transaction. Si des transactions précédentes existent, fait la moyenne pondérée.</td><td style="padding: 0.75pt; width: 26.5793%;"><span style="font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-language: FR;">prixRevient = qte \* (Σ(transactionsDossiers.TransctAchat.PrixUnitaire \* transactionsDossiers.Nbre) / Σ(transactionsDossiers.Nbre))</span><span style="font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-language: FR;"> ou </span><span style="font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-language: FR;">prixRevient = prixUnitaire \* qte</span>

</td></tr><tr style="height: 80.1875px;"><td style="width: 25.0298%; height: 80.1875px;">**CalculerListFraisTransaction**</td><td style="width: 25.0298%; height: 80.1875px;">typeOpe, contrepartie, clientCompte, dateTransaction</td><td style="width: 23.4803%; height: 80.1875px;">Retourne la liste des frais applicables à une transaction selon le type d’opération, le type de client et la date.</td><td style="width: 26.5793%; height: 80.1875px;">N/A</td></tr><tr style="height: 81.125px;"><td style="width: 25.0298%; height: 81.125px;">**CalculMontantFraisTransaction**</td><td style="width: 25.0298%; height: 81.125px;">typeOpeContrepartie, transactions</td><td style="width: 23.4803%; height: 81.125px;">Calcule le montant des frais pour une transaction selon le type de frais, l’assiette et les tranches éventuelles.</td><td style="width: 26.5793%; height: 81.125px;">`mntFrais` calculé à partir de `transactions.Nbre * transactions.PrixUnitaire` et coefficients</td></tr><tr style="height: 113.781px;"><td style="width: 25.0298%; height: 113.781px;">**CalculerListTransactionEcheance**</td><td style="width: 25.0298%; height: 113.781px;">qte, typeOpe, valmob, dateTransaction</td><td style="width: 23.4803%; height: 113.781px;">Génère la liste des échéances (intérêts et capital) pour une transaction, selon les échéances modifiées de Valeur Mobilière.</td><td style="width: 26.5793%; height: 113.781px;">`mntEcheance = qte * MntInteretsNet_Modifie` ou `mntBrut = qte * MntInteretsBruts`</td></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**CalculerListTransactionsDossiers**</td><td style="width: 25.0298%; height: 96.9844px;">clientCompte, valMob, dateTransaction, sensTransaction</td><td style="width: 23.4803%; height: 96.9844px;">Retourne la liste des transactions dossiers disponibles pour un achat ou une vente selon le sens de la transaction.</td><td style="width: 26.5793%; height: 96.9844px;">N/A</td></tr><tr style="height: 96.9844px;"><td style="width: 25.0298%; height: 96.9844px;">**GetListTransactionsDossiersByTransactionsAchat**</td><td style="width: 25.0298%; height: 96.9844px;">clientCompte, valmob, dateTransaction</td><td style="width: 23.4803%; height: 96.9844px;">Appel SQL pour récupérer les transactions dossiers disponibles pour un achat selon le compte, instrument et date.</td><td style="width: 26.5793%; height: 96.9844px;">N/A</td></tr><tr><td style="width: 25.0298%;">**CalculerMntIntEchusTransaction**</td><td style="width: 25.0298%;">transactionsDossiers, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant total des intérêts échus pour une collection de dossiers de transactions.</td><td style="width: 26.5793%;">`mntIntEchus = Σ(transactionsDossiers.MntInteretsCourusDetention)`</td></tr><tr><td style="width: 25.0298%;">**CalculerMntPMVPostTransaction**</td><td style="width: 25.0298%;">transactionsDossiers, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant total des plus ou moins-values après transaction.</td><td style="width: 26.5793%;">`mntplusOuMoinsVal = Σ(transactionsDossiers.MntplusOuMoinsVal)`</td></tr><tr><td style="width: 25.0298%;">**CalculMntFraisTransaction**</td><td style="width: 25.0298%;">transactionFrais, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant total des frais associés aux transactions.</td><td style="width: 26.5793%;">`mntFrais = Σ(transactionFrais.Montant)`</td></tr><tr><td style="width: 25.0298%;">**CalculerMntInteretsCourusDetentionTransaction**</td><td style="width: 25.0298%;">transactionsDossiers, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant total des intérêts courus en détention pour une collection de dossiers de transactions.</td><td style="width: 26.5793%;">`mntIntEchus = Σ(transactionsDossiers.MntInteretCouruNet)`</td></tr><tr><td style="width: 25.0298%;">**CalculerMontantRSTransaction**</td><td style="width: 25.0298%;">transactionsDossiers, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant total de la retenue à la source (RS) sur les intérêts en détention.</td><td style="width: 26.5793%;">`mntIntEchus = Σ(transactionsDossiers.MntRSIntDetention)`</td></tr><tr><td style="width: 25.0298%;">**CalculerSurcoteDecoteVenteTransaction**</td><td style="width: 25.0298%;">transactionsDossiers, dateVente, capitalRes, nbDecimales</td><td style="width: 23.4803%;">Calcule le montant de surcote ou décote à la vente pour une collection de dossiers de transactions.</td><td style="width: 26.5793%;">`mntSurcoteDecote = Σ [ ((capital - capital*TxPiedCoupon) * NbreAchat / NbreJourTotal) * JoursDetention * (NbreVente/NbreAchat) ]`</td></tr></tbody></table>

Calcul de Dossier de Vente:

<table id="bkmrk-nom-de-la-m%C3%A9thode-pa-1"><thead><tr><th>**Nom de la méthode**</th><th>**Paramètres principaux**</th><th>**Résumé / Fonction**</th><th>**Formule / Calcul**</th></tr></thead><tbody><tr><td>**CalculTransactionsDossiersMntCouponCouruAchat**</td><td>transactionAchat, qte, dateDernierCoupon, nbDecimales</td><td>Calcule le montant du coupon couru à l’achat pour une transaction spécifique.</td><td>`MntCouponCouru = MntCouponCouruAchat * qte / Nbre`</td></tr><tr><td>**CalculTransactionsDossiersMntRSIntAchete**</td><td>transactionAchat, qte, dateDernierCoupon, nbDecimales, retenueALaSource</td><td>Calcule la retenue à la source sur les intérêts achetés.</td><td>`MntRSIntAchete = MntCouponCouruAchat * qte * retenueALaSource / Nbre`</td></tr><tr><td>**CalculTransactionsDossiersMntIntAcheteNet**</td><td>transactionAchat, qte, dateDernierCoupon, nbDecimales, retenueALaSource</td><td>Calcule le montant net des intérêts achetés après retenue à la source.</td><td>`MntIntAcheteNet = MntCouponCouruAchat * qte * (1 - retenueALaSource) / Nbre`</td></tr><tr><td>**CalculTransactionsDossiersNbreJoursCourus**</td><td>transactionAchat, qte, dateDernierCoupon, dateVente</td><td>Calcule le nombre de jours de détention entre la date d’achat et la date de vente ou le dernier coupon.</td><td>`NbreJoursCourus = (dateVente - max(dateDernierCoupon, DateDenouement))`</td></tr><tr><td>**CalculTransactionsDossiersMntInteretsCourusDetention**</td><td>nbreJourTotalAnne, formuleCalcul, formIntDenom0, transactionAchat, qte, capitalRes, tauxInteret, dateDernierCoupon, dateVente, nbDecimales</td><td>Calcule les intérêts courus en détention pour une transaction.</td><td>`MntInteretsCourusDetention = InteretsCourusTotal(...)` (via GeneralCalculator)</td></tr><tr><td>**CalculTransactionsDossiersMntRSIntDetention**</td><td>nbreJourTotalAnne, formuleCalcul, formIntDenom0, transactionAchat, qte, capitalRes, tauxInteret, dateDernierCoupon, dateVente, nbDecimales, retenueALaSource</td><td>Calcule la retenue à la source sur les intérêts courus en détention.</td><td>`MntRSIntDetention = MntInteretsCourusDetention * retenueALaSource`</td></tr><tr><td>**CalculTransactionsDossiersMntInteretCouruNet**</td><td>nbreJourTotalAnne, formuleCalcul, formIntDenom0, transactionAchat, qte, capitalRes, tauxInteret, dateDernierCoupon, dateVente, nbDecimales, retenueALaSource</td><td>Calcule le montant net des intérêts courus en détention après retenue à la source.</td><td>`MntInteretCouruNet = MntInteretsCourusDetention * (1 - retenueALaSource)`</td></tr><tr><td>**CalculTransactionsDossiersMntCouponCouruVendu**</td><td>nbreJourTotalAnne, formuleCalcul, formIntDenom0, transactionAchat, qte, capitalRes, tauxInteret, dateDernierCoupon, dateVente, nbDecimales, retenueALaSource</td><td>Calcule le montant total du coupon couru lors de la vente, incluant le net d’intérêts.</td><td>`MntCouponCouruVendu = MntCouponCouruAchat + MntInteretCouruNet`</td></tr><tr><td>**CalculTransactionsDossiersMntPlusOuMoinsVal**</td><td>transactionAchat, qte, capitalRes, tauxVente, nbDecimales</td><td>Calcule la plus ou moins-value réalisée pour la transaction.</td><td>`MntPlusOuMoinsVal = qte * (tauxVente - TxPiedCoupon) * capitalRes`</td></tr></tbody></table>

Calcul de plus ou moins value et stock:

<table id="bkmrk-nom-de-la-m%C3%A9thode-pa-2" style="width: 100%; height: 320.172px;"><thead><tr style="height: 46.5938px;"><th style="width: 10.2503%; height: 46.5938px;">**Nom de la méthode**</th><th style="width: 14.5371%; height: 46.5938px;">**Paramètres principaux**</th><th style="width: 29.4438%; height: 46.5938px;">**Résumé / Fonction**</th><th style="width: 45.7688%; height: 46.5938px;">**Formule / Calcul / Remarques**</th></tr></thead><tbody><tr style="height: 273.578px;"><td style="width: 10.2503%; height: 273.578px;">**CalculerCmpApresTransaction**</td><td style="width: 14.5371%; height: 273.578px;">clientCompte, valmob, dateTransaction, devise, qte, prix, typeOpe, nbDecimales</td><td style="width: 29.4438%; height: 273.578px;">Calcule le coût moyen pondéré (CMP) et le stock après une transaction, pour un client ou un compte spécifique. Le calcul se fait à l’aide des procédures stockées `GenerateCmpByClientCompteAndValmob_PS` (pour le compte) et `GenerateCmpByClientAndValmob_PS` (pour le client).</td><td style="width: 45.7688%; height: 273.578px;">Le calcul du CMP se fait à partir des dernières valeurs de stock et CMP récupérées via les procédures stockées :`transactionPrecCompte = GenerateCmpByClientCompteAndValmob_PS(...)``transactionPrecClt = GenerateCmpByClientAndValmob_PS(...)`

**Achat (SensTransaction=1)** :

`StockApres += qte`, `CmpApres += qte*prix`

**Vente (SensTransaction=-1)** :

`MntPMV = qte*prix - CMP/qte`, `StockApres -= qte`, `CmpApres -= CMP/qte`**Autre (SensTransaction=0)** : `CmpApres += qte * SensPrixRevientClient * prix`

</td></tr></tbody></table>