コード例 #1
0
        //Detect if ArticleBag has a "Recharge Article" and Valid "Customer Card" customer
        //Returns true if is valid, or false if is invalidCustomerCardDetected
        public static bool IsCustomerCardValidForArticleBag(ArticleBag pArticleBag, ERP_Customer pCustomer)
        {
            //Default result is true
            bool result = true;

            try
            {
                FIN_Article article;
                foreach (var item in pArticleBag)
                {
                    //Get Article
                    article = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), item.Key.ArticleOid);
                    //Assign Required if ArticleClassCustomerCard Detected
                    if (article.Type.Oid == SettingsApp.XpoOidArticleClassCustomerCard &&
                        (
                            pCustomer.Oid == SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity ||
                            string.IsNullOrEmpty(pCustomer.CardNumber)
                        )
                        )
                    {
                        //Override Default true Result when Invalid Customer is Detected
                        result = false;
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(result);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        //XpoMode
        public TreeViewCustomer(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            //Init Vars
            Type xpoGuidObjectType = typeof(ERP_Customer);
            //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView
            ERP_Customer defaultValue = (pDefaultValue != null) ? pDefaultValue as ERP_Customer : null;
            //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView
            Type typeDialogClass = (pDialogType != null) ? pDialogType : typeof(DialogCustomer);

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

            columnProperties.Add(new GenericTreeViewColumnProperty("Code")
            {
                Title = Resx.global_record_code, MinWidth = 100
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Name")
            {
                Title = Resx.global_name, MinWidth = 200, Expand = true
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("FiscalNumber")
            {
                Title = Resx.global_fiscal_number, MinWidth = 150
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("CardNumber")
            {
                Title = Resx.global_card_number, MinWidth = 150
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("UpdatedAt")
            {
                Title = Resx.global_record_date_updated, MinWidth = 150, MaxWidth = 150
            });

            //Configure Criteria/XPCollection/Model
            //CriteriaOperator.Parse("Code >= 100 and Code <= 9999");
            CriteriaOperator criteria      = pXpoCriteria;
            XPCollection     xpoCollection = new XPCollection(GlobalFramework.SessionXpo, xpoGuidObjectType, criteria);

            //Custom Events
            //WIP: this.CursorChanged += TreeViewCustomer_CursorChanged;

            //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
                );

            //Protected Records
            ProtectedRecords.Add(SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity);//FinalConsumerEntity
        }
コード例 #4
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Customer

        public static ERP_Customer GetFinalConsumerEntity()
        {
            ERP_Customer result = null;

            try
            {
                string filterCriteria = string.Format("Oid = '{0}'", SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity.ToString());
                result = (GetXPGuidObjectFromCriteria(typeof(ERP_Customer), filterCriteria) as ERP_Customer);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(result);
        }
コード例 #5
0
        private void UpdateTouchButtonSplitPaymentLabels(TouchButtonSplitPayment touchButtonSplitPayment)
        {
            bool debug = false;

            try
            {
                string labelPaymentDetails = string.Empty;
                ProcessFinanceDocumentParameter processFinanceDocumentParameter = touchButtonSplitPayment.ProcessFinanceDocumentParameter;

                if (processFinanceDocumentParameter != null)
                {
                    if (debug)
                    {
                        _log.Debug(Environment.NewLine);
                    }
                    foreach (var item in touchButtonSplitPayment.ArticleBag)
                    {
                        if (debug)
                        {
                            _log.Debug(string.Format("\t[{0}],[{1}],[{2}]", item.Key.Designation, item.Value.Quantity, item.Value.TotalFinal));
                        }
                    }

                    ERP_Customer customer = (ERP_Customer)FrameworkUtils.GetXPGuidObject(typeof(ERP_Customer), processFinanceDocumentParameter.Customer);
                    FIN_ConfigurationPaymentMethod paymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), processFinanceDocumentParameter.PaymentMethod);
                    CFG_ConfigurationCurrency      currency      = (CFG_ConfigurationCurrency)FrameworkUtils.GetXPGuidObject(typeof(CFG_ConfigurationCurrency), processFinanceDocumentParameter.Currency);
                    // Compose labelPaymentDetails
                    string totalFinal    = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.ArticleBag.TotalFinal, currency.Acronym);
                    string totalDelivery = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.TotalDelivery, currency.Acronym);
                    string totalChange   = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.TotalChange, currency.Acronym);
                    string moneyExtra    = (paymentMethod.Token.Equals("MONEY")) ? $" : ({totalDelivery}/{totalChange})" : string.Empty;
                    // Override default labelPaymentDetails
                    labelPaymentDetails = $"{customer.Name} : {paymentMethod.Designation} : {totalFinal}{moneyExtra}";
                }
                // Assign to button Reference
                touchButtonSplitPayment.LabelPaymentDetails.Text = labelPaymentDetails;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #6
0
        public void Load()
        {
            //Get From Session if Exists
            object supplier       = GlobalFramework.SessionApp.GetToken(string.Format("{0}_{1}", this.GetType().Name, "supplier").ToUpper());
            object documentDate   = GlobalFramework.SessionApp.GetToken(string.Format("{0}_{1}", this.GetType().Name, "documentDate").ToUpper());
            object documentNumber = GlobalFramework.SessionApp.GetToken(string.Format("{0}_{1}", this.GetType().Name, "documentNumber").ToUpper());

            //Assign if Valid
            try
            {
                if (supplier != null)
                {
                    _initialSupplier = (ERP_Customer)GlobalFramework.SessionXpo.GetObjectByKey(typeof(ERP_Customer), new Guid(supplier.ToString()));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            try
            {
                _initialDocumentDate = (documentDate != null) ? Convert.ToDateTime(documentDate) : FrameworkUtils.CurrentDateTimeAtomic();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            try
            {
                _initialDocumentNumber = (documentNumber != null) ? Convert.ToString(documentNumber) : string.Empty;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #7
0
        private ProcessFinanceDocumentParameter GetFinanceDocumentParameter()
        {
            //Always Recreate ArticleBag before contruct ProcessFinanceDocumentParameter
            _pagePad3.ArticleBag = GetArticleBag();

            ERP_Customer customer    = null;
            bool         wayBillMode = _pagePad1.EntryBoxSelectDocumentFinanceType.Value.WayBill;

            object resultObject;

            resultObject = Utils.SaveOrUpdateCustomer(
                this,
                _pagePad2.EntryBoxSelectCustomerName.Value,
                _pagePad2.EntryBoxSelectCustomerName.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerAddress.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerLocality.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerZipCode.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerCity.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerPhone.EntryValidation.Text,
                _pagePad2.EntryBoxCustomerEmail.EntryValidation.Text,
                _pagePad2.EntryBoxSelectCustomerCountry.Value,
                _pagePad2.EntryBoxSelectCustomerFiscalNumber.EntryValidation.Text,
                _pagePad2.EntryBoxSelectCustomerCardNumber.EntryValidation.Text,
                FrameworkUtils.StringToDecimal(_pagePad2.EntryBoxCustomerDiscount.EntryValidation.Text),
                _pagePad2.EntryBoxCustomerNotes.EntryValidation.Text
                );

            if (resultObject.GetType() == typeof(ERP_Customer))
            {
                customer = (ERP_Customer)resultObject;
            }
            else
            {
                //If error in Save or Update Customer
                if (resultObject.GetType() == typeof(ConstraintViolationException))
                {
                    Exception    ex       = (Exception)resultObject;
                    ResponseType response = Utils.ShowMessageTouch(_sourceWindow, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Warning, ButtonsType.Close, Resx.window_title_dialog_exception_error, ex.InnerException.Message);
                }
                customer = null;
            }

            //Construct ProcessFinanceDocumentParameter
            ProcessFinanceDocumentParameter result = new ProcessFinanceDocumentParameter(
                _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid, _pagePad3.ArticleBag
                )
            {
                Customer = (customer != null) ? customer.Oid : Guid.Empty,
            };

            //PaymentConditions
            if (_pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value != null &&
                _pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value.Oid != new Guid())
            {
                result.PaymentCondition = _pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value.Oid;
            }

            //PaymentMethod
            if (_pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value != null &&
                _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value.Oid != new Guid())
            {
                result.PaymentMethod = _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value.Oid;
            }

            //TotalDelivery: If Money force TotalDelivery to be equal to TotalFinal
            if (result.PaymentMethod != null && result.PaymentMethod != new Guid())
            {
                FIN_ConfigurationPaymentMethod paymentMethod = (FIN_ConfigurationPaymentMethod)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationPaymentMethod), result.PaymentMethod);
                if (paymentMethod.Token == "MONEY")
                {
                    result.TotalDelivery = _pagePad3.ArticleBag.TotalFinal;
                }
            }

            //Currency
            if (_pagePad1.EntryBoxSelectConfigurationCurrency.Value.Oid != new Guid())
            {
                result.Currency     = _pagePad1.EntryBoxSelectConfigurationCurrency.Value.Oid;
                result.ExchangeRate = (_pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate == 0) ? 1 : _pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate;
            }

            //DocumentParent
            if (_pagePad1.EntryBoxSelectSourceDocumentFinance.Value != null && _pagePad1.EntryBoxSelectSourceDocumentFinance.Value.Oid != new Guid())
            {
                result.DocumentParent = _pagePad1.EntryBoxSelectSourceDocumentFinance.Value.Oid;
            }

            //SourceMode
            result.SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag;

            //Not Used
            //SourceOrderMain : Dont have a OrderMain Source
            //FinanceDocuments
            //TotalChange

            //OrderReferences
            if (_pagePad1.EntryBoxSelectSourceDocumentFinance.Value != null)
            {
                List <FIN_DocumentFinanceMaster> orderReferences = new List <FIN_DocumentFinanceMaster>();
                orderReferences.Add(_pagePad1.EntryBoxSelectSourceDocumentFinance.Value);
                result.OrderReferences = orderReferences;
            }

            //If in WayBillMode Assign ShipTo and ShipFrom
            if (wayBillMode)
            {
                //ShipTo: Not Used : Address, BuildingNumber, StreetName
                result.ShipTo = new MovementOfGoodsProperties();
                if (_pagePad4.EntryBoxShipToDeliveryID.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.DeliveryID = _pagePad4.EntryBoxShipToDeliveryID.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToDeliveryDate.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.DeliveryDate = Convert.ToDateTime(_pagePad4.EntryBoxShipToDeliveryDate.EntryValidation.Text);
                }
                if (_pagePad4.EntryBoxShipToWarehouseID.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.WarehouseID = _pagePad4.EntryBoxShipToWarehouseID.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToLocationID.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.LocationID = _pagePad4.EntryBoxShipToLocationID.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToAddressDetail.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.AddressDetail = _pagePad4.EntryBoxShipToAddressDetail.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToCity.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.City = _pagePad4.EntryBoxShipToCity.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToPostalCode.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.PostalCode = _pagePad4.EntryBoxShipToPostalCode.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxShipToRegion.EntryValidation.Text != string.Empty)
                {
                    result.ShipTo.Region = _pagePad4.EntryBoxShipToRegion.EntryValidation.Text;
                }
                if (_pagePad4.EntryBoxSelectShipToCountry.Value.Oid != new Guid())
                {
                    result.ShipTo.Country     = _pagePad4.EntryBoxSelectShipToCountry.Value.Code2;
                    result.ShipTo.CountryGuid = _pagePad4.EntryBoxSelectShipToCountry.Value.Oid;
                }
                //ShipFrom: Not Used : Address, BuildingNumber, StreetName
                result.ShipFrom = new MovementOfGoodsProperties();
                if (_pagePad5.EntryBoxShipFromDeliveryID.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.DeliveryID = _pagePad5.EntryBoxShipFromDeliveryID.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromDeliveryDate.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.DeliveryDate = Convert.ToDateTime(_pagePad5.EntryBoxShipFromDeliveryDate.EntryValidation.Text);
                }
                if (_pagePad5.EntryBoxShipFromWarehouseID.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.WarehouseID = _pagePad5.EntryBoxShipFromWarehouseID.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromLocationID.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.LocationID = _pagePad5.EntryBoxShipFromLocationID.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromAddressDetail.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.AddressDetail = _pagePad5.EntryBoxShipFromAddressDetail.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromCity.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.City = _pagePad5.EntryBoxShipFromCity.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromPostalCode.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.PostalCode = _pagePad5.EntryBoxShipFromPostalCode.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxShipFromRegion.EntryValidation.Text != string.Empty)
                {
                    result.ShipFrom.Region = _pagePad5.EntryBoxShipFromRegion.EntryValidation.Text;
                }
                if (_pagePad5.EntryBoxSelectShipFromCountry.Value.Oid != new Guid())
                {
                    result.ShipFrom.Country     = _pagePad5.EntryBoxSelectShipFromCountry.Value.Code2;
                    result.ShipFrom.CountryGuid = _pagePad5.EntryBoxSelectShipFromCountry.Value.Oid;
                }
            }

            //Notes
            if (_pagePad1.EntryBoxDocumentMasterNotes.EntryValidation.Text != string.Empty)
            {
                result.Notes = _pagePad1.EntryBoxDocumentMasterNotes.EntryValidation.Text;
            }

            return(result);
        }
コード例 #8
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(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);
        }
コード例 #9
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));
 }
コード例 #10
0
        /// <summary>
        /// If ProcessArticleStockMode.None
        /// </summary>
        public static bool Add(
            FIN_DocumentFinanceMaster pDocumentFinanceMaster,
            // Used to force ReverseStockMode, used in cancel Documents to restore Stocks
            bool pReverseStockMode = false
            )
        {
            //Log4Net
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            bool result = false;
            int  ord    = 0;

            // Check if Works with Stock
            ProcessArticleStockMode mode = (pDocumentFinanceMaster.DocumentType.StockMode > 0)
                ? (ProcessArticleStockMode)pDocumentFinanceMaster.DocumentType.StockMode
                : ProcessArticleStockMode.None
            ;

            try
            {
                //Only Process if has a Valid Mode and a valid article Class
                if (mode != ProcessArticleStockMode.None)
                {
                    // ReverseStockMode : Used for ex when we cancal Finance Documents to Restore/Revert Stock
                    if (pReverseStockMode && mode.Equals(ProcessArticleStockMode.Out))
                    {
                        mode = ProcessArticleStockMode.In;
                    }
                    else if (pReverseStockMode && mode.Equals(ProcessArticleStockMode.In))
                    {
                        mode = ProcessArticleStockMode.Out;
                    }

                    using (UnitOfWork uowSession = new UnitOfWork())
                    {
                        try
                        {
                            //Get Objects in same Session
                            FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)uowSession.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), pDocumentFinanceMaster.Oid);
                            ERP_Customer customer = (ERP_Customer)uowSession.GetObjectByKey(typeof(ERP_Customer), pDocumentFinanceMaster.EntityOid);

                            foreach (FIN_DocumentFinanceDetail item in documentFinanceMaster.DocumentDetail)
                            {
                                //Check if article works in Stock
                                if (item.Article.Class.WorkInStock)
                                {
                                    //Increment Order
                                    ord += 10;
                                    Add(
                                        uowSession,
                                        mode, item,
                                        customer, ord, documentFinanceMaster.Date, documentFinanceMaster.DocumentNumber,
                                        item.Article,
                                        // ReverseStock
                                        item.Quantity,
                                        item.Notes
                                        );
                                }
                            }
                            uowSession.CommitChanges();
                        }
                        catch (Exception ex)
                        {
                            uowSession.RollbackTransaction();
                            log.Error(ex.Message, ex);
                        }
                    }
                    result = true;
                }
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
            }

            return(result);
        }
