Exemplo n.º 1
0
        private void btn_print_Click(object sender, EventArgs e)
        {
            DialogResult result      = MessageBox.Show("Do you want to print these order?", "Confirmation", MessageBoxButtons.YesNo);
            Print        print       = new Print();
            String       nowTime     = DateTime.Now.ToString("HH-mm-ss");
            String       nowTime2    = nowTime.Substring(0, 2) + ":" + nowTime.Substring(3, 2) + ":" + nowTime.Substring(6, 2);
            DateTime     today       = DateTime.Today;
            String       todayString = today.ToString("dd-MM-yyyy");

            if (result == DialogResult.Yes)
            {
                for (int i = 0; i < labelList.Count; i++)
                {
                    String counter = "(" + (i + 1) + "/" + labelList.Count.ToString() + ")";
                    Label  lb      = labelList[i];
                    String s       = "Asia Pacific";
                    s += "\r" + lb.Text;
                    s += "\r" + nowTime2;
                    s += "\r" + counter;
                    String[] OrderNo = (String[])lb.Tag;
                    String[] context = s.Split('\r');
                    if (!Directory.Exists(@"C:\\My Documents\\" + todayString + "\\"))
                    {
                        DirectoryInfo di = Directory.CreateDirectory(@"C:\\My Documents\\" + todayString + "\\");
                    }
                    String path = @"C:\\My Documents\\" + todayString + "\\" + context[1] + "_" + nowTime + "_(" + (i + 1) + "@" + labelList.Count.ToString() + ").txt";
                    System.IO.File.WriteAllLines(path, context);
                    String filename = (context[1] + "_" + nowTime + "_(" + (i + 1) + "@" + labelList.Count.ToString() + ").txt");
                    print.print(filename);
                    db.update(context[1], nowTime2);
                    for (int j = 0; j < FLP1.Controls.Count; j++)
                    {
                        Label Clb = (Label)FLP1.Controls[j];
                        if (Clb.Name.Equals(lb.Name))
                        {
                            FLP1.Controls.RemoveAt(j);
                        }
                    }
                }
                labelList.Clear();
                orderView();
                MessageBox.Show("Printed");
            }
            else if (result == DialogResult.No)
            {
                MessageBox.Show("Printing is Canelled");
            }
        }
Exemplo n.º 2
0
        private void btn_print_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to print these order?", "Confirmation", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                foreach (ListViewItem lv in lv_listFile.CheckedItems)
                {
                    StringBuilder newFile = new StringBuilder();
                    string[]      file    = File.ReadAllLines(@"C:\\My Documents\\" + todayString + "\\" + lv.Tag);
                    file[0] = "Asia Pacific-Reprint";
                    String path = @"C:\\My Documents\\" + todayString + "\\" + lv.Tag;
                    System.IO.File.WriteAllLines(path, file);
                    Print print = new Print();
                    print.print(lv.Tag.ToString());
                }
                MessageBox.Show("Printed");
            }
            else if (result == DialogResult.No)
            {
                MessageBox.Show("Print is Canelled");
            }
        }
Exemplo n.º 3
0
        private void PrintGrpMessage_click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to print these time group order?", "Confirmation", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Print  print = new Print();
                Label  lb    = (Label)sender;
                String s     = "Asia Pacific";
                s += "\r" + lb.Text;
                String[] context = s.Split('\r');
                if (!Directory.Exists(@"C:\\My Documents\\" + todayString + "\\"))
                {
                    DirectoryInfo di = Directory.CreateDirectory(@"C:\\My Documents\\" + todayString + "\\");
                }
                String path = @"C:\\My Documents\\" + todayString + "\\O99999999_99-99-99_(1@1).txt";
                System.IO.File.WriteAllLines(path, context);
                print.print("O99999999_99-99-99_(1@1).txt");
            }
            else
            {
                MessageBox.Show("Printing is Canelled");
            }
        }
