Esempio n. 1
0
 private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         UIAPIRawForm.Freeze(true);
         mtxSellers.Item.Height = UIAPIRawForm.Height / 2 - 75;
         mtxAuction.Item.Top    = UIAPIRawForm.Height / 2;
         mtxAuction.Item.Height = UIAPIRawForm.Height / 2 - 85;
         lblBuyers.Item.Top     = UIAPIRawForm.Height / 2 - 20;
         btnCreate.Item.Top     = UIAPIRawForm.Height - 75;
         btnCancel.Item.Top     = UIAPIRawForm.Height - 75;
         btnFinish.Item.Top     = UIAPIRawForm.Height - 75;
         mtxAuction.AutoResizeColumns();
         mtxSellers.AutoResizeColumns();
     }
     catch (Exception ex)
     {
         UIApplication.ShowError("frmPayment (Form_ResizeAfter)" + ex.Message);
         LogService.WriteError("frmPayment (Form_ResizeAfter)" + ex.Message);
         LogService.WriteError(ex);
     }
     finally
     {
         UIAPIRawForm.Freeze(false);
     }
 }
Esempio n. 2
0
        private void mtxAuction_ValidateBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (pVal.ColUID == "C_TotalC")
                {
                    string lStrPayment = (mtxAuction.Columns.Item("C_TotalC").Cells.Item(pVal.Row).Specific as EditText).Value.Trim();

                    decimal lDblPayment = Convert.ToDecimal(lStrPayment == "" ? "0" : lStrPayment);
                    decimal lDblCompra  = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalB", pVal.Row - 1));

                    if (lDblPayment <= lDblCompra && lDblPayment >= 0)
                    {
                        UpdateMatrix();
                        JounralEntry(pVal.Row);
                    }
                    else
                    {
                        BubbleEvent = false;
                        UIApplication.ShowError("Cantidad incorrecta favor de revisar");
                    }
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message);
                LogService.WriteError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Esempio n. 3
0
        private void Button0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            CorrectionLogic logic             = new CorrectionLogic(DiManager.Company);
            string          transIdParam      = EditText3.Value;
            string          waitingTimeString = EditText4.Value;

            int waitingTime = int.Parse(waitingTimeString);

            if (!string.IsNullOrWhiteSpace(transIdParam))
            {
                logic.CorrectionJournalEntries(transIdParam);
            }
            else
            {
                int maxLine;
                int.TryParse(EditText2.Value,
                             out maxLine);
                bool   mustSkip  = CheckBox0.Checked;
                string startDate = EditText0.Value;
                string endDate   = EditText1.Value;

                CultureInfo provider = CultureInfo.InvariantCulture;
                logic.CorrectionJournalEntries(new CorrectionJournalEntriesParams {
                    MaxLine = maxLine, MustSkip = mustSkip, StartDate = DateTime.ParseExact(startDate, "yyyyMMdd", provider), EndDate = DateTime.ParseExact(endDate, "yyyyMMdd", provider), WaitingTimeInMinutes = waitingTime
                });
            }
        }
        //Campo código
        private void etCode_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var olcn      = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var lcn1      = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_LCN1");

            if (UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_FIND_MODE)
            {
                return;
            }

            var dataTable = ((SAPbouiCOM.SBOChooseFromListEventArg)pVal).SelectedObjects;

            if (dataTable == null)
            {
                return;
            }

            if (String.IsNullOrEmpty(lcn1.GetValue("U_ItemCode", 0)))
            {
                lcn1.InsertRecord(1);
                lcn1.RemoveRecord(1);
            }
            else
            {
                lcn1.InsertRecord(lcn1.Size);
            }

            olcn.SetValue("U_CardName", olcn.Offset, dataTable.GetValue("CardName", 0).ToString());
            olcn.SetValue("U_CardCode", olcn.Offset, dataTable.GetValue("CardCode", 0).ToString());

            mtItens.LoadFromDataSourceEx();
            mtItens.AutoResizeColumns();
        }
Esempio n. 5
0
 private void cmdReturn_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     if (this.cmdReturn.Item.Enabled)
     {
         CreateTransferRequest(); //Crear Documento de Solicitud de Traslado
     }
 }
Esempio n. 6
0
 private void cmdAccept_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     if (this.cmdAccept.Item.Enabled)
     {
         CreateStockTransfer();   //Crear Documento de Transferencia
     }
 }
