Esempio n. 1
0
        private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (FormUID.Equals(this.UIAPIRawForm.UniqueID))
                {
                    if (!pVal.BeforeAction)
                    {
                        switch (pVal.EventType)
                        {
                        case BoEventTypes.et_FORM_CLOSE:
                            UnloadApplicationEvents();
                            break;

                        case BoEventTypes.et_CLICK:
                            if (pVal.ItemUID == "mtxHeader" && mtxHeader.RowCount > 0 && pVal.Row > 0)
                            {
                                UIAPIRawForm.Freeze(true);
                                mtxHeader.SelectRow(pVal.Row, true, false);
                                mIntId = ((SAPbouiCOM.EditText)mtxHeader.GetCellSpecific(1, pVal.Row)).Value;
                                this.LoadMtxDetail(mIntId);
                                UIAPIRawForm.Freeze(false);
                            }
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UIAPIRawForm.Freeze(false);
                UIApplication.ShowError(string.Format("ItemEventException: {0}", ex.Message));
            }
        }
Esempio n. 2
0
        private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                UIAPIRawForm.Freeze(true);
                //Width
                //mtxContracts.Item.Width = UIAPIRawForm.Width / 2;
                //mtxRise.Item.Width = UIAPIRawForm.Width / 2 - 300;


                //Height
                mtxContracts.Item.Height = UIAPIRawForm.Height / 3;
                mtxRise.Item.Height      = UIAPIRawForm.Height / 4;
                mtxRise.Item.Top         = mtxContracts.Item.Top + mtxContracts.Item.Height + 20;

                ////Left
                ////mtxContracts.Item.Left = mtxAuction.Item.Width + 50;
                ////mtxInv.Item.Left = mtxAuction.Item.Width + 50;

                ////Top
                //mtxRise.Item.Top = mtxContracts.Item.Top + mtxContracts.Item.Height + 20;

                mtxContracts.AutoResizeColumns();
                mtxRise.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                LogUtility.WriteError(string.Format("[frmRiseSearch - Form_ResizeAfter] Error: {0}", ex.Message));
                UIApplication.ShowError("frmPayment (Form_ResizeAfter)" + ex.Message);
            }
            finally
            {
                UIAPIRawForm.Freeze(false);
            }
        }
Esempio n. 3
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);
     }
 }
        //Btn OK
        private void Button3_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);
            var olcn      = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var documento = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);

            documento.SetValue("U_DocDate", documento.Offset, DateTime.Now.ToString("yyyyMMdd"));
            documento.SetValue("U_DocDueDate", documento.Offset, DateTime.Now.ToString("yyyyMMdd"));
            documento.SetValue("U_DocTaxDate", documento.Offset, DateTime.Now.ToString("yyyyMMdd"));

            var query = @"SELECT OBPL.BPLId, OBPL.BPLName, ORCT.VatRegNum
                             from OBPL 
	                         inner join ORCT on ORCT.BPLId = ORCT.DocEntry"    ;

            recordset.DoQuery(query);

            cmbFilial.ExpandType = BoExpandType.et_DescriptionOnly;
            var query2 = @"select max(DocEntry) + 1 as DocEntry 
                            from [@HTT_OLCN]";

            recordset.DoQuery(query2);

            documento.SetValue("U_BPLId", documento.Offset, cmbFilial.ValidValues.Item(0).Value);
            documento.SetValue("U_BPLName", documento.Offset, GetCnpjFilial(cmbFilial.ValidValues.Item(0).Value));
            documento.SetValue("U_DocNum", documento.Offset, recordset.Fields.Item("DocEntry").Value.ToString());

            mtItens.AutoResizeColumns();
            UIAPIRawForm.Freeze(false);
        }
