Exemplo n.º 1
0
        /// <summary>
        /// 청구 실행전 실행 가능여부 체크
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool BeforeCancel_ValidationCheck(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;
          
            string strValue = string.Empty;
            string strDocEntry = string.Empty;
            string strPaperTp = string.Empty;       
            try
            {
                oGrid = oForm.Items.Item("grd").Specific;
                if (oGrid.Rows.SelectedRows.Count > 0)
                {
                    int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));
                    strDocEntry = FN.GetGridCellValue(ref oGrid, "DocEntry", idx);                                       

                    strValue = FN.GetRecordsetValue(string.Format(" SELECT COUNT(1) FROM [@KIS_SO01402_HRD] WHERE DocEntry = {0} ", strDocEntry));
                    if (strValue.CompareTo("0") > 0)
                    {
                        B1Connections.theAppl.StatusBar.SetText("청구조정 및 수납관련 데이터가 존재 합니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        rtnValue = false;
                    }
                    else
                    {
                        rtnValue = true;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return rtnValue;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        public virtual void ET_AF_SUB_RECALC(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd").Specific;

                //if (oForm.Mode != BoFormMode.fm_OK_MODE)
                //    B1Connections.theAppl.StatusBar.SetText("문서가 수정중입니다. 갱신후 재실행 해주세요.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                //else
                //{
                oForm.Freeze(true);
                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));
                oGrid.DataTable.SetValue("ROWSTAT", idx, "C");

                if (oForm.Mode != BoFormMode.fm_UPDATE_MODE)
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                //}
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Exemplo n.º 4
0
        public virtual bool ET_grd1_BFMatrixLinkPressed(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_SHORTNM")
                {
                    if (pVal.Row >= 0)
                    {
                        int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

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

                        if (FN.GetRecordsetValue(string.Format("SELECT 'a' FROM [OCRD] WHERE CardCode = '{0}'", U_SHORTNM)) == "")
                        {
                            B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_GLAccounts, "", U_SHORTNM);
                        }
                        else
                        {
                            B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_BusinessPartner, "", U_SHORTNM);
                        }
                    }
                    return false;
                }

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return true;
        }
Exemplo n.º 5
0
        public virtual void ET_grd1_AFValidate(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)
                {

                    if (oGrid.Rows.IsSelected(pVal.Row) == false)
                    {
                        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);
                            }
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
Exemplo n.º 6
0
        public virtual bool ET_grd1_BFMatrixLinkPressed(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_OBJENTRY")
                {
                    if (pVal.Row >= 0)
                    {
                        int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                        string U_OBJYP = ((string)oGrid.DataTable.GetValue("U_OBJTP", iRowIndex)).Trim();
                        string U_OBJENTRY = ((string)oGrid.DataTable.GetValue("U_OBJENTRY", iRowIndex)).Trim();
                        switch (U_OBJYP)
                        {
                            case "18":
                                B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_PurchaseInvoice, "", U_OBJENTRY);
                                break;
                            case "30":
                                B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_JournalPosting, "", U_OBJENTRY);
                                break;
                            default:
                                break;
                        }
                        
                    }
                    return false;
                }
                if (pVal.ColUID == "U_TENTRY")
                {
                    if (pVal.Row >= 0)
                    {
                        int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                        string U_TTYPE = ((string)oGrid.DataTable.GetValue("U_TTYPE", iRowIndex)).Trim();
                        string U_TENTRY = ((string)oGrid.DataTable.GetValue("U_TENTRY", iRowIndex)).Trim();
                        switch (U_TTYPE)
                        {
                            case "30":
                                B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_JournalPosting, "", U_TENTRY);
                                break;
                            case "46":
                                B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_VendorPayment, "", U_TENTRY);
                                break;
                            default:
                                break;
                        }

                    }
                    return false;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return true;
        }
Exemplo n.º 7
0
        private void SetApplyDataToParentForm_2(SAPbouiCOM.Form oForm)
        {
            pForm = B1Connections.theAppl.Forms.Item(oForm.DataSources.UserDataSources.Item("pFORMUID").ValueEx);

            string strAddrType = string.Empty;
            try
            {
                pForm.Freeze(true);
                oGrid = oForm.Items.Item("grd").Specific;
                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));
                SAPbouiCOM.DBDataSource oDB_M = pForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                oDB_M.SetValue("U_HOMEPG", 0, FN.GetGridCellValue(ref oGrid, "Code", idx)); //신청코드
                oDB_M.SetValue("Name", 0, FN.GetGridCellValue(ref oGrid, "U_SINNM", idx)); // 신청자명

                strAddrType = FN.GetGridCellValue(ref oGrid, "U_ADDRTP", idx);
                if (strAddrType == "0")
                {
                    oDB_M.SetValue("U_ADDR1", 0, FN.GetGridCellValue(ref oGrid, "U_ADDR1", idx));   // 주소
                    oDB_M.SetValue("U_ADDR1_D", 0, FN.GetGridCellValue(ref oGrid, "U_ADDR2", idx)); // 주소 상세
                    oDB_M.SetValue("U_ZIPCD1", 0, FN.GetGridCellValue(ref oGrid, "U_ZIPCD", idx));  // 우편번호
                }
                else
                {
                    oDB_M.SetValue("U_ADDR2", 0, FN.GetGridCellValue(ref oGrid, "U_ADDR1", idx));   // 주소
                    oDB_M.SetValue("U_ADDR2_D", 0, FN.GetGridCellValue(ref oGrid, "U_ADDR2", idx)); // 주소 상세
                    oDB_M.SetValue("U_ZIPCD2", 0, FN.GetGridCellValue(ref oGrid, "U_ZIPCD", idx));  // 우편번호
                }
                oDB_M.SetValue("U_JOB", 0, FN.GetGridCellValue(ref oGrid, "U_JOB", idx)); // 직업
                oDB_M.SetValue("U_TEL", 0, FN.GetGridCellValue(ref oGrid, "U_TELNO", idx)); // 전화
                oDB_M.SetValue("U_MOBILE", 0, FN.GetGridCellValue(ref oGrid, "U_CELLNO", idx)); // 전화
                oDB_M.SetValue("U_EMAIL", 0, FN.GetGridCellValue(ref oGrid, "U_EMAIL", idx)); // 이메일
                oDB_M.SetValue("U_BIRTHDY", 0, FN.GetGridCellValue(ref oGrid, "U_BIRTHDY", idx)); // 생일

                string strReadType = FN.GetGridCellValue(ref oGrid, "U_SINGBN", idx);

                if (strReadType == "USO")
                    oDB_M.SetValue("U_TYPE", 0, "U10"); // 구독 = 정상독자
                else if (strReadType == "USP")
                    oDB_M.SetValue("U_TYPE", 0, "U30"); // 샘플 = 기증독자
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                pForm.Freeze(false);
                if (pForm != null) { Marshal.ReleaseComObject(pForm); } pForm = null;
            }
        }
