private void fillGrid() { String userLogin = ((User)Session["user"]).Login; String password = ((User)Session["user"]).Password; //String userLogin = "******"; //String password = ""; List <Report> reportList = ReportDAO.getInstance().getAllReports(userLogin, password); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("ID", typeof(String))); dt.Columns.Add(new DataColumn("Name", typeof(String))); dt.Columns.Add(new DataColumn("Description", typeof(String))); dt.Columns.Add(new DataColumn("IMReport", typeof(String))); foreach (Report rep in reportList) { DataRow dr = null; dr = dt.NewRow(); dr["ID"] = rep.Id; dr["Name"] = rep.Name; dr["Description"] = rep.Description; dr["IMReport"] = rep.IM_Report; dt.Rows.Add(dr); } ViewState["CurrentTable"] = dt; genericGridView.DataSource = dt; genericGridView.DataBind(); }
public string GetCaptureReport(List <FilterDTO> filterDto) { ReportDAO reporting = new ReportDAO(); //return reporting.GetCaptureReport(filterDto); return(DTOSerializer.Serialize(reporting.GetCaptureReport(filterDto)).InnerXml); }
public string GetAttendanceReport(int CaptureId) { ReportDAO reporting = new ReportDAO(); //return reporting.GetAttendanceReport(CaptureId); return(DTOSerializer.Serialize(reporting.GetAttendanceReport(CaptureId)).InnerXml); }
protected void Page_PreLoad(object sender, EventArgs e) { try { string username = Request.Params["username"]; string password = Request.Params["password"]; string log = Request.Params["log"]; User usr = UserDAO.Login(username, password); if (usr == null) { Response.Write("INVALID USER"); Response.End(); } Report report = new Report(); report.Log = log; report.User_fk = usr.Id; ReportDAO.AddReport(report); Response.Write("success"); } catch (Exception ex) { Response.Write("THERE WAS A CRASH LOGGING"); Debug.WriteLine(ex.StackTrace); Debug.WriteLine(ex.Message); } }
/// <summary> /// Lấy dữ liệu thẻ kho tổng hợp /// </summary> /// <param name="fromDate">ngày bắt đầu</param> /// <param name="toDate">ngày kết thúc</param> /// <param name="warehouseID">mã kho</param> /// <param name="isPhatSinh">chỉ lấy PS</param> /// <returns></returns> public List <TheKho> GetTongHopTheKho(DateTime fromDate, DateTime toDate, string warehouseID, bool isPhatSinh) { // Lấy dữ liệu phát sinh trong kỳ List <TheKho> psData = ReportDAO.GetTongHopTheKho(fromDate, toDate, warehouseID); // Lấy dữ liệu đầu kỳ var dauKyData = this.GetWarehouseBalances(fromDate, warehouseID); dauKyData = dauKyData .GroupBy(o => o.ItemID) .OrderBy(o => o.Key) .Select(o => new GetWarehouseBalance { ItemID = o.Key, WarehouseListID = o.Max(s => s.WarehouseListID), BalanceDate = o.Max(s => s.BalanceDate), Quantity = o.Sum(s => s.Quantity), Amount = o.Sum(s => s.Amount) }).ToList(); // Thêm đầu kỳ vào dữ liệu phát sinh AddDKToPS(psData, dauKyData); if (!isPhatSinh) { // xử lý trường hợp có đầu kỳ nhưng lại không có phát sinh AddDKNotPSToPS(psData, dauKyData); } AddTheKhoName(psData); return(psData); }
public ActionResult ThongKeNam(String searchString, int page = 1, int pageSize = 12) { var dao = new ReportDAO(); var model = dao.ThongKeNam(searchString); return(View(model)); }
/// <summary> /// Retrieves the loss ratio and total value of lost/discarded packages for each distribution centre. /// </summary> /// <returns>a list of distribution centre, loss value, loss ratio and risk level</returns> public List <DistributionCentreLossViewData> DistributionCentreLosses() { const double riskThreshold = 0.09; List <DistributionCentreLossViewData> report = new List <DistributionCentreLossViewData>(); List <DistributionCentre> distributionCentres = DistributionCentreDAO.FindAllDistributionCentres(); foreach (DistributionCentre distributionCentre in distributionCentres) { List <MedicationTypeViewData> lostList = ReportDAO.FindDistributionCentreStockByStatus(distributionCentre.ID, PackageStatus.Discarded, PackageStatus.Lost); decimal lostTotal = lostList.Sum(type => type.Value); List <MedicationTypeViewData> handledList = ReportDAO.FindDistributionCentreStockByStatus(distributionCentre.ID, PackageStatus.Distributed, PackageStatus.Discarded, PackageStatus.Lost); decimal handledTotal = handledList.Sum(type => type.Value); double lossRatio; if (handledTotal == 0) { lossRatio = 0; } else { lossRatio = Convert.ToDouble(lostTotal / handledTotal); } DistributionCentreRiskLevel riskLevel = DistributionCentreRiskLevel.Low; if (Convert.ToDouble(lossRatio) > riskThreshold) { riskLevel = DistributionCentreRiskLevel.High; } report.Add(new DistributionCentreLossViewData { DistributionCentre = distributionCentre.Name, LossRatio = lossRatio, LossValue = lostTotal, RiskLevel = riskLevel }); } return(report.OrderByDescending(x => x.LossRatio).ToList()); }
public ActionResult ThongKeNam(int page = 1, int pageSize = 12) { var dao = new ReportDAO(); var model = dao.ThongKeNam(""); return(View(model)); }
public ActionResult Index(String searchString, int page = 1, int pageSize = 10) { var dao = new ReportDAO(); var model = dao.ListAllPaging(searchString, page, pageSize); return(View(model)); }
public async Task <IActionResult> GetReport(string reportId) { using (var reportDAO = new ReportDAO()) { var foundReport = await reportDAO.Context.Report .AsNoTracking() .Include(x => x.JoinXx) .FirstOrDefaultAsync(x => x.IdReport == reportId); var joinXX = foundReport.JoinXx.Select(x => new { x.IdJoin, x.IdTdk, x.IdNtk, x.IdXtk, x.IdTck }).ToArray(); return(Json(new { foundReport.DateElWarehouse, joinXX } )); } }
public List <SoQuyTienMat> GetSoQuyTienMat(DateTime fromDate, DateTime toDate) { var psData = ReportDAO.GetSoQuyTienMat(fromDate, toDate); if (psData == null || psData.Count <= 0) { return(null); } var dkData = BalanceLogic.GetBalanceList(fromDate); dkData = dkData.Where(o => o.AccountID.StartsWith("111")).ToList(); decimal debitBalance = dkData.Sum(o => o.DebitBalance - o.CreditBalance); if (psData == null || psData.Count <= 0) { psData = new List <SoQuyTienMat> { new SoQuyTienMat() }; } else { foreach (var item in psData) { item.DebitBalance = debitBalance; } } return(psData); }
public async Task <IActionResult> GetAllReport() { using (var reportDAO = new ReportDAO()) { var foundReport = reportDAO.Context.Report .AsNoTracking() .Include(x => x.JoinXx) .ThenInclude(x => x.IdReportNavigation) .Select(x => new{ x.IdReport, joinXX = x.JoinXx.Select(y => new { y.IdReportNavigation.DateElWarehouse, y.IdJoin, y.IdTdk, y.IdNtk, y.IdXtk, y.IdTck }).ToArray(), x.DateElWarehouse }).ToArray(); return(Json(foundReport)); } }
private void frmPrincipal_Load(object sender, EventArgs e) { ReportDAO rptDAO = new ReportDAO(); cmdArea.DataSource = rptDAO.GellAllArea(); cmdArea.DisplayMember = "Name"; cmdArea.ValueMember = "Id"; }
public List <GetTongHopNo> GetSoTongHopNo(DateTime fromDate, DateTime toDate) { var dkData = BalanceLogic.GetSoDuDauKyCongNo(fromDate); dkData = dkData.Where(o => o.DebitBalance > 0 || o.CreditBalance > 0).ToList(); var psData = ReportDAO.GetSoTongHopNo(fromDate, toDate); // Thêm DK var dkNotPS = new List <GetTongHopNo>(); foreach (GetBalance item in dkData) { var psFind = psData.Find(o => o.AccountID == item.AccountID && o.AccountDetailID == item.AccountDetailID && o.CustomerID == item.CustomerID); // có ps if (psFind != null) { psFind.DKNo = item.DebitBalance; psFind.DKCo = item.CreditBalance; } // không có ps else { dkNotPS.Add(new GetTongHopNo { AccountID = item.AccountID, AccountDetailID = item.AccountDetailID, CustomerID = item.CustomerID, CustomerName = item.CustomerName, CustomerSName = item.CustomerSName, DKNo = item.DebitBalance, DKCo = item.CreditBalance }); } } // Thêm danh sách có đầu kỳ nhưng không có phát sinh psData.AddRange(dkNotPS); // Tính cuối kỳ foreach (var ps in psData) { decimal ckNo = ps.DKNo + ps.PSNo - ps.DKCo - ps.PSCo; if (ckNo > 0) { ps.CKNo = ckNo; } else { ps.CKCo = Math.Abs(ckNo); } } return(psData.OrderBy(o => o.AccountID).ThenBy(o => o.AccountDetailID).ThenBy(o => o.CustomerSName).ToList()); }
/// <summary> /// Generate the all page report summary to create a line chart /// </summary> /// <param name="pageReportType"></param> /// <param name="dateFrom"></param> /// <param name="dateTo"></param> /// <returns></returns> public static PageReportSummary GeneratePageReport(PageReportType pageReportType, DateTime dateFrom, DateTime dateTo, string selectedPage = "") { dateFrom = new DateTime(dateFrom.Year, dateFrom.Month, dateFrom.Day, 0, 0, 1); dateTo = new DateTime(dateTo.Year, dateTo.Month, dateTo.Day, 23, 59, 59); PageReportSummary PageReportSummary = new PageReportSummary(); //add 3 lists to represent the all categories if (string.IsNullOrWhiteSpace(selectedPage) || "all".Equals(selectedPage)) { PageReportSummary.PageReportSeriesList.Add(new PageReportSeries { name = "Page Views", data = new List <int>() }); PageReportSummary.PageReportSeriesList.Add(new PageReportSeries { name = "Website Visits", data = new List <int>() }); PageReportSummary.PageReportSeriesList.Add(new PageReportSeries { name = "Unique Website Visits", data = new List <int>() }); } else { PageReportSummary.PageReportSeriesList.Add(new PageReportSeries { name = "Page Views", data = new List <int>() }); } List <PageView> PageViewList = ReportDAO.LoadPageViews(dateFrom, dateTo, selectedPage); if (PageViewList != null && PageViewList.Count > 0) { while (dateFrom <= dateTo) { string DateTimeFormat = GetDateTimeCategoryToString(pageReportType); string Category = dateFrom.ToString(DateTimeFormat); PageReportSummary.MasterCategoryList.Add(Category); if (string.IsNullOrWhiteSpace(selectedPage) || "all".Equals(selectedPage)) { ProcessAllPageReportRow(PageReportSummary, PageViewList, DateTimeFormat, Category); } else { ProcessSpecificPageReportRow(PageReportSummary, PageViewList, DateTimeFormat, Category); } dateFrom = IncreaseDateTime(pageReportType, dateFrom); } ProcessBasicStatistics(PageReportSummary, PageViewList); ProcessBrowserSummary(PageReportSummary, PageViewList); ProcessOperatingSystemSummary(PageReportSummary, PageViewList); } return(PageReportSummary); }
public DataSet LoadStockCountingResultForExport(StockTakingDTO argSTK) { DataSet ret = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); ret = dao.LoadStockCountingResultForExport(argSTK); return(ret); }
public DataSet LoadEPR020(ReportCriteriaDTO.EPR020 argCriteria) { DataSet dsReturn = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); dsReturn = dao.LoadEPR020(argCriteria); return(dsReturn); }
public DataSet LoadIVR010_InventorySheet(ReportCriteriaDTO.IVR010 argCriteria) { DataSet dsReturn = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); dsReturn = dao.LoadIVR010_InventorySheet(argCriteria); return(dsReturn); }
public DataSet LoadINV060_ProductionSummaryByItem(ReportCriteriaDTO.INV060 argCriteria) { DataSet dsReturn = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); dsReturn = dao.LoadINV060_ProductionSummaryByItem(argCriteria); return(dsReturn); }
protected void Session_End(object sender, EventArgs e) { try { UserSessionInformation UserInfo = (UserSessionInformation)Session[SiteContext.USER_SESSION_INFO] ?? new UserSessionInformation(); ReportDAO.UpdateLastPageUserWasOn(AppSettings.AllowPageReportRecording, UserInfo); } catch (Exception ex) { } }
public List <SoQuyTienMat> GetTienGuiNganHang(DateTime fromDate, DateTime toDate) { var psData = ReportDAO.GetTienGuiNganHang(fromDate, toDate); var dkData = BalanceLogic.GetBalanceList(fromDate); dkData = dkData .Where(o => o.AccountID.StartsWith("112")) .GroupBy(o => new { o.AccountID, o.AccountDetailID }) .Select(o => new GetBalance { AccountID = o.Key.AccountID, AccountDetailID = o.Key.AccountDetailID, AccountName = o.Max(s => s.AccountName), DebitBalance = o.Sum(s => s.DebitBalance), CreditBalance = o.Sum(s => s.CreditBalance) }) .ToList(); if (psData != null && psData.Count > 0) { string preAccountID = string.Empty, preAccountDetailID = string.Empty; decimal DKNo = 0; // có phát sinh foreach (var item in psData) { if (preAccountID != item.AccountID || preAccountDetailID != item.AccountDetailID) { preAccountID = item.AccountID; preAccountDetailID = item.AccountDetailID; var find = dkData.Find(o => o.AccountID == preAccountID && o.AccountDetailID == preAccountDetailID); if (find != null) { DKNo = find.DebitBalance - find.CreditBalance; } else { DKNo = 0; } } item.DebitBalance = DKNo; } } else { // Không có phát sinh return(null); } return(psData); }
/// <summary> /// Lấy dữ liệu nhập xuất kho /// </summary> /// <param name="fromDate">ngày bắt đầu</param> /// <param name="toDate">ngày kết thúc</param> /// <param name="warehouseID">mã kho</param> /// <param name="isPhatSinh">chỉ lấy PS</param> /// <returns></returns> public List <GetTongHopKho> GetNhapXuatKho(DateTime fromDate, DateTime toDate, string warehouseID, bool isPhatSinh) { // Lấy dữ liệu phát sinh trong kỳ List <GetTongHopKho> psData = ReportDAO.GetTongHopKho(fromDate, toDate, warehouseID); // Lấy dữ liệu đầu kỳ List <GetWarehouseBalance> dauKyData = this.GetWarehouseBalances(fromDate, warehouseID); // Thêm đầu kỳ vào dữ liệu phát sinh var dkNotPS = new List <GetTongHopKho>(); string preItem = string.Empty; decimal balanceQuantity = 0; decimal balanceAmount = 0; foreach (var item in psData) { var find = dauKyData.Find(o => GetKey(o.ItemID, o.WarehouseListID) == GetKey(item.ItemID, item.WarehouseListID)); if (find != null) { balanceQuantity = find.Quantity; balanceAmount = find.Amount; } else { balanceQuantity = 0; balanceAmount = 0; } item.LuongDK = balanceQuantity; item.TienDK = balanceAmount; } if (!isPhatSinh) { // xử lý trường hợp có đầu kỳ nhưng lại không có phát sinh foreach (var item in dauKyData) { if (psData.Find(o => GetKey(o.ItemID, o.WarehouseListID) == GetKey(item.ItemID, item.WarehouseListID)) == null) { psData.Add(new GetTongHopKho { ItemID = item.ItemID, WarehouseListID = item.WarehouseListID, LuongDK = item.Quantity, TienDK = item.Amount }); } } } return(psData); }
private void btnInventory_Click(object sender, EventArgs e) { List <ReportPOJO> reports = ReportDAO.getAllReportInventory(); dtgReportProducts.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgReportProducts.Rows.Add(reports[i].IdArticle, reports[i].Name, reports[i].Size, reports[i].Color, reports[i].Cost, reports[i].Price1, reports[i].Price2, reports[i].Price3, reports[i].Price4, reports[i].QuantityArticle); } }
public async Task <IActionResult> index(int month) { using (var reportDAO = new ReportDAO()) { dynamic expObj = new ExpandoObject(); var foundReport = await reportDAO.Context.Report .Include(x => x.JoinXx) .ThenInclude(x => x.IdJoinNavigation) .Include(x => x.JoinXx) .ThenInclude(x => x.IdTdkNavigation) .Include(x => x.JoinXx) .ThenInclude(x => x.IdNtkNavigation) .Include(x => x.JoinXx) .ThenInclude(x => x.IdXtkNavigation) .Include(x => x.JoinXx) .ThenInclude(x => x.IdTckNavigation) .FirstOrDefaultAsync(x => x.DateElWarehouse.Value.Month == month); expObj.DateElWarehouse = foundReport.DateElWarehouse.Value; var lstReportRow = new List <dynamic>(); foreach (var ele in foundReport.JoinXx) { dynamic expEle = new ExpandoObject(); expEle.IdProduct = ele.IdJoinNavigation.IdProduct; expEle.ProductName = ele.IdJoinNavigation.ProductName; expEle.Unit = ele.IdJoinNavigation.Unit; expEle.QuantityTdk = ele.IdTdkNavigation.QuantityTdk; expEle.Total1 = ele.IdTdkNavigation.Total; expEle.QuantityNtk = ele.IdNtkNavigation.QuantityNtk; expEle.Total2 = ele.IdNtkNavigation.Total; expEle.QuantityXtk = ele.IdXtkNavigation.QuantityXtk; expEle.Total3 = ele.IdXtkNavigation.Total; expEle.PriceExport = ele.IdXtkNavigation.PriceExport; expEle.QuantityTck = ele.IdTckNavigation.QuantityTck; expEle.Total4 = ele.IdXtkNavigation.Total; lstReportRow.Add(expEle); } expObj.ReportRow = lstReportRow; var html = (View(expObj) as ViewResult).ToHtml(HttpContext); var converter = new HtmlToPdf(); var doc = converter.ConvertHtmlString(html); var pdfByte = doc.Save(); doc.Close(); return(File(pdfByte, "application/pdf")); } }
private void btnReportCost_Click(object sender, EventArgs e) { DateTime finish = cmbFinalCostDate.Value; DateTime init = cmbInitialCostDate.Value; String fin = finish.Year + "-" + finish.Month + "-" + (finish.Day + 1); String inicio = init.Year + "-" + init.Month + "-" + (init.Day - 1); List <ReportPOJO> reports = ReportDAO.getAllReportCost(inicio, fin); dtgCostReports.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgCostReports.Rows.Add(reports[i].IdSale, reports[i].Date, reports[i].Total); } }
private void btnReportInOut_Click(object sender, EventArgs e) { DateTime finish = cmbFinalSalesDare.Value; DateTime init = cmbInitialSalesDate.Value; String fin = finish.Year + "-" + finish.Month + "-" + (finish.Day + 1); String inicio = init.Year + "-" + init.Month + "-" + (init.Day - 1); List <ReportPOJO> reports = ReportDAO.getAllReportInOut(inicio, fin); dtgInputOutput.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgInputOutput.Rows.Add(reports[i].IdBatch, reports[i].DateBatch, reports[i].Reason, reports[i].QuantityBatch); } }
public void CanUserAddReportTest() { IMateDAO <Mate> MateDAO = new MateDAO(_connection); Mate testMate = new Mate(); testMate.FirstName = "Miguel"; testMate.LastName = "Dev"; testMate.UserName = "******"; testMate.Password = "******"; testMate.Email = "*****@*****.**"; testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."; testMate.Address = "Figueir"; testMate.Categories = new[] { Categories.CLEANING, Categories.PLUMBING }; testMate.Rank = Ranks.SUPER_MATE; testMate.Range = 20; Mate returnedMate = MateDAO.Create(testMate); IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection); Employer testEmployer = new Employer(); testEmployer.FirstName = "Marcelo"; testEmployer.LastName = "Carvalho"; testEmployer.UserName = "******"; testEmployer.Password = "******"; testEmployer.Email = "*****@*****.**"; testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."; testEmployer.Address = "Lixa"; Employer returnedEmployer = EmployerDAO.Create(testEmployer); IReportDAO ReportDAO = new ReportDAO(_connection); Report reportTest = new Report(); reportTest.Id = 1; reportTest.Reason = Reasons.INADEQUATE_BEHAVIOUR; reportTest.ReportedId = 35; reportTest.ReporterId = 34; reportTest.Comment = "O trabalho que fez nao presta"; Report repReturned = ReportDAO.ReportUser(returnedEmployer.Id, returnedMate.Id, reportTest); Assert.Equal(reportTest.Id, repReturned.Id); Assert.Equal(reportTest.Reason, repReturned.Reason); Assert.Equal(reportTest.ReportedId, repReturned.ReportedId); Assert.Equal(reportTest.ReporterId, repReturned.ReporterId); Assert.Equal(reportTest.Comment, repReturned.Comment); _fixture.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { string action = Request["action"]; if (action == "updatenewreports") { ReportDAO.UpdateReportsWordcount(true); } if (action == "updateallreports") { ReportDAO.UpdateReportsWordcount(false); } Response.Redirect("~/UserList"); }
public DataSet LoadStockTakingTagSummary() { DataSet dsReturn = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); dsReturn = dao.LoadStockTakingTagSummary(); if (dsReturn != null && dsReturn.Tables.Count > 0) { dsReturn.Tables[0].TableName = "STR040_StockTakingTagSummary"; } return(dsReturn); }
public DataSet LoadStockCountingResult(StockTakingDTO argSTK) { DataSet ret = null; ReportDAO dao = new ReportDAO(CommonLib.Common.CurrentDatabase); ret = dao.LoadStockCountingResult(argSTK); if (ret != null && ret.Tables.Count > 0) { ret.Tables[0].TableName = "S_STR020_StockCountingResult"; } return(ret); }