Esempio n. 1
0
        public void A00_SubFormInit(string pStrPFormUID, int pRows = -1, string extCOM = "", string popupID = "", string callBack = "CallBack")
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            oForm.Freeze(true);

            Act02_DataSourcesBinding(oForm, pRows, extCOM, popupID, callBack);
            Act03_DefualtSetting(oForm, pStrPFormUID);

            #region 콜백버튼생성
            if (!FN.GetItemExistsChk(pForm, callBack))
            {
                pForm.Freeze(true);
                SAPbouiCOM.Item oItm;
                oItm = pForm.Items.Add(callBack, BoFormItemTypes.it_BUTTON);
                oItm.Top = -100;
                oItm.Left = -100;
                oItm.Width = 1;
                oItm.Height = 1;
                oItm.LinkTo = "";

                SAPbouiCOM.Button oButton = (SAPbouiCOM.Button)oItm.Specific;
                oButton.Caption = popupID;
                pForm.Freeze(false);
            }
            #endregion

            oForm.Freeze(false);
        }
Esempio n. 2
0
        //[B1Listener(BoEventTypes.et_MENU_CLICK, true, ActionType.Mnu)]
        //public virtual bool ET_BFMenuClick(MenuEvent pVal) {
        //    // ADD YOUR ACTION CODE HERE ...
        //    return this.LoadForm();
        //}
        
        //[B1Listener(BoEventTypes.et_MENU_CLICK, false, ActionType.Mnu)]
        //public virtual void ET_OnAfterMenuClick(MenuEvent pVal) {
        //    oForm.Freeze(true);
        //    this.Act1_FormInit();
        //    oForm.Freeze(false);
        //    // ADD YOUR ACTION CODE HERE ...
        //}

        public void SubFormInit(string Pformuid, string pCol, string ColName, string Col, string FRCol = "", string TOCol = "")
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.Item(formuid);
            oForm.Freeze(true);
            this.Act1_FormInit(Pformuid, pCol, ColName, Col, FRCol, TOCol);
            oForm.Freeze(false);
        }
Esempio n. 3
0
 public virtual void ET_OnAfterMenuClick(MenuEvent pVal) 
 {
     oForm = B1Connections.theAppl.Forms.Item(formuid);
     oForm.Freeze(true);
     this.Act1_FormInit(oForm);
     oForm.Freeze(false);
     // ADD YOUR ACTION CODE HERE ...
 }
Esempio n. 4
0
        //[B1Listener(BoEventTypes.et_MENU_CLICK, true, ActionType.Mnu)]
        //public virtual bool ET_BFMenuClick(MenuEvent pVal) {
        //    // ADD YOUR ACTION CODE HERE ...
        //    return this.LoadForm();
        //}
        
        //[B1Listener(BoEventTypes.et_MENU_CLICK, false, ActionType.Mnu)]
        //public virtual void ET_OnAfterMenuClick(MenuEvent pVal) {
        //    oForm.Freeze(true);
        //    this.Act1_FormInit();
        //    oForm.Freeze(false);
        //    // ADD YOUR ACTION CODE HERE ...
        //}

        public void SubFormInit(string Pformuid)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.Item(formuid);
            oForm.Freeze(true);
            this.Act1_FormInit(Pformuid);
            oForm.Freeze(false);
        }
Esempio n. 5
0
 /// <summary>
 /// 화면 팝업에 필요한 설정정보를 호출합니다.
 /// </summary>
 private void Act1_FormInit()
 {
     oForm = B1Connections.theAppl.Forms.ActiveForm;
     oForm.Freeze(true);
     Act2_DataSourcesBinding(oForm);
     Act3_DefualtSetting(oForm);
     //Act4_FormMenuSetting(oForm);
     //FindData(false)
     oForm.Freeze(false);
 }
Esempio n. 6
0
        //protected KIS_SO0031F_HRD(string strFormType, string strFormUID, bool bAddOn)
        //    : base(strFormType, strFormUID, bAddOn)
        //{
        //}

        //[B1Listener(BoEventTypes.et_MENU_CLICK, true, ActionType.Mnu)]
        //public virtual bool ET_BFMenuClick(MenuEvent pVal) {
        //    // ADD YOUR ACTION CODE HERE ...
        //    return this.LoadForm();
        //}

        //[B1Listener(BoEventTypes.et_MENU_CLICK, false, ActionType.Mnu)]
        //public virtual void ET_OnAfterMenuClick(MenuEvent pVal) {
        //    oForm.Freeze(true);
        //    this.Act1_FormInit();
        //    oForm.Freeze(false);
        //    // ADD YOUR ACTION CODE HERE ...
        //}

        public void A00_SubFormInit(string pStrPFormUID, Dictionary<string, string> pParamDict)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            oForm.Freeze(true);

            Act02_DataSourcesBinding(oForm);
            Act03_DefualtSetting(oForm, pStrPFormUID, pParamDict);

            oForm.Freeze(false);
        }
Esempio n. 7
0
        /// <summary>
        /// 화면 팝업에 필요한 설정정보를 호출합니다.
        /// </summary>
        public void A00_SubFormInit(string pStrPFormUID)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            oForm.Freeze(true);

            Act02_DataSourcesBinding(oForm);
            Act03_DefualtSetting(oForm, pStrPFormUID);
            Act04_FormMenuSetting();
            oForm.Freeze(false);
        }
Esempio n. 8
0
        public void Act0_SubFormInit(string pStrPFormUID, string pDocEntry)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.ActiveForm;

            SAPbouiCOM.Form pForm = B1Connections.theAppl.Forms.Item(pStrPFormUID);
            // UserDataSource 가 있는지 체크한다.(모달팝업여부)
            if (FN.GetUserDataSourceExistsChk(pForm, "cFORMUID"))
                pForm.DataSources.UserDataSources.Item("cFORMUID").Value = oForm.UniqueID;


            oForm.Freeze(true);
            Act2_DataSourcesBinding(oForm);
            //Call LabelInit(oForm)
            Act3_DefualtSetting(oForm, pStrPFormUID, pDocEntry);
            Act4_FormMenuSetting(oForm);
            //FindData(false)
            oForm.Freeze(false);
        }
Esempio n. 9
0
 /// <summary>
 /// 화면 팝업에 필요한 설정정보를 호출합니다.
 /// </summary>
 private void Act1_FormInit()
 {
     // '// ADD YOUR ACTION CODE HERE ...
     oForm = B1Connections.theAppl.Forms.ActiveForm;
     oForm.Freeze(true);
     Act2_DataSourcesBinding(oForm);
     Act3_DefualtSetting(oForm, "");
     Act4_FormMenuSetting(oForm);
     //FindData(false)
     oForm.Freeze(false);
 }
Esempio n. 10
0
        public void SubFormInit(string KeyValue)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.Item(formuid);
            oForm.Freeze(true);
            this.Act1_FormInit();

            oForm.Freeze(false);
            oForm.Visible = true;

            oForm.Mode = BoFormMode.fm_FIND_MODE;
            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("edtCODE").Specific;
            oEditText.Value = KeyValue;

            SAPbouiCOM.Item oItem = oForm.Items.Item("1");
            oItem.Click();

            oItem = null;

        }
Esempio n. 11
0
        public void SubFormInit(string KeyValue)
        {
            this.LoadForm();
            oForm = B1Connections.theAppl.Forms.Item(formuid);
            oForm.Freeze(true);
            this.Act1_FormInit();
            if (oForm.Mode != BoFormMode.fm_VIEW_MODE) { oForm.Mode = BoFormMode.fm_OK_MODE; }

            oForm.Freeze(false);
            oForm.Visible = true;

            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd").Specific;

            for (int iLooper = 0; iLooper < oGrid.Rows.Count; iLooper++)
            {
                if (oGrid.DataTable.Columns.Item("Code").Cells.Item(oGrid.GetDataTableRowIndex(iLooper)).Value.ToString() == KeyValue)
                {
                    Veiw_Grid_SelectedRow(iLooper);
                    break;
                }
            }
        }