Exemplo n.º 8
0
        public virtual bool ET_BFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...
            oForm.Freeze(true);
            try
            {
                oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;

                SelectedRows selectedRows = oGrid.Rows.SelectedRows;

                for (int i = 0; i < selectedRows.Count; i++)
                {
                    int gridRowIdx = selectedRows.Item(i, BoOrderType.ot_RowOrder);
                    int dataRowIdx = oGrid.GetDataTableRowIndex(gridRowIdx);

                    oGrid.DataTable.Rows.Remove(dataRowIdx);
                }

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

            return false;
        }
Exemplo n.º 9
0
        public virtual void ET_btnDEL_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnDEL").Specific));

            // ADD YOUR ACTION CODE HERE ...
            if (CFL.COMMON_MESSAGE("?", "선택한 신청내역을 삭제 하시겠습니까?") != 1)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            string query = string.Empty;

            string Code = string.Empty;
            string U_STATUS = string.Empty;
            string keyValue = string.Empty;
            

            try
            {
                oForm.Freeze(true);

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

                int rowIdx = -1;
                for (int i = 0; i < oGrid.DataTable.Rows.Count; i++)
                {
                    rowIdx = oGrid.GetDataTableRowIndex(i);

                    Code = oGrid.DataTable.GetValue("Code", rowIdx).ToString().Trim();
                    U_STATUS = oGrid.DataTable.GetValue("U_STATUS", rowIdx).ToString().Trim();

                    if (oGrid.DataTable.GetValue("CHK", rowIdx).ToString() == "Y")
                    {
                        if (U_STATUS == statusTypes.Close)
                        {
                            CFL.COMMON_MESSAGE("!", "선택된 신청내역 중 완료된 문서가 존재합니다.");
                            return;
                        }

                        keyValue += Code + ",";
                    }
                }

                if (string.IsNullOrEmpty(keyValue))
                {
                    CFL.COMMON_MESSAGE("!", "선택된 신청내역이 없습니다.");
                    return;
                }


                B1Connections.diCompany.StartTransaction();

                keyValue = keyValue.Substring(0, keyValue.Length - 1);

                query = string.Format("DELETE FROM [@KIS_SO0020M_HRD] WHERE ISNULL(U_STATUS,'O') != 'C' AND Code IN ({0})", keyValue);

                FN.GetRecordsetValue(query);

                oGrid.AutoResizeColumns();


                if (B1Connections.diCompany.InTransaction)
                {
                    B1Connections.diCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
                }

                oForm.Items.Item("btnFIND").Click(BoCellClickType.ct_Regular);

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

                if (B1Connections.diCompany.InTransaction == true)
                {
                    B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
            finally
            {
                oForm.Freeze(false);
            }

        }
Exemplo n.º 10
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 || tabKeyDown)
                {
                    oForm.Freeze(true);

                    int rowidx = oGrid.GetDataTableRowIndex(pVal.Row);
                    System.Data.DataTable Dt = null;
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();

                    // 수정내용이 있으면 자동으로 체크
                    if (pVal.ItemChanged) oGrid.DataTable.SetValue("U_CHK", rowidx, "Y");

                    switch (oGrid.Columns.Item(pVal.ColUID).UniqueID)
                    {
                        case "U_READCD":
                        case "U_REQYM":
                            string U_READCD = FN.GetGridCellValue(ref oGrid, "U_READCD", pVal.Row);
                            string U_REQYM = FN.GetGridCellValue(ref oGrid, "U_REQYM", pVal.Row);

                            #region 독자코드의 청구월에 청구금액 및 청구정보를 가져온다.
                            if (!string.IsNullOrEmpty(U_READCD) && !string.IsNullOrEmpty(U_REQYM))
                            {
                                Dt = FN.GetRecordsetToDataTable(string.Format("EXEC [KIS_SP_SO0240A2_HRD] @edtREADCD = '{0}', @U_USEYM = '{1}'", U_READCD, U_REQYM));

                                if (Dt.Rows.Count == 0)
                                {
                                    FN.Trace("청구자료가 존재하지 않습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);

                                    if (tabKeyDown) B1Connections.theAppl.ActivateMenuItem("7425");
                                    tabKeyDown = false;

                                    return false;
                                }


                                oGrid.DataTable.SetValue("U_REQNM", rowidx, Dt.Rows[0]["U_REQNM"].ToString());
                                oGrid.DataTable.SetValue("U_CARDCD", rowidx, Dt.Rows[0]["U_CARDCD"].ToString());
                                oGrid.DataTable.SetValue("U_AMT", rowidx, Dt.Rows[0]["U_AMT"].ToString());
                                oGrid.DataTable.SetValue("U_MODAMT", rowidx, Dt.Rows[0]["U_MODAMT"].ToString());
                                oGrid.DataTable.SetValue("U_PMETHOD", rowidx, Dt.Rows[0]["U_PMETHOD"].ToString());
                                oGrid.DataTable.SetValue("U_CNT", rowidx, Dt.Rows[0]["U_CNT"].ToString());
                                oGrid.DataTable.SetValue("U_PAYPERD", rowidx, Dt.Rows[0]["U_PAYPERD"].ToString());
                                oGrid.DataTable.SetValue("U_PAPERTP", rowidx, Dt.Rows[0]["U_PAPERTP"].ToString());
                                oGrid.DataTable.SetValue("U_BTYPE", rowidx, Dt.Rows[0]["U_BTYPE"].ToString());
                                oGrid.DataTable.SetValue("U_BENTRY", rowidx, Dt.Rows[0]["U_BENTRY"].ToString());
                                oGrid.DataTable.SetValue("U_BLINEID", rowidx, Dt.Rows[0]["U_BLINEID"].ToString());
                            }
                            #endregion
                            #region 독자코드의 독자정보를 가져온다.
                            else if (!string.IsNullOrEmpty(U_READCD))
                            {
                                string[] rValue = new string[3];
                                rValue = FN.GetRecordsetArrayValue(string.Format("SELECT A.U_REQNAME, A.U_CARDCD, (SELECT TOP (1) F.U_PAPERTP FROM [@KIS_SO00301_HRD] F WHERE F.CODE = A.CODE) FROM [@KIS_SO0030M_HRD] A WHERE CODE = '{0}'", U_READCD));

                                if (rValue == null)
                                {
                                    FN.Trace("독자코드를 확인해 주세요", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);

                                    if (tabKeyDown) B1Connections.theAppl.ActivateMenuItem("7425");
                                    tabKeyDown = false;

                                    return false;
                                }

                                oGrid.DataTable.SetValue("U_REQNM", rowidx, (rValue == null ? "" : rValue[0]));
                                oGrid.DataTable.SetValue("U_CARDCD", rowidx, (rValue == null ? "" : rValue[1]));
                                oGrid.DataTable.SetValue("U_PAPERTP", rowidx, (rValue == null ? "" : rValue[2]));
                                oGrid.DataTable.SetValue("U_AMT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_MODAMT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_PMETHOD", rowidx, "");
                                oGrid.DataTable.SetValue("U_CNT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_PAYPERD", rowidx, "");
                                oGrid.DataTable.SetValue("U_BTYPE", rowidx, "");
                                oGrid.DataTable.SetValue("U_BENTRY", rowidx, 0);
                                oGrid.DataTable.SetValue("U_BLINEID", rowidx, 0);
                            }
                            #endregion
                            #region null
                            else
                            {
                                oGrid.DataTable.SetValue("U_REQNM", rowidx, "");
                                oGrid.DataTable.SetValue("U_CARDCD", rowidx, "");
                                oGrid.DataTable.SetValue("U_PAPERTP", rowidx, "");
                                oGrid.DataTable.SetValue("U_AMT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_MODAMT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_PMETHOD", rowidx, "");
                                oGrid.DataTable.SetValue("U_CNT", rowidx, 0);
                                oGrid.DataTable.SetValue("U_PAYPERD", rowidx, "");
                                oGrid.DataTable.SetValue("U_BTYPE", rowidx, "");
                                oGrid.DataTable.SetValue("U_BENTRY", rowidx, 0);
                                oGrid.DataTable.SetValue("U_BLINEID", rowidx, 0);

                                if (tabKeyDown) B1Connections.theAppl.ActivateMenuItem("7425");
                                tabKeyDown = false;
                            }
                            #endregion


                            break;

                        case "U_HBNKCD":
                            #region 주거래은행 정보를 가져온다.
                            string U_HBNKCD = FN.GetGridCellValue(ref oGrid, "U_HBNKCD", pVal.Row);

                            sb.Append(" SELECT A.AbsEntry                     ");
                            sb.Append("      , A.BankCode                     ");
                            sb.Append("      , (SELECT F.BankName FROM ODSC F WHERE F.CountryCod = A.Country AND F.BankCode = A.BankCode) AS BankName   ");
                            sb.Append("      , A.Account                      ");
                            sb.Append("      , A.Branch                       ");
                            sb.Append("      , A.GLAccount                    ");
                            sb.Append("  FROM DSC1 A                          ");
                            sb.AppendFormat(" WHERE A.AbsEntry = {0}", U_HBNKCD);

                            Dt = FN.GetRecordsetToDataTable(sb.ToString());

                            if (Dt.Rows.Count == 1)
                            {
                                oGrid.DataTable.SetValue("U_BANKCD", rowidx, Dt.Rows[0]["BankCode"].ToString());
                                oGrid.DataTable.SetValue("U_BANKNM", rowidx, Dt.Rows[0]["BankName"].ToString());
                                oGrid.DataTable.SetValue("U_BNKACCT", rowidx, Dt.Rows[0]["Account"].ToString());
                                oGrid.DataTable.SetValue("U_BNKHOLD", rowidx, Dt.Rows[0]["Branch"].ToString());
                                oGrid.DataTable.SetValue("U_ACCT", rowidx, Dt.Rows[0]["GLAccount"].ToString());
                            }
                            else
                            {
                                oGrid.DataTable.SetValue("U_BANKCD", rowidx, "");
                                oGrid.DataTable.SetValue("U_BANKNM", rowidx, "");
                                oGrid.DataTable.SetValue("U_BNKACCT", rowidx, "");
                                oGrid.DataTable.SetValue("U_BNKHOLD", rowidx, "");
                                oGrid.DataTable.SetValue("U_ACCT", rowidx, "");

                                if (tabKeyDown)
                                    B1Connections.theAppl.ActivateMenuItem("7425");
                                else
                                    FN.Trace("주거래은행을 확인해 주세요", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);

                                tabKeyDown = false;

                                return false;
                            }
                            #endregion
                            break;

                        case "U_CARDCD":
                            #region 거래처 정보를 가져온다.
                            string U_CARDCD = FN.GetGridCellValue(ref oGrid, "U_CARDCD", pVal.Row);

                            sb.AppendFormat(" SELECT CardCode, CardName FROM dbo.OCRD WHERE CardCode = '{0}'", U_CARDCD);

                            Dt = FN.GetRecordsetToDataTable(sb.ToString());

                            if (Dt.Rows.Count == 1)
                            {
                                //oGrid.DataTable.SetValue("U_CARDNM", rowidx, Dt.Rows[0]["CardName"].ToString());
                            }
                            else
                            {
                                //oGrid.DataTable.SetValue("U_CARDNM", rowidx, "");

                                if (!string.IsNullOrEmpty(U_CARDCD))
                                    FN.Trace("거래처를 확인해 주세요", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                else if (tabKeyDown)
                                    B1Connections.theAppl.ActivateMenuItem("7425");
                                else
                                    return true;

                                tabKeyDown = false;

                                return false;
                            }
                            #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
            {
                tabKeyDown = false;

                SetEnable(oForm);

                oForm.Freeze(false);
            }
            return true;
        }
Exemplo n.º 11
0
        public virtual void ET_CallBack_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("CallBack").Specific));

            // ADD YOUR ACTION CODE HERE ...
            try
            {
                string popupID = oButton.Caption.ToString();

                if (string.IsNullOrEmpty(popupID)) return;

                // 리턴 DataTable
                SAPbouiCOM.DataTable rDT = KIS_SO0001F_HRD.GetReturnDT(popupID, oForm.UniqueID);

                int rowIdx = KIS_SO0001F_HRD.GetSelectRowIdx(popupID, oForm.UniqueID);

                oForm.Freeze(true);
                switch (popupID)
                {
                    case "개별입금내역":
                        string KeyValue = rDT.GetValue("문서번호", 0).ToString();
                        SetFormLoadFromDBDatasource(oForm, KeyValue);
                        break;

                        
                    case "청구잔액":
                    case "과입금내역":
                        #region 주거래은행 정보 기본 셋팅
                        string U_HBNKCD = string.Empty;
                        string[] arrHBNKCD = new string[6];

                        string cboDEPMD = FN.GetItemValue(ref oForm, "cboDEPMD").Trim();

                        if (!string.IsNullOrEmpty(cboDEPMD))
                        {
                            DataRow[] dr = SO_COMMON_HRD.CommonCodeDataTable.Select(string.Format("TYPE ='U' AND Code='SO51' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'", cboDEPMD));

                            // 주거래은행 기본 셋팅
                            // 공통코드 SO51-입금방법의 참조5번 필드값을 기본 주거래은행으로 처리함.
                            if (dr.Length > 0) U_HBNKCD = dr[0]["U_RMK5"].ToString().Trim();
                        }

                        if (!string.IsNullOrEmpty(U_HBNKCD))
                        {
                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            sb.Append(" SELECT A.AbsEntry                     ");
                            sb.Append("      , A.BankCode                     ");
                            sb.Append("      , (SELECT F.BankName FROM ODSC F WHERE F.CountryCod = A.Country AND F.BankCode = A.BankCode) AS BankName   ");
                            sb.Append("      , A.Account                      ");
                            sb.Append("      , A.Branch                       ");
                            sb.Append("      , A.GLAccount                    ");
                            sb.Append("  FROM DSC1 A                          ");
                            sb.AppendFormat(" WHERE A.AbsEntry = {0}", U_HBNKCD);

                            arrHBNKCD = FN.GetRecordsetArrayValue(sb.ToString());

                        }
                        #endregion


                        int dataIdx = -1;
                        oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
                        for (int i = 0; i < rDT.Rows.Count; i++)
                        {
                            oGrid.DataTable.Rows.Add();
                            dataIdx = oGrid.GetDataTableRowIndex(oGrid.DataTable.Rows.Count - 1);


                            oGrid.DataTable.SetValue("U_CHK", dataIdx, rDT.GetValue("U_CHK", i).ToString());
                            oGrid.DataTable.SetValue("DOCENTRY", dataIdx, rDT.GetValue("DOCENTRY", i).ToString());
                            oGrid.DataTable.SetValue("LINEID", dataIdx, rDT.GetValue("LINEID", i).ToString());
                            oGrid.DataTable.SetValue("VisOrder", dataIdx, rDT.GetValue("VisOrder", i).ToString());
                            oGrid.DataTable.SetValue("U_READCD", dataIdx, rDT.GetValue("U_READCD", i).ToString());
                            oGrid.DataTable.SetValue("U_REQNM", dataIdx, rDT.GetValue("U_REQNM", i).ToString());
                            oGrid.DataTable.SetValue("U_REQYM", dataIdx, rDT.GetValue("U_REQYM", i).ToString());
                            oGrid.DataTable.SetValue("U_AMT", dataIdx, rDT.GetValue("U_AMT", i).ToString());
                            oGrid.DataTable.SetValue("U_MODAMT", dataIdx, rDT.GetValue("U_MODAMT", i).ToString());
                            oGrid.DataTable.SetValue("U_DEPDT", dataIdx, rDT.GetValue("U_DEPDT", i).ToString("yyyyMMdd"));

                            // 입금자 - 청구처이름으로 기본 설정
                            //oGrid.DataTable.SetValue("U_DEPNM", dataIdx, rDT.GetValue("U_DEPNM", i).ToString());
                            oGrid.DataTable.SetValue("U_DEPNM", dataIdx, rDT.GetValue("U_REQNM", i).ToString());

                            // 입금액 - 청구잔액으로 기본 설정
                            //oGrid.DataTable.SetValue("U_DEPAMT", dataIdx, rDT.GetValue("U_DEPAMT", i).ToString());

                            if (popupID == "과입금내역")
                                oGrid.DataTable.SetValue("U_DEPAMT", dataIdx, (decimal.Parse(rDT.GetValue("U_AMT", i).ToString()) * -1).ToString());
                            else
                                oGrid.DataTable.SetValue("U_DEPAMT", dataIdx, rDT.GetValue("U_AMT", i).ToString());


                            oGrid.DataTable.SetValue("U_CMMAMT", dataIdx, rDT.GetValue("U_CMMAMT", i).ToString());
                            //oGrid.DataTable.SetValue("U_CREDTBP", dataIdx, rDT.GetValue("U_CREDTBP", i).ToString());
                            //oGrid.DataTable.SetValue("U_CREDTNO", dataIdx, rDT.GetValue("U_CREDTNO", i).ToString());
                            //oGrid.DataTable.SetValue("U_VALIDMY", dataIdx, rDT.GetValue("U_VALIDMY", i).ToString());
                            //oGrid.DataTable.SetValue("U_CREDTNM", dataIdx, rDT.GetValue("U_CREDTNM", i).ToString());
                            //oGrid.DataTable.SetValue("U_JMNO", dataIdx, rDT.GetValue("U_JMNO", i).ToString());
                            oGrid.DataTable.SetValue("U_PMETHOD", dataIdx, rDT.GetValue("U_PMETHOD", i).ToString());
                            oGrid.DataTable.SetValue("U_CNT", dataIdx, rDT.GetValue("U_CNT", i).ToString());
                            oGrid.DataTable.SetValue("U_PAYPERD", dataIdx, rDT.GetValue("U_PAYPERD", i).ToString());
                            oGrid.DataTable.SetValue("U_PAPERTP", dataIdx, rDT.GetValue("U_PAPERTP", i).ToString());
                            oGrid.DataTable.SetValue("U_BTYPE", dataIdx, rDT.GetValue("U_BTYPE", i).ToString());
                            oGrid.DataTable.SetValue("U_BENTRY", dataIdx, rDT.GetValue("U_BENTRY", i).ToString());
                            oGrid.DataTable.SetValue("U_BLINEID", dataIdx, rDT.GetValue("U_BLINEID", i).ToString());
                            oGrid.DataTable.SetValue("U_CARDCD", dataIdx, rDT.GetValue("U_CARDCD", i).ToString());


                            if (arrHBNKCD[0] == null) continue;

                            oGrid.DataTable.SetValue("U_HBNKCD", dataIdx, U_HBNKCD);
                            oGrid.DataTable.SetValue("U_BANKCD", dataIdx, arrHBNKCD[1]);
                            oGrid.DataTable.SetValue("U_BANKNM", dataIdx, arrHBNKCD[2]);
                            oGrid.DataTable.SetValue("U_BNKHOLD", dataIdx, arrHBNKCD[4]);
                            oGrid.DataTable.SetValue("U_BNKACCT", dataIdx, arrHBNKCD[3]);
                            oGrid.DataTable.SetValue("U_ACCT", dataIdx, arrHBNKCD[5]);

                        }

                        oGrid.Rows.SelectedRows.Clear();
                        oGrid.Rows.SelectedRows.Add(oGrid.DataTable.Rows.Count - 1);
                        //oGrid.SetCellFocus(oGrid.DataTable.Rows.Count - 1, GetColNumByColUID(oGrid, "U_DEPDT"));

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

                        break;



                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
            
        }
Exemplo n.º 12
0
        public virtual void ET_grd2_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd2").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {

                if (pVal.Row != -1)
                {
                    //int rowidx = oGrid.GetDataTableRowIndex(pVal.Row);
                    switch (oGrid.Columns.Item(pVal.ColUID).UniqueID)
                    {
                        case "U_USEYN":
                            SelectedRows selectedRows = oGrid.Rows.SelectedRows;

                            for (int i = 0; i < selectedRows.Count; i++)
                            {
                                int gridRowidx = selectedRows.Item(i, BoOrderType.ot_RowOrder);
                                int dataRowidx = oGrid.GetDataTableRowIndex(gridRowidx);

                                UpdateRowType(oGrid, "ROWTYPE", gridRowidx);

                            }
                            break;

                        default:
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                //throw ex;
            }
            finally
            {
                oForm.Freeze(false);
            }

        }
Exemplo n.º 13
0
        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 ...
            oForm.Freeze(true);
            try
            {
                if (pVal.ColUID == "U_CHK")
                {
                    if (oGrid.Item.Enabled)
                    {
                        if (pVal.Row >= 0)
                        {
                            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");
                            }
                            else
                            {
                                oGrid.DataTable.SetValue("U_CHK", iRowIndex, "N");
                            }

                            ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("U_APPLAMT")).ColumnSetting.SumValue = GetGridCalc_SumValue("U_APPLAMT").ToString();
                        }
                    }
                    return false;
                }

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
            }
            return true;
        }
