Пример #1
0
        private PagedList <HistoryViewModels> Journals(HistoryViewModels model)
        {
            var page = new PagedList <HistoryViewModels>();

            page.Content = HistoryBusinessLogic.getInstance().TodaysJournal(model);
            return(page);
        }
        public async Task <IActionResult> History()
        {
            _logger.LogInformation("View history");
            var viewModel = new HistoryViewModels
            {
                History = history.GetHistory()
            };

            return(this.View(viewModel));
        }
Пример #3
0
        public List <HistoryViewModels> TodaysJournal(HistoryViewModels model)
        {
            List <HistoryViewModels> list = new List <HistoryViewModels>();

            try
            {
                string   account = model.Account, bankAccount = model.BankAccount, sortBy = model.SortBy;
                DateTime?startDate = null, endDate = null;
                if (!String.IsNullOrEmpty(model.Date))
                {
                    startDate = Convert.ToDateTime(model.Date.Split('-')[0].Trim());
                    endDate   = Convert.ToDateTime(model.Date.Split('-')[1].Trim());
                }
                var journalList = _db.sp_HistoryJournal(SessionManager.userId(), startDate, endDate, model.Account, model.BankAccount, model.SortBy);
                foreach (var item in journalList)
                {
                    model = new HistoryViewModels();
                    DateTime?trxDate    = item.TransactionDate;
                    string   strTrxDate = trxDate.Value.ToString("dd MMM yyyy");

                    model.PettyCashId = item.PettyCashId;
                    model.Date        = strTrxDate;
                    model.Account     = item.AccountName;
                    model.BankAccount = item.FacilityName;
                    model.Description = item.Description;
                    model.CashIn      = item.Cash_In.ToString();
                    model.CashOut     = item.Cash_Out.ToString();
                    model.Balance     = item.Balance.ToString();
                    model.Maker       = item.Maker;
                    model.CheckedBy   = item.CheckedBy;
                    model.ApprovalBy  = item.ApprovalBy;
                    model.RejectedBy  = item.RejectedBy;
                    model.Department  = item.DepartmentName;
                    list.Add(model);
                }
                //model.Date = string.Format("{0} - {1}", startDate, endDate);
                //model.Account = account;
                //model.BankAccount = bankAccount;
                //model.SortBy = sortBy;
            }
            catch (Exception e)
            {
                Logging.getInstance().CreateLogError(e);
                throw e;
            }
            return(list);
        }
Пример #4
0
        public ActionResult Index(string sd, string ed, string acc, string bnk, string srt)
        {
            HistoryViewModels model = new HistoryViewModels();

            string strDate = DateTime.Now.AddMonths(-1).ToString("MM/dd/yyyy");
            string endDate = DateTime.Now.ToString("MM/dd/yyyy");

            model.Date          = string.Format("{0}{1}", sd == null ? strDate : sd, ed == null ? " - " + endDate : " - " + ed);
            model.Account       = acc == null ? string.Empty : acc;
            model.BankAccount   = bnk == null ? string.Empty : bnk;
            model.SortBy        = srt == null ? string.Empty : srt;
            model.TodaysJournal = Journals(model);

            ViewBag.AccountList      = common.ToSelectList(AccountDetailsBusinessLogic.getInstance().getAccountDetailDDL(), "ID", "NAME", string.Empty);
            ViewBag.BankFacilityList = common.ToSelectList(BankFacilityBusinessLogic.getInstance().getBankFacilityDDL(), "ID", "NAME", model.BankAccount);
            ViewBag.SortByList       = common.ToSelectList(OutputBusinessLogic.getInstance().getSortByDDL(), "ID", "NAME", string.Empty);
            return(View(model));
        }
Пример #5
0
        public ActionResult Index(string Submit, HistoryViewModels model)
        {
            model.TodaysJournal      = Journals(model);
            ViewBag.AccountList      = common.ToSelectList(AccountDetailsBusinessLogic.getInstance().getAccountDetailDDL(), "ID", "NAME", model.Account);
            ViewBag.BankFacilityList = common.ToSelectList(BankFacilityBusinessLogic.getInstance().getBankFacilityDDL(), "ID", "NAME", model.BankAccount);
            ViewBag.SortByList       = common.ToSelectList(OutputBusinessLogic.getInstance().getSortByDDL(), "ID", "NAME", model.SortBy);

            if (!String.IsNullOrEmpty(Submit))
            {
                if (Submit.Equals("PDF"))
                {
                    GeneratePdf(model);
                }
                else if (Submit.Equals("Excel"))
                {
                    GenerateExcel(model);
                }
                else if (Submit.Equals("Print"))
                {
                }
            }

            return(View(model));
        }
