Exemple #1
0
        public async Task <JsonResult> GetDetail(Guid surveyID)
        {
            var client    = new Client <NOMEvaluationQuestion>(String.Empty, ClientConfiguration.GetAdapterFromConfig());
            var questions = await client.FindAsync(e => e.Active && e.NOMEvaluationPhase.NOMEvaluationSurveyID == surveyID, Guid.Empty, new string[] { "NOMEvaluationPhase" });

            var groupedQuestions = (from q in questions
                                    orderby q.NOMEvaluationPhase.Number
                                    group q by q.NOMEvaluationPhaseID into gq
                                    select gq).ToList();

            var phases = (from gq in groupedQuestions
                          select new
            {
                name = questions.FirstOrDefault(x => x.NOMEvaluationPhase.ID == gq.Key).NOMEvaluationPhase.Name,
                number = questions.FirstOrDefault(x => x.NOMEvaluationPhase.ID == gq.Key).NOMEvaluationPhase.Number,
                questions = from gq2 in gq
                            select new
                {
                    qid = gq2.ID,
                    qnumber = gq2.Number,
                    qname = gq2.Name,
                    qvalue = ""
                }
            }).ToList();

            return(Json(phases));
        }
        public InhabilityController()
        {
            SessionModel.Initialize();
            var clientAdapter = ClientConfiguration.GetAdapterFromConfig();

            client             = new Client <Inhability>(SessionModel.AuthorizationHeader, clientAdapter);
            _calculationClient = new CalculationClient(SessionModel.AuthorizationHeader, clientAdapter);
        }
Exemple #3
0
 public SettlementProcessController()
 {
     SessionModel.Initialize();
     client = new Client <Overdraft>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
     settlementProcessClient = new SettlementProcessClient(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
     employeeClient          = new Client <Employee>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
     statusClient            = new StatusClient <Employee>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
 }
        public HistoricEmployeesController()
        {
            SessionModel.Initialize();
            clientAdapter = ClientConfiguration.GetAdapterFromConfig();
            var authorization = SessionModel.AuthorizationHeader;

            client = new Client <HistoricEmployee>(authorization, clientAdapter);
            _clientEmployerRegistration = new Client <EmployerRegistration>(authorization, clientAdapter);
        }
        public PeriodsController()
        {
            SessionModel.Initialize();
            var adapterFromConfig = ClientConfiguration.GetAdapterFromConfig();

            clientPT          = new Client <PeriodType>(SessionModel.AuthorizationHeader, clientadapter: adapterFromConfig);
            clientPD          = new Client <PeriodDetail>(SessionModel.AuthorizationHeader, clientadapter: adapterFromConfig);
            clientPeriod      = new Client <Period>(SessionModel.AuthorizationHeader, clientadapter: adapterFromConfig);
            calculationClient = new CalculationClient(SessionModel.AuthorizationHeader, clientadapter: adapterFromConfig);
        }
Exemple #6
0
        public VacationController()
        {
            SessionModel.Initialize();
            var clientAdapter = ClientConfiguration.GetAdapterFromConfig();

            client                = new Client <Vacation>(SessionModel.AuthorizationHeader, clientAdapter);
            pdClient              = new Client <PeriodDetail>(SessionModel.AuthorizationHeader, clientAdapter);
            vacationClientUtils   = new VacationClient(SessionModel.AuthorizationHeader, clientAdapter);
            vacationDaysOffClient = new Client <VacationDaysOff>(SessionModel.AuthorizationHeader, clientAdapter);
            _clientPeriodType     = new Client <PeriodType>(SessionModel.AuthorizationHeader, clientAdapter);
            _calculationClient    = new CalculationClient(SessionModel.AuthorizationHeader, clientAdapter);
        }
        public OverdraftController()
        {
            SessionModel.Initialize();
            var adapterConfig = ClientConfiguration.GetAdapterFromConfig();

            oddclient = new Client <OverdraftDetail>(SessionModel.AuthorizationHeader, adapterConfig);
            odclient  = new Client <Overdraft>(SessionModel.AuthorizationHeader, adapterConfig);
            cancelationFiscalDocumentDetailClient = new Client <CancelationFiscalDocumentDetail>(SessionModel.AuthorizationHeader, adapterConfig);
            calculationClient    = new CalculationClient(SessionModel.AuthorizationHeader, adapterConfig);
            previewerClient      = new PreviewerClient(SessionModel.AuthorizationHeader, adapterConfig);
            cancelStampingClient = new CancelStampingClient(SessionModel.AuthorizationHeader, adapterConfig);
        }
Exemple #8
0
        public EmployeeConceptsRelationDetailController()
        {
            SessionModel.Initialize();
            var clientAdapter       = ClientConfiguration.GetAdapterFromConfig();
            var authorizationHeader = SessionModel.AuthorizationHeader;

            _client = new Client <FonacotMovement>(authorizationHeader, clientAdapter);
            _clientEmployeeConceptsRelationDetail = new Client <EmployeeConceptsRelationDetail>(authorizationHeader, clientAdapter);
            _clientOverdraftDetail = new Client <OverdraftDetail>(authorizationHeader, clientAdapter);
            calculationClient      = new CalculationClient(authorizationHeader, clientAdapter);
            employeeConceptsRelationDetailClient = new EmployeeConceptsRelationDetailClient(authorizationHeader, clientAdapter);
        }
Exemple #9
0
        public async Task <JsonResult> GetAllActive(String token)
        {
            var client  = new Client <NOMEvaluationSurvey>(String.Empty, ClientConfiguration.GetAdapterFromConfig());
            var surveys = await client.FindAsync(e => e.Active, Guid.Empty, new String[] { "NOMEvaluationGuide" });

            var result = from s in surveys
                         orderby s.NOMEvaluationGuide.Number
                         select new
            {
                s.ID,
                s.Name,
                s.Description,
                Guide = s.NOMEvaluationGuide.Name,
            };

            return(Json(result));
        }
        public InfonavitController()
        {
            SessionModel.Initialize();
            var adapterClient   = ClientConfiguration.GetAdapterFromConfig();
            var authHeaderToken = SessionModel.AuthorizationHeader;

            client = new Client <InfonavitMovement>(authHeaderToken, adapterClient);
            _conceptPaymentclient           = new Client <ConceptPayment>(authHeaderToken, adapterClient);
            _calculationClient              = new CalculationClient(authHeaderToken, adapterClient);
            _clientEmployeeConceptsRelation = new Client <EmployeeConceptsRelation>(authHeaderToken, adapterClient);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <InfonavitMovement, EmployeeConceptsRelation>();
            });

            _mapper = config.CreateMapper();
        }
