/// <summary>
        /// Create equal conditions
        /// </summary>
        /// <param name="oCFL">Choose from list in the form</param>
        /// <param name="bucket">Result query</param>
        public static void CreateConditionsEquals(ref ChooseFromList oCFL, Bucket bucket)
        {
            var oCons = oCFL.GetConditions();

            // Clear conditions
            oCons = new SAPbouiCOM.Conditions();


            for (int i = 0; i < bucket.CountRows; i++)
            {
                foreach (var field in bucket[i])
                {
                    var oCon = oCons.Add();

                    oCon.Alias     = field.Key;
                    oCon.Operation = BoConditionOperation.co_EQUAL;
                    oCon.CondVal   = field.Value;

                    if (bucket.CountRows > (i + 1))
                    {
                        oCon.Relationship = BoConditionRelationship.cr_OR;
                    }
                }
            }

            oCFL.SetConditions(oCons);
        }
Esempio n. 2
0
        ///<summary>    Initializes the chooseFromlist.
        /// </summary>
        public SAPbouiCOM.ChooseFromList initChooseFromListBussinesPartner(string pStrTipoDoc, SAPbouiCOM.ChooseFromList pObjCFLSocio)
        {
            string lStrType = string.Empty;

            if (pStrTipoDoc == "CFL_Venta")
            {
                lStrType = "C";
            }

            if (pStrTipoDoc == "CFL_Compra")
            {
                lStrType = "S";
            }

            try
            {
                SAPbouiCOM.Conditions lObjCons = null;
                SAPbouiCOM.Condition  lObjCon  = null;
                //  Adding Conditions to CFLPO
                lObjCons = pObjCFLSocio.GetConditions();

                bool lBolNewCond = true;
                foreach (SAPbouiCOM.Condition lObjCond in lObjCons)
                {
                    if (lObjCond.Alias == "CardType")
                    {
                        lObjCond.CondVal = lStrType;
                        lBolNewCond      = false;
                        break;
                    }
                }

                if (lBolNewCond)
                {
                    lObjCon           = lObjCons.Add();
                    lObjCon.Alias     = "CardType";
                    lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                    lObjCon.CondVal   = lStrType;
                }

                pObjCFLSocio.SetConditions(lObjCons);
            }
            catch (Exception ex)
            {
                UIApplication.ShowMessageBox(string.Format("InitChooseFromListException: {0}", ex.Message));
            }

            return(pObjCFLSocio);
        }
Esempio n. 3
0
        private void AddConditionCFL(SAPbouiCOM.ChooseFromList pCFL, string pCFLID)
        {
            SAPbouiCOM.Condition  lObjCon  = null;
            SAPbouiCOM.Conditions lObjCons = new SAPbouiCOM.Conditions();

            if (pCFLID == "CFL_Whs")
            {
                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "location";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = "1";
            }
            else if (pCFLID == "CFL_Item")
            {
                lDicNonLockedItems = lObjDistributionDAO.GetNonLockeditems();

                try {
                    int i = 1;
                    if (lDicNonLockedItems.Count() > 0)
                    {
                        foreach (string itemCode in lDicNonLockedItems.Keys)
                        {
                            lObjCon           = lObjCons.Add();
                            lObjCon.Alias     = "ItemCode";
                            lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                            lObjCon.CondVal   = itemCode;

                            if (lDicNonLockedItems.Count() > i)
                            {
                                lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
                            }
                            i++;
                        }
                    }

                    pCFL.SetConditions(lObjCons);
                }
                catch (Exception ex) {
                    HandleException(ex, "AddConditionChoseFromList");
                }
            }

            pCFL.SetConditions(lObjCons);
        }
Esempio n. 4
0
        ///<summary>    Creates the matrix. </summary>
        ///<remarks>    Amartinez, 08/05/2017. </remarks>
        public SAPbouiCOM.Matrix CreateMatrix(SAPbouiCOM.IItem pObjItem, SAPbouiCOM.ChooseFromListCollection pObjCFLs)
        {
            SAPbouiCOM.Matrix lObjMatrix;
            lObjMatrix                 = ((SAPbouiCOM.Matrix)(pObjItem.Specific));
            lObjMatrix.Layout          = SAPbouiCOM.BoMatrixLayoutType.mlt_Normal;
            lObjMatrix.SelectionMode   = SAPbouiCOM.BoMatrixSelect.ms_Auto;
            lObjMatrix.ValidateBefore += lObjMatrix_ValidateBefore;
            lObjMatrix.ValidateAfter  += lObjMatrix_ValidateAfter;

            SAPbouiCOM.ChooseFromListCreationParams lObjCFLCreationParams;
            SAPbouiCOM.Conditions oCons = null;
            SAPbouiCOM.Condition  oCon  = null;
            lObjCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject(BoCreatableObjectType.cot_ChooseFromListCreationParams);

            //Adding a choosefromlist for the column
            lObjCFLCreationParams.MultiSelection = false;
            lObjCFLCreationParams.ObjectType     = "4";
            lObjCFLCreationParams.UniqueID       = "CFL1";
            SAPbouiCOM.ChooseFromList lObjCFL = pObjCFLs.Add(lObjCFLCreationParams);

            //Add Conditon Rcordova 19-10-2017
            oCons = lObjCFL.GetConditions();

            oCon           = oCons.Add();
            oCon.Alias     = "SellItem";
            oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
            oCon.CondVal   = "Y";

            lObjCFL.SetConditions(oCons);
            //Add Conditon Rcordova 19-10-2017

            //Adding a choosefromlist for the column
            lObjCFLCreationParams.MultiSelection = false;
            lObjCFLCreationParams.ObjectType     = "64";
            lObjCFLCreationParams.UniqueID       = "CFL_Ware";
            pObjCFLs.Add(lObjCFLCreationParams);

            //  SAPbouiCOM.UserDataSource udsCardCode = this.UIAPIRawForm.DataSources.UserDataSources.Add("UdsCardCd", BoDataType.dt_SHORT_TEXT, 10);
            return(lObjMatrix);
        }
Esempio n. 5
0
        ///<summary>    Loads matrix data from document. </summary>
        ///<remarks>    Amartinez, 08/05/2017. </remarks>
        ///<param name="pstrAlias"> The pstr alias. </param>
        ///<param name="pstrCond">  The pstr condition. </param>
        public SAPbouiCOM.DBDataSource LoadMatrixConditions(string pstrAlias, string pstrCond, SAPbouiCOM.DBDataSource pDBDataSourceD)
        {
            SAPbouiCOM.Conditions lObjCons = null;
            SAPbouiCOM.Condition  lObjCon  = null;

            //PL001  1
            lObjCons = new SAPbouiCOM.Conditions();
            lObjCon  = lObjCons.Add();
            lObjCon.BracketOpenNum  = 1;
            lObjCon.Alias           = pstrAlias;
            lObjCon.Operation       = SAPbouiCOM.BoConditionOperation.co_EQUAL;
            lObjCon.CondVal         = pstrCond;
            lObjCon.BracketCloseNum = 1;

            ///Validacion para cargar solo las lineas abiertas
            lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

            lObjCon = lObjCons.Add();
            lObjCon.BracketOpenNum  = 1;
            lObjCon.Alias           = "LineStatus";
            lObjCon.Operation       = SAPbouiCOM.BoConditionOperation.co_EQUAL;
            lObjCon.CondVal         = "O";
            lObjCon.BracketCloseNum = 1;
            pDBDataSourceD.Query(lObjCons);

            //Validacion para evitar lineas sin cantidades pendientes
            lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;

            lObjCon = lObjCons.Add();
            lObjCon.BracketOpenNum  = 1;
            lObjCon.Alias           = "OpenQty";
            lObjCon.Operation       = SAPbouiCOM.BoConditionOperation.co_GRATER_THAN;
            lObjCon.CondVal         = "0";
            lObjCon.BracketCloseNum = 1;
            pDBDataSourceD.Query(lObjCons);

            return(pDBDataSourceD);
        }