Esempio n. 5
0
        //Botão OK
        private void Button2_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);

            if (UIAPIRawForm.Mode != BoFormMode.fm_ADD_MODE)
            {
                return;
            }

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

            var query = @"SELECT OBPL.BPLId, OBPL.BPLName, ORCT.VatRegNum
                             from OBPL 
	                         inner join ORCT on ORCT.BPLId = ORCT.DocEntry"    ;

            recordset.DoQuery(query);

            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_DocDueDate", dados.Offset, DateTime.Now.ToString("yyyyMMdd"));
            dados.SetValue("U_DocDate", dados.Offset, DateTime.Now.ToString("yyyyMMdd"));

            Matrix0.AutoResizeColumns();
            UIAPIRawForm.Freeze(false);
        }
Esempio n. 6
0
        private void CreateTransferRequest()
        {
            UIAPIRawForm.Freeze(true);
            int result = -1;

            try
            {
                mObjTransferRequest = (SAPbobsCOM.StockTransfer)mObjCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryTransferRequest);
                foreach (TransferHeader_DTO lObjTransferHeader_DTO in mObjReceptionTransferService.GetTransferHeader(GetWhsCode(), mIntId))
                {
                    mObjTransferRequest = PopulateTransferRequest(lObjTransferHeader_DTO);
                    int i = 0;
                    foreach (TransferDetail_DTO lObjTransferDetail_DTO in mObjReceptionTransferService.GetTransferDetail(mIntId))
                    {
                        mObjTransferRequest = PopulateTransferRequestDetail(lObjTransferDetail_DTO, i);
                        mObjTransferRequest.Lines.Add();
                        ++i;
                    }
                    result = mObjTransferRequest.Add();
                    if (result == 0)
                    {
                        //Se creo el documento solicitud de transferencia
                        //TicketLogService.WriteSuccess("[CrearTransferencia] DocNum:" + lObjStockTrasnfer.DocNum);
                        UIAPIRawForm.Freeze(false);
                        UIApplication.ShowMessageBox(string.Format("Solicitud de Transferencia realizada correctamente {0}", mIntId));
                        UIAPIRawForm.Freeze(true);
                        bool lBooResultRow = this.LoadMtxHeader(mStrWhsCode);
                        if (lBooResultRow)
                        {
                            mIntId = ((SAPbouiCOM.EditText)mtxHeader.GetCellSpecific(1, 1)).Value;
                            mtxHeader.SelectRow(1, true, false);
                            this.LoadMtxDetail(mIntId);
                            UIControlsEnabled(true);
                        }
                        else
                        {
                            UIControlsEnabled(false);
                        }
                        ClearTxt();
                    }
                    if (result != 0)
                    {
                        UIAPIRawForm.Freeze(false);
                        UIApplication.ShowMessageBox(string.Format("Exception: {0}", DIApplication.Company.GetLastErrorDescription()));
                        //TicketLogService.WriteError("[CrearTransferencia]" + DIApplication.Company.GetLastErrorDescription());
                    }
                }
            }
            catch (Exception ex)
            {
                UIAPIRawForm.Freeze(false);
                UIApplication.ShowError(string.Format(ex.Message, ex.Message));
            }
            finally
            {
                UIAPIRawForm.Freeze(false);
                MemoryUtility.ReleaseComObject(mObjStockTransfer);
            }
        }
Esempio n. 7
0
        //Campo selecionar todos;
        private void Button1_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var dados     = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ONGN");
            var dtMatriz  = UIAPIRawForm.DataSources.DataTables.Item("dtMatriz");

            if (double.Parse(dados.GetValue("U_VlrTotal", dados.Offset)) == 0)
            {
                for (int i = 0; i < dtMatriz.Rows.Count; i++)
                {
                    dtMatriz.SetValue("Select", i, "Y");

                    LinhaTable.Add(new Linha()
                    {
                        NConta      = (int)dtMatriz.GetValue("NConta", i),
                        NBoleto     = (int)dtMatriz.GetValue("NBoleto", i),
                        ValorTitulo = (double)dtMatriz.GetValue("ValorTitulo", i),
                        Vencimento  = (DateTime)dtMatriz.GetValue("Vencimento", i),
                        Lancamento  = (DateTime)dtMatriz.GetValue("Lancamento", i),
                        Atraso      = (int)dtMatriz.GetValue("Atraso", i),
                        RowNumber   = i + 1
                    });
                }

                Matrix0.LoadFromDataSourceEx();
            }
            else
            {
                for (int i = 0; i < dtMatriz.Rows.Count; i++)
                {
                    if (dtMatriz.GetValue("Select", i).ToString() != "Y")
                    {
                        dtMatriz.SetValue("Select", i, "Y");
                        LinhaTable.Add(new Linha()
                        {
                            NConta      = (int)dtMatriz.GetValue("NConta", i),
                            NBoleto     = (int)dtMatriz.GetValue("NBoleto", i),
                            ValorTitulo = (double)dtMatriz.GetValue("ValorTitulo", i),
                            Vencimento  = (DateTime)dtMatriz.GetValue("Vencimento", i),
                            Lancamento  = (DateTime)dtMatriz.GetValue("Lancamento", i),
                            Atraso      = (int)dtMatriz.GetValue("Atraso", i),
                            RowNumber   = i + 1
                        });
                    }
                }
            }

            double total = LinhaTable.Sum(x => x.ValorTitulo);

            dados.SetValue("U_VlrTotal", dados.Offset, total.ToString(CultureInfo.InvariantCulture));
            SetJuros();
            SetMulta();
            SetVlrTotal();
            Matrix0.LoadFromDataSourceEx();

            UIAPIRawForm.Freeze(false);
        }
Esempio n. 8
0
        private void BindOpportunityToForm()
        {
            try
            {
                _opportunity.GetByKey(_opportunityNumber);
                EditText0.Value  = _opportunityNumber.ToString();
                EditText3.Value  = _opportunity.OpportunityName;
                EditText1.Value  = _opportunity.CardCode;
                EditText4.Value  = _opportunity.CustomerName;
                EditText12.Value = (_opportunity.WeightedSumLC - (double)InternalConverters.ConvertStringToDecimal(OpportunityRepository.GetOpportunityUsedAmount(_opportunityNumber).ToString())).ToString();
                EditText6.Value  = SalesPersonRepository.GetNameById(_opportunity.SalesPerson);
                EditText8.Value  = _opportunity.ClosingPercentage + "%";

                //  var businessPartners =
                //      (BusinessPartners) SapDiConnection.Instance.GetBusinessObject(BoObjectTypes
                //          .oBusinessPartners);
                //  businessPartners.GetByKey(_opportunity.CardCode);
                // // businessPartners.ContactEmployees.SetCurrentLine(_opportunity.ContactPerson - 1);
                ////  EditText5.Value = businessPartners.ContactEmployees.Name;

                EditText7.Value = _opportunity.StartDate.ToString("dd.MM.yy");


                //add items
                var items = OpportunityRepository.GetOpportunityItemsById(_opportunityNumber);
                var count = 1;
                foreach (var item in items)
                {
                    Matrix0.AddRow();
                    ((EditText)Matrix0.Columns.Item("#").Cells.Item(count).Specific).Value     = count.ToString();
                    ((EditText)Matrix0.Columns.Item("Col_0").Cells.Item(count).Specific).Value = item.Id;
                    ((EditText)Matrix0.Columns.Item("Col_1").Cells.Item(count).Specific).Value = item.Name;
                    count++;
                }

                //dates
                EditText9.Value  = DateTime.Today.ToString("yyyyMMdd");
                EditText10.Value = DateTime.Today.ToString("yyyyMMdd");
                EditText11.Value = DateTime.Today.ToString("yyyyMMdd");

                EditText16.Value = InternalConverters.StringToDateTypeEdittext(_opportunity.UserFields.Fields.Item("U_ctrctdateto").Value.ToString());
                EditText17.Value = InternalConverters.StringToDateTypeEdittext(_opportunity.UserFields.Fields.Item("U_cntrctdateFrom").Value.ToString());
                _distrule        = _opportunity.UserFields.Fields.Item("U_DistRule").Value.ToString();
                _contractMonths  = InternalConverters.EditTextToDateTime(EditText17.Value).Subtract(InternalConverters.EditTextToDateTime(EditText16.Value)).Days /
                                   (365.25 / 12);
                _contractMonths      = Math.Round(_contractMonths);
                StaticText25.Caption = _contractMonths + " months";
            }
            catch (Exception exception)
            {
                Application.SBO_Application.SetStatusBarMessage(exception.Message);
                UIAPIRawForm.Close();
            }
        }
