Beispiel #1
0
        /// <summary>
        /// Inicializa a extensão nos Artigos (Item)
        /// Não mostra mensagens
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e">
        /// IN:
        /// PropertyList:
        ///     "Window": Form,
        ///     "IManagementConsole": IManagementConsole
        ///
        /// OUT:
        ///     e.result:     true: para extender os menus, e sinalizar sucesso
        ///     e.set_Data(): Passar um ExtenderMenuItems para extender os menus
        ///
        /// Não mostra mensagens
        ///</param>
        void myEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            var propertyList = (ExtendedPropertyList)e.get_data();

            // Acrescentar Items ao menu
            var newMenu = new ExtenderMenuItems();

            var menuGroup = newMenu.Add("mniXFormacao", "Formação X");

            menuGroup.GroupType  = ExtenderGroupType.ExtenderGroupTypeExtraOptions;  //Opções de menu
            menuGroup.BeginGroup = true;                                             //Novo grupo
            //
            var menuItem = menuGroup.ChildItems.Add("mniXItem1", "Meu menu 1");

            menuItem.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;   //Opções de menu

            menuItem           = menuGroup.ChildItems.Add("mniXItem2", "Meu menu 2");
            menuItem.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;   //Opções de menu

            object oMenu = newMenu;

            e.result.set_data(ref oMenu);

            e.result.Success       = true;
            e.result.ResultMessage = string.Empty;
        }
        private void HeaderEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            _transaction = (ItemTransaction)e.get_data();

            //Se cliente da última venda diferente de 0
            if (lastCustomerId != 0)
            {
                double customerPoints = GetCustomerPoints(lastCustomerId); //verifica os pontos que o cliente tem

                if (customerPoints >= 200) //se cliente com mais de 200 pontos
                {
                    //retira 200 pontos ao cliente
                    Discount200Points(lastCustomerId);

                    //criar um TDE no valor de 10€ para o cliente, referência POINTS (se não existir, é criada automaticamente)
                    var transactionTDE = CreateNewDocumentTDE(bsoItemTrans.Transaction.TransSerial, bsoItemTrans.Transaction.DefaultWarehouse, "TDE", 10, lastCustomerId, bsoItemTrans.Transaction.Salesman.SalesmanID, true);

                    //Imprime o TDE (tem de estar configurado na Conf. postos para impressão)
                    BSOItemTransaction bsoItemTransaction = null;
                    bsoItemTransaction = new BSOItemTransaction();
                    bsoItemTransaction.UserPermissions = MyApp.SystemSettings.User;
                    bsoItemTransaction.PrintTransaction(transactionTDE.TransSerial, transactionTDE.TransDocument, transactionTDE.TransDocNumber, RTLPrint16.PrintJobEnum.jobPrint, 1);
                    bsoItemTransaction = null;
                }
            }
            lastCustomerId = 0;
            
        }
Beispiel #3
0
        /// <summary>
        /// Inicializa a extensão nos Artigos ( OtherContact)
        /// Não mostra mensagens
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e">
        /// IN:
        /// PropertyList:
        ///     "Window": Form,
        ///     "IManagementConsole": IManagementConsole
        ///
        /// OUT:
        ///     e.result:     true: para extender os menus, e sinalizar sucesso
        ///     e.set_Data(): Passar um ExtenderMenuItems para extender os menus
        ///
        /// Não mostra mensagens
        ///</param>
        void myEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            var propertyList = (ExtendedPropertyList)e.get_data();

            if (propertyList.PropertyExists("IManagementConsole"))
            {
                _managementConsole = (IManagementConsole)propertyList.get_Value("IManagementConsole");

                // Form a colocar no TAB dos Outros Devedores/Credores
                _formTab = new FormOtherContactTab();
                _managementConsole.AddChildPanel(_formTab);
            }

            // Acrescentar Items ao menu
            var newMenu = new ExtenderMenuItems();

            var menuGroup = newMenu.Add("mniXFormacao", "Formação X");

            menuGroup.GroupType  = ExtenderGroupType.ExtenderGroupTypeExtraOptions;  //Opções de menu
            menuGroup.BeginGroup = true;                                             //Novo grupo
            //
            var menuItem = menuGroup.ChildItems.Add("mniXOtherContact1", "Meu menu 1");

            menuItem.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;   //Opções de menu

            menuItem           = menuGroup.ChildItems.Add("mniXOtherContact2", "Meu menu 2");
            menuItem.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;   //Opções de menu

            object oMenu = newMenu;

            e.result.set_data(ref oMenu);

            e.result.Success       = true;
            e.result.ResultMessage = string.Empty;
        }
