Ejemplo n.º 1
0
        //check of bestelling leverdatum vandaag is want dan word status veranderd
        private void checkBestellingen()
        {
            foreach (DataGridViewRow row in dgvOverzicht.Rows)
            {
                bestelling.id = (int)row.Cells[0].Value;
                BestellingDb.ophalen(bestelling);

                if (bestelling.leverdatum == DateTime.Today && bestelling.status == "Wachten op levering.")
                {
                    bestelling.status = "Boek is gedrukt.";
                    BestellingDb.wijzigen(bestelling);
                    vulDgOverzicht();
                }
            }
        }
Ejemplo n.º 2
0
        private void picKassa_Click(object sender, EventArgs e)
        {
            bestelling.status = "Voltooid";
            BestellingDb.wijzigen(bestelling);
            submain.dgvOverzichtClick(true);
            submain.vulDgOverzicht();
            submain.dgvOverzicht.Rows[submain.selectierow].Selected = true;
            submain.dgvOverzichtClick(true);

            Logging logging = new Logging();

            logging.onderwerp        = "Bestelling";
            logging.handeling        = "Status gewijzigd";
            logging.datum            = DateTime.Now;
            logging.medewerker_id    = Account.getMedewerker().id;
            logging.bestelling_id    = bestelling.id;
            logging.boek_isbn_nummer = "";

            LoggingDb.aanmaken(logging);
        }
Ejemplo n.º 3
0
        private void btnAnnuleren_Click(object sender, EventArgs e)
        {
            if (selectieId != "")
            {
                bestelling.id = Convert.ToInt32(selectieId);
                bestelling    = BestellingDb.ophalen(bestelling);

                if (bestelling.leverdatum != DateTime.Today && bestelling.leverdatum > DateTime.Today)
                {
                    DialogResult dialogResult = MessageBox.Show("Weet u zeker dat u wilt Annuleren: \r\n\r\n Bestelnummer: " + bestelling.id + ". \r\n " + bestelling.besteldatum, "BESTELLING ANNULEREN", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (dialogResult == DialogResult.Yes)
                    {
                        bestelling.status = "Geannuleerd";
                        BestellingDb.wijzigen(bestelling);
                        vulDgOverzicht();
                        dgvOverzicht.Rows[selectierow].Selected = true;
                        dgvOverzichtClick(true);

                        Logging logging = new Logging();
                        logging.onderwerp        = "Bestelling";
                        logging.handeling        = "Geannuleerd";
                        logging.datum            = DateTime.Now;
                        logging.medewerker_id    = Account.getMedewerker().id;
                        logging.bestelling_id    = bestelling.id;
                        logging.boek_isbn_nummer = "";

                        LoggingDb.aanmaken(logging);
                    }
                }
                else
                {
                    DialogResult dialogResult = MessageBox.Show("U kunt deze bestelling niet annuleren. \r\n\r\n Het boek is al gedrukt.", "BESTELLING ANNULEREN", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("U moet een bestelling selecteren om deze te kunnen annuleren.", "BESTELLING ANNULEREN", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        //methode om bestelling aan te maken :
        private void bestellen()
        {
            Cursor.Current         = Cursors.WaitCursor;
            bestelling.besteldatum = datum;
            bestelling.klant_id    = klant.id;

            string strDatum     = "";
            string omschrijving = "";
            string aantal       = "";
            string prijs        = "";
            string totaalPrijs  = "";

            foreach (DataGridViewRow row in dgvBoeken.Rows)
            {
                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dgvBoeken.Rows[row.Index].Cells[1];

                if ((bool)checkbox.EditedFormattedValue)
                {
                    strDatum     += datum.AddDays(3).ToString("dd/MM/yyyy") + "\v";
                    omschrijving += row.Cells[4].Value + "\v";
                    aantal       += row.Cells[0].Value + "\v";
                    totaalPrijs  += row.Cells[2].Value + "\v";
                    prijs        += "€" + row.Cells[7].Value + "\v";
                }
            }

            BestellingDb.aanmaken(bestelling);

            bestelling.id = BestellingDb.GetLaatsteBestelling();

            Factuur factuur = new Factuur();

            bestelling.factuur = factuur.aanmaken(klant, BedrijfsinformatieDb.ophalen(), bestelling, strDatum, omschrijving, aantal, prijs, totaalPrijs, lblPrijs.Text);

            BestellingDb.wijzigen(bestelling);

            foreach (DataGridViewRow row in dgvBoeken.Rows)
            {
                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dgvBoeken.Rows[row.Index].Cells[1];

                if ((bool)checkbox.EditedFormattedValue)
                {
                    bestellingregel.bestelling_id    = bestelling.id;
                    bestellingregel.boek_isbn_nummer = Convert.ToString(row.Cells[3].Value);
                    bestellingregel.aantal           = Convert.ToInt32(row.Cells[0].Value);
                    BestellingregelDB.aanmaken(bestellingregel);

                    Boekvoorraad voorraad = new Boekvoorraad();
                    voorraad.boek_isbn_nummer = bestellingregel.boek_isbn_nummer;

                    if (bestellingregel.aantal > Convert.ToInt32(row.Cells[6].Value))
                    {
                        voorraad.aantal = 0;
                    }
                    else
                    {
                        voorraad.aantal = Convert.ToInt32(row.Cells[6].Value) - bestellingregel.aantal;
                    }
                    BoekvoorraadDb.wijzigen(voorraad);
                }
            }

            Mail mail = new Mail();

            mail.mailAanmaken(klant, bestelling, bestelling.factuur);

            submain.vulDgOverzicht();
            submain.dgvOverzicht.Rows[0].Selected = true;
            submain.dgvOverzichtClick();

            Logging logging = new Logging();

            logging.onderwerp        = "Bestelling";
            logging.handeling        = "Aangemaakt";
            logging.datum            = DateTime.Now;
            logging.medewerker_id    = Account.getMedewerker().id;
            logging.bestelling_id    = bestelling.id;
            logging.boek_isbn_nummer = "";

            LoggingDb.aanmaken(logging);
        }