コード例 #11
0
        public PosDocumentFinanceArticleDialog(Window pSourceWindow, GenericTreeViewDataTable pTreeView, DialogFlags pDialogFlags, DialogMode pDialogMode, DataRow pDataSourceRow)
            : base(pSourceWindow, pDialogFlags, pDialogMode, pDataSourceRow)
        {
            //Parameters
            _sourceWindow  = pSourceWindow;
            _dialogMode    = pDialogMode;
            _dataSourceRow = pDataSourceRow;
            //References
            _posDocumentFinanceDialog = (_sourceWindow as PosDocumentFinanceDialog);
            _currencyDisplay          = (_posDocumentFinanceDialog.PagePad.Pages[0] as DocumentFinanceDialogPage1).EntryBoxSelectConfigurationCurrency.Value;
            //Require to Update ExchangeRate after create Database
            _currencyDisplay.Reload();

            //Get Reference for documentFinanceType
            _documentFinanceType = ((_sourceWindow as PosDocumentFinanceDialog).PagePad.Pages[0] as DocumentFinanceDialogPage1).EntryBoxSelectDocumentFinanceType.Value;

            //Init Local Vars
            String windowTitle = Resx.window_title_edit_article;

            //Get Default System Currency
            _currencyDefaultSystem = SettingsApp.ConfigurationSystemCurrency;
            //Consignation Invoice default values
            _vatRateConsignationInvoice = (FIN_ConfigurationVatRate)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationVatRate), SettingsApp.XpoOidConfigurationVatRateDutyFree);
            _vatRateConsignationInvoiceExemptionReason = (FIN_ConfigurationVatExemptionReason)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationVatExemptionReason), SettingsApp.XpoOidConfigurationVatExemptionReasonM99);

            //TODO:THEME
            _windowSize = new Size(760, 360);

            String fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_finance_article.png");

            //Get Discount from Select Customer
            _discountGlobal = FrameworkUtils.StringToDecimal(((pSourceWindow as PosDocumentFinanceDialog).PagePad.Pages[1] as DocumentFinanceDialogPage2).EntryBoxCustomerDiscount.EntryValidation.Text);
            //Get PriceType from Customer
            var customerObject = ((pSourceWindow as PosDocumentFinanceDialog).PagePad.Pages[1] as DocumentFinanceDialogPage2).EntryBoxSelectCustomerName;

            if (customerObject.Value != null)
            {
                Guid customerOid = customerObject.Value.Oid;
                _customer = (ERP_Customer)GlobalFramework.SessionXpo.GetObjectByKey(typeof(ERP_Customer), customerOid);
            }

            //ActionArea Buttons
            _buttonOk     = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok);
            _buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);

            //ActionArea
            ActionAreaButtons actionAreaButtons = new ActionAreaButtons();

            actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok));
            actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel));

            //Init Content
            Fixed fixedContent = new Fixed();

            //Init Transport Documents Lists
            _listSaftDocumentType.Add(SettingsApp.XpoOidDocumentFinanceTypeDeliveryNote.ToString());
            _listSaftDocumentType.Add(SettingsApp.XpoOidDocumentFinanceTypeTransportationGuide.ToString());
            _listSaftDocumentType.Add(SettingsApp.XpoOidDocumentFinanceTypeOwnAssetsDriveGuide.ToString());
            _listSaftDocumentType.Add(SettingsApp.XpoOidDocumentFinanceTypeConsignmentGuide.ToString());
            _listSaftDocumentType.Add(SettingsApp.XpoOidDocumentFinanceTypeReturnGuide.ToString());

            //Init Components
            InitUI();

            //Put
            fixedContent.Put(_vboxEntrys, 0, 0);

            //Init Object
            this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, _windowSize, fixedContent, actionAreaButtons);
        }