Esempio n. 12
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. 13
0
        public virtual bool ET_1_BFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));

            // ADD YOUR ACTION CODE HERE ...
            try
            {
                oForm.Freeze(true);

                switch (oForm.Mode)
                {
                    case BoFormMode.fm_ADD_MODE:
                        oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                        oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0280T_HRD");
                        oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_SO02801_HRD");
                        if (!FN.CondValidationChk(oForm, "cboDEPYM,edtBNKACCT,edtDEPDT", "sttDEPYM,sttBNKACCT,sttDEPET"))
                            return false;
                        if (oDB_1.GetValue("U_RDCD", 0).ToString() == "")
                        {
                            B1Connections.theAppl.StatusBar.SetText("라인 데이터가 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            return false;
                        }
                        //string DocEntry = CreateDoc(oForm);5

                        string DocEntry = "";
                        return true;

                        //if (!string.IsNullOrEmpty(DocEntry))
                        //{

                        //    FN.SetDbsWithConditionsQuery(ref oDB_M, "DocEntry==" + DocEntry);
     
                        //    FN.SetDbsWithConditionsQuery(ref oDB_1, "DocEntry==" + DocEntry);

                        //    oMatrix.LoadFromDataSource();

                        //    oForm.Mode = BoFormMode.fm_OK_MODE;
                        //}

                        //return false;

                    case BoFormMode.fm_UPDATE_MODE:
                        break;
                    case BoFormMode.fm_EDIT_MODE:
                        break;
                    case BoFormMode.fm_FIND_MODE:
                        break;
                    case BoFormMode.fm_OK_MODE:
                        break;
                    case BoFormMode.fm_PRINT_MODE:
                        break;
                    case BoFormMode.fm_VIEW_MODE:
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            finally
            {
                oForm.Freeze(false);
            }

            //FN.GetRecordsetValue("EXEC [KIS_SP_ADDON] @work_type = 'I', @object_type = 'KIS_SO0160_HRD'");
            return true;
        }
Esempio n. 14
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;

            //SAPbouiCOM.EditTextColumn oEditText;
            SAPbouiCOM.CommonSetting oSetting;
            TFunctions Reg;
            bool       Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_Sucursal.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FESUC");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific);
                //oCombo.ValidValues.Add('33', 'Factura');

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';
                //        oMtx.AutoResizeColumns();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount == 0)
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select Code from [@VID_FESUC] where Code = 'Principal'";
                    }
                    else
                    {
                        s = @"select ""Code"" from ""@VID_FESUC"" where ""Code"" = 'Principal' ";
                    }
                    oRecordSet.DoQuery(s);
                    if (oRecordSet.RecordCount == 0)
                    {
                        Reg       = new TFunctions();
                        Reg.SBO_f = FSBOf;
                        oDBDSH.Clear();
                        oDBDSH.InsertRecord(0);
                        oDBDSH.SetValue("Code", 0, "Principal");
                        oDBDSH.SetValue("Name", 0, "SAP BO");
                        oDBDSH.SetValue("U_Habilitada", 0, "Y");
                        if (Reg.FESUCAdd(oDBDSH) == true)
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal creada correctamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal no ha sido creada", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                    }
                }

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("Code", i, (System.String)(oRecordSet.Fields.Item("Code").Value));
                    oDBDSH.SetValue("Name", i, (System.String)(oRecordSet.Fields.Item("Name").Value));
                    oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("Code", i, "");
                oDBDSH.SetValue("Name", i, "");
                oDBDSH.SetValue("U_Habilitada", i, "Y");

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FESUC' and FieldID = 0";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FESUC' and ""FieldID"" = 0";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habilitada"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();

                oSetting = oMtx.CommonSetting;
                i        = 1;
                while (i <= oMtx.RowCount)
                {
                    if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "")
                    {
                        oSetting.SetCellEditable(i, 1, false);
                    }
                    i++;
                }

                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 15
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);
                oMatrix.AddRow(1, -1);
                int i = oMatrix.VisualRowCount;
                oMatrix.DeleteRow(i);
                oMatrix.FlushToDataSource();
                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Busca la información de acuerdo a los filtros capturados
        /// </summary>
        /// <param name="efiscal"></param>
        /// <param name="codigo"></param>
        /// <param name="descripcion"></param>
        /// <param name="combos"></param>
        public void BuscarDatos()
        {
            try
            {
                _oForma.Freeze(true);

                string qryFechas  = null;
                string qryAlmacen = null;


                if (!string.IsNullOrEmpty(_oTxtFechaInicial.Value) || !string.IsNullOrEmpty(_oTxtFechaFinal.Value) ||
                    !string.IsNullOrEmpty(_oTxtOficina.Value))
                {
                    if (!_oTxtFechaInicial.Value.Equals("") && !_oTxtFechaFinal.Value.Equals(""))
                    {
                        string fechaDesde = _oTxtFechaInicial.Value.Substring(0, 4) + "-" + _oTxtFechaInicial.Value.Substring(4, 2) + "-" +
                                            _oTxtFechaInicial.Value.Substring(6, 2);

                        string fechaHasta = _oTxtFechaFinal.Value.Substring(0, 4) + "-" + _oTxtFechaFinal.Value.Substring(4, 2) + "-" +
                                            _oTxtFechaFinal.Value.Substring(6, 2);

                        DateTime fInicial = Convert.ToDateTime(fechaDesde);
                        DateTime fFinal   = Convert.ToDateTime(fechaHasta);

                        if (fInicial <= fFinal)
                        {
                            qryFechas = " AND T1.DocDate BETWEEN '" + _oTxtFechaInicial.Value + "' AND '" + _oTxtFechaFinal.Value + "'";
                        }
                        else
                        {
                            _Application.MessageBox("La fecha inicial es mayor a la final");
                            return;
                        }
                    }
                    else if (!_oTxtFechaInicial.Value.Equals(""))
                    {
                        qryFechas = " AND T1.DocDate = '" + _oTxtFechaInicial.Value + "'";
                    }
                    else if (!_oTxtFechaFinal.Value.Equals(""))
                    {
                        qryFechas = " AND T1.DocDate = '" + _oTxtFechaFinal.Value + "'";
                    }

                    if (!_oTxtOficina.Value.Equals(""))
                    {
                        if (_oTxtOficina.Value == "GDLV97")
                        {
                            qryAlmacen = " AND T1.Filler = 'GDLCONS'";
                        }
                        else
                        {
                            qryAlmacen = " AND T1.Filler = '" + _oTxtOficina.Value + "'";
                        }
                    }

                    _oForma.DataSources.DataTables.Item(DT_PRECONTRATOS)
                    .ExecuteQuery(@"SELECT  T1.DocEntry AS DocEntry,
                                                'Crear' AS Crear,
                                                T4.USER_CODE AS CodigoUsuario,
                                                T1.DocNum AS DocNum,
                                                T0.U_Serie AS Serie,
                                                T0.U_CodPromotor AS CodigoPromotor,
                                                T0.U_NombrePromotor AS NombrePromotor,
                                                T0.ItemCode AS CodigoPlan,
                                                T0.Dscription AS NombrePlan,
                                                T0.U_FormaPago AS FormaDePago,
                                                T2.NAME AS OrigenSolicitud,
                                                T0.U_InvInicial AS InversionInicial,
                                                T0.U_Comision AS Comision,
                                                T0.U_PapeleriaSol AS ImportePapeleria,
                                                T0.U_Importe AS ImporteRecibido,
                                                T0.U_ExcInvIni AS ExcedenteInvIni,
                                                T0.U_Bono AS Bono
                                        FROM    dbo.WTR1 T0
                                                LEFT JOIN dbo.OWTR T1 ON T1.DocEntry = T0.DocEntry
                                                INNER JOIN dbo.[@ORIGSOLICITUD] T2 ON T2.Code = T0.U_OrigenSolicitud
                                                LEFT JOIN dbo.OUSR T4 ON T1.UserSign = T4.USERID
                                        WHERE   NOT EXISTS ( SELECT T3.U_TraspasoRel AS DocNum,
                                                                    T3.U_SolicitudInt AS Serie
                                                             FROM   dbo.OCRD T3
                                                             WHERE  T3.U_TraspasoRel = T1.DocNum
                                                                    AND T3.U_SolicitudInt = T0.U_Serie AND T3.U_TraspasoRel IS NOT NULL)
                                                AND T1.U_TipoMov IN( 'OFICINAS - CONTRATOS','PROMOTOR - ADMON CONTRATOS')
                                                AND T0.U_FormaPago IS NOT NULL
                                                AND T0.U_OrigenSolicitud IS NOT NULL
                                                AND T0.U_Importe IS NOT NULL
                                                AND T0.U_InvInicial IS NOT NULL
                                                AND T0.U_StatusSolicitud <> 'N' -- ERRONEO
                                                AND T0.U_StatusSolicitud <> 'C' -- CANCELADO
                                                AND T0.U_StatusSolicitud <> 'A' -- ATRACO
                                                AND T0.U_StatusSolicitud <> 'E' -- EXTRAVIO
                                                AND T0.U_Serie IS NOT NULL
                                                AND T1.Comments IS NULL
                                                AND T1.DataSource <> 'N'
                                                AND T1.DocStatus <> 'C' " +
                                  qryFechas + qryAlmacen +
                                  " ORDER BY T0.DocEntry,T0.LineNum  ASC ");
                }
                else
                {
                    _oForma.DataSources.DataTables.Item(DT_PRECONTRATOS)
                    .ExecuteQuery(@"SELECT  T1.DocEntry AS DocEntry,
                                                'Crear' AS Crear,
                                                T4.USER_CODE AS CodigoUsuario,
                                                T1.DocNum AS DocNum,
                                                T0.U_Serie AS Serie,
                                                T0.U_CodPromotor AS CodigoPromotor,
                                                T0.U_NombrePromotor AS NombrePromotor,
                                                T0.ItemCode AS CodigoPlan,
                                                T0.Dscription AS NombrePlan,
                                                T0.U_FormaPago AS FormaDePago,
                                                T2.NAME AS OrigenSolicitud,
                                                T0.U_InvInicial AS InversionInicial,
                                                T0.U_Comision AS Comision,
                                                T0.U_PapeleriaSol AS ImportePapeleria,
                                                T0.U_Importe AS ImporteRecibido,
                                                T0.U_ExcInvIni AS ExcedenteInvIni,
                                                T0.U_Bono AS Bono                                                
                                        FROM    dbo.WTR1 T0
                                                LEFT JOIN dbo.OWTR T1 ON T1.DocEntry = T0.DocEntry
                                                INNER JOIN dbo.[@ORIGSOLICITUD] T2 ON T2.Code = T0.U_OrigenSolicitud
                                                LEFT JOIN dbo.OUSR T4 ON T1.UserSign = T4.USERID
                                        WHERE   NOT EXISTS ( SELECT T3.U_TraspasoRel AS DocNum,
                                                                    T3.U_SolicitudInt AS Serie
                                                             FROM   dbo.OCRD T3
                                                             WHERE  T3.U_TraspasoRel = T1.DocNum
                                                                    AND T3.U_SolicitudInt = T0.U_Serie AND T3.U_TraspasoRel IS NOT NULL)
                                                AND T1.U_TipoMov IN( 'OFICINAS - CONTRATOS','PROMOTOR - ADMON CONTRATOS')
                                                AND T0.U_FormaPago IS NOT NULL
                                                AND T0.U_OrigenSolicitud IS NOT NULL
                                                AND T0.U_Importe IS NOT NULL
                                                AND T0.U_InvInicial IS NOT NULL
                                                AND T0.U_Serie IS NOT NULL
                                                AND T0.U_StatusSolicitud <> 'N' -- ERRONEO
                                                AND T0.U_StatusSolicitud <> 'C' -- CANCELADO
                                                AND T0.U_StatusSolicitud <> 'A' -- ATRACO
                                                AND T0.U_StatusSolicitud <> 'E' -- EXTRAVIO
                                                AND T0.U_Serie IS NOT NULL
                                                AND T1.DocStatus <> 'C'
                                                AND T1.DataSource <> 'N'
                                                AND T1.Comments IS NULL
                                        ORDER BY T0.DocEntry,T0.LineNum  ASC      
                                        ");
                }

                _oGridPrecontratos           = (SAPbouiCOM.Grid)_oForma.Items.Item(GRDPRECONTRATO).Specific;
                _oGridPrecontratos.DataTable = _oForma.DataSources.DataTables.Item(DT_PRECONTRATOS);
                FormatoGrid(_oGridPrecontratos);
            }
            catch (Exception ex)
            {
                throw new Exception("Error al buscar datos *BuscarDatos* : " + ex.Message);
            }
            finally
            {
                _oForma.Freeze(false);
            }
        }
Esempio n. 17
0
        public virtual void ET_btnTARGET_AFItemPressed(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnTARGET").Specific));
            // ADD YOUR ACTION CODE HERE ...
            oForm.Freeze(true);
            try
            {
                string DocEntry = FN.GetItemVal(ref oForm, "edtDOCNUM");


                using (KIS_SD0050A_HRD oKIS_SD0050A_HRD = new KIS_SD0050A_HRD())
                {
                    oKIS_SD0050A_HRD.SubFormCopy(oForm.UniqueID);
                   
                }



                //using (KIS_SD0041F_HRD oKIS_SD0041F = new KIS_SD0041F_HRD())
                //{
                //    oKIS_SD0041F.UDO_Add_Data_COPY_KIS_SD0050_HRD(DocEntry);
                //}

                //B1Connections.theAppl.StatusBar.SetText("작업이 완료되었습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);

                //SetFormLoadFromDBDatasource(DocEntry);




            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
            
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oCombo;
            SAPbouiCOM.GridColumn oColumn;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet      = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
                Funciones.SBO_f = FSBOf;
                Lista           = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FECAF.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All
                oForm.EnableMenu("1281", false); //Buscar
                oForm.EnableMenu("1282", false); //Crear

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //        oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH     = oForm.DataSources.DBDataSources.Add("@VID_FECAF");
                ogrid      = (Grid)(oForm.Items.Item("grid").Specific);
                oDataTable = oForm.DataSources.DataTables.Add("dt");

                ogrid.DataTable = oDataTable;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select ISNULL(U_MultiSoc,'N') MultiSoc from [@VID_FEPARAM]";
                }
                else
                {
                    s = @"select IFNULL(""U_MultiSoc"",'N') ""MultiSoc"" from ""@VID_FEPARAM"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if (((System.String)oRecordSet.Fields.Item("MultiSoc").Value).Trim() == "Y")
                    {
                        bMultiSoc = true;
                    }
                    else
                    {
                        bMultiSoc = false;
                    }
                }
                else
                {
                    bMultiSoc = false;
                }


                ActualizarGrilla();
                // Ok Ad  Fnd Vw Rq Sec
                //        Lista.Add('TipoDoc   , f,  t,  t,  f, r, 1');
                //        FSBOf.SetAutoManaged(var oForm, Lista);

                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin Initform
Esempio n. 19
0
        /// <summary>
        /// Eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Id de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="BubbleEvent">Evento true/false</param>
        public override void eventos(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.BeforeAction == false && pVal.FormType == FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_FORM_RESIZE)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        OcultarControlesVentana(_oForm);
                        CrearCamposDeUsuario(_oForm);
                    }

                    if (pVal.EventType == BoEventTypes.et_FORM_CLOSE)
                    {
                        if (_oContadorFormas == 1)
                        {
                            _Application.ItemEvent      -= new _IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                            _Application.StatusBarEvent -= new SAPbouiCOM._IApplicationEvents_StatusBarEventEventHandler(SBO_Application_StatusBarEvent);
                            Dispose();
                            application            = null;
                            company                = null;
                            _oTransferenciaDeStock = false;
                            Addon.typeList.RemoveAll(p => p._forma == formID);
                            return;
                        }
                        else
                        {
                            _oContadorFormas -= 1;
                        }
                    }

                    if (pVal.EventType == BoEventTypes.et_FORM_ACTIVATE)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        CrearCamposDeUsuario(_oForm);
                    }
                }

                if (pVal.BeforeAction == true && pVal.FormType == FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.ItemUID == TXT_SERIE && pVal.CharPressed == CHAR_PRESS_ENTER && pVal.EventType == BoEventTypes.et_KEY_DOWN)
                    {
                        _oForm          = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oTxtSerie      = _oForm.Items.Item(TXT_SERIE).Specific;
                        _oAlmacenOrigen = _oForm.Items.Item(TXT_ALMACEN_ORIGEN).Specific;
                        _oForm.Select();
                        if (!string.IsNullOrEmpty(_oTxtSerie.Value.ToString()))
                        {
                            _oForm.Select();
                            AgregarArticulo(_oForm, _oTxtSerie.Value.ToString(), _oAlmacenOrigen.Value.ToString());
                            _oForm.Select();
                        }
                        else
                        {
                            _Application.MessageBox("Capture el número de serie");
                        }
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE_INICIO && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }
                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE_FIN && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == BTN_CREAR && pVal.InnerEvent == true)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == BTN_CREAR && pVal.InnerEvent == false)
                    {
                        _oForm       = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        oBtnCrearSAP = _oForm.Items.Item(BTN_CREAR).Specific;

                        if (oBtnCrearSAP.Caption == "Crear")
                        {
                            string msgError = ValidarStatusSolicitudGrid(_oForm);

                            if (!string.IsNullOrEmpty(msgError))
                            {
                                _Application.MessageBox(msgError);
                                bubbleEvent = false;
                                bubbleEvent = false;
                                return;
                            }
                        }
                    }
                }

                if (pVal.BeforeAction == true && pVal.FormType == -FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_COMBO_SELECT && pVal.ItemUID == TIPO_MOVIMIENTO)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oCmbTipoMovimiento = _oForm.Items.Item(TIPO_MOVIMIENTO).Specific;

                        if (!string.IsNullOrEmpty(_oCmbTipoMovimiento.Value.ToString()))
                        {
                            if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                            {
                                if (_Application.MessageBox("Estas seguro de cambiar el tipo de movimiento sin crear." + Environment.NewLine + "¿Desea continuar?", 2, "Si", "No") == 1)
                                {
                                    try
                                    {
                                        _oTxtPromotor.Value = "";
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                                else
                                {
                                    bubbleEvent = false;
                                }
                            }
                        }
                    }
                }



                if (pVal.BeforeAction == false && pVal.FormType == -FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_COMBO_SELECT && pVal.ItemUID == TIPO_MOVIMIENTO)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oForm.Freeze(true);
                        SAPbouiCOM.Form F1 = _Application.Forms.GetFormByTypeAndCount(Convert.ToInt32(_oForm.TypeEx.TrimStart('-')), _oForm.TypeCount);
                        F1.Freeze(true);
                        _oTxtPromotor       = F1.Items.Item(TXT_PROMOTOR).Specific;
                        _oTxtNombrePromotor = F1.Items.Item(TXT_NOMBRE_PROMOTOR).Specific;
                        _oTxtSerie          = F1.Items.Item(TXT_SERIE).Specific;
                        _oCmbTipoMovimiento = _oForm.Items.Item(TIPO_MOVIMIENTO).Specific;


                        if (!string.IsNullOrEmpty(_oCmbTipoMovimiento.Value.ToString()))
                        {
                            F1.Items.Item(TXT_SERIE).Enabled = true;
                            TipoMovimiento            = _oCmbTipoMovimiento.Value.ToString().TrimEnd(' ');
                            _oTxtFechaContabilizacion = F1.Items.Item(TXT_FECHA_CONTABILIZACION).Specific;
                            _oTxtFechaDocumento       = F1.Items.Item(TXT_FECHA_DOCUMENTO).Specific;

                            if (TipoMovimiento != "PROMOTORES - OFICINAS" && TipoMovimiento != "OFICINAS - PROMOTORES")
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    _oTxtPromotor.Value       = Extensor.ObtenerSecretaria(_Company, "U_codigo_secretaria");
                                    _oTxtNombrePromotor.Value = Extensor.ObtenerSecretaria(_Company, "T0.U_nombre_secretaria");
                                }
                            }
                            else
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    _oTxtPromotor.Value       = "";
                                    _oTxtNombrePromotor.Value = "";
                                }
                            }

                            if (TipoMovimiento == "PROMOTORES - OFICINAS" || TipoMovimiento == "OFICINAS - PROMOTORES")
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    //if (Extensor.ValidarImpresionCorteSolicitudes(_Company))
                                    //{
                                    if (F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled == true)
                                    {
                                        _oTxtFechaContabilizacion.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                        _oTxtFechaDocumento.Value       = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                        F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = false;
                                        F1.Items.Item(TXT_PROMOTOR).Click();
                                        F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = false;
                                    }
                                    //}
                                    //else
                                    //{
                                    //    if (F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled == true)
                                    //    {
                                    //        DateTime hoy = DateTime.Now;
                                    //        DateTime mañana = hoy.AddDays(1);
                                    //        _oTxtFechaContabilizacion.Value = hoy.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString();
                                    //        _oTxtFechaDocumento.Value = mañana.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString();
                                    //        F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = false;
                                    //        F1.Items.Item(TXT_PROMOTOR).Click();
                                    //        F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = false;
                                    //    }
                                    //}
                                }
                            }
                            else
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    F1.Items.Item(TXT_PROMOTOR).Click();
                                    F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = true;
                                    _oTxtFechaContabilizacion.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                    F1.Items.Item(TXT_PROMOTOR).Click();
                                    F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = true;
                                    _oTxtFechaDocumento.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                }
                            }
                        }

                        _oForm.Freeze(false);
                        F1.Freeze(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en método 'eventos' *clsTransferenciaDeStock* : " + ex.Message);
            }
        }
Esempio n. 20
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oComboBox;
            SAPbouiCOM.Column oColumn;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_FELibros.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All

                oForm.EnableMenu("1281", false); //Actualizar
                oForm.EnableMenu("1282", false); //Crear

                oDataTable      = oForm.DataSources.DataTables.Add("dt");
                ogrid           = (SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific);
                ogrid.DataTable = oDataTable;
                if (TipoLibro == "V")
                {
                    oForm.Title = "Libro de Ventas";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcVenta,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcVenta"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "C")
                {
                    oForm.Title = "Libro de Compras";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcCompra,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcCompra"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "G")
                {
                    oForm.Title = "Libro de Guias";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcGuia,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcGuia"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "B")
                {
                    oForm.Title = "Libro de Boletas";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcBol,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcBol"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if ((System.String)(oRecordSet.Fields.Item("Libro").Value) != "")
                    {
                        Query((System.String)(oRecordSet.Fields.Item("Libro").Value));
                    }
                }
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 21
0
        /// <summary>
        /// Busca la información de acuerdo a los filtros capturados
        /// </summary>
        /// <param name="efiscal"></param>
        /// <param name="codigo"></param>
        /// <param name="descripcion"></param>
        /// <param name="combos"></param>
        public void BuscarDatos(string codeCobrador, string nameCobrador)
        {
            try
            {
                _oForma.Freeze(true);
                string qryCobrador = null;

                qryCobrador = " and REPLACE(LOWER( " +
                              "REPLACE(LOWER( " +
                              "REPLACE(LOWER( " +
                              "REPLACE(LOWER( " +
                              "REPLACE(LOWER( " +
                              "U_Cobrador),'á','a') ), " +
                              "'é','e') ), " +
                              "'í','i') ), " +
                              "'ó','o') ), " +
                              "'ú','u') LIKE  '%" + nameCobrador.ToLower().Replace('á', 'a').
                              Replace('é', 'e').
                              Replace('í', 'i').
                              Replace('ó', 'o').
                              Replace('ú', 'u') + "%' ";

                _oGridComisionesCobradores           = _oForma.Items.Item(GRD_COMISIONES_COBRADORES).Specific;
                _oGridComisionesCobradores.DataTable = _oForma.DataSources.DataTables.Item(DT_COMISIONES_COBRADORES);

                _oGridComisionesCobradores.DataTable.ExecuteQuery(@"SELECT  T1.empID AS CodigoID,
                                                                            T0.U_Codigo_Cobrador AS CodCobrador,
                                                                            T0.U_Cobrador AS NomCobrador,
                                                                            T0.U_Serie_Programa AS SeriePrograma,
                                                                            --T0.U_Serie_Malba AS SerieMalba,
                                                                            T0.U_Serie_Cooperativa AS SerieCooperativa,
                                                                            T0.U_Serie_Panteon AS SeriePanteon,
                                                                            ISNULL(T0.U_Comision_Panteon, 0.00) AS ComisionPanteon,
                                                                            ISNULL(T0.U_Sueldo_Cooperativa, 0.00) AS SueldoCooperativa,
                                                                            ISNULL(T0.U_Sueldo_Apoyo, 0.00) AS SueldoApoyo,
                                                                            ISNULL(T0.U_Comision_Coop, 0.00) AS ComisionCooperativa,
                                                                            ISNULL(T0.U_Comision_Apoyo, 0.00) AS ComisionApoyo,
                                                                            ISNULL(T0.U_Efectividad, 0.00) AS Efectividad,
                                                                            T0.U_SueldoBase AS SueldoBase
                                                                    FROM    dbo.[@COMISION_COBRADORES] T0
                                                                            LEFT JOIN dbo.OHEM T1 ON T1.firstName = T0.U_Codigo_Cobrador
                                                                                                     --AND ( T1.middleName + ' ' + T1.lastName ) = T0.U_Cobrador
                                                                WHERE   --( T1.middleName + ' ' + T1.lastName ) = T0.U_Cobrador
                                                                       -- AND 
                                                                        T0.U_Codigo_Cobrador LIKE '%" + codeCobrador + "%' " + qryCobrador +
                                                                  "ORDER BY T0.U_Codigo_Cobrador, " +
                                                                  "T1.empID ASC ");
                if (_oGridComisionesCobradores.DataTable.IsEmpty)
                {
                    _Application.MessageBox("No se encontraron registros");
                    _oGridComisionesCobradores.DataTable.Clear();
                    _oForma.Update();
                }
                else
                {
                    //_oGridComisionesCobradores.AutoResizeColumns();
                    FormatoGrid(_oGridComisionesCobradores);
                    _oGridComisionesCobradores.AutoResizeColumns();
                }
                _oBotonUpdate.Caption = "Ok";
            }
            catch (Exception ex)
            {
                throw new Exception("Error al buscar datos *BuscarDatos* : " + ex.Message);
            }
            finally
            {
                _oForma.Freeze(false);
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32      i;
            TFunctions Param;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FEMULTISOC.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                VID_DelRow   = false;
                VID_DelRowOK = false;

                Param       = new TFunctions();
                Param.SBO_f = FSBOf;

                //oForm.DataBrowser.BrowseBy := "DocEntry";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC");
                //oDBDSBases := oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC");

                // Ok Ad  Fnd Vw Rq Sec
                //        Lista.Add('DocEntry  , f,  f,  t,  f, r, 1');
                //        Lista.Add('Desde     , f,  f,  f,  f, r, 1');
                //        Lista.Add('mtx       , f,  t,  f,  f, n, 1');
                //        FSBOf.SetAutoManaged(var oForm, Lista);

                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);

                oMtx.AutoResizeColumns();
                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select U_Sociedad
                              ,U_RUT 
                              ,U_Servidor
                              ,U_Base
	                          ,U_Usuario
	                          ,U_Password
	                          ,DocEntry
	                          ,U_Habilitada
                          from [@VID_FEMULTISOC]";
                }
                else
                {
                    s = @"select ""U_Sociedad""
                              ,""U_RUT""
                              ,""U_Servidor""
                              ,""U_Base""
	                          ,""U_Usuario""
	                          ,""U_Password""
	                          ,""DocEntry""
	                          ,""U_Habilitada""
                          from ""@VID_FEMULTISOC"" ";
                }
                oRecordSet.DoQuery(s);

                if (oRecordSet.RecordCount == 0)
                {
                    oMtx.AddRow(1, 1);
                    oMtx.FlushToDataSource();
                    oMtx.AutoResizeColumns();
                }
                else
                {
                    i = 0;
                    oDBDSH.Clear();
                    while (!oRecordSet.EoF)
                    {
                        oDBDSH.InsertRecord(i);
                        oDBDSH.SetValue("U_Sociedad", i, (System.String)(oRecordSet.Fields.Item("U_Sociedad").Value));
                        oDBDSH.SetValue("U_RUT", i, (System.String)(oRecordSet.Fields.Item("U_RUT").Value));
                        oDBDSH.SetValue("U_Servidor", i, (System.String)(oRecordSet.Fields.Item("U_Servidor").Value));
                        oDBDSH.SetValue("U_Base", i, (System.String)(oRecordSet.Fields.Item("U_Base").Value));

                        oDBDSH.SetValue("U_Usuario", i, (System.String)(oRecordSet.Fields.Item("U_Usuario").Value));
                        //s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value).ToString().Trim());
                        oDBDSH.SetValue("U_Password", i, (System.String)(oRecordSet.Fields.Item("U_Password").Value));

                        oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)));
                        oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("U_Habilitada").Value));
                        i++;
                        oRecordSet.MoveNext();
                    }
                    oDBDSH.InsertRecord(i);
                    oMtx.LoadFromDataSource();
                    oMtx.AutoResizeColumns();
                }



                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_FEDetalleLog.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All
                oForm.EnableMenu("1282", false); //Crear
                oForm.EnableMenu("1281", false); //Actualizar

                //oForm.DataBrowser.BrowseBy := "DocNum";

                // Ok Ad  Fnd Vw Rq Sec
                //Lista.Add('DocNum    , f,  f,  t,  f, n, 1');
                //Lista.Add('DocDate   , f,  t,  f,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                oForm.Items.Item("grid").Enabled = false;
                ogrid           = (Grid)(oForm.Items.Item("grid").Specific);
                dt              = oForm.DataSources.DataTables.Add("dt");
                ogrid.DataTable = dt;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select U_TipoDoc
                              ,LTRIM(STR(U_FolioNum,18,0)) 'U_FolioNum'
                              ,U_ID_Log
                              ,U_Glosa
                              ,U_FechaIn
                          from [@VID_FELOG] T0
                          join [@VID_FELOGD] T1 ON T1.DocEntry = T0.DocEntry
                         where T0.DocEntry = {0}
                         order by T1.LineId DESC";
                }
                else
                {
                    s = @"select ""U_TipoDoc""
                              ,LTRIM(ROUND(""U_FolioNum"",0)) ""U_FolioNum""
                              ,""U_ID_Log""
                              ,""U_Glosa""
                              ,""U_FechaIn""
                          from ""@VID_FELOG"" T0 
                          join ""@VID_FELOGD"" T1 ON T1.""DocEntry"" = T0.""DocEntry""
                         where T0.""DocEntry"" = {0}
                         order by T1.""LineId"" DESC ";
                }

                s = String.Format(s, prmKey);
                dt.ExecuteQuery(s);
                ogrid.AutoResizeColumns();

                ogrid.Columns.Item("U_TipoDoc").Type = BoGridColumnType.gct_EditText;
                oColumn = (GridColumn)(ogrid.Columns.Item("U_TipoDoc"));
                var oEditColumn = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Tipo Documento";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_FolioNum").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_FolioNum"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Número Folio";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_ID_Log").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_ID_Log"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "ID Log Portal";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_Glosa").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_Glosa"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Glosa";
                oEditColumn.RightJustified      = false;

                ogrid.Columns.Item("U_FechaIn").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_FechaIn"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Fecha Movimiento";
                oEditColumn.RightJustified      = false;

                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 24
