public void datatableLoadCount() { if (cbo_searchTYpe.Text == "" || cbo_searchTYpe.Text == "Choose Type" || txt_searchText.Text == "") { MessageBox.Show("The Fields are Empty or invalid."); } else { string theDate = dtp_from.Value.ToString("yyyy-MM-dd") + " " + cbo_from_hours.Text + ":" + cbo_minuts_from.Text + ":00"; string theDate2 = dtp_to.Value.ToString("yyyy-MM-dd") + " " + cbo_to_hours.Text + ":" + cbo_minuts.Text + ":00"; DateTime dateOne = Convert.ToDateTime(theDate); DateTime datetwo = Convert.ToDateTime(theDate2); DataTable dtfis = blrr.GetFiscalYearsales(dateOne, datetwo); if (dtfis.Rows.Count > 0) { fiscal_year = dtfis.Rows[0]["fiscal_year"].ToString(); } else { DataTable dt = blfs.get_all_data_from_fiscal("True"); if (dt.Rows.Count > 0) { fiscal_year = dt.Rows[0]["fiscal_year"].ToString(); } } if (cbo_searchTYpe.Text == "Item") { colunm_name = "item_name"; } else if (cbo_searchTYpe.Text == "Category") { colunm_name = "category_name"; } else if (cbo_searchTYpe.Text == "Bill No") { colunm_name = "bill_no"; } else if (cbo_searchTYpe.Text == "Payment Mode") { colunm_name = "payment_mode"; } else if (cbo_searchTYpe.Text == "KOT Type") { colunm_name = "kot_type"; } else if (cbo_searchTYpe.Text == "Sales Type") { colunm_name = "sales_type"; } else if (cbo_searchTYpe.Text == "User") { colunm_name = "cashier_name"; } else if (cbo_searchTYpe.Text == "Service Provider") { colunm_name = "service_provider"; } if (cbo_searchTYpe.Text == "ALL") { dt = blod.searchALLSalesRecord(dateOne, datetwo, fiscal_year); } else if (cbo_searchTYpe.Text == "Bill No") { dt = blod.searchbybill2Count(txt_searchText.Text); } else if (cbo_searchTYpe.Text == "Category Group") { dt = blcg.getallFromView(dateOne, datetwo, txt_searchText.Text); } else { dt = blod.searchitembyname2Count(txt_searchText.Text, dateOne, datetwo, colunm_name, fiscal_year); } } }