private void button1_Click_1(object sender, EventArgs e) { if (CID < 0) { Message.ErrorMessage("Proszę wybrać kontrahenta na którego będzie wystawiona faktura"); return; } UslugaDEF usluga = new UslugaDEF(UslugaDEF.TYPE.NEW); usluga.ShowDialog(); if (usluga.CANCEL) return; int idUslugi = CustomerDatabase.NewUsluga(usluga.NUMER, usluga.NAZWA, usluga.OPIS, usluga.CENA_NETTO, usluga.VAT, usluga.CENA_BRUTTO,(int)usluga.TIME_IDX); USLUGI.Add(new UslugaC { ID = idUslugi, OPIS = usluga.OPIS, Netto = usluga.CENA_NETTO, VAT = usluga.VAT, Brutto = usluga.CENA_BRUTTO, KWOTA_VAT = (float)Math.Round((usluga.CENA_BRUTTO - usluga.CENA_NETTO), 2), NUMER = usluga.NUMER, NAZWA = usluga.NAZWA, }); SUMA_NETTO += usluga.CENA_NETTO; SUMA_BRUTTO += usluga.CENA_BRUTTO; LoadUslugi(); Message.InfoMessage("Nowa usługa została pomyślnie wprowadzona"); }
private void cbxTowary_SelectedIndexChanged(object sender, EventArgs e) { if (cbxTowary.DisplayMember == "" || cbxTowary.ValueMember == "") return; if (TrybPracy == TYPE.PRODUKTY_EDIT) { Produkt towar = (Produkt)cbxTowary.SelectedItem; FINDKind selectProduct = new FINDKind(FINDKind.TYPE.NEW); int index = GetTowarIndex(towar); if (index > 0) towar.COUNT -= PRODUKTY[index].COUNT; selectProduct.PRODUKT = towar; //selectProduct.DOCID = 2; selectProduct.MID = towar.MID; selectProduct.ShowDialog(); if (selectProduct.CANCEL) { towar = null; return; } towar.COUNT = selectProduct.ILOSC; towar.SUMA_NETTO = selectProduct.ILOSC * selectProduct.PRICE; towar.SUMA_BRUTTO = towar.SUMA = selectProduct.ILOSC * selectProduct.VATPRICE; SUMA_NETTO += towar.SUMA_NETTO; SUMA_BRUTTO += towar.SUMA_BRUTTO; towar.STAN = selectProduct.STAN; if (index > -1) { PRODUKTY[index].COUNT += towar.COUNT; PRODUKTY[index].SUMA_NETTO += towar.SUMA_NETTO; PRODUKTY[index].SUMA_BRUTTO += towar.SUMA_BRUTTO; PRODUKTY[index].SUMA += towar.SUMA_BRUTTO; } else PRODUKTY.Add(selectProduct.PRODUKT); LoadProducts(); cbxTowary.DisplayMember = ""; cbxTowary.ValueMember = ""; cbxTowary.DataSource = null; } else if (TrybPracy == TYPE.USLUGI_EDIT) { UslugaC usluga = (UslugaC)cbxTowary.SelectedItem; UslugaDEF uslugaView = new UslugaDEF(UslugaDEF.TYPE.ADD); uslugaView.USLUGA = usluga; uslugaView.ShowDialog(); if (uslugaView.CANCEL) return; SUMA_NETTO += usluga.Netto; SUMA_BRUTTO += usluga.Brutto; USLUGI.Add(usluga); cbxTowary.DisplayMember = ""; cbxTowary.ValueMember = ""; cbxTowary.DataSource = null; LoadUslugi(); } }