Esempio n. 1
0
 object getIdReg(DataRow r)
 {
     if (r.RowState == DataRowState.Added)
     {
         if (SourceRow == null)
         {
             return(DBNull.Value);
         }
         DataSet dMain = SourceRow.Table.DataSet;
         if (!dMain.Tables.Contains("invoice"))
         {
             return(DBNull.Value);
         }
         string filter = QHC.MCmp(r, new string[] { "idinvkind", "yinv", "ninv" });
         if (dMain.Tables["invoice"].Select(filter).Length == 0)
         {
             return(DBNull.Value);
         }
         return(dMain.Tables["invoice"].Select(filter)[0]["idreg"]);
     }
     if (SourceRow != null)
     {
         DataSet dMain = SourceRow.Table.DataSet;
         if (dMain.Tables.Contains("invoice"))
         {
             string filter = QHC.MCmp(r, new string[] { "idinvkind", "yinv", "ninv" });
             if (dMain.Tables["invoice"].Select(filter).Length > 0)
             {
                 return(dMain.Tables["invoice"].Select(filter)[0]["idreg"]);
             }
         }
     }
     return(Conn.DO_READ_VALUE("invoice", QHC.MCmp(r, new string[] { "idinvkind", "yinv", "ninv" }), "idreg"));
 }
Esempio n. 2
0
 public override void CalculateFields(System.Data.DataRow R, string listtype)
 {
     if (R.Table.DataSet.Tables["fin"] != null)
     {
         DataTable tFin      = R.Table.DataSet.Tables["fin"];
         string    filterFin = QHC.CmpEq("idfin", R["idfin"]);
         if (tFin.Select(filterFin).Length > 0)
         {
             DataRow rFin    = tFin.Select(filterFin)[0];
             object  flagObj = rFin["flag"];
             if (flagObj == null)
             {
                 return;
             }
             byte flag      = Convert.ToByte(flagObj);
             bool isEntrata = (flag & 1) == 0;
             if (listtype == "lista")
             {
                 if (isEntrata)
                 {
                     R["!E/S"] = "E";
                 }
                 else
                 {
                     R["!E/S"] = "S";
                 }
             }
         }
     }
 }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public override DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            string    testoMessaggio = "Bisogna inserire i dati nel form di configurazione della prestazione occasionale";
            DataTable configurazione = T.DataSet.Tables["config"];

            DataRow [] configrow = configurazione.Select(QHC.CmpEq("ayear", GetSys("esercizio")));
            if (configrow.Length == 0)
            {
                MessageBox.Show(testoMessaggio, "Prestazione Occasionale - Dati Mancanti", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(null);
            }
            int    flag_autodocnumbering = CfgFn.GetNoNullInt32(configrow[0]["flag_autodocnumbering"]);
            string kind = ((flag_autodocnumbering & 0x20) == 0) ? "A" : "M";

            if (kind.ToUpper() == "A")
            {
                string reset = configrow[0]["casualcontract_flagrestart"].ToString();
                if (reset.ToUpper() == "S")
                {
                    RowChange.SetSelector(T, "ycon");
                }
                RowChange.MarkAsAutoincrement(T.Columns["ncon"], null, null, 0);
            }
            else
            {
                int nmax = CfgFn.GetNoNullInt32(
                    Conn.DO_READ_VALUE("casualcontract", QHS.CmpEq("ycon", GetSys("esercizio")), "MAX(ncon)")) + 1;
                SetDefault(T, "ncon", nmax);
            }
            return(base.Get_New_Row(ParentRow, T));
        }
Esempio n. 5
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);
        }
Esempio n. 6
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, "codeacc", "Codice", 1);
                DescribeAColumn(T, "account", "Denominazione", 2);
            }

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

            int    maxlevel        = 0;
            string filterEsercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
            object o = Conn.DO_READ_VALUE("accountlevel", filterEsercizio, "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            TreeViewManager M = new TreeViewAccountPrevisionView(Conn, T, tree, filterc, filtersql, maxlevel);

            myGetData.SetStaticFilter("accountlevel", filterEsercizio);
        }
