Example #1
0
 private void LoadPurchases(Int64 CreditorID)
 {
     Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions();
     System.Data.DataTable  dt = clsSalesTransactions.ListForPaymentDataTable(CreditorID);
     clsSalesTransactions.CommitAndDispose();
     lstPurchases.DataSource = dt.DefaultView;
     lstPurchases.DataBind();
 }
Example #2
0
        private void LoadData()
        {
            try
            {
                Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
                System.Data.DataTable  dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID);

                clsTransactions.CommitAndDispose();

                this.dgStyle.MappingName = dt.TableName;
                dgItems.DataSource       = dt;

                if (dt.Rows.Count > 0)
                {
                    dgItems.Select(0);
                    dgItems.CurrentRowIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
 private void LoadPurchases(Int64 CreditorID)
 {
     Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions();
     System.Data.DataTable dt = clsSalesTransactions.ListForPaymentDataTable(CreditorID);
     clsSalesTransactions.CommitAndDispose();
     lstPurchases.DataSource = dt.DefaultView;
     lstPurchases.DataBind();
 }
Example #4
0
		private void LoadData()
		{	
			try
			{
                DateTime dteRetValue = DateTime.MinValue;
                DateTime dtePaymentDateFrom = DateTime.TryParse(txtTrxStartDate.Text + " 00:00:00", out dteRetValue) ? dteRetValue : DateTime.Now.AddYears(-2);
                DateTime dtePaymentDateTo = DateTime.TryParse(txtTrxEndDate.Text + " 23:59:59", out dteRetValue) ? dteRetValue : DateTime.Now; 
                
                Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
				System.Data.DataTable dt;

                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID, "Balance, TransactionID", System.Data.SqlClient.SortOrder.Descending);
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID, "TransactionNo", System.Data.SqlClient.SortOrder.Ascending, 0, dtePaymentDateFrom, dtePaymentDateTo);
                        break;
                }   
                //Data.Billing clsBilling = new Data.Billing(clsTransactions.Connection, clsTransactions.Transaction);
                //Data.BillingDetails clsBillingDetails = clsBilling.Details(mclsCustomerDetails.ContactID, false);

				clsTransactions.CommitAndDispose();

                dgvItems.MultiSelect = true;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize = false;
                dgvItems.DataSource = dt.TableName;
                dgvItems.DataSource = dt;

                foreach (DataGridViewTextBoxColumn dc in dgvItems.Columns)
                {
                    dc.Visible = false;
                }
                dgvItems.Columns["TransactionNo"].Visible = true;
                dgvItems.Columns["TransactionDate"].Visible = true;
                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dgvItems.Columns["CreditReason"].Visible = true;
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].Visible = true;
                        dgvItems.Columns["ModeOfTermsCode"].Visible = true;
                        dgvItems.Columns["AgingDate"].Visible = true;
                        dgvItems.Columns["AgeTerms"].Visible = true;
                        break;
                }
                //
                dgvItems.Columns["SubTotal"].Visible = true;
                dgvItems.Columns["Credit"].Visible = true;
                dgvItems.Columns["CreditPaid"].Visible = true;
                dgvItems.Columns["Balance"].Visible = true;
                
                dgvItems.Columns["TransactionNo"].Width = 120;
                dgvItems.Columns["TransactionDate"].Width = 120;
                // do an override
                int iWidth = 100;
                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        if (dt.Rows.Count < 14) dgvItems.Columns["CreditReason"].Width = 240; else dgvItems.Columns["CreditReason"].Width = 210;
                        iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width - dgvItems.Columns["CreditReason"].Width) / 4;
                        if (dt.Rows.Count >= 14) iWidth = iWidth - 5;

                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].Width = 60;
                        dgvItems.Columns["ModeOfTermsCode"].Width = 75;
                        dgvItems.Columns["AgingDate"].Width = 120;
                        if (dt.Rows.Count < 14) dgvItems.Columns["AgeTerms"].Width = 90; else dgvItems.Columns["AgeTerms"].Width = 60;

                        iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width - dgvItems.Columns["Terms"].Width - dgvItems.Columns["ModeOfTermsCode"].Width - dgvItems.Columns["AgingDate"].Width - dgvItems.Columns["AgeTerms"].Width) / 4;
                        if (dt.Rows.Count >= 14) iWidth = iWidth - 5;
                        break;
                }
                dgvItems.Columns["SubTotal"].Width = iWidth;
                dgvItems.Columns["Credit"].Width = iWidth;
                dgvItems.Columns["CreditPaid"].Width = iWidth;
                dgvItems.Columns["Balance"].Width = iWidth;

                dgvItems.Columns["TransactionNo"].HeaderText = "Trans. No";
                dgvItems.Columns["TransactionDate"].HeaderText = "Trans. Date";
                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dgvItems.Columns["CreditReason"].HeaderText = "Description";
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].HeaderText = "Terms";
                        dgvItems.Columns["ModeOfTermsCode"].HeaderText = "ModeOfTerms";
                        dgvItems.Columns["AgingDate"].HeaderText = "Due Date";
                        dgvItems.Columns["AgeTerms"].HeaderText = "Age";

                        dgvItems.Columns["Terms"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["Terms"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["Terms"].DefaultCellStyle.Format = "#,##0";

                        dgvItems.Columns["AgingDate"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm tt";

                        dgvItems.Columns["AgeTerms"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["AgeTerms"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["AgeTerms"].DefaultCellStyle.Format = "#,##0";
                        break;
                }
                dgvItems.Columns["SubTotal"].HeaderText = "Subtotal";
                dgvItems.Columns["Credit"].HeaderText = "Credit";
                dgvItems.Columns["CreditPaid"].HeaderText = "Credit Paid";
                dgvItems.Columns["Balance"].HeaderText = "Balance";

                dgvItems.Columns["SubTotal"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["TransactionDate"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm tt";
                dgvItems.Columns["SubTotal"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Credit"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Balance"].DefaultCellStyle.Format = "#,##0.#0";

                dgvItems.ReadOnly = true;
                dgvItems.Select();


                lblHeader.Text = mclsCustomerDetails.ContactName;
                lblBalance.Text = mclsCustomerDetails.Credit.ToString("#,##0.#0");

                switch (mclsSysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        // sort this so that the least amount will be on top
                        // for HP
                        dgvItems.Sort(dgvItems.Columns["Balance"], ListSortDirection.Descending);
                        dgvItems.SelectAll();
                        dgvItems_RowStateChanged(null, null);
                        dgvItems.Enabled = false;

                        Data.Billing clsBilling = new Data.Billing();
                        Data.BillingDetails clsBillingDetails = clsBilling.Details(mclsCustomerDetails.ContactID, mclsCustomerDetails.CreditDetails.LastBillingDate, false);
                        clsBilling.CommitAndDispose();

                        lblAmountDue.Visible = true;
                        labelAmountDue.Visible = true;
                        lblAmountDue.Text = "0.00";
                        if (clsBillingDetails.ContactID != 0)
                        {
                            if (mclsCustomerDetails.CreditDetails.CardTypeDetails.WithGuarantor)
                            {
                                labelAmountDue.Text = "Amount Due";

                                if (decimal.Parse(lblBalance.Text) < clsBillingDetails.CurrentDueAmount)
                                {
                                    lblAmountDue.Text = lblBalance.Text;
                                }
                                else
                                {
                                    lblAmountDue.Text = clsBillingDetails.CurrentDueAmount.ToString("#,##0.#0");
                                }
                            }
                            else
                            {
                                labelAmountDue.Text = "Minimum Amount Due";
                                if (decimal.Parse(lblBalance.Text) < clsBillingDetails.MinimumAmountDue)
                                {
                                    lblAmountDue.Text = lblBalance.Text;
                                }
                                else
                                {
                                    lblAmountDue.Text = clsBillingDetails.MinimumAmountDue.ToString("#,##0.#0");
                                }
                            }
                        }
                        break;
                    case CreditPaymentType.Normal:
                    case CreditPaymentType.MPC:
                    default:
                        lblAmountDue.Visible = true;
                        labelAmountDue.Visible = true;

                        labelAmountDue.Text = "SubTotal Amount";
                        lblAmountDue.Text = mclsCustomerDetails.Credit.ToString("#,##0.#0");

                        decimal decTemp = 0;
                        decimal decTotalPayable = 0;
                        foreach (DataGridViewRow dr in dgvItems.Rows)
                        {
                            decTemp = 0;
                            decimal.TryParse(dr.Cells["Balance"].Value.ToString(), out decTemp);
                            decTotalPayable += decTemp;
                        }
                        lblAmountDue.Text = decTotalPayable.ToString("#,##0.#0");

                        labelAmountDue.Location = new Point(116, 475);
                        lblAmountDue.Location = new Point(700, 477);
                        lblBalanceName.Location = new Point(116, 553);
                        lblBalance.Location = new Point(705, 555);
                        break;
                }
                
                grpSearch.Visible = false;
                dgvItems.Focus();
                cmdEnter.Text = "Enter";
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); 
			}
		}
Example #5
0
		private void LoadData()
		{	
			try
			{
				Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
				System.Data.DataTable dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID);

				clsTransactions.CommitAndDispose();

                this.dgStyle.MappingName = dt.TableName;
				dgItems.DataSource = dt;

				if (dt.Rows.Count > 0)
				{
					dgItems.Select(0);
					dgItems.CurrentRowIndex=0;
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); 
			}
		}
Example #6
0
		private void LoadData()
		{	
			try
			{
				Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
				System.Data.DataTable dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID);

				clsTransactions.CommitAndDispose();

                dgvItems.MultiSelect = true;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize = false;
                dgvItems.DataSource = dt.TableName;
                dgvItems.DataSource = dt;

                dgvItems.Columns["TransactionID"].Visible = false;
                dgvItems.Columns["PaxNo"].Visible = false;
                dgvItems.Columns["CustomerID"].Visible = false;
                dgvItems.Columns["CustomerName"].Visible = false;
                dgvItems.Columns["ItemsDiscount"].Visible = false;

                dgvItems.Columns["TransactionNo"].Width = 250;
                dgvItems.Columns["TransactionDate"].Width = 120;
                int iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width) / 6;
                dgvItems.Columns["SubTotal"].Width = iWidth;
                dgvItems.Columns["Discount"].Width = iWidth;
                dgvItems.Columns["AmountPaid"].Width = iWidth;
                dgvItems.Columns["Credit"].Width = iWidth;
                dgvItems.Columns["CreditPaid"].Width = iWidth;
                dgvItems.Columns["Balance"].Width = iWidth;

                dgvItems.Columns["TransactionNo"].HeaderText = "Trans. No";
                dgvItems.Columns["TransactionDate"].HeaderText = "Trans. Date";
                dgvItems.Columns["SubTotal"].HeaderText = "SubTotal";
                dgvItems.Columns["Discount"].HeaderText = "Discount";
                dgvItems.Columns["AmountPaid"].HeaderText = "Amt. Paid";
                dgvItems.Columns["Credit"].HeaderText = "Credit";
                dgvItems.Columns["CreditPaid"].HeaderText = "Credit Paid";
                dgvItems.Columns["Balance"].HeaderText = "Balance";

                dgvItems.Columns["SubTotal"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Discount"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["AmountPaid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Discount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["AmountPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Discount"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["AmountPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Credit"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Balance"].DefaultCellStyle.Format = "#,##0.#0";

                dgvItems.ReadOnly = true;
                dgvItems.Select();

			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); 
			}
		}
        private void LoadPurchases()
        {
            try
            {
                DateTime dteRetValue = DateTime.MinValue;
                DateTime dtePaymentDateFrom = DateTime.MinValue;    // DateTime.TryParse(txtTrxStartDate.Text + " 00:00:00", out dteRetValue) ? dteRetValue : DateTime.Now.AddYears(-2);
                DateTime dtePaymentDateTo = DateTime.MinValue;      //DateTime.TryParse(txtTrxEndDate.Text + " 23:59:59", out dteRetValue) ? dteRetValue : DateTime.Now;

                Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
                System.Data.DataTable dt;

                switch (SysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dt = clsTransactions.ListForPaymentDataTable(mContactDetails.ContactID, "Balance, TransactionID", System.Data.SqlClient.SortOrder.Descending);
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dt = clsTransactions.ListForPaymentDataTable(mContactDetails.ContactID, "TransactionNo", System.Data.SqlClient.SortOrder.Ascending, 0, dtePaymentDateFrom, dtePaymentDateTo);
                        break;
                }
                //Data.Billing clsBilling = new Data.Billing(clsTransactions.Connection, clsTransactions.Transaction);
                //Data.BillingDetails clsBillingDetails = clsBilling.Details(mclsCustomerDetails.ContactID, false);

                clsTransactions.CommitAndDispose();

                dgvItems.MultiSelect = true;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize = false;
                dgvItems.DataSource = dt.TableName;
                dgvItems.DataSource = dt;

                foreach (DataGridViewTextBoxColumn dc in dgvItems.Columns)
                {
                    dc.Visible = false;
                }
                dgvItems.Columns["TransactionNo"].Visible = true;
                dgvItems.Columns["TransactionDate"].Visible = true;
                switch (SysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dgvItems.Columns["CreditReason"].Visible = true;
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].Visible = true;
                        dgvItems.Columns["ModeOfTermsCode"].Visible = true;
                        dgvItems.Columns["AgingDate"].Visible = true;
                        dgvItems.Columns["AgeTerms"].Visible = true;
                        break;
                }
                //
                dgvItems.Columns["SubTotal"].Visible = true;
                dgvItems.Columns["Credit"].Visible = true;
                dgvItems.Columns["CreditPaid"].Visible = true;
                dgvItems.Columns["Balance"].Visible = true;

                dgvItems.Columns["TransactionNo"].Width = 120;
                dgvItems.Columns["TransactionDate"].Width = 120;
                // do an override
                int iWidth = 100;
                switch (SysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        if (dt.Rows.Count < 14) dgvItems.Columns["CreditReason"].Width = 240; else dgvItems.Columns["CreditReason"].Width = 210;
                        iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width - dgvItems.Columns["CreditReason"].Width) / 4;
                        if (dt.Rows.Count >= 14) iWidth = iWidth - 5;

                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].Width = 60;
                        dgvItems.Columns["ModeOfTermsCode"].Width = 75;
                        dgvItems.Columns["AgingDate"].Width = 120;
                        if (dt.Rows.Count < 14) dgvItems.Columns["AgeTerms"].Width = 90; else dgvItems.Columns["AgeTerms"].Width = 60;

                        iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width - dgvItems.Columns["Terms"].Width - dgvItems.Columns["ModeOfTermsCode"].Width - dgvItems.Columns["AgingDate"].Width - dgvItems.Columns["AgeTerms"].Width) / 4;
                        if (dt.Rows.Count >= 14) iWidth = iWidth - 5;
                        break;
                }
                dgvItems.Columns["SubTotal"].Width = iWidth;
                dgvItems.Columns["Credit"].Width = iWidth;
                dgvItems.Columns["CreditPaid"].Width = iWidth;
                dgvItems.Columns["Balance"].Width = iWidth;

                dgvItems.Columns["TransactionNo"].HeaderText = "Trans. No";
                dgvItems.Columns["TransactionDate"].HeaderText = "Trans. Date";
                switch (SysConfigDetails.CreditPaymentType)
                {
                    case CreditPaymentType.Houseware:
                        dgvItems.Columns["CreditReason"].HeaderText = "Description";
                        break;
                    case CreditPaymentType.MPC:
                    case CreditPaymentType.Normal:
                    default:
                        dgvItems.Columns["Terms"].HeaderText = "Terms";
                        dgvItems.Columns["ModeOfTermsCode"].HeaderText = "ModeOfTerms";
                        dgvItems.Columns["AgingDate"].HeaderText = "AgingDate";
                        dgvItems.Columns["AgeTerms"].HeaderText = "Age";

                        dgvItems.Columns["Terms"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["Terms"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["Terms"].DefaultCellStyle.Format = "#,##0";

                        dgvItems.Columns["AgingDate"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm tt";

                        dgvItems.Columns["AgeTerms"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["AgeTerms"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvItems.Columns["AgeTerms"].DefaultCellStyle.Format = "#,##0";
                        break;
                }
                dgvItems.Columns["SubTotal"].HeaderText = "Subtotal";
                dgvItems.Columns["Credit"].HeaderText = "Credit";
                dgvItems.Columns["CreditPaid"].HeaderText = "Credit Paid";
                dgvItems.Columns["Balance"].HeaderText = "Balance";

                dgvItems.Columns["SubTotal"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["TransactionDate"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm tt";
                dgvItems.Columns["SubTotal"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Credit"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Balance"].DefaultCellStyle.Format = "#,##0.#0";

                dgvItems.ReadOnly = true;
                dgvItems.Select();
                //Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
                //System.Data.DataTable dt = clsTransactions.ListForPaymentDataTable(mContactDetails.ContactID);
                //clsTransactions.CommitAndDispose();

                //dgvItems.MultiSelect = true;
                //dgvItems.AutoGenerateColumns = true;
                //dgvItems.AutoSize = false;
                //dgvItems.DataSource = dt.TableName;
                //dgvItems.DataSource = dt;

                //foreach (DataGridViewTextBoxColumn dc in dgvItems.Columns)
                //{
                //    dc.Visible = false;
                //}
                //dgvItems.Columns["TransactionNo"].Visible = true;
                //dgvItems.Columns["TransactionDate"].Visible = true;
                //dgvItems.Columns["CreditReason"].Visible = true;
                //dgvItems.Columns["SubTotal"].Visible = true;
                //dgvItems.Columns["Credit"].Visible = true;
                //dgvItems.Columns["CreditPaid"].Visible = true;
                //dgvItems.Columns["Balance"].Visible = true;

                //dgvItems.Columns["TransactionNo"].Width = 120;
                //dgvItems.Columns["TransactionDate"].Width = 120;
                //if (dt.Rows.Count < 8) dgvItems.Columns["CreditReason"].Width = 240; else dgvItems.Columns["CreditReason"].Width = 210;
                //int iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width - dgvItems.Columns["CreditReason"].Width) / 4;
                //if (dt.Rows.Count >= 8) iWidth = iWidth - 5;
                //dgvItems.Columns["SubTotal"].Width = iWidth;
                //dgvItems.Columns["Credit"].Width = iWidth;
                //dgvItems.Columns["CreditPaid"].Width = iWidth;
                //dgvItems.Columns["Balance"].Width = iWidth;

                //dgvItems.Columns["TransactionNo"].HeaderText = "Trans. No";
                //dgvItems.Columns["TransactionDate"].HeaderText = "Trans. Date";
                //dgvItems.Columns["CreditReason"].HeaderText = "Description";
                //dgvItems.Columns["SubTotal"].HeaderText = "Subtotal";
                //dgvItems.Columns["Credit"].HeaderText = "Credit";
                //dgvItems.Columns["CreditPaid"].HeaderText = "Credit Paid";
                //dgvItems.Columns["Balance"].HeaderText = "Balance";

                //dgvItems.Columns["SubTotal"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["Credit"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["CreditPaid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["Balance"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

                //dgvItems.Columns["SubTotal"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["Credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["CreditPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                //dgvItems.Columns["Balance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

                //dgvItems.Columns["TransactionDate"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm tt";
                //dgvItems.Columns["SubTotal"].DefaultCellStyle.Format = "#,##0.#0";
                //dgvItems.Columns["Credit"].DefaultCellStyle.Format = "#,##0.#0";
                //dgvItems.Columns["CreditPaid"].DefaultCellStyle.Format = "#,##0.#0";
                //dgvItems.Columns["Balance"].DefaultCellStyle.Format = "#,##0.#0";

                //dgvItems.ReadOnly = true;
                //dgvItems.Select();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
        private void LoadData()
        {
            try
            {
                Data.SalesTransactions clsTransactions = new Data.SalesTransactions();
                System.Data.DataTable  dt = clsTransactions.ListForPaymentDataTable(mclsCustomerDetails.ContactID);

                clsTransactions.CommitAndDispose();

                dgvItems.MultiSelect         = true;
                dgvItems.AutoGenerateColumns = true;
                dgvItems.AutoSize            = false;
                dgvItems.DataSource          = dt.TableName;
                dgvItems.DataSource          = dt;

                dgvItems.Columns["TransactionID"].Visible = false;
                dgvItems.Columns["PaxNo"].Visible         = false;
                dgvItems.Columns["CustomerID"].Visible    = false;
                dgvItems.Columns["CustomerName"].Visible  = false;
                dgvItems.Columns["ItemsDiscount"].Visible = false;

                dgvItems.Columns["TransactionNo"].Width   = 250;
                dgvItems.Columns["TransactionDate"].Width = 120;
                int iWidth = (dgvItems.Width - dgvItems.Columns["TransactionNo"].Width - dgvItems.Columns["TransactionDate"].Width) / 6;
                dgvItems.Columns["SubTotal"].Width   = iWidth;
                dgvItems.Columns["Discount"].Width   = iWidth;
                dgvItems.Columns["AmountPaid"].Width = iWidth;
                dgvItems.Columns["Credit"].Width     = iWidth;
                dgvItems.Columns["CreditPaid"].Width = iWidth;
                dgvItems.Columns["Balance"].Width    = iWidth;

                dgvItems.Columns["TransactionNo"].HeaderText   = "Trans. No";
                dgvItems.Columns["TransactionDate"].HeaderText = "Trans. Date";
                dgvItems.Columns["SubTotal"].HeaderText        = "SubTotal";
                dgvItems.Columns["Discount"].HeaderText        = "Discount";
                dgvItems.Columns["AmountPaid"].HeaderText      = "Amt. Paid";
                dgvItems.Columns["Credit"].HeaderText          = "Credit";
                dgvItems.Columns["CreditPaid"].HeaderText      = "Credit Paid";
                dgvItems.Columns["Balance"].HeaderText         = "Balance";

                dgvItems.Columns["SubTotal"].HeaderCell.Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Discount"].HeaderCell.Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["AmountPaid"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].HeaderCell.Style.Alignment     = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].HeaderCell.Style.Alignment    = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Alignment   = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Discount"].DefaultCellStyle.Alignment   = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["AmountPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Credit"].DefaultCellStyle.Alignment     = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dgvItems.Columns["Balance"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;

                dgvItems.Columns["SubTotal"].DefaultCellStyle.Format   = "#,##0.#0";
                dgvItems.Columns["Discount"].DefaultCellStyle.Format   = "#,##0.#0";
                dgvItems.Columns["AmountPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Credit"].DefaultCellStyle.Format     = "#,##0.#0";
                dgvItems.Columns["CreditPaid"].DefaultCellStyle.Format = "#,##0.#0";
                dgvItems.Columns["Balance"].DefaultCellStyle.Format    = "#,##0.#0";

                dgvItems.ReadOnly = true;
                dgvItems.Select();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }