Exemplo n.º 1
0
        /// <summary>
        /// Shows the list of all Leave Carry Forward of selected employees.
        /// </summary>
        /// <param name="es"></param>
        /// <param name="SelectedEmployeeIds">Parameter of Selected Employee ids</param>
        /// <param name="vmLeaveCF"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public VMLeaveCF GetCreate3(VMLeaveCFSelection es, int?[] SelectedEmployeeIds, VMLeaveCF vmLeaveCF)
        {
            List <VMLeaveCFChild>      vmLeaveCFChildList = new List <VMLeaveCFChild>();
            List <VHR_EmployeeProfile> employees          = DDService.GetEmployeeInfo();                                       // Get All Employees from database
            FinancialYear financialYear = DDService.GetFinancialYear().First(aa => aa.PFinancialYearID == es.FinancialYearID); // Get selected financial year

            foreach (int empid in SelectedEmployeeIds)
            {
                VMLeaveCFChild      vmLeaveCFChild = new VMLeaveCFChild();
                VHR_EmployeeProfile employee       = employees.First(aa => aa.PEmployeeID == empid);// Get Specific Employee

                vmLeaveCFChild.EmpID             = employee.PEmployeeID;
                vmLeaveCFChild.EmpNo             = employee.OEmpID;
                vmLeaveCFChild.EmployeeName      = employee.EmployeeName;
                vmLeaveCFChild.FinancialYearID   = financialYear.PFinancialYearID;
                vmLeaveCFChild.FinancialYearName = financialYear.FYName;
                vmLeaveCFChild.TotalLeave        = 20;
                vmLeaveCFChild.LeaveTypeName     = "AL";
                vmLeaveCFChild.CarryForward      = 15;
                vmLeaveCFChild.CollapseLeave     = 5;
                vmLeaveCFChildList.Add(vmLeaveCFChild);
            }
            vmLeaveCF.FinancialYearID   = financialYear.PFinancialYearID;
            vmLeaveCF.FinancialYearName = financialYear.FYName;
            vmLeaveCF.LeaveCFChild      = vmLeaveCFChildList;
            return(vmLeaveCF);
        }
        public async Task <FinancialYear> UpdateFinancialYearAsync(FinancialYear financialYear)
        {
            var cmd = $"UPDATE info.FinancialYears SET Selected = 0 UPDATE info.FinancialYears SET Selected = 1 where FinancialYearId={financialYear.FinancialYearId}";
            await _uow.Database.ExecuteSqlCommandAsync(cmd);

            return(financialYear);
        }
Exemplo n.º 3
0
        public async Task <FinancialYear> AddFinancialYearAsync(FinancialYear financialYear)
        {
            _uow.FinancialYears.Add(financialYear);
            await _uow.SaveChangesAsync().ConfigureAwait(false);

            return(financialYear);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewFinancialYear, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/Finance_Module/UnAuthorized.aspx");
                }
            }
            if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
            {
                FinancialYear year = new FinancialYear();
                year.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                lblYearID.Text        = year.ID.ToString();
                lblYearName.Text      = year.Name;
                lblYearStartDate.Text = year.StartDate.ToShortDateString();
                lblYearEndDate.Text   = year.EndDate.ToShortDateString();
                txtDes.Text           = year.Description;

                lblLastModifiedDate.Text = year.LastModifiedDate.ToShortDateString();
            }
        }
Exemplo n.º 5
0
        public IHttpActionResult PutFinancialYear(FinancialYear financialYear)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (financialYear.ID != financialYear.ID)
            {
                return(BadRequest());
            }

            db.Entry(financialYear).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FinancialYearExists(financialYear.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 6
0
 public ViewFinancialYear(FinancialYear financialYear)
 {
     Id           = financialYear.Id;
     StartingDate = financialYear.StartingDate;
     EndingDate   = financialYear.EndingDate;
     Name         = financialYear.Name;
 }
Exemplo n.º 7
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            FinancialYear f = new FinancialYear();

            f.ID          = Convert.ToInt32(Request.QueryString["id"].ToString());
            f.Name        = txtYearName.Text;
            f.Description = txtDesc.Text;
            DateTime d;

            DateTime.TryParse(txtStartDate.Text, out d);
            f.StartDate = d;

            DateTime.TryParse(txtEndDate.Text, out d);
            f.EndDate = d;
            int id = f.update();

            if (id > 0)
            {
                Response.Redirect("~/Finance_Module/FinancialYears.aspx?alert=success");
            }
            else
            {
                Response.Redirect("~/Finance_Module/CreateFinancialYear.aspx?id=0&&alret=notpass");
            }
        }
