public TouchPrintEngine()
        {
            // create the header...
            Header = new TouchPrintElement(null);
            Header.AddTitle("云南人才市场");
            //Header.AddText("Page: [pagenum]");
            Header.AddHorizontalRule();
            //Header.AddBlankLine();

            // create the footer...
//			Footer = new PrintElement(null);
//			Footer.AddBlankLine();
//			Footer.AddHorizontalRule();
            //Footer.AddText("Confidential");
        }
        // OnPrintPage - called when printing needs to be done...
        protected override void OnPrintPage(PrintPageEventArgs e)
        {
            float headerHeight = Header.CalculateHeight(this, e.Graphics);

            Header.Draw(this, 10, e.Graphics, e.MarginBounds);
            Rectangle pageBounds = new Rectangle(15,
                                                 (int)(e.MarginBounds.Top + headerHeight), e.MarginBounds.Width,
                                                 (int)(e.MarginBounds.Height - headerHeight));
            float yPos = 50;//pageBounds.Top;
            // ok, now we need to loop through the elements...
            //bool morePages = false;
            int elementsOnPage = 0;

            while (_printIndex < _printElements.Count)
            {
                // get the element...
                TouchPrintElement element = (TouchPrintElement)_printElements[_printIndex];
                // how tall is the primitive?
                float height = element.CalculateHeight(this, e.Graphics);

                // will it fit on the page?
//				if(yPos + height > pageBounds.Bottom)
//				{
//					// we don't want to do this if we're the first thing on the page...
//					if(elementsOnPage != 0)
//					{
//						morePages = true;
//						break;
//					}
//				}
                // now draw the element...
                element.Draw(this, yPos, e.Graphics, pageBounds);

                // move the ypos...
                yPos += height;

                // next...
                _printIndex++;
                elementsOnPage++;
            }

            // do we have more pages?
            //e.HasMorePages = morePages;
        }
        // OnBeginPrint - called when printing starts
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            // reset...
            _printElements = new ArrayList();
            _pageNum       = 0;
            _printIndex    = 0;

            // go through the objects in the list and create print elements for each one...
            foreach (ITouchPrintable printObject in _printObjects)
            {
                // create an element...
                TouchPrintElement element = new TouchPrintElement(printObject);
                _printElements.Add(element);

                // tell it to print...
                //element.Print();
                printObject.Print(element);
            }
        }
Пример #4
0
        // Print...
        public void Print(TouchPrintElement element)
        {
            //element.AddHeader(cnvcBillType);
            element.AddSeat(cnvcBillType);
            if (cnvcJobInfo.Trim().Length > 0)
            {
                element.AddInfo(cnvcJobInfo);
                element.AddInfo("服务台签到有效");
            }
            element.AddHorizontalRule();

            element.AddData("会员卡号", cnvcMemberCardNo);
            element.AddData("原卡号", cnvcOldMemberCardNo);
            element.AddData("会员密码", cnvcMemberPwd);
            element.AddData("单位名称", cnvcMemberName);
            element.AddData("工商注册号", cnvcPaperNo);
            element.AddData("会员资格", cnvcMemberRight);
            //产品多条分开显示,逗号分隔各项,|竖线分割各个产品
            if (cnvcProduct.Trim().Length > 0)
            {
                string[] strProducts = cnvcProduct.Split('|');
                element.AddHeader("服务产品");
                foreach (string strProduct in strProducts)
                {
                    if (strProduct.Trim().Length > 0)
                    {
                        string[] strItems = strProduct.Split(',');
                        element.AddData("    名称", strItems[0]);
                        element.AddData("    单价", strItems[1]);
                        //element.AddData("    折扣",strItems[2]);
                        element.AddData("    实收", strItems[3]);
                        element.AddData("    场次", strItems[4]);
                        element.AddData("    剩余场次", strItems[5]);
                        //strItems[3].
                    }
                }
                element.AddHorizontalRule();
            }
            else
            {
                element.AddHorizontalRule();
            }
            if (cnvcBillType == ConstApp.Bill_Type_Provide)
            {
                element.AddData("单位名称", cnvcMemberName);
            }
            element.AddData("会员费", cnnMemberFee.ToString("F2"));
            //element.AddData("折扣",cnvcDiscount);
            //element.AddData("实收",cnnPrepay.ToString("F2"));
            element.AddData("上次余额", cnnLastBalance.ToString("F2"));
            element.AddData("金额", cnnPrepay.ToString("F2"));
            element.AddData("赠送金额", cnnDonate.ToString("F2"));
            element.AddData("当前余额", cnnBalance.ToString("F2"));

            element.AddData("场次", cnvcFree);

            element.AddData("展厅", cnvcShow);
            element.AddSeatData("展位", cnvcSeat);
            element.AddData("剩余场次", cnvcFreeLast);

            //element.AddData("操作员",cnvcOperName);
            element.AddData("到期日期", cndEndDate);
            element.AddData("同步标志", cnvcSynch);
            element.AddData("操作时间", cndOperDate.ToString("yyyy-MM-dd hh:mm"));
//			if (cnvcJobInfo != "")
//			{
//				element.AddText(cnvcJobInfo);
//			}

            if (cnvcBillType == ConstApp.Bill_Type_SignIn)
            {
                element.AddBlack("请到四号窗口领取参会资料");
            }
            //element.AddBlankLine();
        }