コード例 #12
0
        /// <summary>
        /// Generate Fast Report Business Objects for ProcessReportFinanceDocument
        /// </summary>
        public static ResultFRBODocumentFinanceMaster GetFRBOFinanceDocument(Guid pDocumentFinanceMasterOid)
        {
            ResultFRBODocumentFinanceMaster result = new ResultFRBODocumentFinanceMaster();

            try
            {
                FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(FIN_DocumentFinanceMaster), pDocumentFinanceMasterOid);

                bool retificationDocuments = (
                    documentFinanceMaster.DocumentType.Oid == SettingsApp.XpoOidDocumentFinanceTypeCreditNote
                    );

                string sqlFilter = string.Format("fmOid = '{0}'", documentFinanceMaster.Oid.ToString());

                //Prepare and Declare FRBOGenericCollections : Limit 1, One Record (Document Master), else we get All Details to (View)
                FRBOGenericCollection <FRBODocumentFinanceMasterView>      gcDocumentFinanceMaster = new FRBOGenericCollection <FRBODocumentFinanceMasterView>(sqlFilter, 1);
                FRBOGenericCollection <FRBODocumentFinanceDetail>          gcDocumentFinanceDetail;
                FRBOGenericCollection <FRBODocumentFinanceMasterTotalView> gcDocumentFinanceMasterTotal;

                //Override Default Values

                //If Simplified Invoice - Remove Customer Details (If System Country Equal to PT)
                if (
                    (
                        SettingsApp.XpoOidConfigurationCountryPortugal == SettingsApp.ConfigurationSystemCountry.Oid &&
                        new Guid(gcDocumentFinanceMaster.List[0].DocumentType) == SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice
                    )
                    //Added
                    || FrameworkUtils.GetFinalConsumerEntity().Oid.ToString() == gcDocumentFinanceMaster.List[0].EntityOid
                    //Removed This Way we only clean Entity data if is a SimplifiedInvoice, to protect Hidden Entitys with FinanceFinalConsumerFiscalNumber
                    //|| (
                    //    gcDocumentFinanceMaster.List[0].EntityFiscalNumber == SettingsApp.FinanceFinalConsumerFiscalNumber
                    //)
                    )
                {
                    gcDocumentFinanceMaster.List[0].EntityName    = string.Empty;
                    gcDocumentFinanceMaster.List[0].EntityAddress = string.Empty;
                    gcDocumentFinanceMaster.List[0].EntityZipCode = string.Empty;
                    gcDocumentFinanceMaster.List[0].EntityCity    = string.Empty;
                    gcDocumentFinanceMaster.List[0].EntityCountry = string.Empty;
                }

                //Detect if is FinalConsumer with FiscalNumber 999999990 and Hide it
                ERP_Customer customer = (ERP_Customer)GlobalFramework.SessionXpo.GetObjectByKey(typeof(ERP_Customer), SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity);
                if (gcDocumentFinanceMaster.List[0].EntityFiscalNumber == customer.FiscalNumber)
                {
                    gcDocumentFinanceMaster.List[0].EntityFiscalNumber = SettingsApp.FinanceFinalConsumerFiscalNumberDisplay;
                }

                //Detect if is Retification Document (ND/NC) and add SourceDocument to Show on Notes
                if (!string.IsNullOrEmpty(gcDocumentFinanceMaster.List[0].ATDocCodeID))
                {
                    string notes = string.Format("{0} : {1}", Resx.global_at_atdoccodeid, gcDocumentFinanceMaster.List[0].ATDocCodeID);
                    if (!string.IsNullOrEmpty(gcDocumentFinanceMaster.List[0].Notes))
                    {
                        notes += " | " /*Environment.NewLine*/;
                    }
                    notes += gcDocumentFinanceMaster.List[0].Notes;
                    gcDocumentFinanceMaster.List[0].Notes = notes;
                }

                //Detect if is Retification Document (ND/NC) and add SourceDocument to Show on Notes
                if (retificationDocuments)
                {
                    string notes = string.Format("{0} : {1}", Resx.global_source_document, documentFinanceMaster.DocumentParent.DocumentNumber);
                    if (!string.IsNullOrEmpty(gcDocumentFinanceMaster.List[0].Notes))
                    {
                        notes += " | " /*Environment.NewLine*/;
                    }
                    notes += gcDocumentFinanceMaster.List[0].Notes;
                    gcDocumentFinanceMaster.List[0].Notes = notes;
                }

                //Render Child Bussiness Objects
                foreach (FRBODocumentFinanceMasterView documentMaster in gcDocumentFinanceMaster)
                {
                    //Get FinanceDetail
                    gcDocumentFinanceDetail = new FRBOGenericCollection <FRBODocumentFinanceDetail>(string.Format("DocumentMaster = '{0}'", documentMaster.Oid), "Ord");
                    documentMaster.DocumentFinanceDetail = gcDocumentFinanceDetail.List;

                    //Get FinanceMasterTotals
                    gcDocumentFinanceMasterTotal = new FRBOGenericCollection <FRBODocumentFinanceMasterTotalView>(string.Format("fmtDocumentMaster = '{0}'", documentMaster.Oid), "Value");
                    documentMaster.DocumentFinanceMasterTotal = gcDocumentFinanceMasterTotal.List;
                }

                result.DocumentFinanceMaster = gcDocumentFinanceMaster;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(result);
        }
