Patrick Germain 8 miesięcy temu
rodzic
commit
6470b22308

+ 2 - 8
Fuel_ASO.sln

@@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33122.133
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fuel_ASO", "Fuel_ASO\Fuel_ASO.csproj", "{2578A6FE-68E5-4216-AF51-9B04DDD43D8A}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert", "Convert\Convert.csproj", "{37EE8F41-69D4-4BD9-9A56-3BD68230C004}"
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -17,18 +15,14 @@ Global
 		{2578A6FE-68E5-4216-AF51-9B04DDD43D8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{2578A6FE-68E5-4216-AF51-9B04DDD43D8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{2578A6FE-68E5-4216-AF51-9B04DDD43D8A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{37EE8F41-69D4-4BD9-9A56-3BD68230C004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{37EE8F41-69D4-4BD9-9A56-3BD68230C004}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{37EE8F41-69D4-4BD9-9A56-3BD68230C004}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{37EE8F41-69D4-4BD9-9A56-3BD68230C004}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
-		BuildVersion_StartDate = 2000/1/1
-		VisualSVNWorkingCopyRoot = .
 		SolutionGuid = {0EC339A5-8D8B-44F8-9BC8-E03376574355}
+		VisualSVNWorkingCopyRoot = .
+		BuildVersion_StartDate = 2000/1/1
 	EndGlobalSection
 	GlobalSection(SubversionScc) = preSolution
 		Svn-Managed = True

+ 14 - 0
Fuel_ASO/DbUtil.cs

@@ -7,6 +7,7 @@ using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Xml.Linq;
 
 namespace Fuel01
 {
@@ -149,6 +150,19 @@ namespace Fuel01
         }
 
         
+        public static List<Produit> GetProduits()
+        {
+            XDocument xRoot = XDocument.Load(Program.folder + @"\param\produit.xml");
+            var data = from item in xRoot.Descendants("tb_prod")
+                       orderby item.Element("type_prod").Value, item.Element("lib_prod").Value
+                       select new Produit()
+                       {
+                           key_prod = item.Element("key_prod").Value,
+                           lib_prod = item.Element("lib_prod").Value,
+                           type_prod = item.Element("type_prod").Value
+                       };
+            return data.ToList();
+        }
 
     }
 }

+ 2 - 1
Fuel_ASO/Fuel_ASO.csproj

@@ -151,6 +151,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Models\Vente.cs" />
     <Compile Include="Models\Achats.cs" />
     <Compile Include="Models\Achats3.cs" />
     <Compile Include="Models\Presta.cs" />
@@ -428,7 +429,7 @@
   </PropertyGroup>
   <ProjectExtensions>
     <VisualStudio>
-      <UserProperties BuildVersion_DetectChanges="False" BuildVersion_IncrementBeforeBuild="False" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.YearDayOfYearStamp.Increment" BuildVersion_UseUniversalClock="True" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2018/1/1" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
+      <UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_StartDate="2018/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_UseUniversalClock="True" BuildVersion_BuildVersioningStyle="None.None.YearDayOfYearStamp.Increment" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_IncrementBeforeBuild="False" BuildVersion_DetectChanges="False" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 59 - 45
Fuel_ASO/Main.Designer.cs

@@ -30,7 +30,7 @@
         {
             this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
             this.statusBar = new System.Windows.Forms.StatusStrip();
             this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
             this.eprstat = new System.Windows.Forms.ToolStripStatusLabel();
@@ -74,8 +74,8 @@
             this.datestaDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.nomstaDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.text_file = new System.Windows.Forms.TextBox();
-            this.bt_fact = new System.Windows.Forms.Button();
             this.timerSigR = new System.Windows.Forms.Timer(this.components);
+            this.button1 = new System.Windows.Forms.Button();
             this.statusBar.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.tbepreuveBindingSource)).BeginInit();
@@ -110,10 +110,10 @@
             this.eprstat,
             this.stastat,
             this.tslbl1});
-            this.statusBar.Location = new System.Drawing.Point(0, 354);
+            this.statusBar.Location = new System.Drawing.Point(0, 556);
             this.statusBar.Name = "statusBar";
-            this.statusBar.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
-            this.statusBar.Size = new System.Drawing.Size(765, 22);
+            this.statusBar.Padding = new System.Windows.Forms.Padding(2, 0, 15, 0);
+            this.statusBar.Size = new System.Drawing.Size(1148, 22);
             this.statusBar.TabIndex = 0;
             this.statusBar.Text = "statusStrip1";
             // 
@@ -168,6 +168,7 @@
             // 
             this.mainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
             this.mainContainer.Location = new System.Drawing.Point(0, 0);
+            this.mainContainer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.mainContainer.Name = "mainContainer";
             this.mainContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
             // 
@@ -178,8 +179,9 @@
             // mainContainer.Panel2
             // 
             this.mainContainer.Panel2.Controls.Add(this.splitContainer1);
-            this.mainContainer.Size = new System.Drawing.Size(765, 354);
-            this.mainContainer.SplitterDistance = 26;
+            this.mainContainer.Size = new System.Drawing.Size(1148, 556);
+            this.mainContainer.SplitterDistance = 40;
+            this.mainContainer.SplitterWidth = 6;
             this.mainContainer.TabIndex = 13;
             // 
             // main_mnu
@@ -197,8 +199,9 @@
             this.mnu_about});
             this.main_mnu.Location = new System.Drawing.Point(0, 0);
             this.main_mnu.Name = "main_mnu";
+            this.main_mnu.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
             this.main_mnu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
-            this.main_mnu.Size = new System.Drawing.Size(765, 34);
+            this.main_mnu.Size = new System.Drawing.Size(1148, 34);
             this.main_mnu.TabIndex = 12;
             this.main_mnu.Text = "Menu";
             // 
@@ -342,7 +345,7 @@
             // 
             this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.splitContainer1.Location = new System.Drawing.Point(0, 0);
-            this.splitContainer1.Margin = new System.Windows.Forms.Padding(30, 30, 30, 30);
+            this.splitContainer1.Margin = new System.Windows.Forms.Padding(45, 46, 45, 46);
             this.splitContainer1.Name = "splitContainer1";
             // 
             // splitContainer1.Panel1
@@ -352,8 +355,9 @@
             // splitContainer1.Panel2
             // 
             this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
-            this.splitContainer1.Size = new System.Drawing.Size(765, 324);
-            this.splitContainer1.SplitterDistance = 252;
+            this.splitContainer1.Size = new System.Drawing.Size(1148, 510);
+            this.splitContainer1.SplitterDistance = 378;
+            this.splitContainer1.SplitterWidth = 6;
             this.splitContainer1.TabIndex = 10;
             // 
             // splitContainer3
@@ -361,6 +365,7 @@
             this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
             this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
             this.splitContainer3.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.splitContainer3.Name = "splitContainer3";
             this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
             // 
@@ -375,8 +380,9 @@
             this.splitContainer3.Panel2.Controls.Add(this.bt_retry);
             this.splitContainer3.Panel2.Controls.Add(this.bt_test);
             this.splitContainer3.Panel2.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.splitContainer3_Panel2_MouseDoubleClick);
-            this.splitContainer3.Size = new System.Drawing.Size(252, 324);
-            this.splitContainer3.SplitterDistance = 270;
+            this.splitContainer3.Size = new System.Drawing.Size(378, 510);
+            this.splitContainer3.SplitterDistance = 454;
+            this.splitContainer3.SplitterWidth = 6;
             this.splitContainer3.TabIndex = 1;
             // 
             // dg_epr
