예제 #1
0
		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();

		}
예제 #2
0
		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);
		}
예제 #3
0
		private void CreateDetails(int iRow)
		{
			mDetails = new ContactDetails();
			Customer clsCustomer = new Customer();
			mDetails = clsCustomer.Details(Convert.ToInt64(dgContacts[iRow, 0].ToString()));
			clsCustomer.CommitAndDispose();

			////int iRow = dgContacts.CurrentRowIndex;

			//mDetails.ContactID = Convert.ToInt64(dgContacts[iRow, 0].ToString());
			//mDetails.ContactCode = dgContacts[iRow, 1].ToString();
			//mDetails.ContactName = dgContacts[iRow, 2].ToString();
			//mDetails.Debit = Convert.ToDecimal(dgContacts[iRow, 3].ToString());
			//mDetails.Credit = Convert.ToDecimal(dgContacts[iRow, 4].ToString());
			//mDetails.CreditLimit = Convert.ToDecimal(dgContacts[iRow, 5].ToString());
			//mDetails.IsCreditAllowed = Convert.ToInt16(dgContacts[iRow, 6].ToString());
			//mDetails.PositionName = dgContacts[iRow, 7].ToString();
			//mDetails.DepartmentName = dgContacts[iRow, 8].ToString();
		}
예제 #4
0
        //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;
            
        }
예제 #5
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
        }
예제 #6
0
		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

        }