Exemplo n.º 14
0
        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.Row >= 0)
                {
                    int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

                    if (oGrid.Rows.IsSelected(pVal.Row) == false)
                    {
                        oGrid.Rows.SelectedRows.Add(pVal.Row);
                    }
                }
            }
            catch (Exception)
            {
                
                throw;
            }
            return true;
        }
Exemplo n.º 15
0
        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 (oForm.Mode == BoFormMode.fm_ADD_MODE)
                {
                    if (pVal.ColUID == "U_CHK")
                    {
                        #region U_CHK 클릭시 기능 구현
                        if (pVal.Row >= 0)
                        {
                            oForm.Freeze(true);
                            try
                            {
                                #region 문서단위 그룹선택 기능구현
                                int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

                                string DocEntry = oGrid.DataTable.GetValue("DOCENTRY", iRowIndex).ToString().Trim();
                                string Next_DocEntry = DocEntry;

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

                                while (DocEntry == oGrid.DataTable.GetValue("ID", iRowIndex).ToString().Trim() && string.IsNullOrEmpty(DocEntry) == false)
                                {
                                    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);
                                        }
                                    }

                                    if (oGrid.DataTable.Rows.Count - 1 > iRowIndex)
                                    {
                                        iRowIndex++;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }//end while

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

                        }
                        else
                        {
                            //전체선택
                            SetGridColumn_CheckBox_SelectAll(ref oGrid, "U_CHK");
                            
                            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;
        }
Exemplo n.º 16
0
        public virtual bool ET_grd_BFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                if (pVal.Row >= 0)
                {
                    if (pVal.ColUID != "RowsHeader")
                    {
                        #region 그리드 행 선택기능 구현 (RowsHeader)

                        if (oGrid.Rows.IsSelected(pVal.Row) != true)
                        {
                            oGrid.Rows.SelectedRows.Clear();
                            oGrid.Rows.SelectedRows.Add(pVal.Row);
                        }

                        #endregion

                        oForm.Freeze(true);

                        //전기 버튼이 활성화 일때는 미결인 문서를 조회했을때이다. 
                        //미결인 문서가 있을때만 전체 선택기능을 작동시킨다.

                        if (pVal.ColUID == "CHECKED" && oForm.Items.Item("btnTR").Enabled)
                        {
                            #region 문서단위 그룹선택 기능구현
                            int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

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

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

                            if ("미결" == STATUS)
                            {
                                if ((CHECKED == "N") || (CHECKED == ""))
                                {
                                    oGrid.DataTable.SetValue("CHECKED", iRowIndex, "Y");
                                }
                                else
                                {
                                    oGrid.DataTable.SetValue("CHECKED", iRowIndex, "N");
                                }
                            }
                            #endregion
                        }
                        oForm.Freeze(false);
                    }

                }
                else
                {
                    if (pVal.ColUID == "CHECKED")
                    {
                        //전기 버튼이 활성화 일때는 미결인 문서를 조회했을때이다. 
                        //미결인 문서가 있을때만 전체 선택기능을 작동시킨다.
                        if (oForm.Items.Item("btnTR").Enabled)
                        {
                            SetGridColumn_CheckBox_SelectAll(ref oGrid, "CHECKED");
                        }

                    }
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return false;
        }
Exemplo n.º 17
0
        public virtual void ET_btnCONF_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnCONF").Specific));
            
            // ADD YOUR ACTION CODE HERE ...
            #region 선택된 행을 부모창으로 복사한 후 팝업창을 닫음

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

            if (FN.GetFormExistsChk(oForm.DataSources.UserDataSources.Item("pFormUID").Value.ToString()))
            {
                pForm = B1Connections.theAppl.Forms.Item(oForm.DataSources.UserDataSources.Item("pFormUID").Value.ToString());

                SAPbouiCOM.DataTable oDT = oForm.DataSources.DataTables.Item("sboReturnDt");

                XmlDocument XmlDoc = new XmlDocument();
                XmlDoc.LoadXml(oGrid.DataTable.SerializeAsXML(BoDataTableXmlSelect.dxs_MetaData));

                oDT.LoadSerializedXML(BoDataTableXmlSelect.dxs_MetaData, XmlDoc.InnerXml);

                if (oGrid.Rows.Count > 0)
                {
                    if (oForm.DataSources.UserDataSources.Item("pConfTp").ValueEx == SO.SO_COMMON_HRD.ConfirmType.Close.ToString())
                        oForm.Visible = false;

                    SelectedRows selectedRows = oGrid.Rows.SelectedRows;

                    for (int i = 0; i < selectedRows.Count; i++)
                    {
                        int gridRowIdx = selectedRows.Item(i, BoOrderType.ot_RowOrder);
                        int dataRowIdx = oGrid.GetDataTableRowIndex(gridRowIdx);

                        CopyRowDT(ref oDT, oGrid.DataTable, dataRowIdx);
                    }

                }

                if (oDT.Rows.Count == 0)//if (oDT == null)
                {
                    B1Connections.theAppl.StatusBar.SetText(string.Format("{0}", "선택한 자료가 없습니다."), SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    CallBackEvent();

                    if (oForm.DataSources.UserDataSources.Item("pConfTp").ValueEx == SO.SO_COMMON_HRD.ConfirmType.Close.ToString())
                        FN.ItemClick(ref oForm, "2");
                }
            }
            else
            {
                // 팝업창이 닫힐 때 부모창이 없는 경우 알림을 원하는 경우 주석을 푼다
                B1Connections.theAppl.MessageBox("부모창이 존재하지 않습니다. 화면을 종료합니다.");

                if (oForm.DataSources.UserDataSources.Item("pConfTp").ValueEx == SO.SO_COMMON_HRD.ConfirmType.Close.ToString())
                    FN.ItemClick(ref oForm, "2");
            }
            #endregion
            
        }
Exemplo n.º 18
0
        /// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                        Dispose();
                        application    = null;
                        company        = null;
                        _oPrecontratos = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }
                }

                if (pVal.FormUID == formID && pVal.BeforeAction == true)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTNBUSCAR)
                        {
                            BuscarDatos();
                            ContadorSeleccionados = 0;
                        }

                        if (pVal.ItemUID == BTNCOLLAP)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    _oGridPrecontratos.Rows.CollapseAll();
                                }
                            }
                        }

                        if (pVal.ItemUID == BTNEXPAN)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    _oGridPrecontratos.Rows.ExpandAll();
                                }
                            }
                        }

                        if (pVal.ItemUID == BTNCREAR)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    if (ContadorSeleccionados != 0)
                                    {
                                        CrearPreContratos();
                                        _oForma.Close();
                                        bubbleEvent = false;
                                    }
                                    else
                                    {
                                        _Application.MessageBox("No se ha seleccionado ningún Pre-contrato");
                                    }
                                }
                            }
                        }

                        if (pVal.ItemUID == BTN_SELECCION_AUTOMATICA)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    SelecionAutomatica();
                                }
                            }
                        }
                    }

                    if (pVal.ItemUID == GRDPRECONTRATO && pVal.ColUID == "RowsHeader" && pVal.EventType == BoEventTypes.et_DOUBLE_CLICK)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == GRDPRECONTRATO && pVal.ColUID == "Crear")
                    {
                        int index = 0;
                        index = _oGridPrecontratos.GetDataTableRowIndex(pVal.Row);
                        _oGridPrecontratos = _oForma.Items.Item(GRDPRECONTRATO).Specific;
                        EstatusCrear       = _oGridPrecontratos.DataTable.GetValue("Crear", index).ToString();

                        if (EstatusCrear == "Y")
                        {
                            ContadorSeleccionados += 1;
                        }
                        else
                        {
                            ContadorSeleccionados -= 1;
                        }

                        if (ContadorSeleccionados > 10)
                        {
                            _oGridPrecontratos.DataTable.SetValue("Crear", index, "N");
                            _Application.MessageBox("Solo se pueden seleccionar hasta 10 Pre-contratos");
                            ContadorSeleccionados -= 1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsPreContratos* : " + ex.Message);
            }
        }