コード例 #13
0
        private void InitUI()
        {
            try
            {
                //Init Local Vars
                _configurationCountry = (_dataSourceRow as ERP_Customer).Country;

                if (_dialogMode != DialogMode.Insert)
                {
                    _customer = (_dataSourceRow as ERP_Customer);
                    string sql       = string.Format("SELECT COUNT(*) as Count FROM fin_documentfinancemaster WHERE EntityFiscalNumber = '{0}';", _customer.FiscalNumber);
                    var    sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql);
                    _totalNumberOfFinanceDocuments = Convert.ToUInt16(sqlResult);
                    if (_customer.Oid == SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity)
                    {
                        _isFinalConsumerEntity = true;
                    }
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                //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.RegexIntegerGreaterThanZero, true));

                //Name
                Entry       entryName = new Entry();
                BOWidgetBox boxName   = new BOWidgetBox(Resx.global_name, entryName);
                vboxTab1.PackStart(boxName, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxName, _dataSourceRow, "Name", SettingsApp.RegexAlfaNumericExtended, true));

                //FiscalNumber
                _entryFiscalNumber = new Entry();
                BOWidgetBox boxFiscalNumber = new BOWidgetBox(Resx.global_fiscal_number, _entryFiscalNumber);
                vboxTab1.PackStart(boxFiscalNumber, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFiscalNumber, _dataSourceRow, "FiscalNumber", _configurationCountry.RegExFiscalNumber, false));

                //Discount
                Entry       entryDiscount = new Entry();
                BOWidgetBox boxDiscount   = new BOWidgetBox(Resx.global_discount, entryDiscount);
                vboxTab1.PackStart(boxDiscount, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, true));

                //PriceType
                XPOComboBox xpoComboBoxPriceType = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationPriceType), (DataSourceRow as ERP_Customer).PriceType, "Designation");
                BOWidgetBox boxPriceType         = new BOWidgetBox(Resx.global_price_type, xpoComboBoxPriceType);
                vboxTab1.PackStart(boxPriceType, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPriceType, DataSourceRow, "PriceType", SettingsApp.RegexGuid, true));

                //CustomerType
                XPOComboBox xpoComboBoxCustomerType = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerType), (DataSourceRow as ERP_Customer).CustomerType, "Designation");
                BOWidgetBox boxCustomerType         = new BOWidgetBox(Resx.global_customer_types, xpoComboBoxCustomerType);
                vboxTab1.PackStart(boxCustomerType, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCustomerType, DataSourceRow, "CustomerType", SettingsApp.RegexGuid, true));

                ////DISABLED : DiscountGroup
                //XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as ERP_Customer).DiscountGroup, "Designation");
                //BOWidgetBox boxDiscountGroup = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup);
                //vboxTab1.PackStart(boxDiscountGroup, false, false, 0);
                //_crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, true));

                //Supplier
                CheckButton checkButtonSupplier = new CheckButton(Resx.global_supplier);
                vboxTab1.PackStart(checkButtonSupplier, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonSupplier, _dataSourceRow, "Supplier"));

                //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

                VBox vboxTab2 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //Address
                Entry       entryAddress = new Entry();
                BOWidgetBox boxAddress   = new BOWidgetBox(Resx.global_address, entryAddress);
                vboxTab2.PackStart(boxAddress, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAddress, _dataSourceRow, "Address", SettingsApp.RegexAlfaNumericExtended, false));

                //Locality
                Entry       entryLocality = new Entry();
                BOWidgetBox boxLocality   = new BOWidgetBox(Resx.global_locality, entryLocality);
                vboxTab2.PackStart(boxLocality, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLocality, _dataSourceRow, "Locality", SettingsApp.RegexAlfaNumericExtended, false));

                //ZipCode
                _entryZipCode = new Entry()
                {
                    WidthRequest = 100
                };;
                BOWidgetBox boxZipCode = new BOWidgetBox(Resx.global_zipcode, _entryZipCode);
                vboxTab2.PackStart(boxZipCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxZipCode, _dataSourceRow, "ZipCode", _configurationCountry.RegExZipCode, false));

                //City
                Entry       entryCity = new Entry();
                BOWidgetBox boxCity   = new BOWidgetBox(Resx.global_city, entryCity);
                vboxTab2.PackStart(boxCity, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCity, _dataSourceRow, "City", SettingsApp.RegexAlfaNumericExtended, false));

                //Hbox ZipCode and City
                HBox hboxZipCodeAndCity = new HBox(false, _boxSpacing);
                hboxZipCodeAndCity.PackStart(boxZipCode, true, true, 0);
                hboxZipCodeAndCity.PackStart(boxCity, true, true, 0);
                vboxTab2.PackStart(hboxZipCodeAndCity, false, false, 0);

                //CountrySortProperty
                SortProperty[] sortPropertyCountry = new SortProperty[1];
                sortPropertyCountry[0] = new SortProperty("Designation", SortingDirection.Ascending);
                //Country
                _xpoComboBoxCountry = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationCountry), (DataSourceRow as ERP_Customer).Country, "Designation", null, sortPropertyCountry);
                BOWidgetBox boxCountry = new BOWidgetBox(Resx.global_country, _xpoComboBoxCountry);
                vboxTab2.PackStart(boxCountry, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCountry, DataSourceRow, "Country", SettingsApp.RegexGuid, true));

                //Phone
                Entry       entryPhone = new Entry();
                BOWidgetBox boxPhone   = new BOWidgetBox(Resx.global_phone, entryPhone);
                vboxTab2.PackStart(boxPhone, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPhone, _dataSourceRow, "Phone", SettingsApp.RegexAlfaNumericExtended, false));

                //MobilePhone
                Entry       entryMobilePhone = new Entry();
                BOWidgetBox boxMobilePhone   = new BOWidgetBox(Resx.global_mobile_phone, entryMobilePhone);
                vboxTab2.PackStart(boxMobilePhone, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxMobilePhone, _dataSourceRow, "MobilePhone", SettingsApp.RegexAlfaNumericExtended, false));

                //Hbox Phone and MobilePhone
                HBox hboxPhoneAndMobilePhone = new HBox(false, _boxSpacing);
                hboxPhoneAndMobilePhone.PackStart(boxPhone, true, true, 0);
                hboxPhoneAndMobilePhone.PackStart(boxMobilePhone, true, true, 0);
                vboxTab2.PackStart(hboxPhoneAndMobilePhone, false, false, 0);

                //Fax
                Entry       entryFax = new Entry();
                BOWidgetBox boxFax   = new BOWidgetBox(Resx.global_fax, entryFax);
                vboxTab2.PackStart(boxFax, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFax, _dataSourceRow, "Fax", SettingsApp.RegexAlfaNumericExtended, false));

                //Email
                Entry       entryEmail = new Entry();
                BOWidgetBox boxEmail   = new BOWidgetBox(Resx.global_email, entryEmail);
                vboxTab2.PackStart(boxEmail, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxEmail, _dataSourceRow, "Email", SettingsApp.RegexEmail, false));

                //Hbox Fax and Email
                HBox hboxFaxAndEmail = new HBox(false, _boxSpacing);
                hboxFaxAndEmail.PackStart(boxFax, true, true, 0);
                hboxFaxAndEmail.PackStart(boxEmail, true, true, 0);
                vboxTab2.PackStart(hboxFaxAndEmail, false, false, 0);

                //Append Tab
                _notebook.AppendPage(vboxTab2, new Label(Resx.global_contacts));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                //Tab3

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

                //CardNumber
                Entry       entryCardNumber = new Entry();
                BOWidgetBox boxCardNumber   = new BOWidgetBox(Resx.global_card_number, entryCardNumber);
                vboxTab3.PackStart(boxCardNumber, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardNumber, _dataSourceRow, "CardNumber", SettingsApp.RegexAlfaNumericExtended, false));

                //CardCredit
                Entry       entryCardCredit = new Entry();
                BOWidgetBox boxCardCredit   = new BOWidgetBox(Resx.global_card_credit_amount, entryCardCredit);
                vboxTab3.PackStart(boxCardCredit, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardCredit, _dataSourceRow, "CardCredit", SettingsApp.RegexDecimalGreaterEqualThanZero, false));

                //DateOfBirth
                Entry       entryDateOfBirth = new Entry();
                BOWidgetBox boxDateOfBirth   = new BOWidgetBox(Resx.global_dob, entryDateOfBirth);
                vboxTab3.PackStart(boxDateOfBirth, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDateOfBirth, _dataSourceRow, "DateOfBirth", SettingsApp.RegexDate, false));

                //Append Tab
                _notebook.AppendPage(vboxTab3, new Label(Resx.global_others));

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

                //Disable Components
                entryName.Sensitive           = GetEntryNameSensitiveValue();
                entryCardCredit.Sensitive     = false;
                _entryFiscalNumber.Sensitive  = GetEntryFiscalNumberSensitiveValue();
                _xpoComboBoxCountry.Sensitive = GetEntryFiscalNumberSensitiveValue();

                //Get References to GenericCRUDWidgetXPO
                _genericCRUDWidgetXPOFiscalNumber = (_crudWidgetList.GetFieldWidget("FiscalNumber") as GenericCRUDWidgetXPO);
                _genericCRUDWidgetXPOZipCode      = (_crudWidgetList.GetFieldWidget("ZipCode") as GenericCRUDWidgetXPO);
                //Call Validation
                _genericCRUDWidgetXPOFiscalNumber.ValidateField(ValidateFiscalNumberFunc);

                //Update Components
                UpdateCountryRegExComponents();

                //Events
                _entryFiscalNumber.Changed  += delegate { ValidateFiscalNumber(); };
                _xpoComboBoxCountry.Changed += delegate { UpdateCountryRegExComponents(); };
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #14
0
        public PosPaymentsDialog(Window pSourceWindow, DialogFlags pDialogFlags, ArticleBag pArticleBag, bool pEnablePartialPaymentButtons, bool pEnableCurrentAccountButton, bool pSkipPersistFinanceDocument, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter, string pSelectedPaymentMethodButtonName)
            : base(pSourceWindow, pDialogFlags, false)
        {
            try
            {
                //Init Local Vars
                _sourceWindow = pSourceWindow;
                string windowTitle = Resx.window_title_dialog_payments;
                //TODO:THEME
                Size   windowSize            = new Size(598, 620);
                string fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_payments.png");

                //Parameters
                _articleBagFullPayment           = pArticleBag;
                _skipPersistFinanceDocument      = pSkipPersistFinanceDocument;
                _processFinanceDocumentParameter = pProcessFinanceDocumentParameter;
                bool enablePartialPaymentButtons = pEnablePartialPaymentButtons;
                bool enableCurrentAccountButton  = pEnableCurrentAccountButton;
                if (enablePartialPaymentButtons)
                {
                    enablePartialPaymentButtons = (_articleBagFullPayment.TotalQuantity > 1) ? true : false;
                }
                //Files
                string fileIconClearCustomer  = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_nav_delete.png");
                string fileIconFullPayment    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_full.png");
                string fileIconPartialPayment = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_partial.png");
                //Colors
                Color colorPosPaymentsDialogTotalPannelBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosPaymentsDialogTotalPannelBackground"]);
                //Objects
                _intialValueConfigurationCountry = SettingsApp.ConfigurationSystemCountry;

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                //Payment Buttons
                //Get Custom Select Data
                string       executeSql   = @"SELECT Oid, Token, ResourceString FROM fin_configurationpaymentmethod ORDER BY Ord;";
                XPSelectData xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(executeSql);
                //Get Required XpObjects from Selected Data
                FIN_ConfigurationPaymentMethod xpoMoney          = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "MONEY");
                FIN_ConfigurationPaymentMethod xpoCheck          = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "BANK_CHECK");
                FIN_ConfigurationPaymentMethod xpoMB             = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CASH_MACHINE");
                FIN_ConfigurationPaymentMethod xpoCreditCard     = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CREDIT_CARD");
                FIN_ConfigurationPaymentMethod xpoVisa           = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "VISA");
                FIN_ConfigurationPaymentMethod xpoCurrentAccount = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CURRENT_ACCOUNT");
                FIN_ConfigurationPaymentMethod xpoCustomerCard   = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CUSTOMER_CARD");

                //Instantiate Buttons
                TouchButtonIconWithText buttonMoney = new TouchButtonIconWithText("touchButtonMoney_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMoney.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMoney.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoMoney.Oid, Sensitive = (xpoMoney.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCheck = new TouchButtonIconWithText("touchButtonCheck_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCheck.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCheck.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCheck.Oid, Sensitive = (xpoCheck.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonMB = new TouchButtonIconWithText("touchButtonMB_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMB.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMB.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoMB.Oid, Sensitive = (xpoMB.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCreditCard = new TouchButtonIconWithText("touchButtonCreditCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCreditCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCreditCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCreditCard.Oid, Sensitive = (xpoCreditCard.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonVisa = new TouchButtonIconWithText("touchButtonVisa_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoVisa.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoVisa.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoVisa.Oid, Sensitive = (xpoVisa.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCurrentAccount = new TouchButtonIconWithText("touchButtonCurrentAccount_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCurrentAccount.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCurrentAccount.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCurrentAccount.Oid, Sensitive = (xpoCurrentAccount.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCustomerCard = new TouchButtonIconWithText("touchButtonCustomerCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCustomerCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCustomerCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCustomerCard.Oid, Sensitive = (xpoCustomerCard.Disabled) ? false : true
                };
                //Secondary Buttons
                //Events
                buttonMoney.Clicked          += buttonMoney_Clicked;
                buttonCheck.Clicked          += buttonCheck_Clicked;
                buttonMB.Clicked             += buttonMB_Clicked;
                buttonCreditCard.Clicked     += buttonCredit_Clicked;
                buttonVisa.Clicked           += buttonVisa_Clicked;
                buttonCurrentAccount.Clicked += buttonCurrentAccount_Clicked;
                buttonCustomerCard.Clicked   += buttonCustomerCard_Clicked;

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

                //Table
                uint  tablePaymentsPadding = 0;
                Table tablePayments        = new Table(2, 3, true)
                {
                    BorderWidth = 2
                };
                //Row 1
                tablePayments.Attach(buttonMoney, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonMB, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonVisa, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                //Row 2
                tablePayments.Attach(buttonCheck, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonCreditCard, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                if (enableCurrentAccountButton)
                {
                    tablePayments.Attach(
                        (SettingsApp.PosPaymentsDialogUseCurrentAccount) ? buttonCurrentAccount : buttonCustomerCard
                        , 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding
                        );
                }

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

                //Labels
                Label labelTotal    = new Label(Resx.global_total_price_to_pay + ":");
                Label labelDelivery = new Label(Resx.global_total_deliver + ":");
                Label labelChange   = new Label(Resx.global_total_change + ":");
                _labelTotalValue = new Label(FrameworkUtils.DecimalToStringCurrency(_articleBagFullPayment.TotalFinal))
                {
                    //Total Width
                    WidthRequest = 120
                };
                _labelDeliveryValue = new Label(FrameworkUtils.DecimalToStringCurrency(0));
                _labelChangeValue   = new Label(FrameworkUtils.DecimalToStringCurrency(0));

                //Colors
                labelTotal.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelDelivery.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelChange.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                _labelTotalValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelDeliveryValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelChangeValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));

                //Alignments
                labelTotal.SetAlignment(0, 0.5F);
                labelDelivery.SetAlignment(0, 0.5F);
                labelChange.SetAlignment(0, 0.5F);
                _labelTotalValue.SetAlignment(1, 0.5F);
                _labelDeliveryValue.SetAlignment(1, 0.5F);
                _labelChangeValue.SetAlignment(1, 0.5F);

                //labels Font
                Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Bold 10");
                labelTotal.ModifyFont(fontDescription);
                labelDelivery.ModifyFont(fontDescription);
                labelChange.ModifyFont(fontDescription);
                Pango.FontDescription fontDescriptionValue = Pango.FontDescription.FromString("Bold 12");
                _labelTotalValue.ModifyFont(fontDescriptionValue);
                _labelDeliveryValue.ModifyFont(fontDescriptionValue);
                _labelChangeValue.ModifyFont(fontDescriptionValue);

                //Table TotalPannel
                uint  totalPannelPadding = 9;
                Table tableTotalPannel   = new Table(3, 2, false);
                tableTotalPannel.HeightRequest = 132;
                //Row 1
                tableTotalPannel.Attach(labelTotal, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelTotalValue, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 2
                tableTotalPannel.Attach(labelDelivery, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelDeliveryValue, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 3
                tableTotalPannel.Attach(labelChange, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelChangeValue, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);

                //TotalPannel
                EventBox eventboxTotalPannel = new EventBox();
                eventboxTotalPannel.BorderWidth = 3;
                eventboxTotalPannel.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorPosPaymentsDialogTotalPannelBackground));
                eventboxTotalPannel.Add(tableTotalPannel);

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

                //Customer Name
                CriteriaOperator criteriaOperatorCustomerName = null;
                _entryBoxSelectCustomerName             = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_customer, "Name", "Name", null, criteriaOperatorCustomerName, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumeric, false);
                _entryBoxSelectCustomerName.ClosePopup += delegate
                {
                    GetCustomerDetails("Oid", _entryBoxSelectCustomerName.Value.Oid.ToString());
                    Validate();
                };
                _entryBoxSelectCustomerName.EntryValidation.Changed += _entryBoxSelectCustomerName_Changed;

                //Customer Discount
                _entryBoxCustomerDiscount = new EntryBoxValidation(_sourceWindow, Resx.global_discount, KeyboardMode.Alfa, SettingsApp.RegexPercentage, true);
                _entryBoxCustomerDiscount.EntryValidation.Text           = FrameworkUtils.DecimalToString(0.0m);
                _entryBoxCustomerDiscount.EntryValidation.Sensitive      = false;
                _entryBoxCustomerDiscount.EntryValidation.Changed       += _entryBoxCustomerDiscount_Changed;
                _entryBoxCustomerDiscount.EntryValidation.FocusOutEvent += delegate
                {
                    _entryBoxCustomerDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxCustomerDiscount.EntryValidation.Text);
                };

                //Address
                _entryBoxCustomerAddress = new EntryBoxValidation(this, Resx.global_address, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxCustomerAddress.EntryValidation.Changed += delegate { Validate(); };

                //Locality
                _entryBoxCustomerLocality = new EntryBoxValidation(this, Resx.global_locality, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
                _entryBoxCustomerLocality.EntryValidation.Changed += delegate { Validate(); };

                //ZipCode
                _entryBoxCustomerZipCode = new EntryBoxValidation(this, Resx.global_zipcode, KeyboardMode.Alfa, SettingsApp.ConfigurationSystemCountry.RegExZipCode, false);
                _entryBoxCustomerZipCode.WidthRequest             = 150;
                _entryBoxCustomerZipCode.EntryValidation.Changed += delegate { Validate(); };

                //City
                _entryBoxCustomerCity = new EntryBoxValidation(this, Resx.global_city, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
                _entryBoxCustomerCity.WidthRequest             = 200;
                _entryBoxCustomerCity.EntryValidation.Changed += delegate { Validate(); };

                //Country
                CriteriaOperator criteriaOperatorCustomerCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (RegExFiscalNumber IS NOT NULL AND RegExZipCode IS NOT NULL)");
                _entryBoxSelectCustomerCountry = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(pSourceWindow, Resx.global_country, "Designation", "Oid", _intialValueConfigurationCountry, criteriaOperatorCustomerCountry, SettingsApp.RegexGuid, true);
                _entryBoxSelectCustomerCountry.WidthRequest = 235;
                //Extra Protection to prevent Customer without Country
                if (_entryBoxSelectCustomerCountry.Value != null)
                {
                    _entryBoxSelectCustomerCountry.EntryValidation.Validate(_entryBoxSelectCustomerCountry.Value.Oid.ToString());
                }
                _entryBoxSelectCustomerCountry.EntryValidation.IsEditable  = false;
                _entryBoxSelectCustomerCountry.ButtonSelectValue.Sensitive = false;
                _entryBoxSelectCustomerCountry.ClosePopup += delegate
                {
                    _selectedCountry = _entryBoxSelectCustomerCountry.Value;
                    //Require to Update RegEx and Criteria to filter Country Clients Only
                    _entryBoxSelectCustomerFiscalNumber.EntryValidation.Rule = _entryBoxSelectCustomerCountry.Value.RegExFiscalNumber;
                    _entryBoxCustomerZipCode.EntryValidation.Rule            = _entryBoxSelectCustomerCountry.Value.RegExZipCode;
                    //Clear Customer Fields, Except Country
                    ClearCustomer(false);
                    //Apply Criteria Operators
                    ApplyCriteriaToCustomerInputs();
                    //Call Main Validate
                    Validate();
                };

                //FiscalNumber
                CriteriaOperator criteriaOperatorFiscalNumber = null;
                _entryBoxSelectCustomerFiscalNumber = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_fiscal_number, "FiscalNumber", "FiscalNumber", null, criteriaOperatorFiscalNumber, KeyboardMode.AlfaNumeric, _intialValueConfigurationCountry.RegExFiscalNumber, false);
                _entryBoxSelectCustomerFiscalNumber.EntryValidation.Changed += _entryBoxSelectCustomerFiscalNumber_Changed;

                //CardNumber
                CriteriaOperator criteriaOperatorCardNumber = null;//Now Criteria is assigned in ApplyCriteriaToCustomerInputs();
                _entryBoxSelectCustomerCardNumber             = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_card_number, "CardNumber", "CardNumber", null, criteriaOperatorCardNumber, KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxSelectCustomerCardNumber.ClosePopup += delegate
                {
                    if (_entryBoxSelectCustomerCardNumber.EntryValidation.Validated)
                    {
                        GetCustomerDetails("CardNumber", _entryBoxSelectCustomerCardNumber.EntryValidation.Text);
                    }
                    Validate();
                };

                //Notes
                _entryBoxCustomerNotes = new EntryBoxValidation(this, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxCustomerNotes.EntryValidation.Changed += delegate { Validate(); };

                //Fill Dialog Inputs with Defaults FinalConsumerEntity Values
                if (_processFinanceDocumentParameter == null)
                {
                    //If ProcessFinanceDocumentParameter is not null fill Dialog with value from ProcessFinanceDocumentParameter, implemented for SplitPayments
                    GetCustomerDetails("Oid", SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity.ToString());
                }
                //Fill Dialog Inputs with Stored Values, ex when we Work with SplitPayments
                else
                {
                    //Apply Default Customer Entity
                    GetCustomerDetails("Oid", _processFinanceDocumentParameter.Customer.ToString());

                    //Assign Totasl and Discounts Values
                    _totalDelivery  = _processFinanceDocumentParameter.TotalDelivery;
                    _totalChange    = _processFinanceDocumentParameter.TotalChange;
                    _discountGlobal = _processFinanceDocumentParameter.ArticleBag.DiscountGlobal;
                    // Update Visual Components
                    _labelDeliveryValue.Text = FrameworkUtils.DecimalToStringCurrency(_totalDelivery);
                    _labelChangeValue.Text   = FrameworkUtils.DecimalToStringCurrency(_totalChange);
                    // Selects
                    _selectedCustomer = (ERP_Customer)FrameworkUtils.GetXPGuidObject(typeof(ERP_Customer), _processFinanceDocumentParameter.Customer);
                    _selectedCountry  = _selectedCustomer.Country;
                    // PaymentMethod
                    _selectedPaymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), _processFinanceDocumentParameter.PaymentMethod);
                    // Restore Selected Payment Method, require to associate button reference to selectedPaymentMethodButton
                    if (!string.IsNullOrEmpty(pSelectedPaymentMethodButtonName))
                    {
                        switch (pSelectedPaymentMethodButtonName)
                        {
                        case "touchButtonMoney_Green":
                            _selectedPaymentMethodButton = buttonMoney;
                            break;

                        case "touchButtonCheck_Green":
                            _selectedPaymentMethodButton = buttonCheck;
                            break;

                        case "touchButtonMB_Green":
                            _selectedPaymentMethodButton = buttonMB;
                            break;

                        case "touchButtonCreditCard_Green":
                            _selectedPaymentMethodButton = buttonCreditCard;
                            break;

                        case "touchButtonVisa_Green":
                            _selectedPaymentMethodButton = buttonVisa;
                            break;

                        case "touchButtonCurrentAccount_Green":
                            _selectedPaymentMethodButton = buttonCurrentAccount;
                            break;

                        case "touchButtonCustomerCard_Green":
                            _selectedPaymentMethodButton = buttonCustomerCard;
                            break;
                        }

                        //Assign Payment Method after have Reference
                        AssignPaymentMethod(_selectedPaymentMethodButton);
                    }

                    //UpdateChangeValue, if we add/remove Splits we must recalculate ChangeValue
                    UpdateChangeValue();
                }

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

                //Pack Content

                HBox hboxPaymenstAndTotals = new HBox(false, 0);
                hboxPaymenstAndTotals.PackStart(tablePayments, true, true, 0);
                hboxPaymenstAndTotals.PackStart(eventboxTotalPannel, true, true, 0);

                HBox hboxCustomerNameAndCustomerDiscount = new HBox(true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxSelectCustomerName, true, true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxCustomerDiscount, true, true, 0);

                HBox hboxFiscalNumberAndCardNumber = new HBox(true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerFiscalNumber, true, true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerCardNumber, true, true, 0);

                HBox hboxZipCodeCityAndCountry = new HBox(false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerZipCode, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerCity, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxSelectCustomerCountry, true, true, 0);

                VBox vboxContent = new VBox(false, 0);
                vboxContent.PackStart(hboxPaymenstAndTotals, true, true, 0);
                vboxContent.PackStart(hboxFiscalNumberAndCardNumber, true, true, 0);
                vboxContent.PackStart(hboxCustomerNameAndCustomerDiscount, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerAddress, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerLocality, true, true, 0);
                vboxContent.PackStart(hboxZipCodeCityAndCountry, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerNotes, true, true, 0);

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

                //ActionArea Buttons
                _buttonOk             = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok);
                _buttonCancel         = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);
                _buttonClearCustomer  = ActionAreaButton.FactoryGetDialogButtonType("touchButtonClearCustomer_DialogActionArea", Resx.global_button_label_payment_dialog_clear_client, fileIconClearCustomer);
                _buttonFullPayment    = ActionAreaButton.FactoryGetDialogButtonType("touchButtonFullPayment_DialogActionArea", Resx.global_button_label_payment_dialog_full_payment, fileIconFullPayment);
                _buttonPartialPayment = ActionAreaButton.FactoryGetDialogButtonType("touchButtonPartialPayment_DialogActionArea", Resx.global_button_label_payment_dialog_partial_payment, fileIconPartialPayment);
                // Enable if has selectedPaymentMethod defined, ex when working with SplitPayments
                _buttonOk.Sensitive          = (_selectedPaymentMethod != null);
                _buttonFullPayment.Sensitive = false;

                //ActionArea
                ActionAreaButtons actionAreaButtons = new ActionAreaButtons();
                actionAreaButtons.Add(new ActionAreaButton(_buttonClearCustomer, _responseTypeClearCustomer));
                if (enablePartialPaymentButtons)
                {
                    actionAreaButtons.Add(new ActionAreaButton(_buttonFullPayment, _responseTypeFullPayment));
                    actionAreaButtons.Add(new ActionAreaButton(_buttonPartialPayment, _responseTypePartialPayment));
                }

                actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok));
                actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel));

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

                //Init Object
                this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, vboxContent, actionAreaButtons);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #15
