public bool ObradiPlan()
        {
            bool ObradiPlan = false;

            Form forma = new Form();

            forma = Program.Parent.ActiveMdiChild;

            int IdDokView = Convert.ToInt32(forma.Controls["liddok"].Text);

            //Boolean vrati = new Boolean();
            //CRUD ccrud = new CRUD();
            //vrati = ccrud.DoIt(forma, Convert.ToString(((Bankom.frmChield)forma).iddokumenta), ((Bankom.frmChield)forma).imedokumenta);

            sql = "Delete from PlanProdajeStavke where ID_ArtikliView=1 and ID_DokumentaView =@param0";
            ret = db.ParamsInsertScalar(sql, IdDokView);

            if (forma.Controls["OOperacija"].Text == "UNOS")
            {
                if (forma.Controls.OfType <Field>().FirstOrDefault(n => n.IME == "NazivKom").Vrednost.Trim() == "") //nisu popunjena polja za stavke
                {
                    sql = "Select Id_DokumentaView from PlanProdajeStavke where ID_DokumentaView =@param0";
                    dt  = db.ParamsQueryDT(sql, IdDokView);
                    if (dt.Rows.Count > 0) // postoje stavke
                    {
                        if (MessageBox.Show("Da li brisete postojece promene?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            sql = "Delete from PlanProdajeStavke where ID_DokumentaView =@param0";
                            ret = db.ParamsInsertScalar(sql, IdDokView);
                        }
                    }
                    if (((Bankom.frmChield)forma).imedokumenta == "PlanProdaje")
                    {
                        ObradiPlan = NoviPlan(IdDokView);
                    }
                    else
                    {
                        ObradiPlan = NoviMesecniPlan(IdDokView);
                    }
                }
            }



            clsAzuriranja az = new clsAzuriranja();

            az.DodatnaAzuriranja(((Bankom.frmChield)forma).imedokumenta, IdDokView.ToString());

            db.ExecuteStoreProcedure("TotaliZaDokument", "NazivDokumenta:" + ((Bankom.frmChield)forma).imedokumenta, "IdDokument:" + IdDokView.ToString());
            ObradiPlan = true;

            return(ObradiPlan);
        }
        public Boolean PovlacenjeSaPrethodnika(string Dokument, int IdDokView)
        {
            Boolean PovlacenjeSaPrethodnika = false;

            string          str             = "";
            string          strParams       = "";
            List <string[]> lista           = new List <string[]>();
            string          strTabela       = "Dokumenta";
            string          DDDokument      = "";
            string          DokumentP       = "";
            string          BrDokP          = "";
            string          rezultat        = "";
            string          dokType         = "";
            string          MagPolje        = "";
            string          Id_MagPolje     = "1";
            string          Id_Skladiste    = "1";
            string          ID_ArtikliView  = "1";
            string          ID_JedinicaMere = "1";
            string          NazivArtikla    = "";
            int             i = 0;

            string[] lot2       = new string[1];
            string[] kol        = new string[1];
            string[] IdMagPolje = new string[1];
            decimal  pom        = 0;
            decimal  pom2       = 0;
            decimal  pom3       = 0;

            DataTable ts = new DataTable();
            DataTable tt = new DataTable();

            switch (OdakleSePreuzima)
            {
            case "P":
            {
                if (Prethodni.Trim() == "")
                {
                    return(PovlacenjeSaPrethodnika);
                }
                if (MessageBox.Show("Da li preuzimate podatke sa prethodnog dokumenta?", "Povlačenje sa prethodnika", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sql = "select  ds.naziv as Dokument , d.* from dokumenta as d, dokumentastablo as ds "
                          + " where ds.id_dokumentaStablo=d.id_DokumentaStablo and d.id_dokumenta=@param0";

                    DataTable dt = db.ParamsQueryDT(sql, ID_Prethodni);
                    if (dt.Rows.Count != 0)
                    {
                        DokumentP = dt.Rows[0]["Dokument"].ToString();
                        BrDokP    = dt.Rows[0]["BrojDokumenta"].ToString();
                        sql       = "select UlazniIzlazni  as NazivKlona,NacinRegistracije,prikaz,vrsta,OdakleSePreuzima from SifarnikDokumenta where Naziv=@param0";
                        DataTable dt1 = db.ParamsQueryDT(sql, DokumentP);
                        if (dt1.Rows.Count != 0)
                        {
                            DDDokument = dt1.Rows[0]["NazivKlona"].ToString();
                        }
                    }

                    if (NazivKlona == "LotOtpremnica")
                    {
                        MagPolje = Prompt.ShowDialog("", "Preuzimanje otpremnice ", "Unesite magacinsko polje: ");
                        if (MagPolje == "")
                        {
                            MessageBox.Show("Niste uneli magacinsko polje ponovite !!!"); return(PovlacenjeSaPrethodnika);
                        }
                        sql = "Select ID_MagacinskaPoljaStavkeView as ID_MagacinskaPolja From MagacinskaPoljaStavkeView where NazivPolja=@param0";
                        DataTable dt2 = db.ParamsQueryDT(sql, MagPolje);
                        if (dt2.Rows.Count != 0)
                        {
                            Id_MagPolje = dt2.Rows[0]["ID_MagacinskaPolja"].ToString();
                        }
                        else
                        {
                            MessageBox.Show("Pogresna vrednost za  polje: " + MagPolje);
                            return(PovlacenjeSaPrethodnika);
                        }
                    }

                    str = "Execute PrethSled '" + DDDokument + "', '" + NazivKlona.Trim() + "', " + ID_Prethodni + ", " + IdDokView;
                    lista.Add(new string[] { str, strParams, strTabela, dokType, IdDokView.ToString() });
                    lista.ToArray();

                    if (NazivKlona == "LotOtpremnica")
                    {
                        sql = "Select ID_KomitentiView  From " + DDDokument.Trim() + "Totali where ID_" + DDDokument.Trim() + "Totali=" + ID_Prethodni;
                        DataTable dtt = db.ReturnDataTable(sql);
                        if (dtt.Rows.Count != 0)
                        {
                            strParams  = "@param1=" + dtt.Rows[0]["ID_KomitentiView"].ToString() + "`";
                            strParams += "@param2=" + IdDokView.ToString() + "`";
                            str        = "update otpremnica set [ID_MestoIsporuke]=@param1 Where [ID_DokumentaView] = @param2";
                            lista.Add(new string[] { str, strParams, "otpremnica", dokType, IdDokView.ToString() });
                            lista.ToArray();
                        }

                        strParams  = "@param1=" + BrDokP + "`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update otpremnica set [BrojOtp]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "otpremnica", dokType, IdDokView.ToString() });
                        lista.ToArray();

                        strParams  = "@param1=Obrenovac`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update otpremnica set [MestoUtovara]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Otpremnica", dokType, IdDokView.ToString() });
                        lista.ToArray();

                        strParams  = "@param1=" + Program.idkadar.ToString() + "`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update otpremnica set [ID_Magacioner]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Otpremnica", dokType, IdDokView.ToString() });
                        lista.ToArray();

                        sql = " select  ID_ArtikliView ,Kolicina , ID_Skladiste,NazivArtikla,otpremnicastavke.ID_JedinicaMere "
                              + " from Otpremnica, Otpremnicastavke,artikli "
                              + " where otpremnica.id_dokumentaview = Otpremnicastavke.id_dokumentaview and ID_ArtikliView =id_Artikli "
                              + " and otpremnica.id_dokumentaview =@param0";
                        DataTable dt3 = db.ParamsQueryDT(sql, ID_Prethodni);
                        if (dt3.Rows.Count != 0)
                        {
                            Id_Skladiste = dt3.Rows[0]["ID_Skladiste"].ToString();

                            sql = " select ID_MagacinskaPoljaStavkeView  From MagacinskaPoljaStavkeView where NazivPolja=@param0 "
                                  + " and ID_Skladiste =@param1 ";
                            DataTable dt4 = db.ParamsQueryDT(sql, MagPolje, Id_Skladiste);
                            if (dt4.Rows.Count == 0)
                            {
                                return(PovlacenjeSaPrethodnika);
                            }

                            foreach (DataRow row in dt3.Rows)
                            {
                                ID_ArtikliView  = row["ID_ArtikliView"].ToString();
                                NazivArtikla    = row["NazivArtikla"].ToString();
                                ID_JedinicaMere = row["ID_JedinicaMere"].ToString();
                                pom             = 0;
                                sql             = " select  ID_LotView, SUM(Stanje) AS saldo, ID_MagacinskaPolja  from StanjeRobeNaSkl "
                                                  + " where ID_ArtikliView=@param0 and ID_MagacinskaPolja =@param1"
                                                  + " and ID_Skladiste =@param2 "
                                                  + " group by ID_LotView, DatumIsteka, ID_MagacinskaPolja "
                                                  + " having (Sum(Stanje) > 0) "
                                                  + " order by DatumIsteka ";
                                DataTable dt5 = db.ParamsQueryDT(sql, ID_ArtikliView, Id_MagPolje, Id_Skladiste);

                                if (dt5.Rows.Count == 0)
                                {
                                    MessageBox.Show("Nema dovoljno " + NazivArtikla + " na polju: " + MagPolje);

                                    strParams  = "@param1=" + IdDokView.ToString() + "`";
                                    strParams += "@param2=" + ID_ArtikliView + "`";
                                    str        = "delete from OtpremnicaStavke where [ID_DokumentaView] = @param1 and [ID_ArtikliView]=@param2";
                                    lista.Add(new string[] { str, strParams, "OtpremnicaStavke", dokType, IdDokView.ToString() });
                                    lista.ToArray();

                                    goto Sledeci;
                                }
                                i    = 0;
                                pom2 = 0;
                                foreach (DataRow row1 in dt5.Rows)
                                {
                                    lot2[i]       = row1["ID_LotView"].ToString();
                                    pom          += Convert.ToDecimal(row1["saldo"].ToString());
                                    IdMagPolje[i] = row1["ID_MagacinskaPolja"].ToString();

                                    if (pom >= Convert.ToDecimal(row["Kolicina"]))
                                    {
                                        if (i == 0)
                                        {
                                            kol[i] = row["Kolicina"].ToString();
                                        }
                                        else
                                        {
                                            pom3   = (Convert.ToDecimal(row["Kolicina"]) - pom2);
                                            kol[i] = pom3.ToString();
                                        }
                                        break;
                                    }
                                    else
                                    {
                                        pom2  += Convert.ToDecimal(row1["saldo"].ToString());
                                        kol[i] = row1["saldo"].ToString();
                                        i     += 1;
                                        Array.Resize(ref lot2, i + 1);
                                        Array.Resize(ref kol, i + 1);
                                        Array.Resize(ref IdMagPolje, i + 1);
                                    }
                                }

                                if (pom < Convert.ToDecimal(row["Kolicina"]))
                                {
                                    MessageBox.Show("Nema dovoljno " + NazivArtikla + " na polju: " + MagPolje);

                                    strParams  = "@param1=" + IdDokView.ToString() + "`";
                                    strParams += "@param2=" + ID_ArtikliView + "`";
                                    str        = "delete from OtpremnicaStavke where [ID_DokumentaView] = @param1 and [ID_ArtikliView]=@param2";
                                    lista.Add(new string[] { str, strParams, "OtpremnicaStavke", dokType, IdDokView.ToString() });
                                    lista.ToArray();

                                    goto Sledeci;
                                }


                                for (int c = 0; c <= i; c++)
                                {
                                    if (c == 0)
                                    {
                                        strParams  = "@param1=" + kol[c] + "`";
                                        strParams += "@param2=" + lot2[c] + "`";
                                        strParams += "@param3=" + IdMagPolje[c] + "`";
                                        strParams += "@param4=" + IdDokView.ToString() + "`";
                                        strParams += "@param5=" + ID_ArtikliView + "`";
                                        str        = "update OtpremnicaStavke set [kolicina]=@param1,[ID_LotView]=@param2, [ID_MagacinskaPolja]=@param3"
                                                     + " where [ID_DokumentaView] = @param4 and  [ID_ArtikliView]=@param5";
                                        lista.Add(new string[] { str, strParams, "OtpremnicaStavke", dokType, IdDokView.ToString() });
                                        lista.ToArray();
                                    }
                                    else
                                    {
                                        strParams  = "@param1=" + IdDokView.ToString() + "`";
                                        strParams += "@param2=" + ID_JedinicaMere + "`";
                                        strParams += "@param3=" + ID_ArtikliView + "`";
                                        strParams += "@param4=" + kol[c] + "`";
                                        strParams += "@param5=0`";
                                        strParams += "@param6=0`";
                                        strParams += "@param7= `";
                                        strParams += "@param8=" + Program.idkadar.ToString() + "`";
                                        strParams += "@param9=" + DateTime.Now + "`";
                                        strParams += "@param10=" + lot2[c] + "`";
                                        strParams += "@param11=" + IdMagPolje[c] + "`";
                                        strParams += "@param12= `";

                                        str  = "Insert Into OtpremnicaStavke ( [ID_DokumentaView], [ID_JedinicaMere],";
                                        str += " [ID_ArtikliView], [Kolicina], [ProdajnaCena], [KolicinaPoDokumentu],";
                                        str += " [Primedba],[UUser],[TTime],[ID_LotView],[ID_MagacinskaPolja],[Paleta])";
                                        str += " values (@param1,@param2,@param3,@param4,@param5,@param6,@param7,@param8,@param9,@param10,@param11,@param12)";

                                        lista.Add(new string[] { str, strParams, "OtpremnicaStavke", dokType, IdDokView.ToString() });
                                        lista.ToArray();
                                    }
                                }

                                Sledeci :;
                            }
                        }
                    }        // Kraj LOtOtpremnica
                    if (NazivKlona == "NarudzbenicaKupca")
                    {
                        strParams  = "@param1= `";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update Predracun set [Napomena]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Predracun", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }
                    if (NazivKlona == "KonacniRacun" || NazivKlona == "PDVIzlazniRacunZaUsluge")
                    {
                        strParams  = "@param1=1`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update Racun set [ID_Avansi]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Racun", dokType, IdDokView.ToString() });
                        lista.ToArray();

                        strParams  = "@param1=1`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update RacunZaUsluge set [ID_AvansiIzvodi]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "RacunZaUsluge", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }
                    //MENJAMO POLJA KOJA NE TREBAJU POSTOJATI U NOVOM DOKUMENTU A ZAPISANA SU U TOKU POVLACENJA SA PRETHODNIKA
                    if (NazivKlona == "KonacniUlazniRacun" || Dokument == "UlazniAvansniRacun")
                    {
                        strParams  = "@param1= `";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update Racun set [BrUr]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Racun", dokType, IdDokView.ToString() });
                        lista.ToArray();


                        strParams  = "@param1= `";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update Racun set [Otpremnica]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "Racun", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }

                    if (NazivKlona == "PDVUlazniRacunZaUsluge")
                    {
                        strParams  = "@param1= `";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update RacunZaUsluge set [BrUr]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "RacunZaUsluge", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }

                    if (NazivKlona.Contains("lazniJCI") == true)
                    {
                        strParams  = "@param1=" + ID_Prethodni + "`";
                        strParams += "@param2=" + IdDokView.ToString() + "`";
                        str        = "update JCI set [ID_RacunTotali]=@param1 Where [ID_DokumentaView] = @param2";
                        lista.Add(new string[] { str, strParams, "JCI", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }
                    // Jovana 20.09.21 - za Bojanu P. kod preuzimanja izlaznog JCI-ja sa ino racuna da uzme vrednost sa rabatom
                    if (NazivKlona == "IzlazniJCI")
                    {
                        sql = " select ID_DokumentaStablo from dokumenta "
                              + " where id_dokumenta=@param0 ";
                        DataTable dtDok = db.ParamsQueryDT(sql, ID_Prethodni);

                        if (dtDok.Rows.Count != 0)
                        {
                            if (dtDok.Rows[0]["ID_DokumentaStablo"].ToString() == "4")
                            {
                                strParams  = "@param1=" + IdDokView.ToString() + "`";
                                strParams += "@param2=" + ID_Prethodni + "`";
                                str        = "update JCIStavke set [ProdajnaCena]=NetoProdajna from InoRacunTotali Where JCIStavke.[ID_DokumentaView] = @param1"
                                             + "  and JCIStavke.ID_ArtikliView = InoRacunTotali.ID_ArtikliView and ID_InoRacunTotali=@param2 ";
                                lista.Add(new string[] { str, strParams, "JCIStavke", dokType, IdDokView.ToString() });
                                lista.ToArray();
                            }
                        }
                    }
                    // Jovana 16.12.21 - za Rasu da moze da preuzme ino racun bez kursne liste azurira se datumu uplate na datum racuna, a ne na danasnji datum
                    if (NazivKlona == "InoRacun")
                    {
                        strParams = "@param1=" + IdDokView.ToString() + "`";
                        str       = "update Racun set DatumUplate = Datum from Racun, Dokumenta Where Racun.ID_DokumentaView =Dokumenta.ID_Dokumenta and Racun.[ID_DokumentaView] = @param1";
                        lista.Add(new string[] { str, strParams, "Racun", dokType, IdDokView.ToString() });
                        lista.ToArray();
                    }

                    str = "Execute TotaliZaDokument '" + NazivKlona.Trim() + "'," + IdDokView.ToString();
                    lista.Add(new string[] { str, strParams, strTabela, dokType, "" });
                    lista.ToArray();

                    sql = "select polje from recnikpodataka where dokument=@param0 and polje=@param1";
                    tt  = db.ParamsQueryDT(sql, NazivKlona, "NazivSkl");
                    if (tt.Rows.Count > 0)
                    {
                        // poziv potrebnih storedprocedura
                        str = "Execute CeneArtikalaPoSkladistimaIStanje " + IdDokView.ToString();
                        lista.Add(new string[] { str, strParams, strTabela, dokType, "" });
                        lista.ToArray();

                        str = "Execute StanjeRobePoLotu " + IdDokView.ToString();
                        lista.Add(new string[] { str, strParams, strTabela, dokType, "" });
                        lista.ToArray();

                        // provera stanja nakon povlacenja slogova sa prethodnika
                        if (TrebaProvera != "0")
                        {
                            dokType   = "";
                            strParams = "";
                            str       = "Execute stanje";
                            strTabela = NazivKlona;
                            lista.Add(new string[] { str, strParams, strTabela, dokType, IdDokView.ToString() });
                            lista.ToArray();
                        }
                    }

                    //Djora 06.09.21
                    //BackgroundWorker bw = new BackgroundWorker();
                    //bw.DoWork += new DoWorkEventHandler(bw_DoWork);
                    //this.bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                    //this.bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
                    //bw.WorkerReportsProgress = true;
                    //bw.RunWorkerAsync();

                    //Djora 06.09.21
                    var thread2 = new System.Threading.Thread(WriteTextUnsafe);
                    thread2.Start();


                    //Djora 04.09.21
                    //clsRazneFunkcije spin = new clsRazneFunkcije();
                    //spin.SakriSveKontrole();

                    //spin.spinOn2();
                    //spin.spinerOn();

                    //frmSpiner sp = new frmSpiner();
                    //sp.Show();

                    rezultat = db.ReturnSqlTransactionParamsFull(lista);

                    //Djora 04.09.21
                    //spin.spinOff();

                    //Djora 10.09.21
                    //if (rezultat.Trim() != "") { lista.Clear(); MessageBox.Show(rezultat); return false; }
                    if (rezultat.Substring(rezultat.IndexOf("|") + 1).Trim() != "")
                    {
                        lista.Clear(); MessageBox.Show(rezultat); return(false);
                    }

                    lista.Clear();
                    // Jovana 27.04.21
                    // upis u log
                    CRUD l = new CRUD();
                    l.CreateLog(IdDokView.ToString(), "-1", Dokument, "UNOS", "Uuu" + NazivKlona + "StavkeView");

                    //Jovana 25.05.21
                    clsAzuriranja az = new clsAzuriranja();
                    az.DodatnaAzuriranja(NazivKlona, IdDokView.ToString());
                    az.DodatnaAzuriranjaPosleUnosa(NazivKlona, IdDokView.ToString());

                    db.ExecuteStoreProcedure("TotaliZaDokument", "NazivDokumenta:" + NazivKlona, "IdDokument:" + IdDokView.ToString());
                    db.ExecuteStoreProcedure("CeneArtikalaPoSkladistimaIStanje", "IdDokView:" + IdDokView.ToString());
                    db.ExecuteStoreProcedure("StanjeRobePoLotu", "IdDokView:" + IdDokView.ToString());
                }
            }
            break;

            case "F":
            case "M":

                if (NazivKlona == "KursnaLista")
                {
                    string      format   = "dd.MM.yy";
                    CultureInfo provider = CultureInfo.InvariantCulture;

                    string Datum = Prompt.ShowDialog("", "Prepis kursne liste", "Izaberite datum iz kog prepisujete u formatu dd.mm.yy");
                    if (Datum.Trim() == "")
                    {
                        PovlacenjeSaPrethodnika = false;
                        break;
                    }
                    //tamara 7.5.2021.
                    string proveraDatuma = Datum.ToString();
                    // Jovana 29.11.21 - nije postojala validacija datuma
                    clsKorekcija k = new clsKorekcija();
                    if (k.CheckDate(proveraDatuma) == false)
                    //    bool rez = Validacija(proveraDatuma);
                    //if (rez==false)
                    {
                        MessageBox.Show("Niste uneli ispravan format datuma.");
                        PovlacenjeSaPrethodnika = false;
                        return(PovlacenjeSaPrethodnika);
                    }
                    else
                    {
                        DateTime DatumKursneListe = DateTime.ParseExact(Datum, format, provider);
                        sql = "select ID_DokumentaView from KursnaLista where Datum = @param0 ";
                        DataTable dkl = db.ParamsQueryDT(sql, DatumKursneListe);
                        if (dkl.Rows.Count == 0)
                        {
                            MessageBox.Show("Nema kursne liste za taj datum u bazi");
                        }
                        else
                        {
                            sql = "select datum from Dokumenta where Id_Dokumenta = @param0 ";
                            DataTable dkl1 = db.ParamsQueryDT(sql, IdDokView);
                            if (dkl1.Rows.Count == 0)
                            {
                                MessageBox.Show("Nije registrovan dokument kursna lista!");
                            }
                            else
                            {
                                sql = "select datum from KursnaLista where Datum = @param0 ";
                                DataTable dkl2 = db.ParamsQueryDT(sql, dkl1.Rows[0]["datum"].ToString());
                                if (dkl2.Rows.Count == 0)
                                {
                                    db.ExecuteStoreProcedure("[PrepisKursneListe]", "Datum:" + dkl1.Rows[0]["datum"].ToString(),
                                                             "ID_DokumentaViewPreth:" + dkl.Rows[0]["ID_DokumentaView"].ToString(),
                                                             "ID_DokumentaViewSledb:" + IdDokView.ToString());
                                    db.ExecuteStoreProcedure("TotaliZaDokument", "NazivDokumenta:" + NazivKlona, "IdDokument:" + IdDokView);
                                }
                                else
                                {
                                    MessageBox.Show("Kursna Lista za taj datum vec postoji!");
                                }
                            }
                        }
                    }
                }
                break;
            }
            PovlacenjeSaPrethodnika = true;
            return(PovlacenjeSaPrethodnika);
        }