public ujRendeles()
 {
     InitializeComponent();
     this.dataGrid.DataContext = XMLBuilder.Get;
     uj = new Rendeles();
     this.DataContext = uj;
     osszeg           = 0;
 }
Ejemplo n.º 2
0
        public rendeles_megnezese(Rendeles rendeles, MainWindow main)
        {
            InitializeComponent();

            r = rendeles;
            this.DataContext = rendeles;
            this.main        = main;
        }
Ejemplo n.º 3
0
        public string Termekek_Szovegge(Rendeles rendeles)
        {
            string s = "";

            foreach (Rendelt_termek termek in rendeles.Rendelt_termekek)
            {
                s += ":" + termek.TermekID.ToString() + ":" + termek.TermekNameHUN + ":" + termek.TermekNamePL + ":" + termek.Suly + ":" + termek.Ar_Beszerzesi + ":" + termek.Ar_Eladasi + ":" + termek.Db + ":" + termek.KartonDB + ":" + termek.Company + ";";
            }
            return(s);
        }
Ejemplo n.º 4
0
        private void rendelesmegnezese_button_Click(object sender, RoutedEventArgs e)
        {
            if (rendeles_datagrid.SelectedItem != null)
            {
                this.Opacity = 0.85;

                Rendeles           rendeles = (Rendeles)rendeles_datagrid.SelectedItem;
                rendeles_megnezese ablak    = new rendeles_megnezese(rendeles, this);

                ablak.ShowDialog();
                this.Opacity = 1;
            }
        }
Ejemplo n.º 5
0
        public void AddRendeles(Rendeles rendeles)
        {
            var q = new XElement("rendelés",
                                 new XElement("id", rendeles.Rendeles_id.ToString()),
                                 new XElement("termékek", Termekek_Szovegge(rendeles)),
                                 new XElement("date", rendeles.Date.ToString()),
                                 new XElement("pln", rendeles.Pln.ToString()),
                                 new XElement("eur", rendeles.Eur.ToString()),
                                 new XElement("összeg", rendeles.Osszeg.ToString()),
                                 new XElement("lejárat", rendeles.Lejarat.ToString()));

            doc.Root.Add(q);
            doc.Save("adatok.xml");
            rendelesDB++;
        }
