コード例 #1
0
        public void ExportExpenses(DateTime?minExpDate, DateTime?maxExpDate)
        {
            if (System.Web.HttpContext.Current.Session["minExpDate"] != null && System.Web.HttpContext.Current.Session["maxExpDate"] != null)
            {
                minExpDate = (DateTime)System.Web.HttpContext.Current.Session["minExpDate"];
                maxExpDate = (DateTime)System.Web.HttpContext.Current.Session["maxExpDate"];
            }
            //if (minExpDate != null && maxExpDate != null)
            //{
            //    query = query.Where(x => x.expense_date >= minExpDate && x.expense_date <= maxExpDate);
            //}
            //else
            //{
            //    query = query.Where(x => x.expense_date >= dtTmp);
            //}
            DomainModel.BusinessLayer.Expense Exp = new DomainModel.BusinessLayer.Expense();
            var x = Exp.GetExpenditure(UserDetails.Current.SchoolId, minExpDate, maxExpDate);

            //var query = from exp in x
            //            select new ExpenseTrans()
            //            {
            //                id = exp.id,
            //                amount = exp.amount,
            //                expense_date = exp.expense_date,
            //                expense_type = exp.expense_type,
            //                remarks = exp.remarks
            //            };

            //IList<ExpenseTrans> qryList= query.ToList();
            Export2Excel("ExpenseReport", x.ToList());
        }
コード例 #2
0
        public ActionResult EditExpenditure(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LoadDropdowns();
            DomainModel.BusinessLayer.Expense exptrans = new DomainModel.BusinessLayer.Expense();
            var qryExpTrans = exptrans.GetExpenseTrans(Convert.ToInt32(id), Convert.ToInt32(UserDetails.Current.SchoolId));
            var trans       = new ExpenseTrans();

            trans.id = qryExpTrans.id;
            trans.expense_type_id = qryExpTrans.expense_type_id;
            trans.expense_date    = qryExpTrans.expense_date;
            trans.mode_of_payment = qryExpTrans.mode_of_payment;
            trans.cheque_dd_no    = qryExpTrans.cheque_dd_no;
            trans.remarks         = qryExpTrans.remarks;
            trans.amount          = qryExpTrans.amount;
            trans.issue_bank      = qryExpTrans.issue_bank;

            List <string> qryExpAtt = new List <string>();

            qryExpAtt = exptrans.GetAttachment(Convert.ToInt32(id));
            String strAttachment = "";

            foreach (var item in qryExpAtt)
            {
                strAttachment = strAttachment + item.ToString() + ",";
            }
            if (strAttachment != "")
            {
                ViewBag.attachment = strAttachment;
            }
            return(View(trans));
        }
コード例 #3
0
        public ActionResult GetMonthlyExpReport()
        {
            String strContent  = string.Empty;
            int    currentyear = DateTime.Now.Year;

            DomainModel.BusinessLayer.Expense Exp = new DomainModel.BusinessLayer.Expense();
            strContent = Exp.getMonthlyExpReport(UserDetails.Current.SchoolId, currentyear);
            return(Content(strContent));
        }
コード例 #4
0
        // GET: Finance/Expenditure

        public ActionResult Expenditure(DateTime?minExpDate, DateTime?maxExpDate)
        {
            DomainModel.BusinessLayer.Expense Exp = new DomainModel.BusinessLayer.Expense();
            var qryExp = Exp.GetExpenditure(UserDetails.Current.SchoolId, minExpDate, maxExpDate);

            //var query = from exp in x
            //            select new ExpenseTrans()
            //            {
            //                id = exp.id,
            //                amount = exp.amount,
            //                expense_date = exp.expense_date,
            //                expense_type = exp.expense_type,
            //                remarks = exp.remarks
            //            };

            System.Web.HttpContext.Current.Session["minExpDate"] = minExpDate;
            System.Web.HttpContext.Current.Session["maxExpDate"] = maxExpDate;
            return(View(qryExp.ToList()));
        }
コード例 #5
0
        public ActionResult EditExpenditure(HttpPostedFileBase vocher, HttpPostedFileBase vocher2, [Bind(Include = "id,expense_type_id,amount,remarks,expense_date,mode_of_payment,cheque_dd_no,issue_bank")] ExpenseTrans Exp)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    LoadDropdowns();
                    HttpPostedFileBase voch1 = Request.Files["vocher"];
                    HttpPostedFileBase voch2 = Request.Files["vocher2"];
                    DomainModel.BusinessLayer.Expense exptrans = new DomainModel.BusinessLayer.Expense();
                    exptrans.id              = Exp.id;
                    exptrans.amount          = Exp.amount;
                    exptrans.entered_by      = Exp.entered_by;
                    exptrans.expense_date    = Exp.expense_date;
                    exptrans.expense_type_id = Exp.expense_type_id;
                    exptrans.idSchool        = UserDetails.Current.SchoolId;
                    exptrans.last_updated_by = UserDetails.Current.Iduser;
                    exptrans.remarks         = Exp.remarks;
                    exptrans.mode_of_payment = Exp.mode_of_payment;
                    exptrans.cheque_dd_no    = Exp.cheque_dd_no;
                    exptrans.issue_bank      = Exp.issue_bank;

                    int Exptransid = exptrans.SaveExpense(exptrans);
                    if (Exptransid > 0)
                    {
                        string TempFolder = "/Uploads";
                        var    serverPath = HttpContext.Server.MapPath(TempFolder);
                        if (Directory.Exists(serverPath) == false)
                        {
                            Directory.CreateDirectory(serverPath);
                        }
                        if (voch1.FileName != "")
                        {
                            var fileext      = Path.GetExtension(voch1.FileName);
                            var fileName     = String.Concat("Fin_Voch1_", Exptransid, fileext);
                            var fullFileName = Path.Combine(serverPath, fileName);
                            voch1.SaveAs(fullFileName);
                            string vochblob = fileName;
                            //Saving files to cloud Strorage..
                            DomainModel.BusinessLayer.BlobStorage bs = new DomainModel.BusinessLayer.BlobStorage();
                            Boolean res = false;
                            res = bs.SaveBlob((int)DomainModel.BusinessLayer.BlobStorage.StorageContainer.finance, vochblob, fullFileName);
                            //end
                            System.IO.File.Delete(fullFileName);
                            //Saving Attachments
                            Boolean Attach = exptrans.SaveAttachment(UserDetails.Current.Iduser, Exptransid, "/finance/" + fileName);
                            //end
                        }
                        if (voch2.FileName != "")
                        {
                            var fileext      = Path.GetExtension(voch2.FileName);
                            var fileName     = String.Concat("Fin_Voch2_", Exptransid, fileext);
                            var fullFileName = Path.Combine(serverPath, fileName);
                            voch2.SaveAs(fullFileName);
                            string vochblob2 = fileName;
                            DomainModel.BusinessLayer.BlobStorage bs = new DomainModel.BusinessLayer.BlobStorage();
                            Boolean res = false;
                            res = bs.SaveBlob((int)DomainModel.BusinessLayer.BlobStorage.StorageContainer.finance, vochblob2, fullFileName);
                            System.IO.File.Delete(fullFileName);
                            Boolean Attach = exptrans.SaveAttachment(UserDetails.Current.Iduser, Exptransid, "/finance/" + fileName);
                        }
                    }
                    return(RedirectToAction("Expenditure"));
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }