Browse Source

Dodanie zapisu xml

waldek 5 years ago
parent
commit
c6584fedab

+ 37
- 1
JPK_VDEK/Core/JpkData.cs View File

12
     {
12
     {
13
         static private JpkExt aJpk;
13
         static private JpkExt aJpk;
14
 
14
 
15
+        public static JPK getBaseJpk()
16
+        {
17
+            JPK jpk = new JPK();
18
+            jpk.Naglowek = aJpk.Naglowek;
19
+            jpk.Podmiot1 = aJpk.Podmiot1;
20
+            jpk.Deklaracja = aJpk.Deklaracja;
21
+            jpk.SprzedazWiersz = aJpk.SprzedazWiersz;
22
+            jpk.SprzedazCtrl = aJpk.SprzedazCtrl;
23
+            jpk.ZakupWiersz = aJpk.ZakupWiersz;
24
+            jpk.ZakupCtrl = aJpk.ZakupCtrl;
25
+            return jpk;
26
+        }
15
         public static JpkExt getJpk()
27
         public static JpkExt getJpk()
16
         {
28
         {
17
             if(aJpk==null)
29
             if(aJpk==null)
23
         public static void initJpk()
35
         public static void initJpk()
24
         {
36
         {
25
             aJpk = new JpkExt();
37
             aJpk = new JpkExt();
38
+
39
+            aJpk.wczytalemGL = false;
40
+
26
             aJpk.Naglowek = new JPKNaglowek();
41
             aJpk.Naglowek = new JPKNaglowek();
27
             aJpk.Naglowek.KodFormularza = new TNaglowekKodFormularza();
42
             aJpk.Naglowek.KodFormularza = new TNaglowekKodFormularza();
28
             aJpk.Naglowek.CelZlozenia = new TNaglowekCelZlozenia();
43
             aJpk.Naglowek.CelZlozenia = new TNaglowekCelZlozenia();
45
             aJpk.ViewZA = new ObservableCollection<JPKZakupWiersz>();
60
             aJpk.ViewZA = new ObservableCollection<JPKZakupWiersz>();
46
 
61
 
47
             aJpk.Sumy = new JPKSumyKontrola();
62
             aJpk.Sumy = new JPKSumyKontrola();
63
+
64
+            aJpk.Cel = new TCels();
65
+            aJpk.Urz = new US();
48
         }
66
         }
49
     }
67
     }
50
 
68
 
51
     public class JpkExt : JPK
69
     public class JpkExt : JPK
52
     {
70
     {
71
+        public void setCel(int poz)
72
+        {
73
+            this.Naglowek.CelZlozenia.Value = Convert.ToSByte(this.Cel.Cel[poz].Key);
74
+        }
75
+        public void setUrzad(int poz)
76
+        {
77
+            string kod = this.Urz.Lista[poz].Kod;
78
+            if(kod.Equals("0271"))
79
+            {
80
+                this.Naglowek.KodUrzedu = TKodUS.Item0271;
81
+            }
82
+            if (kod.Equals("0225"))
83
+            {
84
+                this.Naglowek.KodUrzedu = TKodUS.Item0271;
85
+            }
86
+        }
53
         public ObservableCollection<JPKSprzedazWiersz> ViewSP { get; set; }
87
         public ObservableCollection<JPKSprzedazWiersz> ViewSP { get; set; }
54
         public ObservableCollection<JPKZakupWiersz> ViewZA { get; set; }
88
         public ObservableCollection<JPKZakupWiersz> ViewZA { get; set; }
55
 
89
 
66
         public bool P65 { get; set; }
100
         public bool P65 { get; set; }
67
         public bool P66 { get; set; }
101
         public bool P66 { get; set; }
68
         public bool P67 { get; set; }
102
         public bool P67 { get; set; }
69
-
103
+        public TCels Cel { get; set; }
104
+        public US Urz { get; set; }
105
+        public bool wczytalemGL { get; set; }
70
     }
106
     }
71
 }
107
 }

+ 70
- 0
JPK_VDEK/Core/TCels.cs View File

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace JPK_VDEK.Core
8
+{
9
+    public class TCels
10
+    {
11
+        private List<TCel> list;
12
+        public TCels()
13
+        {
14
+            list = new List<TCel>();
15
+            TCel c = new TCel();
16
+            c.Key = 0;
17
+            c.Describe = "złożenie po raz pierwszy deklaracji za dany okres";
18
+            list.Add(c);
19
+            c = new TCel();
20
+            c.Key = 1;
21
+            c.Describe = "korekta deklaracji 1";
22
+            list.Add(c);
23
+            c = new TCel();
24
+            c.Key = 2;
25
+            c.Describe = "korekta deklaracji 2";
26
+            list.Add(c);
27
+            c = new TCel();
28
+            c.Key = 3;
29
+            c.Describe = "korekta deklaracji 3";
30
+            list.Add(c);
31
+            c = new TCel();
32
+            c.Key = 4;
33
+            c.Describe = "korekta deklaracji 4";
34
+            list.Add(c);
35
+            c = new TCel();
36
+            c.Key = 5;
37
+            c.Describe = "korekta deklaracji 5";
38
+            list.Add(c);
39
+            c = new TCel();
40
+            c.Key = 6;
41
+            c.Describe = "korekta deklaracji 6";
42
+            list.Add(c);
43
+            c = new TCel();
44
+            c.Key = 7;
45
+            c.Describe = "korekta deklaracji 7";
46
+            list.Add(c);
47
+            c = new TCel();
48
+            c.Key = 8;
49
+            c.Describe = "korekta deklaracji 8";
50
+            list.Add(c);
51
+            c = new TCel();
52
+            c.Key = 9;
53
+            c.Describe = "korekta deklaracji 9";
54
+            list.Add(c);
55
+            c = new TCel();
56
+            c.Key = 10;
57
+            c.Describe = "korekta deklaracji 10";
58
+            list.Add(c);
59
+        }
60
+        public List<TCel> Cel { get { return list; } set { list = value; } }
61
+    }
62
+    public class TCel
63
+    {
64
+        public TCel()
65
+        {
66
+        }
67
+        public int Key { get; set; }
68
+        public String Describe { get; set; }
69
+    }
70
+}