Exemple #11
0
        public EmployeesController()
        {
            SessionModel.Initialize();
            var clientAdapter = ClientConfiguration.GetAdapterFromConfig();

            client = new Client <Employee>(SessionModel.AuthorizationHeader,
                                           clientadapter: clientAdapter);
            employeeIdentityRegistrationClient = new EmployeeIdentityRegistrationClient(SessionModel.AuthorizationHeader,
                                                                                        clientadapter: clientAdapter);
            _clientEmployeeSalary = new Client <EmployeeSalaryIncrease>(SessionModel.AuthorizationHeader,
                                                                        clientadapter: clientAdapter);
            clientPD = new Client <PeriodDetail>(SessionModel.AuthorizationHeader,
                                                 clientadapter: clientAdapter);
            _calculationClient = new CalculationClient(SessionModel.AuthorizationHeader,
                                                       clientadapter: clientAdapter);
            _clientEmployeeSBCAdjustment = new Client <EmployeeSBCAdjustment>(SessionModel.AuthorizationHeader,
                                                                              clientadapter: clientAdapter);
        }
        public FonacotController()
        {
            SessionModel.Initialize();
            var clientAdapter       = ClientConfiguration.GetAdapterFromConfig();
            var authorizationHeader = SessionModel.AuthorizationHeader;

            _client = new Client <FonacotMovement>(authorizationHeader, clientAdapter);
            _clientEmployeeConceptsRelation = new Client <EmployeeConceptsRelation>(authorizationHeader, clientAdapter);
            _conceptPaymentclient           = new Client <ConceptPayment>(authorizationHeader, clientAdapter);
            _calculationClient = new CalculationClient(authorizationHeader, clientAdapter);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <FonacotMovementDTO, FonacotMovement>();
                cfg.CreateMap <FonacotMovementDTO, EmployeeConceptsRelation>();
            });

            _mapper = config.CreateMapper();
        }
        public PayrollCompanyConfigurationController()
        {
            SessionModel.Initialize();
            var clientAdapter = ClientConfiguration.GetAdapterFromConfig();

            _clientConfiguration = new Client <PayrollCompanyConfiguration>(SessionModel.AuthorizationHeader,
                                                                            clientadapter: clientAdapter);
            _clientAddress = new Client <Address>(SessionModel.AuthorizationHeader,
                                                  clientadapter: clientAdapter);
            _clientPeriodType = new Client <PeriodType>(SessionModel.AuthorizationHeader,
                                                        clientadapter: clientAdapter);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <PayrollCompanyConfiguration, PayrollCompanyConfigurationDTO>();
                cfg.CreateMap <PayrollCompanyConfigurationDTO, PayrollCompanyConfiguration>();
            });

            _mapper = config.CreateMapper();
        }