Exemplo n.º 19
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;
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 그리드 행을 선택하고, 선택된 행 정보를 데이터를 DBDataSource와 연결된 아이템에 불러옵니다.
        /// </summary>
        /// <param name="pVal"></param>
        private void Veiw_Grid_SelectedRow(SAPbouiCOM.Form oForm, int oRow)
        {
            try
            {
                oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));

                oGrid.Rows.SelectedRows.Add(oRow);

                if (oGrid.GetDataTableRowIndex(oRow) >= 0)
                {
                    string edtCode = oGrid.DataTable.Columns.Item("Code").Cells.Item(oGrid.GetDataTableRowIndex(oRow)).Value.ToString();
                    SetFormLoadFromDBDatasource(oForm, edtCode);
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                //oForm.Items.Item("edtFORCUS").Click();
            }
        }
Exemplo n.º 21
0
        public virtual bool ET_grd1_BFMatrixLinkPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                int oRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                string KeyValue = string.Empty;

                switch (pVal.ColUID)
                {
                    case "DOCENTRY":
                        KeyValue = oGrid.DataTable.GetValue("DOCENTRY", oRowIndex).ToString();
                        LoadSubForm(oForm, "KIS_SD0050_HRD", KeyValue);
                        break;
                    case "U_CARDNM":
                        KeyValue = oGrid.DataTable.GetValue("U_CARDCD", oRowIndex).ToString();
                        B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_BusinessPartner, "", KeyValue);
                        break;
                    case "U_BPNM":
                        KeyValue = oGrid.DataTable.GetValue("U_BPCD", oRowIndex).ToString();
                        B1Connections.theAppl.OpenForm(BoFormObjectEnum.fo_BusinessPartner, "", KeyValue);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return false;
        }
