Beispiel #1
0
        public void UpdateMenuPrivileges()
        {
            string currentNodePrivilegesToken;

            //Required to Reload Object before Get New Permissions
            GlobalFramework.LoggedUser = (sys_userdetail)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_userdetail), GlobalFramework.LoggedUser.Oid);
            //Update Session Privileges
            GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions(GlobalFramework.LoggedUser);

            //Update Backoffice Menu
            if (_accordionDefinition != null && _accordionDefinition.Count > 0)
            {
                foreach (var parentLevel in _accordionDefinition)
                {
                    if (parentLevel.Value.Childs.Count > 0)
                    {
                        foreach (var childLevel in parentLevel.Value.Childs)
                        {
                            currentNodePrivilegesToken = string.Format(_nodePrivilegesTokenFormat, childLevel.Key.ToUpper());
                            //_log.Debug(string.Format("[{0}]=[{1}] [{2}]=[{3}]", childLevel.Value.NodeButton.Sensitive, childLevel.Value.NodeButton.Name, currentNodePrivilegesToken, FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken)));
                            //If have (Content | Events | ExternalApp) & Privileges or the Button is Enabled, Else is Disabled
                            if (FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken) && (childLevel.Value.Content != null || childLevel.Value.Clicked != null || childLevel.Value.ExternalAppFileName != null))
                            {
                                childLevel.Value.NodeButton.Sensitive = true;
                            }
                            else
                            {
                                childLevel.Value.NodeButton.Sensitive = false;
                            }
                        }
                    }
                }
            }
        }
        void BackOfficeMainWindow_Show(object sender, EventArgs e)
        {
            if (_activeUserDetail != GlobalFramework.LoggedUser)
            {
                _activeUserDetail       = GlobalFramework.LoggedUser;
                _labelTerminalInfo.Text = string.Format("{0} : {1}", GlobalFramework.LoggedTerminal.Designation, GlobalFramework.LoggedUser.Name);

                //Apply Menu Updates
                Accordion.UpdateMenuPrivileges();

                //Hide/Show Current Active Content based on user privileges
                string currentNodePrivilegesToken = string.Format(_privilegesBackOfficeMenuOperation, Accordion.CurrentChildButtonContent.Name.ToUpper());
                _nodeContent.Sensitive = FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken);
            }
        }
