示例#1
0
 private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (Class.Postavke.idFaktura == 1)
     {
         Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
         rfak.dokumenat      = "RAC";
         rfak.ImeForme       = "Račun";
         rfak.poslovnica     = dgv.CurrentRow.Cells["id_ducan"].FormattedValue.ToString();
         rfak.naplatni       = dgv.CurrentRow.Cells["id_kasa"].FormattedValue.ToString();
         rfak.broj_dokumenta = dgv.CurrentRow.Cells["Broj računa"].FormattedValue.ToString();
         rfak.ShowDialog();
     }
     else if (Class.Postavke.idFaktura == 2)
     {
         Report.Faktura.repFakturaNovo rfak = new Report.Faktura.repFakturaNovo();
         rfak.dokumenat      = "RAC";
         rfak.ImeForme       = "Račun";
         rfak.poslovnica     = dgv.CurrentRow.Cells["id_ducan"].FormattedValue.ToString();
         rfak.naplatni       = dgv.CurrentRow.Cells["id_kasa"].FormattedValue.ToString();
         rfak.broj_dokumenta = dgv.CurrentRow.Cells["Broj računa"].FormattedValue.ToString();
         rfak.ShowDialog();
     }
     else if (Class.Postavke.idFaktura == 3)
     {
         Report.Faktura3.repFaktura3 rfak = new Report.Faktura3.repFaktura3();
         rfak.dokumenat      = "RAC";
         rfak.ImeForme       = "Račun";
         rfak.poslovnica     = dgv.CurrentRow.Cells["id_ducan"].FormattedValue.ToString();
         rfak.naplatni       = dgv.CurrentRow.Cells["id_kasa"].FormattedValue.ToString();
         rfak.broj_dokumenta = dgv.CurrentRow.Cells["Broj računa"].FormattedValue.ToString();
         rfak.ShowDialog();
     }
 }
示例#2
0
 private void printaj(string brRac)
 {
     Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
     rfak.dokumenat      = "RAC";
     rfak.ImeForme       = "Račun";
     rfak.poslovnica     = id_ducan;
     rfak.naplatni       = id_kasa;
     rfak.broj_dokumenta = brRac;
     rfak.ShowDialog();
 }
示例#3
0
        private void btnSveFakture_Click(object sender, EventArgs e)
        {
            Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
            rfak.dokumenat      = "RAC";
            rfak.ImeForme       = "Račun";
            rfak.broj_dokumenta = dgv.CurrentRow.Cells["Broj računa"].FormattedValue.ToString();

            rfak.godina        = dgv.CurrentRow.Cells["godina"].FormattedValue.ToString();
            rfak.id_kasa       = dgv.CurrentRow.Cells["id_kasa"].FormattedValue.ToString();
            rfak.id_poslovnica = dgv.CurrentRow.Cells["id_ducan"].FormattedValue.ToString();

            rfak.ShowDialog();
        }
示例#4
0
        private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int brra;

            int.TryParse(dgv1.Rows[e.RowIndex].Cells[2].FormattedValue.ToString(), out brra);
            if (brra != 0)
            {
                string broj_ra = brra.ToString();
                Report.Faktura.repFaktura pogledajrac = new Report.Faktura.repFaktura();
                pogledajrac.dokumenat      = "RAC";
                pogledajrac.broj_dokumenta = broj_ra;
                pogledajrac.ShowDialog();
            }
        }
