private void PrintOR(int queueID) { System.Threading.Thread.Sleep(2000); // Check if able to print Printer = tmpMaintenance.GetValue("PrinterReciept"); IsPrint = tmpMaintenance.GetValue("IsRecieptPrint"); if (!canPrint(Printer)) { return; } string mysql = "SELECT * FROM customer_order WHERE QUEUEID = " + queueID + " and QIStatus =1"; DataSet ds = null; string fillData = "TBLQUEUE"; ds = Database.LoadSQL(mysql, fillData); string OrderNum = String.Format("ORDER # 0000{0}", ds.Tables[0].Rows[0]["ORDERNUM"].ToString()); DateTime DocDate = Convert.ToDateTime(System.DateTime.Now); // Declare AutoPrint Reporting autoPrint = null; LocalReport report = new LocalReport(); autoPrint = new Reporting(); // Initialize Auto Print report.ReportPath = @"Report\rptReciept.rdlc"; report.DataSources.Add(new ReportDataSource(fillData, ds.Tables[fillData])); // Assign Parameters Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("txtUsername", mod_system.ORuser.Username); // Importer Parameters if ((dic != null)) { foreach (KeyValuePair <string, string> param in dic) { var nPara = param; ReportParameter tmpPara = new ReportParameter(); tmpPara.Name = nPara.Key; tmpPara.Values.Add(nPara.Value); report.SetParameters(new ReportParameter[] { tmpPara }); Console.WriteLine(string.Format("{0}: {1}", nPara.Key, nPara.Value)); } } if (IsPrint == "YES") { frmReport frm = new frmReport(); frm.ReportInit(mysql, "dsORPRINT", @"Report\rptReciept.rdlc", dic); frm.Show(); } else { // Executing Auto Print autoPrint.Export(report); autoPrint.m_currentPageIndex = 0; autoPrint.Print(Printer); } }