Beispiel #4
0
        private void HeaderStockEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            var propList = (ExtendedPropertyList)e.get_data();

            propaChangeNotifier = (PropertyChangeNotifier)propList.get_Value("PropertyChangeNotifier");
            propaChangeNotifier.PropertyChanged += OnaPropertyChanged;

            bsoStockTrans = (BSOStockTransaction)propList.get_Value("TransactionManager");

            e.result.ResultMessage = "HeaderEvents_OnInitialize";

            var newMenus1 = new ExtenderMenuItems();
            //
            //Criar o grupo: Tab
            var mnuGroup1 = newMenus1.Add("mniXCustomTools1", "Custom Tools");
            //criar item1
            var mnuItem1 = mnuGroup1.ChildItems.Add("mniXTrans11", "Custom Item 1");

            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            //mnuItem1.Picture = ImageConverter.GetIPictureDispFromImage(  )

            //criar item2
            mnuItem1           = mnuGroup1.ChildItems.Add("mniXTrans21", "Custom Item 2");
            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;

            object returnMenu = newMenus1;

            e.result.set_data(returnMenu);
        }
        private void HeaderEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            var propList    = (ExtendedPropertyList)e.get_data();
            var forDeletion = (bool)propList.get_Value("forDeletion");
            var transaction = (ItemTransaction)propList.get_Value("Data");

            if (!forDeletion)
            {
                foreach (ItemTransactionDetail detail in transaction.Details)
                {
                    if (detail.FamilyID == 1)
                    {
                        e.result.ResultMessage = string.Format("HeaderEvents_OnValidating: Não pode vender artigos da familia {0}", detail.FamilyName);
                        e.result.Success       = false;
                        break;
                    }
                }


                //if (transaction.Details.Count > 3) {
                //    e.result.Success = true;
                //}
                //else {
                //    e.result.Success = false;
                //    e.result.ResultMessage = "Não é possivel gravar documentos com menos de 3 linhas";
                //}
            }
            else
            {
                e.result.ResultMessage = "HeaderEvents_OnValidating: Não pode anular documentos! Mas vou devolver TRUE para deixar anular.";
                e.result.Success       = true;
            }
        }
        /// <summary>
        /// Inicialização
        /// Podemos adicionar novas opções de menu aqui
        /// IN:
        ///     e.get_data(): ExtendedPropertyList
        ///     "PropertyChangeNotifier" = Evento que podemos subscrever para controlar quando uma propriedade é alterada
        ///     "TransactionManager" = BSOItemTransaction; Controlador da transação em curso
        /// 
        /// OUT:
        ///     result.Sucess: true para sinalizar sucesso e carregar novos menus; false para cancelar
        ///     result.ResultMessage: Ignorado
        ///     result.set_data( ExtenderMenuItems ): Items de menu a carregar 
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void HeaderEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            var propList = (ExtendedPropertyList)e.get_data();
            propChangeNotifier = (PropertyChangeNotifier)propList.get_Value("PropertyChangeNotifier");
            propChangeNotifier.PropertyChanged += OnPropertyChanged;

            bsoItemTrans = (BSOItemTransaction)propList.get_Value("TransactionManager");
            bsoItemTrans.WarningItemStock += BsoItemTrans_WarningItemStock;

            var newMenus = new ExtenderMenuItems();
            //
            //Criar o grupo: Tab
            var mnuGroup = newMenus.Add("mniXCustomTools", "Custom Tools");
            //criar item1
            var mnuItem1 = mnuGroup.ChildItems.Add("mniXTrans1", "Custom Item 1");
            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            //mnuItem1.Picture = ImageConverter.GetIPictureDispFromImage(  )

            //criar item2
            mnuItem1 = mnuGroup.ChildItems.Add("mniXTrans2", "Custom Item 2");
            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;

            object returnMenu = newMenus;
            e.result.set_data(returnMenu);

        }