示例#5
0
        private void btnGeneriraj_Click(object sender, EventArgs e)
        {
            GenerirajFakturu();

            if (brojevi_fak.Count > 0)
            {
                if (MessageBox.Show("\r\nGenerirane su fakture od broja " + brojevi_fak[0] + " do broja " + brojevi_fak[brojevi_fak.Count - 1] + ".\n Želite li ispisati iste?", "Generirano!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    for (int i = 0; i < brojevi_fak.Count; i++)
                    {
                        Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                        rfak.dokumenat      = "FAK";
                        rfak.racunajTecaj   = false;
                        rfak.ImeForme       = "Fakture";
                        rfak.naplatni       = id_kasa;
                        rfak.poslovnica     = id_ducan;
                        rfak.broj_dokumenta = brojevi_fak[i];
                        rfak.ShowDialog();
                    }
                }
            }
        }
示例#6
0
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (storno)
            {
                DataGridViewRow row = dgv.Rows[e.RowIndex];
                BrojRacuna = row.Cells[0].Value.ToString();
                Close();
            }
            else
            {
                Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                rfak.dokumenat      = "RAC";
                rfak.ImeForme       = "Račun";
                rfak.broj_dokumenta = dgv.CurrentRow.Cells["Broj računa"].FormattedValue.ToString();

                rfak.godina        = dgv.CurrentRow.Cells["godina"].FormattedValue.ToString();
                rfak.id_kasa       = dgv.CurrentRow.Cells["id_kasa"].FormattedValue.ToString();
                rfak.id_poslovnica = dgv.CurrentRow.Cells["id_ducan"].FormattedValue.ToString();

                rfak.ShowDialog();
            }
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DTsend = new DataTable();
            DTsend.Columns.Add("broj_racuna");
            DTsend.Columns.Add("sifra_robe");
            DTsend.Columns.Add("id_skladiste");
            DTsend.Columns.Add("mpc");
            DTsend.Columns.Add("vpc");
            DTsend.Columns.Add("porez");
            DTsend.Columns.Add("kolicina");
            DTsend.Columns.Add("rabat");
            DTsend.Columns.Add("cijena");
            DTsend.Columns.Add("ime");
            DTsend.Columns.Add("porez_potrosnja");

            DataRow row;

            DataTable DSbr    = classSQL.select("SELECT MAX(CAST(broj_racuna AS integer)) FROM racuni WHERE racuni.id_ducan='" + Util.Korisno.idDucan + "' AND racuni.id_kasa='" + Util.Korisno.idKasa + "'", "racuni").Tables[0];
            DataTable DSkupac = classSQL.select("SELECT id_kupac FROM racuni WHERE broj_racuna='" + DSbr.Rows[0][0].ToString() + "'  AND racuni.id_ducan='" + Util.Korisno.idDucan + "' AND racuni.id_kasa='" + Util.Korisno.idKasa + "'", "racuni").Tables[0];

            string sql = "SELECT racun_stavke.vpc,racun_stavke.sifra_robe,racun_stavke.porez_potrosnja,roba.naziv,racun_stavke.id_skladiste,racun_stavke.mpc,racun_stavke.porez,racun_stavke.kolicina,racun_stavke.rabat FROM racun_stavke " +
                         " INNER JOIN roba ON roba.sifra=racun_stavke.sifra_robe" +
                         " WHERE racun_stavke.broj_racuna='" + DSbr.Rows[0][0].ToString() + "'" +
                         " AND racun_stavke.id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "'" +
                         " AND racun_stavke.id_blagajna='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'" +
                         " AND racun_stavke.godina='" + DateTime.Now.Year.ToString() + "'";
            DataTable DTrac = classSQL.select(sql, "racun_stavke").Tables[0];

            for (int i = 0; i < DTrac.Rows.Count; i++)
            {
                sifra                  = DTrac.Rows[i]["sifra_robe"].ToString();
                row                    = DTsend.NewRow();
                row["ime"]             = DTrac.Rows[i]["naziv"].ToString();
                row["porez"]           = DTrac.Rows[i]["porez"].ToString();
                row["mpc"]             = DTrac.Rows[i]["mpc"].ToString();
                row["kolicina"]        = DTrac.Rows[i]["kolicina"].ToString();
                row["cijena"]          = DTrac.Rows[i]["mpc"].ToString();
                row["vpc"]             = DTrac.Rows[i]["vpc"].ToString();
                row["rabat"]           = DTrac.Rows[i]["rabat"].ToString();
                row["porez_potrosnja"] = DTrac.Rows[i]["porez_potrosnja"].ToString();
                DTsend.Rows.Add(row);
            }

            string blagajnik = classSQL.select("SELECT ime + ' ' + prezime AS name FROM zaposlenici", "zaposlenici").Tables[0].Rows[0]["name"].ToString();

            barcode = "000" + DSbr.Rows[0][0].ToString();
            if (DTpostavkePrinter.Rows[0]["posPrinterBool"].ToString() != "0")
            {
                PosPrint.classPosPrintCaffeNaknadno.PrintReceipt(DTsend, blagajnik, DSbr.Rows[0][0].ToString() + "/" + DateTime.Now.Year.ToString(), DSkupac.Rows[0][0].ToString(), barcode, DSbr.Rows[0][0].ToString(), "G", "");
            }
            else
            {
                if (DTsend.Rows.Count > 0)
                {
                    Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                    rfak.dokumenat      = "RAC";
                    rfak.ImeForme       = "Račun";
                    rfak.broj_dokumenta = DSbr.Rows[0][0].ToString();

                    rfak.godina        = DateTime.Now.Year.ToString();
                    rfak.id_kasa       = DTsettings.Rows[0]["default_ducan"].ToString();
                    rfak.id_poslovnica = DTsettings.Rows[0]["default_blagajna"].ToString();

                    rfak.ShowDialog();
                }
                //MessageBox.Show("Nema printera!");
            }

            classSQL.update("UPDATE racuni SET broj_ispisa=broj_ispisa+1 WHERE broj_racuna='" + DSbr.Rows[0][0].ToString() + "'" +
                            " AND id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "'" +
                            " AND id_kasa='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'" +
                            " AND godina='" + DateTime.Now.Year.ToString() + "'");
        }
