Solved

How should I structure my array list for multiple inputs for a Windows Application using VS 2008 C#?

Posted on 2008-10-20
18
386 Views
Last Modified: 2011-09-20
I am trying to develop a simple program. What is the best way to set up my array list in code for a Windows Application Form and C# to let a user enter Amounts of items and then calculate the total sum plus tax and then put in an amount paid. Then be able to put the sale summary in a rich text box. Then put the daily summary in a rich text box. Thank you for any help!
0
Comment
Question by:jpmc_cmsops
  • 12
  • 6
18 Comments
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 22763221
You should clarify the task. Wha't the purpose of the arraylist in your program? What are you going to store in it? may be item prices (for different items).? Anything else?
Anyway, I have couple of comments.
First, I'd recomment to use generic lists: Syste.Collections.Generics.List.
Second, if you want to store prices for different items (e.g.) you'd better to have a special class Item with some public fields like Name, Description, Price etc. And store these items in the list. You may use the list to populate a combobox or dropdownlist for user to select an item. When you select an item and enter a number of items - you may do any calculations.
0
 

Author Comment

by:jpmc_cmsops
ID: 22763719
Thanks for the help. I have included my code smippets below; please advise if you can.

/*  This program should be able to:
 *   Input an order
 *  Compute the order amount
 *  Compute salestax
 *  Compute amount due
 *  Display order amount, sales tax, amount due
 *  Input amount paid
 *  Compute and display change due
 *  Allow the user to view all the orders placed and a summary of sales for the day
 *  (Cokes and Pizzas, total number and $$ amount, and average sale at a minimum.)
*/

Thank you in advance.
// Program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Windows.Forms;
 

namespace POSForPizzaAndCoke

{

    static class Program

    {

        /// <summary>

        /// The main entry point for the application.

        /// </summary>

        [STAThread]

        static void Main()

        {

            ArrayList allDailySummary = new ArrayList();

            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new frmPosPizzaCoke());

        }

    }

}
 

// frmPosPizzaCoke.cs

/*  This program should be able to:

 *  Input an order 

 *  Compute the order amount 

 *  Compute salestax 

 *  Compute amount due

 *  Display order amount, sales tax, amount due

 *  Input amount paid

 *  Compute and display change due

 *  Allow the user to view all the orders placed and a summary of sales for the day 

 *  (Cokes and Pizzas, total number and $$ amount, and average sale at a minimum.) 

 * 

 * 

 * 

 * 

 */
 
 

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;
 

namespace POSForPizzaAndCoke

{

    public partial class frmPosPizzaCoke : Form

    {

        double pizzaAmt;

        double cokeAmt;

        double pizzaCokeSalesAmtSum;

        double salesTaxAmtDue;

        double totalSalesAmountDue;

        

        

        public frmPosPizzaCoke()

        {

            InitializeComponent();

        }
 

        

        private void btnComputeAmnt_Click(object sender, EventArgs e)

        {

                        
 

            pizzaAmt = double.Parse((textBoxPizzaAmt.Text));

            cokeAmt = double.Parse((textBoxCokeAmt.Text));

            Order anOrder = new Order(pizzaAmt, cokeAmt);

            pizzaCokeSalesAmtSum = double.Parse((pizzaAmt * pizzaPrice) + (cokeAmt * cokePrice));

            salesTaxAmtDue = pizzaCokeSum * salesTaxRate;
 

            

            

            

        

        }

            
 
 

        private void btnTotalAmtDue_Click(object sender, EventArgs e)

        {
 

        }
 

        private void frmPosPiizzaCoke_Load(object sender, EventArgs e)

        {
 

        }
 

        private void btnPurchaseReceiptSum_Click(object sender, EventArgs e)

        {
 

        }
 

        private void txtBoxPurchaseReceiptSum_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void btnDisplayDailySummary_Click(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxDisplayDailySummary_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxPizzaAmt_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxCokeAmt_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxSalesTax_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxAmtDue_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxOrderAmt_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxAmtPaid_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxChangeDue_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void label1_Click(object sender, EventArgs e)

        {
 

        }
 

        private void textBox1_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void btnCompChngDue_Click(object sender, EventArgs e)

        {

            double amtPaid;

            double changeDue;

            

            amtPaid = double.Parse((textBoxAmtPaid.Text));

            changeDue = amtPaid - totalSalesAmountDue;

            textBoxSubAmtDue = pizzaCokeSalesAmtSum;

            textBoxSalesTaxDue = salesTaxAmtDue;

            textBoxTotalAmtDue = pizzaCokeSalesAmtSum + salesTaxAmtDue;

        }

 
 

        
 

        

    }

}
 
 

// DailySummary.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;
 

namespace POSForPizzaAndCoke.Problem_Domain

{

    class DailySummary

    {

        double numberOfCokes;

        double numberOfPizzas;

        double totalOfCokes;

        double totalOfPizzas;
 

        public DailySummary()

        {

        }
 

        // Array Declaration

        // ArrayList allDailySummary = new ArrayList();

        // int [,] pizzacoke = {{1, 1}, {10,10}};
 

        

        public void addOrder(Order aOrder)

        {

            allDailySummary.Add(aOrder);

        }
 

        public double orderCount()

        {

            return allDailySummary.Count;

        }
 
 

        public double orderList()

        {

            string outputString = "";

            foreach(Order aOrder in allDailySummary)

            {

                outputString += aOrder.ToString() + "\n";

            }

            return outputString;

        }

    }

}
 
 

// Order.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;
 

namespace POSForPizzaAndCoke.Problem_Domain

{

    public class Order

    {

        // Declaration of Variables        

        private const double pizzaPrice = 8.99d;

        private const double cokePrice = 0.99d;

        private const double salesTaxRate = 0.065d;
 

        private double pizzaSales;

        private double cokeSales;

        private double numberOfPizzas;

        private double numberOfCokes;

        private double numberOfTotalSalesAmountDue;

        private double salesTax;

        private double changeDue;

        private double amountPaid;

        double pizzaAmt;

        double cokeAmt;

        double pizzaCokeSalesAmtSum;

        double salesTaxAmtDue;

        double totalSalesAmountDue;

        

        // Constructor

        public Order()

        {

        }

        

        public override double ToString()