Exemplo n.º 22
0
        public virtual bool ET_grd_BFMatrixLinkPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                int oRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                string KeyValue = string.Empty;

                switch (pVal.ColUID)
                {
                    case "U_RDCD":
                        SO.SO_COMMON_HRD.KeyValue = FN.GetGridCellValue(ref oGrid, "U_RDCD", pVal.Row);
                        B1Connections.theAppl.ActivateMenuItem("KIS_SO0030A_HRD");
                        break;
                    case "U_BRCCD":
                        SO.SO_COMMON_HRD.KeyValue = FN.GetGridCellValue(ref oGrid, "U_BRCCD", pVal.Row);
                        B1Connections.theAppl.ActivateMenuItem("KIS_SO0040A_HRD");
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return false;
        }
Exemplo n.º 23
0
        public virtual void ET_grd1_AFChooseFromList(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd1").Specific));
            // ADD YOUR ACTION CODE HERE ...

            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.DataTable oDataTable = oCFLEvento.SelectedObjects;

            try
            {
                if (oDataTable != null)
                {
                    SAPbouiCOM.ChooseFromList oCFL = oForm.ChooseFromLists.Item(oCFLEvento.ChooseFromListUID); ;

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

                    switch (pVal.ColUID)
                    {
                        case "U_SHORTNM":
                            int U_ACCTCD_INDEX = FN.GetColumnIndex(oGrid, "U_ACCTCD") + 1;

                            if (oCFL.ObjectType == ((int)BoObjectTypes.oBusinessPartners).ToString())
                            {
                                oGrid.DataTable.SetValue(pVal.ColUID, iRowindex, oDataTable.GetValue("CardCode", 0));
                                oGrid.DataTable.SetValue("U_ACCTCD", iRowindex, oDataTable.GetValue("DebPayAcct", 0));

                                if (oGrid.CommonSetting.GetCellEditable(pVal.Row+1, U_ACCTCD_INDEX)==false)
                                {
                                    oGrid.CommonSetting.SetCellEditable(pVal.Row+1, U_ACCTCD_INDEX, true);
                                }

                                //#region GL계정 ChooseFromList 설정
                                //SAPbouiCOM.EditTextColumn oColumn = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("U_SHORTNM");
                                //oColumn.ChooseFromListUID = "grd1.U_SHORTNM";
                                //oColumn.ChooseFromListAlias = "AcctCode";
                                //#endregion
                            }
                            else
                            {
                                oGrid.DataTable.SetValue(pVal.ColUID, iRowindex, oDataTable.GetValue("AcctCode", 0));
                                oGrid.DataTable.SetValue("U_ACCTCD", iRowindex, oDataTable.GetValue("AcctCode", 0));

                                if (oGrid.CommonSetting.GetCellEditable(pVal.Row + 1, U_ACCTCD_INDEX))
                                {
                                    oGrid.CommonSetting.SetCellEditable(pVal.Row + 1, U_ACCTCD_INDEX, false);
                                }
                            }
                            break;

                        case"U_ACCTCD":
                            oGrid.DataTable.SetValue(pVal.ColUID, iRowindex, oDataTable.GetValue("AcctCode", 0));
                            break;

                        case "U_PRCCD":
                            oGrid.DataTable.SetValue(pVal.ColUID, iRowindex, oDataTable.GetValue("PrcCode", 0));
                            break;

                        default:
                            break;
                    }

                    if (oGrid.Rows.IsSelected(pVal.Row) == false)
                    {
                        string U_CHK = oGrid.DataTable.GetValue("U_CHK",iRowindex);
                        if (U_CHK == "N")
                        {
                            oGrid.DataTable.SetValue("U_CHK", iRowindex, "Y");
                            if (oGrid.Rows.IsSelected(pVal.Row) == false)
                            {
                                oGrid.Rows.SelectedRows.Add(pVal.Row);
                            }
                        }
                    }


                    oCFL = null;

                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oCFLEvento = null;
                oDataTable = null;
            }
        }
Exemplo n.º 24
0
        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.Row >= 0)
                {
                    if (pVal.ColUID != "RowsHeader")
                    {
                        #region 그리드 행 선택기능 구현 (RowsHeader)
                        //SAPbouiCOM.GridColumn oColumn = oGrid.Columns.Item("RowsHeader");

                        //int Mask = (int)Enum.Parse(typeof(BoModifiersEnum), pVal.Modifiers.ToString());

                        //oColumn.Click(pVal.Row, false, Mask); 
                        if (oGrid.Rows.IsSelected(pVal.Row) != true)
                        {
                            oGrid.Rows.SelectedRows.Clear();
                            oGrid.Rows.SelectedRows.Add(pVal.Row);
                        }

                        #endregion
                    }

                    oForm.Freeze(true);

                    //전기 버튼이 활성화 일때는 미결인 문서를 조회했을때이다. 
                    //미결인 문서가 있을때만 전체 선택기능을 작동시킨다.

                    if (pVal.ColUID == "U_CHK" && oForm.Items.Item("btnTRANS").Enabled)
                    {
                        #region 문서단위 그룹선택 기능구현
                        int iRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);

                        string DocEntry = oGrid.DataTable.GetValue("DOCENTRY", iRowIndex).ToString().Trim();
                        string Next_DocEntry = DocEntry;

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

                        //SetGridColumn_CheckBox_SelectAll(ref oGrid, "U_CHK", DocEntry); <- 사용시 화면이 재조회 된다...ㅠㅠ 속도도 비슷하다.

                        while (DocEntry == oGrid.DataTable.GetValue("ID", iRowIndex).ToString().Trim() && string.IsNullOrEmpty(DocEntry) == false)
                        {
                            if (U_CHK == "N")
                            {
                                oGrid.DataTable.SetValue("U_CHK", iRowIndex, "Y");
                            }
                            else
                            {
                                oGrid.DataTable.SetValue("U_CHK", iRowIndex, "N");
                            }

                            if (oGrid.DataTable.Rows.Count - 1 > iRowIndex)
                            {
                                iRowIndex++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        #endregion
                    }
                    oForm.Freeze(false);
                }
                else
                {
                    if (pVal.ColUID == "U_CHK")
                    {
                        //전기 버튼이 활성화 일때는 미결인 문서를 조회했을때이다. 
                        //미결인 문서가 있을때만 전체 선택기능을 작동시킨다.
                        if (oForm.Items.Item("btnTRANS").Enabled)
                        {
                            SetGridColumn_CheckBox_SelectAll(ref oGrid, "U_CHK");
                        }
                        
                    }
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return false;
        }
Exemplo n.º 25
0
        public virtual bool ET_grd_BFMatrixLinkPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                if (pVal.ColUID == "Code")
                {
                    int oRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                    string Code = oGrid.DataTable.GetValue("Code", oRowIndex).ToString();

                    SO.SO_COMMON_HRD.KeyValue = Code;// FN.GetGridCellValue(ref oGrid, "READCD", pVal.Row);
                    B1Connections.theAppl.ActivateMenuItem("KIS_SO0030A_HRD");
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return false;
        }
Exemplo n.º 26
0
        public virtual void ET_grd_AFComboSelect(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...

            try
            {

                oForm.Freeze(true);
                if (pVal.Row > -1)
                {
                    oGrid.Rows.SelectedRows.Add(pVal.Row);
                }

                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));
                oGrid.DataTable.SetValue("ROWSTAT", idx, "U");

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

            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Exemplo n.º 27
0
        public virtual bool ET_grd_BFMatrixLinkPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                int oRowIndex = oGrid.GetDataTableRowIndex(pVal.Row);
                string KeyValue = string.Empty;

                switch (pVal.ColUID)
                {
                    case "DocEntry":
                        KeyValue = FN.GetGridCellValue(ref oGrid, "DocEntry", pVal.Row);
                        LoadSubForm(oForm, "KIS_SD0080_HRD", KeyValue);
                        return false;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return true;
        }
Exemplo n.º 28
0
        private bool CancelData(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = true;
            StringBuilder sb = new StringBuilder();

            string strValue = string.Empty;
            string strDocEntry = string.Empty;

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

                oGrid = oForm.Items.Item("grd").Specific;
                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));

                strDocEntry = FN.GetGridCellValue(ref oGrid, "DocEntry", idx);

                // 청구상세라인 삭제
                sb.AppendLine("  DELETE A                                                                                         ");
                sb.AppendLine("    FROM [@KIS_SO01404_HRD] AS A INNER JOIN [@KIS_SO0140T_HRD] AS B ON A.DocEntry = B.DocEntry     ");
                sb.AppendLine("   WHERE B.DocEntry = {0}                                                                          ");

                sb.AppendLine("  DELETE A                                                                                         ");
                sb.AppendLine("    FROM [@KIS_SO01401_HRD] AS A INNER JOIN [@KIS_SO0140T_HRD] AS B ON A.DocEntry = B.DocEntry     ");
                sb.AppendLine("   WHERE B.DocEntry = {0}                                                                          ");
                // 청구헤더 삭제
                sb.AppendLine("  DELETE [@KIS_SO0140T_HRD]                                                                        ");
                sb.AppendLine("   WHERE DocEntry = {0}                                                                            ");


                oRS.DoQuery(string.Format(sb.ToString(), strDocEntry));
                B1Connections.theAppl.StatusBar.SetText("실행취소가 완료 되었습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
            }
            catch (Exception)
            {
                rtnValue = false;
                throw;
            }
            finally
            {
                oGrid = null;
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
            return rtnValue;
        }
