예제 #1
0
        private void frmScren_Load(object sender, EventArgs e)
        {
            this.Paint += new PaintEventHandler(Class.Postavke.changeBackground);

            try
            {
                id_kasa = DTpostavke.Rows[0]["default_blagajna"].ToString();
                naplatni_uredaj_faktura = DTpostavke.Rows[0]["naplatni_uredaj_faktura"].ToString();
            }
            catch
            {
                MessageBox.Show("Kasa nije odabrana. Provjerite postavke programa.", "Upozorenje!");
                id_kasa = "0";
            }
            try
            {
                id_ducan = DTpostavke.Rows[0]["default_ducan"].ToString();
            }
            catch
            {
                MessageBox.Show("Dućan nije odabran. Provjerite postavke programa.", "Upozorenje!");
                id_ducan = "0";
            }

            pictureBox3.Visible  = kartoteka;
            lblKartoteka.Visible = kartoteka;

            try
            {
                label4.Text = "Verzija programa: " + Properties.Settings.Default.verzija_programa;
                PCPOS.Util.classFukcijeZaUpravljanjeBazom B = new Util.classFukcijeZaUpravljanjeBazom("MALOPRODAJA", "POS");
                int trenutnaG = B.UzmiGodinuKojaSeKoristi();

                if (trenutnaG == DateTime.Now.Year)
                {
                    lblTrenutnaGodina.ForeColor = Color.White;
                    timerUpozoranaNaKrivuGodinu.Stop();
                }
                else
                {
                    lblTrenutnaGodina.ForeColor          = Color.Red;
                    timerUpozoranaNaKrivuGodinu.Interval = 500;
                    timerUpozoranaNaKrivuGodinu.Start();
                }
                lblTrenutnaGodina.Text = "Trenutno koristite " + trenutnaG + " g:";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            timer2.Start();
            SetMoneyValue();
            timer1.Start();
            PieStart(10);
            txtBrojDana.Text = "10";

            //DataTable DT = OstaleFunkcije.DSaktivnosDok;

            if (Class.Dokumenti.kalkulacije != true) // DT.Rows[0]["kalkulacije"].ToString() != "1"
            {
                button1.Enabled = false;
            }
            if (Class.Dokumenti.fakture != true) //DT.Rows[0]["faktura"].ToString() != "1"
            {
                button2.Enabled = false;
            }
            if (Class.Dokumenti.ponude != true) //DT.Rows[0]["ponude"].ToString() != "1"
            {
                button3.Enabled = false;
            }
            if (Class.Dokumenti.otpremnice != true) //DT.Rows[0]["otpremnica"].ToString() != "1"
            {
                button7.Enabled = false;
            }
            if (Class.Postavke.grafovi == false) //DTpostavke.Rows[0]["grafovi"].ToString() == "0"
            {
                chbFakture.Visible        = false;
                cbMaloprodaja.Visible     = false;
                chbIfb.Visible            = false;
                label2.Visible            = false;
                label1.Visible            = false;
                txtBrojDana.Visible       = false;
                Chart1.Visible            = false;
                tableLayoutPanel1.Visible = false;
            }
            else
            {
                chbFakture.Visible        = true;
                cbMaloprodaja.Visible     = true;
                label2.Visible            = true;
                chbIfb.Visible            = true;
                label1.Visible            = true;
                txtBrojDana.Visible       = true;
                Chart1.Visible            = true;
                tableLayoutPanel1.Visible = true;
            }

            //this.Paint += new PaintEventHandler(Form1_Paint);
        }