Przeglądaj źródła

dodanie urzedu plus poprawak dla korekt

waldek 4 lat temu
rodzic
commit
36ec51c899

+ 3
- 2
JPK_VDEK/App.config Wyświetl plik

@@ -8,9 +8,10 @@
8 8
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
9 9
   </startup>
10 10
   <appSettings>
11
-    <add key="JPKOUT" value="C:/BK"/>
11
+    <add key="JPKOUT" value="C:\BK"/>
12 12
     <add key="REJOUT" value="\\ndomena.gl.corp\JPK\PRO"/>
13
-    <add key="DBOUT" value="C:/DB"/>
13
+    <add key="DBOUT" value="C:\DB"/>
14
+    <add key="CERT" value="C:\Users\waldemar.kruszka\Documents\JPK_VDEK\JPK_VDEK\bin\Debug\test_e_dokumenty.mf.gov.pl.pem"/>
14 15
     <add key="ClientSettingsProvider.ServiceUri" value=""/>
15 16
   </appSettings>
16 17
   <entityFramework>

+ 46
- 0
JPK_VDEK/Core/DbRej.cs Wyświetl plik

@@ -0,0 +1,46 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace JPK_VDEK.Core
9
+{
10
+    public class DbRej: INotifyPropertyChanged
11
+    {
12
+        //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
13
+        public int ID { get; set; }
14
+        public String KTO { get; set; }
15
+        public String DOK { get; set; }
16
+        public String NIP { get; set; }
17
+        public String NAME { get; set; }
18
+        public String FAK { get; set; }
19
+        public String NETTO { get; set; }
20
+        public String BRUTTO { get; set; }
21
+        public String VAT { get; set; }
22
+        public String STVAT { get; set; }
23
+
24
+        event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
25
+        {
26
+            add
27
+            {
28
+                NotifyPropertyChanged();
29
+            }
30
+
31
+            remove
32
+            {
33
+                NotifyPropertyChanged();
34
+            }
35
+        }
36
+
37
+        public event PropertyChangedEventHandler PropertyChanged;
38
+
39
+        private void NotifyPropertyChanged(String propertyName = "")
40
+        {
41
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
42
+        }
43
+
44
+
45
+    }
46
+}

+ 1
- 1
JPK_VDEK/Core/JG.cs Wyświetl plik

@@ -63,7 +63,7 @@ namespace JPK_VDEK.Core
63 63
             list.Add(s);
64 64
             s = new SpName();
65 65
             s.Kod = "GLK3";
66
-            s.Describe = "Getin Leasing SKA 3";
66
+            s.Describe = "Idea Getin Leasing Automotive";
67 67
             s.NIP = "5272695935";
68 68
             s.Regon = "146748930";
69 69
             s.Gmina = "Wrocław";

+ 22
- 5
JPK_VDEK/Core/JpkData.cs Wyświetl plik

@@ -20,10 +20,13 @@ namespace JPK_VDEK
20 20
             jpk.Podmiot1 = aJpk.Podmiot1;
21 21
             jpk.Deklaracja = aJpk.Deklaracja;
22 22
             jpk.Ewidencja = aJpk.Ewidencja;
23
-            jpk.Ewidencja.SprzedazWiersz = aJpk.Ewidencja.SprzedazWiersz;
24
-            jpk.Ewidencja.SprzedazCtrl = aJpk.Ewidencja.SprzedazCtrl;
25
-            jpk.Ewidencja.ZakupWiersz = aJpk.Ewidencja.ZakupWiersz;
26
-            jpk.Ewidencja.ZakupCtrl = aJpk.Ewidencja.ZakupCtrl;
23
+            if (jpk.Ewidencja != null)
24
+            {
25
+                jpk.Ewidencja.SprzedazWiersz = aJpk.Ewidencja.SprzedazWiersz;
26
+                jpk.Ewidencja.SprzedazCtrl = aJpk.Ewidencja.SprzedazCtrl;
27
+                jpk.Ewidencja.ZakupWiersz = aJpk.Ewidencja.ZakupWiersz;
28
+                jpk.Ewidencja.ZakupCtrl = aJpk.Ewidencja.ZakupCtrl;
29
+            }
27 30
             return jpk;
28 31
         }
29 32
         public static void setJpk(JPK ajpk)
@@ -70,6 +73,7 @@ namespace JPK_VDEK
70 73
             aJpk.Ewidencja.ZakupCtrl = new JPKEwidencjaZakupCtrl();
71 74
             aJpk.ViewSP = new ObservableCollection<JPKSprzedazWierszExt>();
72 75
             aJpk.ViewZA = new ObservableCollection<JPKEwidencjaZakupWiersz>();
76
+            
73 77
 
74 78
             aJpk.Sumy = new JPKSumyKontrola();
75 79
 
@@ -205,6 +209,12 @@ namespace JPK_VDEK
205 209
     }
206 210
     public class JpkExt : JPK , INotifyPropertyChanged
207 211
     {
212
+
213
+        public JpkExt()
214
+        {
215
+            Rej = new ObservableCollection<DbRej>();
216
+        }
217
+        public string  DB { get; set; }
208 218
         public event PropertyChangedEventHandler PropertyChanged;
209 219
 
210 220
         private void NotifyPropertyChanged( String propertyName = "")
@@ -229,6 +239,11 @@ namespace JPK_VDEK
229 239
                 this.Naglowek.KodUrzedu = TKodUS.Item0225;
230 240
                 this.UsNazwa = this.Urz.Lista[poz].Describe;
231 241
             }
242
+            if (kod.Equals("1471"))
243
+            {
244
+                this.Naglowek.KodUrzedu = TKodUS.Item1471;
245
+                this.UsNazwa = this.Urz.Lista[poz].Describe;
246
+            }
232 247
             NotifyPropertyChanged();
233 248
         }
234 249
         private Decimal p39;
@@ -246,7 +261,7 @@ namespace JPK_VDEK
246 261
              }
247 262
         public ObservableCollection<JPKSprzedazWierszExt> ViewSP { get; set; }
248 263
         public ObservableCollection<JPKEwidencjaZakupWiersz> ViewZA { get; set; }
249
-
264
+        public ObservableCollection<DbRej> Rej { get; set; }
250 265
         public JPKSumyKontrola Sumy { get; set; }
251 266
         private string outscalony;
252 267
         private string outdb;
@@ -262,6 +277,8 @@ namespace JPK_VDEK
262 277
                 NotifyPropertyChanged();
263 278
             }
264 279
         }
280
+
281
+        public string cert { get; set; }
265 282
         public string outScalony 
266 283
         { 
267 284
             get

+ 4
- 0
JPK_VDEK/Core/US.cs Wyświetl plik

@@ -21,6 +21,10 @@ namespace JPK_VDEK.Core
21 21
             d.Kod = "0225";
22 22
             d.Describe = "URZĄD SKARBOWY WROCŁAW-KRZYKI";
23 23
             list.Add(d);
24
+            d = new UsDIDIC();
25
+            d.Kod = "1471";
26
+            d.Describe = "Pierwszy Mazowiecki Urząd w Warszawie";
27
+            list.Add(d);
24 28
         }
25 29
 
26 30
 

+ 147
- 0
JPK_VDEK/Core/Wysylaj.cs Wyświetl plik