@@ -392,11 +398,12 @@
             this.dg_epr.DataSource = this.tbepreuveBindingSource;
             this.dg_epr.Dock = System.Windows.Forms.DockStyle.Fill;
             this.dg_epr.Location = new System.Drawing.Point(0, 0);
+            this.dg_epr.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.dg_epr.Name = "dg_epr";
             this.dg_epr.ReadOnly = true;
             this.dg_epr.RowHeadersWidth = 62;
             this.dg_epr.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
-            this.dg_epr.Size = new System.Drawing.Size(252, 270);
+            this.dg_epr.Size = new System.Drawing.Size(378, 454);
             this.dg_epr.TabIndex = 6;
             this.dg_epr.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dg_epr_CellMouseDoubleClick);
             // 
@@ -432,9 +439,10 @@
             // bt_doAll
             // 
             this.bt_doAll.Dock = System.Windows.Forms.DockStyle.Left;
-            this.bt_doAll.Location = new System.Drawing.Point(150, 0);
+            this.bt_doAll.Location = new System.Drawing.Point(225, 0);
+            this.bt_doAll.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.bt_doAll.Name = "bt_doAll";
-            this.bt_doAll.Size = new System.Drawing.Size(50, 50);
+            this.bt_doAll.Size = new System.Drawing.Size(75, 50);
             this.bt_doAll.TabIndex = 4;
             this.bt_doAll.Text = "ALL";
             this.bt_doAll.UseVisualStyleBackColor = true;
@@ -444,9 +452,10 @@
             // bt_do
             // 
             this.bt_do.Dock = System.Windows.Forms.DockStyle.Left;
-            this.bt_do.Location = new System.Drawing.Point(100, 0);
+            this.bt_do.Location = new System.Drawing.Point(150, 0);
+            this.bt_do.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.bt_do.Name = "bt_do";
-            this.bt_do.Size = new System.Drawing.Size(50, 50);
+            this.bt_do.Size = new System.Drawing.Size(75, 50);
             this.bt_do.TabIndex = 3;
             this.bt_do.Text = "Do";
             this.bt_do.UseVisualStyleBackColor = true;
@@ -456,9 +465,10 @@
             // bt_retry
             // 
             this.bt_retry.Dock = System.Windows.Forms.DockStyle.Left;
-            this.bt_retry.Location = new System.Drawing.Point(50, 0);
+            this.bt_retry.Location = new System.Drawing.Point(75, 0);
+            this.bt_retry.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.bt_retry.Name = "bt_retry";
-            this.bt_retry.Size = new System.Drawing.Size(50, 50);
+            this.bt_retry.Size = new System.Drawing.Size(75, 50);
             this.bt_retry.TabIndex = 1;
             this.bt_retry.Text = "ReTry SigR";
             this.bt_retry.UseVisualStyleBackColor = true;
@@ -469,8 +479,9 @@
             // 
             this.bt_test.Dock = System.Windows.Forms.DockStyle.Left;
             this.bt_test.Location = new System.Drawing.Point(0, 0);
+            this.bt_test.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.bt_test.Name = "bt_test";
-            this.bt_test.Size = new System.Drawing.Size(50, 50);
+            this.bt_test.Size = new System.Drawing.Size(75, 50);
             this.bt_test.TabIndex = 0;
             this.bt_test.Text = "Msg test";
             this.bt_test.UseVisualStyleBackColor = true;
@@ -482,6 +493,7 @@
             this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
             this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
             this.splitContainer2.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.splitContainer2.Name = "splitContainer2";
             this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
             // 
@@ -491,10 +503,12 @@
             // 
             // splitContainer2.Panel2
             // 
+            this.splitContainer2.Panel2.Controls.Add(this.button1);
             this.splitContainer2.Panel2.Controls.Add(this.text_file);
-            this.splitContainer2.Panel2.Controls.Add(this.bt_fact);
-            this.splitContainer2.Size = new System.Drawing.Size(509, 324);
-            this.splitContainer2.SplitterDistance = 270;
+            this.splitContainer2.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.splitContainer2_Panel2_Paint);
+            this.splitContainer2.Size = new System.Drawing.Size(764, 510);
+            this.splitContainer2.SplitterDistance = 454;
+            this.splitContainer2.SplitterWidth = 6;
             this.splitContainer2.TabIndex = 0;
             // 
             // dg_sta
@@ -511,11 +525,12 @@
             this.dg_sta.DataSource = this.tbstationBindingSource;
             this.dg_sta.Dock = System.Windows.Forms.DockStyle.Fill;
             this.dg_sta.Location = new System.Drawing.Point(0, 0);
+            this.dg_sta.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.dg_sta.Name = "dg_sta";
             this.dg_sta.ReadOnly = true;
             this.dg_sta.RowHeadersWidth = 62;
             this.dg_sta.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
-            this.dg_sta.Size = new System.Drawing.Size(509, 270);
+            this.dg_sta.Size = new System.Drawing.Size(764, 454);
             this.dg_sta.TabIndex = 7;
             this.dg_sta.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dg_sta_CellMouseDoubleClick);
             // 
@@ -541,9 +556,9 @@
             // datestaDataGridViewTextBoxColumn
             // 
             this.datestaDataGridViewTextBoxColumn.DataPropertyName = "date_sta";
-            dataGridViewCellStyle1.Format = "M";
-            dataGridViewCellStyle1.NullValue = null;
-            this.datestaDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle5.Format = "M";
+            dataGridViewCellStyle5.NullValue = null;
+            this.datestaDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle5;
             this.datestaDataGridViewTextBoxColumn.HeaderText = "Date";
             this.datestaDataGridViewTextBoxColumn.MinimumWidth = 8;
             this.datestaDataGridViewTextBoxColumn.Name = "datestaDataGridViewTextBoxColumn";
@@ -561,39 +576,38 @@
             // 
             // text_file
             // 
-            this.text_file.Location = new System.Drawing.Point(3, 11);
+            this.text_file.Location = new System.Drawing.Point(173, 5);
+            this.text_file.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.text_file.Name = "text_file";
-            this.text_file.Size = new System.Drawing.Size(374, 20);
+            this.text_file.Size = new System.Drawing.Size(559, 26);
             this.text_file.TabIndex = 3;
             this.text_file.Visible = false;
             // 
-            // bt_fact
-            // 
-            this.bt_fact.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.bt_fact.Location = new System.Drawing.Point(420, 10);
-            this.bt_fact.Name = "bt_fact";
-            this.bt_fact.Size = new System.Drawing.Size(75, 23);
-            this.bt_fact.TabIndex = 0;
-            this.bt_fact.Text = "Facture";
-            this.bt_fact.UseVisualStyleBackColor = true;
-            this.bt_fact.Click += new System.EventHandler(this.bt_fact_Click);
-            // 
             // timerSigR
             // 
             this.timerSigR.Enabled = true;
             this.timerSigR.Interval = 5000;
             this.timerSigR.Tick += new System.EventHandler(this.timerSigR_Tick);
             // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(20, 0);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(146, 50);
+            this.button1.TabIndex = 4;
+            this.button1.Text = "Facture";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click_1);
+            // 
             // Main
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(765, 376);
+            this.ClientSize = new System.Drawing.Size(1148, 578);
             this.Controls.Add(this.mainContainer);
             this.Controls.Add(this.statusBar);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.IsMdiContainer = true;