Esempio n. 9
0
        private void OnCustomInitialize()
        {
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var dados     = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ONGN");
            var dtMatriz  = UIAPIRawForm.DataSources.DataTables.Item("dtMatriz");

            Conditions conditions;
            Condition  condition;

            conditions             = new Conditions();
            condition              = conditions.Add();
            condition.Alias        = "CardType";
            condition.Operation    = BoConditionOperation.co_EQUAL;
            condition.CondVal      = "C";
            condition.Relationship = BoConditionRelationship.cr_AND;

            condition           = conditions.Add();
            condition.Alias     = "frozenFor";
            condition.Operation = BoConditionOperation.co_EQUAL;
            condition.CondVal   = "N";

            var cflCardCode = UIAPIRawForm.ChooseFromLists.Item("cflCardCode");

            cflCardCode.SetConditions(conditions);

            var cflCardName = UIAPIRawForm.ChooseFromLists.Item("cflCardName");

            cflCardName.SetConditions(conditions);

            UIAPIRawForm.Freeze(true);
            var query = @"SELECT OBPL.BPLId, OBPL.BPLName, ORCT.VatRegNum
                             from OBPL 
	                         inner join ORCT on ORCT.BPLId = ORCT.DocEntry"    ;

            recordset.DoQuery(query);

            while (!recordset.EoF)
            {
                cmbFilial.ValidValues.Add(recordset.Fields.Item("BPLId").Value.ToString(), recordset.Fields.Item("BPLName").Value.ToString());

                recordset.MoveNext();
            }

            cmbFilial.ExpandType = BoExpandType.et_DescriptionOnly;
            dados.SetValue("U_Filial", dados.Offset, cmbFilial.ValidValues.Item(0).Value);
            dados.SetValue("U_Cnpj", dados.Offset, GetCnpjFilial(cmbFilial.ValidValues.Item(0).Value));

            Matrix0.AutoResizeColumns();
            UIAPIRawForm.Freeze(false);
        }
Esempio n. 10
0
        private void Matrix0_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);
            try
            {
                if (pVal.ColUID != "Select")
                {
                    return;
                }

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

                Matrix0.FlushToDataSource();

                if (dtMatriz.GetValue("Select", pVal.Row - 1).ToString() == "Y")
                {
                    LinhaTable.Add(new Linha()
                    {
                        NConta      = (int)dtMatriz.GetValue("NConta", pVal.Row - 1),
                        NBoleto     = (int)dtMatriz.GetValue("NBoleto", pVal.Row - 1),
                        ValorTitulo = (double)dtMatriz.GetValue("ValorTitulo", pVal.Row - 1),
                        Vencimento  = (DateTime)dtMatriz.GetValue("Vencimento", pVal.Row - 1),
                        Lancamento  = (DateTime)dtMatriz.GetValue("Lancamento", pVal.Row - 1),
                        Atraso      = (int)dtMatriz.GetValue("Atraso", pVal.Row - 1),
                        RowNumber   = pVal.Row
                    });
                }
                else
                {
                    var index = LinhaTable.FindIndex(x => x.RowNumber == pVal.Row);
                    LinhaTable.RemoveAt(index);
                }

                double total = LinhaTable.Sum(x => x.ValorTitulo);
                dados.SetValue("U_VlrTotal", dados.Offset, total.ToString(CultureInfo.InvariantCulture));

                Matrix0.LoadFromDataSourceEx();
                SetJuros();
                SetMulta();
                SetVlrTotal();
                UIAPIRawForm.Freeze(false);
            }
            catch
            {
                UIAPIRawForm.Freeze(false);
            }
        }
        //Combo box filial
        private void cmbFilial_ComboSelectAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);

            var documento = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);

            var query = @"SELECT VatRegNum from ORCT 
                                 WHERE BPLId = {0}";

            recordset.DoQuery(String.Format(query, documento.GetValue("U_BPLId", 0)));
            documento.SetValue("U_BPLName", documento.Offset, recordset.Fields.Item("VatRegNum").Value.ToString());

            UIAPIRawForm.Freeze(false);
        }
