Example #1
0
 /// <summary>
 /// Controlleert of er al een lopende bestelling draait
 /// Zo ja, pak 't ID van de bestelling en ga daar mee verder
 /// Zo nee, maak een nieuwe bestelling aan en pak het ID hiervan
 /// </summary>
 private void InitBestelId()
 {
     if (bestellingDAO.OpenstaandeBestelling(tafelId))
     {
         bestelId = bestellingDAO.GetBestelIdFromTafel(tafelId);
     }
     else
     {
         bestellingDAO.CreateNewBestelling(personeelId, tafelId);
         bestelId = bestellingDAO.GetBestelIdFromTafel(tafelId);
     }
 }
Example #2
0
        /// <summary>
        /// Het afrekenscherm
        /// </summary>
        public Afrekenen(int tafelId)
        {
            InitializeComponent();

            this.tafelId = tafelId;

            this.bestellingDao = DataHelper.BestellingDao;
            this.productDao    = DataHelper.ProductDao;

            bestelId = bestellingDao.GetBestelIdFromTafel(tafelId);

            List <BestelRegel> rekeningRegels = bestellingDao.GetRekening(bestelId);

            label1.Text = "Tafel " + tafelId;

            decimal totaalPrijs = 0;
            decimal totaalBtw   = 0;

            foreach (BestelRegel rekeningRegel in rekeningRegels)
            {
                Product product = productDao.GetProductById(rekeningRegel.ProductId);

                int     aantal     = rekeningRegel.Aantal;
                decimal prijs      = product.Prijs;
                decimal regelPrijs = aantal * prijs;

                listBox1.Items.Add(product.Naam);
                listBox2.Items.Add(aantal.ToString());
                listBox3.Items.Add(regelPrijs.ToString());

                totaalPrijs += regelPrijs;
                decimal btw = Math.Ceiling(product.BerekenBTW * 100) / 100;
                totaalBtw += (btw * aantal);
            }

            // ----- Form changes ----- //
            totaalTxt.Text = "Totaal: " + totaalPrijs;
            btwTxt.Text    = "BTW: " + totaalBtw.ToString("0.00");

            listBox1.Height = listBox1.PreferredHeight;
            listBox2.Height = listBox2.PreferredHeight;
            listBox3.Height = listBox3.PreferredHeight;

            //set panel height Listbox + BTW and Totaal labels(50px)
            panel1.Height = listBox1.Height + 50;

            //set max panel Height
            if (panel1.Height > 330)
            {
                panel1.Height = 330;
                //set other padding for labels because of the vertical scrollbar
                totaalTxt.Padding = new Padding(0, 0, 8, 0);
                btwTxt.Padding    = new Padding(0, 9, 8, 0); //9top for space between listbox and label
            }
        }