I need assistance with a subtraction operation involving the first 3 rows of a table.
TVA Collectée -TVA Déductible - Tva déductible/immo
If the result is positive, I want to display it in the TVA à Payer
box, and if it's negative, show it in the Crédit de TVA
box.
Below is the HTML code snippet:
<div class="table-responsive">
<table class="styled-table" border="1" cellpadding="1" cellspacing="1">
<thead>
<tr height="50">
<th align="center" width="150"> </th>
<td align="center" width="150" *ngFor="let item of listdate">{{item}}</td>
</tr>
</thead>
<tbody>
<tr>
<th>TVA Collectée</th>
<ng-container *ngFor="let item of date">
<td>
<ng-container *ngFor="let c of listTvaVente">
<label *ngIf="item === c.date">{{c.tvaCollectee | number : '0.3-3'}}</label>
</ng-container>
</td>
</ng-container>
</tr>
<tr>
<th>TVA Déductible</th>
<ng-container *ngFor="let item of date">
<td>
<ng-container *ngFor="let c of listTvaAchat ">
<label *ngIf="item === c.date ">{{c.tvaDeductible| number : '0.3-3'}}</label>
</ng-container>
</td>
</ng-container>
</tr>
<tr>
<th>TVA Déductible/immo</th>
<ng-container *ngFor="let item of date">
<td>
<ng-container *ngFor="let c of listTvaInv ">
<label *ngIf="item=== c.date ">{{c.tvaDeductible| number : '0.3-3'}}</label>
</ng-container>
</td>
</ng-container>
</tr>
<tr>
<th>TVA à Reporter</th>
</tr>
<tr>
<th>TVA à Payer</th>
</tr>
<tr>
<th>Crédit de TVA</th>
</tr>
</tbody>
</table>
</div>
This my .ts code:
import { Component, VERSION } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
listdate = ['Janvier-2021', 'Février-2021', 'Mars-2021'];
date = ['2020-01', '2020-02', '2020-03'];
listTvaVente = [
{
date: '2020-01',
year: 2020,
month: 'JANUARY',
chiffreAffaireHT: 0.0,
tvaCollectee: 36000.0
},
{
date: '2020-02',
year: 2020,
month: 'FEBRUARY',
chiffreAffaireHT: 0.0,
tvaCollectee: 35455.0
},
{
date: '2020-03',
year: 2020,
month: 'MARCH',
chiffreAffaireHT: 0.0,
tvaCollectee: 45000.0
}
];
listTvaAchat = [
{
date: '2020-01',
year: 2020,
month: 'JANUARY',
chiffreAffaireHT: 0.0,
tvaDeductible: 26000.0
},
{
date: '2020-02',
year: 2020,
month: 'FEBRUARY',
chiffreAffaireHT: 0.0,
tvaDeductible: 26000.0
...
here is an example I want to do
https://i.sstatic.net/osBvu.png
Thanks in advance.