private void picMaloprodaj_Click(object sender, EventArgs e) { if (!Class.Registracija.dopustenoKreiranjeNovihDokumenta) { return; } if (!Util.classZaposleniciDopustenja.provjeraZaposlenika(3)) { MessageBox.Show("Nemate potrebno ovlaštenje za pristup stavci"); return; } foreach (Form OpenForm in Application.OpenForms) { if (OpenForm.GetType() == typeof(frmKasa)) { OpenForm.WindowState = FormWindowState.Maximized; return; } } if (ini.Read("POSTAVKE", "paragonac") == "1") { frmParagonac p = new frmParagonac(); //p.MainForm = MainForm; p.Show(); } else { frmKasa ks = new frmKasa(); ks.MainForm = MainForm; ks.Show(); } }
private void VisibleTrueFalse() { if (ini.Read("INDIVIDUALNO", "backstage") == "1") { dataGridView2.Columns["Tvrtka"].Visible = false; dataGridView2.Columns["OIB"].Visible = false; dataGridView2.Columns["Država"].Visible = false; dataGridView2.Columns["Djelatnost"].Visible = false; dataGridView2.Columns["ID"].Visible = false; } }
private void frmRobaTrazi_Load(object sender, EventArgs e) { dsPostavke = classSQL.select_settings("select * from postavke", "postavke"); int p1 = 0; int.TryParse(Properties.Settings.Default.trazi_robno_prvih.ToString(), out p1); nuPrvih.Value = p1; string skladiste = ""; string sql = string.Format(@" select x.ID, x.naziv from ( select 0 as ID, 'Sva skladišta' as naziv, 0 as sort union select id_skladiste as id, skladiste as naziv, 1 as sort from skladiste where aktivnost = 'DA' ) x order by x.sort;"); DataSet dsSkladiste = classSQL.select(sql, "skladiste"); if (dsSkladiste != null && dsSkladiste.Tables.Count > 0 && dsSkladiste.Tables[0] != null && dsSkladiste.Tables[0].Rows.Count > 0) { cmbSkladista.DisplayMember = "naziv"; cmbSkladista.ValueMember = "ID"; cmbSkladista.DataSource = dsSkladiste.Tables[0]; if (idSkladiste > 0) { cmbSkladista.SelectedValue = idSkladiste; } else { cmbSkladista.SelectedValue = Class.Postavke.id_default_skladiste; } if (Convert.ToInt32(cmbSkladista.SelectedValue) != 0) { skladiste = " and roba_prodaja.id_skladiste = '" + Convert.ToInt32(cmbSkladista.SelectedValue) + "'"; } } if (Properties.Settings.Default.artikli_koji_su_na_skl) { chbRNS.Checked = true; } else { chbRNS.Checked = false; } //if (idSkladiste > 0) // skladiste = " and roba_prodaja.id_skladiste = '" + idSkladiste + "'"; //PaintRows(dataGridView2); PaintRows(dataGridView1); txtIme.Select(); Properties.Settings.Default.id_roba = ""; Properties.Settings.Default.idSkladiste = ""; Properties.Settings.Default.Save(); DataTable dt = classSQL.select_settings("SELECT * FROM aktivnost_podataka", "aktivnost_podataka").Tables[0]; /*chbRNS.Checked = false;*/ chbRNS.Visible = dt.Rows[0]["boolRobno"].ToString() != "1" ? false : true; if (classSQL.remoteConnectionString != "") { remoteDBboll = true; } string limit = ""; string limitRemote = ""; if (remoteDBboll != true) { limit = "TOP(" + nuPrvih.Value.ToString() + ")"; } else { limitRemote = "LIMIT " + nuPrvih.Value.ToString() + ""; } string rns = ""; if (chbRNS.Checked) { rns = "AND CAST(REPLACE(roba_prodaja.kolicina,',','.') AS numeric)>0"; } else { rns = ""; } sql = string.Format(@"SELECT {0} roba.sifra as [Šifra], roba.naziv AS [Naziv], partners.ime_tvrtke as [Dobavljač], grupa.grupa as [Grupa], roba_prodaja.kolicina AS [Količina], skladiste.skladiste AS [Skladište], roba_prodaja.nc as [Nabavna], roba.vpc as [Veleprodajna], roba.mpc as [Maloprodajna] FROM roba LEFT JOIN grupa ON roba.id_grupa = grupa.id_grupa LEFT JOIN partners ON roba.id_partner = partners.id_partner LEFT JOIN roba_prodaja ON roba.sifra=roba_prodaja.sifra LEFT JOIN skladiste ON skladiste.id_skladiste = roba_prodaja.id_skladiste WHERE roba.sifra !~* '!serial' {1}{2} ORDER BY CAST(id_roba as numeric) {3}", limit, rns, skladiste, limitRemote); dataGridView2.DataSource = classSQL.select(sql, "roba").Tables[0]; if (ini.Read("INDIVIDUALNO", "backstage") == "1") { dataGridView2.Columns["Naziv"].Width = 300; dataGridView2.Columns["grupa"].Visible = false; dataGridView2.Columns["dobavljač"].Visible = false; dataGridView2.Columns["nabavna"].Visible = false; dataGridView2.Columns["veleprodajna"].Visible = false; } SetSkladisteKojeNePostoji(); SetDecimalInDgv(dataGridView2, "Nabavna", "Veleprodajna", "Maloprodajna"); PaintRows(dataGridView2); this.Paint += new PaintEventHandler(Form1_Paint); }
public static string Zaposlenici() { string ulogirani = Properties.Settings.Default.id_zaposlenik; string sql = "SELECT zaposlenici.ime, zaposlenici.prezime, dopustenja.naziv" + " FROM zaposlenici LEFT JOIN dopustenja ON dopustenja.id_dopustenje = zaposlenici.id_dopustenje" + " WHERE id_zaposlenik = '" + ulogirani + "';"; DataSet dsZaposlenici = classSQL.select(sql, "zaposlenici"); if (dsZaposlenici != null && dsZaposlenici.Tables.Count > 0 && dsZaposlenici.Tables[0] != null && dsZaposlenici.Tables[0].Rows.Count > 0) { DataTable DTzaposlenici = dsZaposlenici.Tables[0]; INIFile ini = new INIFile(); string admin1 = "0"; if (ini.Read("POSTAVKE", "admin_permision") != "") { admin1 = ini.Read("POSTAVKE", "admin_permision"); } string admin = ""; if (admin1 == "0") { try { if (DTzaposlenici.Rows.Count > 0) { admin = DTzaposlenici.Rows[0]["naziv"].ToString(); } else { admin = "administrator"; } } catch { admin = "administrator"; } if (admin.ToString().ToLower() == "administrator") { admin = "administrator"; } else if (admin.ToString().ToLower() == "blagajnik") { admin = "administrator"; } else if (admin.ToString().ToLower() == "korisnik") { admin = "administrator"; } return(admin); } else { try { admin = DTzaposlenici.Rows[0]["naziv"].ToString(); } catch { admin = "administrator"; } if (admin.ToString().ToLower() == "administrator") { admin = "administrator"; } else if (admin.ToString().ToLower() == "blagajnik") { admin = "blagajnik"; } else if (admin.ToString().ToLower() == "korisnik") { admin = "korisnik"; } return(admin); } } return(""); }