Beispiel #7
0
        /// <summary>
        /// Inicialização
        /// Podemos adicionar novas opções de menu aqui
        /// IN:
        ///     e.get_data(): ExtendedPropertyList
        ///     "PropertyChangeNotifier" = Evento que podemos subscrever para controlar quando uma propriedade é alterada
        ///     "TransactionManager" = BSOItemTransaction; Controlador da transação em curso
        /// 
        /// OUT:
        ///     result.Sucess: true para sinalizar sucesso e carregar novos menus; false para cancelar
        ///     result.ResultMessage: Ignorado
        ///     result.set_data( ExtenderMenuItems ): Items de menu a carregar 
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void HeaderEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            var propList = (ExtendedPropertyList)e.get_data();
            propChangeNotifier = (PropertyChangeNotifier)propList.get_Value("PropertyChangeNotifier");
            propChangeNotifier.PropertyChanged += OnPropertyChanged;

            bsoItemTrans = (BSOItemTransaction)propList.get_Value("TransactionManager");
            bsoItemTrans.WarningItemStock += BsoItemTrans_WarningItemStock;

            // Colocar o caminho para o icone.
            // Não usar os nomes de ficheiro da Sage em:
            //      TARGETDIR\Icons50c
            //      TARGETDIR\Images
            var myTargetDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
            myTargetDir = System.IO.Path.Combine(myTargetDir, "Icons");

            var newMenus = new ExtenderMenuItems();
            //
            //Criar o grupo: Tab
            var mnuGroup = newMenus.Add("mniXCustomTools", "Custom Tools");
            //criar item1
            var mnuItem1 = mnuGroup.ChildItems.Add("mniXTrans1", "Custom Item 1");
            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            mnuItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-save.ico");
            //mnuItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-01.png");

            //criar item2
            mnuItem1 = mnuGroup.ChildItems.Add("mniXTrans2", "Custom Item 2");
            mnuItem1.GroupType = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            mnuItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-02.png");

            object returnMenu = newMenus;
            e.result.set_data(returnMenu);
        }
        private void HeaderEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            var propList = (ExtendedPropertyList)e.get_data();
            var forDeletion = (bool)propList.get_Value("forDeletion");
            var transaction = (ItemTransaction)propList.get_Value("Data");

            if (!forDeletion)//Se diferente de anulação
            {

                //Se cliente associado ao grupo 2, força a gravação de FR
                //if (transaction.PartyID != 0)
                //{
                //    var customer = MyApp.DSOCache.CustomerProvider.GetCustomer(transaction.PartyID);

                //    if (customer.CustomerLevel == 2 && transaction.TransDocument != "FR")
                //    {
                //        transaction.TransDocument = "FR";
                //        var x = MyApp.DSOCache.DocumentProvider.GetLastDocNumber(transaction.TransDocType, transaction.TransSerial, transaction.TransDocument);
                //        transaction.TransDocNumber = x + 1;
                //    }
                //    customer = null;
                //}


                foreach (ItemTransactionDetail detail in transaction.Details)
                {
                    if (detail.FamilyID == 1)
                    {
                        e.result.ResultMessage = string.Format("Não pode vender artigos da familia {0}", detail.FamilyName);
                        e.result.Success = false;
                        break;
                    }
                }


                if (e.result.Success)
                {
                    lastCustomerId = transaction.PartyID;
                }
                else
                {
                    lastCustomerId = 0;
                }

                //if (transaction.Details.Count > 3) {
                //    e.result.Success = true;
                //}
                //else {
                //    e.result.Success = false;
                //    e.result.ResultMessage = "Não é possivel gravar documentos com menos de 3 linhas";
                //}
            }
            else
            {
                e.result.ResultMessage = "Não pode anular documentos!";
                e.result.Success = true;
            }


        }
Beispiel #9
0
        private void HeaderEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            var propList    = (ExtendedPropertyList)e.get_data();
            var forDeletion = (bool)propList.get_Value("ForDeletion");
            var transaction = (TenderTransaction)propList.get_Value("Data");

            if (!forDeletion)
            {
                string m = "HeaderEvents_OnValidating: Validação do documento";
                if (transaction.TenderLineItem.Count > 0)
                {
                    m += Environment.NewLine;
                }
                //
                foreach (TenderLineItem tli in transaction.TenderLineItem)
                {
                    m += string.Format("Caixa {0}: {1}={2:C}", tli.TillId, tli.Tender.Description, tli.Amount) + Environment.NewLine;
                }
                e.result.ResultMessage = m;
                e.result.Success       = true;
            }
            else
            {
                e.result.ResultMessage = "HeaderEvents_OnValidating: Não pode anular documentos! Mas vou devolver TRUE para deixar anular.";
                e.result.Success       = true;
            }
        }
