protected virtual void Build() { BinContainer.Attach(this); fixed1 = new Gtk.Fixed(); fixed1.Name = "fixed1"; fixed1.HasWindow = true; Color color = new Color(); Color.Parse("white", ref color); fixed1.ModifyBg(StateType.Normal, color); BuildSymbol(ref img01, 0, 0); BuildSymbol(ref img02, 16, 0); BuildSymbol(ref img03, 32, 0); BuildSymbol(ref img04, 48, 0); BuildSymbol(ref img05, 64, 0); this.Add(this.fixed1); if ((this.Child != null)) { this.Child.ShowAll(); } this.Hide(); }
protected virtual void Build() { BinContainer.Attach(this); fixed1 = new Gtk.Fixed(); fixed1.Name = "fixed1"; fixed1.HasWindow = true; Color color = new Color(); Color.Parse("white", ref color); fixed1.ModifyBg(StateType.Normal, color); BuildSmallWidget(ref sym01, 0, 0); BuildSmallWidget(ref sym02, 90, 0); BuildSmallWidget(ref sym03, 0, 30); BuildSmallWidget(ref sym04, 90, 30); this.Add(this.fixed1); if ((this.Child != null)) { this.Child.ShowAll(); } this.Hide(); }
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 void InitUI() { //Init Local Vars GlobalApp.boScreenSize = Utils.GetScreenSize(); uint borderWidth = 5; System.Drawing.Size sizeIconDashboard = new System.Drawing.Size(30, 30); System.Drawing.Size sizeIcon = new System.Drawing.Size(20, 20); System.Drawing.Size sizeIconQuit = new System.Drawing.Size(20, 20); System.Drawing.Size sizeButton = new System.Drawing.Size(20, 20); String fontPosBackOfficeParent = GlobalFramework.Settings["fontPosBackOfficeParent"]; String fontDescriptionParentLowRes = GlobalFramework.Settings["fontDescriptionParentLowRes"]; String fontDescription = GlobalFramework.Settings["fontDescriptionParentLowRes"]; //Settings //Redimensionar Botões do accordion para 1024 fontDescription = fontPosBackOfficeParent; if (GlobalApp.boScreenSize.Height <= 800) { _widthAccordion = 208; sizeIcon = new System.Drawing.Size(20, 20); sizeButton = new System.Drawing.Size(15, 15); sizeIconQuit = new System.Drawing.Size(20, 20); sizeIconDashboard = new System.Drawing.Size(20, 20); _heightAccordion = 25; fontDescription = fontDescriptionParentLowRes; } //IN009296 BackOffice - Mudar a língua da aplicação try { string sql = string.Format("UPDATE cfg_configurationpreferenceparameter SET value = '{0}' WHERE token = 'CULTURE'", GlobalFramework.Settings["customCultureResourceDefinition"]); GlobalFramework.SessionXpo.ExecuteScalar(sql); } catch (Exception ex) { _log.Error(ex.Message, ex); } /* IN006045 */ //_clockFormat = GlobalFramework.Settings["dateTimeFormatStatusBar"]; _clockFormat = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "backoffice_datetime_format_status_bar"); string fontBackOfficeStatusBar = GlobalFramework.Settings["fontPosStatusBar"]; string fileImageBackOfficeLogoLong = FrameworkUtils.OSSlash(GlobalFramework.Path["themes"] + @"Default\Images\logo_backoffice_long.png"); string fileImageBackOfficeLogo = Utils.GetThemeFileLocation(GlobalFramework.Settings["fileImageBackOfficeLogo"]); //Colors System.Drawing.Color colorBackOfficeContentBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeContentBackground"]); System.Drawing.Color colorBackOfficeStatusBarBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarBackground"]); System.Drawing.Color colorBackOfficeAccordionFixBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeAccordionFixBackground"]); System.Drawing.Color colorBackOfficeStatusBarFont = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarFont"]); System.Drawing.Color colorBackOfficeStatusBarBottomBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarBottomBackground"]); System.Drawing.Color colorLabelReseller = System.Drawing.Color.White; ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeContentBackground)); //Icon string fileImageAppIcon = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], SettingsApp.AppIcon)); if (File.Exists(fileImageAppIcon)) { Icon = Utils.ImageToPixbuf(System.Drawing.Image.FromFile(fileImageAppIcon)); } //Start Pack UI //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //StatusBar EventBox eventBoxStatusBar = new EventBox() { HeightRequest = 38 }; eventBoxStatusBar.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarBackground)); //Reseller _reseller = new Label(); _reseller.Text = string.Format(" Brough by {0}", GlobalFramework.LicenceReseller); _reseller.ModifyFont(Pango.FontDescription.FromString("Trebuchet MS 8 Bold")); _reseller.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _reseller.Justify = Justification.Left; //Logo try { if (GlobalFramework.LicenceReseller != "LogicPulse") { _imageLogo = new Image(fileImageBackOfficeLogo); } else { _imageLogo = new Image(fileImageBackOfficeLogoLong); } //_imageLogo.WidthRequest = _widthAccordion + Convert.ToInt16(borderWidth) * 3; //_imageLogo.SetAlignment(0.0F, 0.5F); } catch (Exception ex) { _log.Error(string.Format("InitUI(): Image [{0}] not found: {1}", fileImageBackOfficeLogo, ex.Message), ex); } //Style StatusBarFont Pango.FontDescription fontDescriptionStatusBar = Pango.FontDescription.FromString(fontBackOfficeStatusBar); String _dashboardIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_dashboard.png"); String _updateIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_update.png"); String _exitIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_pos_close_backoffice.png"); String _backPOSIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_pos_front_office.png"); String _iconDashBoard = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_other_tables.png"); //Active Content _labelActiveContent = new Label() { WidthRequest = 300 }; _labelActiveContent.ModifyFont(fontDescriptionStatusBar); _labelActiveContent.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelActiveContent.SetAlignment(0.0F, 0.5F); //TerminalInfo : Terminal : User _labelTerminalInfo = new Label(string.Format("{0} : {1}", GlobalFramework.LoggedTerminal.Designation, GlobalFramework.LoggedUser.Name)); _labelTerminalInfo.ModifyFont(fontDescriptionStatusBar); _labelTerminalInfo.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelTerminalInfo.SetAlignment(0.5F, 0.5F); //Clock _labelClock = new Label(FrameworkUtils.CurrentDateTime(_clockFormat)); _labelClock.ModifyFont(fontDescriptionStatusBar); _labelClock.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelClock.SetAlignment(1.0F, 0.5F); //Pack HBox StatusBar _hboxStatusBar = new HBox(false, 0) { BorderWidth = borderWidth }; _hboxStatusBar.PackStart(_imageLogo, false, false, 0); if (GlobalFramework.LicenceReseller != "LogicPulse") { _hboxStatusBar.PackStart(_reseller, false, false, 0); } _hboxStatusBar.PackStart(_labelActiveContent, false, false, 0); _hboxStatusBar.PackStart(_labelTerminalInfo, true, true, 0); //TODO:THEME if (GlobalApp.boScreenSize.Width < 1024 || GlobalApp.boScreenSize.Height < 768) { _labelTerminalInfo.SetAlignment(1.0F, 0.5F); } else { _hboxStatusBar.PackStart(_labelClock, false, false, 0); } if (GlobalFramework.AppUseBackOfficeMode) { EventBox eventBoxMinimize = Utils.GetMinimizeEventBox(); eventBoxMinimize.ButtonReleaseEvent += delegate { Iconify(); }; _hboxStatusBar.PackStart(eventBoxMinimize, false, false, 0); //fix.Put(eventBoxMinimize, GlobalApp.ScreenSize.Width - 27 - 10, 10); } _imageLogo.Dispose(); _dashboardButton = new TouchButtonIconWithText("DASHBOARD_ICON", FrameworkUtils.StringToColor("168, 204, 79"), "Dashboard", fontDescription, FrameworkUtils.StringToColor("61, 61, 61"), _dashboardIcon, sizeIconDashboard, _widthAccordion, _heightAccordion, true); _exitButton = new TouchButtonIconWithText("EXIT_BUTTON", FrameworkUtils.StringToColor("201, 102, 88"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_quit"), fontDescription, FrameworkUtils.StringToColor("255, 255, 255"), _exitIcon, sizeButton, _widthAccordion, _heightAccordion, true); _backPOS = new TouchButtonIconWithText("POS", FrameworkUtils.StringToColor("168, 204, 79"), "Logicpos", fontDescription, FrameworkUtils.StringToColor("61, 61, 61"), _backPOSIcon, sizeButton, _widthAccordion, _heightAccordion, true); _NewVersion = new TouchButtonIconWithText("Update_Button", FrameworkUtils.StringToColor("168, 204, 79"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_update_pos"), fontDescription, FrameworkUtils.StringToColor("61, 61, 61"), _updateIcon, sizeButton, _widthAccordion, _heightAccordion, true); _labelClock.ModifyFont(fontDescriptionStatusBar); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //StatusBar //Fixed fixStatusBarBottom = new Fixed() { HasWindow = true, BorderWidth = borderWidth, HeightRequest = 38 }; //fixStatusBarBottom.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarBottomBackground)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Hbox Accordion + Content _hboxContent = new HBox(false, (int)borderWidth) { BorderWidth = borderWidth }; //_accordion = new Accordion() { WidthRequest = _widthAccordion }; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Accordion and HouseFix _fixAccordion = new Fixed() { HasWindow = true, BorderWidth = borderWidth }; _fixAccordion.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeAccordionFixBackground)); _fixAccordion.Put(_dashboardButton, 0, 0); _fixAccordion.Add(_dashboardButton); //Redimensionar Botões do Backoffice para 1024x768 if (!GlobalFramework.AppUseBackOfficeMode) { if (GlobalApp.boScreenSize.Height <= 800) { _fixAccordion.Put(_backPOS, 0, GlobalApp.boScreenSize.Height - 112); _fixAccordion.Add(_backPOS); } else { _fixAccordion.Put(_backPOS, 0, GlobalApp.boScreenSize.Height - 135); _fixAccordion.Add(_backPOS); } } //Redimensionar Botões do Backoffice para 1024x768 if (GlobalApp.boScreenSize.Height <= 800) { _fixAccordion.Put(_exitButton, 0, GlobalApp.boScreenSize.Height - 85); _fixAccordion.Add(_exitButton); } else { _fixAccordion.Put(_exitButton, 0, GlobalApp.boScreenSize.Height - 95); _fixAccordion.Add(_exitButton); } //TK016248 - BackOffice - Check New Version string appVersion = FrameworkUtils.ProductVersion.Replace("v", ""); bool needToUpdate = false; GlobalFramework.ServerVersion = "1.3.0000"; if (GlobalFramework.ServerVersion != null) { try { string[] tmpNew = appVersion.Split('.'); long tmpNewVer = int.Parse(tmpNew[0]) * 10000000 + int.Parse(tmpNew[1]) * 10000 + int.Parse(tmpNew[2]); string[] tmpOld = GlobalFramework.ServerVersion.ToString().Split('.'); long tmpOldVer = int.Parse(tmpOld[0]) * 10000000 + int.Parse(tmpOld[1]) * 10000 + int.Parse(tmpOld[2]); if (tmpNewVer < tmpOldVer) { needToUpdate = true; } } catch /*(Exception ex)*/ { //log.Error(ex.Message, ex); } if (needToUpdate) { if (GlobalFramework.AppUseBackOfficeMode) { if (GlobalApp.boScreenSize.Height <= 800) { _labelUpdate = new Label(string.Format(string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_new_version"), GlobalFramework.ServerVersion.ToString()))); _labelUpdate.ModifyFont(fontDescriptionStatusBar); _labelUpdate.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(FrameworkUtils.StringToColor("61, 61, 61"))); _labelUpdate.SetAlignment(1.0F, 0.5F); _fixAccordion.Put(_labelUpdate, 5, GlobalApp.boScreenSize.Height - 165); _fixAccordion.Add(_labelUpdate); _fixAccordion.Put(_NewVersion, 0, GlobalApp.boScreenSize.Height - 140); _fixAccordion.Add(_NewVersion); } else { _labelUpdate = new Label(string.Format(string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_new_version"), GlobalFramework.ServerVersion.ToString()))); _labelUpdate.ModifyFont(fontDescriptionStatusBar); _labelUpdate.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(FrameworkUtils.StringToColor("61, 61, 61"))); _labelUpdate.SetAlignment(1.0F, 0.5F); _fixAccordion.Put(_labelUpdate, 5, GlobalApp.boScreenSize.Height - 200); _fixAccordion.Add(_labelUpdate); _fixAccordion.Put(_NewVersion, 0, GlobalApp.boScreenSize.Height - 175); _fixAccordion.Add(_NewVersion); } } else { if (GlobalApp.boScreenSize.Height <= 800) { _labelUpdate = new Label(string.Format(string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_new_version"), GlobalFramework.ServerVersion.ToString()))); _labelUpdate.ModifyFont(fontDescriptionStatusBar); _labelUpdate.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(FrameworkUtils.StringToColor("61, 61, 61"))); _labelUpdate.SetAlignment(1.0F, 0.5F); _fixAccordion.Put(_labelUpdate, 5, GlobalApp.boScreenSize.Height - 165); _fixAccordion.Add(_labelUpdate); _fixAccordion.Put(_NewVersion, 0, GlobalApp.boScreenSize.Height - 140); _fixAccordion.Add(_NewVersion); } else { _labelUpdate = new Label(string.Format(string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_new_version"), GlobalFramework.ServerVersion.ToString()))); _labelUpdate.ModifyFont(fontDescriptionStatusBar); _labelUpdate.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(FrameworkUtils.StringToColor("61, 61, 61"))); _labelUpdate.SetAlignment(1.0F, 0.5F); _fixAccordion.Put(_labelUpdate, 5, GlobalApp.boScreenSize.Height - 200); _fixAccordion.Add(_labelUpdate); _fixAccordion.Put(_NewVersion, 0, GlobalApp.boScreenSize.Height - 175); _fixAccordion.Add(_NewVersion); } } } } //TK016248 End //Pack hboxContent _hboxContent.PackStart(_fixAccordion, false, false, 0); VBox vboxContent = new VBox(false, 0); eventBoxStatusBar.Add(_hboxStatusBar); vboxContent.PackStart(eventBoxStatusBar, false, false, 0); vboxContent.PackStart(_hboxContent); //vboxContent.PackStart(fixStatusBarBottom, false, false, 0); this.HeightRequest = 50; //Final Pack Add(vboxContent); //Clock StartClock(); }
private void InitUI() { //Init Local Vars uint borderWidth = 5; //Settings _clockFormat = GlobalFramework.Settings["dateTimeFormatStatusBar"]; string fontBackOfficeStatusBar = GlobalFramework.Settings["fontPosStatusBar"]; string fileImageBackOfficeLogo = Utils.GetThemeFileLocation(GlobalFramework.Settings["fileImageBackOfficeLogo"]); //Colors System.Drawing.Color colorBackOfficeContentBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeContentBackground"]); System.Drawing.Color colorBackOfficeStatusBarBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarBackground"]); System.Drawing.Color colorBackOfficeAccordionFixBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeAccordionFixBackground"]); System.Drawing.Color colorBackOfficeStatusBarFont = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarFont"]); System.Drawing.Color colorBackOfficeStatusBarBottomBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorBackOfficeStatusBarBottomBackground"]); ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeContentBackground)); //Icon string fileImageAppIcon = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], SettingsApp.AppIcon)); if (File.Exists(fileImageAppIcon)) { Icon = Utils.ImageToPixbuf(System.Drawing.Image.FromFile(fileImageAppIcon)); } //Start Pack UI //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //StatusBar EventBox eventBoxStatusBar = new EventBox() { HeightRequest = 38 }; eventBoxStatusBar.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarBackground)); //Logo try { _imageLogo = new Image(fileImageBackOfficeLogo); _imageLogo.WidthRequest = _widthAccordion + Convert.ToInt16(borderWidth) * 3; _imageLogo.SetAlignment(0.0F, 0.5F); } catch (Exception ex) { _log.Error(string.Format("InitUI(): Image [{0}] not found: {1}", fileImageBackOfficeLogo, ex.Message), ex); } //Style StatusBarFont Pango.FontDescription fontDescriptionStatusBar = Pango.FontDescription.FromString(fontBackOfficeStatusBar); //Active Content _labelActiveContent = new Label() { WidthRequest = 300 }; _labelActiveContent.ModifyFont(fontDescriptionStatusBar); _labelActiveContent.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelActiveContent.SetAlignment(0.0F, 0.5F); //TerminalInfo : Terminal : User _labelTerminalInfo = new Label(string.Format("{0} : {1}", GlobalFramework.LoggedTerminal.Designation, GlobalFramework.LoggedUser.Name)); _labelTerminalInfo.ModifyFont(fontDescriptionStatusBar); _labelTerminalInfo.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelTerminalInfo.SetAlignment(0.5F, 0.5F); //Clock _labelClock = new Label(FrameworkUtils.CurrentDateTime(_clockFormat)); _labelClock.ModifyFont(fontDescriptionStatusBar); _labelClock.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarFont)); _labelClock.SetAlignment(1.0F, 0.5F); //Pack HBox StatusBar _hboxStatusBar = new HBox(false, 0) { BorderWidth = borderWidth }; _hboxStatusBar.PackStart(_imageLogo, false, false, 0); _hboxStatusBar.PackStart(_labelActiveContent, false, false, 0); _hboxStatusBar.PackStart(_labelTerminalInfo, true, true, 0); //TODO:THEME if (GlobalApp.ScreenSize.Width == 800 && GlobalApp.ScreenSize.Height == 600) { _labelTerminalInfo.SetAlignment(1.0F, 0.5F); } else { _hboxStatusBar.PackStart(_labelClock, false, false, 0); } _imageLogo.Dispose(); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //StatusBar //Fixed fixStatusBarBottom = new Fixed() { HasWindow = true, BorderWidth = borderWidth, HeightRequest = 38 }; //fixStatusBarBottom.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeStatusBarBottomBackground)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Hbox Accordion + Content _hboxContent = new HBox(false, (int)borderWidth) { BorderWidth = borderWidth }; //_accordion = new Accordion() { WidthRequest = _widthAccordion }; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Accordion and HouseFix _fixAccordion = new Fixed() { HasWindow = true, BorderWidth = borderWidth }; _fixAccordion.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorBackOfficeAccordionFixBackground)); //fixAccordion.Add(_accordion); //Pack hboxContent _hboxContent.PackStart(_fixAccordion, false, false, 0); VBox vboxContent = new VBox(false, 0); eventBoxStatusBar.Add(_hboxStatusBar); vboxContent.PackStart(eventBoxStatusBar, false, false, 0); vboxContent.PackStart(_hboxContent); // vboxContent.PackStart(fixStatusBarBottom, false, false, 0); //Final Pack Add(vboxContent); //Clock StartClock(); }