private void datatableLoad() { 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"; } int intSkip = 0; intSkip = (this.mintCurrentPage * this.mintPageSize); if (cbo_searchTYpe.Text == "ALL") { dt_report = blod.searchALLSalesWithoutpagination(dateOne, datetwo, fiscal_year); dtLoad = blod.searchALLSales(dateOne, datetwo, mintPageSize, intSkip, fiscal_year); dtSum = blrr.totalSalesSum(dateOne, datetwo, fiscal_year); DataGridViewLoad(); } else if (cbo_searchTYpe.Text == "Bill No") { dtLoad = blod.searchbybill2(txt_searchText.Text); dt_report = blod.searchbybill2(txt_searchText.Text); dtSum = blrr.totalSalesSumByBillNo(txt_searchText.Text, fiscal_year); DataGridViewLoad(); } else if (cbo_searchTYpe.Text == "Category Group") { dtLoad = blcg.getallFromView(dateOne, datetwo, txt_searchText.Text); dt_report = blcg.getallFromView(dateOne, datetwo, txt_searchText.Text); DataGridViewLoad(); } else { dtLoad = brr.searchitembyColumnNameDynamic(txt_searchText.Text, dateOne, datetwo, colunm_name, fiscal_year); dt_report = brr.searchitembyColumnNameDynamic(txt_searchText.Text, dateOne, datetwo, colunm_name, fiscal_year); // dtSum = blrr.totalSalesSumBYdifferentColumn(txt_searchText.Text, dateOne, datetwo, colunm_name); DataGridViewLoad(); } this.status = (this.mintCurrentPage + 1).ToString() + " / " + this.mintPageCount.ToString(); } }