private void txtSifra_robe_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; if (DTtvrtka.Rows[0]["oib"].ToString() == "05593216962" || DTtvrtka.Rows[0]["oib"].ToString() == "77566209058") { return; } if (txtSifra_robe.Text == "") { frmRobaTrazi roba = new frmRobaTrazi(); roba.id_skladiste = int.Parse(cbSkladiste.SelectedValue.ToString()); roba.ShowDialog(); if (Properties.Settings.Default.id_roba != "") { txtSifra_robe.Text = Properties.Settings.Default.id_roba; txtSifra_robe.Select(); } else { return; } } for (int y = 0; y < dgwArtikliUsklade.Rows.Count; y++) { if (txtSifra_robe.Text == dgwArtikliUsklade.Rows[y].Cells["sifra"].FormattedValue.ToString().Trim()) { MessageBox.Show("Artikl ili usluga već postoje u ovoj inventuri.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT roba_prodaja.mjera,roba_prodaja.naziv,roba_prodaja.id_skladiste,roba_prodaja.kolicina,roba_prodaja.nc," + " roba_prodaja.ulazni_porez,roba_prodaja.sifra,roba.mpc,roba_prodaja.povratna_naknada " + " FROM roba_prodaja " + " LEFT JOIN roba ON roba.sifra=roba_prodaja.sifra" + " WHERE roba_prodaja.sifra='" + txtSifra_robe.Text + "' AND roba_prodaja.id_skladiste='" + cbSkladiste.SelectedValue + "'"; DTRoba = classSQL.select(sql, "roba_prodaja").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); dgwArtikliUsklade.Select(); dgwArtikliUsklade.CurrentCell = dgwArtikliUsklade.Rows[dgwArtikliUsklade.Rows.Count - 1].Cells[4]; dgwArtikliUsklade.BeginEdit(true); txtBrojInventure.ReadOnly = true; nmGodinaInventure.ReadOnly = true; } else { MessageBox.Show("Za ovu šifru ne postoj artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnArtikli_Click(object sender, EventArgs e) { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Trim(); if (propertis_sifra != "") { for (int y = 0; y < dgw.Rows.Count; y++) { if (propertis_sifra == dgw.Rows[y].Cells["sifra"].FormattedValue.ToString()) { MessageBox.Show("Artikl ili usluga već postoje!", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT * FROM roba WHERE sifra='" + propertis_sifra + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifraArtikla.Text = DTRoba.Rows[0]["sifra"].ToString(); txtImeArtikla.Text = DTRoba.Rows[0]["naziv"].ToString(); txtJedinicaMjere.Text = DTRoba.Rows[0]["jm"].ToString(); txtKomentar.Select(); } else { MessageBox.Show("Za ovu šifru ne postoji artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnOpenRoba_Click(object sender, EventArgs e) { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Replace(" ", ""); if (propertis_sifra != "") { for (int y = 0; y < dgw.Rows.Count; y++) { if (propertis_sifra == dgw.Rows[y].Cells["sifra"].FormattedValue.ToString()) { MessageBox.Show("Artikl ili usluga već postoje u ovoj kalkulaciji.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT * FROM roba WHERE sifra='" + propertis_sifra + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); } else { MessageBox.Show("Za ovu šifru ne postoj artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { frmRobaTrazi rtra = new frmRobaTrazi(); rtra.ShowDialog(); txtartikl.Text = Properties.Settings.Default.id_roba.ToString(); if (txtartikl.Text != "") { txtimeartikla.Text = classSQL.select("Select naziv from roba where sifra = '" + Properties.Settings.Default.id_roba.ToString() + "'", "ime robe").Tables[0].Rows[0][0].ToString(); } }
/// <summary> /// /// </summary> private void SelectRoba() { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Replace(" ", ""); if (propertis_sifra != "") { string sql = ""; if (cbSkladiste.SelectedValue.ToString() == "1") { sql = "SELECT " + " roba_prodaja.sifra," + " roba_prodaja.naziv," + " roba_prodaja.nc," + " roba_prodaja.kolicina," + " roba_prodaja.vpc" + " FROM roba " + " LEFT JOIN roba_prodaja ON roba.sifra=roba_prodaja.sifra" + " WHERE roba.sifra='" + propertis_sifra + "'"; } else { sql = "SELECT " + " roba_prodaja.sifra," + " roba_prodaja.naziv," + " roba_prodaja.nc," + " roba_prodaja.kolicina," + " roba_prodaja.vpc" + " FROM roba " + " LEFT JOIN roba_prodaja ON roba.sifra=roba_prodaja.sifra" + " WHERE roba.sifra='" + propertis_sifra + "' AND roba_prodaja.id_skladiste='" + cbSkladiste.SelectedValue + "'"; } DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifraArtikla.Text = DTRoba.Rows[0]["sifra"].ToString(); txtImeArtikla.Text = DTRoba.Rows[0]["naziv"].ToString(); lblStanje.Text = Convert.ToDouble(DTRoba.Rows[0]["kolicina"].ToString()).ToString("#0.0000"); lblNbc.Text = Convert.ToDouble(DTRoba.Rows[0]["nc"].ToString()).ToString("#0.00"); } else { MessageBox.Show("Za ovu šifru ne postoj artikl na odabranome skladistu.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void txtSifra_robe_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtSifra_robe.Text.Trim() == "") { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Trim(); if (propertis_sifra != "") { txtSifra_robe.Text = propertis_sifra; } } if (txtSifra_robe.Text == "") { return; } for (int y = 0; y < dgw.Rows.Count; y++) { if (txtSifra_robe.Text == dgw.Rows[y].Cells["sifra_kaucija"].FormattedValue.ToString()) { MessageBox.Show("Artikl ili usluga već postoje!", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT " + " roba.sifra," + " roba.naziv" + " FROM roba" + " WHERE roba.sifra='" + txtSifra_robe.Text.Trim() + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); dgw.Rows[dgw.Rows.Count - 1].Cells["kolicina"].Selected = true; txtSifra_robe.Text = ""; } else { MessageBox.Show("Za ovu šifru ne postoji artikl ili usluga!", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnTrazi_Click(object sender, EventArgs e) { frmRobaTrazi roba = new frmRobaTrazi(); roba.ShowDialog(); if (txtNaziv.Enabled == false) { enable(true); //txtSifra.Enabled = false; } if (Properties.Settings.Default.id_roba != "") { Fill_Roba(Properties.Settings.Default.id_roba); } }
private void btnOpenRoba_Click(object sender, EventArgs e) { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Replace(" ", ""); if (propertis_sifra != "") { for (int y = 0; y < dgw.Rows.Count; y++) { if (propertis_sifra == dgw.Rows[y].Cells["sifra"].FormattedValue.ToString()) { MessageBox.Show("Artikl ili usluga već postoje u ovoj kalkulaciji.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT roba_prodaja.sifra," + " roba_prodaja.id_skladiste," + " roba_prodaja.kolicina," + " roba_prodaja.nc," + " roba_prodaja.vpc," + " roba_prodaja.ulazni_porez," + " roba_prodaja.sifra," + " roba_prodaja.naziv," + " roba_prodaja.mjera" + " FROM roba_prodaja " + " WHERE roba_prodaja.sifra='" + propertis_sifra + "' AND roba_prodaja.id_skladiste='" + izSkladista.SelectedValue + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); txtBroj.Enabled = false; nmGodina.Enabled = false; } else { MessageBox.Show("Za ovu šifru ne postoj artikl ili usluga u zadanome skladištu.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { frmRobaTrazi robaTrazi = new frmRobaTrazi(); robaTrazi.ShowDialog(); if (Properties.Settings.Default.id_roba != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT sifra,naziv FROM roba WHERE sifra ='" + Properties.Settings.Default.id_roba + "'", "roba"); if (partner.Tables[0].Rows.Count > 0) { txtSifraArtikla.Text = partner.Tables[0].Rows[0]["sifra"].ToString(); txtImeArtikla.Text = partner.Tables[0].Rows[0]["naziv"].ToString(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } }
private void btnOpenRoba_Click(object sender, EventArgs e) { this.TopMost = false; frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.id_skladiste = int.Parse(cbSkladiste.SelectedValue.ToString()); roba_trazi.ShowDialog(); this.TopMost = true; string propertis_sifra = Properties.Settings.Default.id_roba.Replace(" ", ""); for (int y = 0; y < dgwArtikliUsklade.Rows.Count; y++) { if (propertis_sifra == dgwArtikliUsklade.Rows[y].Cells["sifra"].FormattedValue.ToString().Trim()) { MessageBox.Show("Artikl ili usluga već postoje u ovoj kalkulaciji", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT roba_prodaja.mjera,roba_prodaja.naziv,roba_prodaja.id_skladiste,roba_prodaja.kolicina,roba_prodaja.nc," + " roba_prodaja.ulazni_porez,roba_prodaja.sifra,roba_prodaja.povratna_naknada,roba.mpc" + " FROM roba_prodaja " + " LEFT JOIN roba ON roba.sifra=roba_prodaja.sifra" + " WHERE roba_prodaja.sifra='" + propertis_sifra + "' AND roba_prodaja.id_skladiste='" + cbSkladiste.SelectedValue + "'"; DTRoba = classSQL.select(sql, "roba_prodaja").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); dgwArtikliUsklade.Select(); dgwArtikliUsklade.CurrentCell = dgwArtikliUsklade.Rows[dgwArtikliUsklade.Rows.Count - 1].Cells[4]; dgwArtikliUsklade.BeginEdit(true); txtBrojInventure.ReadOnly = true; nmGodinaInventure.ReadOnly = true; } else { MessageBox.Show("Za ovu šifru ne postoj artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnOpenRoba_Click(object sender, EventArgs e) { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.idSkladiste = Class.Postavke.id_default_skladiste_normativ; roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Trim(); if (propertis_sifra != "") { for (int y = 0; y < dgw.Rows.Count; y++) { if (propertis_sifra == dgw.Rows[y].Cells["sifra"].FormattedValue.ToString()) { MessageBox.Show("Artikl ili usluga već postoje!", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string sql = "SELECT * FROM roba WHERE sifra='" + propertis_sifra + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; SetRoba(); dgw.Select(); dgw.CurrentCell = dgw.Rows[dgw.Rows.Count - 1].Cells[3]; txtBrojNormativa.Enabled = false; nuGodina.Enabled = false; zbroji_artikle(); } else { MessageBox.Show("Za ovu šifru ne postoji artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnOpenRoba_Click(object sender, EventArgs e) { frmRobaTrazi roba_trazi = new frmRobaTrazi(); roba_trazi.ShowDialog(); string propertis_sifra = Properties.Settings.Default.id_roba.Trim(); if (propertis_sifra != "") { string sql = "SELECT * FROM roba WHERE sifra='" + propertis_sifra + "'"; DTRoba = classSQL.select(sql, "roba").Tables[0]; if (DTRoba.Rows.Count > 0) { txtSifra_robe.BackColor = Color.White; txtSifra_robe.Text = propertis_sifra; } else { MessageBox.Show("Za ovu šifru ne postoji artikl ili usluga.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }