Esempio n. 1
0
        private void PrintOrderForKitchens(string order_id, string job_id, string title = "New Order")
        {
            NewOrderReport report = new NewOrderReport();

            try
            {
                report.DataDefinition.FormulaFields["ReportTitle"].Text = "'" + title + "'";


                foreach (DataRow r in kitchen_printers_dt.Rows)
                {
                    NewOrderDataSet ds = generateNewOrderDataSet(order_id, r["Category"].ToString());

                    if (ds.OrderDetail.Rows.Count > 0)
                    {
                        report.SetDataSource(ds);
                        report.PrintOptions.PrinterName = r["Printer"].ToString();
                        report.PrintToPrinter(1, false, 0, 0);
                    }
                }

                MySqlFunctions.SqlNonQuery("update print_jobs set executed_at = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' " +
                                           "where id = '" + job_id + "'", Program.GlobalConn);
            }
            catch (Exception ex)
            {
                MySqlFunctions.SqlNonQuery("update print_jobs set executed_at = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "', " +
                                           " error = '" + MySql.Data.MySqlClient.MySqlHelper.EscapeString(ex.Message) + "' " +
                                           "where id = '" + job_id + "'", Program.GlobalConn);
            }
            finally
            {
                report.Dispose();
            }
        }
Esempio n. 2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            NewOrderReport rpt = new NewOrderReport();

            rpt.Site = this.Site;
            return(rpt);
        }