private void PrintKey(Guid guid, string keyName, int minutes, bool batch = true) { string strLine; string strDate = DateTime.Now.ToString("MMMM,dd,yyyy HH:mm", new DateTimeFormatInfo()); //Batch processing mode if (batch) { m_Printer.TransactionPrint(PrinterStation.Receipt, PrinterTransactionControl.Transaction); } string keyNametmp = keyName + (keyName == "KEY-START-TIMING" ? " MIN:" + minutes.ToString() : ""); strLine = MakePrintString(m_Printer.RecLineChars, keyNametmp, ""); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|bC" + "\u001b|2C" + "\u001b|cA" + strLine + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|cA" + strDate + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm strLine = MakePrintString(m_Printer.RecLineChars, "\u001b|cA" + "PLEASE KEEP THIS KEY SAFE!", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm if (m_Printer.CapRecBarCode == true) { //Barcode printing Ascii85 a85 = new Ascii85(); //m_Printer.PrintBarCode(PrinterStation.Receipt, "{B" + Convert.ToBase64String(guid.ToByteArray()).Replace("=", ""), BarCodeSymbology.Code128, 2000, m_Printer.PrintBarCode(PrinterStation.Receipt, "{B" + a85.Encode(guid.ToByteArray()), BarCodeSymbology.Code128, 2000, m_Printer.RecLineWidth, PosPrinter.PrinterBarCodeCenter, BarCodeTextPosition.None); } m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|fP"); //print all the buffer data. and exit the batch processing mode. if (batch) { m_Printer.TransactionPrint(PrinterStation.Receipt, PrinterTransactionControl.Normal); } }
public bool PrintTicket(Guid guid, int minutes, string cusName, string bookingRef, bool batch = true) { try { string strLine; string strDate = DateTime.Now.ToString("MMMM,dd,yyyy HH:mm", new DateTimeFormatInfo()); //Batch processing mode if (batch) { m_Printer.TransactionPrint(PrinterStation.Receipt, PrinterTransactionControl.Transaction); } strLine = MakePrintString(m_Printer.RecLineChars, " Welcome to VR Arcade", ""); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|bC" + "\u001b|2C" + strLine + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|cA" + strDate + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm strLine = MakePrintString(m_Printer.RecLineChars, "Please take this ticket to one of the booth that", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); strLine = MakePrintString(m_Printer.RecLineChars, "shows \"Ready\" on the screen and scan to activate", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); strLine = MakePrintString(m_Printer.RecLineChars, "your session. Thank you!", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm if (cusName.Length > 0) { strLine = MakePrintString(m_Printer.RecLineChars, "Customer Name: " + cusName, ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); } strLine = MakePrintString(m_Printer.RecLineChars, "Session Time: " + (minutes > 0 ? minutes.ToString() : "Unlimited") + " Minutes", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); if (bookingRef.Length > 0) { strLine = MakePrintString(m_Printer.RecLineChars, "Booking Reference: " + bookingRef, ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); } m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm if (m_Printer.CapRecBarCode == true) { //Barcode printing Ascii85 a85 = new Ascii85(); //m_Printer.PrintBarCode(PrinterStation.Receipt, "{B" + Convert.ToBase64String(guid.ToByteArray()).Replace("=", ""), BarCodeSymbology.Code128, 3000, m_Printer.PrintBarCode(PrinterStation.Receipt, "{B" + a85.Encode(guid.ToByteArray()), BarCodeSymbology.Code128, 3000, m_Printer.RecLineWidth, PosPrinter.PrinterBarCodeCenter, BarCodeTextPosition.None); } m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm strLine = MakePrintString(m_Printer.RecLineChars, "Note: This ticket effective within 20 minutes", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); strLine = MakePrintString(m_Printer.RecLineChars, "of issuring and can only activate one booth. If", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); strLine = MakePrintString(m_Printer.RecLineChars, "you encounter any difficulty please let our", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); strLine = MakePrintString(m_Printer.RecLineChars, "staff know.", ""); m_Printer.PrintNormal(PrinterStation.Receipt, strLine + "\n"); m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|200uF"); // 2mm m_Printer.PrintNormal(PrinterStation.Receipt, "\u001b|fP"); //print all the buffer data. and exit the batch processing mode. if (batch) { m_Printer.TransactionPrint(PrinterStation.Receipt, PrinterTransactionControl.Normal); } return(true); } catch (PosControlException) { return(false); } }