-            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Name = "Main";
             this.Tag = "vide";
             this.Text = "Aucune opération sélectionnée";
@@ -642,7 +656,6 @@
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
         private System.Windows.Forms.BindingSource tbstationBindingSource;
         private System.Windows.Forms.SplitContainer mainContainer;
-        private System.Windows.Forms.Button bt_fact;
         private System.Windows.Forms.DataGridViewTextBoxColumn nomstaDataGridViewTextBoxColumn;
         private System.Windows.Forms.DataGridViewTextBoxColumn datestaDataGridViewTextBoxColumn;
         private System.Windows.Forms.DataGridViewTextBoxColumn etpstaDataGridViewTextBoxColumn;
@@ -680,5 +693,6 @@
         private System.Windows.Forms.TextBox text_file;
         private System.Windows.Forms.ToolStripButton mnu_verif;
         private System.Windows.Forms.ToolStripMenuItem parisNice17ToolStripMenuItem;
+        private System.Windows.Forms.Button button1;
     }
 }

+ 12 - 2
Fuel_ASO/Main.cs

@@ -445,7 +445,10 @@ namespace Fuel01
 
         #endregion
 
-        private void bt_fact_Click(object sender, EventArgs e)
+        private void bt_fact_Click(object sender, EventArgs e) { }
+
+
+        private void DoFact(object sender, EventArgs e)
         {
             DataSet1.tb_stationRow mydata = null;
             DataRowView myrow = tbstationBindingSource.Current as DataRowView;
@@ -458,7 +461,6 @@ namespace Fuel01
             else
                 MessageBox.Show("Pas de station séléctionée!");
 
-
         }
 
 
@@ -633,6 +635,14 @@ namespace Fuel01
 
         }
 
+        private void splitContainer2_Panel2_Paint(object sender, PaintEventArgs e)
+        {
+
+        }
 
+        private void button1_Click_1(object sender, EventArgs e)
+        {
+            DoFact(sender, e);  
+        }
     }
 }

+ 6 - 0
Fuel_ASO/Main.resx

@@ -135,6 +135,12 @@
   <metadata name="main_mnu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>1092, 17</value>
   </metadata>
+  <metadata name="key_epr.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="abrev_epr.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="mnu_ope.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

+ 2 - 2
Fuel_ASO/Models/Achats3.cs

@@ -8,8 +8,8 @@
         public string libel { get; set; }
         public string moment { get; set; }
         public float montantTTC { get; set; }
-        public string pu { get; set; }
-        public string qtty { get; set; }
+        public float pu { get; set; }
+        public float qtty { get; set; }
 
     }
 

+ 22 - 0
Fuel_ASO/Models/Vente.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+
+namespace Fuel01
+{
+    public class Vente
+    {
+        public string epreuve_vt { get; set; } = string.Empty;
+        public string station_vt { get; set; }
+        public String vehi_vt { get; set; }
+        public string prod_vt { get; set; }
+        public DateTime date_vt { get; set; }
+        public float qtt_vt { get; set; }
+        public float pu_vt { get; set; }
+        public float ht_vt { get; set; }
+        public float tva_vt { get; set; }
+        public float ttc_vt { get; set; }
+        public float txtva_vt { get; set; }
+
+    }
+
+}

+ 1 - 10
Fuel_ASO/f_presta.cs

@@ -80,16 +80,7 @@ namespace Fuel01
 
         private void init_list_produit()
         {
-            XDocument xRoot = XDocument.Load(Program.folder + @"\param\produit.xml");
-            var data = from item in xRoot.Descendants("tb_prod")
-                       orderby item.Element("type_prod").Value, item.Element("lib_prod").Value
-                       select new Produit()
-                       {
-                           key_prod = item.Element("key_prod").Value,
-                           lib_prod = item.Element("lib_prod").Value,
-                           type_prod = item.Element("type_prod").Value
-                       };
-            lproduit = data.ToList();
+           lproduit=DbUtil.GetProduits();
 
             dg_presta_prod.Items.Clear();
             dg_presta_prod.DataSource = lproduit;

+ 41 - 35
Fuel_ASO/f_saisie2.cs

@@ -23,7 +23,7 @@ namespace Fuel01
         List<DataSet1.tb_prestaRow> Ldies = new List<DataSet1.tb_prestaRow>();  //Liste diesel
         List<DataSet1.tb_prestaRow> Lprod = new List<DataSet1.tb_prestaRow>();      //Liste des prestations
         List<DataSet1.tb_prestaRow> Lmycarb = new List<DataSet1.tb_prestaRow>(); //Liste tous les carbuants
-
+        List<Produit> lproduit = new List<Produit>();
         DataSet1.tb_stationRow myStation = null;
         DataSet1.tb_vehiRow myVehi = null;
 
@@ -31,7 +31,7 @@ namespace Fuel01
         bool hasChanged = false;
         bool isDiesel = false;
         int indiceCarb = -1;
-        string id_vehi="";
+        string id_vehi = "";
 
         public f_saisie2()
         {
@@ -44,7 +44,7 @@ namespace Fuel01
             Program.subfolder = Program.folder + @"\" + Program.key_ope;
 
             if (File.Exists(Program.subfolder + @"\vehicule.json"))
-                tb_vehi = DbUtil.LoadFromJson<DataSet1.tb_vehiDataTable>(Program.subfolder + @"\Vehicule.json", tb_vehi); 
+                tb_vehi = DbUtil.LoadFromJson<DataSet1.tb_vehiDataTable>(Program.subfolder + @"\Vehicule.json", tb_vehi);
             tbvehiBindingSource.DataSource = tb_vehi;
 
 
@@ -57,7 +57,7 @@ namespace Fuel01
             if (myStation != null)
             {
                 tbstationBindingSource.MoveFirst();
-                while (true) 
+                while (true)
                 {
                     rowView = tbstationBindingSource.Current as DataRowView;
                     if (myStation != rowView.Row)
@@ -68,19 +68,23 @@ namespace Fuel01
                     else
                         break;
                 }
+            }
 
-
-
+            if (File.Exists(Program.folder + @"\param\produit.xml"))
+            {
+                lproduit = DbUtil.GetProduits();
             }
 
             if (File.Exists(Program.subfolder + @"\presta.json"))
-                tb_presta = DbUtil.LoadFromJson<DataSet1.tb_prestaDataTable>(Program.subfolder + @"\presta.json", tb_presta);
+            {
+                tb_presta = DbUtil.LoadPrestaFromJson(Program.subfolder + @"\presta.json", lproduit);
+            }
 
             tbprestaBindingSource.DataSource = tb_presta;
 
             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;
 
@@ -92,7 +96,7 @@ namespace Fuel01
 
             tbventetmpbindingSource.DataSource = tb_ventetmp;
 
-            lblstadt.Text= myStation.date_sta.ToString("dd/MM/yy") + " " + myStation.nom_sta;
+            lblstadt.Text = myStation.date_sta.ToString("dd/MM/yy") + " " + myStation.nom_sta;
 
             turnBlock(false);
         }
@@ -133,7 +137,7 @@ namespace Fuel01
 
             aff_zero();
 
-          
+
 
         }
 