Exemplo n.º 29
0
        private bool CancelData(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = true;
            StringBuilder sb = new StringBuilder();

            string strValue = string.Empty;
            string pDocEntry = string.Empty;

            SAPbobsCOM.Recordset oRS = null;

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

                oGrid = oForm.Items.Item("grd").Specific;
                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));

                pDocEntry = FN.GetGridCellValue(ref oGrid, "DocEntry", idx);

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

                sb.AppendLine(" EXEC KIS_SP_SO0390B_HRD ");
                sb.AppendFormat("      @pDocEntry = '{0}' "     , pDocEntry);
                sb.AppendFormat("    , @pWorkGubun = '{0}' "    , "D");

                oRS.DoQuery(sb.ToString());
                B1Connections.theAppl.StatusBar.SetText("CMS 출금이체신청 내역 삭제를 완료 하였습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);

            }
            catch (Exception ex)
            {
                rtnValue = false;
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oGrid = null;
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
            return rtnValue;
        }
Exemplo n.º 30
0
        /// <summary>
        /// CMS신청 취소 실행 전 실행 가능여부 체크
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool BeforeCancel_ValidationCheck(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;

            string pDocEntry = string.Empty;
            try
            {
                oGrid = oForm.Items.Item("grd").Specific;

                if (oGrid.Rows.SelectedRows.Count == 0)
                    return rtnValue;

                int idx = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_SelectionOrder));
                pDocEntry = FN.GetGridCellValue(ref oGrid, "DocEntry", idx);

                if (string.IsNullOrEmpty(pDocEntry))
                {
                    B1Connections.theAppl.StatusBar.SetText("선택한 자료가 존재하지 않습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    rtnValue = false;
                }
                else
                    rtnValue = true;

            }
            catch (Exception)
            {
                throw;
            }

            return rtnValue;

        }
Exemplo n.º 31
-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;
        }