0
        public virtual void ET_grd_AFDoubleClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            if ((pVal.ColUID == "CHK") && (pVal.Row == -1) && (oGrid.DataTable.Rows.Count > 0))
            {
                oForm.Freeze(true);
                if (oGrid.DataTable.Columns.Item("CHK").Cells.Item(0).Value.ToString() == "Y")
                {
                    for (int i = 0; i < oGrid.DataTable.Rows.Count; i++)
                    {
                        oGrid.DataTable.SetValue("CHK", i, "N");
                    }
                }
                else
                {
                    for (int j = 0; j < oGrid.DataTable.Rows.Count; j++)
                    {
                        oGrid.DataTable.SetValue("CHK", j, "Y");
                        oGrid.DataTable.SetValue("U_PROCDT", j, DateTime.Now.ToString("yyyyMMdd"));
                        oGrid.DataTable.SetValue("U_PROCNM", j, B1Connections.theAppl.Company.UserName);
                    }
                }
                oForm.Freeze(false);
            }
            else if (pVal.ColUID == "U_COMMENT")
            {
                    //string extCOM = ((SAPbouiCOM.EditText)oGrid.DataTable.GetValue("U_MEMO", pVal.Row)).Value.Trim();
                string extCOM = FN.GetGridCellValue(ref oGrid, "U_MEMO", pVal.Row);
                    string strChildFormID = oForm.DataSources.UserDataSources.Item("cFORMUID2").Value;
                    if (!FN.GetFormExistsChk(strChildFormID))
                    {
                        KIS_SO0082F_HRD SO0082F_HRD = new KIS_SO0082F_HRD();
                        SO0082F_HRD.A00_SubFormInit(oForm.UniqueID, pVal.Row, extCOM, "작업내용", "CallBack");
                        SO0082F_HRD = null;
                    }
                    else
                    {
                        SAPbouiCOM.Form pForm = pForm = B1Connections.theAppl.Forms.Item(strChildFormID);
                        KIS_SO0082F_HRD.extSetting(pForm, extCOM, pVal.Row);
                        pForm.Select();
                        pForm = null;
                    }
            }

        }
Esempio n. 25
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
                FSBOf.LoadForm(xmlPath, "VID_FEIMPADIC.srf", uid);
                oForm                = FSBOApp.Forms.Item(uid);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;             // afm_All
                Flag = false;
                oForm.Freeze(true);

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select count(*) Cont from [@VID_FEIMPADIC]";
                }
                else
                {
                    s = @"select count(*) ""Cont"" from ""@VID_FEIMPADIC"" ";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                {
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
                else
                {
                    oForm.Mode = BoFormMode.fm_ADD_MODE;
                }


                oGrid       = (Grid)(oForm.Items.Item("3").Specific);
                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FEIMPADIC");

                oDataTable = oForm.DataSources.DataTables.Add("Tax");
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, U_CodImpto, U_Desc, U_Porc from [@VID_FEIMPADIC]
                          UNION ALL 
                          select CAST('' as varchar(20)), CAST('' as varchar(20)), CAST('' as varchar(50)), 0";
                }
                else
                {
                    s = @"select ""Code"", ""U_CodImpto"", ""U_Desc"", ""U_Porc"" from ""@VID_FEIMPADIC""
                          UNION ALL
                          select CAST('' as varchar(20)), CAST('' as varchar(20)), CAST('' as varchar(50)), 0 FROM DUMMY ";
                }

                oDataTable.ExecuteQuery(s);
                oGrid.DataTable = oDataTable;

                oGrid.Columns.Item("Code").Type = BoGridColumnType.gct_ComboBox;
                oColumn = (GridColumn)(oGrid.Columns.Item("Code"));
                var oComboCol = (ComboBoxColumn)(oColumn);
                oComboCol.Editable            = true;
                oComboCol.TitleObject.Caption = "Impuesto SAP";

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name from OSTA
                          UNION ALL
                          select WTCode 'Code', WTName 'Name' from OWHT where Inactive = 'N'";
                }
                else
                {
                    s = @"select ""Code"", ""Name"" from ""OSTA""
                          UNION ALL
                          select ""WTCode"" ""Code"", ""WTName"" ""Name"" from ""OWHT"" where ""Inactive"" = 'N' ";
                }

                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid((GridColumn)(oGrid.Columns.Item("Code")), ref oRecordSet, true);

                oGrid.Columns.Item("U_CodImpto").Type = BoGridColumnType.gct_EditText;
                oColumn = (GridColumn)(oGrid.Columns.Item("U_CodImpto"));
                var oEditCol = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Código Impto. SII";


                oGrid.Columns.Item("U_Desc").Type = BoGridColumnType.gct_EditText;
                oColumn                      = (GridColumn)(oGrid.Columns.Item("U_Desc"));
                oEditCol                     = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Descripción Impuesto";

                oGrid.Columns.Item("U_Porc").Type = BoGridColumnType.gct_EditText;
                oColumn                      = (GridColumn)(oGrid.Columns.Item("U_Porc"));
                oEditCol                     = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Porcentaje Retencion";
                oEditCol.RightJustified      = true;

                oGrid.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 26