@@ -154,7 +158,7 @@ namespace Fuel01
                 rdCarb1.Enabled = true;
                 rdCarb1.Text = Lmycarb[0].prod_pr;
                 rdCarb1.Checked = (curcarb == rdCarb1.Text);
-                if ( rdCarb1.Checked ) rdCarb_CheckedChanged(rdCarb1, null);
+                if (rdCarb1.Checked) rdCarb_CheckedChanged(rdCarb1, null);
             }
             if (Lmycarb.Count >= 2)
             {
@@ -177,7 +181,7 @@ namespace Fuel01
                 rdCarb4.Checked = (curcarb == rdCarb4.Text);
                 if (rdCarb4.Checked) rdCarb_CheckedChanged(rdCarb4, null);
             }
-            if (Lmycarb.Count >=5 )
+            if (Lmycarb.Count >= 5)
             {
                 rdCarb5.Enabled = true;
                 rdCarb5.Text = Lmycarb[4].prod_pr;
@@ -204,13 +208,13 @@ namespace Fuel01
             chkPrFree.Enabled = true;
             if (Lprod.Count >= 1)
             {
-                chkPr1.Enabled =  true; //nuTot1.Enabled = nuQtt1.Enabled = true;
+                chkPr1.Enabled = true; //nuTot1.Enabled = nuQtt1.Enabled = true;
                 chkPr1.Text = Lprod[0].prod_pr;
                 nuPr1.Value = Lprod[0].ttc_pr;
             }
             if (Lprod.Count >= 2)
             {
-                chkPr2.Enabled =  true; //nuTot2.Enabled = nuQtt2.Enabled = true;
+                chkPr2.Enabled = true; //nuTot2.Enabled = nuQtt2.Enabled = true;
                 chkPr2.Text = Lprod[1].prod_pr;
                 nuPr2.Value = Lprod[1].ttc_pr;
             }
@@ -226,7 +230,7 @@ namespace Fuel01
 
         private void nu_ValueChanged(object sender, EventArgs e)
         {
-            if (Retry++>15) //on evite la boucle infinie
+            if (Retry++ > 15) //on evite la boucle infinie
             {
                 Retry = 0;
                 return;
@@ -242,7 +246,7 @@ namespace Fuel01
                     }
                     break;
                 case "nuVolCarb":
-                        nuMntCarb.Value = nuVolCarb.Value * nuPxCarb.Value;
+                    nuMntCarb.Value = nuVolCarb.Value * nuPxCarb.Value;
                     break;
                 case "nuPr1":
                 case "nuTot1":
@@ -252,7 +256,7 @@ namespace Fuel01
                     }
                     break;
                 case "nuQtt1":
-                        nuTot1.Value = nuQtt1.Value * nuPr1.Value;
+                    nuTot1.Value = nuQtt1.Value * nuPr1.Value;
                     break;
                 case "nuPr2":
                 case "nuTot2":
@@ -277,11 +281,11 @@ namespace Fuel01
                     break;
                 case "nuPrFree":
                 case "nuQttFree":
-                     nuTotFree.Value =  nuPrFree.Value * nuQttFree.Value;
+                    nuTotFree.Value = nuPrFree.Value * nuQttFree.Value;
                     break;
                 case "nuTotFree":
                     nuQttFree.Value = 1;
-                    nuPrFree.Value= nuTotFree.Value / nuQttFree.Value;
+                    nuPrFree.Value = nuTotFree.Value / nuQttFree.Value;
                     break;
             }
         }
