예제 #1
0
        /// <summary>
        /// Print various reports
        /// </summary>
        /// <param name="type">Report to print</param>
        /// <param name="options">Options in JSON string format</param>
        /// <param name="options.baxiArgs">TransferAmount arguments in JSON string format</param>
        /// <returns>JSON payload sent to the terminal</returns>
        public string PrintReport(string type, string options = "{}")
        {
            var opts = JsonConvert.DeserializeObject <OperationOptions>(options);
            Operation <AdministrationArgs> op = null;

            switch (type.ToUpper())
            {
            case "Z":
                op = new ZReport(baxiArgs: opts.baxiArgs);
                break;

            case "X":
                op = new XReport(baxiArgs: opts.baxiArgs);
                break;

            case "EOT":
                op = new EOTReport(baxiArgs: opts.baxiArgs);
                break;

            case "LATEST":
            case "TRANSACTION":
            case "LATESTTRANSACTION":
                op = new LatestTransactionReport(baxiArgs: opts.baxiArgs);
                break;

            default:
                throw new NotImplementedException(string.Format("Report of type {0} is not supported.", type));
            }

            Debug.WriteLine("Generating report of type {0}...", type);
            terminalCtrl.SendAdminOperation(op);
            return(JsonConvert.SerializeObject(op.Args));
        }
        internal void CloseDay()
        {
            ZReport report = new ZReport()
            {
                Employee          = XReport.Employee = UnitOfWork.get().Employees.Get(1),
                Orders            = XReport.Orders,
                reportDate        = DateTime.Now,
                reprotTotalAmount = decimal.Parse(XReport.TotalAmountForReport.ToString())
            };

            XReport.ZReport = report;
            UnitOfWork.get().Context.ZReports.Add(report);
            this.XReport.Orders.Select(o => { o.IsCloseInZ = true; return(o); }).ToList();
            UnitOfWork.get().Complete();
            PrinterAdapter.Instance.PrintZReport(XReport);
        }