private void ok_Click(object sender, EventArgs e) { int a = dt1.Text.Substring(0, 10).CompareTo(dt2.Text.Substring(0, 10)); // 시작날짜가 종료날짜보다 클때 에러처리 if (a == 1) { MessageBox.Show("정확한 날짜를 입력바랍니다."); } else { Hashtable ht = new Hashtable(); api = new WebComm(); ht.Add("spName", "select_date"); ht.Add("start", dt1.Text.Substring(0, 10)); ht.Add("end", dt2.Text.Substring(0, 10)); ArrayList list = api.Select("http://192.168.3.15:5000/sel_date", ht); api.ListView(lv, list); Hashtable pro = new Hashtable(); pro.Add("spName", "total_Money"); pro.Add("start", dt1.Text.Substring(0, 10)); pro.Add("end", dt2.Text.Substring(0, 10)); ArrayList money = api.Select("http://192.168.3.15:5000/sel_date", pro); string[] arr2 = api.str(money); // 총가격 if (arr2[0] == "") { label2.Text = "총 금액: 0원"; } else { ls1 = new lbSet(this, "lb2", arr2[0] + "원", 600, 50, 650, 11, 30); label2.Text = "총 금액: " + arr2[0] + "원"; label2.Font = new Font(FontFamily.GenericSansSerif, 25.0F, FontStyle.Bold); } Controls.Add(label2); } }
private void Combo_SelectedIndexChanged(object sender, EventArgs e) // 콤보박스 이벤트 { ComboBox combo = (ComboBox)sender; WebComm api = new WebComm(); string index = (string)combo.SelectedItem; if (index == "1분기") { if (tb.Text != "") { //api.Post2("http://192.168.3.15:5000/insert_CM"); // 결제버튼 클릭 시 매출관리 테이블에 추가 start = tb.Text + "-1-1"; end = tb.Text + "-3-31"; } } else if (index == "2분기") { if (tb.Text != "") { start = tb.Text + "-4-1"; end = tb.Text + "-6-30"; } } else if (index == "3분기") { if (tb.Text != "") { start = tb.Text + "-7-1"; end = tb.Text + "-9-30"; } } else if (index == "4분기") { if (tb.Text != "") { start = tb.Text + "-10-1"; end = tb.Text + "-12-31"; } } Hashtable pcd = new Hashtable(); pcd.Add("spName", "sel_Rank"); pcd.Add("start", start); pcd.Add("end", end); list = api.Select("http://192.168.3.15:5000/sel_date", pcd); if (list.Count == 0) { MessageBox.Show("데이터값이 없습니다."); } else { panel_clear(); get_chart(); array = api.Cut(list); for (int i = 0; i < 6; i++) { switch (i) { case 0: chart1.Series["Series1"].Points.Clear(); chart1.Titles.Add("파스타"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "1") { chart1.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; case 1: chart2.Series["Series1"].Points.Clear(); chart2.Titles.Add("스테이크"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "2") { chart2.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; case 2: chart3.Series["Series1"].Points.Clear(); chart3.Titles.Add("샐러드"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "3") { chart3.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; case 3: chart4.Series["Series1"].Points.Clear(); chart4.Titles.Add("디저트"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "4") { chart4.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; case 4: chart5.Series["Series1"].Points.Clear(); chart5.Titles.Add("음료"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "5") { chart5.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; case 5: chart6.Series["Series1"].Points.Clear(); chart6.Titles.Add("사이드"); for (int j = 0; j < list.Count; j++) { if (array[j * 3].ToString() == "6") { chart6.Series["Series1"].Points.AddXY(array[(j * 3) + 1].ToString(), array[(j * 3) + 2].ToString()); } } break; } } } }