@@ -291,7 +295,7 @@ namespace Fuel01
             if (((RadioButton)sender).Checked == true)
             {
                 //on récupère le nom pour l'indice du tableau
-                indiceCarb = Convert.ToInt16(((RadioButton)sender).Name.Substring(6, 1))-1;
+                indiceCarb = Convert.ToInt16(((RadioButton)sender).Name.Substring(6, 1)) - 1;
                 if (indiceCarb < Lmycarb.Count && indiceCarb >= 0)
                     nuPxCarb.Value = Lmycarb[indiceCarb].ttc_pr;
                 else
@@ -311,7 +315,7 @@ namespace Fuel01
 
             if (chkPrFree.Checked)
             {
-                if ( nuPrFree.Value * nuQttFree.Value ==0   ||  txtPrFree.Text.Trim(new char[]{ ' ','a' })=="" )
+                if (nuPrFree.Value * nuQttFree.Value == 0 || txtPrFree.Text.Trim(new char[] { ' ', 'a' }) == "")
                 {
                     MessageBox.Show("Incohérence dans les données libres (libellé ou prix ou qtt ou tva");
                     return;
@@ -321,7 +325,7 @@ namespace Fuel01
             if (chkPr1.Checked) ajpresta(Lprod[0], nuPr1.Value, nuQtt1.Value, nuTot1.Text);
             if (chkPr2.Checked) ajpresta(Lprod[1], nuPr2.Value, nuQtt2.Value, nuTot2.Text);
             if (chkPr3.Checked) ajpresta(Lprod[2], nuPr3.Value, nuQtt3.Value, nuTot3.Text);
-            if (chkPrFree.Checked) ajpresta(txtPrFree.Text, nuPrFree.Value, nuQttFree.Value, nuTotFree.Text,numTvaFree.Value);
+            if (chkPrFree.Checked) ajpresta(txtPrFree.Text, nuPrFree.Value, nuQttFree.Value, nuTotFree.Text, numTvaFree.Value);
             f_ticket ticket = new f_ticket(myStation, myVehi, tb_ventetmp);
             if (ticket.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
@@ -344,14 +348,14 @@ namespace Fuel01
         /// <param name="pu"></param>
         /// <param name="qtt"></param>
         /// <param name="total_str"></param>
-        private void ajpresta(DataSet1.tb_prestaRow prRow,  decimal pu, decimal qtt, string total_str)
+        private void ajpresta(DataSet1.tb_prestaRow prRow, decimal pu, decimal qtt, string total_str)
         {
             decimal tva = 0;
             decimal totht = 0;
             decimal total = Convert.ToDecimal(total_str);
             string lib = prRow.prod_pr;
             tva = prRow.tva_pr;
-            totht = Math.Round(total / (1 + tva / 100),2);
+            totht = Math.Round(total / (1 + tva / 100), 2);
             DateTime dt = DateTime.Now;
             tb_ventetmp.Addtb_venteRow(Program.key_ope, Program.key_sta, id_vehi, lib, dt, qtt, pu, tva, totht, total);
         }
@@ -363,13 +367,13 @@ namespace Fuel01
         /// <param name="qtt"></param>
         /// <param name="total_str"></param>
         /// <param name="tva"></param>
-        private void ajpresta(string lib, decimal pu, decimal qtt, string total_str,decimal tva)
+        private void ajpresta(string lib, decimal pu, decimal qtt, string total_str, decimal tva)
         {
             decimal totht = 0;
             decimal total = Convert.ToDecimal(total_str);
             totht = Math.Round(total / (1 + tva / 100), 2);
             DateTime dt = DateTime.Now;
-            tb_ventetmp.Addtb_venteRow(Program.key_ope, Program.key_sta, id_vehi, lib, dt, qtt, pu, tva, totht,  total);
+            tb_ventetmp.Addtb_venteRow(Program.key_ope, Program.key_sta, id_vehi, lib, dt, qtt, pu, tva, totht, total);
         }
 
         private void bt_search_Click(object sender, EventArgs e)
@@ -381,7 +385,7 @@ namespace Fuel01
                 myVehi = tb_vehi.FirstOrDefault(v => v.num_vehi == num && v.categ_vehi == (rdAuto.Checked ? "A" : "M"));
                 if (myVehi != null)
                 {
-                    lbl_pilote.Text = myVehi.cond_vehi ;
+                    lbl_pilote.Text = myVehi.cond_vehi;
                     isDiesel = myVehi.carbu_vehi.ToUpper().Contains("DIESEL");
                     aff_carb(myVehi.carbu_vehi);
                     aff_prod();
@@ -413,13 +417,13 @@ namespace Fuel01
 
         private void aff_zero()
         {
-            chkPr1.Enabled = chkPr2.Enabled = chkPr3.Enabled =  chkPrFree.Enabled= false;
+            chkPr1.Enabled = chkPr2.Enabled = chkPr3.Enabled = chkPrFree.Enabled = false;
             chkPr1.Checked = chkPr2.Checked = chkPr3.Checked = chkPrFree.Checked = false;
             nuPr1.Enabled = nuPr2.Enabled = nuPr3.Enabled = false;
             nuQtt1.Enabled = nuQtt2.Enabled = nuQtt3.Enabled = false;
             nuTot1.Enabled = nuTot2.Enabled = nuTot3.Enabled = false;
             chkPr1.Text = chkPr2.Text = chkPr3.Text = txtPrFree.Text = "";
-            nuVolCarb.Value= nuPr1.Value = nuPr2.Value = nuPr3.Value = nuPrFree.Value = 0;
+            nuVolCarb.Value = nuPr1.Value = nuPr2.Value = nuPr3.Value = nuPrFree.Value = 0;
             nuQtt1.Value = nuQtt2.Value = nuQtt3.Value = nuQttFree.Value = 0;
             nuTot1.Value = nuTot2.Value = nuTot3.Value = 0;
             nuPxCarb.Value = nuMntCarb.Value = nuPxCarb.Value = 0;
@@ -428,10 +432,10 @@ namespace Fuel01
 
 
         private void text_no_KeyUp(object sender, KeyEventArgs e)
-       {
-           if (e.KeyValue == 13)
-               bt_search_Click(null, null);
-       }
+        {
+            if (e.KeyValue == 13)
+                bt_search_Click(null, null);
+        }
 
         private void bt_save_Click(object sender, EventArgs e)
         {
@@ -458,8 +462,8 @@ namespace Fuel01
 
         private void chkProduit_CheckedChanged(object sender, EventArgs e)
         {
-            bool Checked= ((CheckBox)sender).Checked;
-            var Name= ((CheckBox)sender).Name;
+            bool Checked = ((CheckBox)sender).Checked;
+            var Name = ((CheckBox)sender).Name;
             switch (Name)
             {
                 case "chkPr1":
@@ -476,5 +480,7 @@ namespace Fuel01
                     break;
             }
         }
+
+
     }
 }

+ 9 - 9
Fuel_ASO/f_tools.Designer.cs

@@ -91,7 +91,7 @@
             this.statusStrip1.Location = new System.Drawing.Point(0, 703);
             this.statusStrip1.Name = "statusStrip1";
             this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 21, 0);
-            this.statusStrip1.Size = new System.Drawing.Size(1116, 22);
+            this.statusStrip1.Size = new System.Drawing.Size(1431, 22);
             this.statusStrip1.TabIndex = 0;
             this.statusStrip1.Text = "statusStrip1";
             // 
@@ -118,7 +118,7 @@
             // splitContainer1.Panel2
             // 
             this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
-            this.splitContainer1.Size = new System.Drawing.Size(1116, 703);
+            this.splitContainer1.Size = new System.Drawing.Size(1431, 703);
             this.splitContainer1.SplitterDistance = 181;
             this.splitContainer1.SplitterWidth = 6;
             this.splitContainer1.TabIndex = 1;
@@ -189,7 +189,7 @@
             // splitContainer2.Panel2
             // 
             this.splitContainer2.Panel2.Controls.Add(this.splitContainer3);
-            this.splitContainer2.Size = new System.Drawing.Size(929, 703);
+            this.splitContainer2.Size = new System.Drawing.Size(1244, 703);
             this.splitContainer2.SplitterDistance = 26;
             this.splitContainer2.SplitterWidth = 6;
             this.splitContainer2.TabIndex = 4;
@@ -220,8 +220,8 @@
             // splitContainer3.Panel2
             // 
             this.splitContainer3.Panel2.Controls.Add(this.splitContainer4);
-            this.splitContainer3.Size = new System.Drawing.Size(929, 671);
-            this.splitContainer3.SplitterDistance = 212;
+            this.splitContainer3.Size = new System.Drawing.Size(1244, 671);
+            this.splitContainer3.SplitterDistance = 152;
             this.splitContainer3.SplitterWidth = 6;
             this.splitContainer3.TabIndex = 0;
             // 
@@ -236,7 +236,7 @@
             this.textResult.Name = "textResult";
             this.textResult.ReadOnly = true;
             this.textResult.ScrollBars = System.Windows.Forms.ScrollBars.Both;
-            this.textResult.Size = new System.Drawing.Size(929, 212);
+            this.textResult.Size = new System.Drawing.Size(1244, 152);
             this.textResult.TabIndex = 1;
             this.toolTip1.SetToolTip(this.textResult, "Affiche les informations de traitement");
             // 
@@ -257,7 +257,7 @@
             // splitContainer4.Panel2
             // 
             this.splitContainer4.Panel2.Controls.Add(this.dg_vente);
-            this.splitContainer4.Size = new System.Drawing.Size(929, 453);
+            this.splitContainer4.Size = new System.Drawing.Size(1244, 513);
             this.splitContainer4.SplitterDistance = 28;
             this.splitContainer4.SplitterWidth = 6;
             this.splitContainer4.TabIndex = 0;
@@ -311,7 +311,7 @@
             this.dg_vente.Name = "dg_vente";
             this.dg_vente.ReadOnly = true;
             this.dg_vente.RowHeadersWidth = 62;
-            this.dg_vente.Size = new System.Drawing.Size(929, 419);
+            this.dg_vente.Size = new System.Drawing.Size(1244, 479);
             this.dg_vente.TabIndex = 2;
             this.dg_vente.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dg_vente_CellEndEdit);
             // 
@@ -432,7 +432,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1116, 725);
+            this.ClientSize = new System.Drawing.Size(1431, 725);
             this.Controls.Add(this.splitContainer1);
             this.Controls.Add(this.statusStrip1);
             this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);

+ 264 - 142
Fuel_ASO/f_tools.cs

@@ -4,12 +4,14 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using System.Xml.Linq;
 using System.Xml.Serialization;
 
 namespace Fuel01
@@ -21,24 +23,41 @@ namespace Fuel01
         DataSet1.tb_venteDataTable tb_vente = new DataSet1.tb_venteDataTable();
         DataSet1.tb_prestaDataTable tb_presta = new DataSet1.tb_prestaDataTable();
         List<string> files2move = new List<string>();
-        bool hasChanged = false;
 
+        bool hasChanged = false;
+        List<Produit> lproduit = new List<Produit>();
+        List<Vente> Ventes = new List<Vente>();
         public f_tools()
         {
             InitializeComponent();
+            
             Program.subfolder = Program.folder + @"\" + Program.key_ope;
+
             if (!Directory.Exists(Program.subfolder))
                 Directory.CreateDirectory(Program.subfolder);
 
+            if (File.Exists(Program.folder + @"\param\produit.xml"))
+            {
+                lproduit = DbUtil.GetProduits();
+            }
+
             if (File.Exists(Program.subfolder + @"\presta.json"))
-                tb_presta = DbUtil.LoadFromJson<DataSet1.tb_prestaDataTable>(Program.subfolder + @"\presta.json", tb_presta);
+            {
+                tb_presta = DbUtil.LoadPrestaFromJson(Program.subfolder + @"\presta.json", lproduit);
+
+            }
         }
 
+        /// <summary>
+        /// Appelle le serveur pour récupérer les fichiers
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void bt_getdatas_Click(object sender, EventArgs e)
         {
             textResult.Text = "";
             line_res("Connexion au serveur");
-            string url = Properties.Settings.Default.server_adress_datas ;
+            string url = Properties.Settings.Default.server_adress_datas;
             List<string> lines = readHttp_Dir(url);
             copyHttp(lines);
             line_res("F I N");
@@ -52,27 +71,37 @@ namespace Fuel01
             textResult.Text = "";
             line_res("Début");
             string[] files = Directory.GetFiles(Program.folder + @"\in", "*.json ");
+            List<Achats3> allAchats = new List<Achats3>();
             foreach (string file in files)
             {
-                StreamReader readStream = new StreamReader(file, Encoding.UTF8);
-                if (file.ToUpper().Contains(".GLOBAL."))
-                    streamtolist_glob(readStream, file);
-                else
-                    streamtolist_uniq(readStream, file);
-                readStream.Close();
+                var content = File.ReadAllText(file);
+                var achats = JsonConvert.DeserializeObject<List<Achats3>>(content);
+                allAchats.AddRange(achats);
             }
+
+            Ventes = ConvertAchatsToVentes(Ventes, allAchats);
+
             line_res("F I N");
-            if (err == 0 && ok == false)
+            if (err == 0 && !ok)
             {
                 if (MessageBox.Show("Voulez-vous enregister les achats", "Aucune erreur", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                 {
                     ok = true;
-                    init_vente();
+                    load_vente();
                     bt_trait_Click(sender, e);
                     tb_vente.WriteXml(Program.subfolder + @"\vente.xml", XmlWriteMode.WriteSchema);
+                    //File.WriteAllText(Program.subfolder + @"\vente.json", JsonConvert.SerializeObject(allAchats));
                     hasChanged = false;
                     foreach (string file in files2move)
                         File.Move(file, file.Replace(Program.folder + @"\in", Program.folder + @"\in\done"));
+
+                    foreach(var vente in Ventes)
+                    {
+                        traite(vente);
+                    }
+
+                    DbUtil.SaveToJson<DataSet1.tb_venteDataTable>(Program.subfolder + @"\vente.json", tb_vente);
+                    load_vente();
                 }
             }
             else
@@ -80,18 +109,50 @@ namespace Fuel01
             this.Cursor = Cursors.Default;
         }
 
-        private void init_vente()
+        private void load_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;
+                Ventes = JsonConvert.DeserializeObject<List<Vente>>(File.ReadAllText(Program.subfolder + @"\vente.json"));
+                if (Ventes != null && Ventes.Count > 0)
+                {
+                    tb_vente.AcceptChanges();
+                    tbventeBindingSource.DataSource = tb_vente;
+                }
+            }
+        }
 
+        private void save_vente()
+        {
+            File.WriteAllText(Program.subfolder + @"\vente.json", JsonConvert.SerializeObject(Ventes));
+        }
+
+        private List<Vente> ConvertAchatsToVentes(List<Vente> ventes, List<Achats3> achats)
+        {
+            foreach (var achat in achats)
+            {
+                var vente = new Vente
+                {
+                    date_vt = DateTime.ParseExact(achat.moment, "yyyy-MM-ddTHH:mm:ss.ffffff", CultureInfo.InvariantCulture),
+                    epreuve_vt = Program.key_ope,
+                    ht_vt = 0,
+                    prod_vt = achat.libel,
+                    pu_vt = achat.pu,
+                    qtt_vt = achat.qtty,
+                    station_vt = achat.stationKey.ToString(),
+                    ttc_vt = achat.montantTTC,
+                    tva_vt = 0,
+                    vehi_vt = achat.bandeau
+                };
+                ventes.Add(vente);
+            }
+            return ventes;
         }
 
         /// <summary>
-        /// Récupère les nom de fichiers à partir d'un repertoire listé en HTML
+        /// Récupère les noms des fichiers à partir d'un repertoire listé en HTML
         /// </summary>
         /// <param name="url_txt">URL à lister</param>
         /// <returns>liste  Urls des fichiers distants</returns>
@@ -111,36 +172,28 @@ namespace Fuel01
                 readStream.Close();
                 var files = JsonConvert.DeserializeObject<List<string>>(block);
 
-                foreach(var file in files)
+                foreach (var file in files.Where(x => x.EndsWith(".json", StringComparison.OrdinalIgnoreCase)))
                 {
-
-                    var fileUrl = Path.Combine(url_txt, file);
-                    request = (HttpWebRequest)WebRequest.Create(fileUrl);
-                    response = (HttpWebResponse)request.GetResponse();
-                    receiveStream = response.GetResponseStream();
-                    readStream = new StreamReader(receiveStream, Encoding.UTF8);
-                    block = readStream.ReadToEnd();
-                    response.Close();
-                    readStream.Close();
-                    Console.WriteLine(block);
-                    var json = JsonConvert.DeserializeObject<string>(block);
-                    var achats = JsonConvert.DeserializeObject<List<Achats3>>(json);
+                    try
+                    {
+                        var fileUrl = Path.Combine(url_txt, file);
+                        request = (HttpWebRequest)WebRequest.Create(fileUrl);
+                        response = (HttpWebResponse)request.GetResponse();
+                        receiveStream = response.GetResponseStream();
+                        readStream = new StreamReader(receiveStream, Encoding.UTF8);
+                        block = readStream.ReadToEnd();
+                        response.Close();
+                        readStream.Close();
+                        Console.WriteLine(block);
+                        var json = JsonConvert.DeserializeObject<string>(block);
+                        _ = JsonConvert.DeserializeObject<List<Achats3>>(json);
+                        lines.Add("http://" + response.ResponseUri.Host + "/Achats/" + file);
+                    }
+                    catch (Exception ex)
+                    {
+                    }
 
                 }
-
-
-                //int posd = 0;
-                //int posf = 0;
-                //while ((posd = block.IndexOf(dep, posd)) > 0)
-                //{
-                //    Console.WriteLine(posd);
-                //    posd += dep.Length;
-                //    posf = block.IndexOf(fin, posd);
-                //    if (posf < 0) break;
-                //    string line = block.Substring(posd, posf - posd);
-                //    if (line.Contains("/Station_") && line.ToUpper().EndsWith(".XML"))
-                //        lines.Add("http://" + response.ResponseUri.Host + line);
-                //}
             }
             catch (System.Net.WebException ex)
             {
@@ -186,117 +239,186 @@ namespace Fuel01
             }
         }
 
