Example #1
0
        private void frmPrijsberekening_Load(object sender, EventArgs e)
        {
            if (informatie != null)
            {
                txtAantalkm.Text        = informatie.aantalkm.ToString();
                cbbDagkost.SelectedItem = informatie.dagprijs_autocar;
                cbbKmprijs.SelectedItem = informatie.kmprijs_autocar;
                txtBTW.Text             = informatie.offerte_btw_bedrag.ToString();
                txtTotaal.Text          = informatie.offerte_totaal.ToString();
                txtWinstmarge.Text      = informatie.offerte_winst.ToString();
                txtVraagprijs.Text      = informatie.offerte_totaal.ToString();
                txtKostprijs.Text       = informatie.offerte_kostprijs.ToString();
                txtKorting.Text         = informatie.offerte_korting.ToString();

                foreach (kost kost in OfferteManagement.getKostenVanOfferte(informatie.opdracht_id))
                {
                    ucKost ucKost = new ucKost();
                    ucKost.omschrijving = kost.omschrijving;
                    ucKost.prijs        = kost.bedrag;

                    flpKosten.Controls.Add(ucKost);
                }

                foreach (loonsoort loonsoort in OfferteManagement.getLoonSoortenVanOfferte(informatie.opdracht_id))
                {
                    ucLoonSoort ucLoonSoort = new ucLoonSoort();
                    ucLoonSoort.loonsoort = loonsoort;
                    ucLoonSoort.dagen     = dagen.ToString();

                    flpLoonSoorten.Controls.Add(ucLoonSoort);
                }
            }
        }
Example #2
0
        void uco_OnSaveButtonclick(object sender, EventArgs e)
        {
            ucOfferteMini control        = (ucOfferteMini)sender;
            opdracht      updateOpdracht = control.opdracht;

            OfferteManagement.updateOfferteStatus(updateOpdracht.opdracht_id, control.openstaand);
        }
Example #3
0
        //Methode voor formulier in te vullen met de geselecteerde opdracht
        //Methode voor het "opslaan" van de info in de tabel opdracht
        private void btnOpslaan_Click(object sender, EventArgs e)
        {
            //validatie check voor opslaan
            if (Validation.hasValidationErrors(this.Controls))
            {
                return;
            }
            //als validatie geslaagd is
            opdracht geselecteerdeOpdracht = (opdracht)cbbID.SelectedItem;


            opdracht updatedInfo = InfoManagement.updateInfo(geselecteerdeOpdracht.opdracht_id,
                                                             txtPrijs.Text, dtVan.Value, dtTot.Value, txtRitboeknummer.Text,
                                                             txtRitbladnummer.Text, txtAantaldagen.Text, txtAantalpersonen.Text,
                                                             txtTotaalkm.Text, txtGeredenkm.Text, txtBeladenkm.Text, txtLedigekm.Text,
                                                             txtTotaalkm_buitenland.Text, txtKmDuitsland.Text, txtKmBinnenland.Text
                                                             , cbbVersteLand.SelectedText, txtNettoOntvangst.Text);

            foreach (ucKost ucKost in flpKosten.Controls)
            {
                kost kost = new kost();
                kost.bedrag       = ucKost.prijs;
                kost.omschrijving = ucKost.omschrijving;

                opdracht_kost ok = new opdracht_kost();
                ok.kost     = kost;
                ok.opdracht = updatedInfo;

                OfferteManagement.addKostBijOfferte(ok);
            }

            //Voor elke usercontrol ucVoertuigKiezer in flpVoertuigen een nieuwe voertuig link toevoegen aan de veel op veel tussentabel
            foreach (ucVoertuigKiezer voe in flpVoertuigen.Controls)
            {
                opdracht_voertuig ov = new opdracht_voertuig();
                ov.opdracht = updatedInfo;
                ov.voertuig = voe.voertuig;

                InfoManagement.addVoertuigBijOpdracht(ov);
            }


            cbbID.DataSource      = InfoManagement.getOpdrachten();
            cbbID.SelectedItem    = geselecteerdeOpdracht;
            MainForm.updateStatus = "De rit informatie over Opdracht: " + updatedInfo.opdracht_id + ", is succesvol opgeslaan.";
        }
Example #4
0
        void uco_OnRemoveButtonclick(object sender, EventArgs e)
        {
            if (MessageBox.Show("Weet u zeker dat u deze offerte wil verwijderen? Dit kan niet ongedaan worden", "Confirmatie", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ucOfferteMini control          = (ucOfferteMini)sender;
                opdracht      selectedOpdracht = control.opdracht;

                int index = 0;

                foreach (ucOfferteMini ucOfferteMini in flpOffertes.Controls)
                {
                    if (ucOfferteMini == control)
                    {
                        flpOffertes.Controls.RemoveAt(index);
                    }
                    index += 1;
                }

                OfferteManagement.deleteOfferte(selectedOpdracht.opdracht_id);
            }
        }
Example #5
0
        private void ucTeAccepterenOffertes_Load(object sender, EventArgs e)
        {
            foreach (opdracht offerte in OfferteManagement.getOffertes())
            {
                if (offerte.offerte_openstaand == true)
                {
                    ucOfferteMini uco = new ucOfferteMini();
                    uco.opdracht             = offerte;
                    uco.OnRemoveButtonclick += new EventHandler(uco_OnRemoveButtonclick);
                    uco.OnSaveButtonclick   += new EventHandler(uco_OnSaveButtonclick);

                    flpOffertes.Controls.Add(uco);
                }

                //if (opdracht.contract == false)
                //{
                //    uco.achtergrond =  Color.CornflowerBlue;
                //}
                //else if (opdracht.contract == true)
                //{
                //    uco.achtergrond = Color.ForestGreen;
                //}
            }
        }
Example #6
0
        //Formulier invullen met de info van het geselecteerde voertuig
        private void cbbID_SelectedIndexChanged(object sender, EventArgs e)
        {
            opdracht info     = (opdracht)cbbID.SelectedItem;
            opdracht opdracht = (opdracht)cbbID.SelectedItem;

            if (opdracht == null)
            {
                MainForm.updateStatus = "Er is geen opdracht gekozen.";
            }
            else
            {
                emptyFields();

                if (opdracht.info_datum == null)
                {
                    lblInfoStatus.Text      = "Niet ingevuld";
                    lblInfoStatus.ForeColor = Color.Red;
                }
                else
                {
                    lblInfoStatus.Text      = "Ingevuld";
                    lblInfoStatus.ForeColor = Color.Green;
                }

                btnOpslaan.Enabled = true;
                enableFields();

                cbbID.SelectedItem    = info;
                txtPrijs.Text         = info.autocarprijs.ToString();
                dtVan.Value           = info.vanaf_datum;
                dtTot.Value           = info.tot_datum;
                txtRitboeknummer.Text = info.ritboeknummer.ToString();
                txtRitbladnummer.Text = info.ritbladnummer.ToString();

                TimeSpan aantaldagen = dtTot.Value - dtVan.Value;
                int      dagen       = aantaldagen.Days + 1;
                txtAantaldagen.Text = dagen.ToString();

                if (info.info_datum == null)
                {
                    txtAantalpersonen.Text = info.aantal_personen.ToString();
                }
                else
                {
                    txtAantalpersonen.Text = info.info_aantalpersonen.ToString();
                }

                txtTotaalkm.Text            = ((int)info.aantalkm).ToString();
                txtGeredenkm.Text           = info.info_totaalkm.ToString();
                txtBeladenkm.Text           = info.info_beladenkm.ToString();
                txtLedigekm.Text            = info.info_ledigekm.ToString();
                txtTotaalkm_buitenland.Text = info.info_totaalkm_buitenland.ToString();
                txtKmDuitsland.Text         = info.info_km_duitsland.ToString();
                txtKmBinnenland.Text        = info.info_km_binneland.ToString();

                cbbVersteLand.SelectedItem = info.info_verste_land;
                txtNettoOntvangst.Text     = info.info_netto_ontvangst.ToString();

                foreach (kost kost in OfferteManagement.getKostenVanOfferte(info.opdracht_id))
                {
                    ucKost ucKost = new ucKost();
                    ucKost.omschrijving = kost.omschrijving;
                    ucKost.prijs        = kost.bedrag;

                    flpKosten.Controls.Add(ucKost);
                }

                //Alle voertuigen ophalen en toevoegen aan flpVoertuigen
                foreach (voertuig voe in InfoManagement.getVoertuigenVanOpdracht(info))
                {
                    ucVoertuigKiezer ucVoertuigKiezer = new ucVoertuigKiezer();
                    ucVoertuigKiezer.voertuig       = voe;
                    ucVoertuigKiezer.OnButtonclick += new EventHandler(ucVoertuig_OnButtonclick);

                    flpVoertuigen.Controls.Add(ucVoertuigKiezer);
                }

                MainForm.updateStatus = "De rit informatie over Opdracht: " + info.opdracht_id + ", is succesvol geladen.";
            }
        }
Example #7
0
        //Factuur updaten
        private void btnOpslaan_Click(object sender, EventArgs e)
        {
            //Validatie check
            if (Validation.hasValidationErrors(this.Controls))
            {
                return;
            }
            //Huidige opdracht (factuur) selecteren in combbox (voor id uit te halen)
            opdracht oudeOpdracht = (opdracht)cbbID.SelectedItem;



            //dtVan.Value, dtTot.Value
            //De oude opdracht (factuur) updaten en de geupdate opdracht (factuur) terugsturen
            int voorschot;

            if (!int.TryParse(txtVoorschot.Text, out voorschot))
            {
                voorschot = 0;
            }
            opdracht nieuweOpdracht = FactuurManagement.updateFactuur(oudeOpdracht.opdracht_id, (klant)cbbKlant.SelectedItem,
                                                                      dtVan.Value.ToShortDateString(), dtTot.Value.ToShortDateString(), txtVan_uur.Text, txtTot_uur.Text, decimal.Parse(txtSaldo.Text), voorschot,
                                                                      cbBetaald.Checked, txtBetalingMemo.Text, dtBetaald.Value, cbBetaaldvoorschot.Checked, txtBetalingMemovoorschot.Text, dtBetaaldvoorschot.Value);



            //Vertreklocatie toevoegen aan opdracht (factuur)
            locatie vertrek = (locatie)cbbVertrek.SelectedItem;

            OfferteManagement.addLocatieBijOfferte(vertrek, nieuweOpdracht, "vertrek");

            //Bestemming locatie toevoegen aan opdracht (factuur)
            locatie bestemming = (locatie)cbbBestemming.SelectedItem;

            OfferteManagement.addLocatieBijOfferte(bestemming, nieuweOpdracht, "bestemming");

            //Factuur info opslaan
            #region gegevensophaal
            decimal?bedrag_basis;
            if (txtBedrag_basis.Text == string.Empty)
            {
                bedrag_basis = null;
            }
            else
            {
                bedrag_basis = decimal.Parse(txtBedrag_basis.Text);
            }

            decimal?btw_bedrag;
            if (txtBtw_bedrag.Text == string.Empty)
            {
                btw_bedrag = null;
            }
            else
            {
                btw_bedrag = decimal.Parse(txtBtw_bedrag.Text);
            }

            decimal?bedrag_inclusief;
            if (txtBedrag_inclusief.Text == string.Empty)
            {
                bedrag_inclusief = null;
            }
            else
            {
                bedrag_inclusief = decimal.Parse(txtBedrag_inclusief.Text);
            }

            decimal?credit_voorschot;
            if (txtCreditvoorschot.Text == string.Empty)
            {
                credit_voorschot = null;
            }
            else
            {
                credit_voorschot = decimal.Parse(txtCreditvoorschot.Text);
            }

            decimal?totaal_reis;
            if (txtTotaal_reis.Text == string.Empty)
            {
                totaal_reis = null;
            }
            else
            {
                totaal_reis = decimal.Parse(txtTotaal_reis.Text);
            }

            decimal?btw_percent;
            if (cbbBTW.Text == string.Empty)
            {
                btw_percent = null;
            }
            else
            {
                btw_percent = decimal.Parse(cbbBTW.Text);
            }
            #endregion

            opdracht_factuur updatedFactuur = new opdracht_factuur();

            if (FactuurManagement.hasFactuur(nieuweOpdracht) == true)
            {
                //updaten
                updatedFactuur = FactuurManagement.updateFactuurVanOpdracht(nieuweOpdracht, totaal_reis, credit_voorschot,
                                                                            bedrag_basis, btw_bedrag, btw_percent, bedrag_inclusief, txtOmschrijving.Text);
            }

            else
            {
                //aanmaken
                opdracht_factuur of = new opdracht_factuur();
                of.totaal_reis         = totaal_reis;
                of.voorschot           = credit_voorschot;
                of.credit_basis        = bedrag_basis;
                of.credit_btwbedrag    = btw_bedrag;
                of.credit_btwpercent   = btw_percent;
                of.credit_inc          = bedrag_inclusief;
                of.credit_omschrijving = txtOmschrijving.Text;
                of.opdracht            = nieuweOpdracht;

                updatedFactuur = FactuurManagement.addFactuurVanOpdracht(of);
            }

            //Factuur detail
            FactuurManagement.deleteDetailsVanFactuur(updatedFactuur);

            foreach (ucDetailFactuur uc in flpDetail.Controls)
            {
                opdracht_factuur_detail ofd = new opdracht_factuur_detail();
                ofd.bedrag_basis        = uc.bedrag_basis;
                ofd.omschrijving        = uc.omschrijving;
                ofd.btw_percent         = uc.btw_percent;
                ofd.btw_bedrag          = uc.btw_bedrag;
                ofd.bedrag_inclusief    = uc.bedrag_inclusief;
                ofd.opdracht_factuur_id = updatedFactuur.opdracht_factuur_id;

                FactuurManagement.updateDetailsVanFactuur(ofd);
            }
            cbbID_SelectedIndexChanged();
            //frmMain statusbalk updaten
            MainForm.updateStatus = "De factuur met ID: " + oudeOpdracht.opdracht_id + ", is succesvol opgeslaan.";
        }
Example #8
0
 private void loadAllOffertes()
 {
     dataGridView1.DataSource = OfferteManagement.getOffertes();
 }