Beispiel #1
0
        private Taxis GetCorrectTaxis(string Afm, Upload newUpload)
        {
            IEnumerable <Taxis> possibleTaxis = Docs.TaxisList.Where(x => x.Complete).Where(x => x.DocType == 0);

            if (possibleTaxis.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε εκτύπωση προσωποποιημένης πληροφόρησης (μέσω TaxisNET) σε αναγνώσιμη μορφή" + "\n";
                return(null);
            }
            possibleTaxis = possibleTaxis.Where(x => x.Afm == Afm);
            if (possibleTaxis.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε αναγνώσιμη εκτύπωση προσωποποιημένης πληροφόρησης (μέσω TaxisNET) με το ΑΦΜ της εταιρίας" + "\n";
                return(null);
            }
            possibleTaxis = possibleTaxis.Where(x => x.Region == Region);
            if (possibleTaxis.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε αναγνώσιμη εκτύπωση προσωποποιημένης πληροφόρησης (μέσω TaxisNET) με το ΑΦΜ της εταιρίας στην περιφέρεια υλοποίησης" + "\n";
                return(null);
            }

            Taxis correctTaxisCompany = possibleTaxis.FirstOrDefault();

            newUpload.Log += "Τα στοιχεία προσωποποιημένης πληροφόρησης (μέσω TaxisNET) αντλήθηκαν από το αρχείο " + Path.GetFileName(correctTaxisCompany.FilePath) + "\n";

            return(correctTaxisCompany);
        }
Beispiel #2
0
        public void AddTaxis(string path)
        {
            Taxis newTaxis = new Taxis();

            newTaxis.FilePath = path;
            Documents.Add(newTaxis);
            try
            {
                newTaxis.Scan();
            }
            catch
            {
                newTaxis.ParsingErrorExternal = true;
            }
        }