Beispiel #3
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public static bool OpenDoor(sys_configurationprinters pPrinter)
        {
            bool result        = false;
            bool hasPermission = FrameworkUtils.HasPermissionTo("HARDWARE_DRAWER_OPEN");

            if (pPrinter != null && hasPermission)
            {
                try
                {
                    switch (pPrinter.PrinterType.Token)
                    {
                    //Impressora SINOCAN em ambiente Windows
                    case "THERMAL_PRINTER_WINDOWS":
                    //Impressora SINOCAN em ambiente Linux
                    case "THERMAL_PRINTER_LINUX":
                    //Impressora SINOCAN em ambiente WindowsLinux/Socket
                    case "THERMAL_PRINTER_SOCKET":
                    //Impressora SINOCAN em ambiente WindowsLinux/USB
                    case "THERMAL_PRINTER_USB":
                        PrintObject printObjectSINOCAN = new PrintObject(0);
                        // Deprecated
                        //int m = Convert.ToInt32(GlobalFramework.Settings["DoorValueM"]);
                        //int t1 = Convert.ToInt32(GlobalFramework.Settings["DoorValueT1"]);
                        //int t2 = Convert.ToInt32(GlobalFramework.Settings["DoorValueT2"]);
                        // Open Drawer
                        //TK016249 - Impressoras - Diferenciação entre Tipos
                        int m  = GlobalFramework.LoggedTerminal.ThermalPrinter.ThermalOpenDrawerValueM;
                        int t1 = GlobalFramework.LoggedTerminal.ThermalPrinter.ThermalOpenDrawerValueT1;
                        int t2 = GlobalFramework.LoggedTerminal.ThermalPrinter.ThermalOpenDrawerValueT2;
                        printObjectSINOCAN.OpenDoor(pPrinter.PrinterType.Token, pPrinter.NetworkName, m, t1, t2);
                        //Audit
                        FrameworkUtils.Audit("CASHDRAWER_OPEN", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_cashdrawer_open"));

                        break;
                    }

                    result = true;
                }
                catch (Exception ex)
                {
                    _log.Warn(ex.Message, ex);
                }
            }

            return(result);
        }
        void TreeViewDocumentFinanceYears_RecordAfterInsert(object sender, EventArgs e)
        {
            try
            {
                //Get References to TreeViewDocumentFinanceSeries and TreeViewDocumentFinanceYearSerieTerminal
                TreeViewDocumentFinanceSeries treeViewDocumentFinanceSeries = ((_sourceWindow as BackOfficeMainWindow).Accordion.Nodes["TopMenuDocuments"].Childs["DocumentFinanceSeries"].Content as TreeViewDocumentFinanceSeries);
                //Store Reference to BackOffice TreeViewDocumentFinanceYearSerieTerminal
                TreeViewDocumentFinanceYearSerieTerminal treeViewDocumentFinanceYearSerieTerminal =
                    ((_sourceWindow as BackOfficeMainWindow).Accordion.Nodes["TopMenuDocuments"].Childs.ContainsKey("DocumentFinanceYearSerieTerminal"))
                    ? ((_sourceWindow as BackOfficeMainWindow).Accordion.Nodes["TopMenuDocuments"].Childs["DocumentFinanceYearSerieTerminal"].Content as TreeViewDocumentFinanceYearSerieTerminal)
                    : null;
                //Refresh TreeViews after Insert Record, and Hide old Series
                Refresh();
                treeViewDocumentFinanceSeries.Refresh();
                if (treeViewDocumentFinanceYearSerieTerminal != null)
                {
                    treeViewDocumentFinanceYearSerieTerminal.Refresh();
                }
                //Apply Permissions ButtonCreateDocumentFinanceSeries
                treeViewDocumentFinanceSeries.ButtonCreateDocumentFinanceSeries.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCESERIES_MANAGE_SERIES");

                //Request Create Series for all Type of Finance Documents
                ResponseType responseType = Utils.ShowMessageTouch(
                    _sourceWindow,
                    DialogFlags.Modal,
                    new Size(600, 400),
                    MessageType.Question,
                    ButtonsType.YesNo,
                    Resx.window_title_series_create_series,
                    Resx.dialog_message_series_create_document_type_series
                    );

                if (responseType == ResponseType.Yes)
                {
                    //Get Current Active FinanceYear
                    FIN_DocumentFinanceYears currentDocumentFinanceYear = ProcessFinanceDocumentSeries.GetCurrentDocumentFinanceYear();
                    bool result = TreeViewDocumentFinanceSeries.UICreateDocumentFinanceYearSeriesTerminal(_sourceWindow, currentDocumentFinanceYear);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #5
0
        protected void InitObject(Dictionary <string, AccordionNode> pAccordionDefinition, string pNodePrivilegesTokenFormat)
        {
            //get values of backoffice screen to set accordion font text size
            GlobalApp.boScreenSize = Utils.GetScreenSize();
            _label = new Label();

            //Parameters
            _accordionDefinition = pAccordionDefinition;
            //Local Vars
            bool   isFirstButton = true;
            string currentNodePrivilegesToken;
            string accordionType = "";

            VBox vboxOuter = new VBox(false, 2);
            AccordionParentButton accordionParentButton;
            AccordionChildButton  accordionChildButton;

            if (_accordionDefinition != null && _accordionDefinition.Count > 0)
            {
                foreach (var parentLevel in _accordionDefinition)
                {
                    if (parentLevel.Value.GroupIcon != null)
                    {
                        //Redimensionar Icons dos Botões Parent do accordion para 1024
                        HBox hboxParent = new HBox(false, 0);
                        if (GlobalApp.boScreenSize.Height <= 800)
                        {
                            System.Drawing.Size  sizeIcon = new System.Drawing.Size(20, 20);
                            System.Drawing.Image imageIcon;
                            imageIcon = System.Drawing.Image.FromFile(parentLevel.Value.GroupIcon.File.ToString());
                            imageIcon = Utils.ResizeAndCrop(imageIcon, sizeIcon);
                            Gdk.Pixbuf pixBuf         = Utils.ImageToPixbuf(imageIcon);
                            Image      gtkimageButton = new Image(pixBuf);
                            hboxParent.PackStart(gtkimageButton, false, false, 3);
                            imageIcon.Dispose();
                            pixBuf.Dispose();
                        }
                        else
                        {
                            hboxParent.PackStart(parentLevel.Value.GroupIcon, false, false, 3);
                        }
                        _label = new Label(parentLevel.Value.Label);
                        //Pango.FontDescription tmpFont = new Pango.FontDescription();
                        //tmpFont.Weight = Pango.Weight.Bold;
                        //tmpFont.Size = 2;
                        //Redimensionar Tamanho da Fonte dos Botões Parent do accordion para 1024
                        accordionType = "Parent";
                        ChangeFont(FrameworkUtils.StringToColor("61, 61, 61"), accordionType);
                        hboxParent.PackStart(_label, true, true, 0);
                        accordionParentButton = new AccordionParentButton(hboxParent)
                        {
                            Name = parentLevel.Key
                        };
                    }
                    else
                    {
                        accordionParentButton = new AccordionParentButton(parentLevel.Value.Label)
                        {
                            Name = parentLevel.Key
                        };
                        //First Parent Node is Assigned has currentParentButton
                        if (_currentParentButton == null)
                        {
                            _currentParentButton = accordionParentButton;
                        }
                    }

                    accordionParentButton.Active = isFirstButton;
                    if (isFirstButton)
                    {
                        isFirstButton = false;
                    }

                    //Add a Button Widget Reference to NodeWidget AccordionDefinition
                    parentLevel.Value.NodeButton = accordionParentButton;
                    //Click Event
                    accordionParentButton.Clicked += accordionParentButton_Clicked;
                    vboxOuter.PackStart(accordionParentButton, false, false, 0);
                    //_log.Debug(string.Format("Accordion(): parentLevel.Value.Label [{0}]", parentLevel.Value.Label));
                    if (parentLevel.Value.Childs != null && parentLevel.Value.Childs.Count > 0)
                    {
                        foreach (var childLevel in parentLevel.Value.Childs)
                        {
                            HBox hboxChild = new HBox(false, 0);
                            _label        = new Label(childLevel.Value.Label);
                            accordionType = "Child";
                            ChangeFont(FrameworkUtils.StringToColor("61, 61, 61"), accordionType);
                            hboxChild.PackStart(_label, true, true, 0);

                            //Init ChildButton
                            accordionChildButton = new AccordionChildButton(hboxChild)
                            {
                                Name = childLevel.Key, Content = childLevel.Value.Content
                            };
                            //accordionChildButton = new AccordionChildButton(childLevel.Value.Label) { Name = childLevel.Key, Content = childLevel.Value.Content };
                            //Add a Button Widget Reference to NodeWidget AccordionDefinition
                            childLevel.Value.NodeButton = accordionChildButton;
                            //Privileges
                            currentNodePrivilegesToken = string.Format(pNodePrivilegesTokenFormat, childLevel.Key.ToUpper());
                            //_log.Debug(string.Format("currentNodePrivilegesToken: [{0}]", currentNodePrivilegesToken));

                            //First Child Node is Assigned has currentChildButton
                            //if (childLevel.Value.Active)
                            if (_currentChildButton == null)
                            {
                                _currentChildButton = accordionChildButton;
                                //Assign Current Active Button with content
                                _currentChildButtonContent = accordionChildButton;
                            }

                            accordionParentButton.ChildBox.PackStart(accordionChildButton, false, false, 2);

                            //If have (Content | Events | ExternalApp) & Privileges or the Button is Enabled, Else is Disabled
                            accordionChildButton.Sensitive = (FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken) && (childLevel.Value.Content != null || childLevel.Value.Clicked != null || childLevel.Value.ExternalAppFileName != null));

                            //EventHandler, Redirected to public Clicked, this way we have ouside Access
                            accordionChildButton.Clicked += accordionChildButton_Clicked;
                            //ExternalAppFileName
                            if (childLevel.Value.ExternalAppFileName != null)
                            {
                                accordionChildButton.ExternalAppFileName = childLevel.Value.ExternalAppFileName;
                            }

                            //Process AccordionDefinition Clicked Events
                            if (childLevel.Value.Clicked != null)
                            {
                                accordionChildButton.Clicked += childLevel.Value.Clicked;
                            }
                        }
                        vboxOuter.PackStart(accordionParentButton.ChildBox, false, false, 0);
                    }
                }
            }
            PackStart(vboxOuter);
        }
Beispiel #6
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Override Super/Base Class Methods

        //Object Initializer
        public override void InitObject(
            Window pSourceWindow,
            XPGuidObject pXpoDefaultValue,
            GenericTreeViewMode pGenericTreeViewMode,
            GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode,
            List <GenericTreeViewColumnProperty> pColumnProperties,
            XPCollection pXpoCollection,
            Type pDialogType
            )
        {
            if (_debug)
            {
                _log.Debug("InitObject Begin(" + pSourceWindow + "," + pColumnProperties + "," + pXpoCollection + "," + pXpoDefaultValue + "," + pDialogType + "," + pGenericTreeViewMode + "," + pGenericTreeViewNavigatorMode);
            }

            //Parameters
            _sourceWindow = pSourceWindow;
            _dataSource   = pXpoCollection;

            if (_dataSource.Count > 0)
            {
                _dataSourceRow = pXpoDefaultValue;
            }
            _guidDefaultValue  = (_dataSourceRow != null) ? _dataSourceRow.Oid : default(Guid);
            _xpoGuidObjectType = pXpoCollection.ObjectType;
            _dialogType        = pDialogType;
            _columnProperties  = pColumnProperties;
            _treeViewMode      = pGenericTreeViewMode;
            _navigatorMode     = pGenericTreeViewNavigatorMode;

            //Get First Custom Field Position ex OID
            _modelFirstCustomFieldIndex = (_treeViewMode == GenericTreeViewMode.Default) ? 1 : 2;

            //Add default Sorting, if not defined in XPCollection - Use Ord, XPObject must have Ord, else it Throw Exception Intentionally, this way developer detect error
            if (pXpoCollection.Sorting.Count == 0)
            {
                try
                {
                    pXpoCollection.Sorting = FrameworkUtils.GetXPCollectionDefaultSortingCollection();
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message, ex);
                    throw;
                }
            }

            //DropIdentityMap Removed, gives problems, Avoid used DropIdentityMap
            //_dataSource.Session.DropIdentityMap();
            //Force Reload Objects Without Cache
            _dataSource.Reload();

            //InitDataModel
            InitDataModel(_dataSource, _columnProperties, _treeViewMode);

            //ReIndex and count Rows
            _listStoreModel.Foreach(new TreeModelForeachFunc(TreeModelForEachTask));

            //Initialize UI
            if (_debug)
            {
                _log.Debug("InitObject Before InitUI");
            }
            InitUI();

            //Prepare CRUD Privileges
            //Require to use Object Name Without Prefixs (Remove Prefixs PFX_)
            string objectNameWithoutPrefix = _xpoGuidObjectType.UnderlyingSystemType.Name.Substring(4, _xpoGuidObjectType.UnderlyingSystemType.Name.Length - 4);
            string tokenAllowDelete        = string.Format("{0}_{1}", string.Format(SettingsApp.PrivilegesBackOfficeCRUDOperationPrefix, objectNameWithoutPrefix), "DELETE").ToUpper();
            string tokenAllowInsert        = string.Format("{0}_{1}", string.Format(SettingsApp.PrivilegesBackOfficeCRUDOperationPrefix, objectNameWithoutPrefix), "CREATE").ToUpper();
            string tokenAllowUpdate        = string.Format("{0}_{1}", string.Format(SettingsApp.PrivilegesBackOfficeCRUDOperationPrefix, objectNameWithoutPrefix), "EDIT").ToUpper();
            string tokenAllowView          = string.Format("{0}_{1}", string.Format(SettingsApp.PrivilegesBackOfficeCRUDOperationPrefix, objectNameWithoutPrefix), "VIEW").ToUpper();

            // Help to Debug some Kind of Types Privileges
            //if (this.GetType().Equals(typeof(TreeViewConfigurationInputReader)))
            //{
            //    _log.Debug($"BREAK {typeof(TreeViewConfigurationInputReader)}");
            //}

            //Assign CRUD permissions to private members, Overriding Defaults
            if (GlobalFramework.LoggedUserPermissions != null)
            {
                _allowRecordDelete = FrameworkUtils.HasPermissionTo(tokenAllowDelete);
                _allowRecordInsert = FrameworkUtils.HasPermissionTo(tokenAllowInsert);
                _allowRecordUpdate = FrameworkUtils.HasPermissionTo(tokenAllowUpdate);
                _allowRecordView   = FrameworkUtils.HasPermissionTo(tokenAllowView);
            }

            //Update Navigator Permissions
            InitNavigatorPermissions();

            //Init Protected Record Events
            InitProtectedRecordsEvents();

            //Always have a valid cursor, in first Record or in pDefaultValue
            SetInitialCursorPosition();

            if (_debug)
            {
                _log.Debug("InitObject End");
            }
        }
        //XpoMode
        public TreeViewDocumentFinanceSeries(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            //Assign Parameters to Members
            _sourceWindow = pSourceWindow;

            //Init Vars
            Type xpoGuidObjectType = typeof(FIN_DocumentFinanceSeries);
            //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView
            FIN_DocumentFinanceSeries defaultValue = (pDefaultValue != null) ? pDefaultValue as FIN_DocumentFinanceSeries : null;
            //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView
            Type typeDialogClass = (pDialogType != null) ? pDialogType : typeof(DialogDocumentFinanceSeries);

            //Configure columnProperties
            List <GenericTreeViewColumnProperty> columnProperties = new List <GenericTreeViewColumnProperty>();

            columnProperties.Add(new GenericTreeViewColumnProperty("FiscalYear")
            {
                Title = Resx.global_fiscal_year, ChildName = "Designation", MinWidth = 160
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("DocumentType")
            {
                Title = Resx.global_documentfinanceseries_documenttype, ChildName = "Designation", Expand = true
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Designation")
            {
                Title = Resx.global_designation, Expand = true
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("UpdatedAt")
            {
                Title = Resx.global_record_date_updated, MinWidth = 150, MaxWidth = 150
            });

            //Configure Criteria/XPCollection/Model : Use Default Filter
            CriteriaOperator criteria = (ReferenceEquals(pXpoCriteria, null))
                                        // Generate Default Criteria
                ? CriteriaOperator.Parse("(Disabled = 0 OR Disabled IS NULL)")
                                        // Add to Parameter Criteria
                : CriteriaOperator.Parse(string.Format("(Disabled = 0 OR Disabled IS NULL) AND ({0})", pXpoCriteria.ToString()))
            ;
            XPCollection xpoCollection = new XPCollection(GlobalFramework.SessionXpo, xpoGuidObjectType, criteria);

            //Call Base Initializer
            base.InitObject(
                pSourceWindow,                 //Pass parameter
                defaultValue,                  //Pass parameter
                pGenericTreeViewMode,          //Pass parameter
                pGenericTreeViewNavigatorMode, //Pass parameter
                columnProperties,              //Created Here
                xpoCollection,                 //Created Here
                typeDialogClass                //Created Here
                );

            //Add Extra Button to Navigator
            _buttonCreateDocumentFinanceSeries = Navigator.GetNewButton("touchButtonCreateDocumentFinanceSeries_DialogActionArea", Resx.pos_button_create_series, @"Icons/icon_pos_nav_new.png");
            //_buttonCreateDocumentFinanceSeries.WidthRequest = 110;
            //Check if Has an Active Year Open before apply Permissions
            FIN_DocumentFinanceYears currentDocumentFinanceYear = ProcessFinanceDocumentSeries.GetCurrentDocumentFinanceYear();

            //Apply Permissions
            _buttonCreateDocumentFinanceSeries.Sensitive = (currentDocumentFinanceYear != null && FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCESERIES_MANAGE_SERIES"));
            //Event
            _buttonCreateDocumentFinanceSeries.Clicked += buttonCreateDocumentFinanceSeries_Clicked;
            //Add to Extra Slot
            Navigator.ExtraSlot.PackStart(_buttonCreateDocumentFinanceSeries, false, false, 0);
        }
Beispiel #8
0
        public DashBoard(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            //Config
            int fontGenericTreeViewColumn = Convert.ToInt16(GlobalFramework.Settings["fontGenericTreeViewColumn"]);
            var predicate   = (Predicate <dynamic>)((dynamic x) => x.ID == "PosBaseWindow");
            var themeWindow = GlobalApp.Theme.Theme.Frontoffice.Window.Find(predicate);


            Color screenBackgroundColor = FrameworkUtils.StringToColor(themeWindow.Globals.ScreenBackgroundColor);
            Color white = System.Drawing.Color.White;
            Color black = System.Drawing.Color.Black;


            //_log.Debug("Theme Background: " + eventBackGround);
            //Shared error Message
            string errorMessage = "Node: <Window ID=\"PosBaseWindow\">";

            Fixed fix   = new Fixed();
            HBox  hbox  = new HBox();
            Frame frame = new Frame();

            VBox vbox  = new VBox(false, 2);
            VBox vbox2 = new VBox(true, 0);
            VBox vbox3 = new VBox(false, 5);

            DateTime datenow = new DateTime();

            //Icons dos botões do dashboard
            String _fileFiscalYearIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_configurations.png");
            String _fileInsertFiscalYear = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_fiscal_year.png");
            String _fileInsertIcon       = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_printer.png");
            String _fileTerminalsIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_terminals.png");

            String _fileArticlesIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_articles.png");
            String _fileCostumersIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_costumers.png");
            String _fileEmployeesIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_employees.png");
            String _fileOtherTablesIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_other_tables.png");

            String _fileDocumentsIcon      = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents.png");
            String _fileNewDocumentIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_new.png");
            String _filePayedDocumentsIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_new.png");
            String _fileInsertMerchIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_merch.png");

            String _fileReportsMenuIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports.png");
            String _fileReportsTotalIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_report.png");
            String _fileReportsClientsIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_client.png");
            String _fileReportsDayIcon     = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_day.png");

            //Tamanho dos Icons e da Font do Texto dos botões
            Size   sizeIcon = new Size(35, 35);
            string _fontBaseDialogButton = "8";

            //uint borderWidth = 5;
            //Cria o evento por trás da dashboard, tudo será carregado para aqui
            _eventboxDashboard = new EventBox();
            //_eventboxDashboard.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(screenBackgroundColor));
            _eventboxDashboard.WidthRequest  = GlobalApp.boScreenSize.Width;
            _eventboxDashboard.HeightRequest = GlobalApp.boScreenSize.Height;
            Alignment _alignmentWindow = new Alignment(0.0f, 0.0f, 0.0f, 0.0f);

            _alignmentWindow.Add(_eventboxDashboard);
            Add(_alignmentWindow);
            try
            {
                //Imagem carregada aqui para o dashboard
                string fileImageBack        = FrameworkUtils.OSSlash(string.Format("{0}Default/Backgrounds/Windows/LogicPOS_WorkFlow_{1}.png", GlobalFramework.Path["themes"], GlobalFramework.Settings["customCultureResourceDefinition"]));
                System.Drawing.Image pImage = System.Drawing.Image.FromFile(fileImageBack);
                Gdk.Pixbuf           pixbuf = Utils.ImageToPixbuf(pImage);
                _eventboxDashboard.Style = Utils.GetImageBackgroundDashboard(pixbuf);
                //Buttons Configuração
                botao1 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPLACETERMINAL_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_edit_ConfigurationPlaceTerminal_tab1_label"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileTerminalsIcon, sizeIcon, 105, 70);
                botao2 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPREFERENCEPARAMETER_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_application_setup"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileFiscalYearIcon, sizeIcon, 105, 70);
                botao3 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_CREATE", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_years_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertFiscalYear, sizeIcon, 105, 70);
                botao4 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPRINTERS_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printers"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertIcon, sizeIcon, 105, 70);

                //Buttons Tabelas
                botao5 = new TouchButtonIconWithText("BACKOFFICE_MAN_ARTICLE_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_articles"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileArticlesIcon, sizeIcon, 105, 70);
                botao6 = new TouchButtonIconWithText("BACKOFFICE_MAN_CUSTOMER_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customers"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileCostumersIcon, sizeIcon, 105, 70);
                botao7 = new TouchButtonIconWithText("BACKOFFICE_MAN_USERDETAIL_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_users"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileEmployeesIcon, sizeIcon, 105, 70);
                botao8 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPLACETABLE_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_other_tables"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileOtherTablesIcon, sizeIcon, 105, 70);

                //Buttons Documentos
                botao9  = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSSHOW_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_resume_finance_documents"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileNewDocumentIcon, sizeIcon, 105, 70);
                botao10 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSNEW_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_new_document"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileDocumentsIcon, sizeIcon, 105, 70);
                botao11 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSPAYMENTS_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_payments"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _filePayedDocumentsIcon, sizeIcon, 105, 70);
                botao12 = new TouchButtonIconWithText("STOCK_MERCHANDISE_ENTRY_ACCESS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentticket_type_title_cs_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertMerchIcon, sizeIcon, 105, 70);

                //Buttons Relatórios
                botao13 = new TouchButtonIconWithText("REPORT_ACCESS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_reports"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsMenuIcon, sizeIcon, 105, 70);
                botao14 = new TouchButtonIconWithText("REPORT_COMPANY_BILLING", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_company_billing_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsTotalIcon, sizeIcon, 105, 70);
                botao15 = new TouchButtonIconWithText("REPORT_CUSTOMER_BALANCE_DETAILS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_customer_balance_details_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsClientsIcon, sizeIcon, 105, 70);
                botao16 = new TouchButtonIconWithText("REPORT_SALES_DETAIL_PER_DATE", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_sales_per_date"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsDayIcon, sizeIcon, 105, 70);

                PosReportsDialog reportsClicked = new PosReportsDialog();

                //Permissões dos botões
                botao1.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPLACETERMINAL_MENU");
                botao2.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPREFERENCEPARAMETER_VIEW");
                botao3.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_CREATE");
                botao4.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPRINTERS_VIEW");

                botao5.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_ARTICLE_VIEW");
                botao6.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CUSTOMER_VIEW");
                botao7.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_USERDETAIL_VIEW");
                botao8.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPLACETABLE_VIEW");

                botao9.Sensitive  = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCETYPE_MENU");
                botao10.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCETYPE_CREATE");
                botao11.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_VIEW");
                botao12.Sensitive = FrameworkUtils.HasPermissionTo("STOCK_MERCHANDISE_ENTRY_ACCESS");

                //Este fica comentado, porque o próprio menu dos reports tem controlo de previlégios
                //botao13.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_ACCESS");
                botao14.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_COMPANY_BILLING");
                botao15.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_CUSTOMER_BALANCE_DETAILS");
                botao16.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_SALES_DETAIL_PER_DATE");


                //Actions Configurações
                botao1.Clicked += delegate { botao1.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTerminal>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao1, null); };
                botao2.Clicked += delegate { botao2.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao2, null); };
                botao3.Clicked += delegate { botao3.Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceYears>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao3, null); };
                botao4.Clicked += delegate { botao4.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrinters>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao4, null); };

                //Actions Tabelas
                botao5.Clicked += delegate { botao5.Content = Utils.GetGenericTreeViewXPO <TreeViewArticle>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao5, null); };
                botao6.Clicked += delegate { botao6.Content = Utils.GetGenericTreeViewXPO <TreeViewCustomer>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao6, null); };
                botao7.Clicked += delegate { botao7.Content = Utils.GetGenericTreeViewXPO <TreeViewUser>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao7, null); };
                botao8.Clicked += delegate { botao8.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTable>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao8, null); };

                //Actions Documents
                botao9.Clicked  += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 0); };
                botao10.Clicked += delegate { Utils.startNewDocumentFromBackOffice(pSourceWindow); };
                botao11.Clicked += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 3); };
                botao12.Clicked += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 6); };

                //Actions Reports
                botao13.Clicked += delegate { Utils.startReportsMenuFromBackOffice(pSourceWindow); };
                botao14.Clicked += delegate { reportsClicked.PrintReportRouter
                                                  (botao14, null); };
                botao15.Clicked += delegate { reportsClicked.PrintReportRouter(botao15, null); };
                botao16.Clicked += delegate { reportsClicked.PrintReportRouter(botao16, null); };

                //Posição dos botões na dashboard
                fix.Put(botao1, 55, 62);
                fix.Put(botao2, 55, 155);
                fix.Put(botao3, 55, 250);
                fix.Put(botao4, 55, 345);

                fix.Put(botao5, 245, 62);
                fix.Put(botao6, 245, 155);
                fix.Put(botao7, 245, 250);
                fix.Put(botao8, 245, 345);

                fix.Put(botao9, 440, 62);
                fix.Put(botao10, 440, 155);
                fix.Put(botao11, 440, 250);
                fix.Put(botao12, 440, 345);

                fix.Put(botao13, 635, 62);
                fix.Put(botao14, 635, 155);
                fix.Put(botao15, 635, 250);
                fix.Put(botao16, 635, 345);

                string currency = "Money";
                try
                {
                    string sqlCurrency = "SELECT Value FROM cfg_configurationpreferenceparameter where Token = 'SYSTEM_CURRENCY'";
                    currency = GlobalFramework.SessionXpo.ExecuteScalar(sqlCurrency).ToString();
                }
                catch
                {
                    currency = SettingsApp.SaftCurrencyCode;
                }

                decimal   dailyTotal   = 0;
                decimal   MonthlyTotal = 0;
                decimal   annualTotal  = 0;
                ArrayList values       = new ArrayList();
                values.Add(DateTime.Now.Year.ToString());
                try
                {
                    SortingCollection sortCollection = new SortingCollection();
                    sortCollection.Add(new SortProperty("Date", SortingDirection.Ascending));
                    CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("(Disabled = 0 OR Disabled IS NULL AND (DocumentType.Oid = '{0}' OR DocumentType.Oid = '{1}' OR DocumentType.Oid = '{2}' OR DocumentType.Oid = '{3}') AND DocumentStatusReason != 'A')", invoiceOid, invoiceAndPaymentOid, simpleInvoiceOid, creditNoteOid));
                    collectionDocuments = GlobalFramework.SessionXpo.GetObjects(GlobalFramework.SessionXpo.GetClassInfo(typeof(fin_documentfinancemaster)), criteria, sortCollection, int.MaxValue, false, true);

                    datenow = DateTime.Now;

                    foreach (fin_documentfinancemaster item in collectionDocuments)
                    {
                        //Faturação por Dia
                        if (item.Date.Day == datenow.Day && item.Date.Month == datenow.Month && item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                dailyTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                dailyTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //Faturação por Mês
                        if (item.Date.Month == datenow.Month && item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                MonthlyTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                MonthlyTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //Faturação por Ano
                        if (item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                annualTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                annualTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //grava anos que existe faturação
                        if (!values.Contains(item.Date.Year.ToString()))
                        {
                            values.Add(item.Date.Year.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message, ex);
                }

                label            = new Label();
                frame.ShadowType = (ShadowType)0;

                label.Text = string.Format("{0} {3}\n\n{1} {3}\n\n{2} {3}",
                                           Convert.ToInt64(Math.Round(dailyTotal, 0)).ToString(),
                                           Convert.ToInt64(Math.Round(MonthlyTotal, 0)).ToString(),
                                           Convert.ToInt64(Math.Round(annualTotal, 0)).ToString(),
                                           currency.ToString());

                label.ModifyFont(FontDescription.FromString("Trebuchet MS 16"));
                label.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(white));
                label.Justify = Justification.Right;
                frame.Add(label);
                hbox.PackStart(frame, false, false, 0);
                vbox.PackStart(hbox, false, false, 0);
                fix.Put(vbox, 628, 515);

                //COMBO BOX selecionar os anos do gráfico
                int      w        = 1;
                string[] getYears = new string[values.Count];
                getYears[0] = (string)values[0];
                for (int i = values.Count - 1; i > 0; i--)
                {
                    getYears[i] = (string)values[w];
                    w++;
                }
                //w = 1;
                selAno = new ComboBox(getYears);
                selAno.ModifyFg(StateType.Selected, Utils.ColorToGdkColor(black));

                TreeIter iter;
                selAno.Model.GetIterFirst(out iter);
                do
                {
                    GLib.Value thisRow = new GLib.Value();
                    selAno.Model.GetValue(iter, 0, ref thisRow);
                    if ((thisRow.Val as string).Equals(getYears[0]))
                    {
                        selAno.SetActiveIter(iter);
                        break;
                    }
                } while (selAno.Model.IterNext(ref iter));
                selAno.Changed += delegate
                {
                    annualTotal = 0;
                    foreach (fin_documentfinancemaster item in collectionDocuments)
                    {
                        if (item.Date.Year.ToString() == selAno.ActiveText.ToString())
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                annualTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                annualTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                    }
                    label.Text = string.Format("{0} {3}\n\n{1} {3}\n\n{2} {3}",
                                               Convert.ToInt64(Math.Round(dailyTotal, 0)).ToString(),
                                               Convert.ToInt64(Math.Round(MonthlyTotal, 0)).ToString(),
                                               Convert.ToInt64(Math.Round(annualTotal, 0)).ToString(),
                                               currency.ToString());

                    label.ModifyFont(FontDescription.FromString("Trebuchet MS 16"));
                    label.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(white));
                    label.Justify = Justification.Right;
                    frame.Add(label);

                    hbox.PackStart(frame, false, false, 0);
                    vbox.PackStart(hbox, false, false, 0);
                    string selectedDate = string.Format("01/01/{0}", (selAno.ActiveText.ToString()));
                    fix.Put(vbox, 640, 515);
                    fix.Put(drawSalesGraphic(DateTime.Parse(selectedDate), true), 55, 485);
                };
                if (Utils.IsLinux)
                {
                    fix.Put(selAno, 220, 650);
                }
                else
                {
                    fix.Put(selAno, 220, 665);
                }

                //GRÁFICO
                fix.Put(drawSalesGraphic(datenow, false), 55, 485);

                //Adiciona tudo ao evento principal
                _eventboxDashboard.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
                _eventboxDashboard.Add(fix);
                fix.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                Utils.ShowMessageTouchErrorRenderTheme(pSourceWindow, string.Format("{1}{0}{0}{2}", Environment.NewLine, errorMessage, ex.Message));
            }
        }
        private Dictionary <string, AccordionNode> GetAccordionDefinition()
        {
            _log.Debug("GetAccordionDefinition Begin");

            //Init accordionDefinition
            Dictionary <string, AccordionNode> accordionDefinition = null;

            try
            {
                accordionDefinition = new Dictionary <string, AccordionNode>();

                //Define Start Content with Articles TreeView
                Widget startContent = Utils.GetGenericTreeViewXPO <TreeViewArticle>(this);

                //Hide/Show Current Active Content based on user privileges
                string currentNodePrivilegesToken = string.Format(_privilegesBackOfficeMenuOperation, "Article".ToUpper());
                startContent.Sensitive = FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken);

                _labelActiveContent.Text = Resx.global_articles;
                _nodeContent             = startContent;

                _hboxContent.PackEnd(_nodeContent);

                //Define used CriteriaOperators/Override Defaults from TreeViews
                CriteriaOperator criteriaOperatorCustomer = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (Hidden IS NULL OR Hidden = 0)");
                CriteriaOperator criteriaConfigurationPreferenceParameterCompany = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (Token <> 'COMPANY_COUNTRY_OID' AND Token <> 'SYSTEM_CURRENCY_OID' AND FormType = 1)");
                CriteriaOperator criteriaConfigurationPreferenceParameterSystem  = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (FormType = 2)");

                //Articles
                Dictionary <string, AccordionNode> _accordionChildArticles = new Dictionary <string, AccordionNode>();
                //, Clicked = testClickedEventHandlerFromOutside }
                _accordionChildArticles.Add("ArticleFamily", new AccordionNode(Resx.global_families)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleFamily>(this)
                });
                _accordionChildArticles.Add("ArticleSubFamily", new AccordionNode(Resx.global_subfamilies)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleSubFamily>(this)
                });
                _accordionChildArticles.Add("Article", new AccordionNode(Resx.global_articles)
                {
                    Content = startContent
                });
                _accordionChildArticles.Add("ArticleType", new AccordionNode(Resx.global_article_types)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleType>(this)
                });
                _accordionChildArticles.Add("ArticleClass", new AccordionNode(Resx.global_article_class)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleClass>(this)
                });
                _accordionChildArticles.Add("ConfigurationPriceType", new AccordionNode(Resx.global_price_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPriceType>(this)
                });
                // Disable to Speed uo Opening BO, noew we have Stock Reports
                //_accordionChildArticles.Add("ArticleStock", new AccordionNode(Resx.global_stock_movements) { Content = Utils.GetGenericTreeViewXPO<TreeViewArticleStock>(this) });

                //Customers
                Dictionary <string, AccordionNode> _accordionChildCustomers = new Dictionary <string, AccordionNode>();
                _accordionChildCustomers.Add("Customer", new AccordionNode(Resx.global_customers)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomer>(this, criteriaOperatorCustomer)
                });
                _accordionChildCustomers.Add("CustomerType", new AccordionNode(Resx.global_customer_types)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomerType>(this)
                });
                _accordionChildCustomers.Add("CustomerDiscountGroup", new AccordionNode(Resx.global_customer_discount_groups)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomerDiscountGroup>(this)
                });

                //Users
                Dictionary <string, AccordionNode> _accordionChildUsers = new Dictionary <string, AccordionNode>();
                _accordionChildUsers.Add("UserDetail", new AccordionNode(Resx.global_users)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewUser>(this)
                });
                //Commented by Mario: Not Usefull, UserPermissionProfile has same funtionality
                //_accordionChildUsers.Add("UserProfile", new AccordionNode(Resx.global_profile) { Content = Utils.GetGenericTreeViewXPO<TreeViewUserProfile>(this) });
                //WARNING: Works with diferent constructs, its still need to be improved : new TreeViewUserProfilePermissions(this)
                _accordionChildUsers.Add("UserPermissionProfile", new AccordionNode(Resx.global_user_permissions)
                {
                    Content = new TreeViewUserProfilePermissions(this)
                });
                _accordionChildUsers.Add("UserCommissionGroup", new AccordionNode(Resx.global_user_commission_groups)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewUserCommissionGroup>(this)
                });
                //Moved to Custom Toolbar
                //_accordionChildUsers.Add("System_ApplyPrivileges", new AccordionNode(Resx.global_user_apply_privileges) { Clicked = delegate { Accordion.UpdateMenuPrivileges(); } });

                //Documents
                Dictionary <string, AccordionNode> _accordionDocuments = new Dictionary <string, AccordionNode>();
                _accordionDocuments.Add("DocumentFinanceYears", new AccordionNode(Resx.global_documentfinance_years)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceYears>(this)
                });
                _accordionDocuments.Add("DocumentFinanceSeries", new AccordionNode(Resx.global_documentfinance_series)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceSeries>(this)
                });
                _accordionDocuments.Add("DocumentFinanceType", new AccordionNode(Resx.global_documentfinance_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceType>(this)
                });
                //_accordionDocuments.Add("DocumentFinanceYearSerieTerminal", new AccordionNode(Resx.global_documentfinance_yearsseriesterminal) { Content = Utils.GetGenericTreeViewXPO<TreeViewDocumentFinanceYearSerieTerminal>(this) });
                _accordionDocuments.Add("ConfigurationVatRate", new AccordionNode(Resx.global_vat_rates)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationVatRate>(this)
                });
                _accordionDocuments.Add("ConfigurationVatExemptionReason", new AccordionNode(Resx.global_vat_exemption_reason)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationVatExceptionReason>(this)
                });
                _accordionDocuments.Add("ConfigurationPaymentCondition", new AccordionNode(Resx.global_payment_conditions)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPaymentCondition>(this)
                });
                _accordionDocuments.Add("ConfigurationPaymentMethod", new AccordionNode(Resx.global_payment_methods)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPaymentMethod>(this)
                });

                //AuxiliarTables
                Dictionary <string, AccordionNode> _accordionChildAuxiliarTables = new Dictionary <string, AccordionNode>();
                //_accordionChildAuxiliarTables.Add("ConfigurationCashRegister", new AccordionNode(Resx.global_cash_registers) { Content = Utils.GetGenericTreeView<TreeViewConfigurationCashRegister>(this) });
                _accordionChildAuxiliarTables.Add("ConfigurationCountry", new AccordionNode(Resx.global_country)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationCountry>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationCurrency", new AccordionNode(Resx.global_ConfigurationCurrency)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationCurrency>(this)
                });
                //_accordionChildAuxiliarTables.Add("ConfigurationDevice", new AccordionNode(Resx.global_devices) { Content = Utils.GetGenericTreeView<TreeViewConfigurationDevice>(this) });
                //_accordionChildAuxiliarTables.Add("ConfigurationKeyboard", new AccordionNode(Resx.global_keyboards) { Content = Utils.GetGenericTreeView<TreeViewConfigurationKeyboard>(this) });
                //_accordionChildAuxiliarTables.Add("ConfigurationMaintenance", new AccordionNode(Resx.global_maintenance) { Content = Utils.GetGenericTreeView<TreeViewConfigurationMaintenance>(this) });
                _accordionChildAuxiliarTables.Add("ConfigurationPlace", new AccordionNode(Resx.global_places)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlace>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationPlaceTable", new AccordionNode(Resx.global_place_tables)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTable>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationPlaceMovementType", new AccordionNode(Resx.global_places_movement_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceMovementType>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationUnitMeasure", new AccordionNode(Resx.global_units_measure)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationUnitMeasure>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationUnitSize", new AccordionNode(Resx.global_units_size)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationUnitSize>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationHolidays", new AccordionNode(Resx.global_holidays)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationHolidays>(this)
                });

                //Devices
                Dictionary <string, AccordionNode> _accordionDevices = new Dictionary <string, AccordionNode>();
                _accordionDevices.Add("ConfigurationPrintersType", new AccordionNode(Resx.global_ConfigurationPrintersType)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrintersType>(this)
                });
                _accordionDevices.Add("ConfigurationPrinters", new AccordionNode(Resx.global_ConfigurationPrinters)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrinters>(this)
                });
                _accordionDevices.Add("ConfigurationInputReader", new AccordionNode(Resx.global_ConfigurationInputReader)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationInputReader>(this)
                });
                _accordionDevices.Add("ConfigurationPoleDisplay", new AccordionNode(Resx.global_ConfigurationPoleDisplay)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPoleDisplay>(this)
                });
                _accordionDevices.Add("ConfigurationWeighingMachine", new AccordionNode(Resx.global_ConfigurationWeighingMachine)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationWeighingMachine>(this)
                });
                // Deprecated
                //_accordionPrinters.Add("ConfigurationPrintersTemplates", new AccordionNode(Resx.global_ConfigurationPrintersTemplates) { Content = Utils.GetGenericTreeViewXPO<TreeViewConfigurationPrintersTemplates>(this) });
                //_accordionPrinters.Add("ExternalApp_Composer", new AccordionNode(Resx.global_callposcomposer) { Content = null, ExternalAppFileName = SettingsApp.ExecutableComposer });

                //Configuration
                Dictionary <string, AccordionNode> _accordionChildConfiguration = new Dictionary <string, AccordionNode>();
                _accordionChildConfiguration.Add("ConfigurationPreferenceParameterCompany", new AccordionNode(Resx.global_preferenceparameter_company)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(this, criteriaConfigurationPreferenceParameterCompany)
                });
                _accordionChildConfiguration.Add("ConfigurationPreferenceParameterSystem", new AccordionNode(Resx.global_preferenceparameter_system)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(this, criteriaConfigurationPreferenceParameterSystem)
                });
                _accordionChildConfiguration.Add("ConfigurationPlaceTerminal", new AccordionNode(Resx.global_places_terminals)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTerminal>(this)
                });

                // Add Menu Items Based On Plugins PluginSoftwareVendor
                Dictionary <string, AccordionNode> _accordionChildExport = new Dictionary <string, AccordionNode>();
                //Export
                if (GlobalFramework.PluginSoftwareVendor != null && SettingsApp.ConfigurationSystemCountry.Oid == SettingsApp.XpoOidConfigurationCountryPortugal)
                {
                    _accordionChildExport.Add("System_ExportSaftPT_SaftPt", new AccordionNode(Resx.global_export_saftpt_whole_year)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.WholeYear); }
                    });
                    _accordionChildExport.Add("System_ExportSaftPT_E-Fatura", new AccordionNode(Resx.global_export_saftpt_last_month)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.LastMonth); }
                    });
                    _accordionChildExport.Add("System_ExportSaftPT_Custom", new AccordionNode(Resx.global_export_saftpt_custom)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.Custom); }
                    });
                }

                //System
                Dictionary <string, AccordionNode> _accordionChildSystem = new Dictionary <string, AccordionNode>();
                // Add Menu Items Based On Plugins PluginSoftwareVendor
                if (GlobalFramework.PluginSoftwareVendor != null)
                {
                    _accordionChildSystem.Add("System_DataBaseBackup", new AccordionNode(Resx.global_database_backup)
                    {
                        Clicked = delegate { DataBaseBackup.Backup(this); }
                    });
                    _accordionChildSystem.Add("System_DataBaseRestore_FromSystem", new AccordionNode(Resx.global_database_restore)
                    {
                        Clicked = delegate { DataBaseBackup.Restore(this, DataBaseRestoreFrom.SystemBackup); }
                    });
                    _accordionChildSystem.Add("System_DataBaseRestore_FromFile", new AccordionNode(Resx.global_database_restore_from_file)
                    {
                        Clicked = delegate { DataBaseBackup.Restore(this, DataBaseRestoreFrom.ChooseFromFilePickerDialog); }
                    });
                }
                _accordionChildSystem.Add("System_Menu", new AccordionNode(Resx.global_application_logout_user)
                {
                    Clicked = ClickedSystemLogout
                });
                _accordionChildSystem.Add("System_Pos", new AccordionNode(Resx.global_pos)
                {
                    Clicked = ClickedSystemPos
                });
                _accordionChildSystem.Add("System_Quit", new AccordionNode(Resx.global_quit)
                {
                    Clicked = delegate { LogicPos.Quit(this); }
                });

                //Compose Main Accordion Parent Buttons
                accordionDefinition.Add("TopMenuArticles", new AccordionNode(Resx.global_articles)
                {
                    Childs = _accordionChildArticles, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_artigos.png")
                });
                accordionDefinition.Add("TopMenuDocuments", new AccordionNode(Resx.global_documents)
                {
                    Childs = _accordionDocuments, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_informacao_fiscal.png")
                });
                accordionDefinition.Add("TopMenuCustomers", new AccordionNode(Resx.global_customers)
                {
                    Childs = _accordionChildCustomers, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_clientes.png")
                });
                accordionDefinition.Add("TopMenuUsers", new AccordionNode(Resx.global_users)
                {
                    Childs = _accordionChildUsers, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_utilizadores.png")
                });
                accordionDefinition.Add("TopMenuDevices", new AccordionNode(Resx.global_devices)
                {
                    Childs = _accordionDevices, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_impressoras.png")
                });
                accordionDefinition.Add("TopMenuOtherTables", new AccordionNode(Resx.global_other_tables)
                {
                    Childs = _accordionChildAuxiliarTables, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_outras_tabelas.png")
                });
                accordionDefinition.Add("TopMenuConfiguration", new AccordionNode(Resx.global_configuration)
                {
                    Childs = _accordionChildConfiguration, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_configuracao.png")
                });
                if (_accordionChildExport.Count > 0)
                {
                    accordionDefinition.Add("TopMenuExport", new AccordionNode(Resx.global_export)
                    {
                        Childs = _accordionChildExport, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_export.png")
                    });
                }
                accordionDefinition.Add("TopMenuSystem", new AccordionNode(Resx.global_system)
                {
                    Childs = _accordionChildSystem, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_sistema.png")
                });

                _log.Debug("GetAccordionDefinition End");
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(accordionDefinition);
        }
