Ejemplo n.º 1
0
 public static void AddLine(this SAPbouiCOM.Matrix mtxControl)
 {
     try
     {
         SAPbouiCOM.EditText currentControl;
         if (mtxControl.RowCount <= 0)
         {
             mtxControl.AddRow();
             mtxControl.ClearRowData(1);
         }
         else
         {
             mtxControl.AddRow(1, mtxControl.RowCount + 1);
             mtxControl.ClearRowData(mtxControl.RowCount);
         }
         currentControl        = mtxControl.GetCellSpecific(1, mtxControl.RowCount) as SAPbouiCOM.EditText;
         currentControl.Active = true;
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 2
0
        private void AddChooseFromList()//aqui break point
        {
            lObjFormXml.DataSources.UserDataSources.Add("UDCFL", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
            string Cbx = lObjComboBox.Value.Trim();

            try
            {
                SAPbouiCOM.ChooseFromListCollection oCFLs = null;
                SAPbouiCOM.Conditions oCons   = null;
                SAPbouiCOM.Condition  oCon    = null;
                SAPbouiCOM.Column     oColumn = null;

                oCFLs = lObjFormXml.ChooseFromLists;

                SAPbouiCOM.ChooseFromListCreationParams lObjCFLCreationParams = null;
                lObjCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject
                                            (SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                //  Adding 2 CFL, one for the button and one for the edit text.
                //string strCFLID = oCFLCreationParams.UniqueID
                lObjCFLCreationParams.MultiSelection = false;
                if (lStrDocType.Equals("Servicios"))
                {
                    lObjCFLCreationParams.ObjectType = "1";
                }
                else
                {
                    lObjCFLCreationParams.ObjectType = "4";
                }
                lObjCFLCreationParams.UniqueID = "CFLACT";

                pObjChooseFromList = oCFLs.Add(lObjCFLCreationParams);

                //  Adding Conditions to CFL1
                oCons = pObjChooseFromList.GetConditions();

                //Onlu Postable Accounts
                if (lStrDocType.Equals("Servicios") && lStrFormType != "65301")
                {
                    if (Cbx == "MXP")
                    {
                        #region MXP
                        oCon           = oCons.Add();
                        oCon.Alias     = "Postable";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "Y";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "LocManTran";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "N";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "EUR";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "USD";
                        #endregion
                    }
                    else if (Cbx == "USD")
                    {
                        #region USD
                        oCon           = oCons.Add();
                        oCon.Alias     = "Postable";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "Y";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "LocManTran";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "N";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "EUR";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "MXP";
                        #endregion
                    }
                    else if (Cbx == "EUR")
                    {
                        #region EUR
                        oCon           = oCons.Add();
                        oCon.Alias     = "Postable";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "Y";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "LocManTran";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                        oCon.CondVal   = "N";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "USD";

                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

                        oCon           = oCons.Add();
                        oCon.Alias     = "ActCurr";
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                        oCon.CondVal   = "MXP";
                        #endregion
                    }
                }
                else if (lStrDocType.Equals("Servicios") && lStrFormType == "65301")
                {
                    #region advances to suppliers
                    oCon           = oCons.Add();
                    oCon.Alias     = "AcctCode";
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                    oCon.CondVal   = "11410000";
                    #endregion
                }
                else
                {
                    oCon           = oCons.Add();
                    oCon.Alias     = "validFor";
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                    oCon.CondVal   = "Y";
                }
                pObjChooseFromList.SetConditions(oCons);


                if (oMatrix.RowCount > 0)
                {
                    for (int i = oMatrix.RowCount; i >= 1; i--)
                    {
                        if (oMatrix.RowCount == 1)
                        {
                            oMatrix.ClearRowData(i);
                            oMatrix.DeleteRow(i);
                        }
                        else
                        {
                            oMatrix.DeleteRow(i);
                        }
                    }
                }

                oColumn = oMatrix.Columns.Item("Col_0");

                try {
                    oColumn.DataBind.SetBound(true, "", "UDCFL");
                }
                catch (Exception)
                {
                }
                oColumn.ChooseFromListUID = pObjChooseFromList.UniqueID;
                if (lStrDocType.Equals("Servicios"))
                {
                    oColumn.ChooseFromListAlias = "AcctCode";
                }
                else
                {
                    oColumn.ChooseFromListAlias = "ItemCode";
                }
            }
            catch (Exception ex)
            {
                SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message));
            }
        }