        {

            return this.PizzaSales + " " + this.CokeSales  ;

        }

        

        // Getters and Setters

        public double PizzaSales

        {

            

            set {numberOfPizzas = value;}

            get {return numberOfPizzas();}

           

        }

    

        public double CokeSales

        {

            

            set {numberOfCokes = value;}

            get {return numberOfCokes();}

        }
 

        

        private double InputOrder

        {

            
 

            set {numberOfPizzas = value;}

            get {return numberOfPizzas();}

            
 

            

            

        }
 
 

        public double GetTotalSalesAmountDue

        {

            set {totalSalesAmountDue = value;}

            get {return numberOfTotalSalesAmountDue();}

            

            /*

            pizzaAmt = double.Parse((textBoxPizzaAmt.Text));

            cokeAmt = double.Parse((textBoxCokeAmt.Text));

            Order anOrder = new Order(pizzaAmt, cokeAmt);

            pizzaCokeSalesAmtSum = double.Parse((pizzaAmt * pizzaPrice) + (cokeAmt * cokePrice));

            salesTaxAmtDue = pizzaCokeSum * salesTaxRate;

            totalSalesAmountDue = pizzaCokeSalesAmtSum + salesTax;

            return totalSalesAmountDue;

            */

        }
 

        public double GetChangeDue

        {

            

            changeDue = amountPaid - totalSalesAmountDue

            return changeDue;
 
 

        }

    }

}

Open in new window

0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 22770971
Yeah...
Sorry for silence - I was busy.
Lot of errors in your code - trying to fix. Will come back later.
0
 

Author Comment

by:jpmc_cmsops
ID: 22771443
Thank you.
0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 22773475
OK, I 'm posting my code. Unfortunately, I use VS2005 so no point to post the project. Just classes.
I have some additional textboxes and buttons - you may figure by names and createyourself.

All orders are put into a list bu the btnProcessOrder.
See class definitions in the snippets.

If you have questions - ask, I'll try to answer.
Basicly I fixed your code. It's not optimal of course...
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;
 

namespace POSForPizzaAndCoke

{

    public partial class frmPosPizzaCoke : Form

    {

        double pizzaAmt;

        double cokeAmt;

        double pizzaCokeSalesAmtSum;

        double salesTaxAmtDue;

        double totalSalesAmountDue;

        Order orderUnderProcessing = null;

        DailySummary summary = new DailySummary();

        

        

        public frmPosPizzaCoke()

        {

            InitializeComponent();

        }

 

 

 

 

        private void btnCompChngDue_Click(object sender, EventArgs e)

        {

            double amtPaid;

            double changeDue;

            

            amtPaid = double.Parse((textBoxAmtPaid.Text));

            changeDue = amtPaid - totalSalesAmountDue;

            textBoxSubAmtDue.Text = pizzaCokeSalesAmtSum.ToString();

            textBoxSalesTaxDue.Text = salesTaxAmtDue.ToString();

            textBoxTotalAmtDue.Text = (pizzaCokeSalesAmtSum + salesTaxAmtDue).ToString();

        }
 
 
 
 

        private double safeParsingMethod(TextBox tb)

        {

            double parsingResult;//out parameter
 

            while (!double.TryParse(tb.Text, out parsingResult)){

                MessageBox.Show("Please enter valid number to " + tb.Name);// customize message

                break;

            }

            return parsingResult;

        }
 
 
 

        private void btnComputeAmnt_Click(object sender, EventArgs e)

        {

            pizzaAmt = safeParsingMethod(textBoxPizzaAmt);// double.Parse((textBoxPizzaAmt.Text));

            cokeAmt = safeParsingMethod(textBoxCokeAmt);// double.Parse((textBoxCokeAmt.Text));

            orderUnderProcessing = new Order(pizzaAmt, cokeAmt);
 

            // use order functions to calculate

            pizzaCokeSalesAmtSum = orderUnderProcessing.GetPizzaCokeAmoutSum();

            salesTaxAmtDue = orderUnderProcessing.GetSalesTaxAmoutDue();

            totalSalesAmountDue = orderUnderProcessing.GetTotalAmountDue();

            // do you need to display these numbers?

            this.textBoxSubAmtDue.Text = pizzaCokeSalesAmtSum.ToString();// you might need formatting here

            this.textBoxSalesTaxDue.Text = salesTaxAmtDue.ToString();

            this.textBoxTotalAmtDue.Text = totalSalesAmountDue.ToString();
 

            // OK now wait for entering payed cash amount ...
 

        }

        private void btnCompChngDue_Click_1(object sender, EventArgs e)

        {

            double amtPaid = safeParsingMethod(textBoxAmtPaid);//double.Parse((textBoxAmtPaid.Text));

            double changeDue= amtPaid - totalSalesAmountDue;
 

            this.textBoxChangeDue.Text = changeDue.ToString();

            btnProcessOrder.Enabled = true; // ready to process order

        }
 

        private void btnProcessOrder_Click(object sender, EventArgs e)

        {

            // here we "confirm " the order and put it to the summary

            summary.addOrder(this.orderUnderProcessing);

            // "print" receipt if necessary
 
 
 

            // add the 

        }
 

        private void btnShowSummary_Click(object sender, EventArgs e)

        {

            MessageBox.Show(this.summary.GetOrdersSummary());

        }

    }

    

}
 

============================================================
 

using System;

using System.Collections.Generic;

using System.Text;
 

namespace POSForPizzaAndCoke

{

        public class DailySummary

        {
 

            List<Order> allDailySummary;
 

            public DailySummary()

            {

                allDailySummary = new List<Order>();

            }
 

            public void addOrder(Order aOrder)

            {

                allDailySummary.Add(aOrder);

            }
 

            public double orderCount()

            {

                return allDailySummary.Count;

            }
 
 

            public string orderList()

            {

                string outputString = "";

                foreach (Order aOrder in allDailySummary)

                {

                    outputString += aOrder.ToString() + "\n";

                }

                return outputString;

            }
 

            public string GetOrdersSummary()