Esempio n. 7
0
        protected virtual void FileButton_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            SelectFileDialog dialog = new SelectFileDialog("C:\\", "",
                                                           Messages.AdminModuleFilterPrefix + "|*.dll;*.exe;*.zip", DialogType.OPEN);

            dialog.Open();
            modulePath.Value = dialog.SelectedFile;
        }
Esempio n. 8
0
 private void lObjBtnRoute_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     try
     {
         ShowMfRouteFinder();
     }
     catch (Exception ex)
     {
         LogService.WriteError("JournalService (CreateAction): " + ex.Message);
         LogService.WriteError(ex);
         UIApplication.ShowMessageBox(string.Format("CreateAction: {0}", ex.Message));
     }
 }
Esempio n. 9
0
 protected virtual void RemoveButtom_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     for (int i = 0; i < moduleGrid.Rows.SelectedRows.Count; i++)
     {
         int    rowId      = moduleGrid.Rows.SelectedRows.Item(i, BoOrderType.ot_RowOrder);
         string moduleCode = (string)moduleDT.GetValue("Code", rowId);
         string type       = (string)moduleDT.GetValue("Type", rowId);
         if (type == "AddIn")
         {
             frameworkAddinManager.ShutdownAddin(moduleCode);
             asmLoader.RemoveAddIn(moduleCode);
         }
     }
     UpdateGrid();
     moduleGrid_ClickAfter(sboObject, pVal);
 }
Esempio n. 10
0
 private void mtxSellers_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     try
     {
         if (pVal.Row > 0)
         {
             mtxSellers.SelectRow(pVal.Row, true, false);
         }
     }
     catch (Exception ex)
     {
         UIApplication.ShowError("frmPayment (mtxSellers_ClickBefore) " + ex.Message);
         LogService.WriteError("frmPayment (mtxSellers_ClickBefore) " + ex.Message);
         LogService.WriteError(ex);
     }
 }
        //Nome do cliente
        private void EditText10_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            if (UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_FIND_MODE)
            {
                return;
            }

            var dataTable = ((SAPbouiCOM.SBOChooseFromListEventArg)pVal).SelectedObjects;

            if (dataTable == null)
            {
                return;
            }

            var documento = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");

            documento.SetValue("U_CardCode", documento.Offset, dataTable.GetValue("CardCode", 0).ToString());
            documento.SetValue("U_CardName", documento.Offset, dataTable.GetValue("CardName", 0).ToString());
        }
Esempio n. 12
0
 private void mtxSellers_DoubleClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         mIntRowSelected = pVal.Row;
         if (DtMatrixAuctions == null)
         {
             CreateDataTableMatrixAuctions();
         }
         List <AuctionsDTO> lLstAuctionDTO = mObjPaymentServiceFactory.GetPaymentService().GetAuctions(DtMatrixSellers.GetValue("C_Code", pVal.Row - 1).ToString(), mIntSignature).ToList();
         lLstAuctionDTO = AddChargeToList(lLstAuctionDTO);
         FillMatrixAuction(lLstAuctionDTO);
     }
     catch (Exception ex)
     {
         UIApplication.ShowError("frmPayment (mtxSellers_DoubleClickAfter) " + ex.Message);
         LogService.WriteError("frmPayment (mtxSellers_DoubleClickAfter) " + ex.Message);
         LogService.WriteError(ex);
     }
 }
        private void Button1_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            User user = new User();

            if (Name.Value == "" || Surname.Value == "" || FatherName.Value == "" || Address.Value == "" || Company.Value == "" || Phone.Value == "")
            {
                MessageBox.Show("Enter the text");
            }
            else
            {
                user.Name       = Name.Value;
                user.Surname    = Surname.Value;
                user.Fathername = FatherName.Value;
                user.Address    = Address.Value;
                user.Company    = Company.Value;
                user.Phone      = Company.Value;
                UserController.AddUser(user);
                userview.MatrixDataWrite();
                MessageBox.Show("User added successfully");
            }
        }