Exemple #14
0
        public PrePayrollController()
        {
            SessionModel.Initialize();
            var configClientAdapter = ClientConfiguration.GetAdapterFromConfig();

            authorizeClient    = new AuthorizeClient(SessionModel.AuthorizationHeader, configClientAdapter);
            clientPT           = new Client <Period>(SessionModel.AuthorizationHeader, configClientAdapter);
            clientPD           = new Client <PeriodDetail>(SessionModel.AuthorizationHeader, configClientAdapter);
            incidentsClient    = new Client <Incident>(SessionModel.AuthorizationHeader, configClientAdapter);
            vacationsClient    = new Client <Vacation>(SessionModel.AuthorizationHeader, configClientAdapter);
            inhabilitiesClient = new Client <Inhability>(SessionModel.AuthorizationHeader, configClientAdapter);
            clientOD           = new Client <OverdraftDetail>(SessionModel.AuthorizationHeader, configClientAdapter);
            clientO            = new Client <Overdraft>(SessionModel.AuthorizationHeader, configClientAdapter);
            conceptsClient     = new Client <ConceptPayment>(SessionModel.AuthorizationHeader, configClientAdapter);
            calculationClient  = new CalculationClient(SessionModel.AuthorizationHeader, configClientAdapter);
            stampingClient     = new StampingClient(SessionModel.AuthorizationHeader, configClientAdapter);
            clientCP           = new Client <catCFDI_CodigoPostal>(SessionModel.AuthorizationHeader, configClientAdapter);
            clientPCC          = new Client <PayrollCompanyConfiguration>(SessionModel.AuthorizationHeader, configClientAdapter);
            overdraftClient    = new OverdraftClient(SessionModel.AuthorizationHeader, configClientAdapter);
        }
Exemple #15
0
 public IMSSEmployeeTableController()
 {
     SessionModel.Initialize();
     client = new Client <IMSSEmployeeTable>(SessionModel.AuthorizationHeader, clientadapter:
                                             ClientConfiguration.GetAdapterFromConfig());
 }
 public SGDFLimitsController()
 {
     SessionModel.Initialize();
     client = new Client <SGDFLimits>(SessionModel.AuthorizationHeader, clientadapter:
                                      ClientConfiguration.GetAdapterFromConfig());
 }
 public MinimunSalariesController()
 {
     SessionModel.Initialize();
     client = new Client <MinimunSalary>(SessionModel.AuthorizationHeader, clientadapter:
                                         ClientConfiguration.GetAdapterFromConfig());
 }
 public AccumulatedController()
 {
     SessionModel.Initialize();
     client   = new Client <HistoricAccumulatedEmployee>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
     clientAT = new Client <AccumulatedType>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
 }