Exemplo n.º 8
0
 public FinancialYear Put(FinancialYear item)
 {
     try
     {
         var identity = User.Identity as ClaimsIdentity;
         int compid = 0, userid = 0;
         foreach (Claim claim in identity.Claims)
         {
             if (claim.Type == "compid")
             {
                 compid = int.Parse(claim.Value);
             }
             if (claim.Type == "userid")
             {
                 userid = int.Parse(claim.Value);
             }
         }
         logger.Info("User ID : {0} , Company Id : {1}", compid, userid);
         return(context.PutFinancialYear(item));
     }
     catch
     {
         return(null);
     }
 }
Exemplo n.º 9
0
        public async Task <Stream> GenerateByCodeOverviewPdf(string codeName, Guid?financialYearId = null)
        {
            IReadOnlyDictionary <Guid, string> accounts =
                (await _accountRepository.GetAccounts()).ToDictionary(x => x.Id, x => x.Name);
            Func <Guid, string> accountNameResolver =
                accountId => accounts.TryGetValue(accountId, out string accountName) ? accountName : null;

            FinancialYear financialYear = financialYearId.HasValue
                ? await _financialYearRepository.GetFinancialYear(financialYearId.Value)
                : null;

            Transaction[] transactions = await _codeBalanceRepository.GetCodeTransactions(financialYearId, codeName);

            var data = new TemplateData
            {
                FinancialYear = financialYear?.Name,
                CodeName      = codeName,
                Transactions  = MapTransactions(transactions, accountNameResolver),
            };

            return(await _pdfGenerator.GeneratePdf(
                       bodyTemplate : LoadTemplate("ByCodeOverview.html"),
                       templateData : data,
                       footer : "[date] - [page]/[toPage]",
                       margins : new PageMargins(10, 10, 15, 10)));
        }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["user"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.CloseEducationalYear, Request.Cookies["user"]["Permission"].ToString()))
         {
             Response.Redirect("~/Finance_Module/UnAuthorized.aspx");
         }
     }
     if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
     {
         FinancialYear year = new FinancialYear();
         year.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
         lblYearName.Text      = year.Name;
         lblYearStartDate.Text = year.StartDate.ToShortDateString();
         lblYearEndDate.Text   = year.EndDate.ToShortDateString();
         lblDes.Text           = year.Description;
         DataTable dt = year.getTrailBalance();
         ASPxGridView1.DataSource = dt;
         ASPxGridView1.DataBind();
     }
 }
        private ReportViewer LoadReport_vMLeaveBalanceWithSR(List <VMLeaveBalance> list, ReportViewer rv)
        {
            rv.LocalReport.ReportPath = Server.MapPath(ReportPath);
            IEnumerable <VMLeaveBalance> ie;

            ie = list.AsQueryable();
            ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);

            rv.LocalReport.DataSources.Add(datasource1);
            ReportParameter rp  = new ReportParameter("Date", DateTitle, false);
            ReportParameter rp1 = new ReportParameter("Header", CompanyHeader + ReportTitle, false);
            ReportParameter rp2 = new ReportParameter("Footer", ReportFooter, false);

            rv.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 });
            rv.LocalReport.SubreportProcessing += (object sender, SubreportProcessingEventArgs e) =>
            {
                string           EmpNo = e.Parameters["EmployeeID"].Values.First().ToString();
                VMSelectedFilter vmf   = Session["FiltersModel"] as VMSelectedFilter;
                int                  FinancialYearID = ATAssistant.GetFinancialYearID((DateTime)vmf.DateTo, DDService.GetFinancialYear());
                FinancialYear        dbFinancialYear = DDService.GetFinancialYear().Where(aa => aa.PFinancialYearID == FinancialYearID).First();
                DataTable            dataTable       = QueryBuilder.GetValuesfromDB("select * from VAT_LeaveData  where OEmpID='" + EmpNo + "' and (AttDate >= " + "'" + dbFinancialYear.FYStartDate.Value.ToString("yyyy-MM-ddd") + "'" + " and AttDate <= " + "'" + dbFinancialYear.FYEndDate.Value.ToString("yyyy-MM-ddd") + "'" + " )");
                List <VAT_LeaveData> VATLeaveData    = dataTable.ToList <VAT_LeaveData>();
                e.DataSources.Add(new ReportDataSource("DataSet1", VATLeaveData));
            };
            rv.LocalReport.Refresh();
            return(rv);
        }
