void buttonPrintInvoiceJohnDoe2_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice; Guid customerGuid = new Guid("f5a382bb-f826-40d8-8910-cfb18df8a41e");//John Doe2 //Article Guid article1Guid = new Guid("32deb30d-ffa2-45e4-bca6-03569b9e8b08"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 8.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintTransportationGuideWithoutTotals_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = new Guid("96bcf534-0dab-48bb-a69e-166e81ae6f7b"); Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); //Article Guid article1Guid = new Guid("55892c3f-de10-4076-afde-619c54100c9b"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 48.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, ExchangeRate = 0.0m }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceJohnDoe1_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice; Guid customerGuid = new Guid("d8ce6455-e1a4-41dc-a475-223c00de3a91");//John Doe1 //Article Guid article1Guid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceExchangeRate_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); Guid currencyGuid = new Guid("28d692ad-0083-11e4-96ce-00ff2353398c"); CFG_ConfigurationCurrency currency = (CFG_ConfigurationCurrency)GlobalFramework.SessionXpo.GetObjectByKey(typeof(CFG_ConfigurationCurrency), currencyGuid); //Article:Line1 Guid article1Guid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Article:Line2 Guid article2Guid = new Guid("78638720-e728-4e96-8643-6d6267ff817b"); FIN_Article article2 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article2Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 100.0m); articleBag.Add(article2, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, Currency = currencyGuid, ExchangeRate = currency.ExchangeRate }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
public void Add(FIN_Article pArticle, Guid pPlaceOid, Guid pTableOid, PriceType pPriceType, decimal pQuantity, FIN_ConfigurationVatExemptionReason pVatExemptionReason) { ArticleBagKey articleBagKey; ArticleBagProperties articleBagProps; //Get Place Object to extract TaxSellType Normal|TakeWay POS_ConfigurationPlace configurationPlace = (POS_ConfigurationPlace)GlobalFramework.SessionXpo.GetObjectByKey(typeof(POS_ConfigurationPlace), pPlaceOid); TaxSellType taxSellType = (configurationPlace.MovementType.VatDirectSelling) ? TaxSellType.TakeAway : TaxSellType.Normal; PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(pArticle, taxSellType); //Prepare articleBag Key and Props articleBagKey = new ArticleBagKey( pArticle.Oid, pArticle.Designation, priceProperties.PriceNet, priceProperties.DiscountArticle, priceProperties.Vat, pVatExemptionReason.Oid ); articleBagProps = new ArticleBagProperties( pPlaceOid, pTableOid, pPriceType, pArticle.Code, pQuantity, pArticle.UnitMeasure.Acronym ); //Send to Bag Add(articleBagKey, articleBagProps); }
public void Insert(Guid pArticleId, decimal pQuantity, TaxSellType pTaxSellType) { FIN_Article article = (FIN_Article)FrameworkUtils.GetXPGuidObject(typeof(FIN_Article), pArticleId); PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(article, pTaxSellType); priceProperties.Quantity = pQuantity; Insert(article.Oid, article.Designation, priceProperties); }
public ProcessArticleStockParameter(ERP_Customer pCustomer, DateTime pDocumentDate, string pDocumentNumber, FIN_Article pArticle, decimal pQuantity, string pNotes) { _customer = pCustomer; _documentDate = pDocumentDate; _documentNumber = pDocumentNumber; _article = pArticle; _quantity = pQuantity; _notes = pNotes; }
//FT: Vats void buttonPrintInvoiceVat_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); Guid vatExemptionReasonGuid = new Guid("8311ce58-50ee-4115-9cf9-dbca86538fdd"); FIN_ConfigurationVatExemptionReason vatExemptionReason = (FIN_ConfigurationVatExemptionReason)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationVatExemptionReason), vatExemptionReasonGuid); //Article:Line1 Guid articleREDGuid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); FIN_Article articleRED = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), articleREDGuid); //Article:Line2 Guid articleISEGuid = new Guid("78638720-e728-4e96-8643-6d6267ff817b"); FIN_Article articleISE = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), articleISEGuid); //Article:Line3 Guid articleINTGuid = new Guid("bf99351b-1556-43c4-a85c-90082fb02d05"); FIN_Article articleINT = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), articleINTGuid); //Article:Line4 Guid articleNORGuid = new Guid("6b547918-769e-4f5b-bcd6-01af54846f73"); FIN_Article articleNOR = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), articleNORGuid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(articleRED, placeGuid, tableGuid, PriceType.Price1, 1.0m); articleBag.Add(articleISE, placeGuid, tableGuid, PriceType.Price1, 1.0m, vatExemptionReason); articleBag.Add(articleINT, placeGuid, tableGuid, PriceType.Price1, 1.0m); articleBag.Add(articleNOR, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void _entryBoxSelectArticle_ClosePopup(object sender, EventArgs e) { //Prepare Objects FIN_Article article = _entryBoxSelectArticle.Value; FIN_ConfigurationPriceType configurationPriceTypeDefault = (FIN_ConfigurationPriceType)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationPriceType), SettingsApp.XpoOidConfigurationPriceTypeDefault); //Get PriceType from Customer.PriceType or from default if a New Customer or a Customer without PriceType Defined in BackOffice, always revert to Price1 PriceType priceType = (_customer != null) ? (PriceType)_customer.PriceType.EnumValue : (PriceType)configurationPriceTypeDefault.EnumValue ; //Common changes for MediaNova | Non-MediaNova Articles | Here Prices are always in Retail Mode PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(article, priceType, TaxSellType.Normal); //Price _articlePrice = priceProperties.PriceNet; //Display Price _entryBoxValidationPrice.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice); _entryBoxValidationPriceDisplay.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice * _currencyDisplay.ExchangeRate); _entryBoxValidationQuantity.EntryValidation.Text = (article.DefaultQuantity > 0) ? FrameworkUtils.DecimalToString(article.DefaultQuantity) : FrameworkUtils.DecimalToString(1.0m); _entryBoxValidationDiscount.EntryValidation.Text = FrameworkUtils.DecimalToString(article.Discount); //VatRate _entryBoxSelectVatRate.Value = article.VatDirectSelling; _entryBoxSelectVatRate.Entry.Text = article.VatDirectSelling.Designation; //Default Vat Exception Reason if (article.VatExemptionReason != null) { _entryBoxSelectVatExemptionReason.Value = article.VatExemptionReason; _entryBoxSelectVatExemptionReason.Entry.Text = article.VatExemptionReason.Designation; } //Toggle ToggleVatExemptionReasonEditMode Validation ToggleVatExemptionReasonEditMode(); //Update Price Properties UpdatePriceProperties(); }
public DocumentFinanceDialogPage3(Window pSourceWindow, String pPageName, String pPageIcon, Widget pWidget, bool pEnabled = true) : base(pSourceWindow, pPageName, pPageIcon, pWidget, pEnabled) { //Init private vars _pagePad = (_sourceWindow as PosDocumentFinanceDialog).PagePad; _session = (_pagePad as DocumentFinanceDialogPagePad).Session; _posDocumentFinanceDialog = (_sourceWindow as PosDocumentFinanceDialog); //Init Tree _treeViewArticles = new TreeViewDocumentFinanceArticle( pSourceWindow, null, //DefaultValue null, //DialogType GenericTreeViewMode.Default, GenericTreeViewNavigatorMode.Default ); //Settings string fontGenericTreeViewFinanceDocumentArticleColumnTitle = GlobalFramework.Settings["fontGenericTreeViewFinanceDocumentArticleColumnTitle"]; string fontGenericTreeViewFinanceDocumentArticleColumn = GlobalFramework.Settings["fontGenericTreeViewFinanceDocumentArticleColumn"]; //Format Columns FontSizes for Touch _treeViewArticles.FormatColumnPropertiesForTouch(fontGenericTreeViewFinanceDocumentArticleColumnTitle, fontGenericTreeViewFinanceDocumentArticleColumn); //Disable View Button _treeViewArticles.Navigator.ButtonView.Sensitive = false; PackStart(_treeViewArticles); //Events _treeViewArticles.RecordAfterInsert += delegate { //FORCE Assign FriendlyId to Designation FIN_Article article = (_treeViewArticles.DataSourceRow["Article.Code"] as FIN_Article); treeViewArticlesRecordAfterChange(); }; _treeViewArticles.RecordAfterDelete += delegate { treeViewArticlesRecordAfterChange(); }; _treeViewArticles.RecordAfterUpdate += delegate { treeViewArticlesRecordAfterChange(); }; }
private void InitUI() { try { //Init Local Vars _article = (_dataSourceRow as FIN_Article); if (_dialogMode != DialogMode.Insert) { //Get totalNumberOfFinanceDocuments to check if article has already used in Finance Documents, to protect name changes etc string sql = string.Format("SELECT COUNT(*) as Count FROM fin_documentfinancedetail WHERE Article = '{0}';", _article.Oid); var sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql); _totalNumberOfFinanceDocuments = Convert.ToUInt16(sqlResult); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexAlfaNumericArticleCode, true)); //CodeDealer Entry entryCodeDealer = new Entry(); BOWidgetBox boxCodeDealer = new BOWidgetBox(Resx.global_record_code_dealer, entryCodeDealer); vboxTab1.PackStart(boxCodeDealer, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCodeDealer, _dataSourceRow, "CodeDealer", SettingsApp.RegexAlfaNumeric, false)); //Designation Entry entryDesignation = new Entry(); BOWidgetBox boxDesignation = new BOWidgetBox(Resx.global_designation, entryDesignation); vboxTab1.PackStart(boxDesignation, false, false, 0); // Changed from RegexAlfaNumeric to RegexAlfaNumericExtended 2017-1011 _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true)); //ButtonLabel Entry entryButtonLabel = new Entry(); BOWidgetBox boxButtonLabel = new BOWidgetBox(Resx.global_button_name, entryButtonLabel); vboxTab1.PackStart(boxButtonLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericArticleButtonLabel, false)); //Family _xpoComboBoxFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleFamily), (DataSourceRow as FIN_Article).Family, "Designation"); BOWidgetBox boxFamily = new BOWidgetBox(Resx.global_article_family, _xpoComboBoxFamily); vboxTab1.PackStart(boxFamily, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFamily, DataSourceRow, "Family", SettingsApp.RegexGuid, true)); //SubFamily _xpoComboBoxSubFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleSubFamily), (DataSourceRow as FIN_Article).SubFamily, "Designation"); BOWidgetBox boxSubFamily = new BOWidgetBox(Resx.global_article_subfamily, _xpoComboBoxSubFamily); vboxTab1.PackStart(boxSubFamily, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxSubFamily, DataSourceRow, "SubFamily", SettingsApp.RegexGuid, true)); //Type XPOComboBox xpoComboBoxType = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleType), (DataSourceRow as FIN_Article).Type, "Designation"); BOWidgetBox boxType = new BOWidgetBox(Resx.global_article_type, xpoComboBoxType); vboxTab1.PackStart(boxType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxType, DataSourceRow, "Type", SettingsApp.RegexGuid, true)); //ButtonImage FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open) { HeightRequest = 23 }; Image fileChooserImagePreviewButtonImage = new Image() { WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height }; Frame fileChooserFrameImagePreviewButtonImage = new Frame(); fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None; fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage); fileChooserButtonImage.SetFilename(((FIN_Article)DataSourceRow).ButtonImage); fileChooserButtonImage.Filter = Utils.GetFileFilterImages(); fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest)); BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(Resx.global_button_image, fileChooserButtonImage); HBox hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing); hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0); hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0); vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false)); //Favorite CheckButton checkButtonFavorite = new CheckButton(Resx.global_favorite); vboxTab1.PackStart(checkButtonFavorite, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFavorite, _dataSourceRow, "Favorite")); //UseWeighingBalance CheckButton checkButtonUseWeighingBalance = new CheckButton(Resx.global_use_weighing_balance); vboxTab1.PackStart(checkButtonUseWeighingBalance, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUseWeighingBalance, _dataSourceRow, "UseWeighingBalance")); //Disabled CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab2 _vboxTab2 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; int col1width = 100, col2width = 90, col3width = col2width, col4width = 160; //hboxPrices Label labelPriceEmpty = new Label(string.Empty) { WidthRequest = col1width }; Label labelPriceNormal = new Label(Resx.article_normal_price) { WidthRequest = col2width }; Label labelPricePromotion = new Label(Resx.article_promotion_price) { WidthRequest = col3width }; Label labelPriceUsePromotionPrice = new Label(Resx.article_use_promotion_price) { WidthRequest = col4width }; labelPriceNormal.SetAlignment(0.0F, 0.5F); labelPricePromotion.SetAlignment(0.0F, 0.5F); labelPriceUsePromotionPrice.SetAlignment(0.0F, 0.5F); VBox vboxPrices = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; HBox hboxPrices = new HBox(false, _boxSpacing); hboxPrices.PackStart(labelPriceEmpty, true, true, 0); hboxPrices.PackStart(labelPriceNormal, false, false, 0); hboxPrices.PackStart(labelPricePromotion, false, false, 0); hboxPrices.PackStart(labelPriceUsePromotionPrice, false, false, 0); //PackIt VBox vboxPrices.PackStart(hboxPrices, false, false, 0); //Get PriceType Collection : Require Criteria to exclude SettingsApp.XpoOidUndefinedRecord, else we get a Price0 here CriteriaOperator criteriaOperator = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled <> 1) OR (Oid <> '{0}')", SettingsApp.XpoOidUndefinedRecord)); XPCollection xpcConfigurationPriceType = new XPCollection(DataSourceRow.Session, typeof(FIN_ConfigurationPriceType), criteriaOperator); xpcConfigurationPriceType.Sorting = FrameworkUtils.GetXPCollectionDefaultSortingCollection(); //Define Max 5 Rows : 5 Prices int priceTypeCount = (xpcConfigurationPriceType.Count > 5) ? 5 : xpcConfigurationPriceType.Count; //Loop and Render Columns for (int i = 0; i < priceTypeCount; i++) { int priceTypeIndex = ((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).EnumValue; //FieldNames string fieldNamePriceNormal = string.Format("Price{0}", priceTypeIndex); string fieldNamePricePromotion = string.Format("Price{0}Promotion", priceTypeIndex); string fieldNamePriceUsePromotionPrice = string.Format("Price{0}UsePromotionPrice", priceTypeIndex); //PriceType Label labelPriceType = new Label(((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).Designation) { WidthRequest = col1width }; labelPriceType.SetAlignment(0.0F, 0.5F); //Entrys Entry entryPriceNormal = new Entry() { WidthRequest = col2width }; Entry entryPricePromotion = new Entry() { WidthRequest = col3width }; _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPriceNormal, _dataSourceRow, fieldNamePriceNormal, SettingsApp.RegexDecimalGreaterEqualThanZero, true)); _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPricePromotion, _dataSourceRow, fieldNamePricePromotion, SettingsApp.RegexDecimalGreaterEqualThanZero, true)); //UsePromotion CheckButton checkButtonUsePromotion = new CheckButton(string.Empty) { WidthRequest = col4width }; _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUsePromotion, _dataSourceRow, fieldNamePriceUsePromotionPrice)); //PackIt hboxPrices = new HBox(false, _boxSpacing); hboxPrices.PackStart(labelPriceType, true, true, 0); hboxPrices.PackStart(entryPriceNormal, false, false, 0); hboxPrices.PackStart(entryPricePromotion, false, false, 0); hboxPrices.PackStart(checkButtonUsePromotion, false, false, 0); //PackIt VBox vboxPrices.PackStart(hboxPrices, false, false, 0); } _vboxTab2.PackStart(vboxPrices, false, false, 0); //PVPVariable CheckButton checkButtonPVPVariable = new CheckButton(Resx.global_variable_price); _vboxTab2.PackStart(checkButtonPVPVariable, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPVPVariable, _dataSourceRow, "PVPVariable")); //PriceWithVat CheckButton checkButtonPriceWithVat = new CheckButton(Resx.global_price_with_vat); _vboxTab2.PackStart(checkButtonPriceWithVat, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPriceWithVat, _dataSourceRow, "PriceWithVat")); //Discount Entry entryDiscount = new Entry(); BOWidgetBox boxDiscount = new BOWidgetBox(Resx.global_discount, entryDiscount); _vboxTab2.PackStart(boxDiscount, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, false)); //Class XPOComboBox xpoComboBoxClass = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleClass), (DataSourceRow as FIN_Article).Class, "Designation"); BOWidgetBox boxClass = new BOWidgetBox(Resx.global_article_class, xpoComboBoxClass); _vboxTab2.PackStart(boxClass, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxClass, DataSourceRow, "Class", SettingsApp.RegexGuid, true)); //Normal App Mode if (SettingsApp.AppMode == AppOperationMode.Default) { //VatOnTable _xpoComboBoxVatOnTable = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatOnTable, "Designation"); BOWidgetBox boxVatOnTable = new BOWidgetBox(Resx.global_vat_on_table, _xpoComboBoxVatOnTable); _vboxTab2.PackStart(boxVatOnTable, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatOnTable, DataSourceRow, "VatOnTable", SettingsApp.RegexGuid, true)); } //VatDirectSelling _xpoComboBoxVatDirectSelling = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatDirectSelling, "Designation"); BOWidgetBox boxVatDirectSelling = new BOWidgetBox(Resx.global_vat_direct_selling, _xpoComboBoxVatDirectSelling); _vboxTab2.PackStart(boxVatDirectSelling, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatDirectSelling, DataSourceRow, "VatDirectSelling", SettingsApp.RegexGuid, true)); //VatExemptionReason _xpoComboBoxVatExemptionReason = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatExemptionReason), (DataSourceRow as FIN_Article).VatExemptionReason, "Designation"); BOWidgetBox boxVatExemptionReason = new BOWidgetBox(Resx.global_vat_exemption_reason, _xpoComboBoxVatExemptionReason); _vboxTab2.PackStart(boxVatExemptionReason, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatExemptionReason, DataSourceRow, "VatExemptionReason", SettingsApp.RegexGuid, true)); //Append Tab _notebook.AppendPage(_vboxTab2, new Label(Resx.dialog_edit_article_tab2_label)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab3 VBox vboxTab3 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //BarCode Entry entryBarCode = new Entry(); BOWidgetBox boxBarCode = new BOWidgetBox(Resx.global_barcode, entryBarCode); vboxTab3.PackStart(boxBarCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxBarCode, _dataSourceRow, "BarCode", SettingsApp.RegexEan12andEan4, false)); //Accounting Entry entryAccounting = new Entry(); BOWidgetBox boxAccounting = new BOWidgetBox(Resx.global_accounting, entryAccounting); vboxTab3.PackStart(boxAccounting, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAccounting, _dataSourceRow, "Accounting", SettingsApp.RegexDecimal, false)); //Tare Entry entryTare = new Entry(); BOWidgetBox boxTare = new BOWidgetBox(Resx.global_tare, entryTare); vboxTab3.PackStart(boxTare, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTare, _dataSourceRow, "Tare", SettingsApp.RegexDecimal, false)); //Weight Entry entryWeight = new Entry(); BOWidgetBox boxWeight = new BOWidgetBox(Resx.global_weight, entryWeight); vboxTab3.PackStart(boxWeight, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxWeight, _dataSourceRow, "Weight", SettingsApp.RegexDecimal, false)); //DefaultQuantity Entry entryDefaultQuantity = new Entry(); BOWidgetBox boxDefaultQuantity = new BOWidgetBox(Resx.global_article_default_quantity, entryDefaultQuantity); vboxTab3.PackStart(boxDefaultQuantity, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDefaultQuantity, _dataSourceRow, "DefaultQuantity", SettingsApp.RegexDecimal, false)); //UnitMeasure XPOComboBox xpoComboBoxUnitMeasure = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitMeasure), (DataSourceRow as FIN_Article).UnitMeasure, "Designation"); BOWidgetBox boxUnitMeasure = new BOWidgetBox(Resx.global_unit_measure, xpoComboBoxUnitMeasure); vboxTab3.PackStart(boxUnitMeasure, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitMeasure, DataSourceRow, "UnitMeasure", SettingsApp.RegexGuid, true)); //UnitSize XPOComboBox xpoComboBoxUnitSize = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitSize), (DataSourceRow as FIN_Article).UnitSize, "Designation"); BOWidgetBox boxUnitSize = new BOWidgetBox(Resx.global_unit_size, xpoComboBoxUnitSize); vboxTab3.PackStart(boxUnitSize, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitSize, DataSourceRow, "UnitSize", SettingsApp.RegexGuid, true)); //Printer XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrinters), (DataSourceRow as FIN_Article).Printer, "Designation"); BOWidgetBox boxPrinter = new BOWidgetBox(Resx.global_device_printer, xpoComboBoxPrinter); vboxTab3.PackStart(boxPrinter, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false)); //Template XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrintersTemplates), (DataSourceRow as FIN_Article).Template, "Designation"); BOWidgetBox boxTemplate = new BOWidgetBox(Resx.global_ConfigurationPrintersTemplates, xpoComboBoxTemplate); vboxTab3.PackStart(boxTemplate, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false)); if (GlobalApp.ScreenSize.Width > 800 && GlobalApp.ScreenSize.Height > 600) { //CommissionGroup XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(POS_UserCommissionGroup), (DataSourceRow as FIN_Article).CommissionGroup, "Designation"); BOWidgetBox boxCommissionGroup = new BOWidgetBox(Resx.global_commission_group, xpoComboBoxCommissionGroup); vboxTab3.PackStart(boxCommissionGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false)); //DiscountGroup XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as FIN_Article).DiscountGroup, "Designation"); BOWidgetBox boxDiscountGroup = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup); vboxTab3.PackStart(boxDiscountGroup, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, false)); } //Append Tab _notebook.AppendPage(vboxTab3, new Label(Resx.dialog_edit_article_tab3_label)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Enable/Disable Components entryDesignation.Sensitive = (_totalNumberOfFinanceDocuments > 0) ? false : true; //Show or Hide vboxTab2 if (_article.Type != null) { _vboxTab2.Visible = _article.Type.HavePrice; } //Assign Initial Value for Family DefineInitialValueForXpoComboBoxFamily(); //Call UI Update for VatExemptionReason UpdateUIVatExemptionReason(); //Events _xpoComboBoxFamily.Changed += xpoComboBoxFamily_Changed; xpoComboBoxType.Changed += xpoComboBoxType_Changed; _xpoComboBoxVatDirectSelling.Changed += xpoComboBoxVatDirectSelling_Changed; if (_xpoComboBoxVatOnTable != null) { _xpoComboBoxVatOnTable.Changed += xpoComboBoxVatDirectSelling_Changed; } } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Add From Article public void Add(FIN_Article pArticle, Guid pPlaceOid, Guid pTableOid, PriceType pPriceType, decimal pQuantity) { Add(pArticle, pPlaceOid, pTableOid, pPriceType, pQuantity, null); }
public static bool Add(Session pSession, ProcessArticleStockMode pMode, FIN_DocumentFinanceDetail pDocumentDetail, ERP_Customer pCustomer, int pOrd, DateTime pDocumentDate, string pDocumentNumber, FIN_Article pArticle, decimal pQuantity, string pNotes) { //Log4Net log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); bool result = false; decimal quantity = 0.0m; try { switch (pMode) { case ProcessArticleStockMode.Out: quantity = -(pQuantity); break; case ProcessArticleStockMode.In: quantity = pQuantity; break; } //Get Objects in same Session ERP_Customer customer = (ERP_Customer)pSession.GetObjectByKey(typeof(ERP_Customer), pCustomer.Oid); FIN_Article article = (FIN_Article)pSession.GetObjectByKey(typeof(FIN_Article), pArticle.Oid); POS_ConfigurationPlaceTerminal terminal = (POS_ConfigurationPlaceTerminal)pSession.GetObjectByKey(typeof(POS_ConfigurationPlaceTerminal), GlobalFramework.LoggedTerminal.Oid); SYS_UserDetail userDetail = (SYS_UserDetail)pSession.GetObjectByKey(typeof(SYS_UserDetail), GlobalFramework.LoggedUser.Oid); FIN_ArticleStock articleStock = new FIN_ArticleStock(pSession) { Customer = customer, Date = pDocumentDate, Article = article, Quantity = quantity, Notes = pNotes, CreatedWhere = terminal, CreatedBy = userDetail }; if (pDocumentNumber != string.Empty) { articleStock.DocumentNumber = pDocumentNumber; } if (pDocumentDetail != null) { articleStock.DocumentNumber = pDocumentDetail.DocumentMaster.DocumentNumber; articleStock.DocumentMaster = pDocumentDetail.DocumentMaster; articleStock.DocumentDetail = pDocumentDetail; } //Only saves if not Working on a Unit Of Work Transaction if (pSession.GetType() != typeof(UnitOfWork)) { articleStock.Save(); } //Audit switch (pMode) { case ProcessArticleStockMode.Out: FrameworkUtils.Audit("STOCK_MOVEMENT_OUT", string.Format(Resx.audit_message_stock_movement_out, article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity))); break; case ProcessArticleStockMode.In: FrameworkUtils.Audit("STOCK_MOVEMENT_IN", string.Format(Resx.audit_message_stock_movement_in, article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity))); break; } result = true; } catch (Exception ex) { log.Error(ex.Message, ex); } return(result); }
public static bool Add(Session pSession, ProcessArticleStockMode pMode, ERP_Customer pCustomer, int pOrd, DateTime pDocumentDate, string pDocumentNumber, FIN_Article pArticle, decimal pQuantity, string pNotes) { return(Add(GlobalFramework.SessionXpo, pMode, null, pCustomer, 10, pDocumentDate, pDocumentNumber, pArticle, pQuantity, pNotes)); }
public static ArticleBag GetArticleBag(bool pForceErrors) { ArticleBag articleBag = new ArticleBag(10); Guid xpoOidConfigurationPlaceDefault = new Guid(GlobalFramework.Settings["xpoOidConfigurationPlaceDefault"]); Guid xpoOidConfigurationPlaceTableDefaultOpenTable = new Guid(GlobalFramework.Settings["xpoOidConfigurationPlaceTableDefaultOpenTable"]); ArticleBagKey articleBagKey; ArticleBagProperties articleBagProps; Dictionary <Guid, decimal> mockArticles = new Dictionary <Guid, decimal>(); //P:Products mockArticles.Add(new Guid("133cc225-517d-4c24-88b0-cd7c08cf5727"), 2.0m); mockArticles.Add(new Guid("4c47be72-6174-4e63-a077-f3cdb6a15e97"), 3.0m); mockArticles.Add(new Guid("0f32da9c-e533-489d-8a46-d6da79fd63a0"), 3.0m); mockArticles.Add(new Guid("6b547918-769e-4f5b-bcd6-01af54846f73"), 4.0m); mockArticles.Add(new Guid("42cd7f86-97b2-44f4-b098-3c9f0ae9f4b5"), 5.0m); mockArticles.Add(new Guid("55892c3f-de10-4076-afde-619c54100c9b"), 6.0m); mockArticles.Add(new Guid("fc109711-edb0-41dc-87b6-0acb77abd341"), 7.0m); mockArticles.Add(new Guid("bf99351b-1556-43c4-a85c-90082fb02d05"), 8.0m); mockArticles.Add(new Guid("11062ec9-fed0-43eb-a23e-c6f7ed83ff72"), 9.0m); mockArticles.Add(new Guid("32deb30d-ffa2-45e4-bca6-03569b9e8b08"), 2.0m); mockArticles.Add(new Guid("78638720-e728-4e96-8643-6d6267ff817b"), 2.0m); mockArticles.Add(new Guid("42c327e2-4aad-41ea-b5b6-e2198c337f1c"), 3.0m); mockArticles.Add(new Guid("0d30bf31-ecc4-452e-9b43-ee9d5c1d7fb6"), 4.0m); mockArticles.Add(new Guid("7b45a01d-50ee-42d3-a4af-0dcde9397e93"), 5.0m); mockArticles.Add(new Guid("630ff869-e433-46bb-a53b-563c43535424"), 6.0m); mockArticles.Add(new Guid("f71b3648-bb41-4952-ac75-ee93ccf0ec66"), 7.0m); mockArticles.Add(new Guid("87ff6f3a-c858-4829-bbcb-c6ea395129da"), 8.0m); mockArticles.Add(new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"), 9.0m); //S:Services mockArticles.Add(new Guid("5a852060-43b9-4e71-a230-b733bb150427"), 3.0m); mockArticles.Add(new Guid("072db1bf-6182-43de-8065-d4bbd8c9f8c2"), 4.0m); foreach (var item in mockArticles) { FIN_Article article = (FIN_Article)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(FIN_Article), item.Key); articleBagKey = new ArticleBagKey( article.Oid, article.Designation, article.Price1, article.Discount, article.VatOnTable.Value ); articleBagProps = new ArticleBagProperties( xpoOidConfigurationPlaceDefault, xpoOidConfigurationPlaceTableDefaultOpenTable, PriceType.Price1, article.Code, item.Value, article.UnitMeasure.Acronym ); if (!pForceErrors) { //Detect and Add TaxExceptionReason if Miss to Prevent Errors if (articleBagKey.Vat == 0.0m && articleBagKey.VatExemptionReasonOid == Guid.Empty) { articleBagKey.VatExemptionReasonOid = SettingsApp.XpoOidConfigurationVatExemptionReasonM99; } //Add Price to Services, else we have Error with Price 0 if (article.Class.Acronym == "S") { articleBagKey.Price = 10.28m; } } //Send to Bag articleBag.Add(articleBagKey, articleBagProps); } if (pForceErrors) { //Add Error Article after Loop articleBagKey = new ArticleBagKey( Guid.Empty, //Oid "§", //Designation -1, //Price 101, //Discount 0 //VatOnTable ); articleBagProps = new ArticleBagProperties( xpoOidConfigurationPlaceDefault, xpoOidConfigurationPlaceTableDefaultOpenTable, PriceType.Price1, string.Empty, //Code -1, //Quantity "§" //UnitMeasure.Acronym ); //Add Error Article articleBag.Add(articleBagKey, articleBagProps); //Assign Error after add To ArticleBag articleBagKey.Vat = -1; } return(articleBag); }
private void InitUI() { //Init Local Vars //Default Values (INSERT) FIN_Article initialValueSelectArticle = (_dataSourceRow["Article.Code"] as FIN_Article); string initialValuePrice = FrameworkUtils.DecimalToString(0); string initialValuePriceDisplay = FrameworkUtils.DecimalToString(0); string initialValueQuantity = FrameworkUtils.DecimalToString(0); string initialValueDiscount = FrameworkUtils.DecimalToString(0); string initialValueTotalNet = FrameworkUtils.DecimalToString(0); string initialValueTotalFinal = FrameworkUtils.DecimalToString(0); string initialValueNotes = string.Empty; FIN_ConfigurationVatRate initialValueSelectConfigurationVatRate = (FIN_ConfigurationVatRate)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationVatRate), SettingsApp.XpoOidArticleDefaultVatDirectSelling); FIN_ConfigurationVatExemptionReason initialValueSelectConfigurationVatExemptionReason = null; //Update Record : Override Default Values if (initialValueSelectArticle != null && initialValueSelectArticle.Oid != Guid.Empty) { //Always display Values from DataRow, for Both INSERT and UPDATE Modes, We Have defaults comming from ColumnProperties initialValuePrice = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Price"].ToString()); initialValuePriceDisplay = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["PriceDisplay"].ToString()); initialValueQuantity = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Quantity"].ToString()); initialValueDiscount = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["Discount"].ToString()); initialValueTotalNet = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["TotalNet"].ToString()); initialValueTotalFinal = FrameworkUtils.StringToDecimalAndToStringAgain(_dataSourceRow["TotalFinal"].ToString()); initialValueSelectConfigurationVatRate = (_dataSourceRow["ConfigurationVatRate.Value"] as FIN_ConfigurationVatRate); initialValueSelectConfigurationVatExemptionReason = (_dataSourceRow["VatExemptionReason.Acronym"] as FIN_ConfigurationVatExemptionReason); initialValueNotes = _dataSourceRow["Notes"].ToString(); //Required, Else Wrong Calculation in UPDATES, when Price is not Defined : //Reverse Price if not in default System Currency, else use value from Input _articlePrice = (_currencyDefaultSystem == _currencyDisplay) ? FrameworkUtils.StringToDecimal(initialValuePriceDisplay) : (FrameworkUtils.StringToDecimal(initialValuePriceDisplay) / _currencyDisplay.ExchangeRate) ; } //Initialize crudWidgetsList _crudWidgetList = new GenericCRUDWidgetListDataTable(); //SelectArticle CriteriaOperator criteriaOperatorSelectArticle = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1)"); _entryBoxSelectArticle = new XPOEntryBoxSelectRecord <FIN_Article, TreeViewArticle>(this, Resx.global_article, "Designation", "Oid", initialValueSelectArticle, criteriaOperatorSelectArticle); _entryBoxSelectArticle.Entry.IsEditable = false; //Add to WidgetList _crudWidgetSelectArticle = new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, _entryBoxSelectArticle.Label, _dataSourceRow, "Oid", _regexGuid, true); _crudWidgetList.Add(_crudWidgetSelectArticle); //Used only to Update DataRow Column from Widget : Used to force Assign XPGuidObject ChildNames to Columns _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, new Label(), _dataSourceRow, "Article.Code")); _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticle, new Label(), _dataSourceRow, "Article.Designation")); //Events _entryBoxSelectArticle.ClosePopup += _entryBoxSelectArticle_ClosePopup; //Price : Used only in Debug Mode, to Inspect SystemCurrency Values : To View add it to hboxPriceQuantityDiscountAndTotals.PackStart //Note #1 //Removed. this will trigger an error when use a zero Price WayBill to issue an Invoice, better use discount 100% //If not Saft Document Type 2, required greater than zero in Price, else we can have zero or greater from Document Type 2 (ex Transportation Guide) //string regExPrice = (!_listSaftDocumentType2.Contains(_documentFinanceType.Oid.ToString())) ? _regexDecimalGreaterThanZero : _regexDecimalGreaterEqualThanZero; // Now all regExPrice must be greater than Zero string regExPrice = _regexDecimalGreaterThanZero; _entryBoxValidationPrice = new EntryBoxValidation(this, "Price EUR(*)", KeyboardMode.Numeric, regExPrice, true); _entryBoxValidationPrice.EntryValidation.Text = initialValuePrice; _entryBoxValidationPrice.EntryValidation.Sensitive = false; //Add to WidgetList _crudWidgetPrice = new GenericCRUDWidgetDataTable(_entryBoxValidationPrice, _entryBoxValidationPrice.Label, _dataSourceRow, "Price", regExPrice, true); _crudWidgetList.Add(_crudWidgetPrice); //PriceDisplay //Note #1 //If not Saft Document Type 2, required greater than zero in Price, else we can have zero or greater from Document Type 2 (ex Transportation Guide) _entryBoxValidationPriceDisplay = new EntryBoxValidation(this, Resx.global_price, KeyboardMode.Numeric, regExPrice, true); _entryBoxValidationPriceDisplay.EntryValidation.Text = initialValuePriceDisplay; //Add to WidgetList _crudWidgetPriceDisplay = new GenericCRUDWidgetDataTable(_entryBoxValidationPriceDisplay, _entryBoxValidationPriceDisplay.Label, _dataSourceRow, "PriceDisplay", regExPrice, true); _crudWidgetList.Add(_crudWidgetPriceDisplay); //Events _entryBoxValidationPriceDisplay.EntryValidation.Changed += delegate { if (_crudWidgetPriceDisplay.Validated) { //Reverse Price if not in default System Currency, else use value from Input _articlePrice = (_currencyDefaultSystem == _currencyDisplay) ? FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) : (FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) / _currencyDisplay.ExchangeRate); //Assign to System Currency Price _entryBoxValidationPrice.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice); UpdatePriceProperties(); } }; _entryBoxValidationPriceDisplay.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationPriceDisplay.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationPriceDisplay.EntryValidation.Text); }; //Start with _articlePrice Assigned: DISABLED //_articlePrice = (_currencyDefaultSystem == _currencyDisplay) // ? FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) // : (FrameworkUtils.StringToDecimal(_entryBoxValidationPriceDisplay.EntryValidation.Text) / _currencyDisplay.ExchangeRate) // ; //Quantity _entryBoxValidationQuantity = new EntryBoxValidation(this, Resx.global_quantity, KeyboardMode.Numeric, _regexDecimalGreaterThanZero, true); _entryBoxValidationQuantity.EntryValidation.Text = initialValueQuantity; //Add to WidgetList _crudWidgetQuantity = new GenericCRUDWidgetDataTable(_entryBoxValidationQuantity, _entryBoxValidationQuantity.Label, _dataSourceRow, "Quantity", _regexDecimalGreaterThanZero, true); _crudWidgetList.Add(_crudWidgetQuantity); //Events _entryBoxValidationQuantity.EntryValidation.Changed += delegate { UpdatePriceProperties(); }; _entryBoxValidationQuantity.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationQuantity.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationQuantity.EntryValidation.Text); }; //Discount _entryBoxValidationDiscount = new EntryBoxValidation(this, Resx.global_discount, KeyboardMode.Numeric, _regexPercentage, true); _entryBoxValidationDiscount.EntryValidation.Text = initialValueDiscount; //Add to WidgetList _crudWidgetDiscount = new GenericCRUDWidgetDataTable(_entryBoxValidationDiscount, _entryBoxValidationDiscount.Label, _dataSourceRow, "Discount", _regexPercentage, true); _crudWidgetList.Add(_crudWidgetDiscount); //Events _entryBoxValidationDiscount.EntryValidation.Changed += delegate { UpdatePriceProperties(); }; _entryBoxValidationDiscount.EntryValidation.FocusOutEvent += delegate { _entryBoxValidationDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxValidationDiscount.EntryValidation.Text); }; //TotalGross _entryBoxValidationTotalNet = new EntryBoxValidation(this, Resx.global_totalnet, KeyboardMode.None); _entryBoxValidationTotalNet.EntryValidation.Text = initialValueTotalNet; _entryBoxValidationTotalNet.EntryValidation.Sensitive = false; //Used only to Update DataRow Column from Widget _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationTotalNet, new Label(), _dataSourceRow, "TotalNet")); //TotalFinal _entryBoxValidationTotalFinal = new EntryBoxValidation(this, Resx.global_total, KeyboardMode.None); _entryBoxValidationTotalFinal.EntryValidation.Text = initialValueTotalFinal; _entryBoxValidationTotalFinal.EntryValidation.Sensitive = false; //Used only to Update DataRow Column from Widget _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationTotalFinal, new Label(), _dataSourceRow, "TotalFinal")); //HBox PriceQuantityDiscountAndTotals HBox hboxPriceQuantityDiscountAndTotals = new HBox(true, 0); //Invisible, only used to Debug, to View Values in System Currency //hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationPrice, true, true, 0); hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationPriceDisplay, true, true, 0); hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationQuantity, true, true, 0); hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationDiscount, true, true, 0); hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationTotalNet, true, true, 0); hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationTotalFinal, true, true, 0); //SelectVatRate CriteriaOperator criteriaOperatorSelectVatRate = CriteriaOperator.Parse("(Disabled = 0 OR Disabled IS NULL)"); _entryBoxSelectVatRate = new XPOEntryBoxSelectRecord <FIN_ConfigurationVatRate, TreeViewConfigurationVatRate>(this, Resx.global_vat_rate, "Designation", "Oid", initialValueSelectConfigurationVatRate, criteriaOperatorSelectVatRate); _entryBoxSelectVatRate.WidthRequest = 149; _entryBoxSelectVatRate.Entry.IsEditable = false; _entryBoxSelectVatRate.Entry.Changed += _entryBoxSelectVatRate_EntryValidation_Changed; //Add to WidgetList _crudWidgetSelectVatRate = new GenericCRUDWidgetDataTable(_entryBoxSelectVatRate, _entryBoxSelectVatRate.Label, _dataSourceRow, "ConfigurationVatRate.Value", _regexGuid, true); _crudWidgetList.Add(_crudWidgetSelectVatRate); //SelectVatExemptionReason CriteriaOperator criteriaOperatorSelectVatExemptionReason = CriteriaOperator.Parse("(Disabled = 0 OR Disabled IS NULL)"); _entryBoxSelectVatExemptionReason = new XPOEntryBoxSelectRecord <FIN_ConfigurationVatExemptionReason, TreeViewConfigurationVatExceptionReason>(this, Resx.global_vat_exemption_reason, "Designation", "Oid", initialValueSelectConfigurationVatExemptionReason, criteriaOperatorSelectVatExemptionReason); _entryBoxSelectVatExemptionReason.Entry.IsEditable = false; //Add to WidgetList _crudWidgetSelectVatExemptionReason = new GenericCRUDWidgetDataTable(_entryBoxSelectVatExemptionReason, _entryBoxSelectVatExemptionReason.Label, _dataSourceRow, "VatExemptionReason.Acronym", _regexGuid, true); _crudWidgetList.Add(_crudWidgetSelectVatExemptionReason); //ToggleMode: Edit Active/Inactive ToggleVatExemptionReasonEditMode(); //HBox VatRateAndVatExemptionReason HBox hboxVatRateAndVatExemptionReason = new HBox(false, 0); hboxVatRateAndVatExemptionReason.PackStart(_entryBoxSelectVatRate, false, false, 0); hboxVatRateAndVatExemptionReason.PackStart(_entryBoxSelectVatExemptionReason, true, true, 0); //Token1 _entryBoxValidationToken1 = new EntryBoxValidation(this, "Token1", KeyboardMode.None); _entryBoxValidationToken1.EntryValidation.Sensitive = false; //Used only to Update DataRow Column from Widget _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationToken1, new Label(), _dataSourceRow, "Token1")); //Token2 _entryBoxValidationToken2 = new EntryBoxValidation(this, "Token2", KeyboardMode.None); _entryBoxValidationToken2.EntryValidation.Sensitive = false; //Used only to Update DataRow Column from Widget _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationToken2, new Label(), _dataSourceRow, "Token2")); //Notes _entryBoxValidationNotes = new EntryBoxValidation(this, "Notes", KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxValidationNotes.EntryValidation.Text = initialValueNotes; _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxValidationNotes, new Label(), _dataSourceRow, "Notes")); //Uncomment to Show Invisible Widgets //HBox Token1AndToken2 //HBox hboxToken1AndToken2 = new HBox(false, 0); //hboxToken1AndToken2.PackStart(_entryBoxToken1, false, false, 0); //hboxToken1AndToken2.PackStart(_entryBoxToken2, true, true, 0); //Pack in VBox _vboxEntrys = new VBox(true, 0); _vboxEntrys.PackStart(_entryBoxSelectArticle); _vboxEntrys.PackStart(hboxPriceQuantityDiscountAndTotals); _vboxEntrys.PackStart(hboxVatRateAndVatExemptionReason); //Uncomment to Show Invisible Widgets //_vboxEntrys.PackStart(hboxToken1AndToken2); _vboxEntrys.PackStart(_entryBoxValidationNotes); _vboxEntrys.WidthRequest = _windowSize.Width - 13; // CreditNote : Protect all components, only Quantity is Editable in CreditMode if (_documentFinanceType.Oid == SettingsApp.XpoOidDocumentFinanceTypeCreditNote) { //Article _entryBoxSelectArticle.Entry.Sensitive = false; _entryBoxSelectArticle.ButtonSelectValue.Sensitive = false; //PriceDisplay _entryBoxValidationPriceDisplay.EntryValidation.Sensitive = false; _entryBoxValidationPriceDisplay.ButtonKeyBoard.Sensitive = false; //Discount _entryBoxValidationDiscount.EntryValidation.Sensitive = false; _entryBoxValidationDiscount.ButtonKeyBoard.Sensitive = false; //VatRate _entryBoxSelectVatRate.Entry.Sensitive = false; _entryBoxSelectVatRate.ButtonSelectValue.Sensitive = false; //VatExemptionReason _entryBoxSelectVatExemptionReason.Entry.Sensitive = false; _entryBoxSelectVatExemptionReason.ButtonSelectValue.Sensitive = false; } }
//XpoMode public TreeViewArticle(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default) { //Init Vars Type xpoGuidObjectType = typeof(FIN_Article); //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView FIN_Article defaultValue = (pDefaultValue != null) ? pDefaultValue as FIN_Article : null; //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView Type typeDialogClass = (pDialogType != null) ? pDialogType : typeof(DialogArticle); //Config int fontGenericTreeViewColumn = Convert.ToInt16(GlobalFramework.Settings["fontGenericTreeViewColumn"]); //Configure columnProperties List <GenericTreeViewColumnProperty> columnProperties = new List <GenericTreeViewColumnProperty>(); columnProperties.Add(new GenericTreeViewColumnProperty("Code") { Title = Resx.global_record_code, MinWidth = 100 }); columnProperties.Add(new GenericTreeViewColumnProperty("Designation") { Title = Resx.global_designation, Expand = true }); //To Test XPGuidObject InitialValue (InitialValue = xArticleFamily) : ArticleFamily xArticleFamily = (ArticleFamily)FrameworkUtils.GetXPGuidObjectFromSession(GlobalFramework.SessionXpoBackoffice, typeof(ArticleFamily), new Guid("471d8c1e-45c1-4dbe-8526-349c20bd53ef")); columnProperties.Add(new GenericTreeViewColumnProperty("Family") { Title = Resx.global_article_family, ChildName = "Designation" }); columnProperties.Add(new GenericTreeViewColumnProperty("SubFamily") { Title = Resx.global_article_subfamily, ChildName = "Designation" }); columnProperties.Add(new GenericTreeViewColumnProperty("Type") { Title = Resx.global_article_type, ChildName = "Designation" }); columnProperties.Add(new GenericTreeViewColumnProperty("TotalStock") { Query = "SELECT SUM(Quantity) as Result FROM fin_articlestock WHERE Article = '{0}' AND (Disabled = 0 OR Disabled is NULL) GROUP BY Article;", Title = Resx.global_total_stock, MinWidth = 100, //Alignment = 1.0F, FormatProvider = new FormatterDecimal(), //CellRenderer = new CellRendererText() //{ // FontDesc = new Pango.FontDescription() { Size = fontGenericTreeViewColumn }, // Alignment = Pango.Alignment.Right, // Xalign = 1.0F //} }); columnProperties.Add(new GenericTreeViewColumnProperty("UpdatedAt") { Title = Resx.global_record_date_updated, MinWidth = 150, MaxWidth = 150 }); //Configure Criteria/XPCollection/Model //Default Criteria with XpoOidUndefinedRecord CriteriaOperator criteria = pXpoCriteria; // Override Criteria adding XpoOidHiddenRecordsFilter criteria = CriteriaOperator.Parse($"({pXpoCriteria.ToString()}) OR (Oid NOT LIKE '{SettingsApp.XpoOidHiddenRecordsFilter}')"); //Custom Criteria hidding all Hidden Oids //CriteriaOperator criteria = CriteriaOperator.Parse($"(Oid = '{SettingsApp.XpoOidUndefinedRecord}' OR Oid NOT LIKE '{SettingsApp.XpoOidHiddenRecordsFilter}')"); 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 ); }