Exemple #19
0
        public static async Task <DateTime?> GetDateByCompanyZipCode()
        {
            try
            {
                var utcNow               = DateTime.UtcNow;
                var clientPCC            = new Client <PayrollCompanyConfiguration>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
                var clientCP             = new Client <catCFDI_CodigoPostal>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
                var payrollCompanyConfig = await clientPCC.FindAsync(x => x.InstanceID == SessionModel.InstanceID, SessionModel.CompanyID, new String[] { "Address" });

                var companyZipCode = payrollCompanyConfig.FirstOrDefault().Address.ZipCode;
                var catCFDI        = await clientCP.FindAsync(x => x.c_CodigoPostal == companyZipCode, SessionModel.CompanyID);

                var zipCodeTimeZone = catCFDI.FirstOrDefault();
                var difference      = -5;

                //When both differences are equal, just get the realdate
                if (zipCodeTimeZone.Diferencia_Horaria_Verano == zipCodeTimeZone.Diferencia_Horaria_Invierno)
                {
                    difference = Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Verano);
                    return(utcNow.AddHours(difference));
                }
                else
                {
                    var actualYear = utcNow.Year;
                    var exit       = false;

                    //Get number of months
                    var winterMonth = CotorraTools.GetMonthNumber(zipCodeTimeZone.Mes_Inicio_Horario_Invierno);
                    var summerMonth = CotorraTools.GetMonthNumber(zipCodeTimeZone.Mes_Inicio_Horario_Verano);

                    //Get sunday position
                    var winterSunday = 0;
                    switch (zipCodeTimeZone.Dia_Inicio_Horario_Invierno.ToLower())
                    {
                    case "primer domingo": winterSunday = 1; break;

                    case "segundo domingo": winterSunday = 2; break;
                    }

                    var summerSunday = 0;
                    switch (zipCodeTimeZone.Dia_Inicio_Horario_Verano.ToLower())
                    {
                    case "primer domingo": summerSunday = 1; break;

                    case "último domingo": summerSunday = 0; break;
                    }

                    //Get first winter (initial)
                    var winter1 = new DateTime(actualYear - 1, winterMonth, 1, 2, 0, 0);
                    exit = false;
                    do
                    {
                        if (winter1.DayOfWeek == DayOfWeek.Sunday && (Convert.ToInt32(winter1.Day / 7) + 1 == winterSunday))
                        {
                            exit = true;
                        }
                        else
                        {
                            winter1 = winter1.AddDays(1);
                        }
                    } while (!exit);

                    //Get first summer
                    var summer1 = new DateTime(actualYear - 0, summerSunday != 0 ? summerMonth : summerMonth + 1, 1, 2, 0, 0);
                    if (summerSunday == 0)
                    {
                        summer1.AddDays(-1);
                    }

                    exit = false;
                    do
                    {
                        //Not last sunday
                        if (summerSunday != 0)
                        {
                            if (summer1.DayOfWeek == DayOfWeek.Sunday && (Convert.ToInt32(summer1.Day / 7) + 1 == summerSunday))
                            {
                                exit = true;
                            }
                            else
                            {
                                summer1 = summer1.AddDays(1);
                            }
                        }
                        //Last sunday
                        else
                        {
                            if (summer1.DayOfWeek == DayOfWeek.Sunday)
                            {
                                exit = true;
                            }
                            else
                            {
                                summer1 = summer1.AddDays(-1);
                            }
                        }
                    } while (!exit);

                    //Get second winter
                    var winter2 = new DateTime(actualYear - 0, winterMonth, 1, 2, 0, 0);
                    exit = false;
                    do
                    {
                        if (winter2.DayOfWeek == DayOfWeek.Sunday && (Convert.ToInt32(winter2.Day / 7) + 1 == winterSunday))
                        {
                            exit = true;
                        }
                        else
                        {
                            winter2 = winter2.AddDays(1);
                        }
                    } while (!exit);

                    //Get second summer (final)
                    var summer2 = new DateTime(actualYear + 2, summerSunday != 0 ? summerMonth : summerMonth + 1, 1, 2, 0, 0);
                    if (summerSunday == 0)
                    {
                        summer2.AddDays(-1);
                    }

                    exit = false;
                    do
                    {
                        //Not last sunday
                        if (summerSunday != 0)
                        {
                            if (summer2.DayOfWeek == DayOfWeek.Sunday && (Convert.ToInt32(summer2.Day / 7) + 1 == summerSunday))
                            {
                                exit = true;
                            }
                            else
                            {
                                summer2 = summer2.AddDays(1);
                            }
                        }
                        //Last sunday
                        else
                        {
                            if (summer2.DayOfWeek == DayOfWeek.Sunday)
                            {
                                exit = true;
                            }
                            else
                            {
                                summer2 = summer2.AddDays(-1);
                            }
                        }
                    } while (!exit);

                    //Create possible dates
                    var possibleWinterDate = utcNow.AddDays(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Invierno));
                    var possibleSummerDate = utcNow.AddDays(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Verano));

                    //Compare with all ranges
                    if ((possibleWinterDate >= winter1) && (possibleWinterDate < summer1) && (possibleSummerDate >= winter1) && (possibleSummerDate < summer1))
                    {
                        //Winter
                        utcNow.AddHours(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Invierno));
                    }
                    else if ((possibleWinterDate >= summer1) && (possibleWinterDate < winter2) && (possibleSummerDate >= summer1) && (possibleSummerDate < winter2))
                    {
                        //Summer
                        utcNow.AddHours(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Verano));
                    }
                    else if ((possibleWinterDate >= winter2) && (possibleWinterDate < summer2) && (possibleSummerDate >= winter2) && (possibleSummerDate < summer2))
                    {
                        //Winter
                        utcNow.AddHours(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Invierno));
                    }
                    else
                    {
                        //Summer
                        utcNow.AddHours(Int32.Parse(zipCodeTimeZone.Diferencia_Horaria_Verano));
                    }

                    return(utcNow);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #20