0
        /// <summary>
        /// Eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Id de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="BubbleEvent">Evento true/false</param>
        public override void eventos(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.BeforeAction == false && pVal.FormType == FRM_DATOS_MAESTROS_EMPLEADO)
                {
                    if (pVal.EventType == BoEventTypes.et_FORM_RESIZE)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        // CrearCampoRFC(_oForm);
                    }

                    if (pVal.EventType == BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new _IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        Dispose();
                        application            = null;
                        company                = null;
                        _oDatosMestrosEmpleado = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_LOST_FOCUS && pVal.ItemUID == TXT_FECHA_NACIMIENTO)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);

                        if (_oForm.Visible == true)
                        {
                            if (_oForm.Mode == BoFormMode.fm_ADD_MODE || _oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                            {
                                _oTxtFechaNacimiento  = _oForm.Items.Item(TXT_FECHA_NACIMIENTO).Specific;
                                _oTxtNombreEmpleado   = _oForm.Items.Item(TXT_NOMBRE_EMPLEADO).Specific;
                                _oTxtApellidoEmpleado = _oForm.Items.Item(TXT_APELLIDO_EMPLEADO).Specific;
                                _oTxtRfc = _oForm.Items.Item(TXT_RFC).Specific;

                                if (!string.IsNullOrEmpty(_oTxtNombreEmpleado.Value.ToString()))
                                {
                                    if (!string.IsNullOrEmpty(_oTxtApellidoEmpleado.Value.ToString()))
                                    {
                                        if (!String.IsNullOrEmpty(_oTxtFechaNacimiento.Value.ToString()))
                                        {
                                            _oForm.Freeze(true);
                                            string[] separarNombre = null;
                                            string   dia           = null;
                                            string   mes           = null;
                                            string   year          = null;

                                            var nombreSeparado = SepararNombreApllidos_Fomato.FormatoTextoRFC(_oTxtNombreEmpleado.Value.ToString() + " " + _oTxtApellidoEmpleado.Value.ToString());
                                            _oTxtNombreEmpleado.Value   = SepararNombreApllidos_Fomato.FormatoMayusculas(_oTxtNombreEmpleado.Value.ToString());
                                            _oTxtApellidoEmpleado.Value = SepararNombreApllidos_Fomato.FormatoMayusculas(_oTxtApellidoEmpleado.Value.ToString());

                                            year = _oTxtFechaNacimiento.Value.Substring(0, 4);
                                            mes  = _oTxtFechaNacimiento.Value.Substring(4, 2);
                                            dia  = _oTxtFechaNacimiento.Value.Substring(6, 2);

                                            separarNombre  = nombreSeparado.ToString().Split('@');
                                            _oTxtRfc.Value = SepararNombreApllidos_Fomato.GenerarRFC(separarNombre, dia, mes, year);
                                            _oForm.Freeze(false);
                                        }
                                    }
                                    else
                                    {
                                        _Application.MessageBox("Capture el apellido del empleado");
                                    }
                                }
                                else
                                {
                                    _Application.MessageBox("Capture el nombre del empleado");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en método 'eventos' *clsDatosMaestrosEmpleado* : " + ex.Message);
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref SAPbouiCOM.Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 CantRol;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet      = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            Funciones.SBO_f = FSBOf;
            try
            {
                Lista = new List <string>();
                FSBOf.LoadForm(xmlPath, "VID_FEMonDTE.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All
                oForm.EnableMenu("1282", false); //Crear
                oForm.EnableMenu("1281", false); //Actualizar

                // Ok Ad  Fnd Vw Rq Sec
                //Lista.Add('DocNum    , f,  f,  t,  f, n, 1');
                //Lista.Add('DocDate   , f,  t,  f,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                oDBDSHC = oForm.DataSources.DBDataSources.Add("@VID_FEDTECPRA");
                oDBDSHV = oForm.DataSources.DBDataSources.Add("@VID_FEDTEVTA");

                oForm.DataSources.UserDataSources.Add("FechaD", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("FechaD").Specific);
                oEditText.DataBind.SetBound(true, "", "FechaD");
                oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oForm.DataSources.UserDataSources.Add("FechaH", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("FechaH").Specific);
                oEditText.DataBind.SetBound(true, "", "FechaH");
                oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oComboBox = (ComboBox)(oForm.Items.Item("TipoDTE").Specific);
                oForm.DataSources.UserDataSources.Add("TipoDTE", BoDataType.dt_SHORT_TEXT, 10);
                oComboBox.DataBind.SetBound(true, "", "TipoDTE");
                oComboBox.ValidValues.Add("V", "Venta");
                oComboBox.ValidValues.Add("C", "Compra");
                oComboBox.Select("V", BoSearchKey.psk_ByValue);
                oForm.Items.Item("TipoDTE").DisplayDesc = true;

                oDataTable      = oForm.DataSources.DataTables.Add("dt");
                oGrid           = (Grid)(oForm.Items.Item("grid").Specific);
                oGrid.DataTable = oDataTable;

                DSOpFec = oForm.DataSources.UserDataSources.Add("FechaEmi", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
                ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).DataBind.SetBound(true, "", "FechaEmi");

                ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).DataBind.SetBound(true, "", "FechaEmi");
                ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).GroupWith("FechaEmi");
                ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).Selected = true;


                oComboBox = (ComboBox)(oForm.Items.Item("Cliente").Specific);
                oForm.DataSources.UserDataSources.Add("Cliente", BoDataType.dt_SHORT_TEXT, 10);
                oComboBox.DataBind.SetBound(true, "", "Cliente");
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL 
                          SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoC'";
                }
                else
                {
                    s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL
                          SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoC'";
                }
                s = String.Format(s, "@VID_FEDTEVTA");
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo(oComboBox, ref oRecordSet, false);
                oComboBox.Select("Todos", BoSearchKey.psk_ByValue);

                oComboBox = (ComboBox)(oForm.Items.Item("SII").Specific);
                oForm.DataSources.UserDataSources.Add("SII", BoDataType.dt_SHORT_TEXT, 10);
                oComboBox.DataBind.SetBound(true, "", "SII");
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL
                          SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoSII'";
                }
                else
                {
                    s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL
                          SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoSII'";
                }
                s = String.Format(s, "@VID_FEDTEVTA");
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo(oComboBox, ref oRecordSet, false);
                oComboBox.Select("Todos", BoSearchKey.psk_ByValue);

                oComboBox = (ComboBox)(oForm.Items.Item("Ley").Specific);
                oForm.DataSources.UserDataSources.Add("Ley", BoDataType.dt_SHORT_TEXT, 10);
                oComboBox.DataBind.SetBound(true, "", "Ley");
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL
                          SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoLey'";
                }
                else
                {
                    s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL
                          SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoLey'";
                }
                s = String.Format(s, "@VID_FEDTEVTA");
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo(oComboBox, ref oRecordSet, false);
                oComboBox.Select("Todos", BoSearchKey.psk_ByValue);

                BuscarDatos();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            finally
            {
                if (oForm != null)
                {
                    oForm.Freeze(false);
                }
            }


            return(Result);
        }//fin InitForm
        }//fin FormEvent

        private void CargarDatosPE()
        {
            SAPbouiCOM.EditTextColumn oEditColumn;
            SAPbouiCOM.CheckBox       oChkRechazados;
            SAPbouiCOM.CheckBox       oChkPendientes;
            SAPbouiCOM.CheckBox       oChkAceptados;
            SAPbouiCOM.CheckBox       oChkDadoBaja;
            SAPbouiCOM.CheckBox       oChkErrores;
            String FechaD, FechaH, Status;

            try
            {
                oForm.Freeze(true);
                oChkRechazados = (CheckBox)(oForm.Items.Item("Rechazados").Specific);
                oChkPendientes = (CheckBox)(oForm.Items.Item("Pendientes").Specific);
                oChkAceptados  = (CheckBox)(oForm.Items.Item("Aceptados").Specific);
                oChkDadoBaja   = (CheckBox)(oForm.Items.Item("DadoBaja").Specific);
                oChkErrores    = (CheckBox)(oForm.Items.Item("Errores").Specific);

                if ((oChkRechazados.Checked) || (oChkPendientes.Checked) || (oChkAceptados.Checked) || (oChkErrores.Checked))
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        Status = "and T0.U_Status in (";
                        Status = Status + (oChkRechazados.Checked ? "'RZ'," : "");
                        Status = Status + (oChkPendientes.Checked ? "'EC'," : "");
                        Status = Status + (oChkAceptados.Checked ? "'RR'," : "");
                        Status = Status + (oChkDadoBaja.Checked ? "'DB'," : "");
                        Status = Status + (oChkErrores.Checked ? "'EE'," : "");
                        Status = Status.Substring(0, Status.Length - 1);
                        Status = Status + ")";
                    }
                    else
                    {
                        Status = @"and T0.""U_Status"" in (";
                        Status = Status + (oChkRechazados.Checked ? "'RZ'," : "");
                        Status = Status + (oChkPendientes.Checked ? "'EC'," : "");
                        Status = Status + (oChkAceptados.Checked ? "'RR'," : "");
                        Status = Status + (oChkDadoBaja.Checked ? "'DB'," : "");
                        Status = Status + (oChkErrores.Checked ? "'EE'," : "");
                        Status = Status.Substring(0, Status.Length - 1);
                        Status = Status + ")";
                    }
                }
                else if ((!oChkRechazados.Checked) && (!oChkPendientes.Checked) && (!oChkAceptados.Checked) && (!oChkDadoBaja.Checked) && (!oChkErrores.Checked))
                {
                    //en caso de no encontrar ninguno marcado sale de la funcion
                    oForm.Freeze(false);
                    return;
                }
                else
                {
                    Status = "";
                }



                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT 
                               LTRIM(STR(T0.U_DocEntry,18,0))	'DocEntry'
	                          ,CASE U_ObjType
		                        WHEN '13' THEN (SELECT DocNum FROM OINV WHERE DocEntry = T0.U_DocEntry)
		                        WHEN '14' THEN (SELECT DocNum FROM ORIN WHERE DocEntry = T0.U_DocEntry)
		                        WHEN '15' THEN (SELECT DocNum FROM ODLN WHERE DocEntry = T0.U_DocEntry)
		                        WHEN '67' THEN (SELECT DocNum FROM OWTR WHERE DocEntry = T0.U_DocEntry)
                                WHEN '21' THEN (SELECT DocNum FROM ORPD WHERE DocEntry = T0.U_DocEntry)
	                           END				'DocNum'
                              ,T0.U_TipoDoc		'TipoDoc'
                              ,ISNULL(T0.U_SeriePE,'')  'SeriePE'
                              ,LTRIM(STR(T0.U_FolioNum,18,0))	'Folio'
                              ,(SELECT C1.Descr FROM CUFD C0 JOIN UFD1 C1 ON C1.TableID=C0.TableID AND C1.FieldID=C0.FieldID WHERE C0.TableID = '@VID_FELOG' AND C0.AliasID='Status' AND C1.FldValue= T0.U_Status)	'Estado'
                              ,T0.U_Status
                              ,T0.U_Message		'Mensaje'
                              ,T0.U_ObjType     'ObjType'
                              ,T0.U_Path		'Path'
                              ,T0.U_ExtFolio	'ExtFolio'
                              ,T0.DocEntry		'Key'
                              ,ISNULL(T0.U_Id,'0') 'Id'
                              ,ISNULL(T0.U_Validation,'') 'Validation'
                          FROM [@vid_felog] T0 WITH (NOLOCK)
                          JOIN OUSR T2 ON T2.USER_CODE = T0.U_UserCode
                         WHERE {0}
                           {3}
                           AND ISNULL(T0.U_DocDate, T0.CreateDate) BETWEEN '{1}' AND '{2}'
                           
                         ORDER BY T0.DocEntry DESC";
                }
                else
                {
                    s = @"SELECT  
                               LTRIM(TO_ALPHANUM(T0.""U_DocEntry""))	""DocEntry""
	                          ,CASE ""U_ObjType""
		                        WHEN '13' THEN (SELECT ""DocNum"" FROM ""OINV"" WHERE ""DocEntry"" = T0.""U_DocEntry"")
		                        WHEN '14' THEN (SELECT ""DocNum"" FROM ""ORIN"" WHERE ""DocEntry"" = T0.""U_DocEntry"")
		                        WHEN '15' THEN (SELECT ""DocNum"" FROM ""ODLN"" WHERE ""DocEntry"" = T0.""U_DocEntry"")
		                        WHEN '67' THEN (SELECT ""DocNum"" FROM ""OWTR"" WHERE ""DocEntry"" = T0.""U_DocEntry"")
                                WHEN '21' THEN (SELECT ""DocNum"" FROM ""ORPD"" WHERE ""DocEntry"" = T0.""U_DocEntry"")
	                           END				""DocNum""
                              ,T0.""U_TipoDoc""		""TipoDoc""
                              ,IFNULL(T0.""U_SeriePE"",'')  ""SeriePE""
                              ,LTRIM(TO_ALPHANUM(T0.""U_FolioNum""))	""Folio""
                              ,(SELECT C1.""Descr"" FROM ""CUFD"" C0 JOIN ""UFD1"" C1 ON C1.""TableID""=C0.""TableID"" AND C1.""FieldID""=C0.""FieldID"" WHERE C0.""TableID"" = '@VID_FELOG' AND C0.""AliasID""='Status' AND C1.""FldValue""= T0.""U_Status"")	""Estado""
                              ,T0.""U_Status""
                              ,T0.""U_Message""		""Mensaje"" 
                              ,T0.""U_ObjType""     ""ObjType""
                              ,T0.""U_Path""		""Path""
                              ,T0.""U_ExtFolio""	""ExtFolio""
                              ,T0.""DocEntry""		""Key""
                              ,IFNULL(T0.""U_Id"",'0') ""Id""
                              ,IFNULL(T0.""U_Validation"",'') ""Validation""
                          FROM ""@VID_FELOG"" T0 
                          JOIN ""OUSR"" T2 on T2.""USER_CODE"" = T0.""U_UserCode""
                         WHERE {0}
                           {3}
                           AND IFNULL(T0.""U_DocDate"", T0.""CreateDate"") BETWEEN '{1}' AND '{2}'
                         ORDER BY T0.""DocEntry"" DESC ";
                }

                oCheckBox = (CheckBox)(oForm.Items.Item("chk_Todo").Specific);
                oEditText = (EditText)(oForm.Items.Item("FechaD").Specific);
                FechaD    = (System.String)(oEditText.Value).Trim();

                oEditText = (EditText)(oForm.Items.Item("FechaH").Specific);
                FechaH    = (System.String)(oEditText.Value).Trim();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = String.Format(s, !oCheckBox.Checked ? "T0.U_UserCode = '" + FSBOApp.Company.UserName + "'" : "1=1", FechaD, FechaH, Status);
                }
                else
                {
                    s = String.Format(s, !oCheckBox.Checked ? @"T0.""U_UserCode"" = '" + FSBOApp.Company.UserName + "'" : "1=1", FechaD, FechaH, Status);
                }
                oDataTable.ExecuteQuery(s);

                oGrid.Columns.Item("TipoDoc").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("TipoDoc"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Tipo Documento";

                oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("DocEntry"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Llave SAP";
                oEditColumn.LinkedObjectType    = "13";
                oEditColumn.RightJustified      = true;

                oGrid.Columns.Item("DocNum").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("DocNum"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Número SAP";
                oEditColumn.RightJustified      = true;

                oGrid.Columns.Item("SeriePE").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("SeriePE"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Número Serie";
                oEditColumn.RightJustified      = true;

                oGrid.Columns.Item("Folio").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Folio"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Número Correlativo";
                oEditColumn.RightJustified      = true;

                oGrid.Columns.Item("Estado").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Estado"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Estado";

                oGrid.Columns.Item("U_Status").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("U_Status"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "U_Status";
                oEditColumn.Visible             = false;

                oGrid.Columns.Item("Mensaje").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Mensaje"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Comentario";

                oGrid.Columns.Item("ObjType").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("ObjType"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "ObjType";
                oEditColumn.Visible             = false;

                oGrid.Columns.Item("Path").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Path"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Documento";
                oEditColumn.Visible             = false;

                oGrid.Columns.Item("ExtFolio").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("ExtFolio"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "IdDocumento";
                oEditColumn.Visible             = true;

                oGrid.Columns.Item("Key").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Key"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Key";
                oEditColumn.Visible             = false;

                oGrid.Columns.Item("Id").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Id"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Id";
                oEditColumn.Visible             = false;

                oGrid.Columns.Item("Validation").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(oGrid.Columns.Item("Validation"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Validation";
                oEditColumn.Visible             = false;

                oGrid.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("CargarDatosPE : " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.StatusBar.SetText("CargarDatosPE : " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            oForm.Freeze(false);
        } //fin CargarDatosPE
Esempio n. 29
0
        public virtual bool ET_grd1_BFValidate(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd1").Specific));
            // ADD YOUR ACTION CODE HERE ...

            try
            {
                if (pVal.ItemChanged)
                {
                    oForm.Freeze(true);

                    try
                    {
                        switch (oGrid.Columns.Item(pVal.ColUID).UniqueID)
                        {
                            case "U_TRANSAMT":

                                int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

                                string U_CHK = oGrid.DataTable.GetValue("U_CHK", iRowIndex).ToString().Trim();

                                if (U_CHK == "N")
                                {
                                    oGrid.DataTable.SetValue("U_CHK", iRowIndex, "Y");
                                    if (oGrid.Rows.IsSelected(pVal.Row) == false)
                                    {
                                        oGrid.Rows.SelectedRows.Add(pVal.Row);
                                    }
                                }
                                break;
                            default:
                                break;
                        }
                    }
                    catch (Exception)
                    {

                        throw;
                    }
                    finally
                    {
                        oForm.Freeze(false);
                    }

                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
           
            return true;
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_Monitor.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All
                oForm.EnableMenu("1282", false); //Crear
                oForm.EnableMenu("1281", false); //Actualizar

                // Ok Ad  Fnd Vw Rq Sec
                //Lista.Add('DocNum    , f,  f,  t,  f, n, 1');
                //Lista.Add('DocDate   , f,  t,  f,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FELOG");
                oDBDSD      = oForm.DataSources.DBDataSources.Add("@VID_FELOGD");

                oForm.DataSources.UserDataSources.Add("FechaD", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("FechaD").Specific);
                oEditText.DataBind.SetBound(true, "", "FechaD");
                oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oForm.DataSources.UserDataSources.Add("FechaH", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("FechaH").Specific);
                oEditText.DataBind.SetBound(true, "", "FechaH");
                oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oForm.DataSources.UserDataSources.Add("chk_Todo", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("chk_Todo").Specific);
                oCheckBox.DataBind.SetBound(true, "", "chk_Todo");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("Rechazados", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Rechazados").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Rechazados");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oForm.DataSources.UserDataSources.Add("Pendientes", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Pendientes").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Pendientes");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oForm.DataSources.UserDataSources.Add("Aceptados", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Aceptados").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Aceptados");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("DadoBaja", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("DadoBaja").Specific);
                oCheckBox.DataBind.SetBound(true, "", "DadoBaja");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("Errores", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Errores").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Errores");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oDataTable      = oForm.DataSources.DataTables.Add("dt");
                oGrid           = (Grid)(oForm.Items.Item("grid").Specific);
                oGrid.DataTable = oDataTable;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select ISNULL(TaxIdNum,'') TaxIdNum from OADM ";
                }
                else
                {
                    s = @"select IFNULL(""TaxIdNum"",'') ""TaxIdNum"" from ""OADM"" ";
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount == 0)
                {
                    throw new Exception("Debe ingresar RUC de Emisor, Gestión -> Inicialización Sistema -> Detalle Sociedad -> Datos de Contabilidad -> ID fiscal general 1");
                }
                else
                {
                    RUC = ((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim();
                }

                CargarDatosPE();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            String sValue;
            String sValue2;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                {
                    if (pVal.BeforeAction == true)
                    {
                        if (((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)) && (pVal.ItemUID == "1"))
                        {
                            BubbleEvent = false;
                            if (Validar())
                            {
                                Guardar_Registros();
                            }
                        }
                    }

                    if ((pVal.BeforeAction == false) && (pVal.ItemUID == "btn_Borrar"))
                    {
                        BorrarLinea();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    oForm.Freeze(true);
                    if (pVal.ColUID == "U_CardCode")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = ((System.String)oDataTable.GetValue("CardCode", 0)).Trim();
                            sValue2 = ((System.String)oDataTable.GetValue("CardName", 0)).Trim();
                            for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                            {
                                if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Length > 0)
                                {
                                    var CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1));
                                    if (CardCode == sValue)
                                    {
                                        FSBOApp.StatusBar.SetText("Proveedor ya se encuentra en la lista Negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                        return;
                                    }
                                }
                            }

                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"SELECT COUNT(*) 'count' FROM [@VID_FELISTABL] WHERE U_CardCode = '{0}'";
                            }
                            else
                            {
                                s = @"SELECT COUNT(*) ""count"" FROM ""@VID_FELISTABL"" WHERE ""U_CardCode"" = '{0}'";
                            }
                            s = String.Format(s, sValue);
                            oRecordSet.DoQuery(s);
                            if (((System.Int32)oRecordSet.Fields.Item("count").Value) > 0)
                            {
                                FSBOApp.StatusBar.SetText("Codigo Proveedor se encuentra en la lista blanca, no se puede seleccionar -> Codigo " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                return;
                            }

                            odt.SetValue("U_CardCode", pVal.Row, sValue);
                            odt.SetValue("U_CardName", pVal.Row, sValue2);
                            odt.SetValue("U_Activado", pVal.Row, "Y");

                            if ((odt.Rows.Count - 1 == pVal.Row) && (sValue != ""))
                            {
                                odt.Rows.Add(1);
                            }
                            ogrid.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                if (oForm != null)
                {
                    oForm.Freeze(false);
                }
            }
        }//fin FormEvent
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oComboBox;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FEDIST.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                VID_DelRow   = false;
                VID_DelRowOK = false;

                oForm.DataBrowser.BrowseBy = "DocEntry";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEDIST");
                oDBDSD = oForm.DataSources.DBDataSources.Item("@VID_FEDISTD");

                oForm.EnableMenu("1282", false); // boton Crear

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("DocEntry  , f,  f,  f,  f, r, 1");
                Lista.Add("Desde     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Sucursal  , f,  t,  f,  f, r, 1");
                Lista.Add("RangoF    , f,  t,  t,  f, r, 1");
                Lista.Add("TipoDoc   , f,  t,  t,  f, r, 1");
                Lista.Add("btnDist   , f,  t,  f,  f, n, 1");
                FSBOf.SetAutoManaged(oForm, Lista);

                //carga tipo documentos
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select distinct U_TipoDoc 'Code', U_TipoDoc 'Name' from [@VID_FECAF]";
                }
                else
                {
                    s = @"select distinct ""U_TipoDoc"" ""Code"", ""U_TipoDoc"" ""Name"" from ""@VID_FECAF"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("TipoDoc").Specific), ref oRecordSet, true);

                //carga sucursales
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select Code, Name from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Sucursal").Specific), ref oRecordSet, true);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select C1.FldValue 'Code', C1.Descr 'Name'
                           from CUFD C0
                           join UFD1 C1 on C1.TableID = C0.TableID
                                       and C1.FieldID = C0.FieldID
                          where C0.TableID = '@VID_FEDISTD'
                            and C0.AliasID = 'Estado'";
                }
                else
                {
                    s = @"select C1.""FldValue"" ""Code"", C1.""Descr"" ""Name""
                           from ""CUFD"" C0
                           join ""UFD1"" C1 on C1.""TableID"" = C0.""TableID""
                                       and C1.""FieldID"" = C0.""FieldID""
                          where C0.""TableID"" = '@VID_FEDISTD'
                            and C0.""AliasID"" = 'Estado' ";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Estado"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                oDBDSD.InsertRecord(0);
                oMtx.LoadFromDataSource();
                oMtx.AutoResizeColumns();

                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);

            return(Result);
        }//fin InitForm
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            Int32  nErr;
            String sErr;

            SAPbouiCOM.EditText oEditText;
            SAPbouiCOM.ComboBox oComboBox;
            Int32 i;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                {
                    if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)) && (pVal.BeforeAction))
                    {
                        BubbleEvent = false;
                        if (Validar())
                        {
                            if (Limpiar())
                            {
                                oForm.Freeze(true);
                                GuardarRegistros();
                                oMtx.FlushToDataSource();
                                i = oMtx.RowCount + 1;
                                oMtx.AddRow(1, i);
                                oComboBox = (ComboBox)(oMtx.Columns.Item("TipoDoc").Cells.Item(i).Specific);
                                oComboBox.Select("33", BoSearchKey.psk_ByValue);

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomE").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomD").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomR").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomC").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomDe").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomL").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("ProcNomS").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oComboBox = (ComboBox)(oMtx.Columns.Item("Habili").Cells.Item(i).Specific);
                                oComboBox.Select("Y", BoSearchKey.psk_ByValue);

                                oEditText       = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific);
                                oEditText.Value = "";

                                oEditText       = (EditText)(oMtx.Columns.Item("CantLineas").Cells.Item(i).Specific);
                                oEditText.Value = "60";

                                oMtx.FlushToDataSource();
                            }
                        }
                    }

                    if ((pVal.ItemUID == "btnBorrar") && (!pVal.BeforeAction))
                    {
                        Borrar();
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            oForm.Freeze(false);
        }//fin FormEvent
Esempio n. 34
0
        public virtual void ET_cboTYPE_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oComboBox = ((SAPbouiCOM.ComboBox)(oForm.Items.Item("cboTYPE").Specific));
            // ADD YOUR ACTION CODE HERE ...           

            oForm.Freeze(true);
            SetItemEnabled(oForm);

            SetComboBox_Method(oForm);
            SetComboBox_AcctCode(oForm);

            oForm.Freeze(false);
        }
Esempio n. 35
0
        public virtual bool ET_edtBNKCD_BFValidate(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oEditText = ((SAPbouiCOM.EditText)(oForm.Items.Item("edtBNKCD").Specific));
            // ADD YOUR ACTION CODE HERE ...

            try
            {
                if (pVal.ItemChanged)
                {
                    oForm.Freeze(true);

                    System.Data.DataTable Dt = null;

                    switch (pVal.ItemUID)
                    {
                        case "edtBNKCD":
                            #region 주거래은행 정보를 가져온다.
                            string U_HBNKCD = oForm.Items.Item("edtBNKCD").Specific.value;

                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            sb.Append(" SELECT A.AbsEntry                     ");
                            sb.Append("      , A.GLAccount                    ");
                            sb.Append("      , B.AcctName                     ");
                            sb.Append("  FROM DSC1 A                          ");
                            sb.Append("  LEFT JOIN OACT B ON A.GLAccount = B.AcctCode     ");
                            sb.AppendFormat(" WHERE A.AbsEntry = {0}", U_HBNKCD);

                            if (U_HBNKCD != "")
                            {
                                Dt = FN.GetRecordsetToDataTable(sb.ToString());

                                if (Dt.Rows.Count == 1)
                                {
                                    oForm.Items.Item("edtBNKACCT").Specific.value = Dt.Rows[0]["GLAccount"].ToString();
                                    oForm.Items.Item("edtBNKATNM").Specific.value = Dt.Rows[0]["AcctName"].ToString();
                                }
                                else
                                {
                                    oForm.Items.Item("edtBNKACCT").Specific.value = "";
                                    oForm.Items.Item("edtBNKATNM").Specific.value = "";

                                    //FN.Trace("주거래은행을 확인해 주세요", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                }
                            }
                            else
                            {
                                oForm.Items.Item("edtBNKACCT").Specific.value = "";
                                oForm.Items.Item("edtBNKATNM").Specific.value = "";
                            }
                            #endregion
                            break;

                        default:
                            break;
                    }
                }

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                oForm.Freeze(false);
            }
            finally
            {
                oForm.Freeze(false);
            }
            return true;
        }
Esempio n. 36
0
        public virtual void ET_1_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                oForm.Freeze(true);
                if (GetLastData(oForm))
                {
                    DI_JournalEntries(oForm, SO.SO_COMMON_HRD.JournalType.A01);
                }
                oForm.Freeze(false);

            }
            catch (Exception)
            {
                throw;
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oCombo;
            TFunctions Param;

            SAPbouiCOM.CheckBox oCheckBox;
            SAPbouiCOM.EditText oEditText;

            //
            //  obetener recurso
            //  try
            //  .....
            //  finally
            //  liberar recurso
            //  end

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            try
            {
                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "strCnn.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;             // afm_All

                //oForm.DataBrowser.BrowseBy := "DocNum";

                // Ok Ad  Fnd Vw Rq Sec
                //Lista.Add('DocNum    , f,  f,  t,  f, n, 1');
                //Lista.Add('DocDate   , f,  t,  f,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                oDBDSHeader = (DBDataSource)(oForm.DataSources.DBDataSources.Item("@VID_FEPARAM"));

                if (!GlobalSettings.RunningUnderSQLServer)
                {
                    oForm.Items.Item("btnProcFE").Visible = false;
                }
                else
                {
                    oForm.Items.Item("btnProcFE").Visible = true;
                }

                //s := 'Select count(*) cant from [@VID_FEPARAM]';
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"Select count(*) CANT
                                ,U_UserED
                                ,U_PwdED
                                ,U_UserWS
                                ,U_PassWS
                            from [@VID_FEPARAM] 
                            group by U_UserED
                                ,U_PwdED
                                ,U_UserWS
                                ,U_PassWS";
                }
                else
                {
                    s = @"Select count(*) ""CANT"" 
                           ,""U_UserED""
                           ,""U_PwdED""
                           ,""U_UserWS""
                           ,""U_PassWS""
                      from ""@VID_FEPARAM"" 
                     group by ""U_UserED""
                             ,""U_PwdED""
                             ,""U_UserWS""
                             ,""U_PassWS""";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("CANT").Value) > 0)
                {
                    Param       = new TFunctions();
                    Param.SBO_f = FSBOf;

                    oForm.SupportedModes = 1;
                    oForm.Mode           = BoFormMode.fm_UPDATE_MODE;
                    oDBDSHeader.Query(null);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserED").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_UserED", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PwdED").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_PwdED", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserWS").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_UserWS", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PassWS").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_PassWS", 0, s);
                }
                else
                {
                    oForm.SupportedModes = 3;
                    oForm.Mode           = BoFormMode.fm_ADD_MODE;
                    oForm.PaneLevel      = 106;
                }
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            finally
            {
                oForm.Freeze(false);
            }


            return(Result);
        }//fin InitForm
Esempio n. 38
0
        private void SetApplyDataToParentForm(SAPbouiCOM.Form oForm)
        {
            pForm = B1Connections.theAppl.Forms.Item(oForm.DataSources.UserDataSources.Item("pFORMUID").ValueEx);

            try
            {
                pForm.Freeze(true);
                oMatrix = ((SAPbouiCOM.Matrix)(pForm.Items.Item("mtx2_DUMY").Specific));

                string COM = oForm.DataSources.UserDataSources.Item("extCOM").Value;
                SAPbouiCOM.DBDataSource oDB_1 = pForm.DataSources.DBDataSources.Item("@KIS_SO00302_HRD");
                SAPbouiCOM.DBDataSource oDB_1Z = pForm.DataSources.DBDataSources.Item("@KIS_SO00302Z_HRD");

                int pRow = Convert.ToInt16(oForm.DataSources.UserDataSources.Item("pRows").Value);

                oDB_1.SetValue("U_MEMO", pRow - 1, COM);
                oDB_1Z.SetValue("U_MEMO", pRow - 1, COM);

                pForm.DataSources.UserDataSources.Item("cRow").ValueEx = pRow.ToString(); ;
                oMatrix.LoadFromDataSource();

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                pForm.Freeze(false);
                if (pForm != null) { Marshal.ReleaseComObject(pForm); } pForm = null;
            }
        }
Esempio n. 39
0
        private static void flushAll()
        {
            SAPbouiCOM.Grid oGrid;
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("4").Specific;
            SAPbouiCOM.DataTable dtHistory = oGrid.DataTable;
            oSOForm.Freeze(true);

            try
            {
                using (var progress = SboProgressBar.Create("Please Wait while system prepare sales order for selected item(s) ", 100, oForm, 400))
                {
                    System.Data.DataTable dtSelItems = new System.Data.DataTable();
                    dtSelItems.Columns.Add("ItemCode");
                    dtSelItems.Columns.Add("Quantity");
                    dtSelItems.Columns.Add("Price");
                    dtSelItems.Columns.Add("UOM");



                    int rowCount = 1;

                    for (int dtrown = 0; dtrown < dtHistory.Rows.Count; dtrown++)
                    {
                        string strQty = dtHistory.GetValue("Order Qty", dtrown).ToString().Trim();

                        if (strQty != "0" && strQty != "")
                        {
                            string strItemCode = oGrid.DataTable.GetValue("ItemCode", dtrown).ToString().Trim();
                            string strPrice    = oGrid.DataTable.GetValue("Current Purchase Price", dtrown).ToString().Trim();
                            string strUoM      = oGrid.DataTable.GetValue("UoM", dtrown).ToString().Trim();

                            dtSelItems.Rows.Add(strItemCode, strQty, strPrice, strUoM);



                            rowCount++;
                        }
                    }

                    if (dtSelItems.Rows.Count > 0)
                    {
                        for (int m = oMatrix.RowCount; m >= 1; m--)
                        {
                            oMatrix.DeleteRow(1);
                        }

                        progress.Value += 10;

                        rowCount = 1;
                        oMatrix.AddRow(dtSelItems.Rows.Count);
                        int incrmentVal = 90 / dtSelItems.Rows.Count;

                        foreach (System.Data.DataRow dr in dtSelItems.Rows)
                        {
                            if (progress.Value <= 100)
                            {
                                progress.Value += incrmentVal;
                            }
                            progress.Text = "Please Wait while system prepare document for selected item(s) " + dr["ItemCode"].ToString();
                            ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("1", rowCount)).Value  = dr["ItemCode"].ToString();
                            ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("11", rowCount)).Value = dr["Quantity"].ToString();
                            try
                            {
                                ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("1470002145", rowCount)).Value = dr["UOM"].ToString();
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("14", rowCount)).Value = dr["Price"].ToString();
                            }
                            catch (Exception)
                            {
                            }

                            rowCount++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                oSOForm.Freeze(false);
            }
        }
Esempio n. 40
0
        /// <summary>
        /// Agrega la solicitud escaneada
        /// </summary>
        private void AgregarSolicitud()
        {
            try
            {
                _oForma.Freeze(true);
                string empresa = null;
                string plan    = null;
                int    code    = 0;

                if (ValidarNoExistaSolicitud())
                {
                    _oRec = null;
                    _oRec = (SAPbobsCOM.Recordset)_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    _oRec.DoQuery("SELECT U_Empresa,U_Descripcion_Plan FROM dbo.[@COMISIONES] WHERE U_Prefijo_Sol =  SUBSTRING('" + _oTxtCodigoSolicitud.Value.ToString() + "', 1,6)");
                    empresa = _oRec.Fields.Item("U_Empresa").Value;
                    plan    = _oRec.Fields.Item("U_Descripcion_Plan").Value;

                    _oGridArqueos.DataTable.Rows.Add();
                    int lastRow = _oGridArqueos.DataTable.Rows.Count - 1;

                    _oGridArqueos.DataTable.SetValue("#", lastRow, _oGridArqueos.Rows.Count);
                    _oGridArqueos.DataTable.SetValue("CodigoAsistente", lastRow, _oTxtCodigoAsociado.Value.ToString());
                    _oGridArqueos.DataTable.SetValue("NombreAsistente", lastRow, _oTxtNombreAsociado.Value.ToString());
                    _oGridArqueos.DataTable.SetValue("CodigoOficina", lastRow, _oTxtCodigoOficina.Value.ToString());
                    //_oGridArqueos.DataTable.SetValue("FechaArqueo", lastRow, DateTime.Now);
                    _oGridArqueos.DataTable.SetValue("Empresa", lastRow, empresa);
                    _oGridArqueos.DataTable.SetValue("Plan", lastRow, plan);
                    _oGridArqueos.DataTable.SetValue("Solicitud", lastRow, _oTxtCodigoSolicitud.Value.ToString());
                    _oGridArqueos.AutoResizeColumns();
                    verificar = false;

                    _oRec = null;
                    _oRec = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    _oRec.DoQuery(@"SELECT  ISNULL(MAX(CONVERT(INT, Code)), 0) + 1 AS Code
                                    FROM    dbo.[@ARQUEOS]");
                    code  = Convert.ToInt32(_oRec.Fields.Item("Code").Value);
                    _oRec = null;
                    _oRec = (SAPbobsCOM.Recordset)_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    _oRec.DoQuery(@"INSERT INTO dbo.[@ARQUEOS]
                                                ( Code ,
                                                  Name ,
                                                  U_CodigoAsistente ,
                                                  U_NombreAsistente ,
                                                  U_CodigoOficina ,
                                                  U_Empresa ,
                                                  U_Plan ,
                                                  U_Solicitud
                                                )
                                        VALUES  ( '" + code + "' ," +
                                  "'" + code + "' ," +
                                  "'" + _oTxtCodigoAsociado.Value.ToString().ToUpper() + "' ," +
                                  "'" + _oTxtNombreAsociado.Value.ToString() + "' ," +
                                  "'" + _oTxtCodigoOficina.Value.ToString() + "' ," +
                                  "'" + empresa + "' ," +
                                  "'" + plan + "' ," +
                                  "'" + _oTxtCodigoSolicitud.Value.ToString() + "'" +
                                  ")");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error al agregar solicitud escaneada *AgregarSolicitud* : " + ex.Message);
            }
            finally
            {
                try
                {
                    if (_oRec != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(_oRec);
                    }
                    _oForma.Freeze(false);
                }
                catch (Exception)
                {
                }
            }
        }
Esempio n. 41
0
        public virtual void ET_grd_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...

            if ((pVal.ColUID == "CHK") && (pVal.Row != -1) && (oGrid.DataTable.Rows.Count > 0))
            {
                oForm.Freeze(true);

                oGrid.DataTable.SetValue("U_PROCDT", pVal.Row, DateTime.Now.ToString("yyyyMMdd"));
                oGrid.DataTable.SetValue("U_PROCNM", pVal.Row, B1Connections.theAppl.Company.UserName);


                oForm.Freeze(false);
            }

            if (pVal.Row != -1)
                oGrid.Rows.SelectedRows.Add(pVal.Row);
        }
Esempio n. 42
0
        public virtual void ET_AFDataMenu_Add(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;

            // ADD YOUR ACTION CODE HERE ...
            oForm.Freeze(true);

            SetItemCaption(oForm, "1", "생성");

            oForm.Freeze(false);
        }
Esempio n. 43
0
        /// <summary>
        /// Obtiene la información del asociado capturado
        /// </summary>
        private void ObtenerInformacionAsociado()
        {
            try
            {
                _oForma = _Application.Forms.Item(formID);
                _oForma.Freeze(true);
                string oficinaUsuario        = null;
                string oficinaAsociado       = null;
                string nombreOficinaAsociado = null;
                string nombreAsociado        = null;
                _oRec = null;

                oficinaUsuario = Extensor.ObtenerAlmacenOficina(_Company);
                _oRec          = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                _oRec.DoQuery(@"SELECT T0.pager AS OficinaAsociado,
		                                            (T0.middleName + ' ' + T0.lastName) AS NombreAsociado,
		                                            T1.WhsName AS NombreOficina
                                             FROM   dbo.OHEM T0
                                             LEFT JOIN dbo.OWHS T1 ON T0.pager = T1.WhsCode
                                             WHERE  T0.firstName =  '" + _oTxtCodigoAsociado.Value + "'");

                oficinaAsociado       = _oRec.Fields.Item("OficinaAsociado").Value.ToString();
                nombreOficinaAsociado = _oRec.Fields.Item("NombreOficina").Value.ToString();
                nombreAsociado        = _oRec.Fields.Item("NombreAsociado").Value.ToString();

                if (!string.IsNullOrEmpty(oficinaAsociado))
                {
                    if (oficinaUsuario.Contains(oficinaAsociado))
                    {
                        _oTxtCodigoOficina.Value               = oficinaAsociado;
                        _oTxtNombreOficina.Value               = nombreOficinaAsociado;
                        _oTxtNombreAsociado.Value              = nombreAsociado;
                        _oBtnImprimirArqueo.Item.Visible       = false;
                        _oTxtCodigoSolicitud.Item.Enabled      = true;
                        _oForma.Items.Item(BTN_ARQUEO).Enabled = true;
                        CargarGridArqueo();
                    }
                    else
                    {
                        _oTxtCodigoOficina.Value  = "";
                        _oTxtNombreOficina.Value  = "";
                        _oTxtNombreAsociado.Value = "";
                        _oTxtCodigoAsociado.Value = "";
                        _Application.MessageBox("No existe Asociado o no pertenece a tu oficina.");
                        if (_oGridArqueos != null)
                        {
                            _oGridArqueos.DataTable.Clear();
                        }
                    }
                }
                else
                {
                    _oTxtCodigoOficina.Value  = "";
                    _oTxtNombreOficina.Value  = "";
                    _oTxtNombreAsociado.Value = "";
                    _oTxtCodigoAsociado.Value = "";
                    _Application.MessageBox("No existe Asociado o no pertenece a tu oficina.");
                    if (_oGridArqueos != null)
                    {
                        _oGridArqueos.DataTable.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error al obtener información del asociado *ObtenerInformacionAsociado* : " + ex.Message);
            }
            finally
            {
                try
                {
                    if (_oRec != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(_oRec);
                    }
                    _oForma.Freeze(false);
                }
                catch (Exception)
                {
                }
            }
        }
Esempio n. 44
0
        private void BuscarRegistros()
        {
            SAPbouiCOM.EditText oEditText;
            SAPbouiCOM.ComboBox oComboBox;
            String Tipo, sDocSubType, FDesde, FHasta, CDesde, CHasta, Serie;
            String Tabla        = "";
            String TipoDocElect = "";
            String ObjType      = "";

            SAPbouiCOM.Grid oGrid;
            try
            {
                oForm.Freeze(true);
                oEditText   = (EditText)(oForm.Items.Item("FDesde").Specific);
                FDesde      = oEditText.Value;
                oEditText   = (EditText)(oForm.Items.Item("FHasta").Specific);
                FHasta      = oEditText.Value;
                oEditText   = (EditText)(oForm.Items.Item("Serie").Specific);
                Serie       = oEditText.Value;
                oEditText   = (EditText)(oForm.Items.Item("CDesde").Specific);
                CDesde      = oEditText.Value;
                oEditText   = (EditText)(oForm.Items.Item("CHasta").Specific);
                CHasta      = oEditText.Value;
                oComboBox   = (ComboBox)(oForm.Items.Item("TipoDoc").Specific);
                Tipo        = oComboBox.Value;
                Tipo        = Tipo.Trim();
                sDocSubType = "";
                if (Tipo == "01") //Factura venta
                {
                    Tabla        = "OINV";
                    sDocSubType  = "'--'";
                    TipoDocElect = "01";
                    ObjType      = "13";
                }
                else if (Tipo == "01A") //Factura anticipo
                {
                    Tabla        = "ODPI";
                    sDocSubType  = "'--'";
                    TipoDocElect = "01";
                    ObjType      = "203";
                }
                else if (Tipo == "01X") //Factura Exportacion
                {
                    Tabla        = "OINV";
                    sDocSubType  = "'IX'";
                    TipoDocElect = "01";
                    ObjType      = "13";
                }
                else if (Tipo == "08") //Nota de Debito
                {
                    Tabla        = "OINV";
                    sDocSubType  = "'DN'";
                    TipoDocElect = "08";
                    ObjType      = "13";
                }
                else if (Tipo == "03") //Boleta
                {
                    Tabla        = "OINV";
                    sDocSubType  = "'IB','--'";
                    TipoDocElect = "03";
                    ObjType      = "13";
                }
                else if (Tipo == "07") //nota de credito
                {
                    Tabla        = "ORIN";
                    sDocSubType  = "'--'";
                    TipoDocElect = "07";
                    ObjType      = "14";
                }
                else if (Tipo == "09") //guia remision Entrega
                {
                    Tabla        = "ODLN";
                    sDocSubType  = "'--'";
                    TipoDocElect = "09";
                    ObjType      = "15";
                }
                else if (Tipo == "09T") //guia remision Transferencia
                {
                    Tabla        = "OWTR";
                    sDocSubType  = "'--'";
                    TipoDocElect = "09";
                    ObjType      = "67";
                }
                else if (Tipo == "09D") //guia remision Devolucion
                {
                    Tabla        = "ORPD";
                    sDocSubType  = "'--'";
                    TipoDocElect = "09";
                    ObjType      = "21";
                }
                else if (Tipo == "20") //Comprobante Retencion
                {
                    Tabla        = "OVPM";
                    sDocSubType  = "'--'";
                    TipoDocElect = "20";
                    ObjType      = "46";
                }


                if (TipoDocElect == "20")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"SELECT 'N' 'Sel'
                                  ,T0.DocEntry
                                  ,T0.DocNum
		                          ,T0.ObjType
	                              ,T0.DocDate
		                          ,'20'	'TipoDoc'
		                          ,T0.U_BPP_PTSC	'Serie'
		                          ,T0.U_BPP_PTCC	'Folio'
		                          ,T0.CardCode		'CardCode'
		                          ,T0.CardName		'CardName'
		                          ,ISNULL(T0.DocCurr,'PEN')	'Moneda'
		                          ,CASE WHEN T0.DocTotalFC > 0 THEN T0.DocTotalFC
			                            ELSE T0.DocTotal
		                           END				'DocTotal'
                                  ,CASE WHEN LEFT(T0.U_BPP_PTSC,1) = 'R' THEN T0.U_BPP_PTSC + '-' + T0.U_BPP_PTCC ELSE 'R' + T0.U_BPP_PTSC + '-' + T0.U_BPP_PTCC END 'ExtFolio'
	                          FROM {0} T0
	                          JOIN NNM1 N0 ON N0.Series = T0.Series
	                          , OADM A0
	                         WHERE UPPER(LEFT(N0.BeginStr,1)) = 'E'
                               AND ISNULL(T0.U_BPP_PTSC,'') <> '' 
		                       AND ISNULL(T0.U_BPP_PTCC,'') <> '' 
	                           AND T0.Canceled = 'N'
	                           {1}
	                           {2}
	                           {3}
	                           {4}
	                           {5}"    ;
                        s = String.Format(s, Tabla,
                                          (FDesde != "" ? @" AND T0.DocDate >= '" + FDesde + "' " : ""),
                                          (FHasta != "" ? @" AND T0.DocDate <= '" + FHasta + "' " : ""),
                                          (Serie != "" ? @" AND T0.U_BPP_MDSD = '" + Serie + "' " : ""),
                                          (CDesde != "" ? @" AND T0.U_BPP_MDCD >= '" + CDesde + "' " : ""),
                                          (CHasta != "" ? @" AND T0.U_BPP_MDCD <= '" + CHasta + "' " : "")
                                          );
                    }
                    else
                    {
                        s = @"SELECT 'N' ""Sel""
                                  ,T0.""DocEntry""
                                  ,T0.""DocNum""
		                          ,T0.""ObjType""
	                              ,T0.""DocDate""
		                          ,'20'	""TipoDoc""
		                          ,T0.""U_BPP_PTSC""	""Serie""
		                          ,T0.""U_BPP_PTCC""	""Folio""
		                          ,T0.""CardCode""		""CardCode""
		                          ,T0.""CardName""		""CardName""
		                          ,IFNULL(T0.""DocCurr"",'PEN')	""Moneda""
		                          ,CASE WHEN T0.""DocTotalFC"" > 0 THEN T0.""DocTotalFC""
			                            ELSE T0.""DocTotal""
		                           END				""DocTotal""
                                  ,CASE WHEN LEFT(T0.""U_BPP_PTSC"",1) = 'R' THEN T0.""U_BPP_PTSC"" || '-' || T0.""U_BPP_PTCC"" ELSE 'R' || T0.""U_BPP_PTSC"" || '-' || T0.""U_BPP_PTCC"" END ""ExtFolio""
	                          FROM ""{0}"" T0
	                          JOIN ""NNM1"" N0 ON N0.""Series"" = T0.""Series""
	                          , ""OADM"" A0
	                         WHERE UPPER(LEFT(N0.""BeginStr"",1)) = 'E'
                               AND IFNULL(T0.""U_BPP_PTSC"",'') <> '' 
		                       AND IFNULL(T0.""U_BPP_PTCC"",'') <> '' 
	                           AND T0.""Canceled"" = 'N'
	                           {1}
	                           {2}
	                           {3}
	                           {4}
	                           {5}"    ;
                        s = String.Format(s, Tabla,
                                          (FDesde != "" ? @" AND T0.""DocDate"" >= '" + FDesde + "' " : ""),
                                          (FHasta != "" ? @" AND T0.""DocDate"" <= '" + FHasta + "' " : ""),
                                          (Serie != "" ? @" AND T0.""U_BPP_MDSD"" = '" + Serie + "' " : ""),
                                          (CDesde != "" ? @" AND T0.""U_BPP_MDCD"" >= '" + CDesde + "' " : ""),
                                          (CHasta != "" ? @" AND T0.""U_BPP_MDCD"" <= '" + CHasta + "' " : "")
                                          );
                    }
                }
                else //TipoDocElect diferente a 20
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"SELECT 'N' 'Sel'
                                  ,T0.DocEntry
                                  ,T0.DocNum
		                          ,T0.ObjType
	                              ,T0.DocDate
		                          ,T0.U_BPP_MDTD	'TipoDoc'
		                          ,T0.U_BPP_MDSD	'Serie'
		                          ,T0.U_BPP_MDCD	'Folio'
		                          ,T0.CardCode		'CardCode'
		                          ,T0.CardName		'CardName'
		                          ,ISNULL(T0.DocCur,'PEN')	'Moneda'
		                          ,CASE WHEN T0.DocTotalFC > 0 THEN T0.DocTotalFC
			                            ELSE T0.DocTotal
		                           END				'DocTotal'
                                  ,CASE T0.U_BPP_MDTD
								      WHEN '01' THEN CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'F' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'F' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
									  WHEN '03' THEN CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'B' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'B' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
									  WHEN '08' THEN CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'F' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'F' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
									  WHEN '09' THEN CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'T' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'T' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
									  WHEN '07' THEN 
									        CASE WHEN (SELECT  MIN(documentType) FROM VID_VW_FE_PE_ORIN_R WHERE DocEntry = T0.DocEntry AND ObjType = T0.ObjType) = '03'
													THEN CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'B' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'B' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
												 ELSE CASE WHEN LEFT(T0.U_BPP_MDSD,1) = 'F' THEN T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD ELSE 'F' + T0.U_BPP_MDSD + '-' + T0.U_BPP_MDCD END
									        END
								   END 'ExtFolio'
	                          FROM {0} T0
	                          JOIN NNM1 N0 ON N0.Series = T0.Series
	                          , OADM A0
	                         WHERE UPPER(LEFT(N0.BeginStr,1)) = 'E'
                               AND ISNULL(T0.U_BPP_MDTD,'') <> '' 
		                       AND ISNULL(T0.U_BPP_MDSD,'') <> '' 
		                       AND ISNULL(T0.U_BPP_MDCD,'') <> '' 
                               AND T0.DocStatus = 'O'
	                           AND T0.Canceled = 'N'
	                           AND T0.U_BPP_MDTD = '{1}'
                               AND T0.DocSubType IN ({2})
	                           {3}
	                           {4}
	                           {5}
	                           {6}
	                           {7}"    ;
                        s = String.Format(s, Tabla, Tipo, sDocSubType,
                                          (FDesde != "" ? @" AND T0.DocDate >= '" + FDesde + "' " : ""),
                                          (FHasta != "" ? @" AND T0.DocDate <= '" + FHasta + "' " : ""),
                                          (Serie != "" ? @" AND T0.U_BPP_MDSD = '" + Serie + "' " : ""),
                                          (CDesde != "" ? @" AND T0.U_BPP_MDCD >= '" + CDesde + "' " : ""),
                                          (CHasta != "" ? @" AND T0.U_BPP_MDCD <= '" + CHasta + "' " : "")
                                          );
                    }
                    else
                    {
                        s = @"SELECT 'N' ""Sel""
                                  ,T0.""DocEntry""
                                  ,T0.""DocNum""
		                          ,T0.""ObjType""
	                              ,T0.""DocDate""
		                          ,T0.""U_BPP_MDTD""	""TipoDoc""
		                          ,T0.""U_BPP_MDSD""	""Serie""
		                          ,T0.""U_BPP_MDCD""	""Folio""
		                          ,T0.""CardCode""		""CardCode""
		                          ,T0.""CardName""		""CardName""
		                          ,IFNULL(T0.""DocCur"",'PEN')	""Moneda""
		                          ,CASE WHEN T0.""DocTotalFC"" > 0 THEN T0.""DocTotalFC""
			                            ELSE T0.""DocTotal""
		                           END				""DocTotal""
                                  ,CASE T0.""U_BPP_MDTD""
								      WHEN '01' THEN CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'F' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'F' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
									  WHEN '03' THEN CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'B' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'B' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
									  WHEN '08' THEN CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'F' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'F' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
									  WHEN '09' THEN CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'T' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'T' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
									  WHEN '07' THEN 
									        CASE WHEN (SELECT  MIN(""documentType"") FROM VID_VW_FE_PE_ORIN_R WHERE ""DocEntry"" = T0.""DocEntry"" AND ""ObjType"" = T0.""ObjType"") = '03'
													THEN CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'B' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'B' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
												 ELSE CASE WHEN LEFT(T0.""U_BPP_MDSD"",1) = 'F' THEN T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" ELSE 'F' || T0.""U_BPP_MDSD"" || '-' || T0.""U_BPP_MDCD"" END
									        END
								   END ""ExtFolio""
	                          FROM ""{0}"" T0
	                          JOIN ""NNM1"" N0 ON N0.""Series"" = T0.""Series""
	                          , ""OADM"" A0
	                         WHERE UPPER(LEFT(N0.""BeginStr"",1)) = 'E'
                               AND IFNULL(T0.""U_BPP_MDTD"",'') <> '' 
		                       AND IFNULL(T0.""U_BPP_MDSD"",'') <> '' 
		                       AND IFNULL(T0.""U_BPP_MDCD"",'') <> '' 
                               AND T0.""DocStatus"" = 'O'
	                           AND T0.""Canceled"" = 'N'
	                           AND T0.""U_BPP_MDTD"" = '{1}'
                               AND T0.""DocSubType"" IN ({2})
	                           {3}
	                           {4}
	                           {5}
	                           {6}
	                           {7}"    ;
                        s = String.Format(s, Tabla, Tipo, sDocSubType,
                                          (FDesde != "" ? @" AND T0.""DocDate"" >= '" + FDesde + "' " : ""),
                                          (FHasta != "" ? @" AND T0.""DocDate"" <= '" + FHasta + "' " : ""),
                                          (Serie != "" ? @" AND T0.""U_BPP_MDSD"" = '" + Serie + "' " : ""),
                                          (CDesde != "" ? @" AND T0.""U_BPP_MDCD"" >= '" + CDesde + "' " : ""),
                                          (CHasta != "" ? @" AND T0.""U_BPP_MDCD"" <= '" + CHasta + "' " : "")
                                          );
                    }
                }

                oGrid = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                oGrid.DataTable.ExecuteQuery(s);


                if (oGrid.DataTable.Rows.Count > 0)
                {
                    oGrid.Columns.Item("Sel").Type     = BoGridColumnType.gct_CheckBox;
                    oGrid.Columns.Item("Sel").Editable = true;
                    oGrid.Columns.Item("Sel").Visible  = true;

                    oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText;
                    var col = (EditTextColumn)(oGrid.Columns.Item("DocEntry"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.LinkedObjectType     = ObjType; // Link to Employee
                    col.TitleObject.Caption  = "Llave Doc";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("DocNum").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("DocNum"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.TitleObject.Caption  = "DocNum";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("ObjType").Type = BoGridColumnType.gct_EditText;
                    col          = (EditTextColumn)(oGrid.Columns.Item("ObjType"));
                    col.Editable = false;
                    col.Visible  = false;

                    oGrid.Columns.Item("DocDate").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("DocDate"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.TitleObject.Caption  = "Fecha Contable";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("TipoDoc").Type = BoGridColumnType.gct_EditText;
                    col                     = (EditTextColumn)(oGrid.Columns.Item("TipoDoc"));
                    col.Editable            = false;
                    col.Visible             = true;
                    col.TitleObject.Caption = "Tipo Doc";

                    oGrid.Columns.Item("Serie").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("Serie"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.TitleObject.Caption  = "Serie";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("Folio").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("Folio"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.RightJustified       = true;
                    col.TitleObject.Caption  = "Correlativo";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("CardCode").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("CardCode"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.LinkedObjectType     = "2";
                    col.TitleObject.Caption  = "Código SN";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("CardName").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("CardName"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.TitleObject.Caption  = "Nombre Cliente";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("Moneda").Type = BoGridColumnType.gct_EditText;
                    col                      = (EditTextColumn)(oGrid.Columns.Item("Moneda"));
                    col.Editable             = false;
                    col.Visible              = true;
                    col.TitleObject.Caption  = "Moneda";
                    col.TitleObject.Sortable = true;

                    oGrid.Columns.Item("DocTotal").Type = BoGridColumnType.gct_EditText;
                    col                     = (EditTextColumn)(oGrid.Columns.Item("DocTotal"));
                    col.Editable            = false;
                    col.Visible             = true;
                    col.RightJustified      = true;
                    col.TitleObject.Caption = "Total Doc";

                    oGrid.Columns.Item("ExtFolio").Type = BoGridColumnType.gct_EditText;
                    col                     = (EditTextColumn)(oGrid.Columns.Item("ExtFolio"));
                    col.Editable            = false;
                    col.Visible             = false;
                    col.TitleObject.Caption = "Folio Externo";
                }
                else
                {
                    FSBOApp.StatusBar.SetText("No se ha encontrado el documento " + Tipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                }
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText("BuscarRegistros: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("BuscarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
        }//fin MenuEvent

        private void BuscarDatos()
        {
            String FechaD;
            String FechaH;
            String TipoDTE;

            try
            {
                oForm.Freeze(true);
                FechaD  = ((System.String)((EditText)oForm.Items.Item("FechaD").Specific).Value);
                FechaH  = ((System.String)((EditText)oForm.Items.Item("FechaH").Specific).Value);
                TipoDTE = ((System.String)((ComboBox)oForm.Items.Item("TipoDTE").Specific).Selected.Value).Trim();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T0.DocEntry
                              ,T0.U_TipoDoc TipoDoc
	                          ,T0.U_Folio Folio
	                          ,T0.U_RUT RUT
                              ,T0.U_Razon Razon
	                          ,T0.U_FechaEmi FechaEmi
	                          ,CAST(REPLACE(CONVERT(CHAR(10), T0.U_FechaRecep, 102),'.','-') +'  '+ 
								                            CASE WHEN LEN(T0.U_HoraRecep) = 4 THEN LEFT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':' + RIGHT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':00'
									                             WHEN LEN(T0.U_HoraRecep) = 3 THEN '0' + LEFT(CAST(T0.U_HoraRecep AS VARCHAR(10)),1) + ':' + RIGHT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':00'
									                             WHEN LEN(T0.U_HoraRecep) = 2 THEN '00:'+ CAST(T0.U_HoraRecep AS VARCHAR(10)) + ':00'
										                         WHEN LEN(T0.U_HoraRecep) = 1 THEN '00:0' + CAST(T0.U_HoraRecep AS VARCHAR(10)) + ':00'
										                         ELSE '00:00:00'
								                            END AS VARCHAR(50)) FechaRecep
	                          ,T0.U_Monto Monto
	                          ,T0.U_IVA IVA
	                          ,T0.U_EstadoC EstadoC
	                          ,T0.U_EstadoSII EstadoSII
	                          ,T0.U_EstadoLey EstadoLey
                              ,CAST(T0.U_DocEntry AS INT) DocEntryDoc
                              ,{4} 'xml'  
                          FROM [{2}] T0
                         WHERE 1 = 1
                           AND T0.{3} BETWEEN '{0}' AND '{1}'";
                }
                else
                {
                    s = @"SELECT T0.""DocEntry""
                              ,T0.""U_TipoDoc"" ""TipoDoc""
	                          ,T0.""U_Folio"" ""Folio""
	                          ,T0.""U_RUT"" ""RUT""
                              ,T0.""U_Razon"" ""Razon""
	                          ,T0.""U_FechaEmi"" ""FechaEmi""
	                          ,CAST(TO_VARCHAR(T0.""U_FechaRecep"", 'yyyy-MM-dd') ||'  '|| 
								   CASE WHEN LENGTH(T0.""U_HoraRecep"") = 4 THEN LEFT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':' || RIGHT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 3 THEN '0' || LEFT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),1) || ':' || RIGHT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 2 THEN '00:' || CAST(T0.""U_HoraRecep"" AS VARCHAR(10)) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 1 THEN '00:0' || CAST(T0.""U_HoraRecep"" AS VARCHAR(10)) || ':00'
										ELSE '00:00:00'
								   END AS VARCHAR(50)) ""FechaRecep""
	                          ,T0.""U_Monto"" ""Monto""
	                          ,T0.""U_IVA"" ""IVA""
	                          ,T0.""U_EstadoC"" ""EstadoC""
	                          ,T0.""U_EstadoSII"" ""EstadoSII""
	                          ,T0.""U_EstadoLey"" ""EstadoLey""
                              ,TO_INT(T0.""U_DocEntry"") ""DocEntryDoc""
                              ,{4} ""xml""  
                          FROM ""{2}"" T0
                         WHERE 1 = 1
                           AND T0.""{3}"" BETWEEN '{0}' AND '{1}'";
                }
                s = String.Format(s, FechaD, FechaH, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"), (DSOpFec.Value == "1" ? "U_FechaEmi" : "U_FechaRecep"), (TipoDTE == "C" ? (GlobalSettings.RunningUnderSQLServer ? @"T0.U_Xml" : @"T0.""U_Xml"" ") : "''"));

                if (((System.String)((ComboBox)oForm.Items.Item("Cliente").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoC = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoC"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("Cliente").Specific).Selected.Value).Trim());
                }

                if (((System.String)((ComboBox)oForm.Items.Item("SII").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoSII = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoSII"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("SII").Specific).Selected.Value).Trim());
                }

                if (((System.String)((ComboBox)oForm.Items.Item("Ley").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoLey = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoLey"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("Ley").Specific).Selected.Value).Trim());
                }

                oDataTable.ExecuteQuery(s);

                oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText;
                var col = (EditTextColumn)(oGrid.Columns.Item("DocEntry"));
                col.Visible = false;

                oGrid.Columns.Item("TipoDoc").Type = BoGridColumnType.gct_EditText;
                col                      = (EditTextColumn)(oGrid.Columns.Item("TipoDoc"));
                col.Editable             = false;
                col.TitleObject.Caption  = "Tipo DTE";
                col.TitleObject.Sortable = true;

                oGrid.Columns.Item("Folio").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Folio"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Nro Folio";

                oGrid.Columns.Item("RUT").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("RUT"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "RUT";
                if (TipoDTE == "C")
                {
                    col.Visible = true;
                }
                else
                {
                    col.Visible = false;
                }

                oGrid.Columns.Item("Razon").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Razon"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Razon Social";

                oGrid.Columns.Item("FechaEmi").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("FechaEmi"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Fecha Emisión";

                oGrid.Columns.Item("FechaRecep").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("FechaRecep"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Fecha Recepción";

                oGrid.Columns.Item("Monto").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Monto"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Monto";

                oGrid.Columns.Item("IVA").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("IVA"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "IVA";

                oGrid.Columns.Item("EstadoC").Type = BoGridColumnType.gct_ComboBox;
                var colCombo = ((ComboBoxColumn)oGrid.Columns.Item("EstadoC"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado Cliente";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoC'";
                }
                else
                {
                    s = @"SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoC'";
                }
                s = String.Format(s, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoC")), ref oRecordSet, false);

                oGrid.Columns.Item("EstadoSII").Type = BoGridColumnType.gct_ComboBox;
                colCombo                      = ((ComboBoxColumn)oGrid.Columns.Item("EstadoSII"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado SII";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoSII'";
                }
                else
                {
                    s = @"SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoSII'";
                }
                s = String.Format(s, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoSII")), ref oRecordSet, false);

                oGrid.Columns.Item("EstadoLey").Type = BoGridColumnType.gct_ComboBox;
                colCombo                      = ((ComboBoxColumn)oGrid.Columns.Item("EstadoLey"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado Ley 20.956";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T1.FldValue Code, T1.Descr Name
                          FROM CUFD T0
                          JOIN UFD1 T1 ON T1.TableID = T0.TableID
                                      AND T1.FieldID = T0.FieldID
                         WHERE T0.TableID = '{0}'
                           AND T0.AliasID = 'EstadoLey'";
                }
                else
                {
                    s = @"SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name""
                          FROM ""CUFD"" T0
                          JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID""
                                      AND T1.""FieldID"" = T0.""FieldID""
                         WHERE T0.""TableID"" = '{0}'
                           AND T0.""AliasID"" = 'EstadoLey'";
                }
                s = String.Format(s, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoLey")), ref oRecordSet, false);

                oGrid.Columns.Item("DocEntryDoc").Type = BoGridColumnType.gct_EditText;
                col                = ((EditTextColumn)oGrid.Columns.Item("DocEntryDoc"));
                col.Editable       = false;
                col.RightJustified = true;
                if (TipoDTE == "V")
                {
                    col.Visible = false;
                }
                else
                {
                    col.Visible = true;
                }
                col.TitleObject.Sortable = false;
                col.TitleObject.Caption  = "Factura en SAP";
                col.LinkedObjectType     = "18";

                oGrid.Columns.Item("xml").Type = BoGridColumnType.gct_EditText;
                col          = ((EditTextColumn)oGrid.Columns.Item("xml"));
                col.Editable = false;
                col.Visible  = false;

                oGrid.AutoResizeColumns();
            }
            catch (Exception x)
            {
                FSBOApp.StatusBar.SetText(x.Message + " ** Trace: " + x.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("BuscarDatos: " + x.Message + " ** Trace: " + x.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Esempio n. 46
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 CantRol;

            SAPbouiCOM.ComboBox oCombo;
            SAPbouiCOM.EditText oEditText;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet      = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            Funciones.SBO_f = FSBOf;
            try
            {
                Lista = new List <string>();
                FSBOf.LoadForm(xmlPath, "VID_DarBaja.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                oCombo = (ComboBox)(oForm.Items.Item("TipoDoc").Specific);
                oCombo.ValidValues.Add("01", "Factura");
                oCombo.ValidValues.Add("01A", "Factura de Anticipo");
                oCombo.ValidValues.Add("01X", "Factura de Exportación");
                oCombo.ValidValues.Add("03", "Boleta Venta");
                oCombo.ValidValues.Add("07", "Nota de Credito");
                oCombo.ValidValues.Add("08", "Nota de Debito");
                oCombo.ValidValues.Add("09T", "Guia Remisión x Transferencia");
                oCombo.ValidValues.Add("09D", "Guia Remisión x Devol. Compra");
                oCombo.ValidValues.Add("09", "Guia Remisión x Entrega");
                oCombo.ValidValues.Add("20", "Comprobante Retención");
                oCombo.Select("01", BoSearchKey.psk_ByValue);
                oForm.Items.Item("TipoDoc").DisplayDesc = true;

                oEditText = (EditText)(oForm.Items.Item("FDesde").Specific);
                //oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oEditText = (EditText)(oForm.Items.Item("FHasta").Specific);
                //oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                var oGrid = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                oGrid.DataTable = oForm.DataSources.DataTables.Add("dt");


                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("TipoDoc  , f,  t,  t,  f, r, 1");
                Lista.Add("FDesde   , f,  t,  f,  f, r, 1");
                Lista.Add("FHasta   , f,  t,  f,  f, r, 1");
                Lista.Add("Razon    , t,  t,  f,  f, r, 1");
                Lista.Add("DocEntry , f,  f,  t,  f, r, 1");
                FSBOf.SetAutoManaged(ref oForm, Lista);
                oForm.Mode = BoFormMode.fm_ADD_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            finally
            {
                if (oForm != null)
                {
                    oForm.Freeze(false);
                }
            }


            return(Result);
        }//fin InitForm
Esempio n. 47
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...
            oForm.Freeze(true);

            try
            {
                /*빈 라인 삭제*/
                FN.SetMatrixDeleteRow(ref oForm, ref oMatrix);
                /*행추가*/
                SetMatrixAddRow(FN.RowSelectMode.None);
                /*삭제후 다시 문서 총계*/
                SetMatrixCalc_Sum();

                if (oForm.Mode == BoFormMode.fm_OK_MODE)
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); ;
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "1") && (pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    if ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE))
                    {
                        BubbleEvent = false;
                        if (ValidarDatos())
                        {
                            GuardarDatos();
                        }
                    }
                }

                if ((pVal.ItemUID == "btnCtaSAP") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    var bpaso = false;
                    for (Int32 iCant = 0; iCant <= oGrid.Rows.Count - 1; iCant++)
                    {
                        if (oGrid.Rows.IsSelected(iCant))
                        {
                            bpaso = true;
                            if (((System.Int32)oDataTable.GetValue("DocEntry", iCant)) == 0)
                            {
                                FSBOApp.StatusBar.SetText("Debe guardar registro de Plan de Cuentas SII", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                            }
                            else
                            {
                                CuentaSAP(iCant);
                                break;
                            }
                        }
                    }
                    if (!bpaso)
                    {
                        FSBOApp.StatusBar.SetText("Debe seleccionar una linea", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    }
                }

                if ((pVal.ItemUID == "btnCrear") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    if (!oForm.Items.Item("Cuenta").Visible)
                    {
                        oForm.Items.Item("Cuenta").Visible = true;
                        oForm.Items.Item("Descr").Visible  = true;
                    }
                    else
                    {
                        if (CrearNuevaCta())
                        {
                            oForm.Freeze(true);
                            oForm.DataSources.UserDataSources.Item("Cuenta").Value = "";
                            oForm.DataSources.UserDataSources.Item("Descr").Value  = "";
                            //((EditText)oForm.Items.Item("Cuenta").Specific).Value = "";
                            //((EditText)oForm.Items.Item("Descr").Specific).Value = "";
                            s = "XXX";
                            oForm.Items.Item("XXX").Click(BoCellClickType.ct_Regular);
                            oForm.Items.Item("Cuenta").Visible = false;
                            oForm.Items.Item("Descr").Visible  = false;
                            CargarGrilla();
                        }
                    }
                }

                if ((pVal.ItemUID == "btnBorrar") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    BorrarCta();
                }


                if ((pVal.ItemUID == "grid") && (pVal.ColUID == "Cuenta") && (pVal.EventType == BoEventTypes.et_VALIDATE) && (!pVal.BeforeAction))
                {
                    ValidarDataTable(((System.String)oDataTable.GetValue("Cuenta", pVal.Row)), pVal.Row);
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }//fin FormEvent
Esempio n. 49
0
        public virtual bool ET_BFFormDataUpdate(BusinessObjectInfo pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            // ADD YOUR ACTION CODE HERE ...
            oForm.Freeze(true);
            try
            {
                oMatrix = oForm.Items.Item("mtx1").Specific;

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

                FN.SetDBDataSourceDeleteRow(ref oKIS_SD00301_HRD, "U_ITMGRPCD");

                oMatrix.LoadFromDataSource();

                SetMatrixRowNumbering(oMatrix, "U_LINENUM");

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
            return true;
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 CantRol;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet      = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            Funciones.SBO_f = FSBOf;
            try
            {
                Lista = new List <string>();
                FSBOf.LoadForm(xmlPath, "VID_FEPLANCTA.srf", uid);
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged = true;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT COUNT(*) AS cant FROM [@VID_FEPLANCTA]";
                }
                else
                {
                    s = @"SELECT COUNT(*) ""cant"" FROM ""@VID_FEPLANCTA""";
                }
                oRecordSet.DoQuery(s);
                oForm.SupportedModes = (((System.Int32)oRecordSet.Fields.Item("cant").Value) > 0 ? 1 : 3);
                oForm.Mode           = (((System.Int32)oRecordSet.Fields.Item("cant").Value) > 0 ? BoFormMode.fm_OK_MODE : BoFormMode.fm_ADD_MODE);

                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FEPLANCTA");

                if (((System.Int32)oRecordSet.Fields.Item("cant").Value) == 0)
                {
                    FSBOApp.StatusBar.SetText("Iniciando carga de cuentas SII", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    CargarCtaSII();
                }

                // Ok  Ad  Fnd Vw Rq Sec
                Lista.Add("grid       , t,  t,  f,  t, n, 1 ");
                FSBOf.SetAutoManaged(oForm, Lista);

                oForm.DataSources.UserDataSources.Add("Cuenta", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 30);
                oEditText = ((EditText)oForm.Items.Item("Cuenta").Specific);
                oEditText.DataBind.SetBound(true, "", "Cuenta");

                oForm.DataSources.UserDataSources.Add("Descr", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 60);
                oEditText = ((EditText)oForm.Items.Item("Descr").Specific);
                oEditText.DataBind.SetBound(true, "", "Descr");

                oDataTable          = oForm.DataSources.DataTables.Add("VID_FEPLANCTA");
                oGrid               = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                oGrid.DataTable     = oDataTable;
                oGrid.SelectionMode = BoMatrixSelect.ms_Single;

                CargarGrilla();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            finally
            {
                oForm.Freeze(false);
            }


            return(Result);
        }//fin InitForm
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;
            //TFunctions Reg;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FEPROCED.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEPROCED");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific);
                //oCombo.ValidValues.Add('33', 'Factura');

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';
                //        oMtx.AutoResizeColumns();


                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select DocEntry, ISNULL(U_TipoDoc,'') TipoDoc, ISNULL(U_ProcNomE,'') ProcNomE, ISNULL(U_ProcNomD,'') ProcNomD, ISNULL(U_ProcNomR,'') ProcNomR, ISNULL(U_ProcNomC,'') ProcNomC, ISNULL(U_ProcNomDe,'') ProcNomDe, ISNULL(U_ProcNomL,'') ProcNomL, ISNULL(U_ProcNomS,'') ProcNomS, ISNULL(U_Habili,'Y') 'Habilitada', ISNULL(U_CantLineas,0) 'CantLineas' from [@VID_FEPROCED]";
                }
                else
                {
                    s = @"select ""DocEntry"", IFNULL(""U_TipoDoc"",'') ""TipoDoc"", IFNULL(""U_ProcNomE"",'') ""ProcNomE"", IFNULL(""U_ProcNomD"",'') ""ProcNomD"", IFNULL(""U_ProcNomR"",'') ""ProcNomR"", IFNULL(""U_ProcNomC"",'') ""ProcNomC"", IFNULL(""U_ProcNomDe"",'') ""ProcNomDe"", IFNULL(""U_ProcNomL"",'') ""ProcNomL"", IFNULL(""U_ProcNomS"",'') ""ProcNomS"", IFNULL(""U_Habili"",'Y') ""Habilitada"", IFNULL(""U_CantLineas"",0) ""CantLineas"" from ""@VID_FEPROCED"" ";
                }
                oRecordSet.DoQuery(s);

                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)));
                    oDBDSH.SetValue("U_TipoDoc", i, (System.String)(oRecordSet.Fields.Item("TipoDoc").Value));
                    //oDBDSH.SetValue("U_TipoDocPE", i, (System.String)(oRecordSet.Fields.Item("TipoDocPE").Value));
                    oDBDSH.SetValue("U_ProcNomE", i, (System.String)(oRecordSet.Fields.Item("ProcNomE").Value));
                    oDBDSH.SetValue("U_ProcNomD", i, (System.String)(oRecordSet.Fields.Item("ProcNomD").Value));
                    oDBDSH.SetValue("U_ProcNomR", i, (System.String)(oRecordSet.Fields.Item("ProcNomR").Value));
                    oDBDSH.SetValue("U_ProcNomC", i, (System.String)(oRecordSet.Fields.Item("ProcNomC").Value));
                    //oDBDSH.SetValue("U_ProcNomDe", i, (System.String)(oRecordSet.Fields.Item("ProcNomDe").Value));
                    //oDBDSH.SetValue("U_ProcNomL", i, (System.String)(oRecordSet.Fields.Item("ProcNomL").Value));
                    //oDBDSH.SetValue("U_ProcNomS", i, (System.String)(oRecordSet.Fields.Item("ProcNomS").Value));
                    oDBDSH.SetValue("U_Habili", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oDBDSH.SetValue("U_CantLineas", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("CantLineas").Value)));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("DocEntry", i, "");
                oDBDSH.SetValue("U_TipoDoc", i, "");
                //oDBDSH.SetValue("U_TipoDocPE", i, "");
                oDBDSH.SetValue("U_ProcNomE", i, "");
                oDBDSH.SetValue("U_ProcNomD", i, "");
                oDBDSH.SetValue("U_ProcNomR", i, "");
                oDBDSH.SetValue("U_ProcNomC", i, "");
                //oDBDSH.SetValue("U_ProcNomDe", i, "");
                //oDBDSH.SetValue("U_ProcNomL", i, "");
                //oDBDSH.SetValue("U_ProcNomS", i, "");
                oDBDSH.SetValue("U_Habili", i, "Y");
                oDBDSH.SetValue("U_CantLineas", i, "60");

                if (GlobalSettings.RunningUnderSQLServer) //TipoDoc
                {
                    s = @"select U1.FldValue 'Code', U1.Descr 'Name' from UFD1 U1 join CUFD U0 on U0.TableID = U1.TableID and U0.FieldID = U1.FieldID where U1.TableID = '@VID_FEPROCED' and U0.AliasID = '{0}'";
                }
                else
                {
                    s = @"select U1.""FldValue"" ""Code"", U1.""Descr"" ""Name"" from ""UFD1"" U1 join ""CUFD"" U0 on U0.""TableID"" = U1.""TableID"" and U0.""FieldID"" = U1.""FieldID"" where U1.""TableID"" = '@VID_FEPROCED' and U0.""AliasID"" = '{0}' ";
                }

                s = String.Format(s, "TipoDoc");
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("TipoDoc"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);
                //((SAPbouiCOM.Column)oMtx.Columns.Item("TipoDocPE")).Visible = false;

                if (GlobalSettings.RunningUnderSQLServer) //Habilitado
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FEPROCED' and FieldID = 2";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FEPROCED' and ""FieldID"" = 2";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habili"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);


                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();


                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 52