@@ -0,0 +1,147 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.IO.Compression;
5
+using System.Linq;
6
+using System.Security.Cryptography;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+
10
+namespace JPK_VDEK.Core
11
+{
12
+    public class Wysylaj
13
+    {
14
+        public string AesIV256 { get; set; }
15
+        public int length { get; set; }
16
+        public long filezipLen { get; set; }
17
+        public string filexml { get; set; }
18
+        public string hashxml { get; set; }
19
+        public string filezip { get; set; }
20
+        public string key { get; set; }
21
+        public byte[] datOut { get; set; }
22
+        public byte[] sigKey { get; set; }
23
+        public byte[] md5 { get; set; }
24
+        public string md5Base { get; set; }
25
+        public int PoliczHash(String fileXml)
26
+        {
27
+            filexml = Path.GetFileNameWithoutExtension(fileXml) + ".xml";
28
+            string xml = File.ReadAllText(fileXml);
29
+            length = xml.Length;
30
+            using (SHA256 sha256Hash = SHA256.Create())
31
+            {
32
+                // ComputeHash - returns byte array  
33
+                byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(xml));
34
+
35
+                // Convert byte array to a string   
36
+                //  StringBuilder builder = new StringBuilder();
37
+                //  for (int i = 0; i < bytes.Length; i++)
38
+                //  {
39
+                //      builder.Append(bytes[i].ToString("x2"));
40
+                //  }
41
+                //  hashxml= builder.ToString();
42
+                hashxml = Convert.ToBase64String(bytes);
43
+            }
44
+            return 0;
45
+        }
46
+        public int Skompresuj(String fileXml)
47
+        {
48
+            filezip = Path.GetDirectoryName(fileXml) + "\\" + Path.GetFileNameWithoutExtension(fileXml) + ".zip";
49
+            string patharch = Path.GetDirectoryName(fileXml) + "\\" + Path.GetFileNameWithoutExtension(fileXml);
50
+            Directory.CreateDirectory(patharch);
51
+            File.Copy(fileXml, patharch+"\\"+ Path.GetFileNameWithoutExtension(fileXml)+".xml", true);
52
+            ZipFile.CreateFromDirectory(patharch, filezip);
53
+            FileInfo info = new FileInfo(filezip);
54
+            filezipLen = info.Length;
55
+            return 0;
56
+        }
57
+        public int Zaszyfruj(string cert)
58
+        {
59
+            key = @"5TGB&YHN7UJM(IK<5TGB&YHN7UJM(IK<";
60
+            datOut = Encrypt256(filezip, key);
61
+            sigKey = SigKey(key, cert);
62
+            
63
+            return 0;
64
+        }
65
+        public int PoliczMD5()
66
+        {
67
+            md5 = new MD5CryptoServiceProvider().ComputeHash(datOut);
68
+            md5Base = Convert.ToBase64String(md5);
69
+            return 0;
70
+        }
71
+        public int Podpisz()
72
+        {
73
+            InitUploadType meta = new InitUploadType();
74
+           
75
+            meta.EncryptionKey.Value = Convert.ToBase64String(sigKey);
76
+            meta.DocumentType = InitUploadTypeDocumentType.JPK;
77
+            meta.DocumentList.Document.FormCode.systemCode = "JPK_V7M (1)";
78
+            meta.DocumentList.Document.FormCode.schemaVersion = "1-2E";
79
+            meta.DocumentList.Document.FormCode.Value = "JPK_VAT";
80
+            meta.DocumentList.Document.FileName = filexml;
81
+            meta.DocumentList.Document.ContentLength = length;
82
+            meta.DocumentList.Document.HashValue.Value = hashxml;
83
+            meta.DocumentList.Document.FileSignatureList.filesNumber = 1;
84
+          //  ArrayOfFileSignatureTypePackagingSplitZip splitzip = new ArrayOfFileSignatureTypePackagingSplitZip();
85
+          //  meta.DocumentList.Document.FileSignatureList.Packaging.Item = splitzip
86
+            ArrayOfFileSignatureTypeEncryptionAES aes = new ArrayOfFileSignatureTypeEncryptionAES();
87
+            var base64EncodedBytes = System.Convert.FromBase64String(AesIV256);
88
+            aes.IV.Value = System.Convert.ToBase64String(base64EncodedBytes);
89
+            
90
+            meta.DocumentList.Document.FileSignatureList.Encryption.Item = aes;
91
+            FileSignatureType sig = new FileSignatureType();
92
+            sig.OrdinalNumber =1;
93
+            sig.FileName = filezip;
94
+            sig.ContentLength = Convert.ToInt32(filezipLen);
95
+            sig.HashValue.Value = md5Base;
96
+            meta.DocumentList.Document.FileSignatureList.FileSignature.Add(sig);
97
+
98
+            String xmlmeta = meta.Serialize();
99
+            return 0;
100
+        }
101
+        public int WyslijPlik()
102
+        {
103
+            return 0;
104
+        }
105
+        public int Sprawdz()
106
+        {
107
+            return 0;
108
+        }
109
+        public int GenerujUPO()
110
+        {
111
+            return 0;
112
+        }
113
+
114
+        private byte[] Encrypt256(string file, string key)
115
+        {
116
+            AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
117
+            AesIV256 = @"!QAZ2WSX#EDC4RFV";
118
+            aes.BlockSize = 128;
119
+            aes.KeySize = 128;
120
+            aes.Mode = CipherMode.CBC;
121
+            aes.Padding = PaddingMode.PKCS7;
122
+            aes.IV = Encoding.UTF8.GetBytes(AesIV256);
123
+            aes.Key = Encoding.UTF8.GetBytes(key);
124
+            BinaryReader reader = new BinaryReader(File.Open(file, FileMode.Open));
125
+            byte[] src = reader.ReadBytes((int)reader.BaseStream.Length);
126
+            using (ICryptoTransform encrypt = aes.CreateEncryptor())
127
+            {
128
+                byte[] dest = encrypt.TransformFinalBlock(src, 0, src.Length);
129
+                return dest;
130
+            }
131
+        }
132
+        private byte[] SigKey(string key, string publicKey)
133
+        {
134
+            UnicodeEncoding _encoder = new UnicodeEncoding();
135
+            byte[] encryptData;
136
+            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
137
+            byte[] Exponent = { 1, 0, 1 };
138
+            RSAParameters rsaParam = rsa.ExportParameters(false);
139
+            rsaParam.Modulus = Convert.FromBase64String(File.ReadAllText(publicKey).Replace("-----BEGIN CERTIFICATE-----", "").Replace("-----END CERTIFICATE-----", ""));
140
+            rsaParam.Exponent = Exponent;
141
+            rsa.ImportParameters(rsaParam);
142
+            var dataToEncrypt = _encoder.GetBytes(key);
143
+            encryptData = rsa.Encrypt(dataToEncrypt, false);
144
+            return encryptData;
145
+        }
146
+    }
147
+}

+ 7
- 0
JPK_VDEK/JPK_VDEK.csproj Wyświetl plik

@@ -86,6 +86,7 @@
86 86
       <SpecificVersion>False</SpecificVersion>
87 87
       <HintPath>..\..\..\..\..\bk\sqlite-netFx46-static-binary-bundle-x64-2015-1.0.113.0\System.Data.SQLite.dll</HintPath>
88 88
     </Reference>
89
+    <Reference Include="System.IO.Compression.FileSystem" />
89 90
     <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
90 91
       <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
91 92
     </Reference>
@@ -120,10 +121,12 @@
120 121
     <Compile Include="ConfigPopup.xaml.cs">
121 122
       <DependentUpon>ConfigPopup.xaml</DependentUpon>
122 123
     </Compile>
124
+    <Compile Include="Core\DbRej.cs" />
123 125
     <Compile Include="Core\JG.cs" />
124 126
     <Compile Include="Core\JPKSumyKontrola.cs" />
125 127
     <Compile Include="Core\TCels.cs" />
126 128
     <Compile Include="Core\US.cs" />
129
+    <Compile Include="Core\Wysylaj.cs" />
127 130
     <Compile Include="Deklaracja.xaml.cs">
128 131
       <DependentUpon>Deklaracja.xaml</DependentUpon>
129 132
     </Compile>
@@ -131,6 +134,7 @@
131 134
       <DependentUpon>Header.xaml</DependentUpon>
132 135
     </Compile>
133 136
     <Compile Include="Core\JpkData.cs" />
137
+    <Compile Include="initupload.Designer.cs" />
134 138
     <Compile Include="JpkSap.xaml.cs">
135 139
       <DependentUpon>JpkSap.xaml</DependentUpon>
136 140
     </Compile>
@@ -256,6 +260,9 @@
256 260
       <Generator>PublicResXFileCodeGenerator</Generator>
257 261
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
258 262
     </EmbeddedResource>
263
+    <None Include="initupload.xsd">
264
+      <SubType>Designer</SubType>
265
+    </None>
259 266
     <None Include="packages.config" />
260 267
     <None Include="Properties\Settings.settings">
261 268
       <Generator>SettingsSingleFileGenerator</Generator>

+ 5
- 4
JPK_VDEK/JpkSap.xaml.cs Wyświetl plik

@@ -48,16 +48,17 @@ namespace JPK_VDEK
48 48
                 JpkData.getJpk().setUrzad(urz);
49 49
                 JPK jpk = JpkData.getBaseJpk();
50 50
                 Mouse.OverrideCursor = null;
51
-                foreach (var spw in jpk.Ewidencja.SprzedazWiersz)
51
+          /*      foreach (var spw in jpk.Ewidencja.SprzedazWiersz)
52 52
                 {
53 53
                     if (spw.SprzedazVAT_Marza == 0 && spw.K_10 == 0 && spw.K_15 == 0 && spw.K_17 == 0 && spw.K_18 == 0 && spw.K_16 == 0 && spw.K_14 == 0 && spw.K_13 == 0 && spw.K_20 == 0 && spw.K_21 == 0 && spw.K_22 == 0 && spw.K_23 == 0 && spw.K_24 == 0 && spw.K_25 == 0 && spw.K_26 == 0 && spw.K_27 == 0 && spw.K_28 == 0 && spw.K_29 == 0 && spw.K_30 == 0 && spw.K_31 == 0 && spw.K_32 == 0 && spw.K_33 == 0 && spw.K_34 == 0 && spw.K_35 == 0
54 54
                   && spw.K_36 == 0)
55 55
                     {
56 56
                         bool f1 = false;
57
+                      
57 58
                     }
58
-                }
59
-              
60
-                jpk.SaveToFile(s);
59
+                }*/
60
+
61
+                 jpk.SaveToFile(s);
61 62
                 MessageBox.Show("Wygenerowano plik JPK", "JPK_VDEK");
62 63
             }
63 64
         }

+ 48
- 2
JPK_VDEK/MainWindow.xaml.cs Wyświetl plik

@@ -1,6 +1,9 @@
1
-using Microsoft.Win32;
1
+using JPK_VDEK.Core;
2
+using Microsoft.Win32;
2 3
 using System;
3 4
 using System.Collections.Generic;
5
+using System.Data;
6
+using System.Data.SQLite;
4 7
 using System.Linq;
5 8
 using System.Text;
6 9
 using System.Threading.Tasks;
@@ -43,7 +46,50 @@ namespace JPK_VDEK
43 46
             openFileDialog.Filter = "sqlite files (*.sqlite)|*.sqlite";
44 47
             if (openFileDialog.ShowDialog() == true)
45 48
             {
46
-               String dbrej = openFileDialog.FileName;
49
+                Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
50
+                String dbrej = openFileDialog.FileName;
51
+
52
+                SQLiteConnection m_dbConnection;
53
+                String con = "Data Source=" + dbrej + ";Version=3;";
54
+                m_dbConnection = new SQLiteConnection(con);
55
+                m_dbConnection.Open();
56
+                string sql = "select * from REJ";
57
+                SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
58
+                DataTable dt = new DataTable("REJ");
59
+                SQLiteDataReader dataReader = command.ExecuteReader();
60
+                try
61
+                {
62
+                    dt.Load(dataReader);
63
+                }
64
+                catch (Exception)
65
+                {
66
+
67
+
68
+                }
69
+
70
+                dataReader.Close();
71
+                m_dbConnection.Close();
72
+                DbRej r = new DbRej();
73
+                foreach (DataRow item in dt.Rows)
74
+                {
75
+                  //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
76
+                    r = new DbRej();
77
+                    r.ID = Convert.ToInt32(item["LP"].ToString());
78
+                    r.KTO = item["KTO"].ToString();
79
+                    r.DOK = item["DOK"].ToString();
80
+                    r.NIP = item["NIP"].ToString();
81
+                    r.NAME = item["NAME"].ToString();
82
+                    r.FAK = item["FAK"].ToString();
83
+                    r.NETTO = item["NETTO"].ToString();
84
+                    r.VAT = item["VAT"].ToString();
85
+                    r.BRUTTO = item["BRUTTO"].ToString();
86
+                    r.STVAT = item["STVAT"].ToString();
87
+                    JpkData.getJpk().Rej.Add(r);
88
+
89
+                }
90
+                JpkData.getJpk().DB = dbrej;
91
+                this.DataContext = JpkData.getJpk();
92
+                Mouse.OverrideCursor = null;
47 93
             }