0
 public ConceptsController(IMemoryCache memoryCache)
 {
     SessionModel.Initialize();
     client = new Client <ConceptPayment>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
     _cache = memoryCache;
 }
Exemple #21
0
 public PeriodDetailsController()
 {
     SessionModel.Initialize();
     client = new Client <PeriodDetail>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
 }
Exemple #22
0
        public async Task <JsonResult> GetPeriodDetails(Guid periodID)
        {
            var client     = new Client <PeriodDetail>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());
            var findResult = await client.FindAsync(
                x => x.InstanceID == SessionModel.InstanceID && x.PeriodID == periodID,
                SessionModel.CompanyID, new String[] { });

            var periodDetails = from p in findResult
                                orderby p.Number
                                select new
            {
                p.ID,
                p.Number,
                p.PeriodStatus,
                p.InitialDate,
                p.FinalDate
            };

            return(Json(periodDetails));
        }
Exemple #23
0
        public async Task <JsonResult> GetWorkPeriod(Guid periodTypeID, Guid?periodDetailID = null)
        {
            //Set clients
            var conceptsClient  = new Client <ConceptPayment>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());
            var overdraftClient = new Client <Overdraft>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());
            var incidentsClient = new Client <Incident>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());

            //Get grid columns (concepts marked as global automatic)
            var conceptsResult = conceptsClient.FindAsync(x =>
                                                          x.ConceptType != ConceptType.LiabilityPayment &&
                                                          x.Active && x.InstanceID == SessionModel.InstanceID && x.GlobalAutomatic && !x.Kind,
                                                          SessionModel.CompanyID, new String[] { });

            //Get the overdrafts
            var overdraftsResult = overdraftClient.FindAsync(x =>
                                                             x.PeriodDetailID == periodDetailID &&
                                                             x.Active && x.InstanceID == SessionModel.InstanceID,
                                                             SessionModel.CompanyID, new String[] { "Employee", "Employee.JobPosition", "OverdraftDetails" });

            //Get incidents
            var indicentsResult = incidentsClient.FindAsync(x =>
                                                            x.PeriodDetailID == periodDetailID &&
                                                            x.Active && x.InstanceID == SessionModel.InstanceID,
                                                            SessionModel.CompanyID, new String[] { "IncidentType" });


            await Task.WhenAll(conceptsResult, overdraftsResult, indicentsResult);

            //Create the result
            var result = new
            {
                Employees = (from o in overdraftsResult.Result
                             orderby o.Employee.Code
                             select new
                {
                    o.Employee.ID,
                    o.Employee.Code,
                    o.Employee.DailySalary,
                    JobPositionName = o.Employee.JobPosition.Name,
                    FullName = o.Employee.FirstLastName +
                               (!String.IsNullOrEmpty(o.Employee.SecondLastName) ? (" " + o.Employee.SecondLastName) : "") + " " +
                               o.Employee.Name,
                }).ToList(),

                DPOColumns = (from concept in conceptsResult.Result
                              orderby concept.ConceptType, concept.Code
                              select new
                {
                    ConceptPaymentID = concept.ID,
                    field = "F_" + concept.ID.ToString().Replace("-", ""),
                    title = concept.Name,
                }).ToList(),

                DPOData = (from o in overdraftsResult.Result
                           orderby o.Employee.Code
                           select new
                {
                    o.ID,
                    o.EmployeeID,
                    Details = (from d in o.OverdraftDetails
                               select new
                    {
                        d.ConceptPaymentID,
                        d.Amount,
                        //Amount = random.Next(1, 9999),
                        d.IsValueCapturedByUser,
                        d.IsGeneratedByPermanentMovement,
                    }).ToList()
                }).ToList(),

                DHData = (from i in indicentsResult.Result
                          select new
                {
                    //i.ID,
                    i.EmployeeID,
                    i.Date,
                    i.Value,
                    i.IncidentType.Code,
                }).ToList()
            };

            return(Json(result));
        }
