예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZReport"/> class.
        /// </summary>
        /// <param name="lastZReport">The last Z report.</param>
        public ZReport(ZReport lastZReport)
            : this(0m)
        {
            if (lastZReport != null)
            {
                if (lastZReport.IsClosed)
                {
                    OpeningGrandTotal = lastZReport.ClosingGrandTotal;
                    OpenDateTime      = lastZReport.ClosingDateTime;
                }
                else
                {   // Just copy lastZReport into this
                    OpeningGrandTotal = lastZReport.OpeningGrandTotal;
                    OpenDateTime      = lastZReport.OpenDateTime;
                    foreach (string taxId in lastZReport._collectedTaxes.Keys)
                    {
                        _collectedTaxes.Add(taxId, lastZReport._collectedTaxes[taxId]);
                    }

                    foreach (string tender in lastZReport._tenders.Keys)
                    {
                        _tenders.Add(tender, lastZReport._tenders[tender]);
                    }
                }
            }
        }
        /// <summary>
        /// Closes and Prints the Z report.
        /// </summary>
        public void PrintZReport()
        {
            _activeZReport.Close(_grandTotal);
            richTextBox1.AppendText(_activeZReport.GetReport());
            richTextBox1.ScrollToCaret();

            _lastZReport   = _activeZReport;
            _activeZReport = new ZReport(_lastZReport);
        }
        protected override void OnLoad(EventArgs e)
        {
            if (!this.DesignMode)
            {
                // Default initialization
                _receiptNumber = 1;
                _serialNumber  = "111-222-333";
                _lastZReport   = new ZReport();
                _activeZReport = new ZReport(_lastZReport);

                _taxRates = new List <TaxInfo>();
                _taxRates.Add(new TaxInfo("TA", 12.00m));
                _taxRates.Add(new TaxInfo("TB", 5.00m));
                _taxRates.Add(new TaxInfo("TC", 5.00m));
                _taxRates.Add(new TaxInfo("TD", 10.00m));

                this.taxGridView1.DataSource = _taxRates;

                UpdateUserInterfaceValues();
            }

            // For the OnLoad override, call base last to ensure proper DPI scale.
            base.OnLoad(e);
        }