Esempio n. 6
0
        private void AddConditionChoseFromListArea(ChooseFromList pCFL)
        {
            try
            {
                SAPbouiCOM.Condition  lObjCon  = null;
                SAPbouiCOM.Conditions lObjCons = null;
                lObjCons = pCFL.GetConditions();

                //DimCode
                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "DimCode";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = "1";

                lObjCon.Relationship = BoConditionRelationship.cr_AND;

                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "Active";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = "Y";



                //lObjCon.Relationship = BoConditionRelationship.cr_AND;

                //lObjCon = lObjCons.Add();
                //lObjCon.Alias = "GrpCode";
                //lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_NULL;


                pCFL.SetConditions(lObjCons);
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (AddConditionChoseFromListArea) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 분국
        /// </summary>
        /// <param name="oMatrix"></param>
        /// <param name="pVal"></param>
        private void SetConditionsBranchCenter(SAPbouiCOM.Matrix oMatrix, ItemEvent pVal)
        {
            SAPbouiCOM.ChooseFromList oCFL;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams;
            SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
            SAPbouiCOM.Condition oCon;
            SAPbobsCOM.Recordset oRs = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            try
            {

                string strPaperTp = FN.GetMatirxCellValue(ref oMatrix, "U_PAPERTP", pVal.Row);
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);
                oCFL = oForm.ChooseFromLists.Item(oCFLEvento.ChooseFromListUID);


                //oCon = oCons.Add();
                //oCon.Alias = "U_PAPERTP";//지종
                //oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                //oCon.CondVal = strPaperTp;

                //oCon.Relationship = BoConditionRelationship.cr_AND;

                oCon = oCons.Add();
                oCon.Alias = "U_STATUS";//상태
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                oCon.CondVal = "O"; //활성된것만              

                oCFL.SetConditions(oCons);

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                Marshal.ReleaseComObject(oRs);
                oRs = null;

                oCFL = null;
                oCFLEvento = null;
                oCFLCreationParams = null;
                oCons = null;
                oCon = null;
            }
        }
Esempio n. 8
0
        private void SetFormLoadFromDBDatasource(string KeyValue)
        {
            try
            {
                oForm.Mode = BoFormMode.fm_OK_MODE;

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();

                SAPbouiCOM.DBDataSource oKIS_SD0030T_HRD = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SD0030T_HRD");
                SAPbouiCOM.DBDataSource oKIS_SD00301_HRD = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SD00301_HRD");
                

                SAPbouiCOM.Condition oCon = null;

                oCon = oCons.Add();

                oCon.Alias = "DocEntry";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = KeyValue;

                oKIS_SD0030T_HRD.Query(oCons);
                oKIS_SD00301_HRD.Query(oCons);

                oCon = null;
                oCons = null;


                oKIS_SD0030T_HRD = null;
                oKIS_SD00301_HRD = null;
                

                ((SAPbouiCOM.Matrix)oForm.Items.Item("mtx1").Specific).LoadFromDataSource();

                /* 아래 코드부터는  ET_AFFormDataLoad 이벤트와 동일하게 설정해준다.*/
                SetET_AFFormDataLoad();


            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }

        }
Esempio n. 9
0
        /// <summary>
        /// 폼(Form)의 아이템들(Items)에 연결이 필요한 데이타소스(DataSource) 형식을 정의합니다.
        /// </summary>
        private void Act2_DataSourcesBinding() {
            // '// ADD YOUR ACTION CODE HERE ...

            #region EditText
            string ItemUID = "";

            ItemUID = "edtEMPNO"; oForm.DataSources.UserDataSources.Add(ItemUID, BoDataType.dt_SHORT_TEXT, 30); FN.SetUserDataBind(oForm, ItemUID);//사원코드
            ItemUID = "edtEMPNM"; oForm.DataSources.UserDataSources.Add(ItemUID, BoDataType.dt_SHORT_TEXT, 30); FN.SetUserDataBind(oForm, ItemUID);//사원코드

            #endregion

            #region ComboBox

            string sql = string.Empty;
            //string sql = FN.GetSQL("KIS_SF0360A_001");

            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            // 기수
            oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboYEAR").Specific;
            sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201]  WHERE CODE = 'HR01' AND U_USEYN = 'Y'");
            FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Nothing, null);

            sql = string.Format(" SELECT LEFT(U_SMLNM,4) AS YEAR FROM [@KIS_AD00201]  WHERE CODE = 'HR01' AND U_USEYN = 'Y' AND LEFT(U_SMLNM,4) = '" + DateTime.Now.Year.ToString() + "'");
            oRS.DoQuery(sql);
            oComboBox.Select(oRS.Fields.Item("YEAR").Value.ToString(), BoSearchKey.psk_ByValue);

            // 부서
            oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboDEPT").Specific;
            sql = string.Format(" SELECT U_DEPTCD,U_DEPTNM FROM [@KIS_HR00401] WHERE U_USEYN = 'Y'");
            oComboBox.ValidValues.Add("", "");
            FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Nothing, null);

            #endregion

            #region ChooseFromList

            SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
            //oCons = FN.GetConditionsWithQuery("CARDTYPE == S");
            oCons = null;

            FN.SetChooseFromListAdd(oForm, "KIS_HR0120", "edtEMPNO", "U_EMPNO", BoFormItemTypes.it_EXTEDIT, oCons);

            #endregion      
        }