Exemple #24
0
        public async Task <JsonResult> GetFiscalYears(Guid periodTypeID)
        {
            var client     = new Client <Period>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());
            var findResult = await client.FindAsync(
                x => x.InstanceID == SessionModel.InstanceID && x.PeriodTypeID == periodTypeID,
                SessionModel.CompanyID, new String[] { });

            var periodTypes = from p in findResult
                              orderby p.FiscalYear descending
                              select new
            {
                ID   = p.ID,
                Name = p.FiscalYear
            };


            return(Json(periodTypes));
        }
Exemple #25
0
 public AnualEmploymentSubsidyController()
 {
     SessionModel.Initialize();
     client = new Client <AnualEmploymentSubsidy>(SessionModel.AuthorizationHeader, clientadapter:
                                                  ClientConfiguration.GetAdapterFromConfig());
 }
 public SettlementController()
 {
     SessionModel.Initialize();
     client = new Client <SettlementCatalog>(SessionModel.AuthorizationHeader, clientadapter:
                                             ClientConfiguration.GetAdapterFromConfig());
 }
 public PermanentMovements()
 {
     SessionModel.Initialize();
     client = new Client <PermanentMovement>(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
 }
Exemple #28
0
 public CompanyAssistantController()
 {
     SessionModel.Initialize();
     client = new InitializationClient(SessionModel.AuthorizationHeader, ClientConfiguration.GetAdapterFromConfig());
 }
Exemple #29
0
 public AnualIncomeTaxController()
 {
     SessionModel.Initialize();
     client = new Client <AnualIncomeTax>(SessionModel.AuthorizationHeader, clientadapter:
                                          ClientConfiguration.GetAdapterFromConfig());
 }
Exemple #30
0
        public async Task <JsonResult> GetActivePeriodTypes()
        {
            var clientPT   = new Client <PeriodType>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig());
            var findResult = await clientPT.FindAsync(
                x => x.InstanceID == SessionModel.InstanceID,
                SessionModel.CompanyID, new String[] { "Periods", "Periods.PeriodDetails" });

            var periodTypes = from pt in findResult
                              orderby pt.ExtraordinaryPeriod, pt.PeriodTotalDays
            where pt.Periods.Count() > 0 && !pt.ExtraordinaryPeriod
                select new
            {
                ID          = pt.ID,
                Name        = pt.Name,
                CurrentYear = pt.Periods.OrderByDescending(x => x.FiscalYear).First().FiscalYear,

                Years = (from p in pt.Periods orderby p.FiscalYear descending select new { ID = p.ID, Year = p.FiscalYear }),

                PeriodID = pt.Periods.OrderByDescending(x => x.FiscalYear).First().ID,

                PeriodDetailID = pt.Periods.OrderByDescending(x => x.FiscalYear).First()
                                 .PeriodDetails.Where(x => x.PeriodStatus == PeriodStatus.Calculating).OrderBy(x => x.Number).First().ID,

                Number = pt.Periods.OrderByDescending(x => x.FiscalYear).First()
                         .PeriodDetails.Where(x => x.PeriodStatus == PeriodStatus.Calculating).OrderBy(x => x.Number).First().Number,

                InitialDate = pt.Periods.OrderByDescending(x => x.FiscalYear).First()
                              .PeriodDetails.Where(x => x.PeriodStatus == PeriodStatus.Calculating).OrderBy(x => x.Number).First().InitialDate,

                FinalDate = pt.Periods.OrderByDescending(x => x.FiscalYear).First()
                            .PeriodDetails.Where(x => x.PeriodStatus == PeriodStatus.Calculating).OrderBy(x => x.Number).First().FinalDate,

                IsExtraordinary = false
            };


            return(Json(periodTypes));
        }