Exemplo n.º 12
0
 private void OnEditFinancialYear(FinancialYear FinancialYear)
 {
     if (_accessUtility.HasAccess(41))
     {
         EditFinancialYearRequested(FinancialYear);
     }
 }
Exemplo n.º 13
0
        /*
         * ///<summary>
         * ///Gets the default contact.
         * /// </summary>
         * /// <value>The default contact.</value>
         * public Contact DefaultContact
         * {
         *  get
         *  {
         *      if (Contacts == null)
         *      {
         *          return null;
         *      }
         *      return Contacts.Where(x => x.IsDefault).FirstOrDefault();
         *  }
         * }
         *
         * ///<summary>
         * /// Adds the contact.
         * /// </summary>
         * /// <param name="contact">The contact.</param>
         * public void AddContact(Contact contact)
         * {
         *  if (Contacts == null)
         *  {
         *      Contacts = new List<Contact>();
         *  }
         *
         *  // If there are not default address, set this one as default
         *  if (Contacts.Where(x => x.IsDefault).Count() < 1)
         *  {
         *      contact.IsDefault = true;
         *  }
         *
         *  // If this is the new default address
         *  if (contact.IsDefault)
         *  {
         *      foreach (Contact cont in Contacts)
         *      {
         *          cont.IsDefault = false;
         *      }
         *  }
         *
         *  // If the address is not already in the list
         *  if (!Contacts.Any(x => x.PrimaryKey == contact.PrimaryKey))
         *  {
         *      Contacts.Add(contact);
         *      contact.Company = this;
         *  }
         * }
         *
         * ///<summary>
         * /// Removes the contact.
         * /// </summary>
         * /// <param name="contact">The contact.</param>
         * public void RemoveContact(Contact contact)
         * {
         *  if (Contacts == null)
         *  {
         *      return;
         *  }
         *
         *  Contacts.Remove(contact);
         *
         *  if (contact.IsDefault)
         *  {
         *      Contacts.FirstOrDefault().IsDefault = true;
         *  }
         * }
         *
         * ///<summary>
         * ///Gets the default address.
         * /// </summary>
         * /// <value>The default address.</value>
         * public Address DefaultAddress
         * {
         *  get
         *  {
         *      if (Addresses == null)
         *      {
         *          return null;
         *      }
         *      return Addresses.Where(x => x.IsDefault).FirstOrDefault();
         *  }
         * }
         *
         * ///<summary>
         * /// Adds the address.
         * /// </summary>
         * /// <param name="contact">The address.</param>
         * public void AddAddress(Address address)
         * {
         *  if (Addresses == null)
         *  {
         *      Addresses = new List<Address>();
         *  }
         *
         *  // If there are not default address, set this one as default
         *  if (Addresses.Where(x => x.IsDefault).Count() < 1)
         *  {
         *      address.IsDefault = true;
         *  }
         *
         *  // If this is the new default address
         *  if (address.IsDefault)
         *  {
         *      foreach (Address addr in Addresses)
         *      {
         *          addr.IsDefault = false;
         *      }
         *  }
         *
         *  // If the address is not already in the list
         *  if (!Addresses.Any(x => x.PrimaryKey == address.PrimaryKey))
         *  {
         *      Addresses.Add(address);
         *      address.Company = this;
         *  }
         * }
         *
         * ///<summary>
         * /// Removes the address.
         * /// </summary>
         * /// <param name="contact">The address.</param>
         * public void RemoveAddress(Address address)
         * {
         *  if (Addresses == null)
         *  {
         *      return;
         *  }
         *
         *  Addresses.Remove(address);
         *
         *  if (address.IsDefault)
         *  {
         *      Addresses.FirstOrDefault().IsDefault = true;
         *  }
         * }
         */
        ///<summary>
        /// Adds the financial year.
        /// </summary>
        /// <param name="year">The financial year.</param>
        public void AddFinancialYear(FinancialYear fnYear)
        {
            if (FinancialYears == null)
            {
                FinancialYears = new List <FinancialYear>();
            }

            // If there are not default year, set this one as default
            if (FinancialYears.Where(x => x.IsDefault).Count() < 1)
            {
                fnYear.IsDefault = true;
            }

            // If this is the new default year
            if (fnYear.IsDefault)
            {
                foreach (FinancialYear fy in FinancialYears)
                {
                    fy.IsDefault = false;
                }
            }

            // If the year is not already in the list
            if (!FinancialYears.Any(x => x.PrimaryKey == fnYear.PrimaryKey))
            {
                FinancialYears.Add(fnYear);
                fnYear.Company = this;
            }
        }
        public void Then_The_Year_Is_Correctly_Calculated_For_The_Financial_Year(DateTime date, int expectedYear)
        {
            var fy = new FinancialYear(date);

            fy.StartDate.Year.Should().Be(expectedYear);
            fy.EndDate.Year.Should().Be(expectedYear + 1);
        }