Esempio n. 7
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            bool all = false;

            base.DescribeTree(tree, T, ListingType);
            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "leveldescr", "Livello");
                DescribeAColumn(T, "apfinancialactivitycode", "Codice");
                DescribeAColumn(T, "description", "Descrizione");
            }

            if (ListingType == "treeall")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "leveldescr", "Livello");
                DescribeAColumn(T, "apfinancialactivitycode", "Codice");
                DescribeAColumn(T, "description", "Descrizione");
                all = true;
            }

            string          filterc   = QHC.CmpEq("nlevel", 1);
            string          filtersql = QHS.CmpEq("nlevel", 1);
            TreeViewManager M         = new TreeAttivitaEconomicaView(T, tree, filterc, filtersql, all);
        }
Esempio n. 8
0
        public override DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            DataTable tConfigurazione = T.DataSet.Tables["config"];

            DataRow[] rConfig = tConfigurazione.Select(QHC.CmpEq("ayear", GetSys("esercizio")));
            if (rConfig.Length == 0)
            {
                MessageBox.Show("Bisogna inserire i dati nel form di configurazione del contratto",
                                "Contratto - Dati Mancanti", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(null);
            }

            int    flag_autodocnumbering = CfgFn.GetNoNullInt32(rConfig[0]["flag_autodocnumbering"]);
            string kind = ((flag_autodocnumbering & 0x10) == 0) ? "A" : "M";

            RowChange.SetSelector(T, "ycon");
            RowChange.MarkAsAutoincrement(T.Columns["idcon"], null,
                                          Conn.GetSys("esercizio").ToString().Substring(2, 2), 6);
            if (kind.ToUpper() == "A")
            {
                RowChange.MarkAsAutoincrement(T.Columns["ncon"], null, null, 0);
            }
            else
            {
                int nmax = CfgFn.GetNoNullInt32(
                    Conn.DO_READ_VALUE("parasubcontract", QHS.CmpEq("ycon", GetSys("esercizio"))
                                       , "MAX(CONVERT(int,ncon))")) + 1;
                SetDefault(T, "ncon", nmax);
            }

            return(base.Get_New_Row(ParentRow, T));
        }
Esempio n. 9
0
        void CopyCustomFilter(DataRow SourceRow)
        {
            if (SourceRow.Table.ExtendedProperties["ExtraParams"] == null)
            {
                return;
            }
            DataRow parent = SourceRow.GetParentRow("sortingincomesorted");

            if (parent == null)
            {
                return;
            }
            string    filter   = QHC.CmpEq("!idsorkind", parent["idsorkind"]);
            DataTable OldTable =
                (DataTable)SourceRow.Table.ExtendedProperties[MetaData.ExtraParams];
            DataTable newTable = OldTable.Clone();

            DataRow [] selected = OldTable.Select(filter);
            foreach (DataRow R in selected)
            {
                DataRow newR = newTable.NewRow();
                foreach (DataColumn C in newTable.Columns)
                {
                    newR[C] = R[C.ColumnName];
                }
                newTable.Rows.Add(newR);
                newR.AcceptChanges();
            }
            PrimaryDataTable.ExtendedProperties[MetaData.ExtraParams] = newTable;
        }
Esempio n. 10
0
        //modifiche luigi 8179
        public override void WebDescribeTree(hwTreeView tree, DataTable T, string ListingType)
        {
            int maxDepth = 9; bool withdescr = true;

            if (ListingType == "default")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "idlocation", "Id Ubicazione");
                DescribeAColumn(T, "locationcode", "Codice Ubicazione");
                DescribeAColumn(T, "description", "Ubicazione");
            }


            base.WebDescribeTree(tree, T, ListingType);
            string filterc         = QHC.CmpEq("nlevel", 1);
            string filtersql       = QHS.CmpEq("nlevel", 1);
            easy_node_dispatcher D = new location_node_dispatcher(
                "locationlevel",
                "nlevel",
                "description",
                null,
                "description",
                "locationcode"
                );
            WebTreeViewlocation M = new WebTreeViewlocation(T, tree, filterc, filtersql, maxDepth, withdescr);
        }