Beispiel #10
0
        private void SystemEvents_OnMenuItem(object Sender, ExtenderEventArgs e)
        {
            string menuItemId = (string)e.get_data();

            switch (menuItemId)
            {
            case "miSimpleButton":
                //System.Windows.Forms.MessageBox.Show("miXitem1");
                var fItem = new FormItem();

                fItem.ShowWindow();
                break;

            case "miSimpleButton1":
                //System.Windows.Forms.MessageBox.Show("Parabéns! Conseguiu implementar um botão simples", "Botão simples", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //break;
                var fMenu = new FormCallMenu();

                fMenu.ShowWindow();

                break;

            case "miComplexButtonItem1":
                System.Windows.Forms.MessageBox.Show("Parabéns! Conseguiu implementar um botão com Grupo", "Grupo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            case "miComplexButtonItem3":
                System.Windows.Forms.MessageBox.Show("Parabéns! Conseguiu implementar um botão com Grupo e SubGrupo", "Sub Grupo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                break;

            case "miComplexButtonItem4":
                System.Windows.Forms.MessageBox.Show("Parabéns! Conseguiu implementar um segundo botão com Grupo e SubGrupo", "Sub Grupo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                break;
            }
        }
        //switch (e.get_data().ToString().ToLower()) {
        //    case "lepeso":
        //        if (bsoItemTrans.BSOItemTransactionDetail != null) {
        //            bsoItemTrans.BSOItemTransactionDetail.HandleItemDetail("9.99", TransDocFieldIDEnum.fldQuantity);

        //            e.result.Success = true;
        //            e.result.ResultMessage = string.Empty;
        //        }
        //        else {
        //            e.result.Success = false;
        //            e.result.ResultMessage = "Não foi posivel obter o controlador da linha (BSOItemTransactionDetail)";
        //        }
        //        break;
        //}
        //}

        #endregion


        /// <summary>
        /// EXEMPLO DE VALIDAÇÃO NA LINHA
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void DetailEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList  properties            = (ExtendedPropertyList)e.get_data();
            ItemTransactionDetail itemTransactionDetail = (ItemTransactionDetail)properties.get_Value("Data");
            string errorMessage = string.Empty;

            //Navigate home
            bsoItemTrans.ExecuteFunction("GOTOPAGE", "-1");

            //TODO:
            //Insert line handling code HERE
            //------------------------------
            //if (itemTransactionDetail.UnitOfSaleID.Equals("kg", StringComparison.CurrentCultureIgnoreCase)) {
            //    itemTransactionDetail.Quantity = 9.99;
            //}
            //------------------------------

            //if (itemTransactionDetail.Quantity > 100) {
            //    e.result.Success = false;
            //    e.result.R    esultMessage = string.Format("Atenção! Quantidade {0} superior ao permitido", itemTransactionDetail.Quantity);
            //}
            //else {
            //    e.result.Success = true;
            //    e.result.ResultMessage = string.Empty;
            //}

            //// Uncomment to force a taxable group. In this case, it is necessary to recalculate all the detail
            //itemTransactionDetail.TaxableGroupID = 3;
            //bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);

            properties            = null;
            itemTransactionDetail = null;
        }
Beispiel #12
0
        /// <summary>
        /// Chamado na validação do artigo, antes de gravar
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///  e.get_Data(): ExtendedPropertyList
        ///     "Data":  OtherContact,
        ///     "ForDeletion": bool que indica se o  OtherContact vai ser apagado
        ///
        /// OUT:
        ///     result.Success: true para continuar; false para falhar a validação
        ///     result.ResultMessage: Mensagem a apresentar
        /// </param>
        void myEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            var proplist     = (ExtendedPropertyList)e.get_data();
            var OtherContact = (OtherContact)proplist.get_Value("Data");
            var forDeletion  = (bool)proplist.get_Value("ForDeletion");

            e.result.Success = true;
        }
        private void HeaderEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var trans = (ItemTransaction)e.get_data();

            ///... Code here

            e.result.Success = true;
        }