48 94
         }
49 95
     }

+ 1
- 0
JPK_VDEK/Ogolne.xaml Wyświetl plik

@@ -45,5 +45,6 @@
45 45
             <local:JpkSap HorizontalAlignment="Left" Height="110" Margin="19,0,0,-12.4" VerticalAlignment="Top" Width="690"/>
46 46
         </GroupBox>
47 47
         <local:AddDec HorizontalAlignment="Left" Height="229" Margin="10,298,0,0" VerticalAlignment="Top" Width="715" Grid.ColumnSpan="2"/>
48
+        <Button Content="Wyślij" Grid.Column="1" HorizontalAlignment="Left" Margin="569.2,274,0,0" VerticalAlignment="Top" Width="75" RenderTransformOrigin="0.331,1.302" Background="#FFF41414" Click="Button_Click_7"/>
48 49
     </Grid>
49 50
 </UserControl>

+ 150
- 87
JPK_VDEK/Ogolne.xaml.cs Wyświetl plik

@@ -386,11 +386,11 @@ namespace JPK_VDEK
386 386
                 }
387 387
                 if (item.GTU_12 == 1)
388 388
                 {
389
-                    JpkData.getJpk().allGtu11++;
389
+                    JpkData.getJpk().allGtu12++;
390 390
                 }
391 391
                 if (item.GTU_13 == 1)
392 392
                 {
393
-                    JpkData.getJpk().allGtu11++;
393
+                    JpkData.getJpk().allGtu13++;
394 394
                 }
395 395
                 if (item.MPP == 1)
396 396
                 {
@@ -619,12 +619,20 @@ namespace JPK_VDEK
619 619
                         {
620 620
                             d1.P_36 = Math.Round(suma, 0).ToString();
621 621
                         }
622
-                        suma = (Convert.ToDecimal(d1.P_37) + Convert.ToDecimal(atr[29].Replace('.', ',')));
622
+                        // suma = (Convert.ToDecimal(d1.P_37) + Convert.ToDecimal(atr[29].Replace('.', ',')));
623
+                        suma = (Convert.ToDecimal(d1.P_11)) + (Convert.ToDecimal(d1.P_10)) +
624
+                             (Convert.ToDecimal(d1.P_13)) + (Convert.ToDecimal(d1.P_15)) + (Convert.ToDecimal(d1.P_17)) +
625
+                             (Convert.ToDecimal(d1.P_19)) + (Convert.ToDecimal(d1.P_21)) + (Convert.ToDecimal(d1.P_22)) +
626
+                             (Convert.ToDecimal(d1.P_23)) + (Convert.ToDecimal(d1.P_25)) + (Convert.ToDecimal(d1.P_27)) +
627
+                             (Convert.ToDecimal(d1.P_29)) + (Convert.ToDecimal(d1.P_31)) ;
623 628
                         if (suma != 0)
624 629
                         {
625 630
                             d1.P_37 = Math.Round(suma, 0).ToString();
626 631
                         }
627
-                        suma = (Convert.ToDecimal(d1.P_38) + Convert.ToDecimal(atr[30].Replace('.', ',')));
632
+                        suma = (Convert.ToDecimal(d1.P_16)) + (Convert.ToDecimal(d1.P_18)) + (Convert.ToDecimal(d1.P_20)) +
633
+                             (Convert.ToDecimal(d1.P_24)) + (Convert.ToDecimal(d1.P_26)) + (Convert.ToDecimal(d1.P_28)) +
634
+                              (Convert.ToDecimal(d1.P_30)) + (Convert.ToDecimal(d1.P_32)) + (Convert.ToDecimal(d1.P_33)) +
635
+                               (Convert.ToDecimal(d1.P_34)) - (Convert.ToDecimal(d1.P_35)) - (Convert.ToDecimal(d1.P_36));
628 636
                         if (suma != 0)
629 637
                         {
630 638
                             d1.P_38 = Math.Round(suma, 0).ToString();
@@ -694,11 +702,6 @@ namespace JPK_VDEK
694 702
                             suma = Convert.ToDecimal(d1.P_38) - Convert.ToDecimal(d1.P_48);
695 703
                             d1.P_51 = Math.Round(suma, 0).ToString();
696 704
                         }
697
-                        suma = (Convert.ToDecimal(d1.P_51) + Convert.ToDecimal(atr[43].Replace('.', ',')));
698
-                        if (suma != 0)
699
-                        {
700
-                            d1.P_51 = Math.Round(suma, 0).ToString();
701
-                        }   
702 705
                         suma = (Convert.ToDecimal(d1.P_52) + Convert.ToDecimal(atr[44].Replace('.', ',')));
703 706
                         if (suma != 0)
704 707
                         {
@@ -825,11 +828,26 @@ namespace JPK_VDEK
825 828
                         spw.DowodSprzedazy = atr[5];
826 829
                         spw.NazwaKontrahenta = atr[6];
827 830
 
828
-                        spw.K_10 = Convert.ToDecimal(atr[8].Replace('.', ','));
829
-                        spw.K_11 = Convert.ToDecimal(atr[9].Replace('.', ','));
830
-                        spw.K_12 = Convert.ToDecimal(atr[10].Replace('.', ','));
831
-                        spw.K_13 = Convert.ToDecimal(atr[11].Replace('.', ','));
832
-                        spw.K_14 = Convert.ToDecimal(atr[12].Replace('.', ','));
831
+                        if (Convert.ToDecimal(atr[8].Replace('.', ',')) != 0)
832
+                        {
833
+                            spw.K_10 = Convert.ToDecimal(atr[8].Replace('.', ','));
834
+                        }
835
+                        if (Convert.ToDecimal(atr[9].Replace('.', ',')) != 0)
836
+                        {
837
+                            spw.K_11 = Convert.ToDecimal(atr[9].Replace('.', ','));
838
+                        }
839
+                        if (Convert.ToDecimal(atr[10].Replace('.', ',')) != 0)
840
+                        {
841
+                            spw.K_12 = Convert.ToDecimal(atr[10].Replace('.', ','));
842
+                        }
843
+                        if (Convert.ToDecimal(atr[11].Replace('.', ',')) != 0)
844
+                        {
845
+                            spw.K_13 = Convert.ToDecimal(atr[11].Replace('.', ','));
846
+                        }
847
+                        if (Convert.ToDecimal(atr[12].Replace('.', ',')) != 0)
848
+                        {
849
+                            spw.K_14 = Convert.ToDecimal(atr[12].Replace('.', ','));
850
+                        }
833 851
                         spw.K_15 = Convert.ToDecimal(atr[13].Replace('.', ','));
834 852
                         spw.K_16 = Convert.ToDecimal(atr[14].Replace('.', ','));
835 853
                         spw.K_17 = Convert.ToDecimal(atr[15].Replace('.', ','));
@@ -1257,7 +1275,7 @@ namespace JPK_VDEK
1257 1275
                 item.DowodSprzedazy = item.DowodSprzedazy.Replace("'", "''");
1258 1276
                 this.setValue(item, out kn, out kn1, out kn2);
1259 1277
 
1260
-                sql = "insert into REJ (LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','IL','" + poz[1] + "','" + item.NrKontrahenta + "','" + "" + "','" + item.DowodSprzedazy + "'," + kn + "," + kn2 + "," + kn1 + "," + "23" + ")";
1278
+                sql = "insert into REJ (LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','IL','" + poz[1] + "','" + item.NrKontrahenta + "','" + item.NazwaKontrahenta.Replace("'", "") + "','" + item.DowodSprzedazy + "'," + kn + "," + kn2 + "," + kn1 + "," + "0" + ")";
1261 1279
 
1262 1280
                 al.Add(sql);
1263 1281
             }
@@ -1353,31 +1371,31 @@ namespace JPK_VDEK
1353 1371
                     if (!kn.Equals("0.00"))
1354 1372
                     {
1355 1373
                         kn = Convert.ToDecimal(atr[8].Replace('.', ',')).ToString().Replace(',', '.');
1356
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','"  + atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1374
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','"  + atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1357 1375
                     }
1358 1376
                     kn = atr[9];
1359 1377
                     if (!kn.Equals("0.00"))
1360 1378
                     {
1361 1379
                         kn = Convert.ToDecimal(atr[9].Replace('.', ',')).ToString().Replace(',', '.');
1362
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1380
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1363 1381
                     }
1364 1382
                     kn = atr[10];
1365 1383
                     if (!kn.Equals("0.00"))
1366 1384
                     {
1367 1385
                         kn = Convert.ToDecimal(atr[10].Replace('.', ',')).ToString().Replace(',', '.');
1368
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1386
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1369 1387
                     }
1370 1388
                     kn = atr[11];
1371 1389
                     if (!kn.Equals("0.00"))
1372 1390
                     {
1373 1391
                         kn = Convert.ToDecimal(atr[11].Replace('.', ',')).ToString().Replace(',', '.');
1374
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1392
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1375 1393
                     }
1376 1394
                     kn = atr[12];
1377 1395
                     if (!kn.Equals("0.00"))
1378 1396
                     {
1379 1397
                         kn = Convert.ToDecimal(atr[12].Replace('.', ',')).ToString().Replace(',', '.');
1380
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1398
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1381 1399
                     }
1382 1400
                     kn = atr[13];
1383 1401
                     if (!kn.Equals("0.00"))
@@ -1385,7 +1403,7 @@ namespace JPK_VDEK
1385 1403
                         kn = Convert.ToDecimal(atr[13].Replace('.', ',')).ToString().Replace(',', '.');
1386 1404
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[14].Replace('.', ','))).ToString().Replace(',', '.');
1387 1405
                         kvat = Convert.ToDecimal(atr[14].Replace('.', ',')).ToString().Replace(',', '.');
