private void cmdEdytuj_Click(object sender, EventArgs e) { FINDKind newProgram = new FINDKind(FINDKind.TYPE.EDIT); Produkt product; try { product = (Produkt)dgwProdukty.CurrentRow.DataBoundItem; } catch { return; } newProgram.PRODUKT = product; newProgram.ShowDialog(); if (newProgram.CANCEL) return; if (CustomerDatabase.CheckProgram(newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.MODEL, newProgram.PRICE, newProgram.VATPRICE, newProgram.JEDNOSTKA, newProgram.PROWIZJA, newProgram.PRICE2,newProgram.VATPRICE2)) { Message.ErrorMessage("Podany produkt już istnieje"); return; } CustomerDatabase.UpdateProgram(product.ID, newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.NUMER_SERYJNY, newProgram.OPIS, newProgram.PRICE, newProgram.VATPRICE, newProgram.JEDNOSTKA, newProgram.PROWIZJA, newProgram.PRICE2, newProgram.VATPRICE2); Message.InfoMessage("Produkt został zmieniony"); LoadProducts(newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.NUMER_SERYJNY); }
private void cmdPodglad_Click(object sender, EventArgs e) { FINDKind newProgram = new FINDKind(FINDKind.TYPE.VIEW); Produkt product; try { product = (Produkt)dgwProdukty.CurrentRow.DataBoundItem; } catch { return; } newProgram.PRODUKT = product; newProgram.ShowDialog(); }
private void cmdSzukaj_Click(object sender, EventArgs e) { FINDKind products = new FINDKind(FINDKind.TYPE.FIND); products.ShowDialog(); if (products.CANCEL) return; LoadProducts(products.KATID, products.CID, products.NAZWA_TOWARU, products.NUMER_KATALOGOWY, products.MODEL, products.NUMER_SERYJNY); }
private void cmdPodgląd_Click(object sender, EventArgs e) { Produkt program = null; try { program = (Produkt)dgvProdukty.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } FINDKind viewProduct = new FINDKind(FINDKind.TYPE.MAGAZYN_ADD_VIEW); viewProduct.PRODUKT = program; viewProduct.ShowDialog(); }
private void cmdNowy_Click(object sender, EventArgs e) { FINDKind newProgram = new FINDKind(FINDKind.TYPE.NEW); newProgram.ShowDialog(); if (newProgram.CANCEL) return; if (CustomerDatabase.CheckProgram(newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.MODEL, newProgram.PRICE, newProgram.VATPRICE, newProgram.JEDNOSTKA,newProgram.PROWIZJA, newProgram.PRICE2,newProgram.VATPRICE2)) { Message.ErrorMessage("Podany produkt już istnieje"); return; } CustomerDatabase.NewProgram(newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.NUMER_SERYJNY, newProgram.OPIS, newProgram.PRICE, newProgram.VATPRICE, newProgram.JEDNOSTKA, newProgram.PROWIZJA, newProgram.PRICE2, newProgram.VATPRICE2); Message.InfoMessage("Produkt został dodany"); LoadProducts(newProgram.KATID, newProgram.CID, newProgram.NAZWA_TOWARU, newProgram.NUMER_KATALOGOWY, newProgram.MODEL, newProgram.NUMER_SERYJNY); }
private void cbxTowary_SelectedIndexChanged(object sender, EventArgs e) { if (cbxTowary.DisplayMember == "" || cbxTowary.ValueMember == "") return; Produkt towar = (Produkt)cbxTowary.SelectedItem; FINDKind selectProduct = new FINDKind(FINDKind.TYPE.MAGAZYN_ADD); //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.STAN = selectProduct.ILOSC; //towar.SUMA_NETTO = selectProduct.COUNT * selectProduct.PRICE; towar.SUMA_BRUTTO = towar.SUMA = (float)Math.Round(selectProduct.ILOSC * selectProduct.VATPRICE2, 2); towar.SUMA_NETTO = (float)Math.Round((towar.SUMA_BRUTTO / (1 + (Settings.PROCENT * 0.01))), 2); towar.KWOTA_VAT = (float)Math.Round((towar.SUMA_BRUTTO - towar.SUMA_NETTO), 2); 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; //} PRODUKTY.Add(selectProduct.PRODUKT); LoadProducts(); cbxTowary.DisplayMember = ""; cbxTowary.ValueMember = ""; cbxTowary.DataSource = null; }
private void cmdDodaj_Click(object sender, EventArgs e) { FINDKind szukajTowar = new FINDKind(FINDKind.TYPE.MAGAZYN_FIND); //szukajTowar.MID = MID; szukajTowar.ShowDialog(); if (szukajTowar.CANCEL) { return; } List<Produkt> produkty = CustomerDatabase.GetTowarFromMagazyn(szukajTowar.CID, szukajTowar.KATID, -1, szukajTowar.MID, szukajTowar.NAZWA_TOWARU, szukajTowar.NUMER_KATALOGOWY, szukajTowar.MODEL, szukajTowar.NUMER_SERYJNY); if (produkty == null) { Message.NotFound(); return; } cbxTowary.DisplayMember = ""; cbxTowary.ValueMember = ""; cbxTowary.DataSource = null; cbxTowary.DataSource = produkty; cbxTowary.DisplayMember = "TOWAR"; cbxTowary.ValueMember = "ID"; Settings.ShowDropDownList(ref cbxTowary); cbxTowary.Text = "Wybierz towar z listy"; }
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(); } }
private void cmdTowaryPodgląd_Click(object sender, EventArgs e) { if(TrybPracy == TYPE.PRODUKTY_VIEW) { Produkt program = null; try { program = (Produkt)dgvLista.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } FINDKind viewProduct = new FINDKind(FINDKind.TYPE.VIEW); viewProduct.PRODUKT = program; viewProduct.ShowDialog(); } else if( TrybPracy == TYPE.USLUGI_VIEW) { UslugaC selected = null; try { selected = (UslugaC)dgvLista.CurrentRow.DataBoundItem; } catch { Message.Position(); return; } UslugaPrc usluga = new UslugaPrc(UslugaPrc.TYPE.VIEW); usluga.USLUGA = selected; usluga.ShowDialog(); } }
private void cmdTowaryDodaj_Click(object sender, EventArgs e) { if (TrybPracy == TYPE.PRODUKTY_EDIT) { FINDKind szukajTowar = new FINDKind(FINDKind.TYPE.MAGAZYN_FIND); //szukajTowar.MID = MID; szukajTowar.ShowDialog(); if (szukajTowar.CANCEL) { return; } List<Produkt> produkty = CustomerDatabase.GetTowarFromMagazyn(szukajTowar.CID, szukajTowar.KATID, -1, szukajTowar.MID, szukajTowar.NAZWA_TOWARU, szukajTowar.NUMER_KATALOGOWY, szukajTowar.MODEL, szukajTowar.NUMER_SERYJNY); if (produkty == null) { Message.NotFound(); return; } cbxTowary.DisplayMember = ""; cbxTowary.ValueMember = ""; cbxTowary.DataSource = null; cbxTowary.DataSource = produkty; cbxTowary.DisplayMember = "TOWAR"; cbxTowary.ValueMember = "ID"; Settings.ShowDropDownList(ref cbxTowary); cbxTowary.Text = "Wybierz towar z listy"; } else if (TrybPracy == TYPE.USLUGI_EDIT) { UslugaPrc usluga = new UslugaPrc(UslugaPrc.TYPE.NEW); usluga.ShowDialog(); if (usluga.CANCEL) return; SUMA_NETTO += usluga.USLUGA.Netto; SUMA_BRUTTO += usluga.USLUGA.Brutto; usluga.USLUGA.KWOTA_VAT = (float)Math.Round((usluga.USLUGA.Brutto - usluga.USLUGA.Netto), 2); USLUGI.Add(usluga.USLUGA); LoadUslugi(); } }
private void cmdTowarSzukaj_Click(object sender, EventArgs e) { FINDKind.TYPE Typ = FINDKind.TYPE.PRODUKT_FIND_BY_KONTRAHENT; if (CID < 0 && TrybPracy == TYPE.PZ) { Message.ErrorMessage("Proszę wybrać kontrahenta"); txtKontrahent.BackColor = Color.Yellow; return; } else txtKontrahent.BackColor = Color.White; if (MID < 0 && TrybPracy == TYPE.WZ) { Message.ErrorMessage("Proszę wybrać magazyn"); cbxMagazynI.BackColor = Color.Yellow; return; } else cbxMagazynI.BackColor = Color.White; if (TrybPracy == TYPE.PZ) Typ = FINDKind.TYPE.PRODUKT_FIND_BY_KONTRAHENT; else if (TrybPracy == TYPE.WZ) Typ = FINDKind.TYPE.MAGAZYN_FIND_BY_WZ; FINDKind products = new FINDKind(Typ); if (TrybPracy == TYPE.PZ) products.CID = CID; else if (TrybPracy == TYPE.WZ) products.MID = MID; products.ShowDialog(); if (products.CANCEL) return; List<Produkt> product = CustomerDatabase.GetPrograms(-1, products.KATID, products.CID, products.NAZWA_TOWARU, products.NUMER_KATALOGOWY, products.MODEL, products.NUMER_SERYJNY); if (product == null) { Message.InfoMessage("Nie znaleziono"); return; } cbxTowar.DisplayMember = ""; cbxTowar.ValueMember = ""; cbxTowar.DataSource = null; cbxTowar.DataSource = product; cbxTowar.DisplayMember = "CZESC"; cbxTowar.ValueMember = "ID"; Settings.ShowDropDownList(ref cbxTowar); }
private void cbxTowar_SelectedIndexChanged(object sender, EventArgs e) { if (cbxTowar.DisplayMember == "" || cbxTowar.ValueMember == "") return; FINDKind.TYPE typ = FINDKind.TYPE.PRODUKT; if (TrybPracy == TYPE.PZ) typ = FINDKind.TYPE.PRODUKT; else if (TrybPracy == TYPE.WZ) typ = FINDKind.TYPE.MAGAZYN_VIEW_WZ; FINDKind newProgram = new FINDKind(typ); Produkt product; try { product = (Produkt)cbxTowar.SelectedItem; } catch { return; } newProgram.PRODUKT = product; newProgram.MID = MID; newProgram.ShowDialog(); if (newProgram.CANCEL) return; PRODUKTY.Add(newProgram.PRODUKT); SUMA += newProgram.PRODUKT.SUMA; LoadProducts(); cbxTowar.DisplayMember = ""; cbxTowar.ValueMember = ""; cbxTowar.DataSource = null; }