Esempio n. 10
0
        /// <summary>
        /// 폼(Form) 및 아이템들(Items)의 기본값으로 설정되야하는 항목들을 정의합니다.
        /// </summary>
        private void Act3_DefualtSetting() {
            // '// ADD YOUR ACTION CODE HERE ...

            try
            {
                #region Form Setting

                oForm.SupportedModes = 1;
                oForm.Settings.EnableRowFormat = false;
                oForm.Settings.Enabled = false;
                oForm.AutoManaged = true;

                #endregion

                #region ComboBox

                string sql = string.Empty;

                // 콜유형
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboCALLTP").Specific;
                // 2014.06.13 주소변경 후속작업에 추가
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y'AND U_SMLCD IN ('U20','U30','U60','U70') ORDER BY U_SMLCD ", FN.SetSingleQuotes("SO12"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                oForm.DataSources.UserDataSources.Item("edtFRRECDT").Value = B1Connections.diCompany.GetCompanyDate().ToShortDateString();
                oForm.DataSources.UserDataSources.Item("edtTORECDT").Value = B1Connections.diCompany.GetCompanyDate().ToShortDateString();

                // 처리상태
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboPROSTAT").Specific;
                oComboBox.ValidValues.Add("", "전체");
                oComboBox.ValidValues.Add("N", "미결");
                oComboBox.ValidValues.Add("O", "완료");
                //FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                #endregion

                #region EditText

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
                //oCons = FN.GetConditionsWithQuery("Type == S && Status == P && (U_WRKODYN ~~ || (U_WRKODYN !~ && U_WRKODYN == N))");

                // 독자코드
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0030_HRD", "edtFRRDCD", "Code", BoFormItemTypes.it_EDIT, oCons);
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0030_HRD", "edtTORDCD", "Code", BoFormItemTypes.it_EDIT, oCons);

                //// 배달코드
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0030_HRD", "edtFRDELCD", "Code", BoFormItemTypes.it_EDIT, oCons);
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0030_HRD", "edtTODELCD", "Code", BoFormItemTypes.it_EDIT, oCons);

                //// 작업자
                oCons = FN.GetConditionsWithQuery("U_USERGBN == 10,20,30");
                FN.SetChooseFromListAdd(oForm, "KIS_SO0010_HRD", "edtRECVID", "Code", BoFormItemTypes.it_EDIT, oCons);
                
                #endregion

                oForm.DataSources.DataTables.Add("grd");

                SetGridTitle(oForm);

                foreach (SAPbouiCOM.Item item in oForm.Items)
                {
                    item.AffectsFormMode = false;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
       
        }
Esempio n. 11
0
        private void SetConditions_PRCCD(ItemEvent pVal)
        {
            SAPbouiCOM.ChooseFromList oCFL;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams;
            SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
            SAPbouiCOM.Condition oCon;

            try
            {
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);
                oCFL = oForm.ChooseFromLists.Item(oCFLEvento.ChooseFromListUID);


                oCons = new Conditions(); ;
                oCon = oCons.Add();

                oCon.Alias = "DimCode";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = "1";

                oCon.Relationship = BoConditionRelationship.cr_AND;

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

                oCon.Relationship = BoConditionRelationship.cr_AND;

                oCon = oCons.Add();
                oCon.Alias = "Active";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = "Y";


                oCFL.SetConditions(oCons);

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {

                oCFL = null;
                oCFLEvento = null;
                oCFLCreationParams = null;
                oCons = null;
                oCon = null;
            }
        }
Esempio n. 12
0
        private void SetConditions_ACCTCD(ItemEvent pVal)
        {
            SAPbouiCOM.ChooseFromList oCFL;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams;
            SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
            SAPbouiCOM.Condition oCon;

            try
            {
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);
                oCFL = oForm.ChooseFromLists.Item(oCFLEvento.ChooseFromListUID);


                oCons = new Conditions(); ;
                oCon = oCons.Add();

                //자산계정이이고
                oCon.Alias = "Postable";
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                oCon.CondVal = "Y";

                oCon.Relationship = BoConditionRelationship.cr_AND;

                //기밀이 'N'이고
                oCon = oCons.Add();
                oCon.Alias = "Protected";
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                oCon.CondVal = "N";

                oCon.Relationship = BoConditionRelationship.cr_AND;
                //비활성이 'N'
                oCon = oCons.Add();
                oCon.Alias = "FrozenFor";
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                oCon.CondVal = "N";

                oCon.Relationship = BoConditionRelationship.cr_AND;
                //관리계정이이고
                oCon = oCons.Add();
                oCon.Alias = "LocManTran";
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                oCon.CondVal = "Y";

                oCFL.SetConditions(oCons);

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {

                oCFL = null;
                oCFLEvento = null;
                oCFLCreationParams = null;
                oCons = null;
                oCon = null;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 지정된 문서를 DBDatasource로 다시 로드 합니다.
        /// </summary>
        /// <param name="KeyValue">문서번호(DocEntry)</param>
        private void SetFormLoadFromDBDatasource()
        {
            oForm.Freeze(true);
            try
            {
                string cboPUBLICA = oForm.DataSources.UserDataSources.Item("cboPUBLICA").Value;
                string cboYEAR = oForm.DataSources.UserDataSources.Item("cboYEAR").Value;
                string cboMONTH = oForm.DataSources.UserDataSources.Item("cboMONTH").Value;

                oForm.Mode = BoFormMode.fm_OK_MODE;

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();

                SAPbouiCOM.DBDataSource oKIS_SD0170T_HRD = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SD0170T_HRD");


                SAPbouiCOM.Condition oCon = null;

                oCon = oCons.Add();

                oCon.Alias = "U_PUBLICA";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = cboPUBLICA;

                oCon.Relationship = BoConditionRelationship.cr_AND;

                oCon = oCons.Add();
                oCon.Alias = "U_YEAR";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = cboYEAR;

                if (string.IsNullOrEmpty(cboMONTH) == false)
                {
                    oCon.Relationship = BoConditionRelationship.cr_AND;

                    oCon = oCons.Add();
                    oCon.Alias = "U_MONTH";
                    oCon.Operation = BoConditionOperation.co_EQUAL;
                    oCon.CondVal = cboMONTH;
                }

                oKIS_SD0170T_HRD.Query(oCons);

                oMatrix = oForm.Items.Item("mtx1").Specific;
                oMatrix.LoadFromDataSource();

                //월 데이터
                if (string.IsNullOrEmpty(cboMONTH)==false)
                {
                    FN.SetItemEnable(oForm, "btnADD", true);
                }

                oCon = null;
                oCons = null;

                oKIS_SD0170T_HRD = null;
                /* 아래 코드부터는  ET_AFFormDataLoad 이벤트와 동일하게 설정해준다.*/

                if (oMatrix.VisualRowCount>0)
                {
                    oMatrix.SelectRow(1, true, false);
                }

                SetHeaderValues();

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 폼(Form) 및 아이템들(Items)의 기본값으로 설정되야하는 항목들을 정의합니다.
        /// </summary>
        private void Act3_DefualtSetting()
        {
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                #region Form Setting
                oForm.SupportedModes = 1;
                oForm.Settings.Enabled = false;
                oForm.Settings.EnableRowFormat = false;
                //oForm.DataBrowser.BrowseBy = "edtCODE";

                if (oForm.Mode != BoFormMode.fm_OK_MODE && oForm.Mode != BoFormMode.fm_VIEW_MODE)
                {
                    oForm.Mode = BoFormMode.fm_OK_MODE;

                }

                if (oForm.PaneLevel == 1)
                {
                    SAPbouiCOM.Folder oFolder = oForm.Items.Item("fld1").Specific;
                    oFolder.Select();
                }

                #endregion

                #region ChooseFromList Setting
                string ObjectType = "1"; //SAPbouiCOM.BoLinkedObject.lf_GLAccounts;
                string UniqueID = "edtAC01";
                string ChooseFromListAlias = "AcctCode";

                SAPbouiCOM.BoFormItemTypes ItemType = BoFormItemTypes.it_EXTEDIT;

                for (int iLooper = 1; iLooper <= 9; iLooper++)
                {
                    UniqueID = "edtAC" + iLooper.ToString().PadLeft(2, '0');
                    SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
                    oCons = GetChooseFromList_Conditions_GLAccount(oCons);

                    FN.SetChooseFromListAdd(oForm, ObjectType, UniqueID, ChooseFromListAlias, ItemType, oCons);
                }
                #endregion

                FN.SetAutoManagedAttribute(ref oForm, "edtCODE", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_All, BoModeVisualBehavior.mvb_False);
                FN.SetAutoManagedAttribute(ref oForm, "edtCODE", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Add, BoModeVisualBehavior.mvb_True);
                FN.SetAutoManagedAttribute(ref oForm, "edtCODE", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Find, BoModeVisualBehavior.mvb_True);


                //#region 헤럴드 사용자 공통코드 'SD01' 간행물 리스트에 코드가 없는 경우 기본값으로 생성한다

                //SAPbobsCOM.Recordset oRecordset = B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                ////누락된 간행물 코드 조회
                //System.Text.StringBuilder isb = new System.Text.StringBuilder();
                //isb.AppendLine("SELECT                                  ");
                //isb.AppendLine("  U_SMLCD                               ");
                //isb.AppendLine(", U_SMLNM                               ");
                //isb.AppendLine("FROM [@KIS_AD00201] T0                  ");
                //isb.AppendLine("	LEFT JOIN [@KIS_SD0090M_HRD] T1     ");
                //isb.AppendLine("	ON T0.U_SMLCD = T1.Code             ");
                //isb.AppendLine("WHERE   T0.Code = 'SD01'                ");
                //isb.AppendLine("	AND T1.Code IS NULL                 ");

                //oRecordset.DoQuery(isb.ToString());

                //if (oRecordset.RecordCount > 0)
                //{
                //    for (int iLooper = 0; iLooper < oRecordset.RecordCount; iLooper++)
                //    {
                string ReturnValue = FN.GetRecordsetValue("SELECT COUNT(1) FROM [@KIS_SD0090M_HRD]");

                if (ReturnValue.CompareTo("1") < 0)
                {
                    UDO_Add_Data("1","1");
                }
                        

                //        oRecordset.MoveNext();
                //    }
                //}
                //oRecordset = null;

                //#endregion

                Veiw_Data();

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }
Esempio n. 15
0
        private void InitiallizeForm()
        {
            oForm.Freeze(true);

            // Program.objHrmsUI.ExecQuery("Update B1_SCHMDT set u_upd='Y' where isnull(u_upd,'N') = 'N'", "Finalizing temp");
            Program.objHrmsUI.ExecQuery("delete from [@B1_SCHMDT]  where isnull(u_upd,'N') = 'N'", "Finalizing temp");
            Program.objHrmsUI.ExecQuery("delete from [@B1_SCHMDY]  where isnull(u_upd,'N') = 'N'", "Finalizing temp");
            Program.objHrmsUI.ExecQuery("delete from [@B1_SO]  where isnull(u_upd,'N') = 'N'", "Finalizing temp");
            Program.objHrmsUI.ExecQuery("delete from [@B1_SCHOT]  where isnull(u_upd,'N') = 'N'", "Finalizing temp");


            cardCFL = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflCRD");
            SAPbouiCOM.Conditions oCons = cardCFL.GetConditions();
            SAPbouiCOM.Condition  oCon  = oCons.Add();
            oCon.Alias     = "CardType";
            oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
            oCon.CondVal   = "C";
            cardCFL.SetConditions(oCons);

            dtHead = oForm.DataSources.DataTables.Item("dtHead");
            dtItem = oForm.DataSources.DataTables.Item("dtItem");
            dtDate = oForm.DataSources.DataTables.Item("dtDate");
            dtDays = oForm.DataSources.DataTables.Item("dtDays");
            dtOSCN = oForm.DataSources.DataTables.Item("dtOSCN");
            dtOT   = oForm.DataSources.DataTables.Item("dtOT");

            mtItem = (SAPbouiCOM.Matrix)oForm.Items.Item("mtItem").Specific;

            mtDate = (SAPbouiCOM.Matrix)oForm.Items.Item("mtDate").Specific;
            mtDay  = (SAPbouiCOM.Matrix)oForm.Items.Item("mtDays").Specific;
            mtOSCN = (SAPbouiCOM.Matrix)oForm.Items.Item("mtOSCN").Specific;
            mtOT   = (SAPbouiCOM.Matrix)oForm.Items.Item("mtOT").Specific;


            dtHead.Rows.Add(1);
            dtHead.SetValue("tsActive", 0, "Y");


            txCode = (SAPbouiCOM.EditText)oForm.Items.Item("txCode").Specific;
            txName = (SAPbouiCOM.EditText)oForm.Items.Item("txName").Specific;
            txCT   = (SAPbouiCOM.EditText)oForm.Items.Item("txCT").Specific;
            txOTDT = (SAPbouiCOM.EditText)oForm.Items.Item("txOTDT").Specific;

            txICode  = (SAPbouiCOM.EditText)oForm.Items.Item("txICode").Specific;
            txOMDT   = (SAPbouiCOM.EditText)oForm.Items.Item("txOMDT").Specific;
            txOICODE = (SAPbouiCOM.EditText)oForm.Items.Item("txOICODE").Specific;
            imgImage = (SAPbouiCOM.PictureBox)oForm.Items.Item("imgImage").Specific;
            txSL     = (SAPbouiCOM.EditText)oForm.Items.Item("txSL").Specific;



            cbSP    = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbSP").Specific;
            cbDays  = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbDays").Specific;
            cbWeeks = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbWeeks").Specific;

            cbHH  = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbHH").Specific;
            cbMM  = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbMM").Specific;
            cbAP  = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbAP").Specific;
            cbEWN = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbEWN").Specific;

            cbOTHH = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTHH").Specific;
            cbOTMM = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTMM").Specific;
            cbOTAP = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTAP").Specific;



            opOD = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOD").Specific;
            opOW = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOW").Specific;
            opOM = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOM").Specific;
            OMDY = (SAPbouiCOM.OptionBtn)oForm.Items.Item("OMDY").Specific;
            OMDT = (SAPbouiCOM.OptionBtn)oForm.Items.Item("OMDT").Specific;

            opOW.GroupWith("opOD");
            opOM.GroupWith("opOD");

            OMDY.GroupWith("OMDT");
            opOD.Selected = true;
            OMDT.Selected = true;
            tbSO          = (SAPbouiCOM.Folder)oForm.Items.Item("tbSO").Specific;
            tbTS          = (SAPbouiCOM.Folder)oForm.Items.Item("tbTS").Specific;

            tbTS.Select();
            fillCBs();
            oForm.Freeze(false);

            txCode.Active = true;
        }
Esempio n. 16
0
        /// <summary>
        /// 폼(Form) 및 아이템들(Items)의 기본값으로 설정되야하는 항목들을 정의합니다.
        /// </summary>
        private void Act3_DefualtSetting() 
        {
            // '// ADD YOUR ACTION CODE HERE ...
            try
            {
                #region Form Setting

                oForm.SupportedModes = 1;
                oForm.Settings.EnableRowFormat = false;
                oForm.Settings.Enabled = false;
                oForm.AutoManaged = true;

                #endregion

                #region ComboBox

                string sql = string.Empty;

                // 지종
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboPAPERTP").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO01"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                
                // 독자그룹1
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboCATEGP1").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO03"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                // 독자그룹2
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboCATEGP2").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO04"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                // 독자그룹3
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboCATEGP3").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO05"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                // 독자그룹4
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboCATEGP4").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO06"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                /*
                // 구독구분
                //oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboTYPE").Specific;
                //sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO06"));
                //FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                // 상태
                FN.SetComboBoxValidValues(oForm, "@KIS_SO0030M_HRD", "STATUS", "cboSTATUS");

                // 가입방법
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboMETHOD").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO14"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);
                */

                // 연령대
                oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cboAGE").Specific;
                sql = string.Format(" SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = {0} AND U_USEYN = 'Y' ", FN.SetSingleQuotes("SO07"));
                FN.QComboBind(ref oComboBox, sql, FN.Enum_WholeTp.m_Space, null);

                //사용자
                //FN.SetComboBoxValidValues(oForm, "SELECT USER_CODE,U_NAME FROM [OUSR] WHERE Locked ='N'", "cboUSER");
                //oForm.DataSources.UserDataSources.Item("cboUSER").ValueEx = B1Connections.diCompany.UserName;

                #endregion

                #region EditText

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
                //oCons = FN.GetConditionsWithQuery("Type == S && Status == P && (U_WRKODYN ~~ || (U_WRKODYN !~ && U_WRKODYN == N))");

                // 독자코드
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0030_HRD", "edtREADCD", "Code", BoFormItemTypes.it_EDIT, oCons);

                // 지국 -> 분국으로 변경됨
                //oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0040_HRD", "edtBRCCD", "Code", BoFormItemTypes.it_EDIT, oCons);

                // 분국
                oCons = null; FN.SetChooseFromListAdd(oForm, "KIS_SO0330_HRD", "edtCENTCD", "Code", BoFormItemTypes.it_EDIT, oCons);

                // 유치자, 부서
                oCons = null; FN.SetChooseFromListAdd(oForm, ((int)BoLinkedObject.lf_Employee).ToString(), "edtSALLER", "U_EMPNO", BoFormItemTypes.it_EDIT, oCons);//SAP Business One User object
                //oCons = null; FN.SetChooseFromListAdd(oForm, "12", "edtSALLER", "USER_CODE", BoFormItemTypes.it_EDIT, oCons);//SAP Business One User object
                //FN.SetChooseFromListAdd(oForm, "12", "edtSDEPT", "USER_CODE", BoFormItemTypes.it_EDIT);//SAP Business One User object

                #endregion


                Veiw_Grid_DataTable(true);

                foreach (SAPbouiCOM.Item item in oForm.Items)
                {
                    item.AffectsFormMode = false;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }

        }
Esempio n. 17
0
        /// <summary>
        /// 폼(Form) 및 아이템들(Items)의 기본값으로 설정되야하는 항목들을 정의합니다.
        /// </summary>
        private void Act3_DefualtSetting() {
            // '// ADD YOUR ACTION CODE HERE ...

            //청구월
            oComboBox = oForm.Items.Item("cboREQYM").Specific;

            SO.SO_COMMON_HRD.SetComboValue_YearMonth(ref oComboBox, FN.Enum_WholeTp.m_Nothing, "");
            //지종
            FN.SetComboBoxValidValues(oForm, " SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = 'SO01' ", "cboPAPERTP", FN.Enum_WholeTp.m_Nothing);
            //지국 FR
            //FN.SetComboBoxValidValues(oForm, " SELECT Code,Name FROM [@KIS_SO0040M_HRD] ", "cboFRBRCCD", FN.Enum_WholeTp.m_Nothing);

            #region ChooseFromList

            SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
            //oCons = FN.GetConditionsWithQuery("CARDTYPE == S");
            oCons = null;

            FN.SetChooseFromListAdd(oForm, "KIS_SO0040_HRD", "cboFRBRCCD", "Code", BoFormItemTypes.it_EXTEDIT, oCons);

            #endregion       

        }
Esempio n. 18
0
        /// <summary>
        /// 지정된 문서를 DBDatasource로 다시 로드 합니다.
        /// </summary>
        /// <param name="KeyValue">문서번호(DocEntry)</param>
        private void SetFormLoadFromDBDatasource(string KeyValue)
        {
            try
            {
                oForm.Mode = BoFormMode.fm_OK_MODE;

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();

                SAPbouiCOM.DBDataSource oKIS_TR0041T_HRD = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_TR0041T_HRD");

                SAPbouiCOM.Condition oCon = null;

                oCon = oCons.Add();

                oCon.Alias = "DocEntry";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = KeyValue;

                oKIS_TR0041T_HRD.Query(oCons);

                oCon = null;
                oCons = null;

                oKIS_TR0041T_HRD = null;
                /* 아래 코드부터는  ET_AFFormDataLoad 이벤트와 동일하게 설정해준다.*/
                //SetcboSTATUS();

                Veiw_Grid1_DataTable_DataLoaded(oForm, KeyValue);

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }
        private Boolean ValidarDatos_PE(String TipoDocElec, String Tabla, String DocSubType, String DocEntry, String ObjType, String TablaDir, String TablaDetalle)
        {
            Boolean _result = true;

            String[]   CaracteresInvalidos = { "Ñ", "°", "|", "!", @"""", "#", "$", "=", "?", "\\", "¿", "¡", "~", "´", "+", "{", "}", "[", "]", "-", ":", "%" };
            TFunctions Param;
            int        i;
            int        c;
            String     VatStatus = "Y";
            String     BPP_BPTP  = "";

            //SAPbouiCOM.DBDataSource oDBDSDir;
            //SAPbouiCOM.DBDataSource oDBDSH;

            try
            {
                if (TipoDocElec == "20")
                {
                    return(true);
                }

                var oDBDSH   = oForm.DataSources.DBDataSources.Add(Tabla);
                var oDBDSDir = oForm.DataSources.DBDataSources.Add(TablaDir);
                var oDBDSDet = oForm.DataSources.DBDataSources.Add(TablaDetalle);

                SAPbouiCOM.Conditions oConditions;
                SAPbouiCOM.Condition  oCondition;

                oConditions          = new SAPbouiCOM.Conditions();
                oCondition           = oConditions.Add();
                oCondition.Alias     = "DocEntry";
                oCondition.Operation = BoConditionOperation.co_EQUAL;
                oCondition.CondVal   = DocEntry;

                oDBDSH.Query(oConditions);
                oDBDSDet.Query(oConditions);
                oDBDSDir.Query(oConditions);


                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select VatStatus, ISNULL(U_BPP_BPTP,'') BPP_BPTP from OCRD where CardCode = '{0}'";
                }
                else
                {
                    s = @"select ""VatStatus"", IFNULL(""U_BPP_BPTP"",'') ""BPP_BPTP"" from ""OCRD"" where ""CardCode"" = '{0}'";
                }
                s = String.Format(s, (System.String)(oDBDSH.GetValue("CardCode", 0)).Trim());
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    VatStatus = ((System.String)oRecordSet.Fields.Item("VatStatus").Value).Trim();
                    BPP_BPTP  = ((System.String)oRecordSet.Fields.Item("BPP_BPTP").Value).Trim();
                }


                if (ObjType == "14")
                {
                    //valida para nota credito
                    if (_result)
                    {
                        if (oDBDSH.GetValue("U_BPP_MDTN", 0) == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe seleccionar Tipo de operacion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                        else
                        {
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"select U_TypeCode
                                            from [@FM_NOTES] 
                                           where Code = '{0}' ";
                            }
                            else
                            {
                                s = @"select ""U_TypeCode""
                                            from ""@FM_NOTES""
                                           where ""Code"" = '{0}' ";
                            }
                            s = String.Format(s, (System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim());
                            oRecordSet.DoQuery(s);
                            if (oRecordSet.RecordCount == 0)
                            {
                                FSBOApp.StatusBar.SetText("No se encuentra tipo de operacion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                return(false);
                            }
                            //else if (((System.String)(oRecordSet.Fields.Item("Distribuido").Value)).Trim() != "02")
                            else if (((System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim() == "11") || ((System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim() == "10") || ((System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim() == "04"))
                            {
                                FSBOApp.StatusBar.SetText("Debe seleccionar tipo de operacion valida por Factura Movil", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                return(false);
                            }

                            if (_result)
                            {
                                c = 0;
                                var BaseEntry   = (System.String)(oDBDSDet.GetValue("BaseEntry", 0));
                                var PedirRefCab = false;

                                i = 0;
                                while (i < oDBDSDet.Size)
                                {
                                    var BaseEntry2 = (System.String)(oDBDSDet.GetValue("BaseEntry", i)); //BaseEntry
                                    var BaseType2  = (System.String)(oDBDSDet.GetValue("BaseType", i));  //basetype

                                    if (BaseEntry != BaseEntry2)
                                    {
                                        c = c + 1;
                                    }

                                    if ((BaseEntry2 == "") || (BaseType2 != "13"))
                                    {
                                        PedirRefCab = true;
                                    }
                                    i++;
                                }

                                if (PedirRefCab)
                                {
                                    if (oDBDSH.GetValue("U_BPP_MDTO", 0).Trim() == "")
                                    {
                                        FSBOApp.StatusBar.SetText("Debe seleccionar Tipo de operacion de documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                        _result = false;
                                    }
                                    else if (oDBDSH.GetValue("U_BPP_MDSO", 0).Trim() == "")
                                    {
                                        FSBOApp.StatusBar.SetText("Debe seleccionar Serie documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                        _result = false;
                                    }
                                    else if (oDBDSH.GetValue("U_BPP_MDCO", 0).Trim() == "")
                                    {
                                        FSBOApp.StatusBar.SetText("Debe seleccionar Correlativo documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                        _result = false;
                                    }
                                    else
                                    {
                                        var TablaAux = "OINV";
                                        if (GlobalSettings.RunningUnderSQLServer)
                                        {
                                            s = @"SELECT COUNT(*) 'Cont'
                                                        FROM {0} T1 WITH (NOLOCK)
                                                        JOIN NNM1 T2 WITH (NOLOCK) ON T1.Series = T2.Series
                                                       WHERE ISNULL(T1.U_BPP_MDTD, '') = '{1}'
                                                         AND ISNULL(T1.U_BPP_MDSD, '') = '{2}'
                                                         AND ISNULL(T1.U_BPP_MDCD, '') = '{3}'
                                                         AND CASE 
                                                               WHEN '{1}' = '01' THEN '--'
                                                               WHEN '{1}' = '03' THEN 'IB'
                                                               WHEN '{1}' = '08' THEN 'DN'
                                                               Else '-1'
                                                             END = T1.DocSubType";
                                        }
                                        else
                                        {
                                            s = @"SELECT COUNT(*) ""Cont""
                                                    FROM ""{0}"" T1
                                                    JOIN ""NNM1"" T2 ON T1.""Series"" = T2.""Series""
                                                   WHERE IFNULL(T1.""U_BPP_MDTD"", '') = '{1}'
                                                         AND IFNULL(T1.""U_BPP_MDSD"", '') = '{2}'
                                                         AND IFNULL(T1.""U_BPP_MDCD"", '') = '{3}'
                                                         AND CASE
                                                               WHEN '{1}' = '01' THEN '--'
                                                               WHEN '{1}' = '03' THEN 'IB'
                                                               WHEN '{1}' = '08' THEN 'DN'
                                                               Else '-1'
                                                             END = T1.""DocSubType"" ";
                                        }
                                        s = String.Format(s, TablaAux, (System.String)(oDBDSH.GetValue("U_BPP_MDTO", 0)).Trim(), (System.String)(oDBDSH.GetValue("U_BPP_MDSO", 0)).Trim(), (System.String)(oDBDSH.GetValue("U_BPP_MDCO", 0)).Trim());
                                        oRecordSet.DoQuery(s);
                                        if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                                        {
                                            _result = true;
                                        }
                                        else
                                        {
                                            FSBOApp.StatusBar.SetText("No se ha encontrado documento de referencia,", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                            _result = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if ((ObjType == "13") && (TipoDocElec == "08"))//Nota de debito
                {
                    //valida para nota debito
                    if ((_result) && ((System.String)(oDBDSH.GetValue("DocSubType", 0)).Trim() == "DN"))
                    {
                        if (oDBDSH.GetValue("U_BPP_MDTO", 0).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe seleccionar Tipo de operacion de documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                        else if (oDBDSH.GetValue("U_BPP_MDSO", 0).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe seleccionar Serie documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                        else if (oDBDSH.GetValue("U_BPP_MDCO", 0).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe seleccionar Correlativo documento origen", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                        else if ((System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe ingresar tipo de operacion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                        else if ((System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim() != "11")
                        {
                            FSBOApp.StatusBar.SetText("Debe seleccionar tipo de operacion valida por FM", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            return(false);
                        }
                        else if ((System.String)(oDBDSH.GetValue("U_BPP_MDTD", 0)).Trim() != "08")
                        {
                            FSBOApp.StatusBar.SetText("El documento es una Nota de Debito y debe tener Tipo documento 08", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            return(false);
                        }
                        else if (((System.String)(oDBDSH.GetValue("U_BPP_MDTO", 0)).Trim() != "01") && ((System.String)(oDBDSH.GetValue("U_BPP_MDTO", 0)).Trim() != "03"))
                        {
                            FSBOApp.StatusBar.SetText("Solo puede tener como referencia una factura o boleta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            return(false);
                        }
                        else
                        {
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"select U_TypeCode
                                            from [@FM_NOTES] 
                                           where Code = '{0}' ";
                            }
                            else
                            {
                                s = @"select ""U_TypeCode""
                                            from ""@FM_NOTES""
                                           where ""Code"" = '{0}' ";
                            }
                            s = String.Format(s, (System.String)(oDBDSH.GetValue("U_BPP_MDTN", 0)).Trim());
                            oRecordSet.DoQuery(s);

                            if (oRecordSet.RecordCount == 0)
                            {
                                FSBOApp.StatusBar.SetText("No se encuentra tipo de operacion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                _result = false;
                            }


                            Tabla = "OINV";

                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"SELECT COUNT(*) 'Cont'
                                            FROM {0} T1 WITH (NOLOCK)
                                            JOIN NNM1 T2 WITH (NOLOCK) ON T1.Series = T2.Series
                                           WHERE ISNULL(T1.U_BPP_MDTD, '') = '{1}'
                                                         AND ISNULL(T1.U_BPP_MDSD, '') = '{2}'
                                                         AND ISNULL(T1.U_BPP_MDCD, '') = '{3}'
                                                         AND CASE 
                                                               WHEN '{1}' = '01' THEN '--'
                                                               WHEN '{1}' = '03' THEN 'IB'
                                                               WHEN '{1}' = '08' THEN 'DN'
                                                               Else '-1'
                                                             END = T1.DocSubType";
                            }
                            else
                            {
                                s = @"SELECT COUNT(*) ""Cont""
                                            FROM ""{0}"" T1
                                            JOIN ""NNM1"" T2 ON T1.""Series"" = T2.""Series""
                                           WHERE IFNULL(T1.""U_BPP_MDTD"", '') = '{1}'
                                                         AND IFNULL(T1.""U_BPP_MDSD"", '') = '{2}'
                                                         AND IFNULL(T1.""U_BPP_MDCD"", '') = '{3}'
                                                         AND CASE
                                                               WHEN '{1}' = '01' THEN '--'
                                                               WHEN '{1}' = '03' THEN 'IB'
                                                               WHEN '{1}' = '08' THEN 'DN'
                                                               Else '-1'
                                                             END = T1.""DocSubType"" ";
                            }
                            s = String.Format(s, Tabla, ((System.String)oDBDSH.GetValue("U_BPP_MDTO", 0)).Trim(), ((System.String)oDBDSH.GetValue("U_BPP_MDSO", 0)).Trim(), ((System.String)oDBDSH.GetValue("U_BPP_MDCO", 0)).Trim());//, DocSubType);
                            oRecordSet.DoQuery(s);

                            if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                            {
                                _result = true;
                            }
                            else
                            {
                                FSBOApp.StatusBar.SetText("No se ha encontrado documento de referencia", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                _result = false;
                            }
                        }
                    }
                }
                else
                {
                    if ((TipoDocElec != "03") && (((VatStatus != "N") || (BPP_BPTP != "SND")) && ((TipoDocElec == "01") || (TipoDocElec == "08"))))
                    {
                        if ((System.String)(oDBDSDir.GetValue("CityB", 0)).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("Debe ingresar ciudad en Destinatario de Factura", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }

                        if (((System.String)(oDBDSDir.GetValue("BlockB", 0)).Trim() == "") && (_result))
                        {
                            FSBOApp.StatusBar.SetText("Debe ingresar comuna en Destinatario de Factura", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }

                        if (((System.String)(oDBDSDir.GetValue("StreetB", 0)).Trim() == "") && (_result))
                        {
                            FSBOApp.StatusBar.SetText("Debe ingresar calle en Destinatario de Factura", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            _result = false;
                        }
                    }
                }


                //Validar que ingresaron Nombre Cliente
                s = (System.String)(oDBDSH.GetValue("CardName", 0)).Trim();
                if ((s == "") && (_result))
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar Nombre Cliente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    _result = false;
                }

                //validar caracteres invalidos en el nombre del cliente
                //se comenta segun reunion de viernes 20150320, se creo una funcion que limpia lo caracteres invalidos al momento de enviar al portal
                //if (_result)
                //{
                //    foreach (String cara in CaracteresInvalidos)
                //    {
                //        if (s.IndexOf(cara) > 0)
                //        {
                //            FSBOApp.StatusBar.SetText(@"Nombre Cliente tiene caracteres prohibidos (" + cara + ")", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                //            _result = false;
                //            break;
                //        }
                //    }
                //}

                //se deja comentado, por problemas en la validacion de un cliente, Jimmy colocara una validacion en el TN 20151204
                //valida rut
                //if ((_result) && ((TipoDocElec != "03") && (((VatStatus != "N") || (BPP_BPTP != "SND")) && ((TipoDocElec == "01") || (TipoDocElec == "08")))))
                //{
                //    Param = new TFunctions();
                //    Param.SBO_f = FSBOf;
                //    s = Param.ValidarRuc((System.String)(oDBDSH.GetValue("LicTradNum", 0)));

                //    if (s != "OK")
                //    {
                //        FSBOApp.StatusBar.SetText(s, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                //        _result = false;
                //    }
                //}

                //valida descuentos negativos en el detalle del documento, caracteres especiales y descripcion de articulo
                if (_result)
                {
                    i = 0;
                    while (i < oDBDSDet.Size)
                    {
                        if (_result)
                        {
                            s = (System.String)(oDBDSDet.GetValue("Dscription", i));
                            if (s == "")
                            {
                                FSBOApp.StatusBar.SetText("Debe ingresar descripción en la linea " + Convert.ToString(i), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                _result = false;
                                i       = oDBDSDet.Size;
                            }
                        }
                        i++;
                    }
                }

                return(_result);
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("ValidarDatos_PE: " + e.Message + " ** Trace: " + e.StackTrace);
                return(false);
            }
        }
Esempio n. 20
0
        public static void clsSupplierPurchaseHistory_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            if (oForm != null)
            {
                oForm = oSetupForm;
                SAPbouiCOM.Grid oGrid;
                oGrid   = (SAPbouiCOM.Grid)oForm.Items.Item("4").Specific;
                oMatrix = (SAPbouiCOM.Matrix)oSOForm.Items.Item("38").Specific;
                if (pVal.BeforeAction)
                {
                    switch (pVal.EventType)
                    {
                    //case BoEventTypes.et_FORM_CLOSE:
                    //    BubbleEvent = false;
                    //    oForm.Visible = false;
                    //    break;

                    case BoEventTypes.et_DOUBLE_CLICK:
                        if (pVal.ItemUID == "4")
                        {
                            string strSelCol = "";
                            strSelCol = oGrid.Columns.Item(pVal.ColUID).TitleObject.Caption.ToString();
                            string[] words = strSelCol.Split('-');
                            string[] words1;
                            if (words.Length == 2)
                            {
                                oForm.Freeze(true);
                                for (int i = 0; i < oGrid.Rows.Count; i++)
                                {
                                    if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "")
                                    {
                                        if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "0")
                                        {
                                            words1 = oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim().Split(' ');
                                            if (words1[0].Trim() != "")
                                            {
                                                oGrid.DataTable.SetValue("Order Qty", i, words1[0].Trim());
                                            }
                                        }
                                    }
                                }
                                oForm.Freeze(false);
                            }
                        }
                        break;

                    case BoEventTypes.et_ITEM_PRESSED:
                        if (pVal.ItemUID == "2")
                        {
                            BubbleEvent   = false;
                            oForm.Visible = false;
                        }
                        if (pVal.ItemUID == "3")
                        {
                            flushAll();
                            BubbleEvent   = false;
                            oForm.Visible = false;
                            return;

                            oMatrix.Clear();
                            int j = oMatrix.RowCount;
                            if (j == 0)
                            {
                                oMatrix.AddRow(1, -1);
                            }
                            j = oMatrix.RowCount;

                            for (int i = 0; i < oGrid.Rows.Count; i++)
                            {
                                if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "")
                                {
                                    if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "0")
                                    {
                                        string strItemCode = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim();
                                        string strQty      = oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim();
                                        string strPrice    = oGrid.DataTable.GetValue("Current Purchase Price", i).ToString().Trim();
                                        string strUoM      = oGrid.DataTable.GetValue("UoM", i).ToString().Trim();
                                        try
                                        {
                                            ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(j).Specific).Value  = strItemCode;
                                            ((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(j).Specific).Value = strQty;
                                            try
                                            {
                                                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(j).Specific).Value = strUoM;
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            try
                                            {
                                                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(j).Specific).Value = strPrice;
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            j++;
                                        }
                                        catch (Exception)
                                        {
                                            j++;
                                        }
                                    }
                                }
                            }

                            //oForm.Close();
                            oForm.Visible = false;
                        }
                        break;

                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        if (pVal.ItemUID == "4")
                        {
                            if (pVal.ColUID == "UoM")
                            {
                                if (oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() != "")
                                {
                                    string squery = "Select T2.\"UomCode\",T2.\"UomName\" From OITM T0 Inner Join UGP1 T1 On T0.\"UgpEntry\" = T1.\"UgpEntry\" Inner Join OUOM T2 On T1.\"UomEntry\" = T2.\"UomEntry\" Where T0.\"ItemCode\" = '" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "'";
                                    Utilities.UtilitiesCls.CFLConditionQuery(ref oApplication, ref oCompany, oForm, ref pVal, squery, "UomCode", "10010198", "UomCode", false, true, "4", "UoM", false);
                                }
                            }
                            if (pVal.ColUID == "ItemCode")
                            {
                                SAPbouiCOM.ChooseFromListCollection oCFLs = null;
                                SAPbouiCOM.Conditions oCons = null;
                                SAPbouiCOM.Condition  oCon  = null;
                                oCFLs = oForm.ChooseFromLists;
                                SAPbouiCOM.ChooseFromList oCFL = null;
                                oCFL = oCFLs.Item("CFL_2");

                                oCons = new Conditions();
                                oCFL.SetConditions(oCons);


                                oCons = oCFL.GetConditions();



                                oCon           = oCons.Add();
                                oCon.Alias     = "PrchseItem";
                                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                oCon.CondVal   = "Y";

                                oCon.Relationship = BoConditionRelationship.cr_AND;
                                oCon           = oCons.Add();
                                oCon.Alias     = "frozenFor";
                                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                                oCon.CondVal   = "Y";


                                int intCnt = 2;
                                for (int i = 0; i < oGrid.Rows.Count; i++)
                                {
                                    if (oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim() != "")
                                    {
                                        if (intCnt > 0)
                                        {
                                            oCon.Relationship = BoConditionRelationship.cr_AND;
                                        }
                                        oCon           = oCons.Add();
                                        oCon.Alias     = "ItemCode";
                                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                                        oCon.CondVal   = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim();
                                        intCnt        += 1;
                                    }
                                }

                                oCFL.SetConditions(oCons);
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                else if (pVal.BeforeAction == false)
                {
                    switch (pVal.EventType)
                    {
                    case BoEventTypes.et_ITEM_PRESSED:
                        break;

                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        if (oForm.Mode != SAPbouiCOM.BoFormMode.fm_FIND_MODE)
                        {
                            if (pVal.ItemUID == "4")
                            {
                                if (pVal.ColUID == "ItemCode")
                                {
                                    oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                    string strQry      = "";
                                    string strItemCode = "";
                                    oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal);
                                    if (oDataTable != null)
                                    {
                                        strItemCode = oDataTable.GetValue("ItemCode", 0).ToString();
                                    }
                                    if (strItemCode != "")
                                    {
                                        strQry = " Exec EJ_LoadBPItemDetails '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "', '" + strItemCode + "'";
                                        oRecordSet.DoQuery(strQry);
                                        if (!oRecordSet.EoF)
                                        {
                                            oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode);
                                            oGrid.DataTable.SetValue("ItemName", pVal.Row, oRecordSet.Fields.Item("ItemName").Value.ToString());
                                            oGrid.DataTable.SetValue("Order Qty", pVal.Row, "");
                                            oGrid.DataTable.SetValue("UoM", pVal.Row, oRecordSet.Fields.Item("UoM").Value.ToString());
                                            oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString());
                                        }
                                    }

                                    oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode);
                                    int j = oGrid.Rows.Count;
                                    if (j == oGrid.Rows.Count)
                                    {
                                        oGrid.DataTable.Rows.Add();
                                    }
                                }

                                if (pVal.ColUID == "UoM")
                                {
                                    oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                    string strUoMCode = "";
                                    oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal);
                                    if (oDataTable != null)
                                    {
                                        strUoMCode = oDataTable.GetValue("UomCode", 0).ToString();
                                    }
                                    oGrid.DataTable.SetValue("UoM", pVal.Row, strUoMCode);
                                    string strQry = " Exec EJ_LoadUoMPrice '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "','" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "' ,'" + strUoMCode + "'";
                                    oRecordSet.DoQuery(strQry);
                                    if (!oRecordSet.EoF)
                                    {
                                        oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString());
                                    }
                                }
                            }
                        }
                        break;

                    case BoEventTypes.et_COMBO_SELECT:

                        break;

                    case BoEventTypes.et_FORM_CLOSE:
                        oForm = null;
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 지정된 문서를 DBDatasource로 다시 로드 합니다.
        /// </summary>
        /// <param name="KeyValue">문서번호(DocEntry)</param>
        private void SetFormLoadFromDBDatasource()
        {
            try
            {
                string LineKey = FN.GetRecordsetValue(string.Format("SELECT TOP 1 U_TYPE FROM [@KIS_AD0030M_HRD] WHERE U_USERID = '{0}'", LoginId));

                oForm.Mode = BoFormMode.fm_OK_MODE;

                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();

                SAPbouiCOM.DBDataSource oKIS_AD0030M_HRD = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_AD0030M_HRD");

                SAPbouiCOM.Condition oCon = null;

                oCon = oCons.Add();

                oCon.Alias = "Code";
                oCon.Operation = BoConditionOperation.co_EQUAL;
                oCon.CondVal = LoginId + LineKey;
                
                oKIS_AD0030M_HRD.Query(oCons);

                oCon = null;
                oCons = null;

                oKIS_AD0030M_HRD = null;
                /* 아래 코드부터는  ET_AFFormDataLoad 이벤트와 동일하게 설정해준다.*/

                oDB_M.SetValue("U_TYPE", 0, LineKey);

                FindData(oForm, LineKey);

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }

        }
Esempio n. 22
0
        /// <summary>
        /// 폼(Form) 및 아이템들(Items)의 기본값으로 설정되야하는 항목들을 정의합니다.
        /// </summary>
        private void Act3_DefualtSetting()
        {
            // '// ADD YOUR ACTION CODE HERE ...
            try
            {
                #region Form Setting

                oForm.DataBrowser.BrowseBy = "edtCode";

                oForm.SupportedModes = -1;
                oForm.Settings.EnableRowFormat = false;
                oForm.Settings.Enabled = false;
                oForm.AutoManaged = true;
                //oForm.PaneLevel = 1;

                //if (oForm.Mode != BoFormMode.fm_ADD_MODE && oForm.Mode != BoFormMode.fm_VIEW_MODE)
                //{
                //    oForm.Mode = BoFormMode.fm_ADD_MODE;
                //}

                //아이템 Enalbled = false 처리시 커서를 빈 텍스트 박스로 옴기기 위해 임시 아이템 추가
                oForm.Items.Add("btnCHOOSE", BoFormItemTypes.it_BUTTON);
                SAPbouiCOM.Item oItem = (SAPbouiCOM.Item)oForm.Items.Item("btnCHOOSE");
                oItem.Left = -100;

                #endregion


                SAPbouiCOM.Conditions oCons = new SAPbouiCOM.Conditions();
                //oCons = FN.GetConditionsWithQuery("CARDTYPE == S");
                oCons = null;

                FN.SetChooseFromListAdd(oForm, "2", "edtCARDCD", "CardCode", BoFormItemTypes.it_EXTEDIT, oCons);
                FN.SetChooseFromListAdd(oForm, "2", "edtCARDNM", "CardName", BoFormItemTypes.it_EXTEDIT, oCons);
                FN.SetChooseFromListAdd(oForm, "2", "edtBCARDCD", "CardCode", BoFormItemTypes.it_EXTEDIT, oCons);
                FN.SetChooseFromListAdd(oForm, "2", "edtBCARDNM", "CardName", BoFormItemTypes.it_EXTEDIT, oCons);

                #region Button
                FN.SetChooseFromListAdd(oForm, "KIS_SO0040_HRD", "btnCHOOSE", "", BoFormItemTypes.it_BUTTON, null);
                #endregion

                #region Matrix

                SAPbouiCOM.Matrix oMatrix = oForm.Items.Item("mtx1").Specific;
                SAPbouiCOM.DBDataSource oKIS_SO00401_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SO00401_HRD");

                oMatrix.SelectionMode = BoMatrixSelect.ms_Single;

                FN.SetChooseFromListAdd(oForm, ((int)BoObjectTypes.oEmployeesInfo).ToString(), "mtx1", "U_EMPNO", BoFormItemTypes.it_MATRIX, null, "U_ZIPCD1", true);
                FN.SetChooseFromListAdd(oForm, ((int)BoObjectTypes.oEmployeesInfo).ToString(), "mtx1", "U_EMPNO", BoFormItemTypes.it_MATRIX, null, "U_ZIPCD2", true);

                //FN.SetMatrixAddRow(ref oForm, ref oMatrix, ref oKIS_SO00401_HRD, FN.RowSelectMode.None, "U_CENTCD");

                oKIS_SO00401_HRD = null;
                oMatrix = null;

                #endregion

                #region SetAutoManagedAttribute

                string AllString = "cboAREA,edtCode,edtName,cboBRCGBN,edtBRCMNG,edtCARDCD,edtCARDNM,edtCARDDT,edtBCARDCD,edtBCARDNM,cboBILLGBN,edtKHPRICE,edtHEPRICE,edtDELVAMT,cboDPOSYN,edtKHCNT,edtHECNT,edtEMAIL,btnFIND";
                string AddString = "cboAREA,edtCode,edtName,cboBRCGBN,edtBRCMNG,edtCARDCD,edtCARDNM,edtCARDDT,edtBCARDCD,edtBCARDNM,cboBILLGBN,edtKHPRICE,edtHEPRICE,edtDELVAMT,cboDPOSYN,edtKHCNT,edtHECNT,edtEMAIL";
                string OKString = "edtName,cboAREA,cboBRCGBN,edtBRCMNG,edtCARDCD,edtCARDNM,edtCARDDT,edtBCARDCD,edtBCARDNM,cboBILLGBN,edtKHPRICE,edtHEPRICE,edtDELVAMT,cboDPOSYN,edtKHCNT,edtHECNT,edtEMAIL";
                string FindString = "edtCode,edtName,btnFIND";

                FN.SetAutoManagedAttribute(ref oForm, AllString, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_All, BoModeVisualBehavior.mvb_False);
                FN.SetAutoManagedAttribute(ref oForm, AddString, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Add, BoModeVisualBehavior.mvb_True);
                FN.SetAutoManagedAttribute(ref oForm, OKString, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True);
                FN.SetAutoManagedAttribute(ref oForm, FindString, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Find, BoModeVisualBehavior.mvb_True);

                #endregion

                if (!string.IsNullOrEmpty(SO.SO_COMMON_HRD.KeyValue)) GetDataLoad(oForm, SO.SO_COMMON_HRD.KeyValue);

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                SO.SO_COMMON_HRD.KeyValue = null;
            }
        }