0
        public virtual void ET_1_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));
            // ADD YOUR ACTION CODE HERE ...

            if (oForm.Mode == BoFormMode.fm_ADD_MODE)
            {
                SetDefultMasterData(oForm);
            }
            else if (oForm.Mode == BoFormMode.fm_OK_MODE)
            {
                oForm.Freeze(true);

                // 1. 저장후 선택된 행 초기화 되기때문에 다시 선택
                LastSelectedMatrixRow_Select(oForm);

                // 2. 배송리스트 선택하고 상담이력 다시 조회              
                //FindSubData(oForm, gDeliverySelect);(데이터 로드에서 처리)  

                oForm.Freeze(false);
            }
        }
Esempio n. 53
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oComboBox;
            //SAPbouiCOM.Column oColumn;

            Param       = new TFunctions();
            Param.SBO_f = FSBOf;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_GELibro.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All

                oForm.EnableMenu("1281", false); //Actualizar
                oForm.EnableMenu("1282", false); //Crear

                oForm.DataSources.UserDataSources.Add("TipoLibro", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("TipoLibro").Specific);
                oComboBox.DataBind.SetBound(true, "", "TipoLibro");
                oComboBox.ValidValues.Add("V", "Venta");
                oComboBox.ValidValues.Add("C", "Compra");
                oComboBox.Select("V", BoSearchKey.psk_ByValue);

                oForm.DataSources.UserDataSources.Add("Periodo", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("Periodo").Specific);
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    oRecordSet.DoQuery("select CAST(AbsEntry AS VARCHAR(20)) Code, Code 'Name'  from OFPR where YEAR(F_RefDate) >= YEAR(GETDATE())-1  AND YEAR(T_RefDate) <= YEAR(GETDATE())");
                }
                else
                {
                    oRecordSet.DoQuery(@"select TO_VARCHAR(""AbsEntry"") ""Code"", ""Code"" ""Name""  from ""OFPR"" where YEAR(""F_RefDate"") >= YEAR(NOW())-1  AND YEAR(""T_RefDate"") <= YEAR(NOW()) ");
                }
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Periodo").Specific), ref oRecordSet, false);
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select AbsEntry from OFPR where GETDATE() BETWEEN F_RefDate AND T_RefDate";
                }
                else
                {
                    s = @"select ""AbsEntry"" from ""OFPR"" where NOW() BETWEEN ""F_RefDate"" AND ""T_RefDate"" ";
                }
                oRecordSet.DoQuery(s);
                oComboBox.Select(((System.Int32)oRecordSet.Fields.Item("AbsEntry").Value).ToString(), BoSearchKey.psk_ByValue);


                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select ISNULL(U_MultiSoc,'N') MultiSoc from [@VID_FEPARAM]";
                }
                else
                {
                    s = @"select IFNULL(""U_MultiSoc"",'N') ""MultiSoc"" from ""@VID_FEPARAM"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if (((System.String)oRecordSet.Fields.Item("MultiSoc").Value) == "Y")
                    {
                        bMultiSoc = true;
                    }
                }

                if (bMultiSoc)
                {
                    oForm.Items.Item("LInstituto").Visible = true;
                    oForm.Items.Item("Instituto").Visible  = true;
                    oComboBox = (ComboBox)(oForm.Items.Item("Instituto").Specific);
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select DocEntry, U_Sociedad 'Sociedad' from [@VID_FEMULTISOC] where isnull(U_Habilitada,'N') = 'Y'";
                    }
                    else
                    {
                        s = @"select ""DocEntry"", ""U_Sociedad"" ""Sociedad"" from ""@VID_FEMULTISOC"" where IFNULL(""U_Habilitada"",'N') = 'Y' ";
                    }
                    oRecordSet.DoQuery(s);
                    while (!oRecordSet.EoF)
                    {
                        oComboBox.ValidValues.Add(((System.Int32)oRecordSet.Fields.Item("DocEntry").Value).ToString(), ((System.String)oRecordSet.Fields.Item("Sociedad").Value).Trim());
                        oRecordSet.MoveNext();
                    }
                }
                else
                {
                    oForm.Items.Item("LInstituto").Visible = false;
                    oForm.Items.Item("Instituto").Visible  = false;
                }
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 54
0
        public virtual void ET_AFFormDataUpdate(BusinessObjectInfo pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            // ADD YOUR ACTION CODE HERE ...


            try
            {
                oForm.Freeze(true);

                //SetSystemDataTable(oForm);
                // 1. 저장후 라인ID 값 셋팅 및 상태값 초기화
                DbDataSourceToDataTable(oForm);

                // 2. 화면 조회다시 실행
                FindData(oForm);

                //DataSet ds = new DataSet();
                //ds.Tables.AddRange(new System.Data.DataTable[] { gDs.Tables[oForm.UniqueID + "_Deliver"], gDs.Tables[oForm.UniqueID + "_Call"] });
                //ds.WriteXml(@"C:\\test.xml");
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Esempio n. 55
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(gSelMtx).Specific;
                oForm.Freeze(true);


                oMatrix.AddRow(1, -1);
                int i = oMatrix.VisualRowCount;
                oMatrix.DeleteRow(i);
                oMatrix.FlushToDataSource();




                if (gSelMtx == "mtx1_DUMY")
                {
                    gDeliverySelect = -1;
                    // 1. 삭제된뒤 DataTable의 Index값을 다시 설정한다.
                    SetDataTableReIndexing_Deliver();

                    // 2. 다시 DataTable 기준으로 화면에 조회한다.
                    FindData(oForm);
                }
                else
                {
                    // 1. 삭제된뒤 DataTable의 Index값을 다시 설정한다.
                    SetDataTableReIndexing_Call();

                    // 2. 다시 DataTable 기준으로 화면에 조회한다.
                    FindSubData(oForm, GetSelectedMatrixRowIndex(oForm));
                }

                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 56
0
        public virtual void ET_mtx2_DUMY_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx2_DUMY").Specific));
            // ADD YOUR ACTION CODE HERE ...
            if (pVal.Row > 0)
            {
                //1. 콜리스트를 선택하면 배달코드를 찾아 자동으로 선택되도록 한다.
                oMatrix.SelectRow(pVal.Row, true, false);


                // 1-1 콜리스트 선택된 것에서 배달코드를 찾는다.
                string strDeliveryCode = FN.GetMatirxCellValue(ref oMatrix, "U_DELVCD", pVal.Row);

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

                // 2. 배달코드로 배송리스트에서 메트릭스의 행을 찾는다.
                var obj_Deliver = from row in gDs.Tables[oForm.UniqueID + "_Deliver"].AsEnumerable()
                                  where row.Field<string>("DELVCD") == strDeliveryCode
                                  select new
                                  {
                                      vIDX = row.Field<Int32>("IDX")
                                  };

                oMatrix1.SelectRow(obj_Deliver.Take(1).SingleOrDefault().vIDX +1, true, false);
                sFindTY = "F";

            }
            if (oForm.Settings.MatrixUID != pVal.ItemUID)
            {
                oForm.Freeze(true);
                oForm.Settings.MatrixUID = pVal.ItemUID;
                oMatrix.AutoResizeColumns();
                oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1_DUMY").Specific));
                oMatrix.AutoResizeColumns();
                oForm.Freeze(false);
            }
        }
Esempio n. 57
0
 public virtual void ET_mtx1_DUMY_AFClick(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1_DUMY").Specific));
     // ADD YOUR ACTION CODE HERE ...
     if (pVal.Row > 0)
     {
         oMatrix.SelectRow(pVal.Row, true, false);
         gDeliverySelect = pVal.Row;
     }
     if (oForm.Settings.MatrixUID != pVal.ItemUID)
     {
         oForm.Freeze(true);
         oForm.Settings.MatrixUID = pVal.ItemUID;
         oMatrix.AutoResizeColumns();
         oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx2_DUMY").Specific));
         oMatrix.AutoResizeColumns();
         oForm.Freeze(false);
     }
 }
Esempio n. 58
0
        public static void clsPO_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            oForm            = oSetupForm;
            oHDBDataSource   = oForm.DataSources.DBDataSources.Item("OPOR");
            oChildDataSource = oForm.DataSources.DBDataSources.Item("POR1");
            oMatrix          = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

            if (pVal.BeforeAction)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == "38" && (pVal.ColUID == "U_Variance" || pVal.ColUID == "U_DiscExc"))
                    {
                        BubbleEvent = false;
                    }
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "U_DocType")
                        {
                            BubbleEvent = false;
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_PICKER_CLICKED:
                    if (pVal.ItemUID == "38" && pVal.ColUID == "U_Variance")
                    {
                        BubbleEvent = false;
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "btnSH")
                    {
                        if (((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() == "")
                        {
                            oApplication.StatusBar.SetText("Select the Supplier....", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            BubbleEvent = false;
                        }

                        if (oHDBDataSource.GetValue("DocStatus", oHDBDataSource.Offset).ToString().Trim() != "O")
                        {
                            BubbleEvent = false;
                        }

                        // strDocEntry = oHDBDataSource.GetValue("DocEntry", 0).Trim();
                        //strDocType = oHDBDataSource.GetValue("U_DocType", 0).Trim();
                    }
                    break;

                default:
                    break;
                }
            }

            else if (pVal.BeforeAction == false)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                    //Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("2").Left + oForm.Items.Item("2").Width + 120, oForm.Items.Item("2").Top, oForm.Items.Item("2").Width + 20, oForm.Items.Item("2").Height, "Purchase History", true, 0, "");
                    Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("46").Left, oForm.Items.Item("46").Top + 20, oForm.Items.Item("46").Width, oForm.Items.Item("2").Height, "Purchase History", true, 0, "46");
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "1")
                    {
                        if (pVal.ActionSuccess)
                        {
                            if (oWaitForm != null)
                            {
                                oWaitForm.Close();
                                oWaitForm = null;
                            }
                        }
                    }

                    if (pVal.ItemUID == "btnSH")
                    {
                        try
                        {
                            if (oWaitForm != null)
                            {
                                string strCardCode1 = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                                string strCardCode2 = ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value.Trim();

                                if (strCardCode1 != strCardCode2)
                                {
                                    oWaitForm.Close();
                                    oWaitForm = null;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            oWaitForm = null;
                        }

                        if (oWaitForm == null)
                        {
                            string strQry;
                            oWaitForm       = clsSBO.LoadForm("EJ_OSSH.srf", "EJ_OSSH", oApplication);
                            oWaitForm.State = BoFormStateEnum.fs_Maximized;

                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("8").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("54").Specific).Value.Trim();
                            oWaitForm.Freeze(true);
                            oWaitForm.DataSources.DataTables.Add("@dtTemp");
                            SAPbouiCOM.Grid oGrid;
                            oGrid      = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;
                            oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                            strQry     = "Exec \"EJ_SupplierPurchaseHistory\"  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "'";
                            oWaitForm.DataSources.DataTables.Item(0).ExecuteQuery(strQry);
                            oGrid.DataTable = oWaitForm.DataSources.DataTables.Item(0);
                            oGrid.Columns.Item(0).Editable = true;
                            SAPbouiCOM.EditTextColumn oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(0));
                            oEditTxt.ChooseFromListUID     = "CFL_2";
                            oEditTxt.ChooseFromListAlias   = "ItemCode";
                            oGrid.Columns.Item(1).Editable = false;
                            oGrid.Columns.Item(2).Editable = true;
                            oGrid.Columns.Item(3).Editable = true;
                            oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(3));
                            oEditTxt.ChooseFromListUID     = "CFL_3";
                            oEditTxt.ChooseFromListAlias   = "UomCode";
                            oGrid.Columns.Item(4).Editable = true;
                            oGrid.Columns.Item(0).Editable = true;

                            for (int j = 5; j < oGrid.Columns.Count; j++)
                            {
                                oGrid.Columns.Item(j).Editable = false;
                            }

                            oGrid.AutoResizeColumns();
                            oGrid.DataTable.Rows.Add(1);

                            clsSupplierPurchaseHistory.oForm   = oWaitForm;
                            clsSupplierPurchaseHistory.oSOForm = oForm;
                            oWaitForm.Freeze(false);
                        }
                        else
                        {
                            oWaitForm.Visible = true;
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_LOST_FOCUS:
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "12")
                        {
                            //oForm.DefButton = "btnSH";
                            // oForm.ActiveItem = "btnSH";
                            ((SAPbouiCOM.Button)oForm.Items.Item("btnSH").Specific).Item.Click(BoCellClickType.ct_Regular);
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                    if (oWaitForm != null)
                    {
                        try
                        {
                            oWaitForm.Close();
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                        }
                        catch (Exception)
                        {
                            oWaitForm = null;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 59
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oComboBox;
            SAPbouiCOM.Column oColumn;

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_GLibro.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;       // afm_All

                oForm.EnableMenu("1281", false); //Actualizar
                oForm.EnableMenu("1282", false); //Crear

                oForm.DataSources.UserDataSources.Add("TipoLibro", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("TipoLibro").Specific);
                oComboBox.DataBind.SetBound(true, "", "TipoLibro");
                oComboBox.ValidValues.Add("V", "Venta");
                oComboBox.ValidValues.Add("C", "Compra");
                oComboBox.ValidValues.Add("B", "Boletas");
                oComboBox.ValidValues.Add("G", "Guias");
                oComboBox.Select("V", BoSearchKey.psk_ByValue);

                oForm.DataSources.UserDataSources.Add("Desde", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("Desde").Specific);
                oEditText.DataBind.SetBound(true, "", "Desde");
                oEditText.Value = DateTime.Now.ToString("yyyyMM") + "01";

                oForm.DataSources.UserDataSources.Add("Hasta", BoDataType.dt_DATE, 10);
                oEditText = (EditText)(oForm.Items.Item("Hasta").Specific);
                oEditText.DataBind.SetBound(true, "", "Hasta");
                oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select ISNULL(U_MultiSoc,'N') MultiSoc from [@VID_FEPARAM]";
                }
                else
                {
                    s = @"select IFNULL(""U_MultiSoc"",'N') ""MultiSoc"" from ""@VID_FEPARAM"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if (((System.String)oRecordSet.Fields.Item("MultiSoc").Value) == "Y")
                    {
                        bMultiSoc = true;
                    }
                }

                if (bMultiSoc)
                {
                    oForm.Items.Item("LInstituto").Visible = true;
                    oForm.Items.Item("Instituto").Visible  = true;
                    oComboBox = (ComboBox)(oForm.Items.Item("Instituto").Specific);
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select DocEntry, U_Sociedad 'Sociedad' from [@VID_FEMULTISOC] where isnull(U_Habilitada,'N') = 'Y'";
                    }
                    else
                    {
                        s = @"select ""DocEntry"", ""U_Sociedad"" ""Sociedad"" from ""@VID_FEMULTISOC"" where IFNULL(""U_Habilitada"",'N') = 'Y' ";
                    }
                    oRecordSet.DoQuery(s);
                    while (!oRecordSet.EoF)
                    {
                        oComboBox.ValidValues.Add(((System.Int32)oRecordSet.Fields.Item("DocEntry").Value).ToString(), ((System.String)oRecordSet.Fields.Item("Sociedad").Value).Trim());
                        oRecordSet.MoveNext();
                    }
                }
                else
                {
                    oForm.Items.Item("LInstituto").Visible = false;
                    oForm.Items.Item("Instituto").Visible  = false;
                }
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Esempio n. 60
-7
        public virtual bool ET_grd1_BFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {

                    if (pVal.ColUID == "U_CHK")
                    {
                        #region U_CHK 클릭시 기능 구현
                        if (pVal.Row >= 0)
                        {
                            oForm.Freeze(true);
                            try
                            {
                                #region 문서단위 그룹선택 기능구현
                                int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);


                                string U_CHK = oGrid.DataTable.GetValue("U_CHK", iRowIndex).ToString().Trim();

                                if (U_CHK == "N")
                                {
                                    oGrid.DataTable.SetValue("U_CHK", iRowIndex, "Y");
                                    if (oGrid.Rows.IsSelected(pVal.Row) == false)
                                    {
                                        oGrid.Rows.SelectedRows.Add(pVal.Row);
                                    }
                                }
                                else
                                {
                                    oGrid.DataTable.SetValue("U_CHK", iRowIndex, "N");
                                    if (oGrid.Rows.IsSelected(pVal.Row))
                                    {
                                        oGrid.Rows.SelectedRows.Remove(pVal.Row);
                                    }
                                }

                                #endregion
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                            finally
                            {
                                SetGridCalc_Sum();
                                oForm.Freeze(false);
                            }
                            return false;

                        }
                        else
                        {
                            //전체선택
                            SetGridColumn_CheckBox_SelectAll(ref oGrid, "U_CHK");
                            SetGridCalc_Sum();
                            return false;
                        }
                        #endregion

                    }// end (pVal.ColUID == "U_CHK")
            }
            catch (Exception ex)
            {

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