            {

                string summStr = "";

                summStr+="Number of orders" + this.orderCount() + Environment.NewLine + Environment.NewLine;

                double total = 0;

                for (int i = 0; i < this.allDailySummary.Count; i++)

                {

                    Order curr = allDailySummary[i];

                    summStr += "" + i + ". Pizza Q-ty = " + curr.PizzaSales + "; Coke Q-ty = " + curr.CokeSales + Environment.NewLine;

                    total += curr.GetTotalAmountDue();

                }
 

                summStr += Environment.NewLine;

                summStr += "Total sales sum: $" + total;
 

                return summStr;

            }

        }

    }
 
 

=========================================================
 

using System;

using System.Collections.Generic;

using System.Text;
 

namespace POSForPizzaAndCoke

{

    public class Order

    {

        // Declaration of Variables        

        public const double pizzaPrice = 8.99d;

        public const double cokePrice = 0.99d;

        public const double salesTaxRate = 0.065d;

 
 

        double pizzaAmt;

        double cokeAmt;
 

        

        // Constructor

        public Order(double pa, double ca)

        {

            pizzaAmt = pa;

            cokeAmt = ca;

        }

        

        public override string ToString()

        {

            return this.PizzaSales.ToString() + " " + this.CokeSales.ToString();

        }

        

        // Getters and Setters

        public double PizzaSales

        {
 

            get { return pizzaAmt; }

           

        }

    

        public double CokeSales

        {

            get { return cokeAmt; }

        }
 
 
 
 

        public double GetPizzaCokeAmoutSum()

        {

            return this.cokeAmt * cokePrice + this.pizzaAmt * pizzaPrice;

        }
 

        public double GetSalesTaxAmoutDue()

        {

            return GetPizzaCokeAmoutSum() * salesTaxRate;

        }
 

        public double GetTotalAmountDue()

        {

            return GetPizzaCokeAmoutSum() + GetSalesTaxAmoutDue();

        }

    }

}

Open in new window

0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 22773483
Ahha, forgot...

You may add a new button - btnStartNewOrder (e.g).
When click - clear all text fields and set current order to null..
0
 

Author Comment

by:jpmc_cmsops
ID: 22782844
Anarki,
Thank you very much for the great help so far.

I have it working except for the "Daily Summary" so I can show each sale that is stored in the Array.

I will attach all of my code and maybe you could explain how to make that part work where I can print out what is in the array for the Daily Summary, or please explain how I can do that. Thank you in advance!

I have also attached my form code too to help you.
Could you also explain how to use the Button Process Order too a little more?

Thank you again for your help!
Attached Code Below:
using System;

using System.Collections;

using System.Collections.Generic;

using System.Text;
 

namespace POSForPizzaAndCoke

{

    public class DailySummary

    {
 

        List<Order> allDailySummary;
 

        public DailySummary()

        {

            allDailySummary = new List<Order>();

        }
 

        public void addOrder(Order aOrder)

        {

            allDailySummary.Add(aOrder);

        }
 

        public double orderCount()

        {

            return allDailySummary.Count;

        }
 
 

        public string orderList()

        {

            string outputString = "";

            foreach (Order aOrder in allDailySummary)

            {

                outputString += aOrder.ToString() + "\n";

            }

            return outputString;

        }
 

        public string GetOrdersSummary()

        {

            string summStr = "";

            summStr += "Number of orders" + this.orderCount() + Environment.NewLine + Environment.NewLine;

            double total = 0;

            for (int i = 0; i < this.allDailySummary.Count; i++)

            {

                Order curr = allDailySummary[i];

                summStr += "" + i + ". Pizza Q-ty = " + curr.PizzaSales + "; Coke Q-ty = " + curr.CokeSales + Environment.NewLine;

                total += curr.GetTotalAmountDue();

            }
 

            summStr += Environment.NewLine;

            summStr += "Total sales sum: $" + total;
 

            return summStr;

        }

    }

}
 
 

======================================================================
 
 

using System;

using System.Collections.Generic;

using System.Text;
 

namespace POSForPizzaAndCoke

{

    public class Order

    {

        // Declaration of Variables        

        public const double PIZZA_PRICE = 8.99d;

        public const double COKE_PRICE = 0.99d;

        public const double SALES_TAX_RATE = 0.065d;
 
 

        double pizzaAmt;

        double cokeAmt;
 
 

        // Constructor

        public Order(double pa, double ca)

        {

            pizzaAmt = pa;

            cokeAmt = ca;

        }
 

        public override string ToString()

        {

            return this.PizzaSales.ToString() + " " + this.CokeSales.ToString();

        }
 

        // Getters and Setters

        public double PizzaSales

        {
 

            get { return pizzaAmt; }
 

        }
 

        public double CokeSales

        {

            get { return cokeAmt; }

        }
 
 
 
 

        public double GetPizzaCokeAmoutSum()

        {

            return this.cokeAmt * COKE_PRICE + this.pizzaAmt * PIZZA_PRICE;

        }
 

        public double GetSalesTaxAmoutDue()

        {

            return GetPizzaCokeAmoutSum() * SALES_TAX_RATE;

        }
 

        public double GetTotalAmountDue()

        {

            return GetPizzaCokeAmoutSum() + GetSalesTaxAmoutDue();

        }

    }

}
 

=======================================================================
 
 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;
 

namespace POSForPizzaAndCoke

{

    public partial class frmPosPizzaCoke : Form

    {

        double pizzaAmt;

        double cokeAmt;

        double pizzaCokeSalesAmtSum;

        double salesTaxAmtDue;

        double totalSalesAmountDue;

        POSForPizzaAndCoke.Order orderUnderProcessing = null;

        POSForPizzaAndCoke.DailySummary summary = new DailySummary();
 
 

        public frmPosPizzaCoke()

        {

            InitializeComponent();

        }
 
 
 
 

        private void btnCompChngDue_Click(object sender, EventArgs e)

        {

            double amtPaid;

            double changeDue;
 

            amtPaid = double.Parse((textBoxAmtPaid.Text));

            changeDue = amtPaid - totalSalesAmountDue;

            

            this.textBoxChangeDue.Text = changeDue.ToString("C");

        }
 
 
 
 

        private double safeParsingMethod(TextBox tb)

        {

            double parsingResult;//out parameter
 

            while (!double.TryParse(tb.Text, out parsingResult))

            {

                MessageBox.Show("Please enter valid number to " + tb.Name);// customize message

                break;

            }

            return parsingResult;

        }
 
 
 