Exemplo n.º 15
0
        public ActionResult VendorStockLedger(string dates, int productId, int vendorId)
        {
            DateTime      start_date;
            DateTime      end_date;
            var           company = Convert.ToInt32(Session["CompanyID"]);
            var           fYear   = Convert.ToInt32(Session["FinancialYearID"]);
            FinancialYear f       = db.FinancialYears.Where(x => x.Id == fYear).FirstOrDefault();

            try
            {
                if (!String.IsNullOrEmpty(dates))
                {
                    string[] parts = dates.Split('-');
                    if (parts.Length == 2)
                    {
                        start_date = Convert.ToDateTime(parts[0]);
                        end_date   = Convert.ToDateTime(parts[1]);

                        var result = db.USP_VendorStockLedger(productId, company, vendorId, fYear, start_date, end_date).ToList();
                        ViewBag.Product    = db.Products.Where(x => x.Id == productId && x.CompanyId == company).FirstOrDefault().ProductName;
                        ViewBag.VendorName = db.Vendors.Where(x => x.Id == vendorId && x.CompanyId == company).FirstOrDefault().VendorName;
                        return(View(result));
                    }
                }
            }
            catch (Exception e) { ViewBag.ErrMsg = e.Message; }
            return(View());
        }
        public async Task ActivateFinancialYear(Guid id)
        {
            using (IDbContextTransaction transaction = await _dataContext.Database.BeginTransactionAsync())
            {
                try
                {
                    FinancialYear financialYearToActivate = await _dataContext.FinancialYears.Where(x => x.Id == id).FirstOrDefaultAsync();

                    if (financialYearToActivate == null)
                    {
                        throw new FinancialYearNotFoundException(id);
                    }
                    financialYearToActivate.IsActive = true;

                    FinancialYear[] financialYearsToDeactivate = await _dataContext.FinancialYears.Where(x => x.Id != id).ToArrayAsync();

                    foreach (FinancialYear financialYearToDeactivate in financialYearsToDeactivate)
                    {
                        financialYearToDeactivate.IsActive = false;
                    }

                    await _dataContext.SaveChangesAsync();

                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Exemplo n.º 17
0
 public ActionResult Create(FinancialYear obj)
 {
     if (obj.FYName == null || obj.FYName == "")
     {
         ModelState.AddModelError("FYName", "Financial Year name cannot be empty");
     }
     if (FinancialYearService.GetIndex().Where(aa => aa.FYName == obj.FYName).Count() > 0)
     {
         ModelState.AddModelError("FYName", "Financial Year name must be unique");
     }
     if (obj.FYStartDate != null && obj.FYEndDate != null)
     {
         if (obj.FYEndDate == obj.FYStartDate)
         {
         }
         else
         {
             if (obj.FYEndDate < obj.FYStartDate)
             {
                 ModelState.AddModelError("FYStartDate", "Start Date can never be greater than end date.");
             }
         }
     }
     if (FinancialYearService.GetIndex().Where(aa => aa.FYStartDate == obj.FYStartDate && aa.PFinancialYearID != obj.PFinancialYearID).Count() > 0)
     {
         ModelState.AddModelError("FYStartDate", "Already exists in same date");
     }
     if (ModelState.IsValid)
     {
         FinancialYearService.PostCreate(obj);
         return(Json("OK", JsonRequestBehavior.AllowGet));
     }
     return(PartialView("Create", obj));
 }
Exemplo n.º 18
0
        protected PdfPTable VendorReport(PdfPTable tableLayout)
        {
            float[] headers = { 50, 24, 45, 35, 50 }; //Header Widths
            tableLayout.SetWidths(headers);           //Set the pdf headers
            tableLayout.WidthPercentage = 100;        //Set the PDF File witdh percentage
            tableLayout.HeaderRows      = 1;
            //Add Title to the PDF file at the top
            var           company = Convert.ToInt32(Session["CompanyID"]);
            var           fYear   = Convert.ToInt32(Session["FinancialYearID"]);
            FinancialYear f       = db.FinancialYears.Where(x => x.Id == fYear).FirstOrDefault();
            List <USP_VendorWiseStock_Result> product = db.USP_VendorWiseStock(17, company, f.StartDate, f.EndDate).ToList <USP_VendorWiseStock_Result>();

            tableLayout.AddCell(new PdfPCell(new Phrase("Vendor Wise Stock Report", new Font(Font.HELVETICA, 8, 1, new iTextSharp.text.Color(0, 0, 0))))
            {
                Colspan = 12, Border = 0, PaddingBottom = 5, HorizontalAlignment = Element.ALIGN_CENTER
            });

            ////Add header
            AddCellToHeader(tableLayout, "Vendor Name");
            AddCellToHeader(tableLayout, "Given For Printing");
            AddCellToHeader(tableLayout, "Received After Printing");
            AddCellToHeader(tableLayout, "Total Quantity Left");
            AddCellToHeader(tableLayout, "Total Shrinkage");
            ////Add body
            foreach (var emp in product)
            {
                //AddCellToBody(tableLayout, emp.VendorName);
                //AddCellToBody(tableLayout, Convert.ToString(emp.GivenForPrinting));
                //AddCellToBody(tableLayout, Convert.ToString(emp.ReceivedAfterPrinting));
                //AddCellToBody(tableLayout, Convert.ToString(emp.TotalNetQuantity));
                //AddCellToBody(tableLayout, Convert.ToString(emp.TotalShrinkage));
            }
            return(tableLayout);
        }
Exemplo n.º 19
0
        public void SetFinancialYear(FinancialYear financialYear)
        {
            FinancialYear = Mapper.Map <FinancialYear, EditableFinancialYear>(financialYear);
            FinancialYear.ValidationDelegate += FinancialYear_ValidationDelegate;

            FinancialYear.ErrorsChanged += RaiseCanExecuteChanged;
        }
Exemplo n.º 20
0
 public ActionResult FinancialYear(FinancialYear objfinancialyear)
 {
     try
     {
         if (dbFinancialYear.CheckFinancialYear(objfinancialyear.FinancialYearID, objfinancialyear.FinancialYears))
         {
             if (dbFinancialYear.Save(objfinancialyear))
             {
                 if (objfinancialyear.FinancialYearID > 0)
                 {
                     ModelState.Clear();
                     TempData["Msg"] = "FinancialYear Update Successfully";
                     return(RedirectToAction("FinancialYear", "FinancialYear"));
                 }
                 else
                 {
                     ModelState.Clear();
                     TempData["Msg"] = "FinancialYear Saved Successfully";
                     return(RedirectToAction("FinancialYear", "FinancialYear"));
                 }
             }
         }
         else
         {
             TempData["Msg"] = "FinancialYear Already Exist's";
             return(RedirectToAction("FinancialYear", "FinancialYear"));
         }
     }
     catch (Exception ex)
     {
         TempData["Msg"] = ex.Message;
         return(RedirectToAction("FinancialYear", "FinancialYear"));
     }
     return(RedirectToAction("FinancialYear", "FinancialYear"));
 }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.FinancialYears, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/Finance_Module/UnAuthorized.aspx");
                }
            }
            DataTable dt = new FinancialYear().getList();

            ASPxGridView1.DataSource = dt;
            ASPxGridView1.DataBind();
            AddSubmitEvent();
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "success")
                {
                    Response.Write("<script>alert('تم الحفظ بنجاح.');</script>");
                }
            }
        }
