Hi friends ,
I have three table Countdown, Walk, Bon de reception
The Id_marche is a foreign key in the countdown table and
The Receipt table contains the Id_marche
I want to insert in recordings in the counting table which contains Amount TTC so to calculate Amount TTC = TVA* Amount HT
I have the TVA AND the Amount HT in the voucher table of reception
I could not create a request to insert and calculate the amount TTC
I do not know is what I described well my condition but hey I will screenshot the three table and you will see the relationship between them
And thank you for you in advance
What I have tried:
insert into decompte
(Id_marche,Num_decompte,Date_etablissement,Flag_dernier,Montant_ttc,Retenue_garantie,Penalite_retard,Revision_prix,
Autres_retenues,Retenue_source,User_create,Date_create)
values
((select TOP 1 Id_marche from marche where Num_marche='"+textBox1.Text+"'),
'"+textBox3.Text+"','"+dateTimePicker1.Value.Date+"','"+cocher+"',
(select TOP 1 marche.Id_marche from marche , bon_reception_marche br ,decompte where br.Id_marche=marche.Id_marche and decompte.Montant_ttc=br.Montant*br.TVA),
"+Convert.ToDouble(textBox4.Text)+","+Convert.ToDouble(textBox4.Text)+","+Convert.ToDouble(textBox4.Text)+",
"+Convert.ToDouble(textBox4.Text)+","+Convert.ToDouble(textBox4.Text)+","+Convert.ToDouble(textBox4.Text)+",
'"+values.username+"',DateTime.Now.Date)