        private void btnComputeAmnt_Click(object sender, EventArgs e)

        {

            pizzaAmt = safeParsingMethod(textBoxPizzaAmt);// double.Parse((textBoxPizzaAmt.Text));

            cokeAmt = safeParsingMethod(textBoxCokeAmt);// double.Parse((textBoxCokeAmt.Text));

            orderUnderProcessing = new Order(pizzaAmt, cokeAmt);
 

            // use order functions to calculate

            pizzaCokeSalesAmtSum = orderUnderProcessing.GetPizzaCokeAmoutSum();

            salesTaxAmtDue = orderUnderProcessing.GetSalesTaxAmoutDue();

            totalSalesAmountDue = orderUnderProcessing.GetTotalAmountDue();

            // do you need to display these numbers?

            this.textBoxSubAmtDue.Text = pizzaCokeSalesAmtSum.ToString("C");// you might need formatting here

            this.textBoxSalesTaxDue.Text = salesTaxAmtDue.ToString("C");

            this.textBoxTotalAmtDue.Text = totalSalesAmountDue.ToString("C");
 

            // OK now wait for entering payed cash amount ...
 

        }

         

        private void frmPosPizzaCoke_Load(object sender, EventArgs e)

        {
 

        }
 

            private void btnCompChngDue_Click_1(object sender, EventArgs e)

        {

            double amtPaid = safeParsingMethod(textBoxAmtPaid);//double.Parse((textBoxAmtPaid.Text));

            double changeDue= amtPaid - totalSalesAmountDue;

 

            this.textBoxChangeDue.Text = changeDue.ToString();

            // btnProcessOrder.Enabled = true; // ready to process order

        }

 

        private void btnProcessOrder_Click(object sender, EventArgs e)

        {

            // here we "confirm " the order and put it to the summary

            summary.addOrder(this.orderUnderProcessing);

            // "print" receipt if necessary

 

 

 

            // add the 

        }

 

        private void btnShowSummary_Click(object sender, EventArgs e)

        {

            MessageBox.Show(this.summary.GetOrdersSummary());

        }
 

        private void textBoxPizzaAmt_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void textBoxCokeAmt_TextChanged(object sender, EventArgs e)

        {
 

        }
 

        private void btnPurchaseReceiptSum_Click(object sender, EventArgs e)

        {

            this.richTextBoxDisplaySalesTotal.Text =

           "Order Summary: " + "\n"

           + pizzaAmt.ToString() + " Pizzas @ " + Order.PIZZA_PRICE + ":  " + (pizzaAmt * Order.PIZZA_PRICE).ToString("C") + "\n"

           + cokeAmt.ToString() + " Cokes @ " + Order.COKE_PRICE + ": " + (cokeAmt * Order.COKE_PRICE).ToString("C") + "\n"
 

           + "Sales Tax: " + salesTaxAmtDue.ToString("C") + "\n"

           + "Order Amount: " + totalSalesAmountDue.ToString("C") + "\n";
 

            this.txtBoxPurchaseReceiptSum.Text = "Pizza & Coke Sales Summary: " + pizzaCokeSalesAmtSum.ToString("C") + "\r\n"

                                                + "Sales Tax: " + salesTaxAmtDue.ToString("C") + "\r\n"

                                                + "Total Amount Due: " + totalSalesAmountDue.ToString("C") + "\r\n\r\n"

                                                + "Specials For the Day: " + "\r\n"

                                                + "Bread Sticks @ $1.00 / 6" + "\r\n"

                                                + "Chocolate Cinnamon Rolls @ $1.00 / 6" + "\r\n"

                                                + "Vanilla Ice Cream @ $2.00 / gal";

        }

    }

   

}
 
 

======================================================================
 
 

using System;

using System.Collections.Generic;

using System.Windows.Forms;
 

namespace NewPizzaCokePos

{

    static class Program

    {

        /// <summary>

        /// The main entry point for the application.

        /// </summary>

        [STAThread]

        static void Main()

        {

            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new POSForPizzaAndCoke.frmPosPizzaCoke());

        }

    }

}
 
 

======================================================================
 
 
 

namespace POSForPizzaAndCoke

{

    partial class frmPosPizzaCoke

    {

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;
 

        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }
 

        #region Windows Form Designer generated code
 

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

