Exemplo n.º 1
0
 private void checkType()
 {
     typeList = new List <string>();
     foreach (Control c in gb_foobType.Controls)
     {
         CheckBoxEx cb = (CheckBoxEx)c;
         if (cb.Checked == true)
         {
             typeList.Add(cb.Tag.ToString());
         }
     }
     if (typeList.Count == 0 || typeList.Count == gb_foobType.Controls.Count)
     {
         foreach (Control c in FLP1.Controls)
         {
             Label lb = (Label)c;
             lb.Show();
         }
         return;
     }
     foreach (Control c in FLP1.Controls)
     {
         Label    lb  = (Label)c;
         String[] tag = (String[])lb.Tag;
         if (tag.Any(typeList.Contains))
         {
             lb.Show();
         }
         else
         {
             lb.Hide();
         }
     }
 }
Exemplo n.º 2
0
        private void CheckBox3_CheckedChanged(Object sender, EventArgs e)
        {
            CheckBoxEx cb = (CheckBoxEx)sender;

            try
            {
                if (cb.Checked == true)
                {
                    rp.Show();
                }
                else
                {
                    rp.Hide();
                }
            }
            catch (Exception ex)
            {
                rp = new Reprint(this);
                rp.Show();
            }

            /*rp = new Reprint(this);
             * rp.Deactivate += delegate
             * {
             *  rp.Close();
             * };
             * rp.Show();*/
        }
Exemplo n.º 3
0
        private void addGBFoodType()
        {
            ov.setDt("foodType");

            DataTable dt = ov.getDt();

            typelist = new CheckBoxEx[dt.Rows.Count];
            int high = 15;

            this.gb_foobType.Height = 35 * dt.Rows.Count;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CheckBoxEx cb = new CheckBoxEx();

                cb.Location   = new Point(10, high);
                high         += 30;
                cb.ClientSize = new Size(30, 30);
                cb.Font       = new System.Drawing.Font("Microsoft JhengHei", 12, System.Drawing.FontStyle.Bold);
                cb.Name       = "cb_foodType_" + dt.Rows[i].ToString();
                cb.Text       = dt.Rows[i]["name"].ToString();
                cb.Tag        = dt.Rows[i]["fTypeId"].ToString();
                gb_foobType.Controls.Add(cb);
                cb.CheckedChanged += new EventHandler(CheckBox1_CheckedChanged);
                typelist[i]        = cb;
            }
        }
Exemplo n.º 4
0
        private void addTakeTime()
        {
            DateTime startTime = DateTime.Parse(getTimefromjson("http://" + login.database.id + "/fyp_php/pc/start.php"));
            DateTime endTime   = DateTime.Parse(getTimefromjson("http://" + login.database.id + "/fyp_php/pc/end.php"));

            int    startHour = startTime.Hour - 1;
            int    endHour   = endTime.Hour;
            int    min       = 0;
            int    high      = 15;
            double height    = 32.25;
            int    timeRange = (endHour - (startHour)) * 2;

            this.gb_time.Height = (int)(height) * timeRange;
            time = new CheckBoxEx[timeRange];
            for (int i = 0; i < timeRange; i++)
            {
                CheckBoxEx cb = new CheckBoxEx();
                cb.ClientSize = new Size(30, 30);
                cb.Location   = new Point(10, high);
                cb.Font       = new System.Drawing.Font("Microsoft JhengHei", 18, System.Drawing.FontStyle.Bold);

                if (min == 0)
                {
                    startHour++;
                    String temp = "0" + min.ToString();
                    cb.Text = startHour.ToString() + ":" + temp;
                }
                else
                {
                    cb.Text = startHour.ToString() + ":" + min.ToString();
                }
                high   += 30;
                min     = (min + 30) % 60;
                cb.Name = "cb_TakeTime_" + i;
                time[i] = cb;

                cb.CheckedChanged += new EventHandler(CheckBoxTime_CheckedChanged);
                gb_time.Controls.Add(cb);
            }
            btn_TimeClear.Location   = new Point(120, 15);
            btn_TimeClear.ClientSize = new Size(70, 100);
            btn_GrpPrint.Location    = new Point(120, btn_GrpPrint.Location.Y + btn_TimeClear.ClientSize.Height);
            btn_GrpPrint.ClientSize  = new Size(70, 100);
            btn_pgop.Location        = new Point(120, btn_pgop.Location.Y + (btn_GrpPrint.ClientSize.Height * 2));
            btn_pgop.ClientSize      = new Size(70, 100);
        }