Exemplo n.º 22
0
 public async Task <UpsertBaseFinancialYearResponse> UpsertBaseFinancialYearAsync(UpsertBaseFinancialYearRequest request)
 {
     return(await Task.Run(() =>
     {
         UpsertBaseFinancialYearResponse _response = new UpsertBaseFinancialYearResponse();
         using (AsyncAutomateAccountingEntities _dbContext = new AsyncAutomateAccountingEntities())
         {
             if (request.BaseObject != null)
             {
                 try
                 {
                     FinancialYear _FinancialYear = request.BaseObject.ToFinancialYear();
                     UpsertEntity <FinancialYear>(request.BaseObject.Id, ref _FinancialYear, _dbContext);
                     _response.BaseObject = _FinancialYear.ToBaseFinancialYear();
                 }
                 catch (Exception ex) { AssignStatusData(_response, false, string.Format("Some error occurred during DB interaction. Message is something like : \n{0}", ex.Message)); }
             }
             else
             {
                 AssignStatusData(_response, false, "No entity data recieved to insert/update.");
             }
         }
         return _response;
     }));
 }
Exemplo n.º 23
0
        static List <PESA2010Entry> ParsePESADBs2010Chap10()
        {
            string ExcelFilePath = @"Assets/pesa_2010_database_tables_chapter10.xlsx";
            string SheetName     = @"CRA 2010 Chapter 10 DB final ";

            List <PESA2010Entry> PESA2010Entries = new List <PESA2010Entry>();

            DataTable CURRENTTABLE;

            using (var stream = File.Open(ExcelFilePath, FileMode.Open, FileAccess.Read))
            {
                using (var reader = ExcelReaderFactory.CreateReader(stream))
                {
                    var result = reader.AsDataSet();
                    DataTableCollection Worksheets = result.Tables;
                    CURRENTTABLE = Worksheets[Worksheets.IndexOf(SheetName)];
                }
            }

            List <string> FinancialYears = new List <string>()
            {
                "2004-05",
                "2005-06",
                "2006-07",
                "2007-08",
                "2008-09",
                "2009-10"
            };

            FinancialYears.Remove("2009-10"); // already covered in a later dataset

            for (int i = 1; i < CURRENTTABLE.Rows.Count; i++)
            {
                foreach (string FinancialYear in FinancialYears)
                {
                    PESA2010Entry pesaEntry = new PESA2010Entry();

                    pesaEntry.FinancialYear = FinancialYear;
                    pesaEntry.YearEnd       = int.Parse(FinancialYear.Substring(0, 4)) + 1;
                    pesaEntry.Value         = SafeConvertObjectToDouble(CURRENTTABLE.Rows[i].ItemArray[CURRENTTABLE.Rows[0].ItemArray.OfType <string>().ToList().IndexOf(FinancialYear)]);

                    pesaEntry.DepartmentCode            = SafeConvertObjectToString(CURRENTTABLE.Rows[i].ItemArray[0]);
                    pesaEntry.DepartmentName            = (string)CURRENTTABLE.Rows[i].ItemArray[1];
                    pesaEntry.COFOGLevel1               = (string)CURRENTTABLE.Rows[i].ItemArray[2];
                    pesaEntry.HMTFunction               = (string)CURRENTTABLE.Rows[i].ItemArray[3];
                    pesaEntry.COFOGLevel2               = (string)CURRENTTABLE.Rows[i].ItemArray[4];
                    pesaEntry.HMTSubfunction            = (string)CURRENTTABLE.Rows[i].ItemArray[5];
                    pesaEntry.ProgrammeObjectGroup      = SafeConvertObjectToString(CURRENTTABLE.Rows[i].ItemArray[6]);
                    pesaEntry.ProgrammeObjectGroupAlias = SafeConvertObjectToString(CURRENTTABLE.Rows[i].ItemArray[7]);
                    pesaEntry.IDNonID         = (string)CURRENTTABLE.Rows[i].ItemArray[8];
                    pesaEntry.CAPorCUR        = (string)CURRENTTABLE.Rows[i].ItemArray[9];
                    pesaEntry.NUTSRegion      = (string)CURRENTTABLE.Rows[i].ItemArray[11];
                    pesaEntry.CGorLGorPCorBOE = (string)CURRENTTABLE.Rows[i].ItemArray[10];

                    PESA2010Entries.Add(pesaEntry);
                }
            }
            return(PESA2010Entries);
        }
        private static FinancialYear MapFinYear(dynamic results)
        {
            var finYear = new FinancialYear();

            finYear.startDate = results[0].StartDate;
            finYear.endDate   = results[0].EndDate;
            return(finYear);
        }