Пример #6
0
        private void GeneratePdf(HistoryViewModels model)
        {
            MemoryStream ms = new MemoryStream();

            iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(PageSize.A4);
            rec.BackgroundColor = new BaseColor(System.Drawing.Color.Olive);
            Document doc = new Document(rec);

            doc.SetPageSize(iTextSharp.text.PageSize.A4);
            PdfWriter writer = PdfWriter.GetInstance(doc, ms);

            doc.Open();

            BaseFont arial = BaseFont.CreateFont(Server.MapPath(fontPath) + "ARIALN.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            Paragraph prgHeading = new Paragraph();

            prgHeading.Alignment = Element.ALIGN_CENTER;
            prgHeading.Add(new Chunk("DIPO INVESTAMA", new iTextSharp.text.Font(arial, 16, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
            doc.Add(prgHeading);

            prgHeading           = new Paragraph();
            prgHeading.Alignment = Element.ALIGN_CENTER;
            prgHeading.Add(new Chunk(" ", new iTextSharp.text.Font(arial, 16, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
            doc.Add(prgHeading);

            PdfPTable table = new PdfPTable(7);

            table.WidthPercentage = 100;
            table.SetWidthPercentage(new float[] { 15, 15, 15, 25, 10, 10, 10 }, new iTextSharp.text.Rectangle(doc.PageSize.Width / 6, doc.PageSize.Height));

            PdfPCell cell = new PdfPCell();

            cell.Phrase = new Phrase("Date"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Account"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Bank"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Description"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Cash Out"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Cash In"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            cell        = new PdfPCell();
            cell.Phrase = new Phrase("Balance"
                                     , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Border = 1;
            table.AddCell(cell);

            foreach (var item in model.TodaysJournal.Content)
            {
                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.Date
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.Account
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.BankAccount
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.Description
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.CashIn
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.CashOut
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(item.Balance
                                         , new iTextSharp.text.Font(arial, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#000000"))));
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.Border = 1;
                table.AddCell(cell);
            }

            doc.Add(table);
            doc.Close();

            byte[] result = ms.ToArray();

            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
            response.Clear();
            response.Buffer      = true;
            response.Charset     = "";
            response.ContentType = MimeMapping.GetMimeMapping("Journals_.pdf");
            response.AddHeader("content-disposition", "attachment;filename=Journals_" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".pdf");
            response.BinaryWrite(result);
            response.End();
        }
Пример #7
0
        private void GenerateExcel(HistoryViewModels model)
        {
            ExcelPackage   Package    = new ExcelPackage();
            ExcelWorksheet ws         = Package.Workbook.Worksheets.Add("Data");
            Color          colFromHex = System.Drawing.ColorTranslator.FromHtml("#00b0f0");

            OfficeOpenXml.Style.ExcelBorderStyle DefaultBorder = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

            ws.Cells["A1"].LoadFromText("Date");
            ws.Cells["A1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["A1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["A1"].Style.Font.Bold        = true;
            ws.Cells["A1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["A1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["A1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["A1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["A1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["A1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["A1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["A1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["B1"].LoadFromText("Account");
            ws.Cells["B1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["B1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B1"].Style.Font.Bold        = true;
            ws.Cells["B1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["B1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["B1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["B1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["B1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["B1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["B1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["B1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["C1"].LoadFromText("Bank");
            ws.Cells["C1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["C1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["C1"].Style.Font.Bold        = true;
            ws.Cells["C1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["C1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["C1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["C1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["C1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["C1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["C1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["C1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["D1"].LoadFromText("Description");
            ws.Cells["D1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["D1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["D1"].Style.Font.Bold        = true;
            ws.Cells["D1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["D1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["D1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["D1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["D1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["D1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["D1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["D1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["E1"].LoadFromText("Cash Out");
            ws.Cells["E1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["E1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["E1"].Style.Font.Bold        = true;
            ws.Cells["E1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["E1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["E1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["E1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["E1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["E1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["E1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["E1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["F1"].LoadFromText("Cash In");
            ws.Cells["F1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["F1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["F1"].Style.Font.Bold        = true;
            ws.Cells["F1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["F1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["F1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["F1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["F1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["F1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["F1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["F1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["G1"].LoadFromText("Balance");
            ws.Cells["G1"].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
            ws.Cells["G1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["G1"].Style.Font.Bold        = true;
            ws.Cells["G1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["G1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["G1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["G1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["G1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["G1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["G1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["G1"].Style.Border.Right.Style  = DefaultBorder;

            int idx = 1;

            foreach (var item in model.TodaysJournal.Content)
            {
                idx++;
                ws.Cells["A" + idx.ToString()].LoadFromText(item.Date);
                ws.Cells["A" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["A" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["A" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["A" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["B" + idx.ToString()].LoadFromText(item.Account);
                ws.Cells["B" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["B" + idx.ToString()].Style.Numberformat.Format = "dd MMM yy HH:mm";
                ws.Cells["B" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["B" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["B" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["C" + idx.ToString()].LoadFromText(item.BankAccount);
                ws.Cells["C" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["C" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["C" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["C" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["D" + idx.ToString()].LoadFromText(item.Description);
                ws.Cells["D" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["D" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["D" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["D" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["D" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["D" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["D" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["E" + idx.ToString()].LoadFromText(item.CashOut);
                ws.Cells["E" + idx.ToString()].Style.Numberformat.Format = "##0";
                ws.Cells["E" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["E" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["E" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["E" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["E" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["E" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["E" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["F" + idx.ToString()].LoadFromText(item.CashIn);
                ws.Cells["F" + idx.ToString()].Style.Numberformat.Format = "##0";
                ws.Cells["F" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["F" + idx.ToString()].Style.Numberformat.Format = "#,#0 Liter";
                ws.Cells["F" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["F" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["F" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["F" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["F" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["F" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["G" + idx.ToString()].LoadFromText(item.Balance);
                ws.Cells["G" + idx.ToString()].Style.Numberformat.Format = "##0";
                ws.Cells["G" + idx.ToString()].Style.Font.SetFromFont(new System.Drawing.Font("Cambria", 10));
                ws.Cells["G" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["G" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["G" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["G" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["G" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["G" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;
            }

            Response.Clear();
            Response.Buffer      = true;
            Response.Charset     = "";
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment;filename=Journals_" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".xlsx");
            Response.BinaryWrite(Package.GetAsByteArray());
            Response.End();
        }
Пример #8
0
        public List <HistoryViewModels> getActivitiesLog(string IDUser)
        {
            //ReviewFilmsBus reviewFilmsBus = new ReviewFilmsBus();
            List <HistoryViewModels> result = new List <HistoryViewModels>();

            CommentBus commentBus = new CommentBus();

            ReviewFilmsBus reviewBus = new ReviewFilmsBus();
            AccountBus     accBus    = new AccountBus();
            FilmBus        filmBus   = new FilmBus();
            ThanhVien      thanhVien = accBus.getMemberByUserId(IDUser);

            List <BinhLuan> lstBinhLuan = commentBus.getMyComments(IDUser);



            foreach (BinhLuan binhLuan in lstBinhLuan)
            {
                HistoryViewModels temp = new HistoryViewModels();

                BaiNhanXet baiNhanXet = reviewBus.getReview((int)binhLuan.MS_BaiNhanXet);
                Phim       phim       = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());

                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = (int)binhLuan.MS_BaiNhanXet;
                temp.tenPhim       = phim.TenPhim;
                temp.MS_Phim       = (int)phim.MaSo;
                temp.action        = "Comment";
                temp.Hoten         = thanhVien.HoTen;
                temp.content       = binhLuan.NoiDung;
                temp.dateAction    = (DateTime)binhLuan.NgayDang;
                result.Add(temp);
            }

            FilmLikeBus filmLikeBus = new FilmLikeBus();

            List <DanhSachPhimYeuThich> lstPhimYeuThich = filmLikeBus.getMyListFilmLike(IDUser);


            foreach (DanhSachPhimYeuThich phimYeuThich in lstPhimYeuThich)
            {
                HistoryViewModels temp = new HistoryViewModels();

                Phim p = filmBus.getFilmByID(phimYeuThich.MS_Phim.ToString());
                temp.tenPhim    = p.TenPhim;
                temp.MS_Phim    = p.MaSo;
                temp.Hoten      = thanhVien.HoTen;
                temp.action     = "Like";
                temp.content    = thanhVien.HoTen + " đã thích " + p.TenPhim;
                temp.dateAction = (DateTime)phimYeuThich.ThoiGian;
                result.Add(temp);
            }


            List <BaiNhanXet> lstNhanXet = reviewBus.getMyListReview(IDUser);

            foreach (BaiNhanXet baiNhanXet in lstNhanXet)
            {
                HistoryViewModels temp = new HistoryViewModels();
                Phim p = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());
                temp.tenPhim       = p.TenPhim;
                temp.MS_Phim       = p.MaSo;
                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = baiNhanXet.MaSo;
                temp.Hoten         = thanhVien.HoTen;
                temp.action        = "Post";
                temp.content       = thanhVien.HoTen + " đã thêm bài nhận xét ...." + baiNhanXet.MS_Phim;
                temp.dateAction    = (DateTime)baiNhanXet.NgayDang;
                result.Add(temp);
            }

            result.Sort((x, y) => y.dateAction.CompareTo(x.dateAction));


            return(result);
        }