Esempio n. 1
0
        public F2_Info GetF2Info(int year, IEnumerable <F2> f2s)
        {
            F2_Info info = new F2_Info();

            info.Year      = year;
            info.FilePaths = new List <string>();
            List <F2> correctF2s = new List <F2>();

            if (f2s.Count() == 1)
            {
                var f2 = f2s.First();
                if (f2.DateStart.Month == 4 && f2.DateEnd.Month == 6)
                {
                    correctF2s.Add(f2);
                }
                info.FilePaths.Add(f2.FileName);
                info.WorkCycle = f2.WorkCycle;
                info.Outflow   = f2.Outflow;
                return(info);
            }
            if (f2s.Count() == 3)
            {
                f2s = f2s.OrderBy(x => x.DateStart);
                if (f2s.First().DateStart.Month == 4 && f2s.Last().DateEnd.Month == 6)
                {
                    correctF2s.AddRange(f2s);
                }
                info.FilePaths = correctF2s.Select(x => x.FilePath).ToList();
                info.WorkCycle = correctF2s.Sum(x => x.WorkCycle);
                info.Outflow   = correctF2s.Sum(x => x.Outflow);
                return(info);
            }
            return(null);
        }
Esempio n. 2
0
        private F2_Info GetCorrectF2(string Afm, int year, Upload newUpload)
        {
            IEnumerable <F2> possibleF2s = Docs.F2s.Where(x => x.Year == year);

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

            F2_Info info = GetF2Info(year, possibleF2s);

            try
            {
                newUpload.Log += info.Log + "\n";
            }
            catch { }
            return(info);
        }
Esempio n. 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);
        }