/// <summary> /// Prints end of day Z short receipt /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void PrintEndOfDaySalesReceipt(object sender, PrintPageEventArgs e) { Graphics graphic = e.Graphics; Font font = new Font("Courier New", 9, System.Drawing.FontStyle.Bold); Font storeNameFont = new Font("Courier New", 14, System.Drawing.FontStyle.Bold); Font storeInfoFont = new Font("Courier New", 8, System.Drawing.FontStyle.Bold); var buf = string.Empty; float fontHeight = font.GetHeight(); float storeNameFontHeight = storeNameFont.GetHeight(); float storeInfoFontHeight = storeInfoFont.GetHeight(); int startX = 5; int startY = 2; int offset = 10; int itemsNumber = 0; //Ticket header with business information buf = Formatter.AlignToCenter(Pos.BusinessName, 19); graphic.DrawString(buf, storeNameFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeNameFontHeight; buf = Formatter.AlignToCenter(Pos.FiscalName); graphic.DrawString(buf, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight; buf = Formatter.AlignToCenter(Pos.FiscalType + " " + Pos.FiscalNumber); graphic.DrawString(buf, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight; buf = Formatter.AlignToCenter(Pos.FiscalStreetAddress); graphic.DrawString(buf, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight; buf = Formatter.AlignToCenter(Pos.FiscalCityAndZipCode + " " + Pos.FiscalPhoneNumber); graphic.DrawString(buf, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight; buf = Formatter.AlignToCenter(Pos.FiscalEmail); graphic.DrawString(buf, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight + 10; //Receipt number and tickets number range graphic.DrawString("Corte Z " + "Folio " + EndOfDayReceiptData.FirstReceiptNumber.ToString() + " al " + EndOfDayReceiptData.LastReceiptNumber, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight + 10; Thread.CurrentThread.CurrentCulture = new CultureInfo("es-MX"); var date = DateTime.Now.ToString("g"); var ticketNumber = "No. " + Pos.LastCorteZNumber.ToString(); graphic.DrawString(ticketNumber.PadRight(18) + date, storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight + 10; //Gets each category information foreach (var catInfo in EndOfDayReceiptData.SalesInfoPerCategory) { //mimic a product just to use the ToString overwrite var cat = new ProductBase() { Category = catInfo.Item1, LastQuantitySold = catInfo.Item2, Price = catInfo.Item3 }; //product line if (cat.LastQuantitySold != 0 || cat.Price != 0) { graphic.DrawString(cat.ToString(ReceiptType.DailyRegular), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight; } } offset = offset + 10; graphic.DrawString("Articulos: ".PadLeft(20) + string.Format("{0}", EndOfDayReceiptData.TotalItemsSold), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight + 5; graphic.DrawString("Efectivo: ".PadLeft(20) + string.Format("{0:c}", EndOfDayReceiptData.CashTotal), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight + 5; graphic.DrawString("Tarjeta: ".PadLeft(20) + string.Format("{0:c}", EndOfDayReceiptData.CardTotal), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight + 5; graphic.DrawString("Otro Metodo: ".PadLeft(20) + string.Format("{0:c}", EndOfDayReceiptData.OtherTotal + EndOfDayReceiptData.BankTotal + EndOfDayReceiptData.BankTotal), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight + 5; graphic.DrawString("Total: ".PadLeft(20) + string.Format("{0:c}", EndOfDayReceiptData.TotalAmountSold), font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)fontHeight + 5; graphic.DrawString(string.Format(" Final Corte {0} {1}", EndOfDayAmountData.EndOfSalesReceiptType, date), storeInfoFont, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)storeInfoFontHeight; }