Esempio n. 14
0
        private void Button2_PressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            var dados    = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ONGN");
            var linha    = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_NGN1");
            var dtMatriz = UIAPIRawForm.DataSources.DataTables.Item("dtMatriz");
            var linhaObj = new Linha();

            Matrix0.FlushToDataSource();

            for (var i = linha.Size - 1; i >= 0; i--)
            {
                linha.RemoveRecord(i);
            }

            var count = 0;

            foreach (var line in LinhaTable)
            {
                linha.InsertRecord(count);

                linha.SetValue("U_NConta", count, line.NConta.ToString());
                linha.SetValue("U_NBoleto", count, line.NBoleto.ToString());
                linha.SetValue("U_Vencimento", count, line.Vencimento.ToString("yyyyMMdd"));
                linha.SetValue("U_Lancamento", count, line.Vencimento.ToString("yyyyMMdd"));
                linha.SetValue("U_Atraso", count, line.Atraso.ToString());
                linha.SetValue("U_ValorTitulo", count, line.ValorTitulo.ToString());
                count++;
            }

            if (double.Parse(dados.GetValue("U_VlrTotal", dados.Offset)) == 0)
            {
                BubbleEvent = false;

                SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Não é possível adicionar pagamento sem documentos  [Mensagem 3524-97]", BoMessageTime.bmt_Short);
            }
        }
Esempio n. 15
0
 protected virtual void InstallUpdateModule_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     if (string.IsNullOrEmpty(modulePath.Value))
     {
         Logger.Error(Messages.AdminEmptyFile);
     }
     else
     {
         string confirmation;
         Logger.Info(Messages.AdminCreatingAppDomain);
         try
         {
             SAPAppender.SilentMode = true; // Prevent messy log.
             string addinName, addinNamespace;
             if (asmLoader.AddInIsValid(modulePath.Value, out confirmation, out addinName, out addinNamespace))
             {
                 if (string.IsNullOrEmpty(confirmation))
                 {
                     InstallAddin(addinName, addinNamespace);
                 }
                 else
                 {
                     GetUserConfirmation(confirmation, addinName, addinNamespace);
                 }
             }
             else
             {
                 SAPAppender.SilentMode = false;
                 Logger.Error(Messages.AdminInvalidAddin);
             }
         }
         finally
         {
             SAPAppender.SilentMode = false;
         }
     }
 }
Esempio n. 16
0
        private void lObjBtnUpdate_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                switch (lObjBtnUpdate.Caption)
                {
                case "Nuevo":
                    NewRoute();
                    break;

                case "Actualizar":
                    UpdateRoute();
                    break;
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("JournalService (CreateAction): " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("CreateAction: {0}", ex.Message));
            }
        }
Esempio n. 17
0
        //Campo code
        private void EditText6_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            Matrix0.AutoResizeColumns();

            if (UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_FIND_MODE)
            {
                return;
            }

            var dataTable = ((SAPbouiCOM.SBOChooseFromListEventArg)pVal).SelectedObjects;

            if (dataTable == null)
            {
                return;
            }

            var dados     = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ONGN");
            var linha     = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_NGN1");
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var dtMatriz  = UIAPIRawForm.DataSources.DataTables.Item("dtMatriz");

            LinhaTable = new List <Linha>();

            dados.SetValue("U_Filial", dados.Offset, cmbFilial.ValidValues.Item(0).Value);
            dados.SetValue("U_Cnpj", dados.Offset, GetCnpjFilial(cmbFilial.ValidValues.Item(0).Value));
            dados.SetValue("U_CardCode", dados.Offset, dataTable.GetValue("CardCode", 0).ToString());
            dados.SetValue("U_CardName", dados.Offset, dataTable.GetValue("CardName", 0).ToString());
            dados.SetValue("U_DocDueDate", dados.Offset, DateTime.Now.ToString("yyyyMMdd"));
            dados.SetValue("U_DocDate", dados.Offset, DateTime.Now.ToString("yyyyMMdd"));
            CleanField();

            dtMatriz.Rows.Clear();
            GetBoletosEmAberto();

            Matrix0.LoadFromDataSourceEx();
        }
