Exemplo n.º 1
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "", -1);
                }
                DescribeAColumn(T, "leveldescr", "Livello", 1);
                DescribeAColumn(T, "sortcode", "Codice", 2);
                DescribeAColumn(T, "description", "Denominazione", 3);
                DescribeAColumn(T, "movkind", "Tipo movimento", 4);
                DescribeAColumn(T, "printingorder", "Ordine stampa", 5);
                DescribeAColumn(T, "incomeprevision", "Budget Ricavi", 6);
                DescribeAColumn(T, "expenseprevision", "Budget Costi", 7);
            }


            base.DescribeTree(tree, T, ListingType);
            string filterc   = QHC.CmpEq("nlevel", 1);
            string filtersql = QHS.CmpEq("nlevel", 1);

            int eserc = CfgFn.GetNoNullInt32(GetSys("esercizio"));

            filterc   = QHC.AppAnd(filterc, QHC.NullOrLe("start", eserc), QHC.NullOrGe("stop", eserc));
            filtersql = QHC.AppAnd(filtersql, QHS.NullOrLe("start", eserc), QHS.NullOrGe("stop", eserc));

            TreeViewManager M = new TreeViewClassMovimentiView(T, tree, filterc, filtersql);
        }
Exemplo n.º 2
0
        public override bool FilterRow(DataRow R, string list_type)
        {
            if ((list_type == "bilancio") || (list_type == "upb"))
            {
                if (R.Table.DataSet.Tables["finvar"] != null)
                {
                    DataTable tFinVar      = R.Table.DataSet.Tables["finvar"];
                    string    filterFinVar = QHC.AppAnd(QHC.CmpEq("yvar", R["yvar"]),
                                                        QHC.CmpEq("nvar", R["nvar"]));

                    if (tFinVar.Select(filterFinVar).Length > 0)
                    {
                        DataRow rFinVar = tFinVar.Select(filterFinVar)[0];
                        if (CfgFn.GetNoNullInt32(rFinVar["idfinvarstatus"]) != 5)
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
                return(true);
            }

            return(true);
        }
Exemplo n.º 3
0
 public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
 {
     // Listing Type chiamato dal form di gestione di budgetprevision (fissato l'IDFIN)
     if (ListingType == "tree")
     {
         object idSorting = T.ExtendedProperties["idsor"];
         base.DescribeTree(tree, T, ListingType);
         string          filterC         = QHC.AppAnd(QHC.CmpEq("idsor", idSorting), QHC.IsNull("paridupb"));
         string          filterSql       = QHS.AppAnd(QHS.CmpEq("idsor", idSorting), QHS.IsNull("paridupb"));
         string          filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
         TreeViewManager M = new TreeViewbudgetprevision(T, tree, filterC, filterSql, null);
         myGetData.SetStaticFilter("sortinglevel", filteresercizio);
     }
 }
Exemplo n.º 4
0
 public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
 {
     // Listing Type chiamato dal form di gestione di ACCOUNTYEAR (fissato l'IDACC)
     if (ListingType == "tree")
     {
         string idAcc = T.ExtendedProperties["idacc"].ToString();
         base.DescribeTree(tree, T, ListingType);
         string          filterc         = QHC.AppAnd(QHC.CmpEq("idacc", idAcc), QHC.IsNull("paridupb"));
         string          filtersql       = QHS.AppAnd(QHS.CmpEq("idacc", idAcc), QHS.IsNull("paridupb"));
         string          filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
         TreeViewManager M = new TreeViewAccountYear(Conn, T, tree, filterc, filtersql, null, 10);
         myGetData.SetStaticFilter("accountlevel", filteresercizio);
     }
 }
Exemplo n.º 5
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            base.DescribeTree(tree, T, ListingType);
            string filterc   = QHC.CmpEq("nlevel", "1");
            string filtersql = QHS.CmpEq("nlevel", "1");

            if (ListingType != "history")
            {
                int eserc = CfgFn.GetNoNullInt32(GetSys("esercizio"));
                filterc   = QHC.AppAnd(filterc, QHC.NullOrLe("start", eserc), QHC.NullOrGe("stop", eserc));
                filtersql = QHC.AppAnd(filtersql, QHS.NullOrLe("start", eserc), QHS.NullOrGe("stop", eserc));
            }
            //			if (ListingType=="tree"){
            //				string eserc = esercizio.ToString();
            //				filter=filter+"AND(esercizio='" + eserc + "')";
            //			}
            //easy_node_dispatcher D = new easy_node_dispatcher(
            //    "sortinglevel",
            //    "nlevel",
            //    "description",
            //    "flagusable",
            //    "description",
            //    "sortcode"
            //    );
            int    maxlevel        = 0;
            string filterSortLevel = "";

            if (ListingType == "tree5")
            {
                maxlevel        = 5;
                filterSortLevel = QHS.CmpLe("nlevel", maxlevel);
                myGetData.SetStaticFilter("sortinglevel", filterSortLevel);
            }

            bool all = false;

            if (ListingType == "treeall")
            {
                all = true;
            }
            //object o = T.ExtendedProperties["idsorkindFilter"];
            //string filtro = o==null
            //    ? QHS.BitSet("flag", 1)
            //    : QHS.AppAnd(o.ToString(), QHS.BitSet("flag", 1));
            //int levelop = CfgFn.GetNoNullInt32(Conn.DO_READ_VALUE("sortinglevel", filtro, "min(nlevel)"));
            TreeViewManager M = new TreeViewClassMovimenti(Conn, T, tree, filterc, filtersql, all, maxlevel);          //, levelop);
        }
Exemplo n.º 6
0
        //string removefilterupb(string filter){
        //          if (filter.IndexOf("AND(idupb IS NULL)")>=0) {
        //              return filter.Replace("AND(idupb IS NULL)", "");
        //          }
        //	int i = filter.IndexOf("(idupb=");
        //	if (i<0) return filter;
        //	int j= filter.IndexOf(")",i+5);
        //          if (filter.Length >= j + 4) {
        //              if (filter.Substring(j, 4).ToLower() == ")and") {
        //                  j += 3;
        //              }
        //          }

        //    if (filter.Length >= j + 2 && i>=3) {
        //        if (filter[j + 1] == ')' && filter.Substring(i-3, 3).ToLower() == "and") {
        //            i -= 3;//caso in cui c'è ... AND(idupb='asasa'))
        //        }
        //    }
        //	//if (j+1< filter.Length)
        //          return removefilterupb(filter.Substring(0, i) + filter.Substring(j + 1));
        //}

        public override string GetStaticFilter(string ListingType)
        {
            string filteresercizio, filtraSuUpbLibero;

            //if ((ListingType!="default")&&(ListingType!="upbprevision"))
            if ((ListingType == "tree") || (ListingType == "treee") || (ListingType == "trees") ||
                (ListingType == "treees") || (ListingType == "manager") || (ListingType == "treeenew") || (ListingType == "treesnew") ||
                (ListingType == "treealle") || (ListingType == "treealls") ||
                (ListingType == "treeallenew") || (ListingType == "treeallsnew") ||
                (ListingType == "treeeupb") || (ListingType == "treesupb"))
            {
                filteresercizio   = QHC.CmpEq("ayear", GetSys("esercizio"));
                filtraSuUpbLibero = QHC.AppAnd(filteresercizio, QHC.CmpEq("idupb", "0001"));
                return(filtraSuUpbLibero);
            }
            return(base.GetStaticFilter(ListingType));
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        void CalcolaUbicazioneResponsabile(System.Data.DataRow R)
        {
            //Mette in !location la riga di assetlocation con data null
            DataTable AssetLocation = R.Table.DataSet.Tables["assetlocation"];
            DataTable Location      = R.Table.DataSet.Tables["location"];

            DataRow [] RAL = AssetLocation.Select(QHC.AppAnd(QHC.CmpEq("idasset", R["idasset"]),
                                                             QHC.IsNull("start")));
            if (RAL.Length > 0)
            {
                object    idlocation = RAL[0]["idlocation"];
                DataRow[] RLoc       = Location.Select(QHC.CmpEq("idlocation", idlocation));
                if (RLoc.Length == 0)
                {
                    Conn.RUN_SELECT_INTO_TABLE(Location, null, QHS.CmpEq("idlocation", idlocation), null, false);
                    RLoc = Location.Select(QHC.CmpEq("idlocation", idlocation));
                }

                if (RLoc.Length > 0)
                {
                    R["!location"] = RLoc[0]["description"];
                }
                else
                {
                    R["!location"] = "";
                }
            }
            else
            {
                R["!location"] = "";
            }


            //Mette in !manager la riga di assetmanager con data null
            DataTable AssetManager = R.Table.DataSet.Tables["assetmanager"];
            DataTable Manager      = R.Table.DataSet.Tables["manager"];

            DataRow[] RAM = AssetManager.Select(QHC.AppAnd(QHC.CmpEq("idasset", R["idasset"]),
                                                           QHC.IsNull("start")));
            if (RAM.Length > 0)
            {
                object    idmanager = RAM[0]["idman"];
                DataRow[] RMan      = Manager.Select(QHC.CmpEq("idman", idmanager));
                if (RMan.Length == 0)
                {
                    Conn.RUN_SELECT_INTO_TABLE(Manager, null, QHS.CmpEq("idman", idmanager), null, false);
                    RMan = Manager.Select(QHC.CmpEq("idman", idmanager));
                }
                if (RMan.Length > 0)
                {
                    R["!manager"] = RMan[0]["title"];
                }
                else
                {
                    R["!manager"] = "";
                }
            }
            else
            {
                R["!manager"] = "";
            }

            //Mette in !submanager la riga di assetsubmanager con data null
            DataTable AssetSubManager = R.Table.DataSet.Tables["assetsubmanager"];
            DataTable SubManager      = R.Table.DataSet.Tables["submanager"];

            DataRow[] RAsubM = AssetSubManager.Select(QHC.AppAnd(QHC.CmpEq("idasset", R["idasset"]),
                                                                 QHC.IsNull("start")));
            if (RAsubM.Length > 0)
            {
                object    idmanager = RAsubM[0]["idmanager"];
                DataRow[] RAsubMan  = SubManager.Select(QHC.CmpEq("idman", idmanager));
                if (RAsubMan.Length == 0)
                {
                    Conn.RUN_SELECT_INTO_TABLE(SubManager, null, QHS.CmpEq("idman", idmanager), null, false);
                    RAsubMan = SubManager.Select(QHC.CmpEq("idman", idmanager));
                }
                if (RAsubMan.Length > 0)
                {
                    R["!submanager"] = RAsubMan[0]["title"];
                }
                else
                {
                    R["!submanager"] = "";
                }
            }
            else
            {
                R["!submanager"] = "";
            }
        }
Exemplo n.º 9
0
        override public DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            DataTable Levels = T.DataSet.Tables["sortinglevel"];

            if (Levels == null)
            {
                return(null);
            }
            bool   linear = false;
            int    level;
            string codprefix;
            string ordinestampaprefix;

            if (ParentRow != null)
            {
                level              = Convert.ToInt32(ParentRow["nlevel"]) + 1;
                codprefix          = ParentRow["sortcode"].ToString();
                ordinestampaprefix = ParentRow["printingorder"].ToString();
            }
            else
            {
                level              = 1;
                codprefix          = "";
                ordinestampaprefix = "";
            }
            if (level > (Levels.Select(QHC.CmpEq("idsorkind", this.ExtraParameter)).Length))
            {
                MessageBox.Show("Non è possibile inserire un livello inferiore a quello selezionato");
                return(null);
            }
            int    len  = 6;
            string kind = "A";

            DataRow [] levrow = Levels.Select(QHC.AppAnd(QHC.CmpEq("idsorkind", this.ExtraParameter), QHC.CmpEq("nlevel", level)));

            if (levrow.Length != 1)
            {
                return(null);
            }

            int flag = CfgFn.GetNoNullInt32(levrow[0]["flag"]);

            len  = flag >> 8;
            kind = (flag & 1) != 0 ? "A" : "N";
            if ((flag & 4) == 0)
            {
                linear = true;
            }

            T.Columns["sortcode"].ExtendedProperties["length"] = codprefix.Length + len;
            if (kind.ToUpper() == "A")
            {
                RowChange.MarkAsAutoincrement(T.Columns["printingorder"], null, ordinestampaprefix, len, linear);
            }

            SetDefault(T, "nlevel", level);

            //RowChange.SetSelector(T,"idsorkind");
            RowChange.MarkAsAutoincrement(T.Columns["idsor"], null, null, 8);

            if (kind.ToLower() == "a")
            {
                SetDefault(T, "sortcode", codprefix);
                RowChange.ClearAutoIncrement(T.Columns["sortcode"]);
                SetDefault(T, "printingorder", ordinestampaprefix);               //??
            }
            else
            {
                RowChange.MarkAsAutoincrement(T.Columns["sortcode"],
                                              null, codprefix, len, linear);
                RowChange.MarkAsAutoincrement(T.Columns["printingorder"],
                                              null, ordinestampaprefix, len, linear);
                if (!linear)
                {
                    RowChange.SetMySelector(T.Columns["sortcode"], "paridsor", 0);
                    RowChange.SetMySelector(T.Columns["printingorder"], "paridsor", 0);
                }
                RowChange.SetMySelector(T.Columns["sortcode"], "idsorkind", 0);
                RowChange.SetMySelector(T.Columns["printingorder"], "idsorkind", 0);
            }


            DataRow R = base.Get_New_Row(ParentRow, T);

            if (kind.ToLower() == "a")
            {
                RowChange.ClearAutoIncrement(T.Columns["printingorder"]);
            }
            return(R);
        }
Exemplo n.º 10
0
        override public DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            DataTable Levels = T.DataSet.Tables["accountlevel"];

            if (Levels == null)
            {
                return(null);
            }
            int    level;
            string codprefix;
            string ordinestampaprefix;
            object esercizio = T.Columns["ayear"].DefaultValue;

            if (esercizio == DBNull.Value)
            {
                esercizio = Conn.GetEsercizio();
            }

            if (ParentRow != null)
            {
                level              = Convert.ToInt32(ParentRow["nlevel"]) + 1;
                codprefix          = ParentRow["codeacc"].ToString();
                ordinestampaprefix = ParentRow["printingorder"].ToString();
            }
            else
            {
                level              = 1;
                codprefix          = "";
                ordinestampaprefix = "";
                SetDefault(T, "paridacc", esercizio.ToString().Substring(2, 2));
            }
            if (level > Levels.Rows.Count)
            {
                MessageBox.Show("Non è possibile inserire un livello inferiore a quello selezionato");
                return(null);
            }
            string kind = "A";             //corresponding to "flagreset"

            DataRow [] levrow = Levels.Select(QHC.AppAnd(QHC.CmpEq("nlevel", level), QHC.CmpEq("ayear", esercizio)));

            if (levrow.Length != 1)
            {
                return(null);
            }

            SetDefault(T, "nlevel", level);

            RowChange.MarkAsAutoincrement(T.Columns["idacc"],
                                          "paridacc", null, 4);

            if (kind.ToLower() == "a")
            {
                SetDefault(T, "codeacc", codprefix);
                SetDefault(T, "printingorder", ordinestampaprefix);
            }

            DataRow R = base.Get_New_Row(ParentRow, T);

            if (kind.ToLower() == "a")
            {
                RowChange.ClearAutoIncrement(T.Columns["printingorder"]);
            }
            return(R);
        }