Esempio n. 11
0
        public override void DescribeTree(System.Windows.Forms.TreeView tree, DataTable T, string ListingType)
        {
            bool all = false;

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree" || ListingType == "treeall" || ListingType == "treenew" || ListingType == "treeminusable")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "!livello", "Livello", "accountlevel.description");
                DescribeAColumn(T, "codeacc", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.DescribeTree(tree, T, ListingType);
            int    esercizio       = Convert.ToInt32(GetSys("esercizio"));
            int    esercizionew    = esercizio + 1;
            string filteresercizio = QHC.CmpEq("ayear", GetSys("esercizio"));
            string filterc         = QHC.CmpEq("nlevel", "1");
            string filtersql       = QHS.CmpEq("nlevel", "1");

            int    maxlevel = 0;
            object o        = Conn.DO_READ_VALUE("accountlevel", filteresercizio, "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            int    minlevelop         = CfgFn.GetNoNullInt32(GetSys("accountusablelevel"));
            string filterAccountLevel = filteresercizio;

            if (ListingType == "treeminusable")
            {
                maxlevel = minlevelop;
                string filterenablebudgetprev = QHS.NullOrEq("flagenablebudgetprev", "S");
                filterAccountLevel = QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.CmpLe("nlevel", minlevelop), filterenablebudgetprev);
            }

            //		TreeViewAccount M = new TreeViewAccount(Conn, T, tree, filter, maxlevel);
            //		myGetData.SetStaticFilter("accountevel","(ayear='"+GetSys("esercizio").ToString()+"')");
            //
            if (ListingType == "treeall")
            {
                all = true;
            }
            if (ListingType == "treenew")
            {
                //string livsupid = esercizionew.ToString().Substring(2);
                //filter = "(paridacc is null + QueryCreator.quotedstrvalue(livsupid, true) + ")";
                filterAccountLevel = QHS.CmpEq("ayear", esercizionew);
                all = true;
            }
            TreeViewAccount M = new TreeViewAccount(Conn, T, tree, filterc, filtersql, all, maxlevel);

            myGetData.SetStaticFilter("accountlevel", filterAccountLevel);
        }
Esempio n. 12
0
        void CheckResponsabileChange()
        {
            DataRow [] Location = DS.assetlocation.Select(null, null, DataViewRowState.Added);
            foreach (DataRow RL in Location)
            {
                string    filterloc = QHC.CmpEq("idlocation", RL["idlocation"]);
                DataRow[] LL        = DS.location.Select(filterloc);
                if (LL.Length == 0)
                {
                    continue;
                }
                if (LL[0]["idman"] == DBNull.Value)
                {
                    continue;
                }
                if (LL[0]["idman"].ToString() == lastrejected.ToString())
                {
                    continue;
                }
                string filter = QHC.CmpEq("start", RL["start"]);
                if (DS.assetmanager.Select(filter).Length == 0)
                {
                    if (MessageBox.Show(this, "Si vuole reimpostare il responsabile in base alla nuova ubicazione?", "Conferma",
                                        MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        lastrejected = LL[0]["idman"];
                        return;
                    }

                    MetaData AM = Meta.Dispatcher.Get("assetmanager");
                    AM.SetDefaults(DS.assetmanager);
                    DataRow NA = AM.Get_New_Row(DS.asset.Rows[0], DS.assetmanager);
                    MetaData.SetDefault(DS.assetmanager, "start", RL["start"]);
                    NA["start"] = RL["start"];
                    NA["idman"] = LL[0]["idman"];
                }
                else
                {
                    DataRow CurrAssMan = DS.assetmanager.Select(filter)[0];
                    if (CurrAssMan["idman"].ToString() != LL[0]["idman"].ToString())
                    {
                        if (MessageBox.Show(this, "Si vuole reimpostare il responsabile in base alla nuova ubicazione?", "Conferma",
                                            MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            lastrejected = LL[0]["idman"];
                            return;
                        }
                        CurrAssMan["idman"] = LL[0]["idman"];
                    }
                }
                Meta.myGetData.GetTemporaryValues(DS.assetmanager);
                lastrejected = DBNull.Value;
            }
        }
Esempio n. 13
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);
     }
 }
Esempio n. 14
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);
     }
 }
