Пример #1
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            //Aggiorno le intestazioni del DataGrid
            int esercizio = Convert.ToInt32(GetSys("esercizio"));

            if (ListingType == "tree" || ListingType == "treee" || ListingType == "treesupbnew" || ListingType == "treeeupbnew" ||
                ListingType == "trees" || ListingType == "treees" ||
                ListingType == "treeenew" || ListingType == "treesnew" ||
                ListingType == "treeeupb" || ListingType == "treesupb" ||
                ListingType == "treealle" || ListingType == "treealls" ||
                ListingType == "treeallenew" || ListingType == "treeallsnew" ||
                ListingType == "upbprevision")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "codefin", "Codice");
                DescribeAColumn(T, "leveldescr", "Livello");
                DescribeAColumn(T, "title", "Denominazione");
                DescribeAColumn(T, "manager", "Responsabile");
                DescribeAColumn(T, "cupcode", "CUP");
                DescribeAColumn(T, "prevision", "Prev. Iniziale Princ.");
                DescribeAColumn(T, "currentprevision", "Prev. Attuale Princ.");
                DescribeAColumn(T, "availableprevision", "Prev. Disponibile Princ.");
                if (Conn != null)
                {
                    int finkind = CfgFn.GetNoNullInt32(Conn.GetSys("fin_kind"));
                    if (finkind == 3)
                    {
                        DescribeAColumn(T, "secondaryprev", "Prev. Iniziale Second.");
                        DescribeAColumn(T, "currentsecondaryprev", "Prev. Attuale Second.");
                        DescribeAColumn(T, "availablesecondaryprev", "Prev. Disponibile Second.");
                    }
                }
            }

            base.DescribeTree(tree, T, ListingType);

            int    esercizionew    = esercizio + 1;
            string filterC         = QHC.CmpEq("nlevel", 1);
            string filtersql       = QHS.CmpEq("nlevel", 1);
            string kind            = "ES";
            string filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));

            if (ListingType == "treee")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
            }
            if (ListingType == "trees")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
            }
            if (ListingType == "treees")
            {
                //filter="(nlevel='1')";
                kind = "ES";
            }
            if (ListingType == "tree")
            {
                //filter="(nlevel='1')";
                kind = "ES";
            }
            if (ListingType == "treeenew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "E";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treeeupbnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "E";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }

            if (ListingType == "treesnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "S";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treesupbnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "S";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treeeupb")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
            }

            if (ListingType == "treesupb")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
            }

            if (ListingType == "upbprevision")
            {
                filtersql = QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin"));
                filterC   = QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin"));
                kind      = "ES";
            }

            bool all = false;

            if (ListingType == "treealle")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
                all  = true;
            }
            if (ListingType == "treealls")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
                all  = true;
            }

            if (ListingType == "treeallenew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind = "E";
                all  = true;
            }
            if (ListingType == "treeallsnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind = "S";
                all  = true;
            }
            int    maxlevel = 0;
            object o        = Conn.DO_READ_VALUE("finlevel", QHS.CmpEq("ayear", GetSys("esercizio")), "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            TreeViewManager M = new TreeViewBilancio(Conn, T, tree, filterC, filtersql, kind, all, maxlevel,
                                                     CfgFn.GetNoNullInt32(GetSys("finusablelevel")));

            myGetData.SetStaticFilter("finlevel", filteresercizio);
        }