示例#1
0
文件: Ticket.cs 项目: njmube/PoS
 public void AddItem(string qty,string item, string price)
 {
     OrderItem newItem = new OrderItem('?');
     items.Add(newItem.GenerateItem(qty,item, price));
 }
示例#2
0
文件: Ticket.cs 项目: njmube/PoS
        private void DrawItems()
        {
            OrderItem ordIt = new OrderItem('?');

            gfx.DrawString("Qty  Description           Amount", printFont, myBrush, leftMargin, YPosition(), new StringFormat());

            count++;
            DrawBlank();

            foreach (string item in items)
            {
                line = ordIt.GetItemQty(item);

                gfx.DrawString(line, printFont, myBrush, leftMargin, YPosition(), new StringFormat());

                line = ordIt.GetItemPrice(item);
                line = AlignRightText(line.Length) + line;

                gfx.DrawString(line, printFont, myBrush, leftMargin, YPosition(), new StringFormat());

                string name = ordIt.GetItemName(item);

                leftMargin = 0;
                if (name.Length > maxCharDescription)
                {
                    int currentChar = 0;
                    int itemLenght = name.Length;

                    while (itemLenght > maxCharDescription)
                    {
                        line = ordIt.GetItemName(item);
                        gfx.DrawString("      " + line.Substring(currentChar, maxCharDescription), printFont, myBrush, leftMargin, YPosition(), new StringFormat());

                        count++;
                        currentChar += maxCharDescription;
                        itemLenght -= maxCharDescription;
                    }

                    line = ordIt.GetItemName(item);
                    gfx.DrawString("      " + line.Substring(currentChar, line.Length - currentChar), printFont, myBrush, leftMargin, YPosition(), new StringFormat());
                    count++;
                }
                else
                {
                    gfx.DrawString("      " + ordIt.GetItemName(item), printFont, myBrush, leftMargin, YPosition(), new StringFormat());

                    count++;
                }
            }

            leftMargin = 0;
            DrawBlank();
            line = DottedLine();

            gfx.DrawString(line, printFont, myBrush, leftMargin, YPosition(), new StringFormat());

            count++;
            DrawBlank();
        }