1388
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",5.00)";
1406
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",5.00)";
1389 1407
                     }
1390 1408
                     kn = atr[15];
1391 1409
                     if (!kn.Equals("0.00"))
@@ -1393,7 +1411,7 @@ namespace JPK_VDEK
1393 1411
                         kn = Convert.ToDecimal(atr[15].Replace('.', ',')).ToString().Replace(',', '.');
1394 1412
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[16].Replace('.', ','))).ToString().Replace(',', '.');
1395 1413
                         kvat = Convert.ToDecimal(atr[16].Replace('.', ',')).ToString().Replace(',', '.');
1396
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",8.00)";
1414
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",8.00)";
1397 1415
                     }
1398 1416
                     kn = atr[17];
1399 1417
                     if (!kn.Equals("0.00"))
@@ -1401,7 +1419,7 @@ namespace JPK_VDEK
1401 1419
                         kn = Convert.ToDecimal(atr[17].Replace('.', ',')).ToString().Replace(',', '.');
1402 1420
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[18].Replace('.', ','))).ToString().Replace(',', '.');
1403 1421
                         kvat = Convert.ToDecimal(atr[18].Replace('.', ',')).ToString().Replace(',', '.');
1404
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1422
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1405 1423
                     }
1406 1424
                     kn = atr[17];
1407 1425
                     kn1 = atr[18];
@@ -1410,19 +1428,19 @@ namespace JPK_VDEK
1410 1428
                         kn = Convert.ToDecimal(atr[17].Replace('.', ',')).ToString().Replace(',', '.');
1411 1429
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[18].Replace('.', ','))).ToString().Replace(',', '.');
1412 1430
                         kvat = Convert.ToDecimal(atr[18].Replace('.', ',')).ToString().Replace(',', '.');
1413
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1431
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1414 1432
                     }
1415 1433
                     kn = atr[19];
1416 1434
                     if (!kn.Equals("0.00"))
1417 1435
                     {
1418 1436
                         kn = Convert.ToDecimal(atr[19].Replace('.', ',')).ToString().Replace(',', '.');
1419
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1437
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1420 1438
                     }
1421 1439
                     kn = atr[20];
1422 1440
                     if (!kn.Equals("0.00"))
1423 1441
                     {
1424 1442
                         kn = Convert.ToDecimal(atr[20].Replace('.', ',')).ToString().Replace(',', '.');
1425
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1443
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1426 1444
                     }
1427 1445
                     kn = atr[21];
1428 1446
                     if (!kn.Equals("0.00"))
@@ -1430,7 +1448,7 @@ namespace JPK_VDEK
1430 1448
                         kn = Convert.ToDecimal(atr[21].Replace('.', ',')).ToString().Replace(',', '.');
1431 1449
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[22].Replace('.', ','))).ToString().Replace(',', '.');
1432 1450
                         kvat = Convert.ToDecimal(atr[22].Replace('.', ',')).ToString().Replace(',', '.');
1433
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1451
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1434 1452
                     }
1435 1453
                     kn = atr[23];
1436 1454
                     if (!kn.Equals("0.00"))
@@ -1438,7 +1456,7 @@ namespace JPK_VDEK
1438 1456
                         kn = Convert.ToDecimal(atr[23].Replace('.', ',')).ToString().Replace(',', '.');
1439 1457
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[24].Replace('.', ','))).ToString().Replace(',', '.');
1440 1458
                         kvat = Convert.ToDecimal(atr[24].Replace('.', ',')).ToString().Replace(',', '.');
1441
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1459
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + ",23.00)";
1442 1460
                     }
1443 1461
                     kn = atr[25];
1444 1462
                     if (!kn.Equals("0.00"))
@@ -1446,7 +1464,7 @@ namespace JPK_VDEK
1446 1464
                         kn = Convert.ToDecimal(atr[25].Replace('.', ',')).ToString().Replace(',', '.');
1447 1465
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[26].Replace('.', ','))).ToString().Replace(',', '.');
1448 1466
                         kvat = Convert.ToDecimal(atr[26].Replace('.', ',')).ToString().Replace(',', '.');
1449
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1467
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1450 1468
                     }
1451 1469
                     kn = atr[27];
1452 1470
                     if (!kn.Equals("0.00"))
@@ -1454,13 +1472,13 @@ namespace JPK_VDEK
1454 1472
                         kn = Convert.ToDecimal(atr[27].Replace('.', ',')).ToString().Replace(',', '.');
1455 1473
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[28].Replace('.', ','))).ToString().Replace(',', '.');
1456 1474
                         kvat = Convert.ToDecimal(atr[28].Replace('.', ',')).ToString().Replace(',', '.');
1457
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1475
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1458 1476
                     }
1459 1477
                     kn = atr[29];
1460 1478
                     if (!kn.Equals("0.00"))
1461 1479
                     {
1462 1480
                         kn = Convert.ToDecimal(atr[29].Replace('.', ',')).ToString().Replace(',', '.');
1463
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1481
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn + ",0.00,0.00)";
1464 1482
                     }
1465 1483
                     kn = atr[30];
1466 1484
                     if (!kn.Equals("0.00"))
@@ -1468,7 +1486,7 @@ namespace JPK_VDEK
1468 1486
                         kn = Convert.ToDecimal(atr[30].Replace('.', ',')).ToString().Replace(',', '.');
1469 1487
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[31].Replace('.', ','))).ToString().Replace(',', '.');
1470 1488
                         kvat = Convert.ToDecimal(atr[31].Replace('.', ',')).ToString().Replace(',', '.');
1471
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1489
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1472 1490
                     }
1473 1491
                     kn = atr[32];
1474 1492
                     if (!kn.Equals("0.00"))
@@ -1476,31 +1494,31 @@ namespace JPK_VDEK
1476 1494
                         kn = Convert.ToDecimal(atr[32].Replace('.', ',')).ToString().Replace(',', '.');
1477 1495
                         kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[33].Replace('.', ','))).ToString().Replace(',', '.');
1478 1496
                         kvat = Convert.ToDecimal(atr[33].Replace('.', ',')).ToString().Replace(',', '.');
1479
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1497
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn1 + "," + kn + "," + kvat + ",23.00)";
1480 1498
                     }
1481 1499
                     kn = atr[34];
1482 1500
                     if (!kn.Equals("0.00"))
1483 1501
                     {
1484 1502
                         kn = Convert.ToDecimal(atr[34].Replace('.', ',')).ToString().Replace(',', '.');
1485
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1503
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1486 1504
                     }
1487 1505
                     kn = atr[35];
1488 1506
                     if (!kn.Equals("0.00"))
1489 1507
                     {
1490 1508
                         kn = Convert.ToDecimal(atr[35].Replace('.', ',')).ToString().Replace(',', '.');
1491
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1509
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1492 1510
                     }
1493 1511
                     kn = atr[36];
1494 1512
                     if (!kn.Equals("0.00"))
1495 1513
                     {
1496 1514
                         kn = Convert.ToDecimal(atr[36].Replace('.', ',')).ToString().Replace(',', '.');
1497
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1515
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1498 1516
                     }
1499 1517
                     kn = atr[37];
1500 1518
                     if (!kn.Equals("0.00"))
1501 1519
                     {
1502 1520
                         kn = Convert.ToDecimal(atr[37].Replace('.', ',')).ToString().Replace(',', '.');
1503
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1521
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1504 1522
                     }
1505 1523
                     if (sql.Equals(""))
1506 1524
                     {
@@ -1508,101 +1526,101 @@ namespace JPK_VDEK
1508 1526
                     }
1509 1527
                     sql = "";
1510 1528
                 }
1511
-                else
1529
+                else if(atr[1].Equals("Z") == true)
1512 1530
                 {
1513 1531
                     atr[6] = atr[6].Replace("'", "''");
1514 1532
                     atr[7] = atr[7].Replace("'", "''");
1515 1533
                     atr[6] = atr[6].Replace(",", " ");
1516 1534
                     atr[7] = atr[7].Replace(",", " ");
1517
-                    kn = atr[38];
1518
-                    kn1 = atr[39];
1535
+                    kn = atr[40];
1536
+                    kn1 = atr[41];
1519 1537
 
1520 1538
                     if (!kn.Equals("0.00"))
1521 1539
                     {
1522
-                        kn = Convert.ToDecimal(atr[38].Replace('.', ',')).ToString().Replace(',', '.');
1523
-                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[39].Replace('.', ','))).ToString().Replace(',', '.');
1524
-                        kvat = Convert.ToDecimal(atr[39].Replace('.', ',')).ToString().Replace(',', '.');
1525
-                        if (Convert.ToDecimal(atr[38].Replace('.', ',')) == 0)
1540
+                        kn = Convert.ToDecimal(atr[40].Replace('.', ',')).ToString().Replace(',', '.');
1541
+                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[41].Replace('.', ','))).ToString().Replace(',', '.');
1542
+                        kvat = Convert.ToDecimal(atr[41].Replace('.', ',')).ToString().Replace(',', '.');
1543
+                        if (Convert.ToDecimal(atr[40].Replace('.', ',')) == 0)
1526 1544
                         {
1527 1545
                             kst = "0.00";
1528 1546
                         }
1529 1547
                         else