Ejemplo n.º 6
0
        public void LejaratiModosit(Rendeles rendeles, DateTime lejarati)
        {
            if (rendeles != null)
            {
                var q = doc.Root.Descendants("rendelés").Where(
                    elem => elem.Element("id").Value == rendeles.Rendeles_id.ToString()).FirstOrDefault();
                q.Element("lejárat").Value = rendeles.Lejarat.ToString();
                doc.Save("adatok.xml");

                foreach (Rendeles t in rendeleslist)
                {
                    if (t.Rendeles_id == rendeles.Rendeles_id)
                    {
                        rendeleslist[rendeleslist.IndexOf(t)].Lejarat     = rendeles.Lejarat;
                        rendeleslist[rendeleslist.IndexOf(t)].Hatra       = rendeles.Hatra;
                        rendeleslist[rendeleslist.IndexOf(t)].LejaratMEGJ = rendeles.LejaratMEGJ;
                        rendeleslist[rendeleslist.IndexOf(t)].HatraMEGJ   = rendeles.HatraMEGJ;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void Write_PDF(Rendeles rendeles)
        {
            List <Rendelt_termek> egyikLista = new List <Rendelt_termek>();
            List <Rendelt_termek> masikLista = new List <Rendelt_termek>();
            string pdfNev = "";

            foreach (Rendelt_termek r_termek in rendeles.Rendelt_termekek) //Termékek szétválogatása (cég)
            {
                if (r_termek.Company == "Plawristy")
                {
                    egyikLista.Add(r_termek);
                }
                else if (r_termek.Company == "Milk Co.")
                {
                    masikLista.Add(r_termek);
                }
            }

            if (!egyikLista.Any())
            {
                pdfNev = rendeles.Date.ToString("yyyy-MM-dd") + "_Milk Co.";

                FileStream fs     = new FileStream(@"rendelesek/" + pdfNev + ".pdf", FileMode.Create);
                Document   doc    = new Document(PageSize.A4);
                PdfWriter  writer = PdfWriter.GetInstance(doc, fs);

                int db = 1;

                doc.Open();
                BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_BOLD, BaseFont.CP1252, false);
                Font     font    = new Font(bfTimes, 18, Font.NORMAL);

                doc.Add(new Paragraph("Order of Excellent Food Bt.", font));
                doc.Add(new Paragraph("Date: " + rendeles.Date.ToString("yyyy.MM.dd.")));
                doc.Add(new Paragraph("-----------------"));
                double priceSum  = 0;
                double weightSum = 0;
                foreach (Rendelt_termek r_termek in masikLista)
                {
                    doc.Add(new Paragraph(db++.ToString() + ". " +
                                          r_termek.TermekNamePL + " (" + r_termek.TermekNameHUN + ") - " +
                                          r_termek.Suly.ToString() + "g - " +
                                          r_termek.Ar_Beszerzesi.ToString() + "€" + " - " +
                                          r_termek.Db.ToString() + " unit"
                                          ));
                    priceSum  += r_termek.Ar_Beszerzesi * r_termek.Db * r_termek.KartonDB;
                    weightSum += r_termek.Suly * r_termek.Db * r_termek.KartonDB;
                }
                doc.Add(new Paragraph("-----------------"));
                doc.Add(new Paragraph("Ár összesen: " + priceSum.ToString() + "€"));
                doc.Add(new Paragraph("Összsúly: " + (weightSum / 1000).ToString() + "kg"));
                doc.Close();
                writer.Close();
                fs.Close();
            }
            else if (!masikLista.Any())
            {
                pdfNev = rendeles.Date.ToString("yyyy-MM-dd") + "_Plawristy";

                FileStream fs     = new FileStream(@"rendelesek/" + pdfNev + ".pdf", FileMode.Create);
                Document   doc    = new Document(PageSize.A4);
                PdfWriter  writer = PdfWriter.GetInstance(doc, fs);

                int db = 1;

                doc.Open();
                BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_BOLD, BaseFont.CP1252, false);
                Font     font    = new Font(bfTimes, 18, Font.NORMAL);

                doc.Add(new Paragraph("Order of Excellent Food Bt.", font));
                doc.Add(new Paragraph("Date: " + rendeles.Date.ToString("yyyy.MM.dd.")));
                doc.Add(new Paragraph("-----------------"));
                double priceSum  = 0;
                double weightSum = 0;
                foreach (Rendelt_termek r_termek in egyikLista)
                {
                    doc.Add(new Paragraph(db++.ToString() + ". " +
                                          r_termek.TermekNamePL + " (" + r_termek.TermekNameHUN + ") - " +
                                          r_termek.Suly.ToString() + "g - " +
                                          r_termek.Ar_Beszerzesi.ToString() + " zl" + " - " +
                                          r_termek.Db.ToString() + " unit"
                                          ));
                    priceSum  += r_termek.Ar_Beszerzesi * r_termek.Db * r_termek.KartonDB;
                    weightSum += r_termek.Suly * r_termek.Db * r_termek.KartonDB;
                }
                doc.Add(new Paragraph("-----------------"));
                doc.Add(new Paragraph("Ár összesen: " + priceSum.ToString() + "zl"));
                doc.Add(new Paragraph("Összsúly: " + (weightSum / 1000).ToString() + "kg"));
                doc.Close();
                writer.Close();
                fs.Close();
            }
            else if (!egyikLista.Any() && !masikLista.Any()) //Üres a rendelés
            {
                MessageBox.Show("Nem rendeltél semmit!", "Hiba", MessageBoxButton.OK);
            }
            else //Mind2ből vannak
            {
                string pdfNev1 = rendeles.Date.ToString("yyyy-MM-dd") + "_Plawristy";
                string pdfNev2 = rendeles.Date.ToString("yyyy-MM-dd") + "_Milk Co.";

                FileStream fs1     = new FileStream(@"rendelesek/" + pdfNev1 + ".pdf", FileMode.Create);
                Document   doc1    = new Document(PageSize.A4);
                PdfWriter  writer1 = PdfWriter.GetInstance(doc1, fs1);

                int db1 = 1; //Egyik cégé

                doc1.Open();
                BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_BOLD, BaseFont.CP1252, false);
                Font     font    = new Font(bfTimes, 18, Font.NORMAL);

                doc1.Add(new Paragraph("Order of Excellent Food Bt.", font));
                doc1.Add(new Paragraph("Date: " + rendeles.Date.ToString("yyyy.MM.dd.")));
                doc1.Add(new Paragraph("-----------------"));
                double priceSum  = 0;
                double weightSum = 0;
                foreach (Rendelt_termek r_termek in egyikLista)
                {
                    doc1.Add(new Paragraph(db1++.ToString() + ". " +
                                           r_termek.TermekNamePL + " (" + r_termek.TermekNameHUN + ") - " +
                                           r_termek.Suly.ToString() + "g - " +
                                           r_termek.Ar_Beszerzesi.ToString() + " zl" + " - " +
                                           r_termek.Db.ToString() + " unit"
                                           ));
                    priceSum  += r_termek.Ar_Beszerzesi * r_termek.Db * r_termek.KartonDB;
                    weightSum += r_termek.Suly * r_termek.Db * r_termek.KartonDB;
                }
                doc1.Add(new Paragraph("-----------------"));
                doc1.Add(new Paragraph("Ár összesen: " + priceSum.ToString() + "zl"));
                doc1.Add(new Paragraph("Összsúly: " + (weightSum / 1000).ToString() + "kg"));
                doc1.Close();
                writer1.Close();
                fs1.Close();

                FileStream fs2     = new FileStream(@"rendelesek/" + pdfNev2 + ".pdf", FileMode.Create);
                Document   doc2    = new Document(PageSize.A4);
                PdfWriter  writer2 = PdfWriter.GetInstance(doc2, fs2);

                int db2 = 1; //Másik cégé

                doc2.Open();

                doc2.Add(new Paragraph("Order of Excellent Food Bt.", font));
                doc2.Add(new Paragraph("Date: " + rendeles.Date.ToString("yyyy.MM.dd.")));
                doc2.Add(new Paragraph("-----------------"));
                double priceSum2  = 0;
                double weightSum2 = 0;
                foreach (Rendelt_termek r_termek in masikLista)
                {
                    doc2.Add(new Paragraph(db2++.ToString() + ". " +
                                           r_termek.TermekNamePL + " (" + r_termek.TermekNameHUN + ") - " +
                                           r_termek.Suly.ToString() + "g - " +
                                           r_termek.Ar_Beszerzesi.ToString() + "€" + " - " +
                                           r_termek.Db.ToString() + " unit"
                                           ));
                    priceSum2  += r_termek.Ar_Beszerzesi * r_termek.Db * r_termek.KartonDB;
                    weightSum2 += r_termek.Suly * r_termek.Db * r_termek.KartonDB;
                }
                doc2.Add(new Paragraph("-----------------"));
                doc2.Add(new Paragraph("Ár összesen: " + priceSum2.ToString() + "€"));
                doc2.Add(new Paragraph("Összsúly: " + (weightSum2 / 1000).ToString() + "kg"));
                doc2.Close();
                writer2.Close();
                fs2.Close();
            }
        }