public bool PrintOrderSlipFooter(OrderSlipPrinter orderSlipPrinter) { // no need if it's a non-applicable if (orderSlipPrinter == RetailPlus.OrderSlipPrinter.NotApplicable) return false; bool boSuccess = false; SendOrderSlipToPrinter("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine, orderSlipPrinter); SendOrderSlipToPrinter("Served by: " + mclsSalesTransactionDetails.WaiterName + Environment.NewLine, orderSlipPrinter); SendOrderSlipToPrinter("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine, orderSlipPrinter); // print page footer spacer for (int i = 0; i < 6; i++) { SendOrderSlipToPrinter(Environment.NewLine, orderSlipPrinter); } switch (orderSlipPrinter) { case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter1: mclsFPRetailPlusOSPrinter1.Write(msbToPrintFP1); boSuccess = RawPrinterHelper.SendFileToPrinter(orderSlipPrinter.ToString("G"), mclsFPRetailPlusOSPrinter1.FileName, "RetailPlus " + mclsFPRetailPlusOSPrinter1.FileName); //mclsFPRetailPlusOSPrinter1.DeleteFile(); break; case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter2: mclsFPRetailPlusOSPrinter2.Write(msbToPrintFP2); boSuccess = RawPrinterHelper.SendFileToPrinter(orderSlipPrinter.ToString("G"), mclsFPRetailPlusOSPrinter2.FileName, "RetailPlus " + mclsFPRetailPlusOSPrinter2.FileName); //mclsFPRetailPlusOSPrinter2.DeleteFile(); break; case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter3: mclsFPRetailPlusOSPrinter3.Write(msbToPrintFP3); boSuccess = RawPrinterHelper.SendFileToPrinter(orderSlipPrinter.ToString("G"), mclsFPRetailPlusOSPrinter3.FileName, "RetailPlus " + mclsFPRetailPlusOSPrinter3.FileName); //mclsFPRetailPlusOSPrinter3.DeleteFile(); break; case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter4: mclsFPRetailPlusOSPrinter4.Write(msbToPrintFP4); boSuccess = RawPrinterHelper.SendFileToPrinter(orderSlipPrinter.ToString("G"), mclsFPRetailPlusOSPrinter4.FileName, "RetailPlus " + mclsFPRetailPlusOSPrinter4.FileName); //mclsFPRetailPlusOSPrinter4.DeleteFile(); break; case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter5: mclsFPRetailPlusOSPrinter5.Write(msbToPrintFP5); boSuccess = RawPrinterHelper.SendFileToPrinter(orderSlipPrinter.ToString("G"), mclsFPRetailPlusOSPrinter2.FileName, "RetailPlus " + mclsFPRetailPlusOSPrinter5.FileName); //mclsFPRetailPlusOSPrinter5.DeleteFile(); break; } if (mclsTerminalDetails.IsPrinterAutoCutter) CutPrinterPaper(orderSlipPrinter.ToString("G")); return boSuccess; }
public void PrintPLUReportPerOrderSlipPrinter(System.Data.DataTable dtPLUReport, Data.CashierReportDetails clsCashierReportDetails, DateTime StartDate, DateTime EndDate, OrderSlipPrinter blockOrderSlipPrinter) { Cursor.Current = Cursors.WaitCursor; try { PrintingPreference oldCONFIG_AutoPrint = mclsTerminalDetails.AutoPrint; mclsTerminalDetails.AutoPrint = PrintingPreference.Normal; PrintReportHeadersSection(false); decimal TotalQuantity = 0; decimal TotalAmount = 0; msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine); msbToPrint.Append(CenterString("PLU REPORT", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine); msbToPrint.Append(CenterString(blockOrderSlipPrinter.ToString("G"), mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine); msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine); msbToPrint.Append(CenterString("Start Date: " + StartDate.ToString("MM/dd/yyyy hh:mm:ss tt"), mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine); msbToPrint.Append(CenterString("End Date : " + EndDate.ToString("MM/dd/yyyy hh:mm:ss tt"), mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine + Environment.NewLine); msbToPrint.Append("Item Quantity Amount" + Environment.NewLine); msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine); foreach (System.Data.DataRow dr in dtPLUReport.Rows) { OrderSlipPrinter enumOrderSlipPrinter = (OrderSlipPrinter)Enum.Parse(typeof(OrderSlipPrinter), dr["OrderSlipPrinter"].ToString()); if (blockOrderSlipPrinter == enumOrderSlipPrinter) { string stProductCode = dr["ProductCode"].ToString(); string stQuantity = Convert.ToDecimal(dr["Quantity"].ToString()).ToString("#,##0.#0"); string stAmount = Convert.ToDecimal(dr["Amount"].ToString()).ToString("#,##0.#0"); if (stProductCode.Length <= 11) { msbToPrint.Append(stProductCode.PadRight(11)); msbToPrint.Append(stQuantity.PadLeft(12)); msbToPrint.Append(stAmount.PadLeft(17)); msbToPrint.Append(Environment.NewLine); } else { msbToPrint.Append(stProductCode + Environment.NewLine); msbToPrint.Append(stQuantity.PadLeft(23)); msbToPrint.Append(stAmount.PadLeft(17)); msbToPrint.Append(Environment.NewLine); } TotalQuantity += Convert.ToDecimal(dr["Quantity"]); TotalAmount += Convert.ToDecimal(dr["Amount"]); } } msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine); msbToPrint.Append("Total:".PadRight(6)); msbToPrint.Append(TotalQuantity.ToString("#,##0.#0").PadLeft(17)); msbToPrint.Append(TotalAmount.ToString("#,##0.#0").PadLeft(17)); msbToPrint.Append(Environment.NewLine); msbToPrint.Append("Grand Total :".PadRight(16)); msbToPrint.Append(TotalAmount.ToString("#,##0.#0").PadLeft(24)); msbToPrint.Append(Environment.NewLine); msbToPrint.Append("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine); PrintPageAndReportFooterSection(false, DateTime.MinValue); mclsTerminalDetails.AutoPrint = oldCONFIG_AutoPrint; InsertAuditLog(AccessTypes.PrintPLUReport, "Print PLU report per OrderSlipprinter: " + blockOrderSlipPrinter.ToString("G") + " TerminalNo=" + mclsTerminalDetails.TerminalNo + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Printing PLU report. Err Description: "); } Cursor.Current = Cursors.Default; }
public void ShowOrderSlipPrinterError(OrderSlipPrinter OrderSlipPrinter, bool isFromSuspendTransaction, bool PrinterOffline = false) { if (PrinterOffline) { if (isFromSuspendTransaction) MessageBox.Show("Printer is Offline: Error sending items to kitchen while suspending the transaction!!! Please double check the OrderSlipPrinter #" + (Int32.Parse(OrderSlipPrinter.ToString("d")) + 1).ToString() + " then RESEND this order for printing.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); else MessageBox.Show("Printer is Offline: Error sending items to kitchen!!! Please double check the OrderSlipPrinter #" + (Int32.Parse(OrderSlipPrinter.ToString("d")) + 1).ToString() + " then RESEND this order for printing.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } else { if (isFromSuspendTransaction) MessageBox.Show("Error sending items to kitchen while suspending the transaction!!! Please double check the OrderSlipPrinter #" + (Int32.Parse(OrderSlipPrinter.ToString("d")) + 1).ToString() + " then RESEND this order for printing.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); else MessageBox.Show("Error sending items to kitchen!!! Please double check the OrderSlipPrinter #" + (Int32.Parse(OrderSlipPrinter.ToString("d")) + 1).ToString() + " then RESEND this order for printing.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }