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); } } }
//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."; } }
//Methoden voor usercontrol ucKost toe te voegen en te verwijderen in flpKosten private void btnKostToevoegen_Click(object sender, EventArgs e) { ucKost ucKost = new ucKost(); flpKosten.Controls.Add(ucKost); }
private void button1_Click(object sender, EventArgs e) { ucKost ucKost = new ucKost(); flpKosten.Controls.Add(ucKost); }