Esempio n. 12
0
        private void btnCreate_ClickAfter(object sboObject, SBOItemEventArg pVal)
        {
            try
            {
                IList <string> lLstStrCreateJounalEntry = mObjPaymentServiceFactory.CreateDocument().CreateDocument(mLstJournalEntryDTO);
                if (lLstStrCreateJounalEntry.Count() == 0)
                {
                    UIApplication.ShowMessageBox("Guardado correcto");
                    UIApplication.ShowSuccess("Creación de asiento realizado correctamente");
                    LogService.WriteSuccess("Creación de asiento realizado correctamente");

                    try
                    {
                        UIAPIRawForm.Freeze(true);
                        DtMatrixAuctions.Rows.Clear();
                        List <PaymentDTO> lLstPaymentDTO = mObjPaymentServiceFactory.GetPaymentService().GetPayments(mStrAuctionId, mIntSignature).ToList();
                        FillMatrix(lLstPaymentDTO);
                        mtxAuction.LoadFromDataSource();
                        mLstJournalEntryDTO = new List <JournalEntryDTO>();
                    }
                    catch (Exception ex)
                    {
                        UIApplication.ShowError("frmPayment (btnCreate_ClickAfter) " + ex.Message);
                        LogService.WriteError("frmPayment (btnCreate_ClickAfter) " + ex.Message);
                        LogService.WriteError(ex);
                    }
                    finally
                    {
                        UIAPIRawForm.Freeze(false);
                    }
                }
                else
                {
                    string lStrMessage = string.Format(" \n{0}",
                                                       string.Join("\n", lLstStrCreateJounalEntry.Select(x => string.Format("{0}", x)).ToArray()));
                    UIApplication.ShowMessageBox("Error al crear el asiento: " + lStrMessage);
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError("frmPayment (btnCreate_ClickAfter) " + ex.Message);
                LogService.WriteError("frmPayment (btnCreate_ClickAfter) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Esempio n. 13
0
        public override void OnInitializeComponent()
        {
            UIAPIRawForm.Freeze(true);
            this.mtxHeader              = ((SAPbouiCOM.Matrix)(this.GetItem("mtxHeader").Specific));
            this.mtxDetail              = ((SAPbouiCOM.Matrix)(this.GetItem("mtxDetail").Specific));
            this.cmdAccept              = ((SAPbouiCOM.Button)(this.GetItem("cmdAccept").Specific));
            this.cmdAccept.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.cmdAccept_ClickBefore);
            this.cmdReturn              = ((SAPbouiCOM.Button)(this.GetItem("cmdReturn").Specific));
            this.cmdReturn.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.cmdReturn_ClickBefore);
            this.lblComents             = ((SAPbouiCOM.StaticText)(this.GetItem("lblComents").Specific));
            this.txtComents             = ((SAPbouiCOM.EditText)(this.GetItem("txtComents").Specific));
            this.btnCancel              = ((SAPbouiCOM.Button)(this.GetItem("btnCancel").Specific));
            this.btnCancel.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.btnCancel_ClickBefore);
            this.LoadApplicationEvents();

            this.OnCustomInitialize();
            UIAPIRawForm.Freeze(false);
        }
Esempio n. 14
0
        //Campo desmarcar todos;
        private void Button0_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);

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

            for (int i = 0; i < dtMatriz.Rows.Count; i++)
            {
                dtMatriz.SetValue("Select", i, "N");
            }

            LinhaTable = new List <Linha>();

            CleanField();
            Matrix0.LoadFromDataSourceEx();
            UIAPIRawForm.Freeze(false);
        }