Beispiel #14
0
 private void MyEvents_OnValidating(object Sender, ExtenderEventArgs e)
 {
     //Validate properties
     if (formProps != null)
     {
         formProps.Validate(e.result);
     }
 }
Beispiel #15
0
 private void MyEvents_OnSave(object Sender, ExtenderEventArgs e)
 {
     //Save custom params
     if (formProps != null)
     {
         formProps.Save();
     }
 }
Beispiel #16
0
        /// <summary>
        /// Ocorre ao criar um artigo novo
        /// IN:
        ///     e.get_data(): Item a ser criado. Pode ser alterado
        ///
        /// OUT:
        ///     e.result.ResultMessage: Mensagem a apresentar ao utilizador. Se vazia, não mostra nada
        ///     e.result.Success: devolver true para continuar; false cancela a operação
        /// </summary>
        /// <param name="Sender">ExtensibilityController</param>
        /// <param name="e">Event parameters</param>
        void myEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            //var item = (Item)e.get_data();
            //item.Description = "bla bla";

            //e.result.ResultMessage = "Alterei a descrição de um artigo novo";
            //e.result.Success = true;
        }
Beispiel #17
0
        /// <summary>
        /// Chamado quando um artigo é carregado da base de dados
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data():  Salesman
        ///
        /// OUT:
        ///     Sucess: true or false
        ///     ResultMessage: caso preenchida, apresenta a mensagem
        /// </param>
        void myEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var Salesman = (Salesman)e.get_data();

            if (Salesman != null)
            {
                _formTab.OnLoad(Salesman);
            }
        }
Beispiel #18
0
        /// <summary>
        /// Chamado quando um artigo é carregado da base de dados
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data():  Supplier
        ///
        /// OUT:
        ///     Sucess: true or false
        ///     ResultMessage: caso preenchida, apresenta a mensagem
        /// </param>
        void myEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var supplier = (Supplier)e.get_data();

            if (supplier != null)
            {
                _formTab.OnLoad(supplier);
            }
        }
        private void DetailEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            var detail = (ItemTransactionDetail)e.get_data();

            //detail.ItemID = "7up4";

            //e.result.ResultMessage = "Alterei a descrição de um artigo novo";
            //e.result.Success = true;
        }
Beispiel #20
0
        /// <summary>
        /// Chamado quando um artigo é carregado da base de dados
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data():  Customer
        ///
        /// OUT:
        ///     Sucess: true or false
        ///     ResultMessage: caso preenchida, apresenta a mensagem
        /// </param>
        void myEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var Customer = ( Customer)e.get_data();

            if (Customer != null)
            {
                _formTab.OnLoad(Customer);
            }
        }
Beispiel #21
0
        /// <summary>
        /// Chamado quando um artigo é carregado da base de dados
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data(): Item
        ///
        /// OUT:
        ///     Sucess: true or false
        ///     ResultMessage: caso preenchida, apresenta a mensagem
        /// </param>
        void myEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var item = (Item)e.get_data();

            //item.Description = "My description";

            //e.result.Success = false;
            //e.result.ResultMessage = "A descrição foi alterada.";
        }
Beispiel #22
0
        /// <summary>
        /// Chamado quando um artigo é carregado da base de dados
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data():  OtherContact
        ///
        /// OUT:
        ///     Sucess: true or false
        ///     ResultMessage: caso preenchida, apresenta a mensagem
        /// </param>
        void myEvents_OnLoad(object Sender, ExtenderEventArgs e)
        {
            var OtherContact = (OtherContact)e.get_data();

            if (OtherContact != null)
            {
                _formTab.OnLoad(OtherContact);
            }
        }