Esempio n. 15
0
        //fine

        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);
            easy_node_dispatcher D = new location_node_dispatcher(
                "locationlevel",
                "nlevel",
                "description",
                null,
                "description",
                "locationcode"
                );
            TreeViewManager M = new TreeViewClassInventario(T, tree, filterc, filtersql);
        }
Esempio n. 16
0
        public override void WebDescribeTree(hwTreeView tree, DataTable T, string ListingType)
        {
            int    esercizio       = Convert.ToInt32(GetSys("esercizio"));
            int    esercizionew    = esercizio + 1;
            string filteresercizio = QHC.CmpEq("ayear", GetSys("esercizio"));
            string filterc         = QHC.CmpEq("nlevel", "1");
            string filtersql       = QHS.CmpEq("nlevel", "1");

            if (ListingType == "tree" || ListingType == "treeall" || ListingType == "treenew" || ListingType == "treeminusable")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "!livello", "Livello", "accountlevel.description");
                DescribeAColumn(T, "codeacc", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }
            int    maxlevel = 0;
            object o        = Conn.DO_READ_VALUE("accountlevel", filteresercizio, "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            int minlevelop = CfgFn.GetNoNullInt32(GetSys("accountusablelevel"));

            if (ListingType == "treeminusable")
            {
                maxlevel = minlevelop;
            }
            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "codeacc", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.WebDescribeTree(tree, T, ListingType);

            hwTreeViewAccount M = new hwTreeViewAccount(Conn, T, tree, filterc, filtersql, false, maxlevel);
        }
Esempio n. 17
0
        public override void WebDescribeTree(hwTreeView tree, DataTable T, string ListingType)
        {
            int esercizio = Convert.ToInt32(GetSys("esercizio"));

            if (ListingType == "tree")
            {
                DescribeColumns(T, ListingType);
            }


            base.WebDescribeTree(tree, T, ListingType);
            int               maxlevel  = 9;
            string            filterc   = QHC.IsNull("paridaccmotive");
            string            filtersql = QHS.IsNull("paridaccmotive");
            hwTreeViewManager M         = new hwTreeViewAccMotiveApplied(Conn, T, tree, filterc, filtersql, maxlevel);
        }
Esempio n. 18
0
        string getNMovBySelect(DataTable t, object idmov)
        {
            DataRow[] Exp = t.Select(QHC.CmpEq("idexp", idmov));
            if (Exp.Length == 0)
            {
                return(null);
            }
            string nMov = Exp[0]["nmov"].ToString();

            while ((nMov.StartsWith("0")) && (nMov.Length > 0))
            {
                nMov = nMov.Substring(1, nMov.Length - 1);
            }

            return(nMov);
        }
Esempio n. 19
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);

            inventory_node_dispatcher D = new inventory_node_dispatcher(
                "inventorysortinglevel",
                "nlevel",
                "description",
                "flag",
                "description",
                "codeinv"
                );
            TreeViewManager M = new TreeViewClassInventario(T, tree, filterc, filtersql);
        }
Esempio n. 20
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);
        }
Esempio n. 21
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));
        }
Esempio n. 22
0
 public override void CalculateFields(DataRow R, string list_type)
 {
     if (list_type == "lista")
     {
         if (!R.Table.DataSet.Tables.Contains("virtualuser"))
         {
             return;
         }
         DataTable VU = R.Table.DataSet.Tables["virtualuser"];
         DataRow[] f  = VU.Select(QHC.CmpEq("cf", R["cf"]));
         if (f.Length > 0)
         {
             R["!surname"]  = f[0]["surname"];
             R["!forename"] = f[0]["forename"];
         }
     }
 }
Esempio n. 23
0
        public override void WebDescribeTree(hwTreeView tree, DataTable T, string ListingType)
        {
            int maxDepth = 9;

            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "codelistclass", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.WebDescribeTree(tree, T, ListingType);
            string filterc   = QHC.IsNull("paridlistclass");
            string filtersql = QHS.IsNull("paridlistclass");

            hwTreeViewListClass M = new hwTreeViewListClass(Conn, T, tree, filterc, filtersql, false, maxDepth);
        }