        {

            this.lblPizzaAmt = new System.Windows.Forms.Label();

            this.lblCokeAmt = new System.Windows.Forms.Label();

            this.textBoxPizzaAmt = new System.Windows.Forms.TextBox();

            this.textBoxCokeAmt = new System.Windows.Forms.TextBox();

            this.lblSalesTaxRate = new System.Windows.Forms.Label();

            this.textBoxSubAmtDue = new System.Windows.Forms.TextBox();

            this.lblAmtDue = new System.Windows.Forms.Label();

            this.textBoxAmtPaid = new System.Windows.Forms.TextBox();

            this.lblAmtPaid = new System.Windows.Forms.Label();

            this.lblChangeDue = new System.Windows.Forms.Label();

            this.textBoxChangeDue = new System.Windows.Forms.TextBox();

            this.btnComputeSubAmntDue = new System.Windows.Forms.Button();

            this.textBoxDisplayDailySummary = new System.Windows.Forms.TextBox();

            this.btnDisplayDailySummary = new System.Windows.Forms.Button();

            this.btnCompChngDue = new System.Windows.Forms.Button();

            this.btnPurchaseReceiptSum = new System.Windows.Forms.Button();

            this.txtBoxPurchaseReceiptSum = new System.Windows.Forms.TextBox();

            this.lblSalesTaxRateValue = new System.Windows.Forms.Label();

            this.lblTotalAmtDue = new System.Windows.Forms.Label();

            this.lblSalesTaxDue = new System.Windows.Forms.Label();

            this.textBoxTotalAmtDue = new System.Windows.Forms.TextBox();

            this.textBoxSalesTaxDue = new System.Windows.Forms.TextBox();

            this.buttonProcessOrder = new System.Windows.Forms.Button();

            this.richTextBoxDisplaySalesTotal = new System.Windows.Forms.RichTextBox();

            this.richTextBoxDailySummary = new System.Windows.Forms.RichTextBox();

            this.SuspendLayout();

            // 

            // lblPizzaAmt

            // 

            this.lblPizzaAmt.AutoSize = true;

            this.lblPizzaAmt.Location = new System.Drawing.Point(12, 35);

            this.lblPizzaAmt.Name = "lblPizzaAmt";

            this.lblPizzaAmt.Size = new System.Drawing.Size(91, 13);

            this.lblPizzaAmt.TabIndex = 0;

            this.lblPizzaAmt.Text = "Amount of Pizzas:";

            // 

            // lblCokeAmt

            // 

            this.lblCokeAmt.AutoSize = true;

            this.lblCokeAmt.Location = new System.Drawing.Point(11, 61);

            this.lblCokeAmt.Name = "lblCokeAmt";

            this.lblCokeAmt.Size = new System.Drawing.Size(91, 13);

            this.lblCokeAmt.TabIndex = 1;

            this.lblCokeAmt.Text = "Amount of Cokes:";

            // 

            // textBoxPizzaAmt

            // 

            this.textBoxPizzaAmt.Location = new System.Drawing.Point(158, 28);

            this.textBoxPizzaAmt.Name = "textBoxPizzaAmt";

            this.textBoxPizzaAmt.Size = new System.Drawing.Size(65, 20);

            this.textBoxPizzaAmt.TabIndex = 2;

            this.textBoxPizzaAmt.Text = "Enter Amt";

            this.textBoxPizzaAmt.TextChanged += new System.EventHandler(this.textBoxPizzaAmt_TextChanged);

            // 

            // textBoxCokeAmt

            // 

            this.textBoxCokeAmt.Location = new System.Drawing.Point(158, 54);

            this.textBoxCokeAmt.Name = "textBoxCokeAmt";

            this.textBoxCokeAmt.Size = new System.Drawing.Size(65, 20);

            this.textBoxCokeAmt.TabIndex = 3;

            this.textBoxCokeAmt.TextChanged += new System.EventHandler(this.textBoxCokeAmt_TextChanged);

            // 

            // lblSalesTaxRate

            // 

            this.lblSalesTaxRate.AutoSize = true;

            this.lblSalesTaxRate.Location = new System.Drawing.Point(11, 151);

            this.lblSalesTaxRate.Name = "lblSalesTaxRate";

            this.lblSalesTaxRate.Size = new System.Drawing.Size(83, 13);

            this.lblSalesTaxRate.TabIndex = 4;

            this.lblSalesTaxRate.Text = "Sales Tax Rate:";

            // 

            // textBoxSubAmtDue

            // 

            this.textBoxSubAmtDue.Location = new System.Drawing.Point(158, 118);

            this.textBoxSubAmtDue.Name = "textBoxSubAmtDue";

            this.textBoxSubAmtDue.Size = new System.Drawing.Size(65, 20);

            this.textBoxSubAmtDue.TabIndex = 7;

            // 

            // lblAmtDue

            // 

            this.lblAmtDue.AutoSize = true;

            this.lblAmtDue.Location = new System.Drawing.Point(11, 125);

            this.lblAmtDue.Name = "lblAmtDue";

            this.lblAmtDue.Size = new System.Drawing.Size(91, 13);

            this.lblAmtDue.TabIndex = 6;

            this.lblAmtDue.Text = "Sub Amount Due:";

            // 

            // textBoxAmtPaid

            // 

            this.textBoxAmtPaid.Location = new System.Drawing.Point(158, 306);

            this.textBoxAmtPaid.Name = "textBoxAmtPaid";

            this.textBoxAmtPaid.Size = new System.Drawing.Size(65, 20);

            this.textBoxAmtPaid.TabIndex = 11;

            // 

            // lblAmtPaid

            // 

            this.lblAmtPaid.AutoSize = true;

            this.lblAmtPaid.Location = new System.Drawing.Point(27, 313);

            this.lblAmtPaid.Name = "lblAmtPaid";

            this.lblAmtPaid.Size = new System.Drawing.Size(70, 13);

            this.lblAmtPaid.TabIndex = 10;

            this.lblAmtPaid.Text = "Amount Paid:";

            // 

            // lblChangeDue

            // 

            this.lblChangeDue.AutoSize = true;

            this.lblChangeDue.Location = new System.Drawing.Point(26, 396);

            this.lblChangeDue.Name = "lblChangeDue";

            this.lblChangeDue.Size = new System.Drawing.Size(70, 13);

            this.lblChangeDue.TabIndex = 12;

            this.lblChangeDue.Text = "Change Due:";

            // 

            // textBoxChangeDue

            // 

            this.textBoxChangeDue.Location = new System.Drawing.Point(158, 389);

            this.textBoxChangeDue.Name = "textBoxChangeDue";

            this.textBoxChangeDue.Size = new System.Drawing.Size(65, 20);

            this.textBoxChangeDue.TabIndex = 13;

            // 

            // btnComputeSubAmntDue

            // 

            this.btnComputeSubAmntDue.Location = new System.Drawing.Point(29, 90);

            this.btnComputeSubAmntDue.Name = "btnComputeSubAmntDue";

            this.btnComputeSubAmntDue.Size = new System.Drawing.Size(194, 22);

            this.btnComputeSubAmntDue.TabIndex = 14;

            this.btnComputeSubAmntDue.Text = "Compute Sub Amout Due";

            this.btnComputeSubAmntDue.UseVisualStyleBackColor = true;

            this.btnComputeSubAmntDue.Click += new System.EventHandler(this.btnComputeAmnt_Click);

            // 

            // textBoxDisplayDailySummary

            // 

            this.textBoxDisplayDailySummary.Location = new System.Drawing.Point(554, 61);

            this.textBoxDisplayDailySummary.Multiline = true;

            this.textBoxDisplayDailySummary.Name = "textBoxDisplayDailySummary";

            this.textBoxDisplayDailySummary.Size = new System.Drawing.Size(260, 119);

            this.textBoxDisplayDailySummary.TabIndex = 15;

            this.textBoxDisplayDailySummary.Text = "Display of Daily Summary\r\n400 Pizzas @ 8.99: $3596.00 \r\n500 Cokes @ .99: $495.00 " +

                "\r\nOrder Amount: $4091.00 \r\nSales Tax: $266.00 \r\nAmount Due: $4357.00 \r\nAmount Pa" +

                "id: $5000.00 \r\nChange Due: $643.00 \r\n";

            // 

            // btnDisplayDailySummary

            // 

            this.btnDisplayDailySummary.Location = new System.Drawing.Point(554, 27);

            this.btnDisplayDailySummary.Name = "btnDisplayDailySummary";

            this.btnDisplayDailySummary.Size = new System.Drawing.Size(260, 20);

            this.btnDisplayDailySummary.TabIndex = 16;

            this.btnDisplayDailySummary.Text = "Display Daily Summary";

            this.btnDisplayDailySummary.UseVisualStyleBackColor = true;

            // 

            // btnCompChngDue

            // 

            this.btnCompChngDue.Location = new System.Drawing.Point(27, 332);

            this.btnCompChngDue.Name = "btnCompChngDue";

            this.btnCompChngDue.Size = new System.Drawing.Size(196, 23);

            this.btnCompChngDue.TabIndex = 17;

            this.btnCompChngDue.Text = "Compute Change Due";

            this.btnCompChngDue.UseVisualStyleBackColor = true;

            this.btnCompChngDue.Click += new System.EventHandler(this.btnCompChngDue_Click);

            // 

            // btnPurchaseReceiptSum

            // 

            this.btnPurchaseReceiptSum.Location = new System.Drawing.Point(291, 27);

            this.btnPurchaseReceiptSum.Name = "btnPurchaseReceiptSum";

            this.btnPurchaseReceiptSum.Size = new System.Drawing.Size(230, 20);

            this.btnPurchaseReceiptSum.TabIndex = 18;

            this.btnPurchaseReceiptSum.Text = "Purchase Receipt Summary";

            this.btnPurchaseReceiptSum.UseVisualStyleBackColor = true;

            this.btnPurchaseReceiptSum.Click += new System.EventHandler(this.btnPurchaseReceiptSum_Click);

            // 

            // txtBoxPurchaseReceiptSum

            // 

            this.txtBoxPurchaseReceiptSum.Location = new System.Drawing.Point(291, 61);

            this.txtBoxPurchaseReceiptSum.Multiline = true;

            this.txtBoxPurchaseReceiptSum.Name = "txtBoxPurchaseReceiptSum";

            this.txtBoxPurchaseReceiptSum.Size = new System.Drawing.Size(230, 119);

            this.txtBoxPurchaseReceiptSum.TabIndex = 19;

            this.txtBoxPurchaseReceiptSum.Text = "Display of Purchase Summary\r\n4 Pizzas @ 8.99: $35.96 \r\n5 Cokes @ .99: $4.95 \r\nOrd" +

                "er Amount: $40.91 \r\nSales Tax: $2.66 \r\nAmount Due: $43.57 \r\nAmount Paid: $50.00 " +

                "\r\nChange Due: $6.43 \r\n";

            // 

            // lblSalesTaxRateValue

            // 

            this.lblSalesTaxRateValue.AutoSize = true;

            this.lblSalesTaxRateValue.Location = new System.Drawing.Point(113, 151);

            this.lblSalesTaxRateValue.Name = "lblSalesTaxRateValue";

            this.lblSalesTaxRateValue.Size = new System.Drawing.Size(110, 13);

            this.lblSalesTaxRateValue.TabIndex = 21;

            this.lblSalesTaxRateValue.Text = "Sales Tax Rate Value";

            // 

            // lblTotalAmtDue

            // 

            this.lblTotalAmtDue.AutoSize = true;

            this.lblTotalAmtDue.Location = new System.Drawing.Point(26, 226);

            this.lblTotalAmtDue.Name = "lblTotalAmtDue";

            this.lblTotalAmtDue.Size = new System.Drawing.Size(96, 13);

            this.lblTotalAmtDue.TabIndex = 22;

            this.lblTotalAmtDue.Text = "Total Amount Due:";

            // 

            // lblSalesTaxDue

            // 

            this.lblSalesTaxDue.AutoSize = true;

            this.lblSalesTaxDue.Location = new System.Drawing.Point(28, 188);

            this.lblSalesTaxDue.Name = "lblSalesTaxDue";

            this.lblSalesTaxDue.Size = new System.Drawing.Size(80, 13);

            this.lblSalesTaxDue.TabIndex = 24;

            this.lblSalesTaxDue.Text = "Sales Tax Due:";

            // 

            // textBoxTotalAmtDue

            // 

            this.textBoxTotalAmtDue.Location = new System.Drawing.Point(158, 219);

            this.textBoxTotalAmtDue.Name = "textBoxTotalAmtDue";

            this.textBoxTotalAmtDue.Size = new System.Drawing.Size(65, 20);

            this.textBoxTotalAmtDue.TabIndex = 23;

            // 

            // textBoxSalesTaxDue

            // 

            this.textBoxSalesTaxDue.Location = new System.Drawing.Point(158, 181);

            this.textBoxSalesTaxDue.Name = "textBoxSalesTaxDue";

            this.textBoxSalesTaxDue.Size = new System.Drawing.Size(65, 20);

            this.textBoxSalesTaxDue.TabIndex = 25;

            // 

            // buttonProcessOrder

            // 

            this.buttonProcessOrder.Location = new System.Drawing.Point(30, 362);

            this.buttonProcessOrder.Name = "buttonProcessOrder";

            this.buttonProcessOrder.Size = new System.Drawing.Size(124, 23);

            this.buttonProcessOrder.TabIndex = 26;

            this.buttonProcessOrder.Text = "Button Process Order";

            this.buttonProcessOrder.UseVisualStyleBackColor = true;

            // 

            // richTextBoxDisplaySalesTotal

            // 

            this.richTextBoxDisplaySalesTotal.Location = new System.Drawing.Point(291, 188);

            this.richTextBoxDisplaySalesTotal.Name = "richTextBoxDisplaySalesTotal";

            this.richTextBoxDisplaySalesTotal.Size = new System.Drawing.Size(230, 221);

            this.richTextBoxDisplaySalesTotal.TabIndex = 27;

            this.richTextBoxDisplaySalesTotal.Text = "";

            // 

            // richTextBoxDailySummary

            // 

            this.richTextBoxDailySummary.AcceptsTab = true;

            this.richTextBoxDailySummary.Location = new System.Drawing.Point(554, 185);

            this.richTextBoxDailySummary.Name = "richTextBoxDailySummary";

            this.richTextBoxDailySummary.Size = new System.Drawing.Size(260, 221);

            this.richTextBoxDailySummary.TabIndex = 28;

            this.richTextBoxDailySummary.Text = "";

            // 

            // frmPosPizzaCoke

            // 

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(836, 442);

            this.Controls.Add(this.richTextBoxDailySummary);

            this.Controls.Add(this.richTextBoxDisplaySalesTotal);

            this.Controls.Add(this.buttonProcessOrder);

            this.Controls.Add(this.textBoxSalesTaxDue);

            this.Controls.Add(this.lblSalesTaxDue);

            this.Controls.Add(this.textBoxTotalAmtDue);

            this.Controls.Add(this.lblTotalAmtDue);

            this.Controls.Add(this.lblSalesTaxRateValue);

            this.Controls.Add(this.txtBoxPurchaseReceiptSum);

            this.Controls.Add(this.btnPurchaseReceiptSum);

            this.Controls.Add(this.btnCompChngDue);

            this.Controls.Add(this.btnDisplayDailySummary);

            this.Controls.Add(this.textBoxDisplayDailySummary);

            this.Controls.Add(this.btnComputeSubAmntDue);

            this.Controls.Add(this.textBoxChangeDue);

            this.Controls.Add(this.lblChangeDue);

            this.Controls.Add(this.textBoxAmtPaid);

            this.Controls.Add(this.lblAmtPaid);

            this.Controls.Add(this.textBoxSubAmtDue);

            this.Controls.Add(this.lblAmtDue);

            this.Controls.Add(this.lblSalesTaxRate);

            this.Controls.Add(this.textBoxCokeAmt);

            this.Controls.Add(this.textBoxPizzaAmt);

            this.Controls.Add(this.lblCokeAmt);

            this.Controls.Add(this.lblPizzaAmt);

            this.Name = "frmPosPizzaCoke";

            this.Text = "Pizza and Coke POS Computer";

            this.ResumeLayout(false);

            this.PerformLayout();
 

        }
 

