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 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 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);
        }
Esempio n. 4
0
        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);
        }
        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);
        }
Esempio n. 6
0
        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;
 }
Esempio n. 8
0
        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);


            _entryBoxSelectArticleCode.Entry.Text = article.Code;
            _entryBoxSelectArticle.Entry.Text     = article.Designation;
            //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();
        }
        //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);
        }
Esempio n. 10
0
        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(); };
        }
Esempio n. 11
0
        private void InitUI()
        {
            string lastArticleCode = "0";

            try
            {
                try
                {
                    //IN009261 BackOffice - Inserir mais auto-completes nos forms
                    if (GlobalFramework.DatabaseType.ToString() == "MSSqlServer")
                    {
                        string lastArticleSql = string.Format("SELECT MAX(CAST(Code AS INT))FROM fin_article");
                        lastArticleCode = GlobalFramework.SessionXpo.ExecuteScalar(lastArticleSql).ToString();
                    }
                    else if (GlobalFramework.DatabaseType.ToString() == "SQLite")
                    {
                        string lastArticleSql = string.Format("SELECT MAX(CAST(Code AS INT))FROM fin_article");
                        lastArticleCode = GlobalFramework.SessionXpo.ExecuteScalar(lastArticleSql).ToString();
                    }
                    else if (GlobalFramework.DatabaseType.ToString() == "MySql")
                    {
                        string lastArticleSql = string.Format("SELECT MAX(CAST(code AS UNSIGNED)) as Cast FROM fin_article;");
                        lastArticleCode = GlobalFramework.SessionXpo.ExecuteScalar(lastArticleSql).ToString();
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message, ex);
                }

                //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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_name"), entryButtonLabel);
                vboxTab1.PackStart(boxButtonLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericArticleButtonLabel, false));

                //Composite article
                //_xpoComboBoxCompositeArticle = new XPOComboBox(DataSourceRow.Session, typeof(fin_articlefamily), (DataSourceRow as fin_article).Family, "Designation", null);
                //BOWidgetBox boxComposite = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_composite_article"), _xpoComboBoxCompositeArticle);
                //vboxTab1.PackStart(boxComposite, false, false, 0);
                //_crudWidgetList.Add(new GenericCRUDWidgetXPO(boxComposite, DataSourceRow, "CompositeArticle", SettingsApp.RegexGuid, true));

                //Family
                _xpoComboBoxFamily = new XPOComboBox(DataSourceRow.Session, typeof(fin_articlefamily), (DataSourceRow as fin_article).Family, "Designation", null);
                BOWidgetBox boxFamily = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxSubFamily = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxType         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_favorite"));
                vboxTab1.PackStart(checkButtonFavorite, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFavorite, _dataSourceRow, "Favorite"));

                //UseWeighingBalance
                CheckButton checkButtonUseWeighingBalance = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_use_weighing_balance"));
                vboxTab1.PackStart(checkButtonUseWeighingBalance, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUseWeighingBalance, _dataSourceRow, "UseWeighingBalance"));

                //Disabled
                CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "article_normal_price"))
                {
                    WidthRequest = col2width
                };
                Label labelPricePromotion = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "article_promotion_price"))
                {
                    WidthRequest = col3width
                };
                Label labelPriceUsePromotionPrice = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_variable_price"));
                _vboxTab2.PackStart(checkButtonPVPVariable, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPVPVariable, _dataSourceRow, "PVPVariable"));

                //PriceWithVat
                CheckButton checkButtonPriceWithVat = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxClass         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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.IsDefaultTheme)/* IN008024 */
                {
                    //VatOnTable
                    _xpoComboBoxVatOnTable = new XPOComboBox(DataSourceRow.Session, typeof(fin_configurationvatrate), (DataSourceRow as fin_article).VatOnTable, "Designation", null);
                    BOWidgetBox boxVatOnTable = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxVatDirectSelling = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxVatExemptionReason = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_edit_article_tab2_label")));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Tab3
                VBox vboxTab3 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //BarCode
                Entry       entryBarCode = new Entry();
                BOWidgetBox boxBarCode   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxUnitMeasure         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxUnitSize         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxPrinter         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                BOWidgetBox boxTemplate         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                    BOWidgetBox boxCommissionGroup         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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", null);
                    BOWidgetBox boxDiscountGroup         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_edit_article_tab3_label")));


                //Tab4
                //VBox vboxTab4 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing };
                //_notebook.AppendPage(vboxTab4, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_edit_article_tab4_label1")));
                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Enable/Disable Components
                entryDesignation.Sensitive = (_totalNumberOfFinanceDocuments > 0) ? false : true;

                //IN009261 BackOffice - Inserir mais auto-completes nos forms

                int lcode = 0;
                lcode = Convert.ToInt32(lastArticleCode.ToString()) + 10;
                if (lcode != 10 && entryCode.Text == "")
                {
                    entryCode.Text = lcode.ToString();
                }

                //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);
            }
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        //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 = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), MinWidth = 100
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Designation")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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 = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_article_family"), ChildName = "Designation"
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("SubFamily")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_article_subfamily"), ChildName = "Designation"
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Type")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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    = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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 = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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
                );
        }