0
        public DocumentFinanceDialogPage8(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;
            _crudWidgetList = new GenericCRUDWidgetListXPO(_session);

            //Get Target Object
            //Guid customerGuid = new Guid("0cf40622-578b-417d-b50f-e945fefb5d68");//Consumidor Final|0.0
            Guid customerGuid = new Guid("765859cc-29c2-4925-be89-0486d03684f2");//Carlos Fernandes|5.0

            //Guid customerGuid = new Guid("78c08879-6d08-4146-9cc9-914f427926c6");//Cristina Janeiro|12.5
            _valueCustomer = (ERP_Customer)FrameworkUtils.GetXPGuidObject(_session, typeof(ERP_Customer), customerGuid);

            //Client (Used in _crudWidgetList)
            _entryBoxClient = new EntryBoxValidation(_sourceWindow, string.Format("{0}/WL", Resx.global_customer), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, true);
            _entryBoxClient.EntryValidation.Changed += delegate { Validate(); };
            _entryBoxClientValidation = new EntryBoxValidation(_sourceWindow, Resx.global_customer, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, true);
            _entryBoxClientValidation.EntryValidation.Changed += delegate { Validate(); };
            //FiscalNumber
            _entryBoxFiscalNumber = new EntryBoxValidation(_sourceWindow, Resx.global_fiscal_number, KeyboardMode.Alfa, _valueCustomer.Country.RegExFiscalNumber, true);
            _entryBoxFiscalNumber.EntryValidation.Changed += delegate { /*ValidateFiscalNumber();*/ Validate(); };
            //Address
            _entryBoxAddress = new EntryBoxValidation(_sourceWindow, Resx.global_address, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
            //_entryBoxAddress.WidthRequest = _pagePad.EntryBoxMaxWidth;
            _entryBoxAddress.EntryValidation.Changed += delegate { Validate(); };
            //Locality
            _entryBoxLocality = new EntryBoxValidation(_sourceWindow, Resx.global_locality, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
            //_entryBoxLocality.WidthRequest = _pagePad.EntryBoxMaxWidth;
            _entryBoxLocality.EntryValidation.Changed += delegate { Validate(); };
            //ZipCode
            _entryBoxZipCode = new EntryBoxValidation(_sourceWindow, Resx.global_zipcode, KeyboardMode.Alfa, _valueCustomer.Country.RegExZipCode, false);
            _entryBoxZipCode.WidthRequest             = 200;
            _entryBoxZipCode.EntryValidation.Changed += delegate { Validate(); };
            //City
            _entryBoxCity = new EntryBoxValidation(_sourceWindow, Resx.global_city, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false);
            //_entryBoxCity.WidthRequest = _pagePad.EntryBoxMaxWidth - 200;
            _entryBoxCity.EntryValidation.Changed += delegate { Validate(); };

            //Country (Used in _crudWidgetList)
            CriteriaOperator criteriaOperator = CriteriaOperator.Parse("CurrencyCode = 'EUR'");

            _entryBoxSelectCountry = new XPOEntryBoxSelectRecord <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(_sourceWindow, string.Format("{0}/WL", Resx.global_country), "Designation", "Oid", _valueCustomer.Country, criteriaOperator);
            //_entryBoxSelectCountry.WidthRequest = _pagePad.EntryBoxMaxWidth;
            _entryBoxSelectCountry.Entry.IsEditable = false;
            //CountryValidation
            _entryBoxSelectCountryValidation = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(_sourceWindow, Resx.global_country, "Designation", "Oid", _valueCustomer.Country, criteriaOperator, SettingsApp.RegexGuid, true);
            //_entryBoxSelectCountryValidation.WidthRequest = _pagePad.EntryBoxMaxWidth;
            _entryBoxSelectCountryValidation.EntryValidation.IsEditable = false;
            //Test _selectedXPGuidObject :)
            //_entryBoxSelectCountryValidation.EntryValidation.Changed += delegate {
            //  _log.Debug(string.Format("_entryBoxCountryValidation.Selected.Code3: [{0}]", _entryBoxSelectCountryValidation.Value.Code3));
            //};

            //Notes
            _entryBoxNotes = new EntryBoxValidation(_sourceWindow, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
            //_entryBoxNotes.WidthRequest = _pagePad.EntryBoxMaxWidth;
            _entryBoxNotes.EntryValidation.Changed += delegate { Validate(); };

            ////OPTIONAL: REQUIRE Assign Values TO Work On NON XpoWidget Mode ELSE Leave Blanck and XPOWidget Init Will fill Initial Values
            //_entryBoxClient.Entry.Text = xCustomer.Name;
            _entryBoxClientValidation.EntryValidation.Text = _valueCustomer.Name;
            ////Assign Value First
            //_entryBoxCountry.Value = xCustomer.Country;
            //_entryBoxCountry.Entry.Text = xCustomer.Country.Designation;
            ////Assign Value First
            //_entryBoxCountryValidation.Value = xCustomer.Country;
            //_entryBoxCountryValidation.EntryValidation.Text = xCustomer.Country.Designation;

            //Using Labels ;)
            GenericCRUDWidget <XPGuidObject> crudWidgetClientName    = new GenericCRUDWidgetXPO(_entryBoxClient, _entryBoxClient.Label, _valueCustomer, "Name", SettingsApp.RegexAlfaNumericExtended, true);
            GenericCRUDWidget <XPGuidObject> crudWidgetClientCountry = new GenericCRUDWidgetXPO(_entryBoxSelectCountry, _entryBoxSelectCountry.Label, _valueCustomer, "Country", SettingsApp.RegexGuid, true);

            _crudWidgetList.Add(crudWidgetClientName);
            _crudWidgetList.Add(crudWidgetClientCountry);

            Button button = new Button("VALIDATE & UpdateRecord");

            button.Clicked += delegate
            {
                if (_crudWidgetList.ValidateRecord())
                {
                    //Using WidgetList
                    _crudWidgetList.UpdateRecord(DialogMode.Update);
                }
            };

            //Pack VBOX
            VBox vbox = new VBox(false, 2);

            vbox.PackStart(_entryBoxClient, false, false, 0);
            vbox.PackStart(_entryBoxClientValidation, false, false, 0);
            vbox.PackStart(_entryBoxSelectCountry, false, false, 0);
            vbox.PackStart(_entryBoxSelectCountryValidation, false, false, 0);
            vbox.PackStart(button, true, true, 0);
            PackStart(vbox);
        }