Esempio n. 24
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            // L'idupb ha una lunghezza di 36 caratteri ed ogni livello ha una lunghezza di 4 caratteri

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "codemotive", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.DescribeTree(tree, T, ListingType);
            string filterc   = QHC.IsNull("paridaccmotive");
            string filtersql = QHS.IsNull("paridaccmotive");

            TreeViewAccMotive M = new TreeViewAccMotive(Conn, T, tree, filterc, filtersql);
        }
Esempio n. 25
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            bool all = false;

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree" || ListingType == "treeall")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "!livello", "Livello", "flowchartlevel.description");
                DescribeAColumn(T, "codeflowchart", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.DescribeTree(tree, T, ListingType);
            int    esercizio = Convert.ToInt32(GetSys("esercizio"));
            string filterc   = QHC.CmpEq("nlevel", "1");
            string filtersql = QHS.CmpEq("nlevel", "1");
            int    maxlevel  = 0;
            object o         = Conn.DO_READ_VALUE("flowchartlevel", "(ayear = '" + Conn.GetSys("esercizio") + "')", "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }

            if (ListingType == "treeall")
            {
                all = true;
            }

            TreeViewFlowChart M = new TreeViewFlowChart(Conn, T, tree, filterc, filtersql, all, maxlevel);

            myGetData.SetStaticFilter("flowchartlevel", QHS.CmpEq("ayear", esercizio));
        }
Esempio n. 26
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            bool all = false;

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "", -1);
                }
                int nPos = 1;
                DescribeAColumn(T, "leveldescr", "Livello", nPos++);
                DescribeAColumn(T, "codeinv", "Codice", nPos++);
                DescribeAColumn(T, "description", "Descrizione", nPos++);
            }
            if (ListingType == "treeall")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "", -1);
                }
                int nPos = 1;
                DescribeAColumn(T, "leveldescr", "Livello", nPos++);
                DescribeAColumn(T, "codeinv", "Codice", nPos++);
                DescribeAColumn(T, "description", "Descrizione", nPos++);
                all = true;
            }
            base.DescribeTree(tree, T, ListingType);

            string filterc   = QHC.CmpEq("nlevel", 1);
            string filtersql = QHS.CmpEq("nlevel", 1);
            //			if (ListingType=="tree"){
            TreeViewManager M = new TreeClassInventarioView(T, tree, filterc, filtersql, all);
        }
Esempio n. 27
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"] = "";
            }
        }