Exemplo n.º 25
0
        public void NewFinancialYear(string year, DateTime startDate, DateTime endDate)
        {
            var model = new FinancialYear {
                Year = year, StartDate = startDate, EndDate = endDate
            };

            _financialYearService.Create(model);
        }
Exemplo n.º 26
0
        public ActionResult DeleteConfirmed(int id)
        {
            FinancialYear financialYear = db.FinancialYears.Find(id);

            db.FinancialYears.Remove(financialYear);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 27
0
        protected void btnClose_Click(object sender, EventArgs e)
        {
            FinancialYear year = new FinancialYear();

            year.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
            year.CloseYear();
            Response.Redirect("~/Finance_Module/FinancialYears.aspx");
        }
Exemplo n.º 28
0
        public bool Delete(FinancialYear financialYear)
        {
            FinancialYear entity = db.FinancialYears.Find(financialYear.Id);

            db.FinancialYears.Remove(entity);
            db.SaveChanges();
            return(true);
        }
Exemplo n.º 29
0
        static List <PESA2018Entry> ParsePESADB2018()
        {
            string ExcelFilePath = @"Assets/CRA_2018_Database_for_Publication_rvsd.xlsx";
            string SheetName     = @"CRA 2018 database";

            DataTable CURRENTTABLE;

            using (var stream = File.Open(ExcelFilePath, FileMode.Open, FileAccess.Read))
            {
                using (var reader = ExcelReaderFactory.CreateReader(stream))
                {
                    var result = reader.AsDataSet();
                    DataTableCollection Worksheets = result.Tables;
                    CURRENTTABLE = Worksheets[Worksheets.IndexOf(SheetName)];
                }
            }

            List <PESA2018Entry> PESA2018Entries = new List <PESA2018Entry>();

            List <string> FinancialYears = new List <string>()
            {
                "2013-14",
                "2014-15",
                "2015-16",
                "2016-17",
                "2017-18"
            };

            for (int i = 1; i < CURRENTTABLE.Rows.Count; i++)
            {
                foreach (string FinancialYear in FinancialYears)
                {
                    PESA2018Entry pesaEntry = new PESA2018Entry();

                    pesaEntry.FinancialYear = FinancialYear;
                    pesaEntry.YearEnd       = int.Parse(FinancialYear.Substring(0, 4)) + 1;
                    pesaEntry.Value         = SafeConvertObjectToDouble(CURRENTTABLE.Rows[i].ItemArray[CURRENTTABLE.Rows[0].ItemArray.OfType <string>().ToList().IndexOf(FinancialYear)]);

                    pesaEntry.DepartmentName   = (string)CURRENTTABLE.Rows[i].ItemArray[0];
                    pesaEntry.OrganisationName = (string)CURRENTTABLE.Rows[i].ItemArray[1];
                    pesaEntry.CRASegmentCode   = (string)CURRENTTABLE.Rows[i].ItemArray[2];
                    pesaEntry.CRASegmentName   = (string)CURRENTTABLE.Rows[i].ItemArray[3];
                    pesaEntry.COFOGLevel0      = (string)CURRENTTABLE.Rows[i].ItemArray[4];
                    pesaEntry.HMTFunction      = (string)CURRENTTABLE.Rows[i].ItemArray[5];
                    pesaEntry.COFOGLevel1      = (string)CURRENTTABLE.Rows[i].ItemArray[6];
                    pesaEntry.HMTSubfunction   = (string)CURRENTTABLE.Rows[i].ItemArray[7];
                    pesaEntry.IDNonID          = (string)CURRENTTABLE.Rows[i].ItemArray[8];
                    pesaEntry.CAPorCUR         = (string)CURRENTTABLE.Rows[i].ItemArray[9];
                    pesaEntry.CGorLGorPCorBOE  = (string)CURRENTTABLE.Rows[i].ItemArray[10];
                    pesaEntry.HMTorDept        = (string)CURRENTTABLE.Rows[i].ItemArray[11];
                    pesaEntry.NUTSRegion       = (string)CURRENTTABLE.Rows[i].ItemArray[12];
                    pesaEntry.Country          = (string)CURRENTTABLE.Rows[i].ItemArray[13];

                    PESA2018Entries.Add(pesaEntry);
                }
            }
            return(PESA2018Entries);
        }
Exemplo n.º 30
0
        public ActionResult ProductWiseStock()
        {
            var           company = Convert.ToInt32(Session["CompanyID"]);
            var           fYear   = Convert.ToInt32(Session["FinancialYearID"]);
            FinancialYear f       = db.FinancialYears.Where(x => x.Id == fYear).FirstOrDefault();
            var           result  = db.USP_ProductWiseStock(company, fYear, f.StartDate, f.EndDate).ToList();

            return(View(result));
        }