Beispiel #3
0
        public Upload CreateUpload()
        {
            ValidationInfo vInfo = Functions.GetAfmFromCode(Functions.Greekify(Code));

            try
            {
                string afmtest = vInfo.Afm;
            }
            catch
            {
                Removed = true;
            }
            string        Afm          = vInfo.Afm;
            List <string> DeclaredKads = vInfo.KadFormatted;
            List <Tuple <string, DateTime> > ValidKads = new List <Tuple <string, DateTime> >();

            Upload newUpload = new Upload();

            newUpload.Log           = "";
            newUpload.ProjectFileId = Functions.Greekify(Code);

            E3 correctE3 = GetCorrectE3(Afm, newUpload);

            Taxis correctTaxisCompany = GetCorrectTaxis(Afm, newUpload);

            F2_Info f2info2020 = GetCorrectF2(Afm, 2020, newUpload);
            F2_Info f2info2019 = GetCorrectF2(Afm, 2019, newUpload);

            if (correctE3 != null && correctE3.Afm == Afm)
            {
                newUpload.f102E32019          = correctE3.Values.Where(x => x.Key == "102").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f202E32019          = correctE3.Values.Where(x => x.Key == "202").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f181E32019          = correctE3.Values.Where(x => x.Key == "181").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f281E32019          = correctE3.Values.Where(x => x.Key == "281").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f481E32019          = correctE3.Values.Where(x => x.Key == "481").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f185E32019          = correctE3.Values.Where(x => x.Key == "185").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f285E32019          = correctE3.Values.Where(x => x.Key == "285").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.f485E32019          = correctE3.Values.Where(x => x.Key == "485").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.Turnover2019        = correctE3.Values.Where(x => x.Key == "500").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.EBITDA2019          = correctE3.Values.Where(x => x.Key == "524").Single().Value.Value.ToString("N2").Replace(",", "");
                newUpload.KadSuggestBiggest   = new KadUpload();
                newUpload.KadSuggestBiggest.a = Functions.Kadify(correctE3.KadIncome);
                newUpload.KadSuggestMain      = new KadUpload();
                newUpload.KadSuggestMain.a    = Functions.Kadify(correctE3.KadMain);
            }

            if (f2info2019 != null)
            {
                newUpload.Turnover2019A     = f2info2019.WorkCycle.ToString("N2").Replace(",", "");
                newUpload.Turnover2019A_311 = f2info2019.Outflow.ToString("N2").Replace(",", "");
                if (f2info2019.FilePaths.Count == 1)
                {
                    newUpload.Log += "Τα στοιχεία Φ2 2019 αντλήθηκαν από το αρχείο " + f2info2019.FilePaths.First() + "\n";
                }
                else
                {
                    newUpload.Log += "Τα στοιχεία Φ2 2019 αντλήθηκαν από τα αρχεία " + string.Join(",", f2info2019.FilePaths) + "\n";
                }
            }

            if (f2info2020 != null)
            {
                newUpload.Turnover2020B     = f2info2020.WorkCycle.ToString("N2").Replace(",", "");
                newUpload.Turnover2020B_311 = f2info2020.Outflow.ToString("N2").Replace(",", "");
                if (f2info2020.FilePaths.Count == 1)
                {
                    newUpload.Log += "Τα στοιχεία Φ2 2020 αντλήθηκαν από το αρχείο " + f2info2020.FilePaths.First() + "\n";
                }
                else
                {
                    newUpload.Log += "Τα στοιχεία Φ2 2020 αντλήθηκαν από τα αρχεία " + string.Join(",", f2info2020.FilePaths) + "\n";
                }
            }

            if (correctTaxisCompany != null)
            {
                newUpload.TaxCode      = correctTaxisCompany.Afm;
                newUpload.LegalName    = correctTaxisCompany.CompanyName;
                newUpload.FoundingDate = correctTaxisCompany.StartDate.ToString("dd/MM/yyyy");
                newUpload.PostCode     = correctTaxisCompany.PostCode;
                if (correctE3 != null)
                {
                    newUpload.KadSuggestBiggest.b = correctTaxisCompany.Kads.Where(x => x.Code == correctE3.KadIncome && x.DateEnd == null).Single().DateStart.ToString("dd/MM/yyyy");
                    newUpload.KadSuggestBiggest.c = correctTaxisCompany.PostCode;
                    newUpload.KadSuggestMain.b    = correctTaxisCompany.Kads.Where(x => x.Code == correctE3.KadMain && x.DateEnd == null).SingleOrDefault().DateStart.ToString("dd/MM/yyyy");
                    newUpload.KadSuggestMain.c    = correctTaxisCompany.PostCode;
                }

                if (correctTaxisCompany.Establishments == null)
                {
                    return(newUpload);
                }

                if (correctTaxisCompany.Establishments.Count > 0)
                {
                    if (TaxisEstablishment.Where(x => x.Complete).Count() > 0)
                    {
                        newUpload.KadImplementationPlaces = new List <KadUpload>();
                        foreach (var est in TaxisEstablishment.Where(x => x.Complete))
                        {
                            foreach (var kad in est.Kads)
                            {
                                KadUpload newKad = new KadUpload();
                                newKad.a = Functions.Kadify(kad.Code);
                                newKad.b = kad.DateStart.ToString("dd/MM/yyyy");
                                newKad.c = est.PostCode;
                                newUpload.KadImplementationPlaces.Add(newKad);
                            }
                        }
                        newUpload.Log += "Τα στοιχεία εγκαταστάσεων εσωτερικού (μέσω TaxisNET) αντλήθηκαν από τα αρχεία "
                                         + string.Join(", ", TaxisEstablishment.Where(x => x.Complete).Select(x => Path.GetFileName(x.FilePath)))
                                         + "\n";
                    }
                    else
                    {
                        newUpload.Log += "Δεν βρέθηκε εκτύπώση εγκαταστάσεων εσωτερικού (μέσω TaxisNET) σε αναγνώσιμη μορφή" + "\n";
                    }
                }
            }
            return(newUpload);
        }