Esempio n. 28
0
        override public bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            if (DS.Tables["sortingkind"] == null)
            {
                return(true);
            }
            DataRow parent = R.GetParentRow("sortingincomesorted");

            if (parent == null)
            {
                return(true);
            }
            string filtercodice = QHC.CmpEq("idsorkind", parent["idsorkind"]);

            DataRow [] tipoclass = DS.Tables["sortingkind"].Select(filtercodice);
            if (tipoclass.Length == 0)
            {
                return(true);                                 //??
            }
            if (R["amount"] == DBNull.Value)
            {
                errmess  = "L'importo della classificazione deve sempre essere specificato";
                errfield = "amount";
                return(false);
            }

            if (edit_type == "default")
            {
                if (DS.Tables["sorting"] == null)
                {
                    return(true);
                }

                string     filteridcodice = QHC.CmpEq("idsor", R["idsor"]);
                DataRow [] classmov       = DS.Tables["sorting"].Select(filteridcodice);
                if (classmov.Length == 0)
                {
                    return(true);                                    //??
                }
                DataRow CurrTipo  = tipoclass[0];
                DataRow CurrClass = classmov[0];

                //Evaluates flagincompleto and checks forced columns to be not null
                bool flagincompleto = false;
                foreach (char C in new char[3] {
                    'n', 's', 'v'
                })
                {
                    for (int i = 1; i <= 5; i++)
                    {
                        string suffix = C.ToString() + i.ToString();
                        if ((CurrTipo["forced" + suffix].ToString().ToLower() == "s") &&
                            (R["value" + C.ToString() + i.ToString()] == DBNull.Value))
                        {
                            if (MessageBox.Show(
                                    "Il campo " + CurrTipo["label" + suffix].ToString() +
                                    " non dovrebbe essere vuoto. Proseguo lo stesso?",
                                    "Avviso",
                                    MessageBoxButtons.YesNo) != DialogResult.Yes)
                            {
                                errfield = "value" + suffix;
                                errmess  = null;
                                return(false);
                            }
                            flagincompleto = true;
                        }
                    }
                }
                if ((CurrClass["flagnodate"].ToString().ToLower() == "n") &&
                    (R["flagnodate"].ToString().ToLower() == "n"))
                {
                    if (R["start"].ToString().Equals(""))
                    {
                        if (MessageBox.Show(
                                "Il campo datainizio non dovrebbe essere vuoto. Proseguo lo stesso?",
                                "Avviso",
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            errfield = "start";
                            errmess  = null;
                            return(false);
                        }
                        else
                        {
                            flagincompleto = true;
                        }
                    }
                    if (R["stop"].ToString().Equals(""))
                    {
                        if (MessageBox.Show(
                                "Il campo datafine non dovrebbe essere vuoto. Proseguo lo stesso?",
                                "Avviso",
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            errfield = "stop";
                            errmess  = null;
                            return(false);
                        }
                    }
                    else
                    {
                        flagincompleto = true;
                    }
                }

                if ((flagincompleto) && (R["tobecontinued"].ToString().ToLower() == ""))
                {
                    R["tobecontinued"] = "s";
                }
            }
            if (edit_type == "main")
            {
                if (DS.Tables["sortingview"] == null)
                {
                    return(true);
                }

                string     filteridcodice = QHC.CmpEq("idsor", R["idsor"]);
                DataRow [] classmov       = DS.Tables["sortingview"].Select(filteridcodice);
                if (classmov.Length == 0)
                {
                    return(true);                                    //??
                }
                DataRow CurrTipo  = tipoclass[0];
                DataRow CurrClass = classmov[0];

                //Evaluates flagincompleto and checks forced columns to be not null
                bool flagincompleto = false;
                foreach (char C in new char[3] {
                    'n', 's', 'v'
                })
                {
                    for (int i = 1; i <= 5; i++)
                    {
                        string suffix = C.ToString() + i.ToString();
                        if ((CurrTipo["forced" + suffix].ToString().ToLower() == "s") &&
                            (R["value" + C.ToString() + i.ToString()] == DBNull.Value))
                        {
                            if (MessageBox.Show(
                                    "Il campo " + CurrTipo["label" + suffix].ToString() +
                                    " non dovrebbe essere vuoto. Proseguo lo stesso?",
                                    "Avviso",
                                    MessageBoxButtons.YesNo) != DialogResult.Yes)
                            {
                                errfield = "value" + suffix;
                                errmess  = null;
                                return(false);
                            }
                            flagincompleto = true;
                        }
                    }
                }

                if ((CurrClass["flagnodate"].ToString().ToLower() == "n") &&
                    (R["flagnodate"].ToString().ToLower() == "n"))
                {
                    if (R["start"].ToString().Equals(""))
                    {
                        if (MessageBox.Show(
                                "Il campo datainizio non dovrebbe essere vuoto. Proseguo lo stesso?",
                                "Avviso",
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            errfield = "start";
                            errmess  = null;
                            return(false);
                        }
                        else
                        {
                            flagincompleto = true;
                        }
                    }
                    if (R["stop"].ToString().Equals(""))
                    {
                        if (MessageBox.Show(
                                "Il campo datafine non dovrebbe essere vuoto. Proseguo lo stesso?",
                                "Avviso",
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            errfield = "stop";
                            errmess  = null;
                            return(false);
                        }
                    }
                    else
                    {
                        flagincompleto = true;
                    }
                }

                if ((flagincompleto) && (R["tobecontinued"].ToString().ToLower() == ""))
                {
                    R["tobecontinued"] = "s";
                }
            }
            return(true);
        }
Esempio n. 29
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);
        }
Esempio n. 30
0
    public override void DoCommand(string command)
    {
        string cmd = HelpForm.GetFieldLower(command, 0);

        if (!cmd.EndsWith("showcase"))
        {
            return;
        }
        object idshowcase = CfgFn.GetNoNullInt32(HelpForm.GetFieldLower(command, 1));
        object idstore    = CfgFn.GetNoNullInt32(HelpForm.GetFieldLower(command, 2));
        string Query;

        Query  = "SELECT stocktotalview.idstore as idstore, list.idlist as idlist,list.intcode as intcode, list.description as description, ";
        Query += " stocktotalview.number as number, stocktotalview.ordered as ordered, stocktotalview.booked as booked,listclass.title as listclasstitle,";
        Query += " listclass.authrequired as authorizationrequired ";
        Query += " FROM showcasedetail join list on (showcasedetail.idlist=list.idlist) ";
        Query += " join stocktotalview on (list.idlist=stocktotalview.idlist) ";
        Query += " join listclass on (list.idlistclass=listclass.idlistclass) ";
        Query += " WHERE showcasedetail.idshowcase=" + idshowcase + " and stocktotalview.idstore=" + idstore;
        Query += " AND list.active='S'";
        //Query += " AND (stocktotalview.number - stocktotalview.booked)>0";  //Solo la merce disponibile
        Query += " order by description asc ";


        //string Query = "select S.idlist,S.idstore, S.intcode,S.list as description,	ST.number,ST.ordered,ST.booked, " +
        //        "S.listclass as listclasstitle,S.authrequired as authorizationrequired," +
        //        "convert(  decimal(19,2),	ROUND(	 ( SUM ( S.residual * S.amount	) /ST.number)	,2	 ))	as avgprice " +
        //        "FROM showcasedetail SC join  stockview S on S.idlist=SC.idlist " +
        //        "join stocktotal ST on S.idlist=ST.idlist and S.idstore=ST.idstore " +
        //        "where "+
        //        QHS.AppAnd(QHS.CmpGt("S.amount",0),QHS.CmpGt("residual",0),QHS.CmpEq("S.idstore",idstore),QHS.CmpEq("SC.idshowcase",idshowcase))+
        //        " group by S.idlist,S.idstore, S.intcode,S.list,ST.number,ST.ordered,ST.booked, S.listclass,S.authrequired " +
        //        " order by description asc";

        if (booking_on_invoice())
        {
            Query = "select S.idlist,S.idstore, S.intcode,S.list as description,	S.available, S.idstock,"+
                    "S.listclass as listclasstitle,S.authrequired as authorizationrequired," +
                    "convert(decimal(19,2),ROUND(S.amount/ S.number,2))	as price " +
                    "FROM showcasedetail SC join  stockview S on S.idlist=SC.idlist " +
                    "where " +
                    QHS.AppAnd(QHS.CmpGt("S.amount", 0), QHS.CmpGt("S.available", 0), QHS.CmpEq("S.idstore", idstore), QHS.CmpEq("SC.idshowcase", idshowcase)) +
                    " order by description asc";
        }



        DataTable DT = Conn.SQLRunner(Query);

        if (DT != null && DT.Rows.Count != 0)
        {
            if (booking_on_invoice())
            {
                foreach (DataRow R1 in DT.Select(null, "idstock"))
                {
                    if (R1.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    string flt2 = QHS.AppAnd(QHC.MCmp(R1, "idlist", "idstore"), QHC.CmpGt("idstock", R1["idstock"]));
                    foreach (DataRow R2 in DT.Select(flt2))
                    {
                        R2.Delete();
                    }
                }

                DT.AcceptChanges();
            }

            RenderCategoryTable(DT);
        }

        string filter;

        filter = QHS.CmpEq("idshowcase", idshowcase);
        DT     = Conn.RUN_SELECT("showcase", "title", null, filter, null, false);
        if (DT == null)
        {
            return;
        }
        titoloVetrina.Text = "<strong>Vetrina attualmente selezionata:</strong>&nbsp;" + DT.Rows[0]["title"].ToString();

        filter = QHS.CmpEq("idstore", idstore);
        DT     = Conn.RUN_SELECT("store", "description,deliveryaddress", null, filter, null, false);
        if (DT == null)
        {
            return;
        }
        lblStore.Text   = "<strong>Magazzino:&nbsp;</strong>" + DT.Rows[0]["description"];
        LabAddress.Text = "<strong>Indirizzo:&nbsp;</strong>" + DT.Rows[0]["deliveryaddress"];
    }