Beispiel #10
0
        protected void InitObject(Dictionary <string, AccordionNode> pAccordionDefinition, string pNodePrivilegesTokenFormat)
        {
            String fontPosBackOfficeParent = GlobalFramework.Settings["fontPosBackOfficeParent"];
            String fontPosBackOfficeChild  = GlobalFramework.Settings["fontPosBackOfficeChild"];

            //Parameters
            _accordionDefinition = pAccordionDefinition;
            //Local Vars
            bool   isFirstButton = true;
            string currentNodePrivilegesToken;

            VBox vboxOuter = new VBox(false, 2);
            AccordionParentButton accordionParentButton;
            AccordionChildButton  accordionChildButton;

            if (_accordionDefinition != null && _accordionDefinition.Count > 0)
            {
                foreach (var parentLevel in _accordionDefinition)
                {
                    if (parentLevel.Value.GroupIcon != null)
                    {
                        HBox hboxParent = new HBox(false, 0);
                        hboxParent.PackStart(parentLevel.Value.GroupIcon, false, false, 3);
                        Label label = new Label(parentLevel.Value.Label);

                        //Pango.FontDescription tmpFont = new Pango.FontDescription();
                        Pango.FontDescription fontDescriptionParent = Pango.FontDescription.FromString(fontPosBackOfficeParent);
                        //tmpFont.Weight = Pango.Weight.Bold;
                        //tmpFont.Size = 2;
                        label.ModifyFont(fontDescriptionParent);
                        label.SetAlignment(0.0f, 0.5f);
                        hboxParent.PackStart(label, true, true, 0);
                        accordionParentButton = new AccordionParentButton(hboxParent)
                        {
                            Name = parentLevel.Key
                        };
                    }
                    else
                    {
                        accordionParentButton = new AccordionParentButton(parentLevel.Value.Label)
                        {
                            Name = parentLevel.Key
                        };
                        //First Parent Node is Assigned has currentParentButton
                        if (_currentParentButton == null)
                        {
                            _currentParentButton = accordionParentButton;
                        }
                    }

                    accordionParentButton.Active = isFirstButton;
                    if (isFirstButton)
                    {
                        isFirstButton = false;
                    }

                    //Add a Button Widget Reference to NodeWidget AccordionDefinition
                    parentLevel.Value.NodeButton = accordionParentButton;
                    //Click Event
                    accordionParentButton.Clicked += accordionParentButton_Clicked;
                    vboxOuter.PackStart(accordionParentButton, false, false, 0);

                    //_log.Debug(string.Format("Accordion(): parentLevel.Value.Label [{0}]", parentLevel.Value.Label));
                    if (parentLevel.Value.Childs.Count > 0)
                    {
                        foreach (var childLevel in parentLevel.Value.Childs)
                        {
                            //Init ChildButton
                            accordionChildButton = new AccordionChildButton(childLevel.Value.Label)
                            {
                                Name = childLevel.Key, Content = childLevel.Value.Content
                            };
                            //Add a Button Widget Reference to NodeWidget AccordionDefinition
                            childLevel.Value.NodeButton = accordionChildButton;

                            //Privileges
                            currentNodePrivilegesToken = string.Format(pNodePrivilegesTokenFormat, childLevel.Key.ToUpper());
                            //_log.Debug(string.Format("currentNodePrivilegesToken: [{0}]", currentNodePrivilegesToken));

                            //First Child Node is Assigned has currentChildButton
                            //if (childLevel.Value.Active)
                            if (_currentChildButton == null)
                            {
                                _currentChildButton = accordionChildButton;
                                //Assign Current Active Button with content
                                _currentChildButtonContent = accordionChildButton;
                            }

                            accordionParentButton.ChildBox.PackStart(accordionChildButton, false, false, 2);

                            //If have (Content | Events | ExternalApp) & Privileges or the Button is Enabled, Else is Disabled
                            accordionChildButton.Sensitive = (FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken) && (childLevel.Value.Content != null || childLevel.Value.Clicked != null || childLevel.Value.ExternalAppFileName != null));

                            //EventHandler, Redirected to public Clicked, this way we have ouside Access
                            accordionChildButton.Clicked += accordionChildButton_Clicked;
                            //ExternalAppFileName
                            if (childLevel.Value.ExternalAppFileName != null)
                            {
                                accordionChildButton.ExternalAppFileName = childLevel.Value.ExternalAppFileName;
                            }

                            //Process AccordionDefinition Clicked Events
                            if (childLevel.Value.Clicked != null)
                            {
                                accordionChildButton.Clicked += childLevel.Value.Clicked;
                            }
                        }
                        vboxOuter.PackStart(accordionParentButton.ChildBox, false, false, 0);
                    }
                }
            }
            PackStart(vboxOuter);
        }