예제 #7
0
        //public DateTime getCreditPurcEndDateToProcess(CreditType CreditType)
        //{
        //    try
        //    {
        //        MySqlCommand cmd = new MySqlCommand();
        //        cmd.CommandType = System.Data.CommandType.Text;

        //        string SQL = "SELECT CreditPurcEndDateToProcess FROM tblCardTypes WHERE CardTypeCode = (SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'IndividualCardTypeCode') ";

        //        // do an override
        //        if (CreditType == RetailPlus.CreditType.Group)
        //            SQL = "SELECT CreditPurcEndDateToProcess FROM tblCardTypes WHERE CardTypeCode = (SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'GroupCardTypeCode') ";

        //        cmd.CommandText = SQL;
        //        string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
        //        base.MySqlDataAdapterFill(cmd, dt);

        //        DateTime dteRetValue = DateTime.MaxValue;
        //        foreach(System.Data.DataRow dr in dt.Rows)
        //        {
        //            dteRetValue = DateTime.Parse(dr["CreditPurcEndDateToProcess"].ToString());
        //        }

        //        return dteRetValue;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw base.ThrowException(ex);
        //    }
        //}

        //public DateTime getBillingDate(CreditType CreditType)
        //{
        //    try
        //    {
        //        MySqlCommand cmd = new MySqlCommand();
        //        cmd.CommandType = System.Data.CommandType.Text;

        //        string SQL = "SELECT BillingDate FROM tblCardTypes WHERE CardTypeCode = (SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'IndividualCardTypeCode') ";

        //        // do an override if group
        //        if (CreditType == RetailPlus.CreditType.Group)
        //            SQL = "SELECT BillingDate FROM tblCardTypes WHERE CardTypeCode = (SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'GroupCardTypeCode') ";

        //        cmd.CommandText = SQL;
        //        string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
        //        base.MySqlDataAdapterFill(cmd, dt);

        //        DateTime dteRetValue = Constants.C_DATE_MIN_VALUE;
        //        foreach (System.Data.DataRow dr in dt.Rows)
        //        {
        //            dteRetValue = DateTime.Parse(dr["BillingDate"].ToString());
        //        }

        //        return dteRetValue;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw base.ThrowException(ex);
        //    }
        //}

        //public CardTypeDetails getCreditCardTypeInfo(CreditType CreditType)
        //{
        //    try
        //    {
        //        MySqlCommand cmd = new MySqlCommand();
        //        cmd.CommandType = System.Data.CommandType.Text;

        //        string SQL = "SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'IndividualCardTypeCode' ";

        //        // do an override if group
        //        if (CreditType == RetailPlus.CreditType.Group)
        //            SQL = "SELECT ConfigValue FROM sysCreditConfig WHERE ConfigName = 'GroupCardTypeCode' ";

        //        cmd.CommandText = SQL;
        //        string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
        //        base.MySqlDataAdapterFill(cmd, dt);

        //        string strCardTypeCode = string.Empty;
        //        foreach (System.Data.DataRow dr in dt.Rows)
        //        {
        //            strCardTypeCode = dr["ConfigValue"].ToString();
        //            return new CardType(base.Connection, base.Transaction).Details(strCardTypeCode);
        //        }

        //        return new CardTypeDetails();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw base.ThrowException(ex);
        //    }
        //}

        private BillingDetails setDetails(System.Data.DataRow dr)
        {
            try
            {
                BillingDetails Details = new BillingDetails();

                Details.CreditBillHeaderID = Convert.ToInt64(dr["CreditBillHeaderID"]);
                Details.ContactID = Convert.ToInt64(dr["ContactID"]);
                Details.CrediLimit = Convert.ToDecimal(dr["CreditLimit"]);
                Details.RunningCreditAmt = Convert.ToDecimal(dr["RunningCreditAmt"]);
                Details.CurrMonthCreditAmt = Convert.ToDecimal(dr["CurrMonthCreditAmt"]);
                Details.CurrMonthAmountPaid = Convert.ToDecimal(dr["CurrMonthAmountPaid"]);
                Details.TotalBillCharges = Convert.ToDecimal(dr["TotalBillCharges"]);
                Details.CurrentDueAmount = Convert.ToDecimal(dr["CurrentDueAmount"]);
                Details.MinimumAmountDue = Convert.ToDecimal(dr["MinimumAmountDue"]);

                Details.Prev1MoCurrentDueAmount = Convert.ToDecimal(dr["Prev1MoCurrentDueAmount"]);
                Details.Prev1MoMinimumAmountDue = Convert.ToDecimal(dr["Prev1MoMinimumAmountDue"]);
                Details.Prev1MoCurrMonthAmountPaid = Convert.ToDecimal(dr["Prev1MoCurrMonthAmountPaid"]);
                Details.Prev2MoCurrentDueAmount = Convert.ToDecimal(dr["Prev2MoCurrentDueAmount"]);
                Details.CurrentPurchaseAmt = decimal.Parse(dr["CurrentPurchaseAmt"].ToString());
                Details.BeginningBalance = decimal.Parse(dr["BeginningBalance"].ToString());
                Details.EndingBalance = decimal.Parse(dr["EndingBalance"].ToString());

                Details.CreditCutOffDate = DateTime.Parse(dr["CreditCutOffDate"].ToString());
                Details.CreditPaymentDueDate = DateTime.Parse(dr["CreditPaymentDueDate"].ToString());
                Details.BillingDate = DateTime.Parse(dr["BillingDate"].ToString());

                Details.CreditPurcStartDateToProcess = DateTime.Parse(dr["CreditPurcStartDateToProcess"].ToString());
                Details.CreditPurcEndDateToProcess = DateTime.Parse(dr["CreditPurcEndDateToProcess"].ToString());

                // need an override to eliminate reporting issue
                // '0001-01-01' is not accepted by Crystal
                Details.CreditPurcStartDateToProcess = Details.CreditPurcStartDateToProcess == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreditPurcStartDateToProcess;
                Details.CreditPurcEndDateToProcess = Details.CreditPurcEndDateToProcess == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreditPurcEndDateToProcess;

                Details.BillingFile = dr["BillingFile"].ToString();
                Details.isBillPrinted = bool.Parse(dr["isBillPrinted"].ToString());

                Customer clsCustomer = new Customer(base.Connection, base.Transaction);
                Details.CustomerDetails = clsCustomer.Details(Details.ContactID);

                return Details;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #8
0
        public BillingDetails Details(Int64 CustomerID, DateTime LastBillingDate, bool CheckIsBillPrinted = false, bool IsBillPrinted = false)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect();
                SQL += "WHERE 1=1 ";

                SQL += CheckIsBillPrinted ? (IsBillPrinted ? "AND IsBillPrinted = 1 " : "AND IsBillPrinted = 0 ") : "";

                if (LastBillingDate == Constants.C_DATE_MIN_VALUE)
                {
                    SQL += "AND CBL.BillingDate = (SELECT MAX(BillingDate) FROM tblCreditBills) ";
                }
                else
                {
                    SQL += "AND CBL.BillingDate = @BillingDate ";
                    cmd.Parameters.AddWithValue("BillingDate", LastBillingDate);
                }
                if (CustomerID != 0)
                {
                    SQL += "AND CUS.ContactID = @ContactID ";
                    cmd.Parameters.AddWithValue("ContactID", CustomerID);
                }

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                BillingDetails Details = new BillingDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.CreditBillHeaderID = Int64.Parse(dr["CreditBillHeaderID"].ToString());
                    Details.ContactID = Int64.Parse(dr["ContactID"].ToString());
                    Details.CrediLimit = decimal.Parse(dr["CreditLimit"].ToString());
                    Details.RunningCreditAmt = decimal.Parse(dr["RunningCreditAmt"].ToString());
                    Details.CurrMonthCreditAmt = decimal.Parse(dr["CurrMonthCreditAmt"].ToString());
                    Details.CurrMonthAmountPaid = decimal.Parse(dr["CurrMonthAmountPaid"].ToString());
                    Details.TotalBillCharges = decimal.Parse(dr["TotalBillCharges"].ToString());
                    Details.CurrentDueAmount = decimal.Parse(dr["CurrentDueAmount"].ToString());
                    Details.MinimumAmountDue = decimal.Parse(dr["MinimumAmountDue"].ToString());

                    Details.Prev1MoCurrentDueAmount = decimal.Parse(dr["Prev1MoCurrentDueAmount"].ToString());
                    Details.Prev1MoMinimumAmountDue = decimal.Parse(dr["Prev1MoMinimumAmountDue"].ToString());
                    Details.Prev1MoCurrMonthAmountPaid = decimal.Parse(dr["Prev1MoCurrMonthAmountPaid"].ToString());
                    Details.Prev2MoCurrentDueAmount = decimal.Parse(dr["Prev2MoCurrentDueAmount"].ToString());
                    Details.CurrentPurchaseAmt = decimal.Parse(dr["CurrentPurchaseAmt"].ToString());
                    Details.BeginningBalance = decimal.Parse(dr["BeginningBalance"].ToString());
                    Details.EndingBalance = decimal.Parse(dr["EndingBalance"].ToString());

                    Details.CreditCutOffDate = DateTime.Parse(dr["CreditCutOffDate"].ToString());
                    Details.CreditPaymentDueDate = DateTime.Parse(dr["CreditPaymentDueDate"].ToString());
                    Details.BillingDate = DateTime.Parse(dr["BillingDate"].ToString());
                    Details.CreditPurcStartDateToProcess = DateTime.Parse(dr["CreditPurcStartDateToProcess"].ToString());
                    Details.CreditPurcEndDateToProcess = DateTime.Parse(dr["CreditPurcEndDateToProcess"].ToString());
                    Details.BillingFile = dr["BillingFile"].ToString();
                    Details.isBillPrinted = bool.Parse(dr["isBillPrinted"].ToString());

                    Details.CardTypeDetails = new Data.CardTypeDetails()
                    {
                        CardTypeID = Int16.Parse(dr["CreditCardTypeID"].ToString()),
                        CardTypeCode = dr["CardTypeCode"].ToString(),
                        CardTypeName = dr["CardTypeName"].ToString(),
                        CreditFinanceCharge = decimal.Parse(dr["CreditFinanceCharge"].ToString()),
                        CreditLatePenaltyCharge = decimal.Parse(dr["CreditLatePenaltyCharge"].ToString()),
                        CreditMinimumAmountDue = decimal.Parse(dr["CreditMinimumAmountDue"].ToString()),
                        CreditMinimumPercentageDue = decimal.Parse(dr["CreditMinimumPercentageDue"].ToString()),
                        CreditFinanceCharge15th = decimal.Parse(dr["CreditFinanceCharge15th"].ToString()),
                        CreditLatePenaltyCharge15th = decimal.Parse(dr["CreditLatePenaltyCharge15th"].ToString()),
                        CreditMinimumAmountDue15th = decimal.Parse(dr["CreditMinimumAmountDue15th"].ToString()),
                        CreditMinimumPercentageDue15th = decimal.Parse(dr["CreditMinimumPercentageDue15th"].ToString()),
                        CreditPurcStartDateToProcess = DateTime.Parse(dr["CreditPurcStartDateToProcess"].ToString()),
                        CreditPurcEndDateToProcess = DateTime.Parse(dr["CreditPurcEndDateToProcess"].ToString()),
                        CreditCutOffDate = DateTime.Parse(dr["CreditCutOffDate"].ToString()),
                        CreditCardType = (CreditCardTypes)Enum.Parse(typeof(CreditCardTypes), dr["CreditCardType"].ToString()),
                        WithGuarantor = bool.Parse(dr["WithGuarantor"].ToString()),
                        BillingDate = DateTime.Parse(dr["BillingDate"].ToString())
                    };


                    Customer clsCustomer = new Customer(base.Connection, base.Transaction);
                    Details.CustomerDetails = clsCustomer.Details(Details.ContactID);
                }

                return Details;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #9
0
		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);
		}