public ActionResult DailySales(String TerminalID, DateTime LocalTime) { if (ModelState.IsValid) { try { String MerchantID = GetFromMerchantIDCookie(); DailySalesInformation RecInfo = TransactionServiceInstance.DailyReport( MerchantID, "", 'W', "", TerminalID, LocalTime); if (RecInfo.ResponseCode == 'A') { Receipt Recpt = TransactionServiceInstance.FormatDailyReport(RecInfo); // set return address for the receipt page TempData["Receipt"] = Recpt; return(RedirectToAction("Receipt")); } else { // need locale based lookup of error codes ModelState.AddModelError("", "Error on Daily Sales Report: " + Utility.ConvertErrorCodes(RecInfo.ErrorCode)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } } catch (Exception Ex) { ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Daily Sales Report", Request.Form)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } } return(View("ReportError")); }
//**************************************************************** // // R e p o r t s /// <summary> /// Daily Report /// </summary> /// <param name="MerchantID"></param> /// <param name="ClerkID"></param> /// <param name="MerchSeqNum"></param> /// <param name="WhereFrom"></param> /// <returns></returns> DailySalesInformation ITransactionService.DailyReport( String MerchantID, String ClerkID, char WhereFrom, String MerchSeqNum, String TerminalID, DateTime LocalTime) { DailySalesInformation DSI = new DailySalesInformation(); IHistoryDAO IHR = new HistoryDAO(); gp_DailyReport_Result DRR = IHR.DailyReport(MerchantID, ClerkID, Convert.ToString(WhereFrom), MerchSeqNum, TerminalID, LocalTime); IHR.DailyReportToWeb(DRR, DSI, LocalTime); return(DSI); }
public ActionResult PriorSummary(String TerminalID, DateTime LocalTime, String ID) { String MerchantID = GetFromMerchantIDCookie(); if (ID.Length < 4) { return(RedirectToAction("PriorSummaries")); } string[] Parts = (ID + ".").Split('.'); string[] DateParts = (Parts[0] + "-").Split('-'); string ProperDate = DateParts[1] + "/" + DateParts[0] + "/" + DateParts[2] + " " + Parts[1].Substring(0, 2) + ":" + Parts[1].Substring(2); //if (ModelState.IsValid) DateTime Result; if (DateTime.TryParse(ProperDate, out Result)) { try { DailySalesInformation RecInfo = TransactionServiceInstance.PriorDailyReport( MerchantID, "", 'W', TerminalID, LocalTime, ProperDate); if (RecInfo.ResponseCode == 'A') { Receipt Recpt = TransactionServiceInstance.FormatDailyReport(RecInfo); // set return address for the receipt page TempData["Receipt"] = Recpt; return(RedirectToAction("Receipt")); } else { ModelState.AddModelError("", "Unable to retrieve that report"); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } } catch (Exception Ex) { ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Prior Daily Report", Request.Form)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } } else { ModelState.AddModelError("", "Invalid Date"); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } return(RedirectToAction("PriorSummaries")); }
public void DailyReportToWeb(gp_DailyReport_Result Res, DailySalesInformation Web, DateTime When) { Web.When = When; Web.ResponseCode = (char)Res.ResponseCode[0]; Web.ErrorCode = (string)Res.ErrorCode; Web.GiftActive = false; if (Res.GiftActive.Length > 0) { if (Res.GiftActive[0] == 'A') { Web.GiftActive = true; } } Web.GiftActivations = 0; if (Res.GiftActivates.HasValue) { Web.GiftActivations = Res.GiftActivates.Value; } Web.GiftActivationAmount = 0.00M; if (Res.GiftActiveTotal.HasValue) { Web.GiftActivationAmount = Res.GiftActiveTotal.Value; } Web.GiftSales = 0; if (Res.GiftSales.HasValue) { Web.GiftSales = Res.GiftSales.Value; } Web.GiftSalesAmount = 0.00M; if (Res.GiftSalesTotal.HasValue) { Web.GiftSalesAmount = Res.GiftSalesTotal.Value; } Web.GiftCredits = 0; if (Res.GiftCredits.HasValue) { Web.GiftCredits = Res.GiftCredits.Value; } Web.GiftCreditAmount = 0.00M; if (Res.GiftCreditTotal.HasValue) { Web.GiftCreditAmount = Res.GiftCreditTotal.Value; } Web.NetGiftAmount = 0; if (Res.NetGiftTotal.HasValue) { Web.NetGiftAmount = Res.NetGiftTotal.Value; } }
public void FormatSummarySection(Receipt aRep, DailySalesInformation ReportInfo) { int linelen = ("cardActivations" + " - " + ReportInfo.GiftActivationAmount.ToString()).Length + 12; int ValueLen = ReportInfo.GiftSalesAmount.ToString().Length + 3; aRep.Add(" "); if (ReportInfo.GiftActive) { aRep.Add(formatReportLine("Card Activations", " - ", ReportInfo.GiftActivations.ToString(), linelen, ValueLen)); aRep.Add(formatReportLine("Amount", " $", formatAmount(ReportInfo.GiftActivationAmount.ToString()), linelen, ValueLen)); aRep.Add(formatReportLine("Sales From Cards", " - ", ReportInfo.GiftSales.ToString(), linelen, ValueLen)); aRep.Add(formatReportLine("Amount", " $", formatAmount(ReportInfo.GiftSalesAmount.ToString()), linelen, ValueLen)); aRep.Add(formatReportLine("Credits To Cards", " - ", ReportInfo.GiftCredits.ToString(), linelen, ValueLen)); aRep.Add(formatReportLine("Amount", " $", formatAmount(ReportInfo.GiftCreditAmount.ToString()), linelen, ValueLen)); aRep.Add(formatReportLine("netTotal", " $", formatAmount(ReportInfo.NetGiftAmount.ToString()), linelen, ValueLen)); aRep.Add(" "); } }
Receipt ITransactionService.FormatDailyReport(DailySalesInformation ReportInfo) { Receipt aRep = new Receipt(); // format the date & time line String TransactionDate = ReportInfo.When.ToShortDateString(); String TransactionTime = ReportInfo.When.ToShortTimeString(); aRep.JustifyBoth(TransactionDate, TransactionTime); // format the transaction type aRep.Add(""); aRep.AddCentered("Daily Sales Report");//Utils.getMappedMessage("Activate")); aRep.Add(" "); FormatSummarySection(aRep, ReportInfo); return(aRep); }