        #endregion
 

        private System.Windows.Forms.Label lblPizzaAmt;

        private System.Windows.Forms.Label lblCokeAmt;

        private System.Windows.Forms.TextBox textBoxPizzaAmt;

        private System.Windows.Forms.TextBox textBoxCokeAmt;

        private System.Windows.Forms.Label lblSalesTaxRate;

        private System.Windows.Forms.TextBox textBoxSubAmtDue;

        private System.Windows.Forms.Label lblAmtDue;

        private System.Windows.Forms.TextBox textBoxAmtPaid;

        private System.Windows.Forms.Label lblAmtPaid;

        private System.Windows.Forms.Label lblChangeDue;

        private System.Windows.Forms.TextBox textBoxChangeDue;

        private System.Windows.Forms.Button btnComputeSubAmntDue;

        private System.Windows.Forms.TextBox textBoxDisplayDailySummary;

        private System.Windows.Forms.Button btnDisplayDailySummary;

        private System.Windows.Forms.Button btnCompChngDue;

        private System.Windows.Forms.Button btnPurchaseReceiptSum;

        private System.Windows.Forms.TextBox txtBoxPurchaseReceiptSum;

        private System.Windows.Forms.Label lblSalesTaxRateValue;

        private System.Windows.Forms.Label lblTotalAmtDue;