Exemplo n.º 5
0
 private void control()
 {
     typeList = new List <string>();
     timeList = new List <string>();
     for (int i = 0; i < time.Length; i++)
     {
         if (time[i].Checked == true)
         {
             timeList.Add(time[i].Text);
         }
     }
     foreach (Control c in gb_foobType.Controls)
     {
         CheckBoxEx cb = (CheckBoxEx)c;
         if (cb.Checked == true)
         {
             typeList.Add(cb.Tag.ToString());
         }
     }
     if (timeList.Count + typeList.Count > 1)
     {
         checkType();
         checkTime();
     }
     if (typeList.Count > 0 && timeList.Count == 0)
     {
         checkType();
     }
     if (timeList.Count > 0 && typeList.Count == 0)
     {
         checkFullTime();
     }
     if (timeList.Count == 0 && typeList.Count == 0)
     {
         foreach (Control c in FLP1.Controls)
         {
             Label lb = (Label)c;
             lb.Show();
         }
     }
 }
Exemplo n.º 6
0
        private void CheckBox2_CheckedChanged(Object sender, EventArgs e)
        {
            CheckBoxEx cb = (CheckBoxEx)sender;

            try
            {
                if (cb.Checked == true)
                {
                    gcv.Show();
                }
                else
                {
                    gcv.Hide();
                }
            }
            catch (Exception ex)
            {
                gcv = new GroupCountView(login);
                gcv.Show();
            }
        }
Exemplo n.º 7
0
        private void gbInformation()
        {
            int        high = 40;
            CheckBoxEx cb   = new CheckBoxEx();

            cb.Location   = new Point(10, high);
            cb.ClientSize = new Size(30, 30);
            cb.Font       = new System.Drawing.Font("Microsoft JhengHei", 12, System.Drawing.FontStyle.Bold);
            cb.Name       = "cb_gcv";
            cb.Text       = "Count Viewer";
            gb_Information.Controls.Add(cb);
            cb.CheckedChanged += new EventHandler(CheckBox2_CheckedChanged);
            cb            = new CheckBoxEx();
            cb.Location   = new Point(10, high + 31);
            cb.ClientSize = new Size(30, 30);
            cb.Font       = new System.Drawing.Font("Microsoft JhengHei", 12, System.Drawing.FontStyle.Bold);
            cb.Name       = "cb_reprint";
            cb.Text       = "Reprint";
            gb_Information.Controls.Add(cb);
            cb.CheckedChanged += new EventHandler(CheckBox3_CheckedChanged);
        }
Exemplo n.º 8
0
        private String sqlControl()
        {
            String  cmdText = "SELECT food.shortname as name, count(*) as count from orders , orderfood , food ,foodtype where orderfood.orderid = orders.orderid and orderfood.orderDate = orders.orderDate and orderfood.foodid = food.foodid and orders.status = 'processing' and orderfood.orderdate = CURDATE() and foodtype.fTypeId=food.fTypeId ";
            String  s       = "";
            Boolean check   = false;

            for (int i = 0; i < time.Length; i++)
            {
                CheckBoxEx cb = time[i];

                if (cb.Checked == true && (s.Equals("")))
                {
                    s += "'" + cb.Text + "'";
                    if (check == false)
                    {
                        check = true;
                    }
                }
                else if (cb.Checked == true)
                {
                    s += ",'" + cb.Text + "'";
                    if (check == false)
                    {
                        check = true;
                    }
                }
            }
            if (check == true)
            {
                cmdText += " AND orders.otaketime in (" + s + ")";
            }

            s     = "";
            check = false;
            for (int i = 0; i < typelist.Length; i++)
            {
                CheckBoxEx cb = typelist[i];

                if (cb.Checked == true && (s.Equals("")))
                {
                    s += "'" + cb.Text + "'";
                    if (check == false)
                    {
                        check = true;
                    }
                }
                else if (cb.Checked == true)
                {
                    s += ",'" + cb.Text + "'";
                    if (check == false)
                    {
                        check = true;
                    }
                }
            }
            if (check == true)
            {
                cmdText += " AND foodtype.name in (" + s + ")";
            }


            cmdText += " group by food.name";
            return(cmdText);
        }
Exemplo n.º 9
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.º 10
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");
            }
        }