Esempio n. 18
0
        /// <summary>
        ///  Button Add to store Delivery Records on SAP B1 by selected Item and Matrix Rows
        /// </summary>
        /// <param name="sboObject"></param>
        /// <param name="pVal"></param>
        /// <param name="BubbleEvent"></param>
        private void btnAdd_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;


            txtCode.Active = true;

            if (btnAdd.Item.Enabled == false)
            {
                return;
            }

            if (dt0.Rows.Count <= 0)
            {
                return;
            }

            if (String.IsNullOrEmpty(txtCode.Value))
            {
                SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("No se ha seleccionado Artículo");
                return;
            }

            if (!ValidateBagsFields())
            {
                return;
            }

            LogService.WriteInfo("Begin Creating Deliveries");

            var           currentClient   = dt0.GetValue(1, 0).ToString();
            var           deliveryDTO     = new DeliveryDTO();
            DeliveryLines deliveryLine    = null;
            var           results         = new List <Task>();
            var           lastClient      = String.Empty;
            var           nextClient      = String.Empty;
            var           nextClientValue = String.Empty;
            var           lastClientValue = String.Empty;
            var           processed       = false;

            try {
                for (int i = 0; i < dt0.Rows.Count; i++)
                {
                    if (String.IsNullOrEmpty(dt0.GetValue("C_Food", i).ToString()) || dt0.GetValue("C_Food", i).ToString().Equals("0"))
                    {
                        continue;
                    }

                    currentClient   = dt0.GetValue("C_Code", i).ToString();
                    lastClient      = (i == 0) ? String.Empty : dt0.GetValue("C_Code", i - 1).ToString();
                    lastClientValue = (i == 0) ? String.Empty : dt0.GetValue("C_Food", i - 1).ToString();
                    nextClient      = (i < dt0.Rows.Count - 1) ? dt0.GetValue("C_Code", i + 1).ToString() : String.Empty;
                    nextClientValue = (i < dt0.Rows.Count - 1) ? dt0.GetValue("C_Food", i + 1).ToString() : String.Empty;

                    if (currentClient != lastClient || (currentClient == lastClient && lastClientValue == "0"))
                    {
                        deliveryDTO          = new DeliveryDTO();
                        deliveryDTO.CardCode = dt0.GetValue("C_Code", i).ToString();
                        deliveryDTO.CardName = dt0.GetValue("C_Name", i).ToString();
                        deliveryDTO.DocDate  = DateTime.ParseExact(txtDate.Value, "yyyyMMdd", CultureInfo.InvariantCulture);
                        deliveryDTO.Series   = series;
                    }

                    deliveryLine            = new DeliveryLines();
                    deliveryLine.ItemCode   = txtCode.Value;
                    deliveryLine.Dscription = txtItem.Value;
                    deliveryLine.WhsCode    = defaultUserWhs;
                    deliveryLine.Corral     = dt0.GetValue("C_Whs", i).ToString();
                    deliveryLine.Quantity   = (double)dt0.GetValue("C_Food", i);
                    deliveryLine.BagsBales  = (double)dt0.GetValue("C_Bags", i);
                    deliveryLine.Area       = defaultUserArea;
                    deliveryLine.Price      = lDicNonLockedItems[txtCode.Value];
                    deliveryDTO.DocLines.Add(deliveryLine);

                    if (currentClient != lastClient || currentClient == lastClient)
                    {
                        if (nextClient == currentClient && nextClientValue != "0")
                        {
                            continue;
                        }
                        else
                        {
                            processed = true;
                            var result = DeliveryDI.CreateDelivery(deliveryDTO);

                            for (int j = 0; j < dt0.Rows.Count; j++)
                            {
                                if (dt0.GetValue("C_Code", j).ToString() == currentClient && !dt0.GetValue("C_Food", j).ToString().Equals("0"))
                                {
                                    dt0.SetValue("C_Result", j, result.Message);
                                    dt0.SetValue("C_Deliv", j, (result.Success ? "SI" : "NO"));
                                }
                            }
                        }
                    }
                }
            }
            catch (AggregateException ae) {
                ae.Handle(e => {
                    HandleException(e, "Concurrent Adding Delivery");
                    return(true);
                });

                return;
            }
            catch (Exception e) {
                HandleException(e, "Adding Delivery");
                return;
            }

            if (processed)
            {
                this.UIAPIRawForm.Freeze(true);
                mtx0.Columns.Item("C_Result").Visible = true;
                mtx0.LoadFromDataSource();
                mtx0.AutoResizeColumns();
                this.UIAPIRawForm.Freeze(false);

                UIApplication.ShowMessageBox("Revisar la Columna de Resultados");
                btnAdd.Item.Enabled = false;
                LogService.WriteInfo("Done Creating Deliveries");
            }
        }
Esempio n. 19
0
 private void btnSearch_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = false;
     FillMatrix();
     btnAdd.Item.Enabled = true;
 }
Esempio n. 20
0
 private void btnNew_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     Clear();
 }
Esempio n. 21
0
 void lObjTxtCardCode_LostFocusAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     EnableButton();
 }
Esempio n. 22
0
 private void mtx0_ValidateAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     changedRow = pVal.Row;
 }
Esempio n. 23
0
 private void btnCancel_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     this.UIAPIRawForm.Close();
 }
Esempio n. 24
0
 private void lObjBtnFreight_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     //LoadFreight();
 }
Esempio n. 25
0
 private void txtAuction_KeyDownAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
 }