-        private void streamtolist_glob(StreamReader readStream, string file)
+        //private void streamtolist_globXMLS(StreamReader readStream, string file)
+        //{
+
+        //    XmlSerializer xs = new XmlSerializer(typeof(List<Achats>));
+        //    List<Achats> ListAchats = new List<Achats>();
+        //    try
+        //    {
+        //        using (readStream)
+        //            ListAchats = xs.Deserialize(readStream) as List<Achats>;
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        err++;
+        //        line_res("ERREUR Fichier : " + file);
+        //        MessageBox.Show(file + "\r\n" + ex.Message, "streamtolist_glob");
+        //    }
+
+        //    foreach (Achats ac in ListAchats)
+        //    {
+        //        line_res(string.Format("GLOBAL Date {0} Produit {1}  PTTC {2}", ac.Date, ac.KindCarbu, ac.MontantCarbu));
+        //        if (ok)
+        //        {
+        //            traite(ac);
+        //        }
+        //    }
+        //    if (ok && err == 0) files2move.Add(file);  // Normalement err toujours à zero pour autoriser le traitement cad ok=true;
+
+        //}
+
+        //private void streamtolist(StreamReader readStream, string file)
+        //{
+
+
+
+        //}
+
+        //private void streamtolist_uniq(StreamReader readStream, string file)
+        //{
+        //    XmlSerializer xs = new XmlSerializer(typeof(Achats));
+        //    Achats ac = null;
+        //    try
+        //    {
+        //        using (readStream)
+        //            ac = xs.Deserialize(readStream) as Achats;
+
+        //        line_res(string.Format("UNIQ Date {0} Produit {1}  PTTC {2}", ac.Date, ac.KindCarbu, ac.MontantCarbu));
+        //        if (ok)
+        //        {
+        //            traite(ac);
+        //            files2move.Add(file);
+        //        }
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        err++;
+        //        line_res("ERREUR Fichier : " + file);
+        //        MessageBox.Show(file + "\r\n" + ex.Message, "streamtolist_uniq");
+        //    }
+        //}
+
+        //private void traite(Achats ac)
+        //{
+        //    if (ac.Volume > 0)
+        //    {
+        //        tsLbl1.Text = string.Format("Date {0} Bandeau {1}  Type {2}  Volume {3}  Total {4}", ac.Date, ac.Bandeau, ac.KindCarbu, ac.Volume, ac.MontantTotal);
+        //        Application.DoEvents();
+        //        if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.StationId.ToString(), ac.Bandeau, ac.KindCarbu, ac.Date) == null)
+        //        {
+        //            DataSet1.tb_venteRow myrow = tb_vente.NewRow() as DataSet1.tb_venteRow;
+
+        //            DataSet1.tb_prestaRow mydata = null;
+        //            mydata = tb_presta.FindBysta_prprod_pr(ac.StationId.ToString(), ac.KindCarbu);
+        //            if (mydata != null)
+        //                ac.TxTva = (float)mydata.tva_pr;
+        //            else
+        //                ac.TxTva = 0;
+
+        //            myrow["epreuve_vt"] = Program.key_ope;
+        //            myrow["station_vt"] = ac.StationId.ToString();
+        //            myrow["vehi_vt"] = ac.Bandeau;
+        //            myrow["prod_vt"] = ac.KindCarbu;
+        //            myrow["date_vt"] = ac.Date;
+        //            myrow["qtt_vt"] = Math.Round(ac.Volume, 2);
+        //            myrow["pu_vt"] = Math.Round(ac.PrixCarbu, 3);
+        //            myrow["tva_vt"] = ac.TxTva;
+        //            myrow["ttc_vt"] = Math.Round(ac.MontantCarbu, 2);
+        //            myrow["ht_vt"] = Math.Round(ac.MontantCarbu / (1 + (ac.TxTva / 100)), 2);
+
+        //            tb_vente.Addtb_venteRow(myrow);
+        //            hasChanged = true;
+        //        }
+        //    }
+        //    foreach (PrestasFournies pf in ac.Prestas)
+        //    {
+        //        if (pf.Name != null)
+        //        {
+        //            pf.TxTva = 0;
+        //            string newName = pf.Name.ToUpper().Contains("FREE") ? (pf.Libel == null ? "Produit inconnu" : pf.Libel) : pf.Name;
+        //            if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.StationId.ToString(), ac.Bandeau, newName, ac.Date) == null)
+        //            {
+        //                DataSet1.tb_venteRow myrow = tb_vente.NewRow() as DataSet1.tb_venteRow;
+        //                myrow["epreuve_vt"] = Program.key_ope;
+        //                myrow["station_vt"] = ac.StationId.ToString();
+        //                myrow["vehi_vt"] = ac.Bandeau;
+        //                myrow["prod_vt"] = newName;
+        //                myrow["date_vt"] = ac.Date;
+        //                myrow["qtt_vt"] = Math.Round(pf.Quantity, 2);
+        //                myrow["pu_vt"] = Math.Round(pf.PrixUnitaire, 2);
+        //                myrow["tva_vt"] = pf.TxTva; // pf.TxTva == 0 ? 20 : pf.TxTva; ;
+        //                myrow["ttc_vt"] = Math.Round(pf.Total, 2);
+        //                myrow["ht_vt"] = Math.Round(pf.Total, 2);  // Math.Round(pf.Total / (1 + ( pf.TxTva / 100)), 2);
+
+        //                tb_vente.Addtb_venteRow(myrow);
+        //                hasChanged = true;
+        //            }
+        //        }
+
+        //    }
+        //    tsLbl1.Text = "";
+        //}
+
+        private void traite(Vente ac)
         {
-
-            XmlSerializer xs = new XmlSerializer(typeof(List<Achats>));
-            List<Achats> ListAchats = new List<Achats>();
-            try
-            {
-                using (readStream)
-                    ListAchats = xs.Deserialize(readStream) as List<Achats>;
-            }
-            catch (Exception ex)
-            {
-                err++;
-                line_res("ERREUR Fichier : " + file);
-                MessageBox.Show(file + "\r\n" + ex.Message, "streamtolist_glob");
-            }
-
-            foreach (Achats ac in ListAchats)
-            {
-                line_res(string.Format("GLOBAL Date {0} Produit {1}  PTTC {2}", ac.Date, ac.KindCarbu, ac.MontantCarbu));
-                if (ok)
-                {
-                    traite(ac);
-                }
-            }
-            if (ok && err == 0) files2move.Add(file);  // Normalement err toujours à zero pour autoriser le traitement cad ok=true;
-
-        }
-
-        private void streamtolist_uniq(StreamReader readStream, string file)
-        {
-            XmlSerializer xs = new XmlSerializer(typeof(Achats));
-            Achats ac = null;
-            try
+            if (ac.qtt_vt > 0)
             {
-                using (readStream)
-                    ac = xs.Deserialize(readStream) as Achats;
-
-                line_res(string.Format("UNIQ Date {0} Produit {1}  PTTC {2}", ac.Date, ac.KindCarbu, ac.MontantCarbu));
-                if (ok)
-                {
-                    traite(ac);
-                    files2move.Add(file);
-                }
-            }
-            catch (Exception ex)
-            {
-                err++;
-                line_res("ERREUR Fichier : " + file);
-                MessageBox.Show(file + "\r\n" + ex.Message, "streamtolist_uniq");
-            }
-        }
-
-        private void traite(Achats ac)
-        {
-            if (ac.Volume > 0)
-            {
-                tsLbl1.Text = string.Format("Date {0} Bandeau {1}  Type {2}  Volume {3}  Total {4}", ac.Date, ac.Bandeau, ac.KindCarbu, ac.Volume, ac.MontantTotal);
+                tsLbl1.Text = string.Format("Date {0} Bandeau {1}  Type {2}  Volume {3}  Total {4}", ac.date_vt, ac.vehi_vt, ac.prod_vt, ac.qtt_vt, ac.ttc_vt);
                 Application.DoEvents();
-                if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.StationId.ToString(), ac.Bandeau, ac.KindCarbu, ac.Date) == null)
+                if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.station_vt, ac.vehi_vt, ac.prod_vt, ac.date_vt) == null)
                 {
                     DataSet1.tb_venteRow myrow = tb_vente.NewRow() as DataSet1.tb_venteRow;
 
                     DataSet1.tb_prestaRow mydata = null;
-                    mydata = tb_presta.FindBysta_prprod_pr(ac.StationId.ToString(), ac.KindCarbu);
-                    if (mydata != null)
-                        ac.TxTva = (float)mydata.tva_pr;
+                    mydata = tb_presta.FindBysta_prprod_pr(ac.station_vt, ac.prod_vt);
+                    if (mydata != null )
+                        ac.txtva_vt = (float)mydata.tva_pr;
                     else
-                        ac.TxTva = 0;
+                        ac.txtva_vt = 0;
 
                     myrow["epreuve_vt"] = Program.key_ope;
-                    myrow["station_vt"] = ac.StationId.ToString();
-                    myrow["vehi_vt"] = ac.Bandeau;
-                    myrow["prod_vt"] = ac.KindCarbu;
-                    myrow["date_vt"] = ac.Date;
-                    myrow["qtt_vt"] = Math.Round(ac.Volume,2);
-                    myrow["pu_vt"] = Math.Round(ac.PrixCarbu,3);
-                    myrow["tva_vt"] = ac.TxTva ;
-                    myrow["ttc_vt"] = Math.Round(ac.MontantCarbu,2);
-                    myrow["ht_vt"] = Math.Round( ac.MontantCarbu / ( 1+ ( ac.TxTva/100 ) ) ,2);
+                    myrow["station_vt"] = ac.station_vt;
+                    myrow["vehi_vt"] = ac.vehi_vt;
+                    myrow["prod_vt"] = ac.prod_vt;
+                    myrow["date_vt"] = ac.date_vt;
+                    myrow["qtt_vt"] = Math.Round(ac.qtt_vt, 2);
+                    myrow["pu_vt"] = Math.Round(ac.pu_vt, 3);
+                    myrow["tva_vt"] = ac.txtva_vt;
+                    myrow["ttc_vt"] = Math.Round(ac.ttc_vt, 2);
+                    myrow["ht_vt"] = Math.Round(ac.ttc_vt / (1 + (ac.txtva_vt / 100)), 2);
 
                     tb_vente.Addtb_venteRow(myrow);
                     hasChanged = true;
                 }
             }