示例#8
0
        private void btnStornoZadnjegR_Click(object sender, EventArgs e)
        {
            bool storno = false;

            if (!File.Exists("belveder"))
            {
                if (MessageBox.Show("Dali ste sigurni da želite stornirati račun?", "Storno računa!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    storno = true;
                }
            }
            else
            {
                Dodaci.frmVracaNekuVrijednost v = new Dodaci.frmVracaNekuVrijednost();
                Properties.Settings.Default.privremena_vrijednost = "";
                v.txtBroj.PasswordChar = '*';
                v._title = "Unesite ključ:";
                v.ShowDialog();

                string key = File.ReadAllText("belveder");
                if (Properties.Settings.Default.privremena_vrijednost == key)
                {
                    if (MessageBox.Show("Dali ste sigurni da želite stornirati račun?", "Storno računa!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        storno = true;
                    }
                }
                else
                {
                    MessageBox.Show("Krivi unos!");
                }
            }

            if (storno)
            {
                DTsend = new DataTable();
                DTsend.Columns.Add("broj_racuna");
                DTsend.Columns.Add("sifra_robe");
                DTsend.Columns.Add("id_skladiste");
                DTsend.Columns.Add("mpc");
                DTsend.Columns.Add("vpc");
                DTsend.Columns.Add("nbc");
                DTsend.Columns.Add("porez");
                DTsend.Columns.Add("kolicina");
                DTsend.Columns.Add("godina");
                DTsend.Columns.Add("rabat");
                DTsend.Columns.Add("cijena");
                DTsend.Columns.Add("ime");
                DTsend.Columns.Add("stol");
                DTsend.Columns.Add("jelo");
                DTsend.Columns.Add("porez_potrosnja");
                DTsend.Columns.Add("storno");
                DTsend.Columns.Add("id_ducan");
                DTsend.Columns.Add("id_blagajna");
                DTsend.Columns.Add("dod");
                DTsend.Columns.Add("pol");

                DataRow row;

                string   brRac = brojRacuna();
                DateTime dRac  = Convert.ToDateTime(DateTime.Now);
                string   dt    = dRac.ToString("yyyy-MM-dd H:mm:ss");

                DataTable DSbr = classSQL.select("SELECT MAX(CAST(broj_racuna AS integer)) FROM racuni " +
                                                 "WHERE  id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "' " +
                                                 "AND id_kasa='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'" +
                                                 "AND godina='" + DateTime.Now.Year.ToString() + "'"
                                                 , "racuni").Tables[0];

                string    sql = "SELECT * FROM racuni WHERE broj_racuna='" + DSbr.Rows[0][0].ToString() + "' AND id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "' AND godina='" + DateTime.Now.Year.ToString() + "' AND id_kasa='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'";
                DataTable DTr = classSQL.select(sql, "racuni").Tables[0];

                if (DTr.Rows.Count > 0)
                {
                    if (DTr.Rows[0]["storno"].ToString() == "DA")
                    {
                        MessageBox.Show("Ovaj je račun je već stonirani.");
                        return;
                    }
                    decimal dec;
                    decimal Dukupno_virman = 0;
                    if (!decimal.TryParse(DTr.Rows[0]["ukupno_virman"].ToString(), out dec))
                    {
                        Dukupno_virman = 0;
                    }
                    else
                    {
                        Dukupno_virman = Convert.ToDecimal(DTr.Rows[0]["ukupno_virman"].ToString());
                    }

                    string sqlR = "INSERT INTO racuni (" +
                                  " broj_racuna," +
                                  " datum_racuna," +
                                  " id_ducan," +
                                  " id_kasa," +
                                  " id_kupac," +
                                  " id_blagajnik," +
                                  " ukupno_gotovina," +
                                  " ukupno_kartice," +
                                  " storno," +
                                  " ukupno," +
                                  " dobiveno_gotovina," +
                                  " id_stol," +
                                  " nacin_placanja," +
                                  " ukupno_virman," +
                                  " godina" +
                                  ") VALUES (" +
                                  "'" + brRac + "'," +
                                  "'" + dt + "'," +
                                  "'" + DTr.Rows[0]["id_ducan"].ToString() + "'," +
                                  "'" + DTr.Rows[0]["id_kasa"].ToString() + "'," +
                                  "'" + DTr.Rows[0]["id_kupac"].ToString() + "'," +
                                  "'" + DTr.Rows[0]["id_blagajnik"].ToString() + "'," +
                                  "'" + (Convert.ToDouble(DTr.Rows[0]["ukupno_gotovina"].ToString()) * (-1)).ToString() + "'," +
                                  "'" + (Convert.ToDouble(DTr.Rows[0]["ukupno_kartice"].ToString()) * (-1)).ToString() + "'," +
                                  "'NE'," +
                                  "'" + (Convert.ToDouble(DTr.Rows[0]["ukupno"].ToString()) * (-1)).ToString() + "'," +
                                  "'" + DTr.Rows[0]["dobiveno_gotovina"].ToString() + "'," +
                                  "'" + DTr.Rows[0]["id_stol"].ToString() + "'," +
                                  "'" + DTr.Rows[0]["nacin_placanja"].ToString() + "'," +
                                  "'" + (Dukupno_virman * (-1)).ToString() + "'," +
                                  "'" + DTr.Rows[0]["godina"].ToString() + "'" +
                                  ")";

                    string aa = DTr.Rows[0]["ukupno_gotovina"].ToString();

                    provjera_sql(classSQL.insert(sqlR));

                    string sqlA = "SELECT * FROM racun_stavke WHERE broj_racuna='" + DSbr.Rows[0][0].ToString() + "'" +
                                  " AND id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "'" +
                                  " AND godina='" + DateTime.Now.Year.ToString() + "'" +
                                  " AND id_blagajna='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'";

                    DataTable DTA = classSQL.select(sqlA, "racun_stavke").Tables[0];

                    for (int i = 0; i < DTA.Rows.Count; i++)
                    {
                        sifra = DTA.Rows[i]["sifra_robe"].ToString();
                        row   = DTsend.NewRow();
                        row["broj_racuna"]     = brRac;
                        row["sifra_robe"]      = sifra;
                        row["mpc"]             = DTA.Rows[i]["mpc"].ToString();
                        row["godina"]          = DTA.Rows[i]["godina"].ToString();
                        row["id_skladiste"]    = DTA.Rows[i]["id_skladiste"].ToString();
                        row["porez"]           = DTA.Rows[i]["porez"].ToString();
                        row["kolicina"]        = (Convert.ToDouble(DTA.Rows[i]["kolicina"].ToString()) * (-1)).ToString();
                        row["rabat"]           = DTA.Rows[i]["rabat"].ToString();
                        row["vpc"]             = DTA.Rows[i]["vpc"].ToString();
                        row["cijena"]          = DTA.Rows[i]["mpc"].ToString();
                        row["porez_potrosnja"] = DTA.Rows[i]["porez_potrosnja"].ToString();
                        row["ime"]             = classSQL.select("SELECT naziv FROM roba WHERE sifra='" + sifra + "'", "roba").Tables[0].Rows[0][0].ToString();
                        row["stol"]            = DTr.Rows[0]["id_stol"].ToString();
                        row["nbc"]             = DTA.Rows[0]["nbc"].ToString().Replace(",", ".");
                        row["dod"]             = 0;
                        row["pol"]             = 0;

                        DTsend.Rows.Add(row);

                        sqlA = "INSERT INTO racun_stavke (broj_racuna,sifra_robe,id_skladiste,mpc,porez,kolicina,rabat,vpc,odjava,nbc,porez_potrosnja,id_ducan,godina,id_blagajna) VALUES (" +
                               "'" + brRac + "'," +
                               "'" + DTA.Rows[i]["sifra_robe"].ToString() + "'," +
                               "'" + DTA.Rows[i]["id_skladiste"].ToString() + "'," +
                               "'" + DTA.Rows[i]["mpc"].ToString() + "'," +
                               "'" + DTA.Rows[i]["porez"].ToString() + "'," +
                               "'" + (Convert.ToDouble(DTA.Rows[i]["kolicina"].ToString()) * (-1)).ToString() + "'," +
                               "'" + DTA.Rows[i]["rabat"].ToString() + "'," +
                               "'" + DTA.Rows[i]["vpc"].ToString().Replace(",", ".") + "'," +
                               "'" + DTA.Rows[i]["odjava"].ToString() + "'," +
                               "'" + DTA.Rows[i]["nbc"].ToString().Replace(",", ".") + "'," +
                               "'" + DTA.Rows[i]["porez_potrosnja"].ToString() + "'," +
                               "'" + DTA.Rows[i]["id_ducan"].ToString() + "'," +
                               "'" + DTA.Rows[i]["godina"].ToString() + "'," +
                               "'" + DTA.Rows[i]["id_blagajna"].ToString() + "'" +
                               ")";
                        provjera_sql(classSQL.insert(sqlA));

                        SQL.ClassSkladiste.GetAmountCaffe(DTA.Rows[i]["sifra_robe"].ToString(), DTA.Rows[i]["id_skladiste"].ToString(), (Convert.ToDouble(DTA.Rows[i]["kolicina"].ToString()) * (-1)).ToString(), "-");
                    }

                    if (DTr.Rows[0]["nacin_placanja"].ToString() == "G")
                    {
                        Util.Korisno.dodajIznosUBlagajnickiIzvjestaj(Convert.ToInt32(brRac), dRac, (Convert.ToDecimal(DTr.Rows[0]["ukupno"].ToString()) * (-1)));
                    }

                    //OVA FUNKCIJA POSTAVLJA SKLADIŠTE TAKO DA UZME U OBZIR SVE DOKUMENTE I ZAKLJUČI STANJE NA SKLADIŠTU
                    if (DTsettings.Rows[0]["skidaj_kolicinu_po_dokumentima"].ToString() == "1")
                    {
                        RobnoFunkcije.PostaviStanjeSkladista();
                    }

                    if (DTpostavkePrinter.Rows[0]["posPrinterBool"].ToString() == "1")
                    {
                        try
                        {
                            try
                            {
                                PosPrint.classPosPrintCaffe.PrintReceipt(DTsend, DTr.Rows[0]["id_blagajnik"].ToString(), brRac + "/" + DTr.Rows[0]["id_ducan"].ToString() + "/" + DTr.Rows[0]["id_kasa"].ToString(), DTr.Rows[0]["id_kupac"].ToString(), barcode, brRac, DTr.Rows[0]["nacin_placanja"].ToString(), "DA", 0);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                            if (MessageBox.Show("Desila se pogreška kod ispisa na 'mali' pos printer.\r\nŽelite li ispisati ovaj dokumenat na A4 format?\r\nOvo je orginalna greška:\r\n" + ex, "Printer", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                            {
                                Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                                rfak.dokumenat      = "RAC";
                                rfak.ImeForme       = "Račun";
                                rfak.broj_dokumenta = brRac;
                                rfak.ShowDialog();
                            }
                        }
                    }
                    else
                    {
                        Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                        rfak.dokumenat      = "RAC";
                        rfak.ImeForme       = "Račun";
                        rfak.broj_dokumenta = brRac;
                        rfak.ShowDialog();
                    }

                    if (DSbr.Rows.Count != 0)
                    {
                        classSQL.update("UPDATE racuni SET storno='DA' WHERE broj_racuna='" + DSbr.Rows[0][0].ToString() + "'" +
                                        " AND racuni.id_ducan='" + Util.Korisno.idDucan + "' AND racuni.id_kasa='" + Util.Korisno.idKasa + "';");
                    }

                    MessageBox.Show("Izvršeno");
                    this.Close();
                }
            }
        }
示例#9
0
        private void button1_Click(object sender, EventArgs e)
        {
            DTsend = new DataTable();
            DTsend.Columns.Add("broj_racuna");
            DTsend.Columns.Add("sifra_robe");
            DTsend.Columns.Add("id_skladiste");
            DTsend.Columns.Add("mpc");
            DTsend.Columns.Add("porez");
            DTsend.Columns.Add("kolicina");
            DTsend.Columns.Add("rabat");
            DTsend.Columns.Add("cijena");
            DTsend.Columns.Add("ime");
            DTsend.Columns.Add("vpc");
            DTsend.Columns.Add("porez_potrosnja");
            DataRow row;

            string sql = "SELECT racun_stavke.vpc,racun_stavke.sifra_robe,racun_stavke.porez_potrosnja,roba.naziv,racun_stavke.id_skladiste," +
                         "racun_stavke.mpc,racun_stavke.porez,racun_stavke.kolicina,racun_stavke.rabat FROM racun_stavke " +
                         " INNER JOIN roba ON roba.sifra=racun_stavke.sifra_robe" +
                         " WHERE racun_stavke.broj_racuna='" + textBox1.Text + "'" +
                         " AND id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "' " +
                         " AND id_blagajna='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'" +
                         " AND godina='2019'";

            DataTable DT = classSQL.select("SELECT * FROM racuni WHERE broj_racuna='" + textBox1.Text + "'  AND racuni.id_ducan='" + Util.Korisno.idDucan + "' AND racuni.id_kasa='" + Util.Korisno.idKasa + "'", "racuni").Tables[0];

            if (DT.Rows.Count == 0)
            {
                MessageBox.Show("Krivi unos.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DataTable DTitems           = classSQL.select(sql, "racun_stavke").Tables[0];
            DataTable DTpostavkePrinter = classSQL.select_settings("SELECT * FROM pos_print", "pos_print").Tables[0];
            string    imeBlagajnika     = classSQL.select("SELECT ime + ' ' + prezime AS name FROM zaposlenici WHERE id_zaposlenik='" + DT.Rows[0]["id_blagajnik"].ToString() + "'", "zaposlenici").Tables[0].Rows[0][0].ToString();

            for (int i = 0; i < DTitems.Rows.Count; i++)
            {
                sifra = DTitems.Rows[i]["sifra_robe"].ToString();
                row   = DTsend.NewRow();
                row["broj_racuna"]     = textBox1.Text;
                row["sifra_robe"]      = DTitems.Rows[i]["sifra_robe"].ToString();
                row["id_skladiste"]    = DTitems.Rows[i]["id_skladiste"].ToString();
                row["mpc"]             = DTitems.Rows[i]["mpc"].ToString();
                row["porez"]           = DTitems.Rows[i]["porez"].ToString();
                row["kolicina"]        = DTitems.Rows[i]["kolicina"].ToString();
                row["rabat"]           = DTitems.Rows[i]["rabat"].ToString();
                row["cijena"]          = DTitems.Rows[i]["mpc"].ToString();
                row["ime"]             = DTitems.Rows[i]["naziv"].ToString();
                row["vpc"]             = DTitems.Rows[i]["vpc"].ToString();
                row["porez_potrosnja"] = DTitems.Rows[i]["porez_potrosnja"].ToString();
                DTsend.Rows.Add(row);
            }

            classSQL.update("UPDATE racuni SET broj_ispisa=broj_ispisa+1 WHERE broj_racuna='" + textBox1.Text + "'" +
                            " AND id_ducan='" + DTsettings.Rows[0]["default_ducan"].ToString() + "' " +
                            " AND id_kasa='" + DTsettings.Rows[0]["default_blagajna"].ToString() + "'" +
                            " AND godina='" + DateTime.Now.Year.ToString() + "'");

            barcode = "000" + textBox1.Text;
            if (DTpostavkePrinter.Rows[0]["posPrinterBool"].ToString() != "0")
            {
                PosPrint.classPosPrintCaffeNaknadno.PrintReceipt(DTsend, imeBlagajnika, textBox1.Text + "/" + Util.Korisno.GodinaKojaSeKoristiUbazi.ToString(), DT.Rows[0]["id_kupac"].ToString(), barcode, textBox1.Text, "G", "");

                this.Close();
            }
            else
            {
                if (DTsend.Rows.Count > 0)
                {
                    Report.Faktura.repFaktura rfak = new Report.Faktura.repFaktura();
                    rfak.dokumenat      = "RAC";
                    rfak.ImeForme       = "Račun";
                    rfak.broj_dokumenta = textBox1.Text;
                    rfak.godina         = DateTime.Now.Year.ToString();
                    rfak.id_kasa        = DTsettings.Rows[0]["default_ducan"].ToString();
                    rfak.id_poslovnica  = DTsettings.Rows[0]["default_blagajna"].ToString();
                    this.Hide();
                    rfak.ShowDialog();
                    this.Close();
                }
            }
        }