Beispiel #11
0
        new protected void InitUI()
        {
            VBox vbox = new VBox(false, 1);

            //ScrolledWindow
            ScrolledWindow scrolledWindowProfile = new ScrolledWindow();

            scrolledWindowProfile.ShadowType = ShadowType.EtchedIn;
            scrolledWindowProfile.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            //StatusBar
            if (_showStatusBar)
            {
                _statusbar = new Statusbar()
                {
                    HasResizeGrip = false
                };
                _statusbar.Push(0, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_statusbar"));
            }
            ;

            //Treeview
            TreeView = new TreeView(_listStoreModelFilterSort);

            //_treeView.RulesHint = true;
            TreeView.EnableSearch = true;
            TreeView.SearchColumn = 1;
            TreeView.ModifyCursor(new Gdk.Color(100, 100, 100), new Gdk.Color(200, 200, 200));
            //Add Columns
            AddColumns();

            //Navigator
            Navigator = new GenericTreeViewNavigator <XPCollection, XPGuidObject>(_sourceWindow, this, _navigatorMode);

            //TODO:THEME
            //if (GlobalApp.ScreenSize.Width >= 800)
            //{
            TouchButtonIconWithText buttonApplyPrivileges = Navigator.GetNewButton("touchButtonApplyPrivileges_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_user_apply_privileges"), @"Icons/icon_pos_nav_refresh.png");

            //buttonApplyPrivileges.WidthRequest = 110;
            //Apply Permissions
            buttonApplyPrivileges.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_USER_PRIVILEGES_APPLY");
            //Event
            buttonApplyPrivileges.Clicked += delegate
            {
                GlobalApp.WindowBackOffice.Accordion.UpdateMenuPrivileges();
                //Force Update MainWindow Pos Privilegs ex TollBar Buttons etc
                GlobalApp.WindowPos.TicketList.UpdateTicketListButtons();
            };
            //Add to Extra Slot
            Navigator.ExtraSlot.PackStart(buttonApplyPrivileges, false, false, 0);
            //}

            //Pack components
            scrolledWindowProfile.Add(TreeView);

            HBox hbox = new HBox(false, 1);

            hbox.PackStart(scrolledWindowProfile);

            vbox.PackStart(hbox, true, true, 0);
            vbox.PackStart(Navigator, false, false, 0);

            if (_showStatusBar)
            {
                vbox.PackStart(_statusbar, false, false, 0);
            }

            //Final Pack
            PackStart(vbox);

            //Required Always Start in First Record, and get Iter XPGuidObject, Ready for Update Action
            try
            {
                if (_dataSource.Count > 0)
                {
                    TreeView.Model.GetIterFirst(out _treeIter);
                    _treePath = ListStoreModelFilter.GetPath(_treeIter);
                    TreeView.SetCursor(_treePath, null, false);
                    _dataSourceRow = (sys_userprofile)_dataSource.Lookup(new Guid(Convert.ToString(TreeView.Model.GetValue(_treeIter, _modelFirstCustomFieldIndex))));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            //Events
            TreeView.CursorChanged            += _treeView_CursorChanged;
            TreeView.RowActivated             += delegate { Update(); };
            TreeView.Vadjustment.ValueChanged += delegate { UpdatePages(); };
            TreeView.Vadjustment.Changed      += delegate { UpdatePages(); };

            //****************************************************************************

            _treeViewPermissionItem.Model = _listStoreModelPermissionItem;

            TreeViewColumn tmpColId = _treeViewPermissionItem.AppendColumn("ID", new CellRendererText(), "text", 0);

            tmpColId.Visible = false;

            TreeViewColumn tmpColProperty = _treeViewPermissionItem.AppendColumn(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_privilege_property"), new CellRendererText()
            {
                FontDesc = _fontDesc
            }, "text", 1);
            //Config Column Title
            Label labelPropertyTitle = new Label(tmpColProperty.Title);

            labelPropertyTitle.Show();
            labelPropertyTitle.ModifyFont(_fontDescTitle);
            tmpColProperty.Widget = labelPropertyTitle;

            TreeViewColumn tmpColActivo = _treeViewPermissionItem.AppendColumn(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_privilege_active"), _cellRendererTogglePermissionItem, "active", 2);

            tmpColActivo.MaxWidth = 100;
            //Config Column Title
            Label labelActivoTitle = new Label(tmpColActivo.Title);

            labelActivoTitle.Show();
            labelActivoTitle.ModifyFont(_fontDescTitle);
            tmpColActivo.Widget = labelActivoTitle;
            //Event
            _cellRendererTogglePermissionItem.Toggled += ToggleEvent;

            ScrolledWindow scrolledWindowPermissionItem = new ScrolledWindow()
            {
                WidthRequest = 500
            };

            scrolledWindowPermissionItem.Add(_treeViewPermissionItem);

            hbox.Add(scrolledWindowPermissionItem);
        }
        public PosDocumentFinanceSelectRecordDialog(Window pSourceWindow, DialogFlags pDialogFlags, int docChoice)
            : base(pSourceWindow, pDialogFlags)
        {
            //Parameters
            _sourceWindow = pSourceWindow;

            //Settings
            string _fileIconListFinanceDocuments        = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_toolbar_finance_document.png");
            string _fileIconListCurrentAccountDocuments = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_toolbar_current account_document.png");
            string _fileIconListWorksessionPeriods      = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_toolbar_cashdrawer.png");
            string _fileIconListMerchandiseEntry        = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_toolbar_merchandise_entry.png");

            //Sizes
            Size sizeIcon         = new Size(50, 50);
            int  buttonWidth      = 162;
            int  buttonHeight     = 88;
            uint tablePadding     = 10;
            int  windowSizeWidth  = (buttonWidth + Convert.ToInt16(tablePadding)) * 3 + 65;
            int  windowSizeHeight = (buttonHeight + Convert.ToInt16(tablePadding)) * 2 + 90;

            //Init Local Vars
            string windowTitle           = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_document_finance");
            Size   windowSize            = new Size(windowSizeWidth, windowSizeHeight);
            string fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_documents.png");

            //Buttons
            _touchButtonPosToolbarFinanceDocuments = new TouchButtonIconWithText("touchButtonPosToolbarFinanceDocuments_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_record_finance_documents"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListFinanceDocuments, sizeIcon, buttonWidth, buttonHeight)
            {
                Token = "ALL"
            };
            _toolbarFinanceDocumentsInvoicesUnpayed = new TouchButtonIconWithText("touchButtonPosToolbarFinanceDocumentsInvoicesForPayment_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_finance_documents_ft_unpaid"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListFinanceDocuments, sizeIcon, buttonWidth, buttonHeight)
            {
                Token = "FT_UNPAYED"
            };
            _toolbarFinanceDocumentsPayments = new TouchButtonIconWithText("touchButtonPosToolbarFinanceDocumentsPayments_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_payments"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListFinanceDocuments, sizeIcon, buttonWidth, buttonHeight);
            _touchButtonPosToolbarCurrentAccountDocuments = new TouchButtonIconWithText("touchButtonPosToolbarCurrentAccountDocuments_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_finance_documents_cc"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListCurrentAccountDocuments, sizeIcon, buttonWidth, buttonHeight)
            {
                Token = "CC"
            };
            _touchButtonPosToolbarWorkSessionPeriods = new TouchButtonIconWithText("touchButtonPosToolbarWorkSessionPeriods_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_worksession_period"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListWorksessionPeriods, sizeIcon, buttonWidth, buttonHeight);
            _touchButtonPosToolbarMerchandiseEntry   = new TouchButtonIconWithText("touchButtonPosToolbarMerchandiseEntry_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_merchandise_entry"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileIconListMerchandiseEntry, sizeIcon, buttonWidth, buttonHeight);
            //Permission
            _touchButtonPosToolbarMerchandiseEntry.Sensitive = FrameworkUtils.HasPermissionTo("STOCK_MERCHANDISE_ENTRY_ACCESS");

            //Table
            Table table = new Table(1, 1, true);

            table.BorderWidth = tablePadding;
            //Row 1
            table.Attach(_touchButtonPosToolbarFinanceDocuments, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);
            table.Attach(_toolbarFinanceDocumentsInvoicesUnpayed, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);
            table.Attach(_toolbarFinanceDocumentsPayments, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);
            //Row 2
            table.Attach(_touchButtonPosToolbarCurrentAccountDocuments, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);
            table.Attach(_touchButtonPosToolbarWorkSessionPeriods, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);
            table.Attach(_touchButtonPosToolbarMerchandiseEntry, 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePadding, tablePadding);

            //TK016235 BackOffice - Mode
            //numero da escolha vem do accordion do BackOfficeMainWindow, e passa por Utils
            switch (docChoice)
            {
            case 1:
                touchButtonPosToolbarFinanceDocuments_Clicked(_touchButtonPosToolbarFinanceDocuments, null);
                break;

            case 2:
                touchButtonPosToolbarFinanceDocuments_Clicked(_toolbarFinanceDocumentsInvoicesUnpayed, null);
                break;

            case 3:
                _toolbarFinanceDocumentsPayments_Clicked(_toolbarFinanceDocumentsPayments, null);
                break;

            case 4:
                touchButtonPosToolbarFinanceDocuments_Clicked(_touchButtonPosToolbarCurrentAccountDocuments, null);
                break;

            case 5:
                _touchButtonPosToolbarWorkSessionPeriods_Clicked(_touchButtonPosToolbarWorkSessionPeriods, null);
                break;

            case 6:
                _touchButtonPosToolbarMerchandiseEntry_Clicked(_touchButtonPosToolbarMerchandiseEntry, null);
                break;

            case 0:

                //Init Object
                this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, table, null);

                //Shared Events
                _touchButtonPosToolbarFinanceDocuments.Clicked        += touchButtonPosToolbarFinanceDocuments_Clicked;
                _toolbarFinanceDocumentsInvoicesUnpayed.Clicked       += touchButtonPosToolbarFinanceDocuments_Clicked;
                _touchButtonPosToolbarCurrentAccountDocuments.Clicked += touchButtonPosToolbarFinanceDocuments_Clicked;
                //Non Shared Events
                _toolbarFinanceDocumentsPayments.Clicked         += _toolbarFinanceDocumentsPayments_Clicked;
                _touchButtonPosToolbarWorkSessionPeriods.Clicked += _touchButtonPosToolbarWorkSessionPeriods_Clicked;
                _touchButtonPosToolbarMerchandiseEntry.Clicked   += _touchButtonPosToolbarMerchandiseEntry_Clicked;

                //Reference Objects
                _printerGeneric = (sys_configurationprinters)GlobalFramework.SessionXpo.GetObjectByKey(typeof(sys_configurationprinters), SettingsApp.XpoOidConfigurationPrinterGeneric);
                break;
            }
        }