//TK016251 - FrontOffice - Criar novo documento com auto-complete para artigos e clientes private void SelectRecordDropDown(Entry pEntry) { PropertyInfo propertyInfo; //Store previousValue before update _value, to keep it _previousValue = _value; Guid articleOid = Guid.Empty; if (dropdownTextCollection != null && _value != null) { foreach (dynamic item in dropdownTextCollection) { if (_value.ClassInfo.ToString() == "logicpos.datalayer.DataLayer.Xpo.erp_customer") { if (item.Name == pEntry.Text) { articleOid = item.Oid; } } else if (_articleCode) { if (item.Code == pEntry.Text) { articleOid = item.Oid; } } else if (item.Designation == pEntry.Text) { articleOid = item.Oid; } } } if (!articleOid.Equals(Guid.Empty)) { //Get Object from dialog else Mixing Sessions, Both belong to diferente Sessions _value = (T1)FrameworkUtils.GetXPGuidObject(typeof(T1), articleOid); propertyInfo = typeof(T1).GetProperty(_fieldDisplayValue); object value = null; if (propertyInfo != null) { // Get value from XPGuidObject Instance value = propertyInfo.GetValue(_value, null); } else { string invalidFieldMessage = string.Format("Invalid Field DisplayValue:[{0}] on XPGuidObject:[{1}]", _fieldDisplayValue, _value.GetType().Name); _log.Error(invalidFieldMessage); value = invalidFieldMessage; } pEntry.Text = (value != null) ? value.ToString() : resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"); OnClosePopup(); } }
private void InitUI() { //Initial Values FIN_ConfigurationPaymentMethod initialValueConfigurationPaymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), SettingsApp.XpoOidConfigurationPaymentMethodDefaultInvoicePaymentMethod); CFG_ConfigurationCurrency intialValueConfigurationCurrency = SettingsApp.ConfigurationSystemCurrency; string initialPaymentDate = FrameworkUtils.CurrentDateTimeAtomic().ToString(SettingsApp.DateTimeFormat); //ConfigurationPaymentMethod string filterValidPaymentMethod = "(Token = 'CREDIT_CARD' OR Token = 'BANK_CHECK' OR Token = 'MONEY' OR Token = 'BANK_TRANSFER' OR Token = 'CASH_MACHINE' OR Token = 'VISA' OR Token = 'OTHER')"; CriteriaOperator criteriaOperatorConfigurationPaymentMethod = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled <> 1) AND Oid <> '{0}' AND {1}", SettingsApp.XpoOidConfigurationPaymentMethodCurrentAccount.ToString(), filterValidPaymentMethod)); _entryBoxSelectConfigurationPaymentMethod = new XPOEntryBoxSelectRecordValidation <FIN_ConfigurationPaymentMethod, TreeViewConfigurationPaymentMethod>(_sourceWindow, Resx.global_payment_method, "Designation", "Oid", initialValueConfigurationPaymentMethod, criteriaOperatorConfigurationPaymentMethod, SettingsApp.RegexGuid, true); _entryBoxSelectConfigurationPaymentMethod.EntryValidation.Changed += delegate { Validate(); }; _entryBoxSelectConfigurationPaymentMethod.EntryValidation.IsEditable = false; //ConfigurationCurrency CriteriaOperator criteriaOperatorConfigurationCurrency = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled <> 1) AND (ExchangeRate IS NOT NULL OR Oid = '{0}')", SettingsApp.ConfigurationSystemCurrency.Oid.ToString())); _entryBoxSelectConfigurationCurrency = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCurrency, TreeViewConfigurationCurrency>(_sourceWindow, Resx.global_currency, "Designation", "Oid", intialValueConfigurationCurrency, criteriaOperatorConfigurationCurrency, SettingsApp.RegexGuid, false); _entryBoxSelectConfigurationCurrency.EntryValidation.Changed += _entryBoxSelectConfigurationCurrency_Changed; _entryBoxSelectConfigurationCurrency.EntryValidation.IsEditable = false; //PaymentAmount _entryPaymentAmount = new EntryBoxValidation(_sourceWindow, Resx.global_total_deliver, KeyboardMode.Numeric, SettingsApp.RegexDecimalGreaterEqualThanZero, true); _entryPaymentAmount.EntryValidation.Text = FrameworkUtils.DecimalToString(_paymentAmountTotal); _entryPaymentAmount.EntryValidation.Validate(); _entryPaymentAmount.EntryValidation.Changed += delegate { Validate(); UpdateTitleBar(); }; //PaymentDate _entryBoxPaymentDate = new EntryBoxValidation(_sourceWindow, Resx.global_date, KeyboardMode.Alfa, SettingsApp.RegexDateTime, true); _entryBoxPaymentDate.EntryValidation.Text = initialPaymentDate; _entryBoxPaymentDate.EntryValidation.Validate(); _entryBoxPaymentDate.EntryValidation.Changed += delegate { Validate(); }; //PaymentNotes _entryBoxDocumentPaymentNotes = new EntryBoxValidation(_sourceWindow, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxDocumentPaymentNotes.EntryValidation.Changed += delegate { Validate(); }; //Pack VBOX VBox vbox = new VBox(false, 0); vbox.PackStart(_entryBoxSelectConfigurationPaymentMethod, true, true, 0); vbox.PackStart(_entryBoxSelectConfigurationCurrency, false, false, 0); vbox.PackStart(_entryPaymentAmount, false, false, 0); vbox.PackStart(_entryBoxPaymentDate, false, false, 0); vbox.PackStart(_entryBoxDocumentPaymentNotes, false, false, 0); vbox.PackStart(_entryBoxDocumentPaymentNotes, false, false, 0); vbox.WidthRequest = _windowSize.Width - 14; //Put in FinishContent _fixedContent = new Fixed(); _fixedContent.Put(vbox, 0, 0); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYears), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYears), "Code"); int currentYear = FrameworkUtils.CurrentDateTimeAtomic().Year; FiscalYear = currentYear; Acronym = string.Format("{0}{1}{2}", FiscalYear, "A", Code / 10); Designation = string.Format("{0} {1} {2}{3}", Resx.global_fiscal_year, FiscalYear, "A", Code / 10); }
public DocumentFinanceDialogPagePad(Window pSourceWindow) { //Parameters _sourceWindow = pSourceWindow; //Init Private Vars _session = GlobalFramework.SessionXpo; //Init Other _dateTimeFormat = SettingsApp.DateTimeFormat; _initalDateTime = FrameworkUtils.CurrentDateTimeAtomic(); }
public void ShowOrder(string pArticle, decimal pQuantity, decimal pPrice, decimal pTotal) { string article = string.Format("{0} x {1}", FrameworkUtils.DecimalToString(pQuantity), pArticle); //string price = string.Format("{0}", FrameworkUtils.DecimalToString(pPrice)); //string line1 = TextJustified(article, price, Convert.ToInt16(_charactersPerLine)); Write(article, 1); WriteJustified(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total"), FrameworkUtils.DecimalToString(pTotal), 2); EnableStandBy(); }
//BarCode void _buttonKeyBarCode_Clicked(object sender, EventArgs e) { string fileWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_input_text_barcode.png"); logicpos.Utils.ResponseText dialogResponse = Utils.GetInputText(_sourceWindow, DialogFlags.Modal, fileWindowIcon, Resx.global_barcode, string.Empty, SettingsApp.RegexInteger, true); if (dialogResponse.ResponseType == ResponseType.Ok) { InsertOrUpdate(dialogResponse.Text); } }
public GlobalFrameworkSession(String pFile) { //Init Parameters _file = pFile; //Default _currentOrderMainOid = Guid.Empty; _sessionDateStart = FrameworkUtils.CurrentDateTimeAtomic(); _loggedUsers = new Dictionary <Guid, DateTime>(); _ordersMain = new Dictionary <Guid, OrderMain>(); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinanceyears), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinanceyears), "Code"); int currentYear = FrameworkUtils.CurrentDateTimeAtomic().Year; FiscalYear = currentYear; Acronym = string.Format("{0}{1}{2}", FiscalYear, "A", Code / 10); Designation = string.Format("{0} {1} {2}{3}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_year"), FiscalYear, "A", Code / 10); }
public void ShowOrder(string pArticle, decimal pQuantity, decimal pPrice, decimal pTotal) { string article = string.Format("{0} x {1}", FrameworkUtils.DecimalToString(pQuantity), pArticle); //string price = string.Format("{0}", FrameworkUtils.DecimalToString(pPrice)); //string line1 = TextJustified(article, price, Convert.ToInt16(_charactersPerLine)); Write(article, 1); WriteJustified(Resx.global_total, FrameworkUtils.DecimalToString(pTotal), 2); EnableStandBy(); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplacemovementtype), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplacemovementtype), "Code"); //In Retail Mode VatDirectSelling is always true; if (SettingsApp.AppMode == AppOperationMode.Retail) { VatDirectSelling = true; } }
public PosInputTextDialog(Window pSourceWindow, DialogFlags pDialogFlags, Size pSize, string pWindowTitle, string pWindowIcon, string pEntryLabel, string pInitialValue, KeyboardMode pKeyboardMode, string pRule, bool pRequired) : base(pSourceWindow, pDialogFlags) { //Init Local Vars String windowTitle = pWindowTitle; Size windowSize = pSize; if (!File.Exists(pWindowIcon)) { pWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_system.png"); } //Always assign pInitialValue to Dialog.Value _value = pInitialValue; //Entry _entryBoxValidation = new EntryBoxValidation(this, pEntryLabel, pKeyboardMode, pRule, pRequired); if (pInitialValue != string.Empty) { _entryBoxValidation.EntryValidation.Text = pInitialValue; } //VBox _vbox = new VBox(false, 0) { WidthRequest = windowSize.Width - 12 }; _vbox.PackStart(_entryBoxValidation, false, false, 0); //Init Content Fixed fixedContent = new Fixed(); fixedContent.Put(_vbox, 0, 0); //ActionArea Buttons TouchButtonIconWithText buttonOk = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok); TouchButtonIconWithText buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel); buttonOk.Sensitive = _entryBoxValidation.EntryValidation.Validated; //After Button Construction _entryBoxValidation.EntryValidation.Changed += delegate { _value = _entryBoxValidation.EntryValidation.Text; buttonOk.Sensitive = _entryBoxValidation.EntryValidation.Validated; }; //ActionArea ActionAreaButtons actionAreaButtons = new ActionAreaButtons(); actionAreaButtons.Add(new ActionAreaButton(buttonOk, ResponseType.Ok)); actionAreaButtons.Add(new ActionAreaButton(buttonCancel, ResponseType.Cancel)); //Init Object this.InitObject(this, pDialogFlags, pWindowIcon, windowTitle, windowSize, fixedContent, actionAreaButtons); }
private DataTable GetDataTable(List <GenericTreeViewColumnProperty> pColumnProperties) { //Init Local Vars DataTable resultDataTable = new DataTable(); Type dataTableColumnType; FIN_Article article; OrderMain orderMain = GlobalFramework.SessionApp.OrdersMain[GlobalFramework.SessionApp.CurrentOrderMainOid]; ArticleBag articleBag = ArticleBag.TicketOrderToArticleBag(orderMain); POS_ConfigurationPlace configurationPlace; //Add Columns with specific Types From Column Properties foreach (GenericTreeViewColumnProperty column in pColumnProperties) { dataTableColumnType = (column.Type != null) ? column.Type : typeof(String); resultDataTable.Columns.Add(column.Name, dataTableColumnType); } //Init DataRow System.Object[] dataRow = new System.Object[pColumnProperties.Count]; //Start Loop foreach (var item in articleBag) { article = (FIN_Article)FrameworkUtils.GetXPGuidObject(typeof(FIN_Article), item.Key.ArticleOid); if (article.Type.HavePrice) { configurationPlace = (POS_ConfigurationPlace)FrameworkUtils.GetXPGuidObject(typeof(POS_ConfigurationPlace), item.Value.PlaceOid); for (int i = 0; i < item.Value.Quantity; i++) { //Column Fields dataRow[0] = item.Key.ArticleOid; dataRow[1] = item.Value.Code; dataRow[2] = item.Key.Designation; dataRow[3] = item.Value.PriceFinal; dataRow[4] = item.Key.Vat; dataRow[5] = item.Key.Discount; dataRow[6] = configurationPlace.Designation; dataRow[7] = item.Key.Price; dataRow[8] = 1; dataRow[9] = item.Value.UnitMeasure; dataRow[10] = item.Value.PlaceOid; dataRow[11] = item.Value.TableOid; dataRow[12] = item.Value.PriceType; dataRow[13] = item.Value.Token1; dataRow[14] = item.Value.Token2; dataRow[15] = string.Empty; //Add Row resultDataTable.Rows.Add(dataRow); } } } return(resultDataTable); }
private static string GetFilePath(RestoreWindowSettings settings, Window window) { if (!string.IsNullOrWhiteSpace(settings.FilePath)) { return(settings.FilePath); } string windowName = window.GetType().FullName; return(FrameworkUtils.GetFullPathToExe(windowName.Replace('.', '_') + ".xml")); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Event Handlers void _entry_Changed(object sender, EventArgs e) { EntryValidation entry = (EntryValidation)sender; _validated = entry.Validated; _deliveryValue = FrameworkUtils.StringToDecimal(_entryDeliveryValue.Text); if (EntryChanged != null) { EntryChanged(sender, e); } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Helper Functions private void AddMoney(decimal pAmount) { if (_moneyPadMode != MoneyPadMode.Money) { _deliveryValue = 0.0m; _moneyPadMode = MoneyPadMode.Money; } _deliveryValue += pAmount; _entryDeliveryValue.Text = FrameworkUtils.DecimalToString(_deliveryValue); }
public BOBaseDialog(Window pSourceWindow, GenericTreeViewXPO pTreeView, DialogFlags pFlags, DialogMode pDialogMode, XPGuidObject pDataSourceRow) : base("", pSourceWindow, pFlags) { //Parameters _treeView = pTreeView; _dialogMode = pDialogMode; _dataSourceRow = pDataSourceRow; //TODO: try to prevent NULL Error //_dataSourceRow = GlobalFramework.SessionXpo.GetObjectByKey<XPGuidObject>(_dataSourceRow.Oid); //TODO: Validar se o erro de editar dá erro de acesso objecto eliminado. //APPEAR when we Try to ReEdit Terminal, after assign Printer //An exception of type 'System.NullReferenceException' occurred in logicpos.exe but was not handled in user code _dataSourceRow.Reload(); //Defaults //Modal = true; //< Problems in Ubuntu, TitleBar Disapear WindowPosition = WindowPosition.CenterAlways; GrabFocus(); SetSize(400, 400); _widgetMaxWidth = WidthRequest - (_dialogPadding * 2) - 16; //Grey Window : Luis|Muga //this.Decorated = false; //White Window : Mario this.Decorated = true; this.Resizable = false; this.WindowPosition = WindowPosition.Center; //Grey Window : Luis|Muga //this.ModifyBg(StateType.Normal, Utils.StringToGTKColor(GlobalFramework.Settings["colorBackOfficeContentBackground"])); //Accelerators AccelGroup accelGroup = new AccelGroup(); AddAccelGroup(accelGroup); //Init WidgetList _crudWidgetList = new GenericCRUDWidgetListXPO(_dataSourceRow.Session); //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)); } //Init StatusBar InitStatusBar(); //InitButtons InitButtons(); //InitUi InitUI(); }
void buttonPrintOrder_Clicked(object sender, EventArgs e) { if (Utils.ShowMessageTouchRequiredValidPrinter(this)) { return; } string sql = string.Empty; OrderMain currentOrderMain = GlobalFramework.SessionApp.OrdersMain[GlobalFramework.SessionApp.CurrentOrderMainOid]; Guid orderTicketOid = new Guid(); sql = string.Format(@"SELECT COUNT(*) AS Count FROM fin_documentorderticket WHERE OrderMain = '{0}';", currentOrderMain.PersistentOid); var countTickets = GlobalFramework.SessionXpo.ExecuteScalar(sql); //If has more than one ticket show requestTicket dialog if (countTickets != null && Convert.ToInt16(countTickets) > 1) { CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("OrderMain = '{0}'", currentOrderMain.PersistentOid)); PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewDocumentOrderTicket> dialog = new PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewDocumentOrderTicket>( this.SourceWindow, DialogFlags.DestroyWithParent, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_select_ticket"), //TODO:THEME GlobalApp.MaxWindowSize, null, //XpoDefaultValue criteria, GenericTreeViewMode.Default, null //pActionAreaButtons ); int response = dialog.Run(); if (response == (int)ResponseType.Ok) { orderTicketOid = dialog.GenericTreeView.DataSourceRow.Oid; } dialog.Destroy(); } //Else Print Unique Ticket else { sql = string.Format(@"SELECT Oid FROM fin_documentorderticket WHERE OrderMain = '{0}';", currentOrderMain.PersistentOid); //_log.Debug(string.Format("sql: [{0}]", sql)); orderTicketOid = FrameworkUtils.GetGuidFromQuery(sql); } if (orderTicketOid != new Guid()) { fin_documentorderticket orderTicket = (fin_documentorderticket)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentorderticket), orderTicketOid); //POS front-end - Consulta Mesa + Impressão Ticket's + Gerar PDF em modo Thermal Printer [IN009344] ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(GlobalFramework.LoggedTerminal.ThermalPrinter, orderTicket); thermalPrinterInternalDocumentOrderRequest.Print(); } }
void EntryValidation_Changed(object sender, EventArgs e) { if (_maxLength > 0 || _maxWords > 0) { ValidateMaxLenghtMaxWordsResult result = FrameworkUtils.ValidateMaxLenghtMaxWords(Text, _initialLabelText, _maxLength, _maxWords); Text = result.Text; Label.Text = result.LabelText; _length = result.Length; _words = result.Words; } }
void _entryBoxSelectConfigurationCurrency_Changed(object sender, EventArgs e) { //Update ExchangeRate Reference _exchangeRate = _entryBoxSelectConfigurationCurrency.Value.ExchangeRate; //Always Update Entry Value too paymentAmountTotal to prevent round values, this way when we change currency, we always assign to default paymentAmountTotal value _entryPaymentAmount.EntryValidation.Text = FrameworkUtils.DecimalToString(_paymentAmountTotal * _exchangeRate); //Call Validate Validate(); //Call Update Title Bar UpdateTitleBar(); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPoleDisplay), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPoleDisplay), "Code"); VID = "0x0000"; PID = "0x0000"; EndPoint = "Ep01"; CodeTable = "0x10"; DisplayCharactersPerLine = 20; GoToStandByInSeconds = 60; }
public void Init(List <PagePadPage> pPages) { string fontPagePadNavigatorButton = GlobalFramework.Settings["fontPagePadNavigatorButton"]; Size sizePagesPadNavigatorButton = Utils.StringToSize(GlobalFramework.Settings["sizePagesPadNavigatorButton"]); Size sizePagesPadNavigatorButtonIcon = Utils.StringToSize(GlobalFramework.Settings["sizePagesPadNavigatorButtonIcon"]); string iconPrev = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/icon_pos_pagepad_prev.png")); string iconNext = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/icon_pos_pagepad_next.png")); //Parameters _pages = pPages; HBox navigatorButtons = new HBox(true, 0); _buttonPrev = new TouchButtonIconWithText("buttonPrev", _colorPagePadHotButtonBackground, Resx.pos_button_label_prev_pages_toolbar, fontPagePadNavigatorButton, Color.White, iconPrev, sizePagesPadNavigatorButtonIcon, sizePagesPadNavigatorButton.Width, sizePagesPadNavigatorButton.Height) { Sensitive = false }; _buttonNext = new TouchButtonIconWithText("buttonNext", _colorPagePadHotButtonBackground, Resx.pos_button_label_next_pages_toolbar, fontPagePadNavigatorButton, Color.White, iconNext, sizePagesPadNavigatorButtonIcon, sizePagesPadNavigatorButton.Width, sizePagesPadNavigatorButton.Height); //Events _buttonPrev.Clicked += buttonPrev_Clicked; _buttonNext.Clicked += buttonNext_Clicked; //Render/Pack Navigator Buttons int i = 0; foreach (PagePadPage page in _pages) { i++; page.NavigatorButton = new TouchButtonIconWithText(page.PageName, Color.Transparent, page.PageName, fontPagePadNavigatorButton, Color.White, page.PageIcon, sizePagesPadNavigatorButtonIcon, 0, sizePagesPadNavigatorButton.Height); // Start Active Pad Button page.NavigatorButton.Sensitive = (i == 1) ? true : false; // Change color of current Button if ((i == 1)) { page.NavigatorButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(_colorPagePadHotButtonBackground)); } // Pack navigatorButtons.PackStart(page.NavigatorButton, true, true, 2); } //Final Navigator _navigator = new HBox(false, 0); _navigator.PackStart(_buttonPrev, false, false, 2); _navigator.PackStart(navigatorButtons, true, true, 2); _navigator.PackStart(_buttonNext, false, false, 2); //Pack Page Navigator PackStart(_navigator, false, false, 2); //Add ActivePage _activePage = pPages[0]; PackStart(_activePage); }
//Update TreeView TotalFinal, used when we change Customer Discount, this way we update Total Final for all Articles in TreeView public void UpdateTotalFinal() { bool debug = false; try { if (_treeViewArticles.DataSource.Rows.Count > 0) { FIN_Article article; //Get Discount from Select Customer decimal discountGlobal = FrameworkUtils.StringToDecimal(_pagePad2.EntryBoxCustomerDiscount.EntryValidation.Text); decimal exchangeRate = _pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate; //Update DataTable Rows foreach (DataRow item in _treeViewArticles.DataSource.Rows) { article = (FIN_Article)FrameworkUtils.GetXPGuidObject(typeof(FIN_Article), new Guid(item.ItemArray[item.Table.Columns["Oid"].Ordinal].ToString())); //Calc PriceProperties PriceProperties priceProperties = PriceProperties.GetPriceProperties( PricePropertiesSourceMode.FromPriceNet, false, //PriceWithVat Convert.ToDecimal(item.ItemArray[item.Table.Columns["Price"].Ordinal]), //Price Convert.ToDecimal(item.ItemArray[item.Table.Columns["Quantity"].Ordinal]), //Quantity Convert.ToDecimal(item.ItemArray[item.Table.Columns["Discount"].Ordinal]), //Discount discountGlobal, (item.ItemArray[item.Table.Columns["ConfigurationVatRate.Value"].Ordinal] as FIN_ConfigurationVatRate).Value //VatValue ); //Finnally Update DataSourceRow Value with calculated PriceProperties if (debug) { _log.Debug(string.Format("#1:TotalFinal DataSourceRow: [{0}], discountGlobal: [{1}]", FrameworkUtils.DecimalToString(Convert.ToDecimal(_treeViewArticles.DataSourceRow["TotalFinal"])), FrameworkUtils.DecimalToString(discountGlobal))); } //Update Display Values with ExchangeRate Multiplier item["PriceDisplay"] = priceProperties.PriceNet * exchangeRate; item["TotalNet"] = (priceProperties.TotalNet * exchangeRate); item["TotalFinal"] = priceProperties.TotalFinal * exchangeRate; item["PriceFinal"] = priceProperties.PriceFinal * exchangeRate; if (debug) { _log.Debug(string.Format("#2:TotalFinal DataSourceRow: [{0}], discountGlobal: [{1}]", FrameworkUtils.DecimalToString(Convert.ToDecimal(_treeViewArticles.DataSourceRow["TotalFinal"])), FrameworkUtils.DecimalToString(discountGlobal))); } } //Call Refresh, Recreate TreeView from Model _treeViewArticles.Refresh(); } } catch (Exception ex) { _log.Error(ex.Message, ex); } }
public void CreateModel(XPCollection pXpCollection, XPGuidObject pCurrentValue) { //Local Variables TreeIter tempItemIter; TreeIter currentItemIter = new TreeIter(); //Parameters _XpCollection = pXpCollection; //Add Default Sorting Order, if Not Assigned by Parameter if (_XpCollection.Sorting.Count == 0) { _XpCollection.Sorting = FrameworkUtils.GetXPCollectionDefaultSortingCollection(); } //Store TreeIters in Dictionary _treeInterDictionary = new Dictionary <Guid, TreeIter>(); //Init ListStore Model _comboBoxListStore = new ListStore(typeof(string), typeof(XPGuidObject)); //Aways Default to Null Value - Undefined, even if Collection is Empty tempItemIter = _comboBoxListStore.AppendValues(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "widget_combobox_undefined"), null); _treeInterDictionary.Add(new Guid(), tempItemIter); //Default Selected currentItemIter = tempItemIter; //Start Processing Collection if (_XpCollection.Count > 0) { //Create Model foreach (XPGuidObject item in _XpCollection) { //Console.WriteLine("fieldLabel: {0}, fieldValue: {1} fieldValue.Oid: {2}", _fieldLabel, item.GetMemberValue(_fieldLabel), item.Oid); tempItemIter = _comboBoxListStore.AppendValues(item.GetMemberValue(_fieldLabel), item); _treeInterDictionary.Add(new Guid(Convert.ToString(item.GetMemberValue("Oid"))), tempItemIter); //Detected Current/Selected Value if (pCurrentValue != null && pCurrentValue == item) { currentItemIter = tempItemIter; //Always assign Active Value (XPGuidObject) to Value Property Value = item; } ; } ; } ; //Always Update Model and ActiveIter, even is Collection is Empty, example it always have Null Default Value in Model Model = _comboBoxListStore; SetActiveIter(currentItemIter); }
//5.3: FT: Cancel Invoice void buttonCancelInvoice_Clicked(object sender, EventArgs e) { string dateTimeFormatCombinedDateTime = SettingsApp.DateTimeFormatCombinedDateTime; Guid documentMasterGuid = new Guid("81fcf207-ff59-4971-90cb-80d2cbdb87dc");//Document To Cancel fin_documentfinancemaster documentFinanceMaster = (fin_documentfinancemaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentfinancemaster), documentMasterGuid); //Cancel Document documentFinanceMaster.DocumentStatusStatus = "A"; documentFinanceMaster.DocumentStatusDate = FrameworkUtils.CurrentDateTimeAtomic().ToString(dateTimeFormatCombinedDateTime); documentFinanceMaster.DocumentStatusReason = "Erro ao Inserir Artigos"; documentFinanceMaster.Save(); }
protected override void OnAfterConstruction() { // Init EncryptedAttributes - Load Encrypted Attributes Fields if Exist - Required for New Records to have InitEncryptedAttributes else it Triggers Exception on Save InitEncryptedAttributes <SYS_UserDetail>(); Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_UserDetail), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_UserDetail), "Code"); //Required for New Users AccessPin = CryptographyUtils.SaltedString.GenerateSaltedString(SettingsApp.DefaultValueUserDetailAccessPin); PasswordReset = true; ButtonImage = string.Format("{0}{1}", GlobalFramework.Path["assets"], SettingsApp.DefaultValueUserDetailButtonImage); }
private static BitmapImage LoadPicture(string fileName) { try { string path = FrameworkUtils.GetFullPathToExe(fileName); return(new BitmapImage(new Uri(path))); } catch { return(new BitmapImage()); } }
private static DataBaseBackupFileInfo GetSelectRecordFileName(Window pSourceWindow) { DataBaseBackupFileInfo resultFileInfo = new DataBaseBackupFileInfo(); try { CriteriaOperator criteriaOperator = CriteriaOperator.Parse(string.Format("DataBaseType = '{0}' && FileName IS NOT NULL", GlobalFramework.DatabaseType)); PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewSystemBackup> dialogSystemBackup = new PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewSystemBackup>( pSourceWindow, Gtk.DialogFlags.DestroyWithParent, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_select_backup_filename"), new Size(780, 580), null, //XpoDefaultValue criteriaOperator, GenericTreeViewMode.Default, null //ActionAreaButtons ); ResponseType response = (ResponseType)dialogSystemBackup.Run(); if (response == ResponseType.Ok) { //Assign Result resultFileInfo.Response = response; sys_systembackup systemBackup = (sys_systembackup)dialogSystemBackup.GenericTreeView.DataSourceRow; if (systemBackup != null) { if (GlobalFramework.DatabaseType == DatabaseType.MSSqlServer) { resultFileInfo.FileName = systemBackup.FileName; resultFileInfo.FileHashValid = true; } else { resultFileInfo.FileName = FrameworkUtils.OSSlash(string.Format(@"{0}{1}", _pathBackups, systemBackup.FileName)); resultFileInfo.FileNamePacked = FrameworkUtils.OSSlash(string.Format(@"{0}{1}", _pathBackups, systemBackup.FileNamePacked)); resultFileInfo.FileHashDB = systemBackup.FileHash; resultFileInfo.FileHashFile = FrameworkUtils.MD5HashFile(resultFileInfo.FileNamePacked); } } } dialogSystemBackup.Destroy(); } catch (Exception ex) { _log.Error(ex.Message, ex); } return(resultFileInfo); }
//Overload : Default Dates Start: 1st Day of Month, End Last Day Of Month public PosDatePickerStartEndDateDialog(Window pSourceWindow, DialogFlags pDialogFlags) : base(pSourceWindow, pDialogFlags) { //pastMonths=0 to Work in Curent Month Range, pastMonths=1 Works in Past Month, pastMonths=2 Two months Ago etc int pastMonths = 1; DateTime workingDate = FrameworkUtils.CurrentDateTimeAtomic().AddMonths(-pastMonths); DateTime firstDayOfMonth = new DateTime(workingDate.Year, workingDate.Month, 1); DateTime lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); DateTime dateTimeStart = firstDayOfMonth; DateTime dateTimeEnd = lastDayOfMonth.AddHours(23).AddMinutes(59).AddSeconds(59); InitUI(pDialogFlags, dateTimeStart, dateTimeEnd); }
private void InitUI(DialogFlags pDialogFlags, DateTime pDateStart, DateTime pDateEnd) { //Parameters _dateStart = pDateStart; _dateEnd = pDateEnd; //Init Local Vars String windowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_datepicket_startend"); Size windowSize = new Size(300, 255); String fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_date_picker.png"); //Init Content _fixedContent = new Fixed(); //Init DateEntry Start _entryBoxDateStart = new EntryBoxValidationDatePickerDialog(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_date_start"), _dateStart, SettingsApp.RegexDate, true); _entryBoxDateStart.EntryValidation.Text = _dateStart.ToString(SettingsApp.DateFormat); _entryBoxDateStart.EntryValidation.Validate(); _entryBoxDateStart.ClosePopup += entryBoxDateStart_ClosePopup; //Init DateEntry End _entryBoxDateEnd = new EntryBoxValidationDatePickerDialog(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_date_end"), _dateEnd, SettingsApp.RegexDate, true); _entryBoxDateEnd.EntryValidation.Text = _dateEnd.ToString(SettingsApp.DateFormat); _entryBoxDateEnd.EntryValidation.Validate(); _entryBoxDateEnd.ClosePopup += entryBoxDateEnd_ClosePopup; VBox vbox = new VBox(true, 0) { WidthRequest = 290 }; vbox.PackStart(_entryBoxDateStart, true, true, 2); vbox.PackStart(_entryBoxDateEnd, true, true, 2); _fixedContent.Put(vbox, 0, 0); //ActionArea Buttons _buttonOk = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok); _buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel); //ActionArea ActionAreaButtons actionAreaButtons = new ActionAreaButtons(); actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok)); actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel)); //Start Validated Validate(); //Init Object this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, _fixedContent, actionAreaButtons); }
/// <summary> /// Process all scripts in target directory /// </summary> /// <param name="Session"></param> /// <param name="DatabaseType"></param> /// <param name="CommandSeparator"></param> /// <param name="TargetDirectory"></param> /// <returns></returns> /// public static bool ProcessDumpDirectory(Session pXpoSession, string pTargetDirectory, string pCommandSeparator, Dictionary <string, string> pReplaceables) { //Log4Net log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Start True bool result = true; string[] filesArray = null; //Ignores files if List <string> ignoreFilesForDeveloper = new List <string>(); if (Debugger.IsAttached == true) { //IgnoreClean Preference Parameter ignoreFilesForDeveloper.Add(@"Resources/Database/Other/configurationpreferenceparameter.sql"); } try { if (Directory.Exists(pTargetDirectory)) { filesArray = Directory.GetFiles(pTargetDirectory, "*.sql"); } //Process Files if (filesArray != null && filesArray.Length > 0) { for (int i = 0; i < filesArray.Length; i++) { if (result) { //Ignore File if is in ignoreFilesForDeveloper List if (!ignoreFilesForDeveloper.Contains(filesArray[i])) { result = ProcessDump(pXpoSession, FrameworkUtils.OSSlash(filesArray[i]), pCommandSeparator, pReplaceables); } } } } ; } catch (Exception ex) { log.Error(ex.Message, ex); } return(result); }