Beispiel #23
0
        void HeaderStockEvents_OnMenuItem(object Sender, ExtenderEventArgs e)
        {
            var menuId = (string)e.get_data();

            switch (menuId)
            {
            case "mniXTrans11":
                System.Windows.Forms.MessageBox.Show("YAY");
                break;
            }
        }
        //switch (e.get_data().ToString().ToLower()) {
        //    case "lepeso":
        //        if (bsoItemTrans.BSOItemTransactionDetail != null) {
        //            bsoItemTrans.BSOItemTransactionDetail.HandleItemDetail("9.99", TransDocFieldIDEnum.fldQuantity);

        //            e.result.Success = true;
        //            e.result.ResultMessage = string.Empty;
        //        }
        //        else {
        //            e.result.Success = false;
        //            e.result.ResultMessage = "Não foi posivel obter o controlador da linha (BSOItemTransactionDetail)";
        //        }
        //        break;
        //}
        //}

        #endregion


        /// <summary>
        /// EXEMPLO DE VALIDAÇÃO NA LINHA   
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void DetailEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = (ExtendedPropertyList)e.get_data();
            ItemTransactionDetail itemTransactionDetail = (ItemTransactionDetail)properties.get_Value("Data");
            string errorMessage = string.Empty;

            var mainProvider = MyApp.DataManager.MainProvider;
            double priceWithDiscount = 0;

            try
            {
                string query = string.Format("Select PriceWithDiscount from UXDiscounColorAndSize Where ItemID='{0}' and SizeId={1} and ColorID={2}",
                                            itemTransactionDetail.ItemID, itemTransactionDetail.Size.SizeID, itemTransactionDetail.Color.ColorID);
                priceWithDiscount = Convert.ToDouble(mainProvider.ExecuteScalar(query));
            }
            catch (Exception ex)
            {
                string tableToCreateInSQL = string.Format("CREATE TABLE [dbo].[UXDiscounColorAndSize]([ItemID] [nvarchar](25) NOT NULL, [SizeID] [int] NOT NULL, [ColorID] [int] NOT NULL, [PriceWithDiscount] [float] NOT NULL ) ON [PRIMARY]", Environment.NewLine);
                MessageBox.Show(String.Format("{0}{1}{1}{1}Crie uma tabela no SQL com a seguinte informação:{1}{1}{2}", ex.Message.ToString(), Environment.NewLine, tableToCreateInSQL), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                priceWithDiscount = 0;
            }

            if (priceWithDiscount != 0)
            {
                itemTransactionDetail.TaxIncludedPrice = priceWithDiscount;
                bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);
            }


            //TODO:
            //Insert line handling code HERE
            //------------------------------
            //if (itemTransactionDetail.UnitOfSaleID.Equals("kg", StringComparison.CurrentCultureIgnoreCase)) {
            //    itemTransactionDetail.Quantity = 9.99;
            //}
            //------------------------------

            //if (itemTransactionDetail.Quantity > 100) {
            //    e.result.Success = false;
            //    e.result.R    esultMessage = string.Format("Atenção! Quantidade {0} superior ao permitido", itemTransactionDetail.Quantity);
            //}
            //else {
            //    e.result.Success = true;
            //    e.result.ResultMessage = string.Empty;
            //}

            // When forcing a taxable group,
            // it is necessary to recalculate all the detail
            //itemTransactionDetail.TaxableGroupID = 3;
            //bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);

            properties = null;
            itemTransactionDetail = null;
        }
Beispiel #25
0
        /// <summary>
        /// Ocorre ao criar um artigo novo
        /// IN:
        ///     e.get_data():  Salesman a ser criado. Pode ser alterado
        ///
        /// OUT:
        ///     e.result.ResultMessage: Mensagem a apresentar ao utilizador. Se vazia, não mostra nada
        ///     e.result.Success: devolver true para continuar; false cancela a operação
        /// </summary>
        /// <param name="Sender">ExtensibilityController</param>
        /// <param name="e">Event parameters</param>
        void myEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            var salesman = (Salesman)e.get_data();

            _formTab.ResetInterface();

            //salesman.Name = "My name";
            //e.result.ResultMessage = "O nome foi alterado.";
            //e.result.Success = true;

            //e.result.ResultMessage = "New Event: Estou a criar um vendedor novo";
            e.result.Success = true;
        }
Beispiel #26
0
        /// <summary>
        /// Ocorre ao criar um artigo novo
        /// IN:
        ///     e.get_data():  Customer a ser criado. Pode ser alterado
        ///
        /// OUT:
        ///     e.result.ResultMessage: Mensagem a apresentar ao utilizador. Se vazia, não mostra nada
        ///     e.result.Success: devolver true para continuar; false cancela a operação
        /// </summary>
        /// <param name="Sender">ExtensibilityController</param>
        /// <param name="e">Event parameters</param>
        void myEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            var customer = (Customer)e.get_data();

            _formTab.ResetInterface();

            //customer.OrganizationName = "My name";
            //e.result.ResultMessage = "O nome foi alterado.";
            //e.result.Success = true;

            //e.result.ResultMessage = "New Event: Estou a criar um cliente novo";
            e.result.Success = true;
        }