Esempio n. 14
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        //Add From Article
        public void Add(fin_article pArticle, Guid pPlaceOid, Guid pTableOid, PriceType pPriceType, decimal pQuantity)
        {
            Add(pArticle, pPlaceOid, pTableOid, pPriceType, pQuantity, null);
        }
Esempio n. 15
0
 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));
 }
Esempio n. 16
0
        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();

            //TK016251 - FrontOffice - Criar novo documento com auto-complete para artigos e clientes
            //Select ArticleCode
            fin_article       articles       = null;
            SortingCollection sortCollection = new SortingCollection();

            sortCollection.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending));
            CriteriaOperator criteria            = CriteriaOperator.Parse(string.Format("(Disabled = 0 OR Disabled IS NULL)"));
            ICollection      collectionCustomers = GlobalFramework.SessionXpo.GetObjects(GlobalFramework.SessionXpo.GetClassInfo(typeof(fin_article)), criteria, sortCollection, int.MaxValue, false, true);

            foreach (fin_article item in collectionCustomers)
            {
                articles = item;
            }
            articles.Code = "";
            CriteriaOperator criteriaOperatorSelectArticle = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1)");

            _entryBoxSelectArticleCode = new XPOEntryBoxSelectRecord <fin_article, TreeViewArticle>(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_article_code"), "Code", "Oid", articles, criteriaOperatorSelectArticle);
            _entryBoxSelectArticleCode.Entry.IsEditable = true;
            _entryBoxSelectArticleCode.WidthRequest     = 149;

            //Add to WidgetList
            _crudWidgetSelectArticleCode = new GenericCRUDWidgetDataTable(_entryBoxSelectArticleCode, _entryBoxSelectArticleCode.Label, _dataSourceRow, "Oid", _regexGuid, true);
            _crudWidgetList.Add(_crudWidgetSelectArticleCode);
            //Used only to Update DataRow Column from Widget : Used to force Assign XPGuidObject ChildNames to Columns
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticleCode, new Label(), _dataSourceRow, "Article.Code"));
            _crudWidgetList.Add(new GenericCRUDWidgetDataTable(_entryBoxSelectArticleCode, new Label(), _dataSourceRow, "Article.Designation"));
            //Events
            _entryBoxSelectArticleCode.ClosePopup += _entryBoxSelectArticleCode_ClosePopup;

            //Select Article Name
            _entryBoxSelectArticle = new XPOEntryBoxSelectRecord <fin_article, TreeViewArticle>(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_article"), "Designation", "Oid", initialValueSelectArticle, criteriaOperatorSelectArticle);
            _entryBoxSelectArticle.Entry.IsEditable = true;

            //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.Money, 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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_price"), KeyboardMode.Money, 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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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); };

            //TotalNet
            _entryBoxValidationTotalNet = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_article_tab"), KeyboardMode.None);/* IN009206 */
            _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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_per_item_vat"), KeyboardMode.None); /* IN009206 */
            _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"));

            //TK016251 - FrontOffice - Criar novo documento com auto-complete para artigos e clientes
            //HBox ArticleCodeAndArticleName
            HBox ArticleCodeAndArticleName = new HBox(false, 0);

            //Invisible, only used to Debug, to View Values in System Currency
            //hboxPriceQuantityDiscountAndTotals.PackStart(_entryBoxValidationPrice, true, true, 0);
            ArticleCodeAndArticleName.PackStart(_entryBoxSelectArticleCode, false, false, 0);
            ArticleCodeAndArticleName.PackStart(_entryBoxSelectArticle, true, true, 0);


            //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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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(ArticleCodeAndArticleName);
            _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;
            }
        }
Esempio n. 17
0
        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(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_stock_movement_out"), article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity)));
                    break;

                case ProcessArticleStockMode.In:
                    FrameworkUtils.Audit("STOCK_MOVEMENT_IN", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "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);
        }