Esempio n. 15
0
        private void GetBoletosEmAberto()
        {
            UIAPIRawForm.Freeze(true);
            var dados    = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ONGN");
            var linha    = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_NGN1");
            var dtMatriz = UIAPIRawForm.DataSources.DataTables.Item("dtMatriz");

            dtMatriz.Rows.Clear();

            //Aparecer os titulos em aberto por padrão
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var query     = @"select distinct ORCT.BPLName, ORCT.VATRegNum, DocNum, OBOE.BoeNum, OBOE.BoeSum, DocDueDate, DocDate,
                                datediff(day, DocDueDate, getDate()) as Date
                                from ORCT
                            inner join OBOE ON OBOE.BoeKey = ORCT.DocEntry
                                 where Canceled = 'N'
                                 and ORCT.BPLId = {0}
                                 and ORCT.CardCode = '{1}'
                                 and ORCT.DocDate <= '{2}'";

            recordset.DoQuery(String.Format(query, dados.GetValue("U_Filial", dados.Offset).ToString(), dados.GetValue("U_CardCode", dados.Offset).ToString(), dados.GetValue("U_DocDate", dados.Offset).ToString()));

            dtMatriz.Rows.Add(recordset.RecordCount);

            var i = 0;

            while (!recordset.EoF)
            {
                dtMatriz.SetValue("NConta", i, recordset.Fields.Item("DocNum").Value.ToString());
                dtMatriz.SetValue("NBoleto", i, recordset.Fields.Item("BoeNum").Value.ToString());
                dtMatriz.SetValue("ValorTitulo", i, ((double)recordset.Fields.Item("BoeSum").Value).ToString(CultureInfo.InvariantCulture));
                dtMatriz.SetValue("Vencimento", i, DateTime.Parse(recordset.Fields.Item("DocDueDate").Value.ToString()).ToString("yyyyMMdd"));
                dtMatriz.SetValue("Lancamento", i, DateTime.Parse(recordset.Fields.Item("DocDate").Value.ToString()).ToString("yyyyMMdd"));
                dtMatriz.SetValue("Atraso", i, recordset.Fields.Item("Date").Value.ToString());
                recordset.MoveNext();
                i++;
            }

            UIAPIRawForm.Freeze(false);

            Matrix0.LoadFromDataSourceEx();
        }
Esempio n. 16
0
 private void Form_ResizeAfter(SBOItemEventArg pVal)
 {
     try {
         if (resize)
         {
             UIAPIRawForm.Freeze(true);
             mtx0.Item.Height = UIAPIRawForm.Height / 2 - 100;
             mtx1.Item.Top    = UIAPIRawForm.Height / 2 - 50;
             mtx1.Item.Height = mtx0.Item.Height;
             UIAPIRawForm.Freeze(false);
         }
         else
         {
             resize = true;
         }
     }
     catch (Exception ex) {
         SAPException.Handle(ex, "Form_ResizeAfter");
     }
 }