+ 35
- 0
JPK_VDEK/Core/US.cs View File

1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace JPK_VDEK.Core
8
+{
9
+    public class US
10
+    {
11
+        private List<UsDIDIC> list;
12
+
13
+        public US()
14
+        {
15
+            list = new List<UsDIDIC>();
16
+            UsDIDIC d = new UsDIDIC();
17
+            d.Kod = "0271";
18
+            d.Describe = "DOLNOŚLĄSKI URZĄD SKARBOWY WE WROCŁAWJU";
19
+            list.Add(d);
20
+            d = new UsDIDIC();
21
+            d.Kod = "0225";
22
+            d.Describe = "URZĄD SKARBOWY WROCŁAW-KRZYKI";
23
+            list.Add(d);
24
+        }
25
+
26
+
27
+        public List<UsDIDIC> Lista { get { return list; } }
28
+    }
29
+
30
+    public class UsDIDIC
31
+    {
32
+        public String Kod { get; set; }
33
+        public String Describe { get; set; }
34
+    }
35
+}

+ 2
- 0
JPK_VDEK/JPK_VDEK.csproj View File

60
     </Compile>
60
     </Compile>
61
     <Compile Include="Core\JG.cs" />
61
     <Compile Include="Core\JG.cs" />
62
     <Compile Include="Core\JPKSumyKontrola.cs" />
62
     <Compile Include="Core\JPKSumyKontrola.cs" />
63
+    <Compile Include="Core\TCels.cs" />
64
+    <Compile Include="Core\US.cs" />
63
     <Compile Include="Deklaracja.xaml.cs">
65
     <Compile Include="Deklaracja.xaml.cs">
64
       <DependentUpon>Deklaracja.xaml</DependentUpon>
66
       <DependentUpon>Deklaracja.xaml</DependentUpon>
65
     </Compile>
67
     </Compile>

+ 2
- 0
JPK_VDEK/JpkSap.xaml View File

10
         <Label Content="Cel złożenia" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
10
         <Label Content="Cel złożenia" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
11
         <Label Content="Urząd" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top"/>
11
         <Label Content="Urząd" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top"/>
12
         <Button Content="5. Wygeneruj" HorizontalAlignment="Left" Margin="363,80,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>
12
         <Button Content="5. Wygeneruj" HorizontalAlignment="Left" Margin="363,80,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>
13
+        <ComboBox HorizontalAlignment="Left" Name="cCel" Margin="114,13,0,0" VerticalAlignment="Top" Width="324"/>
14
+        <ComboBox HorizontalAlignment="Left"  Name="cUrz" Margin="114,44,0,0" VerticalAlignment="Top" Width="324"/>
13
 
15
 
14
     </Grid>
16
     </Grid>
15
 </UserControl>
17
 </UserControl>

+ 19
- 1
JPK_VDEK/JpkSap.xaml.cs View File

23
         public JpkSap()
23
         public JpkSap()
24
         {
24
         {
25
             InitializeComponent();
25
             InitializeComponent();
26
+            foreach (var item in JpkData.getJpk().Cel.Cel)
27
+            {
28
+                cCel.Items.Add(item.Describe);
29
+            }
30
+            foreach (var item in JpkData.getJpk().Urz.Lista)
31
+            {
32
+                cUrz.Items.Add(item.Describe);
33
+            }
34
+
26
         }
35
         }
27
 
36
 
28
         private void Button_Click(object sender, RoutedEventArgs e)
37
         private void Button_Click(object sender, RoutedEventArgs e)
29
         {
38
         {
30
-            string s = JpkData.getJpk().outScalony;
39
+            if (JpkData.getJpk().wczytalemGL == true)
40
+            {
41
+                string s = JpkData.getJpk().outScalony;
42
+                int scel = cCel.SelectedIndex;
43
+                int urz = cUrz.SelectedIndex;
44
+                JpkData.getJpk().setCel(scel);
45
+                JpkData.getJpk().setUrzad(urz);
46
+                JPK jpk = JpkData.getBaseJpk();
47
+                jpk.SaveToFile(s);
48
+            }
31
         }
49
         }
32
     }
50
     }
33
 }
51
 }

+ 1
- 0
JPK_VDEK/Ogolne.xaml.cs View File

617
                     JpkData.getJpk().ZakupCtrl.LiczbaWierszyZakupow = liczbaWZp.ToString();
617
                     JpkData.getJpk().ZakupCtrl.LiczbaWierszyZakupow = liczbaWZp.ToString();
618
                     JpkData.getJpk().ZakupCtrl.PodatekNaliczony = podNali;
618
                     JpkData.getJpk().ZakupCtrl.PodatekNaliczony = podNali;
619
                 }
619
                 }
620
+                JpkData.getJpk().wczytalemGL = true;
620
                 win.DataContext = JpkData.getJpk();
621
                 win.DataContext = JpkData.getJpk();
621
             }
622
             }
622
             catch (FileNotFoundException ex)
623
             catch (FileNotFoundException ex)