private void LoadOptions() { cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCredit, ReportTypes.CustomerCredit)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditBill, ReportTypes.CustomerCreditBill)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditListWCredit, ReportTypes.CustomerCreditListWCredit)); cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditListLatestBill, ReportTypes.CustomerCreditListLatestBill)); cboReportType.SelectedIndex = 0; Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, true, "ContactName", SortOption.Ascending); cboContactName.DataBind(); cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboContactName.Items.Count > 1 && txtContactName.Text.Trim() != string.Empty) cboContactName.SelectedIndex = 1; else cboContactName.SelectedIndex = 0; ContactGroups clsContactGroup = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction); cboCustomerGroup.DataTextField = "ContactGroupName"; cboCustomerGroup.DataValueField = "ContactGroupCode"; cboCustomerGroup.DataSource = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER); cboCustomerGroup.DataBind(); cboCustomerGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboCustomerGroup.Items.Count > 1 && txtCustomerGroup.Text.Trim() != string.Empty) cboCustomerGroup.SelectedIndex = 1; else cboCustomerGroup.SelectedIndex = 0; clsCustomer.CommitAndDispose(); }
private void LoadOptions() { cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); cboReportType.Items.Add(new ListItem(ReportTypes.RewardsHistory, ReportTypes.RewardsHistory)); cboReportType.Items.Add(new ListItem(ReportTypes.RewardsSummary, ReportTypes.RewardsSummary)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.RewardsSummaryStatistics, ReportTypes.RewardsSummaryStatistics)); if (Request.QueryString["task"] == null) { cboReportType.SelectedIndex = 0; } else { string task = Common.Decrypt(Request.QueryString["task"].ToString(), Session.SessionID); switch (task) { case ReportTypes.RewardsHistory: cboReportType.SelectedIndex = 1; break; case ReportTypes.RewardsSummary: cboReportType.SelectedIndex = 2; break; case ReportTypes.RewardsSummaryStatistics: cboReportType.SelectedIndex = 4; break; default: cboReportType.SelectedIndex = 0; break; } } Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboContactName.Items.Count > 1 && txtContactName.Text.Trim() != string.Empty) cboContactName.SelectedIndex = 1; else cboContactName.SelectedIndex = 0; clsCustomer.CommitAndDispose(); txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1)); txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now); cboReportType_SelectedIndexChanged(null, null); }
//protected void imgTerminalNoSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) //{ // Terminal clsTerminal = new Terminal(); // cboTerminalNo.DataTextField = "TerminalNo"; // cboTerminalNo.DataValueField = "TerminalNo"; // cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(txtTerminalNo.Text); // cboTerminalNo.DataBind(); // cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); // if (cboTerminalNo.Items.Count > 1 && txtTerminalNo.Text.Trim() != string.Empty) cboTerminalNo.SelectedIndex = 1; else cboTerminalNo.SelectedIndex = 0; // clsTerminal.CommitAndDispose(); //} protected void imgContactNameSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); clsCustomer.CommitAndDispose(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING)); cboContactName.SelectedIndex = 0; }
private void LoadOptions() { Int64 UID = Convert.ToInt64(Session["UID"]); Security.AccessRights clsAccessRights = new Security.AccessRights(); Security.AccessRightsDetails clsDetails = clsAccessRights.Details(UID,(int) AccessTypes.SummarizedDailySalesWithTFDetailed); clsAccessRights.CommitAndDispose(); cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales)); if (clsDetails.Read) cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay)); if (cboReportType.Items.Count == 2) cboReportType.Items.RemoveAt(cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.REPORT_SELECTION))); cboReportType.SelectedIndex = 0; cboConsignment.Items.Clear(); cboConsignment.Items.Add(new ListItem("Both", "-1")); cboConsignment.Items.Add(new ListItem("Yes", true.ToString())); cboConsignment.Items.Add(new ListItem("No", false.ToString())); cboTransactionStatus.Items.Clear(); foreach(string status in Enum.GetNames(typeof(TransactionStatus))) { cboTransactionStatus.Items.Add(new ListItem(status, status)); } cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString())); cboPaymentType.Items.Clear(); foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes))) { cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType)); } cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString())); txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1)); txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now); Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING)); cboContactName.SelectedIndex = 0; cboAgent.Items.Clear(); Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction); cboAgent.DataTextField = "ContactName"; cboAgent.DataValueField = "ContactID"; cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending); cboAgent.DataBind(); if (string.IsNullOrEmpty(txtAgent.Text)) cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING)); cboAgent.SelectedIndex = 0; Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction); cboTerminalNo.DataTextField = "TerminalNo"; cboTerminalNo.DataValueField = "TerminalNo"; cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(); cboTerminalNo.DataBind(); cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); cboTerminalNo.SelectedIndex = 0; Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction); cboBranch.DataTextField = "BranchCode"; cboBranch.DataValueField = "BranchID"; cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: true).DefaultView; cboBranch.DataBind(); cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboBranch.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction); cboCashierName.DataTextField = "Name"; cboCashierName.DataValueField = "UID"; cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0); cboCashierName.DataBind(); if (string.IsNullOrEmpty(txtCashierName.Text)) cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING)); cboCashierName.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupName"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName"); cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductGroup.SelectedIndex = 0; clsCustomer.CommitAndDispose(); #region Sales Per Day cboMonth.Items.Add(new ListItem("January", "1")); cboMonth.Items.Add(new ListItem("February", "2")); cboMonth.Items.Add(new ListItem("March", "3")); cboMonth.Items.Add(new ListItem("April", "4")); cboMonth.Items.Add(new ListItem("May", "5")); cboMonth.Items.Add(new ListItem("June", "6")); cboMonth.Items.Add(new ListItem("July", "7")); cboMonth.Items.Add(new ListItem("August", "8")); cboMonth.Items.Add(new ListItem("September", "9")); cboMonth.Items.Add(new ListItem("October", "10")); cboMonth.Items.Add(new ListItem("November", "11")); cboMonth.Items.Add(new ListItem("Decemeber", "12")); cboMonth.SelectedIndex = DateTime.Now.Month - 1; int x = 2007; while (x <= DateTime.Now.Year) { cboYear.Items.Add(new ListItem(x.ToString(), x.ToString())); x++; } cboYear.SelectedIndex = cboYear.Items.Count - 1; #endregion }
private void LoadOptions() { Int64 UID = Convert.ToInt64(Session["UID"]); Security.AccessRights clsAccessRights = new Security.AccessRights(); cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySales).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay)); } //if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySalesWithTF).Read) //{ // cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); // cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySalesWithTF, ReportTypes.SummarizeDailySalesWithTF)); // cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDayWithTF, ReportTypes.SalesPerDayWithTF)); //} if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionReport).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerHour, ReportTypes.SalesPerHour)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactions, ReportTypes.SalesTransactions)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomer, ReportTypes.SalesTransactionPerCustomer)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroup, ReportTypes.SalesTransactionPerCustomerPerGroup)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroupSummarized, ReportTypes.SalesTransactionPerCustomerPerGroupSummarized)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerWithCheque, ReportTypes.SalesTransactionPerCustomerWithCheque)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerItem, ReportTypes.SalesTransactionPerCustomerPerItem)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashier, ReportTypes.SalesTransactionPerCashier)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashierPerCustomer, ReportTypes.SalesTransactionPerCashierPerCustomer)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerTerminal, ReportTypes.SalesTransactionPerTerminal)); if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItem).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItem, ReportTypes.SalesTransactionPerItem)); } if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItemWoutPurchaseDetails).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItemWoutPurchaseDetails, ReportTypes.SalesTransactionPerItemWoutPurchaseDetails)); } cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesDaily, ReportTypes.CashSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesMonthly, ReportTypes.CashSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequePaymentList, ReportTypes.ChequePaymentList)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesDaily, ReportTypes.ChequeSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesMonthly, ReportTypes.ChequeSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesDaily, ReportTypes.CreditCardSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesMonthly, ReportTypes.CreditCardSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.DailySalesTransaction, ReportTypes.DailySalesTransaction)); cboReportType.Items.Add(new ListItem(ReportTypes.WeeklySalesTransaction, ReportTypes.WeeklySalesTransaction)); cboReportType.Items.Add(new ListItem(ReportTypes.MonthlySalesTransaction, ReportTypes.MonthlySalesTransaction)); } if (clsAccessRights.Details(UID, (int)AccessTypes.PaidOutDisburseROC).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.PaidOut, ReportTypes.PaidOut)); cboReportType.Items.Add(new ListItem(ReportTypes.Disburse, ReportTypes.Disburse)); cboReportType.Items.Add(new ListItem(ReportTypes.RecieveOnAccount, ReportTypes.RecieveOnAccount)); } cboReportType.SelectedIndex = 0; clsAccessRights.CommitAndDispose(); cboConsignment.Items.Clear(); cboConsignment.Items.Add(new ListItem("Both", "-1")); cboConsignment.Items.Add(new ListItem("Yes", true.ToString())); cboConsignment.Items.Add(new ListItem("No", false.ToString())); cboTransactionStatus.Items.Clear(); foreach(string status in Enum.GetNames(typeof(TransactionStatus))) { cboTransactionStatus.Items.Add(new ListItem(status, status)); } cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString())); cboPaymentType.Items.Clear(); foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes))) { cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType)); } cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString())); txtStartValidityDate.Text = Common.ToShortDateString(DateTime.Now); txtEndValidityDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(30)); txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1)); txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now); Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING)); cboContactName.SelectedIndex = 0; ContactGroups clsContactGroups = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction); cboContactGroupName.DataTextField = "ContactGroupName"; cboContactGroupName.DataValueField = "ContactGroupID"; cboContactGroupName.DataSource = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text); cboContactGroupName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactGroupName.Text, Constants.ZERO_STRING)); cboContactGroupName.SelectedIndex = 0; cboAgent.Items.Clear(); Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction); cboAgent.DataTextField = "ContactName"; cboAgent.DataValueField = "ContactID"; cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending); cboAgent.DataBind(); if (string.IsNullOrEmpty(txtAgent.Text)) cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING)); cboAgent.SelectedIndex = 0; Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction); cboTerminalNo.DataTextField = "TerminalNo"; cboTerminalNo.DataValueField = "TerminalNo"; cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(); cboTerminalNo.DataBind(); cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); cboTerminalNo.SelectedIndex = 0; Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction); cboBranch.DataTextField = "BranchCode"; cboBranch.DataValueField = "BranchID"; cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView; cboBranch.DataBind(); cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboBranch.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction); cboCashierName.DataTextField = "Name"; cboCashierName.DataValueField = "UID"; cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0); cboCashierName.DataBind(); if (string.IsNullOrEmpty(txtCashierName.Text)) cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING)); cboCashierName.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupName"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName"); cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductGroup.SelectedIndex = 0; clsCustomer.CommitAndDispose(); #region Sales Per Day cboMonth.Items.Add(new ListItem("January", "1")); cboMonth.Items.Add(new ListItem("February", "2")); cboMonth.Items.Add(new ListItem("March", "3")); cboMonth.Items.Add(new ListItem("April", "4")); cboMonth.Items.Add(new ListItem("May", "5")); cboMonth.Items.Add(new ListItem("June", "6")); cboMonth.Items.Add(new ListItem("July", "7")); cboMonth.Items.Add(new ListItem("August", "8")); cboMonth.Items.Add(new ListItem("September", "9")); cboMonth.Items.Add(new ListItem("October", "10")); cboMonth.Items.Add(new ListItem("November", "11")); cboMonth.Items.Add(new ListItem("Decemeber", "12")); cboMonth.SelectedIndex = DateTime.Now.Month - 1; int x = 2007; while (x <= DateTime.Now.Year) { cboYear.Items.Add(new ListItem(x.ToString(), x.ToString())); x++; } cboYear.SelectedIndex = cboYear.Items.Count - 1; #endregion }
private void SetDataSource(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); DataTable dt; switch (cboReportType.SelectedValue) { case ReportTypes.CustomerCredit: #region Customer Credit Customer clsCustomer = new Customer(); dt = clsCustomer.CustomersDataTable(cboContactName.SelectedItem.Text); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.CustomerDetails.NewRow(); foreach (DataColumn dc in rptds.CustomerDetails.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.CustomerDetails.Rows.Add(drNew); } SalesTransactions clsSalesTransactions = new SalesTransactions(clsCustomer.Connection, clsCustomer.Transaction); dt = clsSalesTransactions.ListForPaymentDataTable(Convert.ToInt64(cboContactName.SelectedItem.Value)); clsCustomer.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.CustomerCredit.NewRow(); foreach (DataColumn dc in rptds.CustomerCredit.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.CustomerCredit.Rows.Add(drNew); } break; #endregion case ReportTypes.CustomerCreditListWCredit: #region Customers List With Credit Contacts clsContact = new Contacts(); dt = clsContact.CustomerAdvanceSearch(null, cboContactName.SelectedItem.Text, cboCustomerGroup.SelectedItem.Value, true, "ContactID", SortOption.Ascending); clsContact.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.Contacts.NewRow(); foreach (DataColumn dc in rptds.Contacts.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.Contacts.Rows.Add(drNew); } break; #endregion } Report.SetDataSource(rptds); SetParameters(Report); }