        private System.Windows.Forms.Label lblSalesTaxDue;

        private System.Windows.Forms.TextBox textBoxTotalAmtDue;

        private System.Windows.Forms.TextBox textBoxSalesTaxDue;

        private System.Windows.Forms.Button buttonProcessOrder;

        private System.Windows.Forms.RichTextBox richTextBoxDisplaySalesTotal;

        private System.Windows.Forms.RichTextBox richTextBoxDailySummary;

    }

}

Open in new window

0
 

Author Comment

by:jpmc_cmsops
ID: 22782858
I am using VS 2005 also now to maybe make it easier to communicate.
0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 22783150
First, about the button "process order".

Yes, I was not aware about the scenario you was using so I used the following scenario:
-I enter quantity for cokes and pizzas
- then click "Compute Amount"
- then enter amount payed
- and click "Compute change"
-then (assume no changes required etc) we just confirm the order. In other words - we save the order in the array list (other possible scenarios - cancel the order). You may have different scenario, e.g. move this code into Compute Change button and just discard this one. But we need a place where we add the new order to the list.

In the "process order" i'd print a receipt (I didn't implement this - it should be easy).

I don't quite understand your question about how to print the daily summary.
It depends on your requirements.
Possible ways: display a separate form with a textbox and print the summary in it.

Another option - you may have a textbox on the main form and print in it - but I think it's a bad option. Another way is to save into a file - but still we need to display it somehow.

OK, let's think what information we may need to display? Number of orders? Number of pizzas and cokes sold? Total amout? Total tax amount?
Probably, we may use a separate form with a grid to dipspaly the information nicely. What do you think or what requirements are?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:jpmc_cmsops
ID: 22783298
For now I would like to just print the "Daily Dummary" to my Daily Summary Rich Text Box: "richTextBoxDailySummary"  when I hit the Display Daily Summary button: "btnDisplayDailySummary" on the Form.


Ultimately I will export it to an Excel Spreadsheet and a SQL Database but please don't worry about that now.
0
 

Author Comment

by:jpmc_cmsops
ID: 22783322
I would also like to confirm the order to the array when I compute Change Due.
Thank you.
0
 

Author Comment

by:jpmc_cmsops
ID: 22783339
What I would like to print a list of all of the orders and a Total Summary at the end;

This is the example for listing each order in the Summary: (This is just an example of one orders)
4 Pizzas @ 8.99: $35.96
5 Cokes @ .99: $4.95
Order Amount: $40.91
Sales Tax: $2.66
Amount Due: $43.57
Amount Paid: $50.00
Change Due: $6.43
================== Then the next order and so on...
4 Pizzas @ 8.99: $35.96
5 Cokes @ .99: $4.95
Order Amount: $40.91
Sales Tax: $2.66
Amount Due: $43.57
Amount Paid: $50.00
Change Due: $6.43
==========================================================