Exemplo n.º 4
0
        private void btn_pgop_Click(object sender, EventArgs e)
        {
            Print             print = new Print();
            List <CheckBoxEx> lcb   = new List <CheckBoxEx>();
            List <CheckBoxEx> tcb   = new List <CheckBoxEx>();

            for (int i = 0; i < time.Length; i++)
            {
                CheckBoxEx cb = time[i];
                if (cb.Checked == true)
                {
                    lcb.Add(cb);
                }
            }
            for (int i = 0; i < typelist.Length; i++)
            {
                CheckBoxEx cb = typelist[i];
                if (cb.Checked == true)
                {
                    tcb.Add(cb);
                }
            }
            if (lcb.Count == 1)
            {
                String cmdText = "";
                if (lcb.Count > 0)
                {
                    cmdText  = "select f.shortName,o.oTakeTime ,COUNT(*) AS COUNT FROM orders O, orderFood OF, food F WHERE O.orderDate=OF.orderDate AND O.orderId=OF.orderId AND OF.foodId=F.foodId  and o.status = 'processing'";
                    cmdText += "AND O.oTakeTime in(";
                    for (int i = 0; i < lcb.Count; i++)
                    {
                        if (i != 0)
                        {
                            cmdText += ",";
                        }
                        cmdText += "'" + lcb[i].Text + ":00'";
                    }
                    cmdText += ")";
                }
                if (tcb.Count > 0)
                {
                    cmdText += "AND F.fTypeId IN (";
                    for (int i = 0; i < tcb.Count; i++)
                    {
                        if (i != 0)
                        {
                            cmdText += ",";
                        }
                        cmdText += "'" + tcb[i].Tag + "'";
                    }
                    cmdText += ")";
                }
                cmdText += "GROUP BY f.foodId";
                DataTable dt = db.printGrp(cmdText);
                String    s  = "Asia Pacific";

                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    s += "\r" + dt.Rows[j]["shortname"] + "-Qty:" + dt.Rows[j]["count"];
                }
                s += "\rTake Time:" + dt.Rows[0]["otaketime"];
                String[] context = s.Split('\r');
                if (!Directory.Exists(@"C:\\My Documents\\" + todayString + "\\"))
                {
                    DirectoryInfo di = Directory.CreateDirectory(@"C:\\My Documents\\" + todayString + "\\");
                }
                String path = @"C:\\My Documents\\" + todayString + "\\O99999999_99-99-99_(1@1).txt";
                System.IO.File.WriteAllLines(path, context);
                print.print("O99999999_99-99-99_(1@1).txt");
            }
            else
            {
                MessageBox.Show("Please choose one time only.");
            }
        }
Exemplo n.º 5
0
        private void PrintMessage_click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to print these time group order?", "Confirmation", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Print             print    = new Print();
                String            nowTime  = DateTime.Now.ToString("HH-mm-ss");
                String            nowTime2 = nowTime.Substring(0, 2) + ":" + nowTime.Substring(3, 2) + ":" + nowTime.Substring(6, 2);
                List <CheckBoxEx> lcb      = new List <CheckBoxEx>();
                List <CheckBoxEx> tcb      = new List <CheckBoxEx>();
                int printcount             = 0;
                for (int i = 0; i < time.Length; i++)
                {
                    CheckBoxEx cb = time[i];
                    if (cb.Checked == true)
                    {
                        lcb.Add(cb);
                    }
                }
                for (int i = 0; i < typelist.Length; i++)
                {
                    CheckBoxEx cb = typelist[i];
                    if (cb.Checked == true)
                    {
                        tcb.Add(cb);
                    }
                }
                if (lcb.Count > 0)
                {
                    String cmdText = "";
                    if (lcb.Count > 0)
                    {
                        cmdText  = "select * FROM orders O, orderFood OF, food F WHERE O.orderDate=OF.orderDate AND O.orderId=OF.orderId AND OF.foodId=F.foodId  and o.status = 'processing'";
                        cmdText += "AND O.oTakeTime in(";
                        for (int i = 0; i < lcb.Count; i++)
                        {
                            if (i != 0)
                            {
                                cmdText += ",";
                            }
                            cmdText += "'" + lcb[i].Text + ":00'";
                        }
                        cmdText += ")";
                    }
                    if (tcb.Count > 0)
                    {
                        cmdText += "AND F.fTypeId IN (";
                        for (int i = 0; i < tcb.Count; i++)
                        {
                            if (i != 0)
                            {
                                cmdText += ",";
                            }
                            cmdText += "'" + tcb[i].Tag + "'";
                        }
                        cmdText += ")";
                    }
                    cmdText += "GROUP BY o.orderid";
                    DataTable dt = db.printGrp(cmdText);
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        printcount++;
                        String counter = "(" + printcount + "/" + dt.Rows.Count + ")";
                        String s       = "Asia Pacific";
                        s += "\r" + dt.Rows[j]["orderid"];
                        DataTable orderDt = db.getDb2(dt.Rows[j]["orderid"].ToString());
                        for (int k = 0; k < orderDt.Rows.Count; k++)
                        {
                            s += "\r" + orderDt.Rows[k]["shortname"];
                        }
                        s += "\rTake Time:" + dt.Rows[j]["otaketime"]; //get order string end
                        s += "\r" + nowTime2;
                        s += "\r" + counter;

                        String[] context = s.Split('\r');
                        if (!Directory.Exists(@"C:\\My Documents\\" + todayString + "\\"))
                        {
                            DirectoryInfo di = Directory.CreateDirectory(@"C:\\My Documents\\" + todayString + "\\");
                        }
                        String path = @"C:\\My Documents\\" + todayString + "\\" + context[1] + "_" + nowTime + "_(" + printcount + "@" + dt.Rows.Count + ").txt";
                        System.IO.File.WriteAllLines(path, context);
                        String filename = (context[1] + "_" + nowTime + "_(" + printcount + "@" + dt.Rows.Count + ").txt");
                        print.print(filename);
                        db.update(context[1], nowTime2);
                    }
                }
                if (lcb.Count == 0)
                {
                    MessageBox.Show("Plesae choose time first!");
                }
            }
            else
            {
                MessageBox.Show("Printing is Canelled");
            }
        }