Exemplo n.º 11
0
        public override void CalculateFields(System.Data.DataRow R, string listtype)
        {
            string filterFin           = "";
            string filterFinVar        = "";
            string filterVariationKind = "";
            string filterVarStatus     = "";
            object flagObj             = null;
            string flagPrevision       = null;
            string flagSecondaryPrev   = null;
            string flagCredit          = null;
            string flagProceeds        = null;
            object variationKind       = null;
            object finvarstatus        = null;
            bool   finInDS             = false;

            if (R.Table.DataSet.Tables["fin"] != null)
            {
                DataTable tFin = R.Table.DataSet.Tables["fin"];
                filterFin = QHC.CmpEq("idfin", R["idfin"]);
                if (tFin.Select(filterFin).Length > 0)
                {
                    DataRow rFin = tFin.Select(filterFin)[0];
                    flagObj = rFin["flag"];
                    finInDS = true;
                }
            }

            //bool finVarInDS = false;
            if (R.Table.DataSet.Tables["finvar"] != null)
            {
                DataTable tFinVar = R.Table.DataSet.Tables["finvar"];
                filterFinVar = QHC.AppAnd(QHC.CmpEq("yvar", R["yvar"]),
                                          QHC.CmpEq("nvar", R["nvar"]));

                if (tFinVar.Select(filterFinVar).Length > 0)
                {
                    DataRow rFinVar = tFinVar.Select(filterFinVar)[0];
                    flagPrevision       = rFinVar["flagprevision"].ToString().ToUpper();
                    flagSecondaryPrev   = rFinVar["flagsecondaryprev"].ToString().ToUpper();
                    flagCredit          = rFinVar["flagcredit"].ToString().ToUpper();
                    flagProceeds        = rFinVar["flagproceeds"].ToString().ToUpper();
                    filterVariationKind = QHC.CmpEq("idvariationkind", rFinVar["variationkind"]);
                    if (listtype == "bilancio" || listtype == "upb")
                    {
                        variationKind = Conn.DO_READ_VALUE("variationkind", filterVariationKind, "description");
                    }
                    //finVarInDS = true;
                }
            }
            if (!finInDS)
            {
                filterFin = QHS.CmpEq("idfin", R["idfin"]);
                flagObj   = Conn.DO_READ_VALUE("fin", filterFin, "flag");
            }



            if (flagObj == null)
            {
                return;
            }
            byte flag      = Convert.ToByte(flagObj);
            bool isEntrata = (flag & 1) == 0;

            if (listtype == "default" || listtype == "listaweb" || listtype == "underwriting")
            {
                if (isEntrata)
                {
                    R["!entrata"] = R["amount"];
                }
                else
                {
                    R["!spesa"] = R["amount"];
                }
            }

            if (listtype == "underwriting")
            {
                filterFinVar = QHS.AppAnd(QHS.CmpEq("yvar", R["yvar"]),
                                          QHS.CmpEq("nvar", R["nvar"]));
                object idfinvarstatus = Conn.DO_READ_VALUE("finvar", filterFinVar, "idfinvarstatus");
                filterVarStatus    = QHS.CmpEq("idfinvarstatus", idfinvarstatus);
                finvarstatus       = Conn.DO_READ_VALUE("finvarstatus", filterVarStatus, "description");
                R["!finvarstatus"] = finvarstatus;
            }

            if ((listtype == "bilancio") || (listtype == "upb"))
            {
                if (isEntrata)
                {
                    R["!E/S"] = "E";
                }
                else
                {
                    R["!E/S"] = "S";
                }
                if (flagPrevision == "S")
                {
                    R["!prev_competenza"] = R["amount"];
                }
                if (flagSecondaryPrev == "S")
                {
                    R["!prev_cassa"] = R["amount"];
                }
                if (flagCredit == "S")
                {
                    R["!crediti"] = R["amount"];
                }
                if (flagProceeds == "S")
                {
                    R["!cassa"] = R["amount"];
                }
                R["!variationkind"] = variationKind;
            }
            if (listtype == "listaweb")
            {
                if (R["limit"] != DBNull.Value)
                {
                    decimal amount = CfgFn.GetNoNullDecimal(R["amount"]);
                    decimal limit  = CfgFn.GetNoNullDecimal(R["limit"]);
                    if (amount > limit)
                    {
                        R["!semaphore"] = "<center><img src=\"Immagini/red_light.gif\"></center>";
                    }
                    else
                    {
                        R["!semaphore"] = "<center><img src=\"Immagini/green_light.gif\"></center>";
                    }
                }
                else
                {
                    R["!semaphore"] = "";
                }
            }
        }