Then, if possible, I would also like to print a total summary (for example):

400 Pizzas @ 8.99: $3596.00
500 Cokes @ .99: $495.00
Order Amount: $4091.00
Sales Tax: $266.00
Amount Due: $4357.00
Amount Paid: $5000.00
Change Due: $643.00
0
 

Author Comment

by:jpmc_cmsops
ID: 22783341
Thank you again for your help.
0
 

Author Comment

by:jpmc_cmsops
ID: 22784719
I can now print out an ongoing summary by using "+=" for my display in my rich text box as shown below.

Could you help me print out the array Daily Summary into a separate form and
now can you help me try to print it to an Excel Spreadsheet and a database?

Thank you!
this.richTextBoxDisplaySalesTotal.Text +=

           "Order Summary: " + "\n"

           + pizzaAmt.ToString() + " Pizzas @ " + Order.PIZZA_PRICE + ":  " + (pizzaAmt * Order.PIZZA_PRICE).ToString("C") + "\n"

           + cokeAmt.ToString() + " Cokes @ " + Order.COKE_PRICE + ": " + (cokeAmt * Order.COKE_PRICE).ToString("C") + "\n"

Open in new window

0
 

Author Comment

by:jpmc_cmsops
ID: 22784968
If you could help me first print out the array showing the Daily Summary into a DataGridView in a separate pop up form after I hit a button, that would be great.

Then if you could possibly how to export or put it into an Excel Spreadsheet and then an MS Access or SQL Database that would be extremely helpful too. Thank you much for your help!
0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 22792382
OK, bit more help.

In the DailySummary I have added the following property:

            public List<Order> GetAllOrders()
            {
                return allDailySummary;
            }

I need to use this list in the grid form

On the main form I have a button to display a grid form:

        private void btnShowGridSummary_Click(object sender, EventArgs e)
        {
            SummaryGridForm frm = new SummaryGridForm(summary);
            frm.ShowDialog();
            frm.Close();
        }

So, now we need a form with a grid to display summary. See the snippet for a designer file and code file.

About confirming an order - I believe you are able to do it yourself - just display a messagebox with two buttons, like Confirm - Cancel, etc.


By the way, using this table from the grid form you may save data to Excel, xml, DB. Try to use a dataset.

Sorry, I can't help any more till next week.
Good luck

namespace POSForPizzaAndCoke

{

    partial class SummaryGridForm

    {

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;
 

        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }
 

        #region Windows Form Designer generated code
 

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

        {

            this.dataGridView1 = new System.Windows.Forms.DataGridView();

            this.button1 = new System.Windows.Forms.Button();

            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();

            this.SuspendLayout();

            // 

            // dataGridView1

            // 

            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                        | System.Windows.Forms.AnchorStyles.Left)

                        | System.Windows.Forms.AnchorStyles.Right)));

            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;

            this.dataGridView1.Location = new System.Drawing.Point(28, 30);

            this.dataGridView1.Name = "dataGridView1";

            this.dataGridView1.Size = new System.Drawing.Size(627, 189);

            this.dataGridView1.TabIndex = 0;

            // 

            // button1

            // 

            this.button1.Location = new System.Drawing.Point(192, 244);

            this.button1.Name = "button1";

            this.button1.Size = new System.Drawing.Size(263, 22);

            this.button1.TabIndex = 1;

            this.button1.Text = "Close";

            this.button1.UseVisualStyleBackColor = true;

            // 

            // SummaryGridForm

            // 

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(676, 273);

            this.Controls.Add(this.button1);

            this.Controls.Add(this.dataGridView1);

            this.Name = "SummaryGridForm";

            this.Text = "SummaryGridForm";

            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();

            this.ResumeLayout(false);
 

        }
 

        #endregion
 

        private System.Windows.Forms.DataGridView dataGridView1;

        private System.Windows.Forms.Button button1;

    }

}
 

//=======================================
 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;
 

namespace POSForPizzaAndCoke

{

    public partial class SummaryGridForm : Form

    {

        //private DailySummary dsummary;

        public SummaryGridForm(DailySummary summary)

        {

            InitializeComponent();

            //dsummary = summary;

            populateFridFromSummary(summary);

        }
 

        private void populateFridFromSummary(DailySummary summary){

            DataTable table = new DataTable();

            DataColumn col0 = new DataColumn("Pizza Qty", typeof(double));

            DataColumn col1 = new DataColumn("Pizza Price", typeof(double));

            DataColumn col2 = new DataColumn("Pizza Total", typeof(double));

            DataColumn col3 = new DataColumn("Coke Qty", typeof(double));

            DataColumn col4 = new DataColumn("Coke Price", typeof(double));

            DataColumn col5 = new DataColumn("Coke Total", typeof(double));

            DataColumn col6 = new DataColumn("Order Total", typeof(double));

            DataColumn col7 = new DataColumn("Tax", typeof(double));

            DataColumn col8 = new DataColumn("Grand Total", typeof(double));
 

            DataColumn[] cols = { col0, col1, col2, col3, col4, col5, col6, col7, col8 };

            table.Columns.AddRange(cols);

            foreach (Order ord in summary.GetAllOrders())

            {

                DataRow row = table.NewRow();

                row[0] = ord.PizzaSales;

                row[1] = Order.pizzaPrice;

                row[2] = ord.PizzaSales * Order.pizzaPrice;

                row[3] = ord.CokeSales;

                row[4] = Order.cokePrice;

                row[5] = ord.CokeSales * Order.cokePrice;

                row[6] = ord.GetPizzaCokeAmoutSum();

                row[7] = ord.GetSalesTaxAmoutDue();

                row[8] = ord.GetTotalAmountDue();

                table.Rows.Add(row);

            }

            this.dataGridView1.DataSource = table;

        }

    }

}

Open in new window

0
 

Author Comment

by:jpmc_cmsops
ID: 22793376
Thank you much! I appreciate all of your help! I will award you all the points please don't worry. I will try to talk to you next week.

If I need to ask you specific questions next week i will keep assigning more points to you if I can.

0
 

Author Closing Comment

by:jpmc_cmsops
ID: 31508085
Excellent help and vast resource of information! Thank you immensely
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now