-            foreach (PrestasFournies pf in ac.Prestas)
-            {
-                if (pf.Name != null)
-                {
-                    pf.TxTva = 0;
-                    string newName= pf.Name.ToUpper().Contains("FREE") ? (pf.Libel == null ? "Produit inconnu" : pf.Libel) : pf.Name;
-                    if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.StationId.ToString(), ac.Bandeau, newName, ac.Date) == null)
-                    {
-                        DataSet1.tb_venteRow myrow = tb_vente.NewRow() as DataSet1.tb_venteRow;
-                        myrow["epreuve_vt"] = Program.key_ope;
-                        myrow["station_vt"] = ac.StationId.ToString();
-                        myrow["vehi_vt"] = ac.Bandeau;
-                        myrow["prod_vt"] = newName;
-                        myrow["date_vt"] = ac.Date;
-                        myrow["qtt_vt"] = Math.Round(pf.Quantity,2);
-                        myrow["pu_vt"] = Math.Round(pf.PrixUnitaire,2);
-                        myrow["tva_vt"] = pf.TxTva  ; // pf.TxTva == 0 ? 20 : pf.TxTva; ;
-                        myrow["ttc_vt"] = Math.Round(pf.Total,2);
-                        myrow["ht_vt"] = Math.Round(pf.Total,2);  // Math.Round(pf.Total / (1 + ( pf.TxTva / 100)), 2);
-
-                        tb_vente.Addtb_venteRow(myrow);
-                        hasChanged = true;
-                    }
-                }
-
-            }
+            
+            //foreach (PrestasFournies pf in ac.Prestas)
+            //{
+            //    if (pf.Name != null)
+            //    {
+            //        pf.TxTva = 0;
+            //        string newName = pf.Name.ToUpper().Contains("FREE") ? (pf.Libel == null ? "Produit inconnu" : pf.Libel) : pf.Name;
+            //        if (tb_vente.FindByepreuve_vtstation_vtvehi_vtprod_vtdate_vt(Program.key_ope, ac.StationId.ToString(), ac.Bandeau, newName, ac.Date) == null)
+            //        {
+            //            DataSet1.tb_venteRow myrow = tb_vente.NewRow() as DataSet1.tb_venteRow;
+            //            myrow["epreuve_vt"] = Program.key_ope;
+            //            myrow["station_vt"] = ac.StationId.ToString();
+            //            myrow["vehi_vt"] = ac.Bandeau;
+            //            myrow["prod_vt"] = newName;
+            //            myrow["date_vt"] = ac.Date;
+            //            myrow["qtt_vt"] = Math.Round(pf.Quantity, 2);
+            //            myrow["pu_vt"] = Math.Round(pf.PrixUnitaire, 2);
+            //            myrow["tva_vt"] = pf.TxTva; // pf.TxTva == 0 ? 20 : pf.TxTva; ;
+            //            myrow["ttc_vt"] = Math.Round(pf.Total, 2);
+            //            myrow["ht_vt"] = Math.Round(pf.Total, 2);  // Math.Round(pf.Total / (1 + ( pf.TxTva / 100)), 2);
+
+            //            tb_vente.Addtb_venteRow(myrow);
+            //            hasChanged = true;
+            //        }
+            //    }
+
+            //}
             tsLbl1.Text = "";
         }
 
