Esempio n. 1
0
        public void RenderRedeemReceipt(Backend.Objects.RedeemReceipt redeem)
        {
            var          store        = redeem.Store;
            var          customer     = redeem.Customer;
            var          user         = redeem.User;
            PageSettings pageSettings = new PageSettings();

            pageSettings.Margins.Top    = 0;
            pageSettings.Margins.Bottom = 0;
            pageSettings.Margins.Left   = 0;
            pageSettings.Margins.Right  = 0;

            double defaultHeight = 117; //mm
            // height -> hundreth inch
            int height = (int)Math.Round(defaultHeight * (0.0393701) * 100, 1);

            pageSettings.PaperSize = new PaperSize("Custom", 190, height);

            var postCodeCity    = string.Format("{0} {1}", store.PostCode, store.City);
            var firstName       = user.FirstName.FirstOrDefault().ToString().ToUpper();
            var userDisplayName = string.Format("{0}. {1}", firstName, user.LastName);
            var message         = Properties.Settings.Default.ReceiptFooterMessage;
            var customerText    = customer is object && customer.Id != "" ? $"KUNDE : {customer.FirstName } {customer.LastName } " : "KUNDE : Nicht Eingetragen ";

            ReportParameter[] parameters = new ReportParameter[]
            {
                // Header
                new ReportParameter("StoreName", store.Name),
                new ReportParameter("Address", store.Address),
                new ReportParameter("PostCodeCity", postCodeCity),
                new ReportParameter("PhoneNumber", store.PhoneNumber),

                new ReportParameter("CustomerId", customer.Id),
                new ReportParameter("DateTime", DateTime.Now.ToString()),

                new ReportParameter("RedeemedAmount", StringUtil.ToRoundedString(redeem.RedeemedAmount)),
                new ReportParameter("AccountBalance", StringUtil.ToRoundedString(redeem.AccountBalance)),

                new ReportParameter("Currency", store.CurrencySign),
                new ReportParameter("UserDisplayName", userDisplayName),
                new ReportParameter("Customer", customerText),
            };


            try
            {
                this.reedemReceiptViewer.SetPageSettings(pageSettings);
                this.reedemReceiptViewer.LocalReport.SetParameters(parameters);
                this.reedemReceiptViewer.RefreshReport();
            }
            catch
            {
                Alert.Show("Error Printing", "A Fatal Error occured while rendring Receipt", Alert.AlertType.Error, isMini: false);
            }
        }
Esempio n. 2
0
        void PrintReceipt(decimal redeemedAmount, decimal accountBalance)
        {
            Backend.Objects.RedeemReceipt redeemReceipt = new Backend.Objects.RedeemReceipt
            {
                Store          = Util.Data.GetStore(),
                User           = Util.Data.GetUser(),
                Customer       = Customer,
                RedeemedAmount = redeemedAmount,
                AccountBalance = accountBalance,
            };

            Printing printing = new Printing
            {
                TopMost          = true,
                RedeemReceipt    = redeemReceipt,
                ReportViewerType = Printing.PintingItems.RedeemReceipt,
            };

            printing.ShowDialog();
        }