예제 #1
0
        public static SalaryDetailsViewModel GetSalaryDetailsViewModel(XDocument xml, string tin)
        {
            SalaryDetailsViewModel model;


            // Διαβάζουμε για τον υπαλληλο το Indentification XElement και το αντίστοιχο SalaryEmployeeInfo instance
            XElement identification = EapXMLTool.GetEmployeeIdentification(xml, tin);

            if (identification != null)
            {
                SalaryEmployeeInfo employee = EapXMLTool.GetEmployeeInfoFromElement(identification);

                // Διαβάζουμε το payment parent XElement του Identification
                XElement payment = EapXMLTool.GetEmployeePaymentParent(identification);
                // και παίρνουμε όλα τα incomes του υπαλληλου
                IEnumerable <XElement> incomes = EapXMLTool.GetPaymentIncomes(payment);

                // κρατάμε τα incomes τακτικής μισθοδοσίας και αναδρομικών
                IEnumerable <XElement> incomesTaktikhs    = EapXMLTool.GetPaymentIncomesOfType(incomes, 0);
                IEnumerable <XElement> incomesAnadromikwn = EapXMLTool.GetPaymentIncomesOfType(incomes, 1);

                IEnumerable <XElement> incomesTrimhnes    = EapXMLTool.GetPaymentIncomesOfType(incomes, 2);
                IEnumerable <XElement> incomesEkpApodoxwn = EapXMLTool.GetPaymentIncomesOfType(incomes, 3);

                IEnumerable <XElement> incomesApozhmiwsh       = EapXMLTool.GetPaymentIncomesOfType(incomes, 4);
                IEnumerable <XElement> incomesApozhmiwshAdeias = EapXMLTool.GetPaymentIncomesOfType(incomes, 5);

                IEnumerable <XElement> incomesEteroxronismenh = EapXMLTool.GetPaymentIncomesOfType(incomes, 6);



                SalaryEmployeeDetails detailsTaktikwn    = EapXMLTool.GetPaymentTaktikisAmounts(incomesTaktikhs.ToList(), 0);
                SalaryEmployeeDetails detailsAnadromikwn = EapXMLTool.GetPaymentTaktikisAmounts(incomesAnadromikwn.ToList(), 1);

                SalaryEmployeeDetails detailsTrimhnesApodoxes = EapXMLTool.GetPaymentTaktikisAmounts(incomesTrimhnes.ToList(), 2);
                SalaryEmployeeDetails detailsEkpaidApodoxes   = EapXMLTool.GetPaymentTaktikisAmounts(incomesEkpApodoxwn.ToList(), 3);

                SalaryEmployeeDetails detailsApozhmiwsh       = EapXMLTool.GetPaymentTaktikisAmounts(incomesApozhmiwsh.ToList(), 4);
                SalaryEmployeeDetails detailsApozhmiwshAdeias = EapXMLTool.GetPaymentTaktikisAmounts(incomesApozhmiwshAdeias.ToList(), 5);

                SalaryEmployeeDetails detailsEteroxronismenh = EapXMLTool.GetPaymentTaktikisAmounts(incomesEteroxronismenh.ToList(), 6);


                SalaryTotals ABamounts = EapXMLTool.GetPaymentABAmounts(payment);


                model = new SalaryDetailsViewModel();

                model.SalaryEmployee     = employee;
                model.SalaryTotalAmounts = ABamounts;
                model.SalaryDetalis      = new List <SalaryEmployeeDetails>();

                if (detailsTaktikwn != null)
                {
                    model.SalaryDetalis.Add(detailsTaktikwn);
                }
                if (detailsAnadromikwn != null)
                {
                    model.SalaryDetalis.Add(detailsAnadromikwn);
                }

                if (detailsTrimhnesApodoxes != null)
                {
                    model.SalaryDetalis.Add(detailsTrimhnesApodoxes);
                }
                if (detailsEkpaidApodoxes != null)
                {
                    model.SalaryDetalis.Add(detailsEkpaidApodoxes);
                }

                if (detailsApozhmiwsh != null)
                {
                    model.SalaryDetalis.Add(detailsApozhmiwsh);
                }
                if (detailsApozhmiwshAdeias != null)
                {
                    model.SalaryDetalis.Add(detailsApozhmiwshAdeias);
                }

                if (detailsEteroxronismenh != null)
                {
                    model.SalaryDetalis.Add(detailsEteroxronismenh);
                }


                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Επιστρέφει τα σύνολο για ΑΜΟΙΒΕΣ, ΚΡΑΤΗΣΕΙΣ, ΕΡΓΟΔΟΤΙΚΕΣ για
        /// τα income Τακτικής Μισθοδοσίας
        /// </summary>
        /// <param name="incomestaktikhs">Όλα τα income τακτικής</param>
        /// <returns>Ενα SalaryEmployeeDetails για τακτικη</returns>
        public static SalaryEmployeeDetails GetPaymentTaktikisAmounts(IList <XElement> incomestaktikhs, int incomeType)
        {
            SalaryEmployeeDetails employeeItm = null;

            if (incomestaktikhs.Count() > 0)
            {
                employeeItm             = new SalaryEmployeeDetails();
                employeeItm.Amoibes     = new List <SalaryAmounts>();
                employeeItm.ErgEisfores = new List <SalaryAmounts>();
                employeeItm.Krathseis   = new List <SalaryAmounts>();

                // εφόσον ειναι Τακτική, καθαρίζουμε τις τιμές
                // στα properties για την περίπτωση αναδρομικού
                // TODO ΟΛΕΣ ΤΙΣ ΠΕΡΙΠΤΩΣΕΙΣ....
                employeeItm.Type = 444;
                switch (incomeType)
                {
                case 0:
                    employeeItm.Type = 0;
                    break;

                case 1:
                    employeeItm.Type = 1;

                    employeeItm.EndDate     = Convert.ToDateTime(incomestaktikhs.First().Attribute("endDate").Value).ToString("dd/M/yyyy");
                    employeeItm.StartDate   = Convert.ToDateTime(incomestaktikhs.First().Attribute("startDate").Value).ToString("dd/M/yyyy");
                    employeeItm.PeriodCount = null;

                    break;

                case 2:
                    employeeItm.Type = 2;
                    break;

                case 3:
                    employeeItm.Type = 3;
                    break;

                case 4:
                    employeeItm.Type = 4;
                    break;

                case 5:
                    employeeItm.Type = 5;
                    break;

                case 6:
                    employeeItm.Type = 6;
                    break;
                }

                employeeItm.TypeDescriptionText = DisplayNameHelper.GetEnumStringValue((TyposEisodhmatos)employeeItm.Type);
                employeeItm.TypeDisplayText     = DisplayNameHelper.GetEnumVocativeDescription((TyposEisodhmatos)employeeItm.Type);



                employeeItm.Amoibes     = EapXMLTool.GetSalaryAmounts(incomestaktikhs, "gr", "kae");
                employeeItm.ErgEisfores = EapXMLTool.GetSalaryAmounts(incomestaktikhs, "et", "code");
                employeeItm.Krathseis   = EapXMLTool.GetSalaryAmounts(incomestaktikhs, "de", "code");
            }


            return(employeeItm);
        }