Esempio n. 17
0
        private void ComboBox0_ComboSelectAfter(object sboObject, SBOItemEventArg pVal)
        {
            UIAPIRawForm.Freeze(true);

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

            var query = @"SELECT TaxIdNum from OBPL 
                                 WHERE BPLId = {0}";

            recordset.DoQuery(String.Format(query, dados.GetValue("U_Filial", 0)));
            dados.SetValue("U_Cnpj", dados.Offset, recordset.Fields.Item("TaxIdNum").Value.ToString());

            CleanField();

            dtMatriz.Rows.Clear();
            GetBoletosEmAberto();
            UIAPIRawForm.Freeze(false);
        }
        //Valor total
        private void mtItens_ValidateAfter(object sboObject, SBOItemEventArg pVal)
        {
            if (pVal.ColUID != "mtValor")
            {
                return;
            }

            if (!pVal.ItemChanged)
            {
                return;
            }

            UIAPIRawForm.Freeze(true);
            var olcn = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var lcn1 = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_LCN1");

            mtItens.FlushToDataSource();

            SumValues();

            mtItens.LoadFromDataSourceEx();
            UIAPIRawForm.Freeze(false);
        }
        //Btn OK
        private void Button3_PressedBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            UIAPIRawForm.Freeze(true);

            if (UIAPIRawForm.Mode != BoFormMode.fm_ADD_MODE && UIAPIRawForm.Mode != BoFormMode.fm_UPDATE_MODE)
            {
                return;
            }
            var olcn      = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var documento = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_OLCN");
            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var grid      = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_LCN1");

            grid.RemoveRecord(grid.Size - 1);

            mtItens.FlushToDataSource();

            if (Double.Parse(etVenc.Value) < Double.Parse(etLanc.Value))
            {
                BubbleEvent = false;
                SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Data de vencimento/lançamento inválida. ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                return;
            }

            for (int i = 0; i < grid.Size - 1; i++)
            {
                if (Double.Parse(grid.GetValue("U_ItemVlr", i)) <= 0.0)
                {
                    SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Não é permitido campos em brancos!", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    BubbleEvent = false;
                }
            }

            UIAPIRawForm.Freeze(false);
        }
Esempio n. 20
0
        private void Button0_PressedAfter(object sboObject, SBOItemEventArg pVal)
        {
            var answer = Application.SBO_Application.MessageBox("Create Documents For  Opportunity ?", 2, "Yes", "No");

            if (answer == 2)
            {
                return;
            }

            if (InternalConverters.ConvertStringToDecimal(EditText12.Value) == 0)
            {
                Application.SBO_Application.SetStatusBarMessage("Amount Must Be More Than Zero");
                return;
            }

            if (ComboBox0.Selected == null)
            {
                Application.SBO_Application.SetStatusBarMessage("Please Select Operation Type");
                return;
            }

            if (Convert.ToDecimal(EditText12.Value) == 0)
            {
                Application.SBO_Application.SetStatusBarMessage("Please Fill Amount");
                return;
            }

            if (string.IsNullOrEmpty(EditText9.Value) || string.IsNullOrEmpty(EditText9.Value) ||
                string.IsNullOrEmpty(EditText9.Value))
            {
                Application.SBO_Application.SetStatusBarMessage("Please Fill Dates");
                return;
            }

            if (String.IsNullOrEmpty(EditText19.Value))
            {
                Application.SBO_Application.SetStatusBarMessage("Please Select Business Partner");
                return;
            }


            if (String.IsNullOrEmpty(EditText15.Value))
            {
                Application.SBO_Application.SetStatusBarMessage("Please Select Payment List");
                return;
            }

            try
            {
                var result = new Result();
                SapDiConnection.Instance.StartTransaction();

                //cretae A/R A/P Documents
                switch (ComboBox0.Selected.Description)
                {
                case "Forma 1":
                    result = CreateType1();
                    break;

                case "Forma 2":
                    result = CreateType2();
                    break;

                case "Forma 3":
                    result = CreateType3();
                    break;
                }

                if (result.Code != 0)
                {
                    throw new Exception(result.Message);
                }

                //create JE schedule
                if (!CheckBox0.Checked)
                {
                    result = CreateJESchedule();
                }

                if (result.Code != 0)
                {
                    throw new Exception(result.Message);
                }


                SapDiConnection.Instance.EndTransaction(BoWfTransOpt.wf_Commit);
                Application.SBO_Application.MessageBox("Documents Succesfully Created");
                UIAPIRawForm.Close();
            }
            catch (Exception exception)
            {
                Application.SBO_Application.SetStatusBarMessage(exception.Message);
                if (SapDiConnection.Instance.InTransaction)
                {
                    SapDiConnection.Instance.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                Application.SBO_Application.MessageBox(exception.Message);
            }
        }
Esempio n. 21
0
 private void btnCancel_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     UIAPIRawForm.Close();
 }