1530 1548
                         {
1531
-                            kst = Math.Round((Convert.ToDecimal(atr[39].Replace('.', ',')) / Convert.ToDecimal(atr[38].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1549
+                            kst = Math.Round((Convert.ToDecimal(atr[41].Replace('.', ',')) / Convert.ToDecimal(atr[40].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1532 1550
                         }
1533
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1551
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1534 1552
                     }
1535 1553
                     if (kn.Equals("0.00") && !kn1.Equals("0.00"))
1536 1554
                     {
1537
-                        kn = Convert.ToDecimal(atr[38].Replace('.', ',')).ToString().Replace(',', '.');
1538
-                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[39].Replace('.', ','))).ToString().Replace(',', '.');
1539
-                        kvat = Convert.ToDecimal(atr[39].Replace('.', ',')).ToString().Replace(',', '.');
1540
-                        if (Convert.ToDecimal(atr[38].Replace('.', ',')) == 0)
1555
+                        kn = Convert.ToDecimal(atr[40].Replace('.', ',')).ToString().Replace(',', '.');
1556
+                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[41].Replace('.', ','))).ToString().Replace(',', '.');
1557
+                        kvat = Convert.ToDecimal(atr[41].Replace('.', ',')).ToString().Replace(',', '.');
1558
+                        if (Convert.ToDecimal(atr[40].Replace('.', ',')) == 0)
1541 1559
                         {
1542 1560
                             kst = "0.00";
1543 1561
                         }
1544 1562
                         else
1545 1563
                         {
1546
-                            kst = Math.Round((Convert.ToDecimal(atr[39].Replace('.', ',')) / Convert.ToDecimal(atr[38].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1564
+                            kst = Math.Round((Convert.ToDecimal(atr[41].Replace('.', ',')) / Convert.ToDecimal(atr[40].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1547 1565
                         }
1548
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1566
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1549 1567
                     }
1550
-                    kn = atr[40];
1551
-                    kn1 = atr[41];
1568
+                    kn = atr[42];
1569
+                    kn1 = atr[43];
1552 1570
                     if (!kn.Equals("0.00"))
1553 1571
                     {
1554
-                        kn = Convert.ToDecimal(atr[40].Replace('.', ',')).ToString().Replace(',', '.');
1555
-                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[41].Replace('.', ','))).ToString().Replace(',', '.');
1556
-                        kvat = Convert.ToDecimal(atr[41].Replace('.', ',')).ToString().Replace(',', '.');
1557
-                        if (Convert.ToDecimal(atr[40].Replace('.', ',')) == 0)
1572
+                        kn = Convert.ToDecimal(atr[42].Replace('.', ',')).ToString().Replace(',', '.');
1573
+                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[43].Replace('.', ','))).ToString().Replace(',', '.');
1574
+                        kvat = Convert.ToDecimal(atr[43].Replace('.', ',')).ToString().Replace(',', '.');
1575
+                        if (Convert.ToDecimal(atr[42].Replace('.', ',')) == 0)
1558 1576
                         {
1559 1577
                             kst = "0.00";
1560 1578
                         }
1561 1579
                         else
1562 1580
                         {
1563
-                            kst = Math.Round((Convert.ToDecimal(atr[41].Replace('.', ',')) / Convert.ToDecimal(atr[40].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1581
+                            kst = Math.Round((Convert.ToDecimal(atr[43].Replace('.', ',')) / Convert.ToDecimal(atr[42].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1564 1582
                         }
1565
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1583
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1566 1584
                     }
1567 1585
                     if (kn.Equals("0.00") && !kn1.Equals("0.00"))
1568 1586
                     {
1569
-                        kn = Convert.ToDecimal(atr[40].Replace('.', ',')).ToString().Replace(',', '.');
1570
-                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[41].Replace('.', ','))).ToString().Replace(',', '.');
1571
-                        kvat = Convert.ToDecimal(atr[41].Replace('.', ',')).ToString().Replace(',', '.');
1572
-                        if (Convert.ToDecimal(atr[40].Replace('.', ',')) == 0)
1587
+                        kn = Convert.ToDecimal(atr[42].Replace('.', ',')).ToString().Replace(',', '.');
1588
+                        kn1 = (Convert.ToDecimal(kn.Replace('.', ',')) + Convert.ToDecimal(atr[43].Replace('.', ','))).ToString().Replace(',', '.');
1589
+                        kvat = Convert.ToDecimal(atr[43].Replace('.', ',')).ToString().Replace(',', '.');
1590
+                        if (Convert.ToDecimal(atr[42].Replace('.', ',')) == 0)
1573 1591
                         {
1574 1592
                             kst = "0.00";
1575 1593
                         }
1576 1594
                         else
1577 1595
                         {
1578
-                            kst = Math.Round((Convert.ToDecimal(atr[41].Replace('.', ',')) / Convert.ToDecimal(atr[40].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1596
+                            kst = Math.Round((Convert.ToDecimal(atr[43].Replace('.', ',')) / Convert.ToDecimal(atr[42].Replace('.', ',')) * 100), 2).ToString().Replace(',', '.');
1579 1597
                         }
1580
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1598
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "'," + kn + "," + kn1 + "," + kvat + "," + kst + ")";
1581 1599
                     }
1582
-                    kn = atr[42];
1600
+               /*     kn = atr[42];
1583 1601
                     if (!kn.Equals("0.00"))
1584 1602
                     {
1585 1603
                         kn = Convert.ToDecimal(atr[42].Replace('.', ',')).ToString().Replace(',', '.');
1586
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1604
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" +  atr[5] + "',0.00,0.00," + kn + ",0.00)";
1587 1605
                     }
1588 1606
                     kn = atr[43];
1589 1607
                     if (!kn.Equals("0.00"))
1590 1608
                     {
1591 1609
                         kn = Convert.ToDecimal(atr[43].Replace('.', ',')).ToString().Replace(',', '.');
1592
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1610
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1593 1611
                     }
1594 1612
                     kn = atr[44];
1595 1613
                     if (!kn.Equals("0.00"))
1596 1614
                     {
1597 1615
                         kn = Convert.ToDecimal(atr[44].Replace('.', ',')).ToString().Replace(',', '.');
1598
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1616
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1599 1617
                     }
1600 1618
                     kn = atr[45];
1601 1619
                     if (!kn.Equals("0.00"))
1602 1620
                     {
1603 1621
                         kn = Convert.ToDecimal(atr[45].Replace('.', ',')).ToString().Replace(',', '.');
1604
-                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[47] + "','" + atr[46] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1605
-                    }
1622
+                        sql = "insert into REJ (LP,KTO, DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT) values ('" + lp.ToString() + "','GL','" + atr[49] + "','" + atr[48] + "','" + atr[6] + "','" + atr[5] + "',0.00,0.00," + kn + ",0.00)";
1623
+                    }*/
1606 1624
                     al.Add(sql);
1607 1625
                 }
1608 1626
 
@@ -1644,11 +1662,11 @@ namespace JPK_VDEK
1644 1662
                     atr = line.Split('|');
1645 1663
 
1646 1664
 
1647
-                    JpkData.getJpk().Naglowek.KodUrzedu = TKodUS.Item0271;
1648
-                    JpkData.getJpk().UsNazwa = "DOLNOŚLĄSKI URZĄD SKARBOWY WE WROCŁAWJU";
1665
+                    JpkData.getJpk().Naglowek.KodUrzedu = TKodUS.Item1471;
1666
+                    JpkData.getJpk().UsNazwa = "Pierwszy Mazowiecki Urząd w Warszawie";
1649 1667
                     JpkData.getJpk().Naglowek.WariantFormularza = 1;
1650 1668
                     JpkData.getJpk().Naglowek.KodFormularza.Value = TKodFormularza.JPK_VAT;
1651
-                   JpkData.getJpk().Naglowek.Rok = atr[1].Substring(0, 4);
1669
+                    JpkData.getJpk().Naglowek.Rok = atr[1].Substring(0, 4);
1652 1670
                     JpkData.getJpk().Naglowek.Miesiac = Convert.ToSByte(atr[1].Substring(4, 2));
1653 1671
                     JpkData.getJpk().Naglowek.DataWytworzeniaJPK = new DateTime(Convert.ToInt16(atr[3].Substring(0, 4)), Convert.ToInt16(atr[3].Substring(4, 2)), Convert.ToInt16(atr[3].Substring(6, 2)));
1654 1672
 
@@ -2010,14 +2028,32 @@ namespace JPK_VDEK
2010 2028
                             spw.DataWystawienia = new DateTime(Convert.ToInt16(atr[4].Substring(0, 4)), Convert.ToInt16(atr[4].Substring(4, 2)), Convert.ToInt16(atr[4].Substring(6, 2)));
2011 2029
                             spw.DowodSprzedazy = atr[5];
2012 2030
                             spw.NazwaKontrahenta = atr[6];
2013
-                            
2031
+              
2014 2032
                             spw.K_10 = Convert.ToDecimal(atr[8].Replace('.', ','));
2015
-                            spw.K_11 = Convert.ToDecimal(atr[9].Replace('.', ','));
2016
-                            spw.K_12 = Convert.ToDecimal(atr[10].Replace('.', ','));
2017
-                            spw.K_13 = Convert.ToDecimal(atr[11].Replace('.', ','));
2018
-                            spw.K_14 = Convert.ToDecimal(atr[12].Replace('.', ','));
2019
-                            spw.K_15 = Convert.ToDecimal(atr[13].Replace('.', ','));
2020
-                            spw.K_16 = Convert.ToDecimal(atr[14].Replace('.', ','));
2033
+                            if (Convert.ToDecimal(atr[9].Replace('.', ',')) != 0)
2034
+                            {
2035
+                                spw.K_11 = Convert.ToDecimal(atr[9].Replace('.', ','));
2036
+                            }
2037
+                            if (Convert.ToDecimal(atr[10].Replace('.', ',')) != 0)
2038
+                            {
2039
+                                spw.K_12 = Convert.ToDecimal(atr[10].Replace('.', ','));
2040
+                            }
2041
+                            if (Convert.ToDecimal(atr[11].Replace('.', ',')) != 0)
2042
+                            {
2043
+                                spw.K_13 = Convert.ToDecimal(atr[11].Replace('.', ','));
2044
+                            }
2045
+                            if (Convert.ToDecimal(atr[12].Replace('.', ',')) != 0)
2046
+                            {
2047
+                                spw.K_14 = Convert.ToDecimal(atr[12].Replace('.', ','));
2048
+                            }
2049
+                            if (Convert.ToDecimal(atr[13].Replace('.', ',')) != 0)
2050
+                            {
2051
+                                spw.K_15 = Convert.ToDecimal(atr[13].Replace('.', ','));
2052
+                            }
2053
+                            if (Convert.ToDecimal(atr[14].Replace('.', ',')) != 0)
2054
+                            {
2055
+                                spw.K_16 = Convert.ToDecimal(atr[14].Replace('.', ','));
2056
+                            }
2021 2057
                             spw.K_17 = Convert.ToDecimal(atr[15].Replace('.', ','));
2022 2058
                             spw.K_18 = Convert.ToDecimal(atr[16].Replace('.', ','));
2023 2059
                             spw.K_19 = Convert.ToDecimal(atr[17].Replace('.', ','));
@@ -2045,7 +2081,10 @@ namespace JPK_VDEK
2045 2081
                             {
2046 2082
                                 podNal = podNal + spw.K_16 + spw.K_18 + spw.K_20 + spw.K_24 + spw.K_26 + spw.K_28 + spw.K_30 + spw.K_32 + spw.K_33 + spw.K_34 - spw.K_35 - spw.K_36;
2047 2083
                             }
2048
-                            spw.SprzedazVAT_Marza = Convert.ToDecimal(atr[77].Replace('.', ','));
2084
+                            if (Convert.ToDecimal(atr[77].Replace('.', ',') ) != 0)
2085
+                            {
2086
+                                spw.SprzedazVAT_Marza = Convert.ToDecimal(atr[77].Replace('.', ','));
2087
+                            }
2049 2088
                             if(spw.SprzedazVAT_Marza==0 && spw.K_10 == 0&& spw.K_15 == 0 && spw.K_17 == 0 && spw.K_18 == 0 && spw.K_16 == 0 && spw.K_14 == 0 && spw.K_13 == 0 && spw.K_20 == 0 && spw.K_21 == 0 && spw.K_22 == 0 && spw.K_23 == 0 && spw.K_24 == 0 && spw.K_25 == 0 && spw.K_26 == 0 && spw.K_27 == 0 && spw.K_28 == 0 && spw.K_29 == 0 && spw.K_30 == 0 && spw.K_31 == 0 && spw.K_32 == 0 && spw.K_33 == 0 && spw.K_34 == 0 && spw.K_35 == 0
2050 2089
                                 && spw.K_36 == 0)
2051 2090
                             {
@@ -2379,10 +2418,20 @@ namespace JPK_VDEK
2379 2418
                             JpkData.getJpk().ViewZA.Add(zawext);
2380 2419
                         }
2381 2420
                     }
2382
-                    JpkData.getJpk().Ewidencja.SprzedazCtrl.LiczbaWierszySprzedazy = liczbaWSp.ToString();
2383
-                    JpkData.getJpk().Ewidencja.SprzedazCtrl.PodatekNalezny = podNal;
2384
-                    JpkData.getJpk().Ewidencja.ZakupCtrl.LiczbaWierszyZakupow = liczbaWZp.ToString();
2385
-                    JpkData.getJpk().Ewidencja.ZakupCtrl.PodatekNaliczony = podNali;
2421
+                    if (liczbaWSp > 0)
2422
+                    {
2423
+                        JpkData.getJpk().Ewidencja.SprzedazCtrl.LiczbaWierszySprzedazy = liczbaWSp.ToString();
2424
+                        JpkData.getJpk().Ewidencja.SprzedazCtrl.PodatekNalezny = podNal;
2425
+                    }
2426
+                    if (liczbaWZp > 0)
2427
+                    {
2428
+                        JpkData.getJpk().Ewidencja.ZakupCtrl.LiczbaWierszyZakupow = liczbaWZp.ToString();
2429
+                        JpkData.getJpk().Ewidencja.ZakupCtrl.PodatekNaliczony = podNali;
2430
+                    }
2431
+                    if(liczbaWSp==0 && liczbaWZp==0)
2432
+                    {
2433
+                        JpkData.getJpk().Ewidencja = null;
2434
+                    }
2386 2435
 
2387 2436
                 }
2388 2437
                 JpkData.getJpk().wczytalemGL = true;
@@ -2395,5 +2444,19 @@ namespace JPK_VDEK
2395 2444
  
2396 2445
             }
2397 2446
         }
2447
+
2448
+        private void Button_Click_7(object sender, RoutedEventArgs e)
2449
+        {
2450
+            Wysylaj w = new Wysylaj();
2451
+            var appSettings = ConfigurationManager.AppSettings;
2452
+            string path1 = appSettings["CERT"];
2453
+            w.PoliczHash(JpkData.getJpk().outScalony);
2454
+            w.Skompresuj(JpkData.getJpk().outScalony);
2455
+            w.Zaszyfruj(path1);
2456
+            w.PoliczMD5();
2457
+            w.Podpisz();
2458
+            w.WyslijPlik();
2459
+            w.Sprawdz();
2460
+        }
2398 2461
     }
2399 2462
 }

+ 15
- 16
JPK_VDEK/Rejestr.xaml Wyświetl plik

@@ -7,34 +7,33 @@
7 7
              mc:Ignorable="d" 
8 8
              d:DesignHeight="450" Width="935.427">
9 9
     <Grid Margin="0,0,154.2,-0.4">
10
-        <DataGrid HorizontalAlignment="Left" Height="339" Margin="10,101,0,0" VerticalAlignment="Top" Width="728">
10
+        <DataGrid HorizontalAlignment="Left"  ItemsSource="{Binding Rej}" Height="339" Margin="10,101,0,0" AutoGenerateColumns="False" VerticalAlignment="Top" Width="728">
11 11
             <DataGrid.Columns>
12
-                <DataGridTextColumn Header="" Binding="{Binding Path=ID}" >
12
+                <DataGridTextColumn Header="" Binding="{Binding ID}" >
13 13
                     <DataGridTextColumn.HeaderTemplate>
14 14
                         <DataTemplate>
15 15
                             <TextBlock Text="L.p." Width="25" TextWrapping="Wrap" HorizontalAlignment="Center"/>
16 16
                         </DataTemplate>
17 17
                     </DataGridTextColumn.HeaderTemplate>
18 18
                 </DataGridTextColumn>
19
-                <DataGridTextColumn Header="KTO" Binding="{Binding Path=Date}"/>
20
-                <DataGridTextColumn Header="Dokument" Binding="{Binding Path=Date}"/>
21
-                <DataGridTextColumn Header="NIP" Binding="{Binding Path=Date}"/>
22
-                <DataGridTextColumn Header="Nazwa" Binding="{Binding Path=Date}"/>
23
-                <DataGridTextColumn Header="Adres" Binding="{Binding Path=Date}"/>
24
-                <DataGridTextColumn Header="Faktura" Binding="{Binding Path=Date}"/>
25
-                <DataGridTextColumn Header="Netto" Binding="{Binding Path=Date}"/>
26
-                <DataGridTextColumn Header="Vat" Binding="{Binding Path=Date}"/>
27
-                <DataGridTextColumn Header="Brutto" Binding="{Binding Path=Date}"/>
28
-                <DataGridTextColumn Header="Stawka VAT" Binding="{Binding Path=Date}"/>
19
+                <DataGridTextColumn Header="KTO" Binding="{Binding KTO}"/>
20
+                <DataGridTextColumn Header="Dokument" Binding="{Binding DOK}"/>
21
+                <DataGridTextColumn Header="NIP" Binding="{Binding NIP}"/>
22
+                <DataGridTextColumn Header="Nazwa" Binding="{Binding NAME}"/>
23
+                <DataGridTextColumn Header="Faktura" Binding="{Binding FAK}"/>
24
+                <DataGridTextColumn Header="Netto" Binding="{Binding NETTO}"/>
25
+                <DataGridTextColumn Header="Vat" Binding="{Binding VAT}"/>
26
+                <DataGridTextColumn Header="Brutto" Binding="{Binding BRUTTO}"/>
27
+                <DataGridTextColumn Header="Stawka VAT" Binding="{Binding STVAT}"/>
29 28
             </DataGrid.Columns>
30 29
         </DataGrid>
31
-        <Button x:Name="bSzu" Content="Szukaj" HorizontalAlignment="Left" Margin="616,65,0,0" VerticalAlignment="Top" Width="75"/>
30
+        <Button x:Name="bSzu" Content="Szukaj" HorizontalAlignment="Left" Margin="616,65,0,0" VerticalAlignment="Top" Width="75" Click="bSzu_Click"/>
32 31
         <Label Content="Nip" HorizontalAlignment="Left" Margin="26,10,0,0" VerticalAlignment="Top"/>
33 32
         <Label Content="Faktura" HorizontalAlignment="Left" Margin="26,36,0,0" VerticalAlignment="Top"/>
34 33
         <Label Content="Dokument Ksiegowy" HorizontalAlignment="Left" Margin="26,62,0,0" VerticalAlignment="Top"/>
35
-        <TextBox HorizontalAlignment="Left" Height="23" Margin="169,13,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="157" RenderTransformOrigin="0.181,-0.325"/>
36
-        <TextBox HorizontalAlignment="Left" Height="23" Margin="169,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="207" RenderTransformOrigin="0.181,-0.325"/>
37
-        <TextBox HorizontalAlignment="Left" Height="23" Margin="169,68,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" RenderTransformOrigin="0.181,-0.325"/>
34
+        <TextBox x:Name="tNip" HorizontalAlignment="Left" Height="23" Margin="169,13,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="157" RenderTransformOrigin="0.181,-0.325"/>
35
+        <TextBox x:Name="tFaktura" HorizontalAlignment="Left" Height="23" Margin="169,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="207" RenderTransformOrigin="0.181,-0.325"/>
36
+        <TextBox x:Name="tDok" HorizontalAlignment="Left" Height="23" Margin="169,68,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" RenderTransformOrigin="0.181,-0.325"/>
38 37
 
39 38
     </Grid>
40 39
 </UserControl>

+ 192
- 1
JPK_VDEK/Rejestr.xaml.cs Wyświetl plik

@@ -1,5 +1,8 @@
1
-using System;
1
+using JPK_VDEK.Core;
2
+using System;
2 3
 using System.Collections.Generic;
4
+using System.Data;
5
+using System.Data.SQLite;
3 6
 using System.Linq;
4 7
 using System.Text;
5 8
 using System.Threading.Tasks;
@@ -24,5 +27,193 @@ namespace JPK_VDEK
24 27
         {
25 28
             InitializeComponent();
26 29
         }
30
+
31
+        private void bSzu_Click(object sender, RoutedEventArgs e)
32
+        {
33
+            JpkData.getJpk().Rej = new System.Collections.ObjectModel.ObservableCollection<DbRej>();
34
+            string sql;
35
+            if (!tNip.Text.Equals(""))
36
+            {
37
+                if (!tFaktura.Text.Equals(""))
38
+                {
39
+                    if (!tDok.Text.Equals(""))
40
+                    {
41
+                        sql = "select * from REJ where NIP like '%" + tNip.Text + "%' and FAK like '%" + tFaktura.Text + "%' and DOK like '%" + tDok.Text + "%'";
42
+                    }
43
+                    else
44
+                    {
45
+                        sql = "select * from REJ where NIP like '%" + tNip.Text + "%' and FAK like '%" + tFaktura.Text + "%'";
46
+                    }
47
+                }
48
+                else
49
+                {
50
+                    sql = "select * from REJ where NIP like '%" + tNip.Text + "%'";
51
+                }
52
+                SQLiteConnection m_dbConnection;
53
+                String con = "Data Source=" + JpkData.getJpk().DB + ";Version=3;";
54
+                m_dbConnection = new SQLiteConnection(con);
55
+                m_dbConnection.Open();
56
+                SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
57
+                SQLiteDataReader dataReader = command.ExecuteReader();
58
+
59
+                DataTable dt = new DataTable("REJ");
60
+                try
61
+                {
62
+                    dt.Load(dataReader);
63
+                }
64
+                catch (Exception)
65
+                {
66
+
67
+
68
+                }
69
+                DbRej r = new DbRej();
70
+                if(dt.Rows.Count == 0)
71
+                {
72
+                    r = new DbRej();
73
+                    JpkData.getJpk().Rej.Add(r);
74
+                }
75
+                foreach (DataRow item in dt.Rows)
76
+                {
77
+                    //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
78
+                    r = new DbRej();
79
+                    r.ID = Convert.ToInt32(item["LP"].ToString());
80
+                    r.KTO = item["KTO"].ToString();
81
+                    r.DOK = item["DOK"].ToString();
82
+                    r.NIP = item["NIP"].ToString();
83
+                    r.NAME = item["NAME"].ToString();
84
+                    r.FAK = item["FAK"].ToString();
85
+                    r.NETTO = item["NETTO"].ToString();
86
+                    r.VAT = item["VAT"].ToString();
87
+                    r.STVAT = item["STVAT"].ToString();
88
+                    JpkData.getJpk().Rej.Add(r);
89
+
90
+                }
91
+                m_dbConnection.Close();
92
+            }
93
+            else if (!tFaktura.Text.Equals(""))
94
+            {
95
+                if (!tDok.Text.Equals(""))
96
+                {
97
+                    sql = "select * from REJ where FAK like '%" + tFaktura.Text + "%' and DOK like '%" + tDok.Text + "%'";
98
+                }
99
+                else
100
+                {
101
+                    sql = "select * from REJ where FAK like '%" + tFaktura.Text + "%'";
102
+                }
103
+                SQLiteConnection m_dbConnection;
104
+                String con = "Data Source=" + JpkData.getJpk().DB + ";Version=3;";
105
+                m_dbConnection = new SQLiteConnection(con);
106
+                m_dbConnection.Open();
107
+                SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
108
+                SQLiteDataReader dataReader = command.ExecuteReader();
109
+
110
+                DataTable dt = new DataTable("REJ");
111
+                try
112
+                {
113
+                    dt.Load(dataReader);
114
+                }
115
+                catch (Exception)
116
+                {
117
+
118
+
119
+                }
120
+                DbRej r = new DbRej();
121
+                foreach (DataRow item in dt.Rows)
122
+                {
123
+                    //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
124
+                    r = new DbRej();
125
+                    r.ID = Convert.ToInt32(item["LP"].ToString());
126
+                    r.KTO = item["KTO"].ToString();
127
+                    r.DOK = item["DOK"].ToString();
128
+                    r.NIP = item["NIP"].ToString();
129
+                    r.NAME = item["NAME"].ToString();
130
+                    r.FAK = item["FAK"].ToString();
131
+                    r.NETTO = item["NETTO"].ToString();
132
+                    r.VAT = item["VAT"].ToString();
133
+                    r.STVAT = item["STVAT"].ToString();
134
+                    JpkData.getJpk().Rej.Add(r);
135
+
136
+                }
137
+                m_dbConnection.Close();
138
+            }
139
+            else if (!tDok.Text.Equals(""))
140
+            {
141
+                sql = "select * from REJ where DOK like '%" + tDok.Text + "%'";
142
+                SQLiteConnection m_dbConnection;
143
+                String con = "Data Source=" + JpkData.getJpk().DB + ";Version=3;";
144
+                m_dbConnection = new SQLiteConnection(con);
145
+                m_dbConnection.Open();
146
+                SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
147
+                SQLiteDataReader dataReader = command.ExecuteReader();
148
+
149
+                DataTable dt = new DataTable("REJ");
150
+                try
151
+                {
152
+                    dt.Load(dataReader);
153
+                }
154
+                catch (Exception)
155
+                {
156
+
157
+
158
+                }
159
+                DbRej r = new DbRej();
160
+                foreach (DataRow item in dt.Rows)
161
+                {
162
+                    //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
163
+                    r = new DbRej();
164
+                    r.ID = Convert.ToInt32(item["LP"].ToString());
165
+                    r.KTO = item["KTO"].ToString();
166
+                    r.DOK = item["DOK"].ToString();
167
+                    r.NIP = item["NIP"].ToString();
168
+                    r.NAME = item["NAME"].ToString();
169
+                    r.FAK = item["FAK"].ToString();
170
+                    r.NETTO = item["NETTO"].ToString();
171
+                    r.VAT = item["VAT"].ToString();
172
+                    r.STVAT = item["STVAT"].ToString();
173
+                    JpkData.getJpk().Rej.Add(r);
174
+
175
+                }
176
+                m_dbConnection.Close();
177
+            }
178
+            else
179
+            {
180
+                sql = "select * from REJ";
181
+                SQLiteConnection m_dbConnection;
182
+                String con = "Data Source=" + JpkData.getJpk().DB + ";Version=3;";
183
+                m_dbConnection = new SQLiteConnection(con);
184
+                m_dbConnection.Open();
185
+                SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
186
+                SQLiteDataReader dataReader = command.ExecuteReader();
187
+
188
+                DataTable dt = new DataTable("REJ");
189
+                try
190
+                {
191
+                    dt.Load(dataReader);
192
+                }
193
+                catch (Exception)
194
+                {
195
+
196
+
197
+                }
198
+                DbRej r = new DbRej();
199
+                foreach (DataRow item in dt.Rows)
200
+                {
201
+                    //  LP, KTO,DOK,NIP,NAME,FAK,NETTO,BRUTTO,VAT,STVAT
202
+                    r = new DbRej();
203
+                    r.ID = Convert.ToInt32(item["LP"].ToString());
204
+                    r.KTO = item["KTO"].ToString();
205
+                    r.DOK = item["DOK"].ToString();
206
+                    r.NIP = item["NIP"].ToString();
207
+                    r.NAME = item["NAME"].ToString();
208
+                    r.FAK = item["FAK"].ToString();
209
+                    r.NETTO = item["NETTO"].ToString();
210
+                    r.VAT = item["VAT"].ToString();
211
+                    r.STVAT = item["STVAT"].ToString();
212
+                    JpkData.getJpk().Rej.Add(r);
213
+
214
+                }
215
+                m_dbConnection.Close();
216
+            }
217
+        }
27 218
     }
28 219
 }

+ 349
- 809
JPK_VDEK/Schemat_JPK_V7M(1)_v1-0.Designer.cs
Plik diff jest za duży
Wyświetl plik


+ 4764
- 0
JPK_VDEK/initupload.Designer.cs
Plik diff jest za duży
Wyświetl plik


+ 239
- 0
JPK_VDEK/initupload.xsd Wyświetl plik

@@ -0,0 +1,239 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<xs:schema xmlns="http://e-dokumenty.mf.gov.pl" xmlns:mf="http://e-dokumenty.mf.gov.pl" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://e-dokumenty.mf.gov.pl" elementFormDefault="qualified">
3
+    <xs:element name="InitUpload" type="mf:InitUploadType"/>
4
+    <xs:complexType name="InitUploadType">
5
+        <xs:sequence>
6
+            <xs:element name="DocumentType" minOccurs="1" maxOccurs="1">
7
+                <xs:annotation>
8
+                    <xs:documentation>JPK - dokumenty przesyłane cyklicznie, JPKAH - dokumenty przesyłane doraźnie w ramach kontroli</xs:documentation>
9
+                </xs:annotation>
10
+                <xs:simpleType>
11
+                    <xs:restriction base="xs:string">
12
+                        <xs:enumeration value="JPK">
13
+                            <xs:annotation>
14
+                                <xs:documentation>Dokumenty przesyłane cyklicznie</xs:documentation>
15
+                            </xs:annotation>
16
+                        </xs:enumeration>
17
+                        <xs:enumeration value="JPKAH">
18
+                            <xs:annotation>
19
+                                <xs:documentation>Dokumenty przesyłane doraźnie w ramach kontroli</xs:documentation>
20
+                            </xs:annotation>
21
+                        </xs:enumeration>
22
+                    </xs:restriction>
23
+                </xs:simpleType>
24
+            </xs:element>
25
+            <xs:element name="Version" fixed="01.02.01.20160617" minOccurs="1" maxOccurs="1">
26
+                <xs:simpleType>
27
+                    <xs:restriction base="xs:string"/>
28
+                </xs:simpleType>
29
+            </xs:element>
30
+            <xs:element name="EncryptionKey" minOccurs="1" maxOccurs="1">
31
+                <xs:complexType>
32
+                    <xs:simpleContent>
33
+                        <xs:restriction base="mf:EncryptionKeyRSAType">
34
+                            <xs:minLength value="344"/>
35
+                            <xs:maxLength value="344"/>
36
+                        </xs:restriction>
37
+                    </xs:simpleContent>
38
+                </xs:complexType>
39
+            </xs:element>
40
+            <xs:element name="DocumentList" type="mf:ArrayOfDocumentType" minOccurs="1" maxOccurs="1">
41
+                <xs:unique name="UniqueDocumentFileName">
42
+                    <xs:selector xpath="mf:Document"/>
43
+                    <xs:field xpath="mf:FileName"/>
44
+                </xs:unique>
45
+            </xs:element>
46
+            <xs:element name="AuthData" minOccurs="0" maxOccurs="1">
47
+                <xs:annotation>
48
+                    <xs:documentation>To opcjonalne pole powinno zawierać dokument XML zgodny z opublikowaną schemą SIG-2008_v2-0.xsd zaszyfrowany z wykorzystaniem algorytmu symetrycznego AES256. Powinien zostać wykorzystany ten sam klucz, który jest wykorzystywany do szyfrowania części skompresowanego archiwum pliku JPK i załączany do niniejszego pliku metadanych. Algorytm kodowania zaszyfrowanych danych to Base64.</xs:documentation>
49
+                </xs:annotation>
50
+                <xs:simpleType>
51
+                    <xs:restriction base="xs:string"/>
52
+                </xs:simpleType>
53
+            </xs:element>
54
+        </xs:sequence>
55
+    </xs:complexType>
56
+    <xs:complexType name="ArrayOfDocumentType">
57
+        <xs:sequence>
58
+            <xs:element name="Document" minOccurs="1">
59
+                <xs:complexType>
60
+                    <xs:complexContent>
61
+                        <xs:extension base="mf:DocumentType"/>
62
+                    </xs:complexContent>
63
+                </xs:complexType>
64
+            </xs:element>
65
+        </xs:sequence>
66
+    </xs:complexType>
67
+    <xs:complexType name="DocumentType">
68
+        <xs:sequence>
69
+            <xs:element name="FormCode">
70
+                <xs:annotation>
71
+                    <xs:documentation>KodFormularza zawarty w nagłówku pliku XML.</xs:documentation>
72
+                </xs:annotation>
73
+                <xs:complexType>
74
+                    <xs:simpleContent>
75
+                        <xs:extension base="xs:string">
76
+                            <xs:attribute name="systemCode" type="xs:string" use="required">
77
+                                <xs:annotation>
78
+                                    <xs:documentation>Atrybut kodSystemowy elementu KodFormularza z pliku XML.</xs:documentation>
79
+                                </xs:annotation>
80
+                            </xs:attribute>
81
+                            <xs:attribute name="schemaVersion" type="xs:string" use="required">
82
+                                <xs:annotation>
83
+                                    <xs:documentation>Atrybut wersjaSchemy elementu KodFormularza z pliku XML.</xs:documentation>
84
+                                </xs:annotation>
85
+                            </xs:attribute>
86
+                        </xs:extension>
87
+                    </xs:simpleContent>
88
+                </xs:complexType>
89
+            </xs:element>
90
+            <xs:element name="FileName">
91
+                <xs:simpleType>
92
+                    <xs:restriction base="xs:string">
93
+                        <xs:pattern value="[a-zA-Z0-9_\.\-]{5,55}"/>
94
+                    </xs:restriction>
95
+                </xs:simpleType>
96
+            </xs:element>
97
+            <xs:element name="ContentLength" type="xs:long"/>
98
+            <xs:element name="HashValue" minOccurs="1" maxOccurs="1">
99
+                <xs:complexType>
100
+                    <xs:simpleContent>
101
+                        <xs:restriction base="mf:HashValueSHAType">
102
+                            <xs:minLength value="44"/>
103
+                            <xs:maxLength value="44"/>
104
+                        </xs:restriction>
105
+                    </xs:simpleContent>
106
+                </xs:complexType>
107
+            </xs:element>
108
+            <xs:element name="FileSignatureList" minOccurs="1" maxOccurs="1">
109
+                <xs:complexType>
110
+                    <xs:complexContent>
111
+                        <xs:extension base="mf:ArrayOfFileSignatureType">
112
+                            <xs:attribute name="filesNumber" use="required">
113
+                                <xs:simpleType>
114
+                                    <xs:restriction base="xs:int">
115
+                                        <xs:minInclusive value="1"/>
116
+                                    </xs:restriction>
117
+                                </xs:simpleType>
118
+                            </xs:attribute>
119
+                        </xs:extension>
120
+                    </xs:complexContent>
121
+                </xs:complexType>
122
+                <xs:unique name="UniqueFileSignatureFileName">
123
+                    <xs:selector xpath="mf:FileSignature"/>
124
+                    <xs:field xpath="mf:FileName"/>
125
+                </xs:unique>
126
+                <xs:unique name="UniqueFileSignatureOrdinalNumber">
127
+                    <xs:selector xpath="mf:FileSignature"/>
128
+                    <xs:field xpath="mf:OrdinalNumber"/>
129
+                </xs:unique>
130
+            </xs:element>
131
+        </xs:sequence>
132
+    </xs:complexType>
133
+    <xs:complexType name="ArrayOfFileSignatureType">
134
+        <xs:sequence>
135
+            <xs:element name="Packaging">
136
+                <xs:complexType>
137
+                    <xs:choice>
138
+                        <xs:element name="SplitZip">
139
+                            <xs:complexType>
140
+                                <xs:attribute name="type" use="required" fixed="split"/>
141
+                                <xs:attribute name="mode" use="required" fixed="zip"/>
142
+                            </xs:complexType>
143
+                        </xs:element>
144
+                    </xs:choice>
145
+                </xs:complexType>
146
+            </xs:element>
147
+            <xs:element name="Encryption">
148
+                <xs:complexType>
149
+                    <xs:choice>
150
+                        <xs:element name="AES">
151
+                            <xs:complexType>
152
+                                <xs:sequence>
153
+                                    <xs:element name="IV">
154
+                                        <xs:complexType>
155
+                                            <xs:simpleContent>
156
+                                                <xs:restriction base="mf:EncryptionAESIVType">
157
+                                                    <xs:minLength value="24"/>
158
+                                                    <xs:maxLength value="24"/>
159
+                                                </xs:restriction>
160
+                                            </xs:simpleContent>
161
+                                        </xs:complexType>
162
+                                    </xs:element>
163
+                                </xs:sequence>
164
+                                <xs:attribute name="size" type="xs:int" use="required" fixed="256"/>
165
+                                <xs:attribute name="block" type="xs:int" use="required" fixed="16"/>
166
+                                <xs:attribute name="mode" use="required" fixed="CBC"/>
167
+                                <xs:attribute name="padding" use="required" fixed="PKCS#7"/>
168
+                            </xs:complexType>
169
+                        </xs:element>
170
+                    </xs:choice>
171
+                </xs:complexType>
172
+            </xs:element>
173
+            <xs:element name="FileSignature" type="mf:FileSignatureType" minOccurs="1" maxOccurs="unbounded"/>
174
+        </xs:sequence>
175
+    </xs:complexType>
176
+    <xs:complexType name="FileSignatureType">
177
+        <xs:sequence>
178
+            <xs:element name="OrdinalNumber">
179
+                <xs:simpleType>
180
+                    <xs:restriction base="xs:int">
181
+                        <xs:minInclusive value="1"/>
182
+                    </xs:restriction>
183
+                </xs:simpleType>
184
+            </xs:element>
185
+            <xs:element name="FileName" minOccurs="1" maxOccurs="1">
186
+                <xs:simpleType>
187
+                    <xs:restriction base="xs:string">
188
+                        <xs:pattern value="[a-zA-Z0-9_\.\-]{5,55}"/>
189
+                    </xs:restriction>
190
+                </xs:simpleType>
191
+            </xs:element>
192
+            <xs:element name="ContentLength" type="xs:int" minOccurs="1" maxOccurs="1"/>
193
+            <xs:element name="HashValue">
194
+                <xs:complexType>
195
+                    <xs:simpleContent>
196
+                        <xs:restriction base="mf:HashValueMD5Type">
197
+                            <xs:minLength value="24"/>
198
+                            <xs:maxLength value="24"/>
199
+                        </xs:restriction>
200
+                    </xs:simpleContent>
201
+                </xs:complexType>
202
+            </xs:element>
203
+        </xs:sequence>
204
+    </xs:complexType>
205
+    <xs:complexType name="HashValueSHAType">
206
+        <xs:simpleContent>
207
+            <xs:extension base="xs:token">
208
+                <xs:attribute name="algorithm" use="required" fixed="SHA-256"/>
209
+                <xs:attribute name="encoding" use="required" fixed="Base64"/>
210
+            </xs:extension>
211
+        </xs:simpleContent>
212
+    </xs:complexType>
213
+    <xs:complexType name="HashValueMD5Type">
214
+        <xs:simpleContent>
215
+            <xs:extension base="xs:token">
216
+                <xs:attribute name="algorithm" use="required" fixed="MD5"/>
217
+                <xs:attribute name="encoding" use="required" fixed="Base64"/>
218
+            </xs:extension>
219
+        </xs:simpleContent>
220
+    </xs:complexType>
221
+    <xs:complexType name="EncryptionAESIVType">
222
+        <xs:simpleContent>
223
+            <xs:extension base="xs:token">
224
+                <xs:attribute name="bytes" use="required" fixed="16"/>
225
+                <xs:attribute name="encoding" use="required" fixed="Base64"/>
226
+            </xs:extension>
227
+        </xs:simpleContent>
228
+    </xs:complexType>
229
+    <xs:complexType name="EncryptionKeyRSAType">
230
+        <xs:simpleContent>
231
+            <xs:extension base="xs:token">
232
+                <xs:attribute name="algorithm" use="required" fixed="RSA"/>
233
+                <xs:attribute name="mode" use="required" fixed="ECB"/>
234
+                <xs:attribute name="padding" use="required" fixed="PKCS#1"/>
235
+                <xs:attribute name="encoding" use="required" fixed="Base64"/>
236
+            </xs:extension>
237
+        </xs:simpleContent>
238
+    </xs:complexType>
239
+</xs:schema>