| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Fuel01
- {
- public partial class f_verif : Form
- {
- DataSet1.tb_venteDataTable tb_vente = new DataSet1.tb_venteDataTable();
- public f_verif()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- init_vente();
- }
- private void init_vente()
- {
- tb_vente.Clear();
- if (File.Exists(Program.subfolder + @"\vente.json"))
- tb_vente = DbUtil.LoadFromJson<DataSet1.tb_venteDataTable>(Program.subfolder + @"\vente.json", tb_vente);
- tb_vente.AcceptChanges();
- tbventeBindingSource.DataSource = tb_vente;
- }
- private void splitContainer2_Panel1_Paint(object sender, PaintEventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- decimal puttc, qtt, tva, totht, totttc,calcttcQ,calcttcT,ecart;
- ecart = 0.02M;
- tbventeBindingSource.MoveFirst();
- DataRowView myrow_b = tbventeBindingSource.Current as DataRowView;
- DataSet1.tb_venteRow myrow = myrow_b.Row as DataSet1.tb_venteRow;
- DataSet1.tb_venteRow oldrow = null;
- while ( myrow!=oldrow)
- {
- Console.WriteLine(myrow.prod_vt.ToString());
- puttc = myrow.pu_vt;
- qtt = myrow.qtt_vt;
- tva = myrow.tva_vt;
- totht = myrow.ht_vt;
- totttc = Math.Round(myrow.ttc_vt,2);
- calcttcQ = Math.Round(qtt * puttc, 2);
- calcttcT = Math.Round(totht * (1 + tva / 100), 2);
- if (totttc != calcttcQ)
- if (Math.Abs(totttc - calcttcQ) > ecart)
- {
- textErr.Text += string.Format("Err TTC...... ttc={0} calc={1} delta={2}\r\n", totttc, calcttcQ, totttc - calcttcQ);
- myrow.ttc_vt = totttc= calcttcQ;
- }
- if (totttc != calcttcT)
- if (Math.Abs(totttc - calcttcT) > ecart)
- {
- textErr.Text += string.Format("Err TVA...... ttc={0} calc={1} delta={2}\r\n", totttc, calcttcT, totttc - calcttcT);
- myrow.ht_vt = Math.Round(totttc / (1 + tva / 100), 2);
- }
- tbventeBindingSource.MoveNext();
- myrow_b = tbventeBindingSource.Current as DataRowView;
- oldrow = myrow;
- myrow = myrow_b.Row as DataSet1.tb_venteRow;
- Application.DoEvents();
- }
- textErr.Text += "END";
- DbUtil.SaveToJson<DataSet1.tb_venteDataTable>(Program.subfolder + @"\vente2.json", tb_vente);
- }
- }
- }
|