示例#1
0
        private E3 GetCorrectE3(string Afm, Upload newUpload)
        {
            IEnumerable <E3> possibleE3s = Docs.E3s.Where(x => x.Complete);

            if (possibleE3s.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε Ε3 σε αναγνώσιμη μορφή" + "\n";
                return(null);
            }
            possibleE3s = possibleE3s.Where(x => x.Year == 2019);
            if (possibleE3s.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε αναγνώσιμος Ε3 για το φορολογικό έτος 2019" + "\n";
                return(null);
            }
            possibleE3s = possibleE3s.Where(x => x.Afm == Afm);
            if (possibleE3s.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε αναγνώσιμος Ε3 για το φορολογικό έτος 2019 με το ΑΦΜ της εταιρίας" + "\n";
                return(null);
            }
            possibleE3s = possibleE3s.Where(x => !string.IsNullOrWhiteSpace(x.FormNumber));
            if (possibleE3s.Count() == 0)
            {
                newUpload.Log += "Δεν βρέθηκε αναγνώσιμος Ε3 για το φορολογικό έτος 2019 με το ΑΦΜ της εταιρίας και αριθμό υποβολής" + "\n";
                return(null);
            }

            E3 correctE3 = possibleE3s.OrderByDescending(x => x.FormNumber).FirstOrDefault();

            newUpload.Log += "Τα οικονομικά στοιχεία (Ε3) αντλήθηκαν από το αρχείο " + Path.GetFileName(correctE3.FilePath) + "\n";

            return(correctE3);
        }
示例#2
0
        public void AddE3(string path)
        {
            E3 newE3 = new E3();

            newE3.FilePath = path;
            Documents.Add(newE3);
            try
            {
                newE3.ScanE3(path);
            }
            catch
            {
                newE3.ParsingErrorExternal = true;
            }
        }
示例#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);
        }