Exemple #1
0
        private void SendToKitchen()
        {
            if (myCash1.listInvoiceItem.Rows.Count > 0)
            {
                bool kt = false;
                foreach (Printer c in serviceGet.getPrinters(StaticClass.storeId, StaticClass.stationId))
                {
                    kt = false;
                    if (!c.Disable)
                    {
                        foreach (MyItem c1 in myCash1.get_All_Rows())
                        {
                            if (!(c1.Mota.StartsWith(">")))
                            {
                                DataTable inventPrinter = getGui.GetInventPrinter(StaticClass.storeId, myCash1.listInvoiceItem.Rows[c1.Id - 1]["ItemNum"].ToString(), c.PrinterName);
                                if (inventPrinter.Rows.Count > 0)
                                {
                                    string lineNum  = myCash1.listInvoiceItem.Rows[c1.Id - 1]["LineNum"].ToString();
                                    string itemNum  = myCash1.listInvoiceItem.Rows[c1.Id - 1]["ItemNum"].ToString();
                                    string quan     = myCash1.listInvoiceItem.Rows[c1.Id - 1]["Quantity"].ToString();
                                    string note     = myCash1.listInvoiceItem.Rows[c1.Id - 1]["Kit_ItemNum"].ToString();
                                    string itemname = myCash1.listInvoiceItem.Rows[c1.Id - 1]["DiffItemName"].ToString();
                                    getGui.InsertItemsToPrintToKit(StaticClass.storeId, invoiceNum, lineNum, itemNum, quan, note, itemname);
                                    kt = true;
                                }
                            }
                        }
                        if (kt)
                        {
                            rpt_PrintToKit xxx = new rpt_PrintToKit();

                            xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                            string[] para  = { "@Store_ID", "@Invoice_Number", "@Table" };
                            string[] value = { StaticClass.storeId, invoiceNum, tableName };
                            serviceGet.FillDataReport(xxx, para, value, true);

                            xxx.PrintOptions.PrinterName = c.Details;
                            xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
                            xxx.PrintToPrinter(1, false, 0, 0);
                            getGui.DeleteItemsPrintToKit(StaticClass.storeId, invoiceNum);
                        }
                    }
                }
            }
        }