Esempio n. 22
0
 private void OnCustomInitialize()
 {
     UIAPIRawForm.EnableMenu("1293", true); //Borrar
 }
        private void OnCustomInitialize()
        {
            //Pegando o xml
            XmlDocument docBase   = new XmlDocument();
            XmlDocument formXml   = new XmlDocument();
            XmlDocument estudoXml = new XmlDocument();

            var recordset = (Recordset)CommonController.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
            var dados     = UIAPIRawForm.DataSources.DBDataSources.Item("@HTT_ManipulationXML");

            //Carrega o arquivo
            docBase.Load(@"d:\Users\vinicius.peters\documents\visual studio 2015\Projects\Projeto\Projeto\View\Base.xml");

            formXml.InnerXml = UIAPIRawForm.GetAsXML();

            var nodes = formXml.SelectNodes("/Application/forms/action/form/items/action/item[@type='113']");

            //Armazena no xml Base os comboboxes cujos campos de usuário contenham uma tabela vinculada
            foreach (XmlNode node in formXml.SelectNodes("/Application/forms/action/form/items/action/item[@type='113']"))
            {
                var table = node.SelectSingleNode("specific/databind/@table").Value;
                var field = node.SelectSingleNode("specific/databind/@alias").Value;

                //Pega o resultado da consulta, e importa os nós
                if (Controller.UserFieldsController.HaveLikedTable(table, field.Replace("U_", "")))
                {
                    var newNode = docBase.ImportNode(node, true);
                    docBase.SelectSingleNode("Application/forms/action/form/items/action").AppendChild(newNode);
                }
            }

            //Se o tipo do nó for diferente de null, ele pega o valor do type do formulário.
            var formTypeNode = docBase.DocumentElement.SelectSingleNode("/Application/forms/action/form/@FormType");

            if (formTypeNode != null)
            {
                formTypeNode.Value = UIAPIRawForm.TypeEx;
            }

            //Se o tipo do nó for diferente de null, ele pega o valor do type do formulário.
            var uidNode = docBase.DocumentElement.SelectSingleNode("/Application/forms/action/form/@uid");

            if (uidNode != null)
            {
                uidNode.Value = UIAPIRawForm.UniqueID;
            }

            // Insere os valores válidos nos comboboxes cujos campos de usuário contenham uma tabela vinculada
            foreach (XmlNode node in docBase.SelectNodes("Application/forms/action/form/items/action/item[@type='113']"))
            {
                var table = node.SelectSingleNode("specific/databind/@table").Value;
                var field = node.SelectSingleNode("specific/databind/@alias").Value;

                string resultadoDaConsulta = UserFieldsController.GetLikedTableValues(table, field.Replace("U_", ""));

                // Monta xml de valores válidos, obtendo-os no banco de dados
                XmlDocument docValidValues = new XmlDocument();
                docValidValues.LoadXml(resultadoDaConsulta);

                //Criar elemento action, e atributo =type="add"
                XmlElement   elem = docValidValues.CreateElement("action");
                XmlAttribute attr = docValidValues.CreateAttribute("type");
                attr.Value = "add";

                //Seleciona o no especifico
                var no        = node.SelectSingleNode("specific/ValidValues/action");
                var documento = docValidValues.InnerXml.Replace("<row>", "<ValidValue")
                                .Replace("</row>", "")
                                .Replace("<Code />", " value=\"\"")
                                .Replace("<Name />", " description=\"\" />")
                                .Replace("<Code>", " value=\"")
                                .Replace("</Code>", "\"")
                                .Replace("<Name>", " description =\"")
                                .Replace("</Name>", "\"/>");

                //Carrega o documento corrigido
                docValidValues.LoadXml(documento);
                var elemStr = docValidValues.SelectNodes(@"BOM/BO/CUFD");

                //Faz a inserção no documento base.xml
                no.InnerXml = elemStr[0].InnerXml;
            }

            var innerXml = docBase.InnerXml;

            Application.SBO_Application.LoadBatchActions(ref innerXml);
        }