@@ -317,7 +439,7 @@ namespace Fuel01
 
         private void bt_loadVT_Click(object sender, EventArgs e)
         {
-            init_vente();
+            load_vente();
         }
 
         private void check_modif_CheckedChanged(object sender, EventArgs e)
@@ -333,8 +455,8 @@ namespace Fuel01
 
         private void f_tools_FormClosing(object sender, FormClosingEventArgs e)
         {
-            if ( hasChanged)
-                if ( MessageBox.Show("Voulez-vous sauvegarder les modifications ?","Modifications non sauvegardées",MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)== System.Windows.Forms.DialogResult.Yes)
+            if (hasChanged)
+                if (MessageBox.Show("Voulez-vous sauvegarder les modifications ?", "Modifications non sauvegardées", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                     DbUtil.SaveToJson<DataSet1.tb_venteDataTable>(Program.subfolder + @"\vente.json", tb_vente);
             e.Cancel = false;
         }
@@ -348,7 +470,7 @@ namespace Fuel01
         {
             string input = "";
             if (Program.ShowInputDialog("Contrôle", "Entrez le mot de passe", ref input, true) == DialogResult.OK)
-                    splitContainer1.Enabled = (input == "fuel2016");
+                splitContainer1.Enabled = (input == "fuel2016");
         }
     }
 }