Beispiel #27
0
        /// <summary>
        /// Ocorre ao criar um artigo novo
        /// IN:
        ///     e.get_data():  OtherContact a ser criado. Pode ser alterado
        ///
        /// OUT:
        ///     e.result.ResultMessage: Mensagem a apresentar ao utilizador. Se vazia, não mostra nada
        ///     e.result.Success: devolver true para continuar; false cancela a operação
        /// </summary>
        /// <param name="Sender">ExtensibilityController</param>
        /// <param name="e">Event parameters</param>
        void myEvents_OnNew(object Sender, ExtenderEventArgs e)
        {
            var otherContact = (OtherContact)e.get_data();

            _formTab.ResetInterface();

            //otherContact.Name  = "My name";
            //e.result.ResultMessage = "O nome foi alterado.";
            //e.result.Success = true;

            //e.result.ResultMessage = "New Event: Estou a criar um outro devedor/credor novo";
            e.result.Success = true;
        }
        void HeaderEvents_OnMenuItem(object Sender, ExtenderEventArgs e)
        {
            var menuId = (string)e.get_data();
            var rnd    = new Random();

            switch (menuId)
            {
            case "mniXTrans1":
                //System.Windows.Forms.MessageBox.Show("YAY");
                double qty       = rnd.Next(1, 10) + (double)rnd.Next(0, 99) / 100;
                double unitPrice = rnd.Next(1, 100) + (double)rnd.Next(0, 99) / 100;

                var item = APIEngine.DSOCache.ItemProvider.GetItem("aaa", APIEngine.SystemSettings.BaseCurrency);
                if (item != null)
                {
                    var detail = new ItemTransactionDetail()
                    {
                        LineItemID  = bsoItemTrans.Transaction.Details.Count + 1,
                        ItemID      = item.ItemID,
                        Description = item.Description
                    };
                    if (bsoItemTrans.Transaction.TransactionTaxIncluded)
                    {
                        detail.TaxIncludedPrice = unitPrice;
                    }
                    else
                    {
                        detail.UnitPrice = unitPrice;
                    }
                    detail.SetUnitOfSaleID(item.UnitOfSaleID);
                    detail.SetQuantity(qty);
                    detail.TaxableGroupID = item.TaxableGroupID;

                    //var detail = TransAddDetail(bsoItemTrans.Transaction, item, qty, "UNI", unitPrice, 23, 1, 0, 0, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Now, 0, 0, 0);
                    // IMPORTANTE: Mandar calcular a linha!
                    bsoItemTrans.BSOItemTransactionDetail.Calculate(detail);
                    // Adicionar à venda
                    bsoItemTrans.AddDetail(detail);
                }
                break;

            case "XFunctionA":
                MessageBox.Show("Your function here...");
                break;

            case "XPosDisplay":
                SendMessageToCustomerDisplay();
                break;
            }
        }
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //MyApp.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow)properties.get_Value("ChildWindow");
            }
            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }


            // CUSTOM MENUS
            // Definir os menus
            menuItem = new ExtenderMenuItems();
            var childItems = menuItem.Add("miExtensibilidade", "&Extensibilidade").ChildItems;

            childItems.Add("miXItem1", "Item &1");
            childItems.Add("miXItem2", "Item &2");
            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }
Beispiel #30
0
        /// <summary>
        /// Chamado se o utilizador utililzar um dos menus extendidos, passados no Initialize
        /// </summary>
        /// <param name="Sender">GenericExtensibilityController</param>
        /// <param name="e">
        /// IN:
        ///     e.get_Data(): Id do menu (string)
        ///
        /// OUT:
        ///     Ignorado
        /// </param>
        void myEvents_OnMenuItem(object Sender, ExtenderEventArgs e)
        {
            var menuId = (string)e.get_data();

            switch (menuId)
            {
            case "mniXItem1":
                System.Windows.Forms.MessageBox.Show("Pressionei Item 1");
                break;

            case "mniXItem2":
                System.Windows.Forms.MessageBox.Show("Pressionei Item 2");
                break;
            }
        }