Ejemplo n.º 1
0
        public IList <AccountDTO> GetBankAccounts(string pStrBankCode)
        {
            SAPbobsCOM.Recordset lObjResults  = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            IList <AccountDTO>   lLstObjBanks = new List <AccountDTO>();

            try
            {
                string lStrQuery = this.GetSQL("GetBankAccounts").InjectSingleValue("BankCode", pStrBankCode);
                lObjResults.DoQuery(lStrQuery);
                if (lObjResults.RecordCount > 0)
                {
                    for (int i = 0; i < lObjResults.RecordCount; i++)
                    {
                        AccountDTO lObjAccount = new AccountDTO();
                        lObjAccount.BankCode  = lObjResults.GetColumnValue <string>("BankCode");
                        lObjAccount.Account   = lObjResults.GetColumnValue <string>("Account");
                        lObjAccount.Branch    = lObjResults.GetColumnValue <string>("Branch");
                        lObjAccount.GLAccount = lObjResults.GetColumnValue <string>("GLAccount");
                        lLstObjBanks.Add(lObjAccount);
                        lObjResults.MoveNext();
                    }
                }
                return(lLstObjBanks);
            }
            catch (Exception e)
            {
                LogService.WriteError("GetBankAccounts (GetFilterssVouchers): " + e.Message);
                LogService.WriteError(e);
                return(lLstObjBanks);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjResults);
            }
        }
Ejemplo n.º 2
0
        public int getSeries(string pStrUserID, string pStrObjectCode)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            int lStrSeries = 0;

            try
            {
                //ReceptionTransferDAO mObjTicketDAO = new ReceptionTransferDAO();
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("UserID", pStrUserID);
                lLstStrParameters.Add("ObjCode", pStrObjectCode);
                string lStrQuery = this.GetSQL("GetSeries").Inject(lLstStrParameters);
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrSeries = Convert.ToInt32(lObjRecordset.Fields.Item(0).Value.ToString());
                }
            }
            catch
            {
                // UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(lStrSeries);
        }
Ejemplo n.º 3
0
        public List <string> GetALLRequest()
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;

            string        lStrQuery   = "";
            List <string> lLstRequest = new List <string>();

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = "select U_RequestId from [dbo].[@UG_PE_WS_PERE] ";
                lObjRecordSet.DoQuery(lStrQuery);

                if (lObjRecordSet.RecordCount > 0)
                {
                    for (int i = 0; i < lObjRecordSet.RecordCount; i++)
                    {
                        lLstRequest.Add(lObjRecordSet.Fields.Item("U_RequestId").Value.ToString());
                        lObjRecordSet.MoveNext();
                    }
                }
                return(lLstRequest);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 4
0
        public int GetExportFormat()
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            try
            {
                string lStrQuery = string.Format(@"select ParamValue from ECM1 where ParamName in ('MappingDOC')");

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    return(Convert.ToInt32(lObjRecordset.Fields.Item(0).Value));
                }
            }
            catch
            {
                //Ignore
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(0);
        }
        public int GetSysCatID()
        {
            int functionReturnValue = 0;

            functionReturnValue = -3;
            SAPbobsCOM.Recordset oRS = (Recordset)SBOApp.Company.GetBusinessObject(BoObjectTypes.BoRecordset);

            try
            {
                SBOApp.TranslateToHana("SELECT TOP 1 CATEGORYID FROM OQCN WHERE CATNAME = 'Geral'");
                oRS.DoQuery("SELECT TOP 1 CATEGORYID FROM OQCN WHERE CATNAME = 'Geral'");
                if (oRS.RecordCount > 0)
                {
                    functionReturnValue = Convert.ToInt32(oRS.Fields.Item(0).Value);
                }
            }
            catch
            {
                throw new Exception(String.Format("Erro: {0}", SBOApp.Company.GetLastErrorDescription()));
            }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
                oRS = null;
                GC.Collect();
            }
            return(functionReturnValue);
        }
Ejemplo n.º 6
0
        public double GetDocTotal(string pStrCardCode, string pStrNumAtCard)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            try
            {
                string lStrQuery = string.Format(@"
    SELECT DocTotal FROM OINV WHERE NumAtCard = '{0}'  AND CardCode = '{1}'", pStrNumAtCard, pStrCardCode);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    return(Convert.ToDouble(lObjRecordset.Fields.Item(0).Value));
                }
            }
            catch
            {
                //Ignore
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(0);
        }
Ejemplo n.º 7
0
        public string GetValue(string pStrSelectFieldName, string pStrWhereFieldName, string pStrWhereFieldValue, string pStrTableName)
        {
            SAPbobsCOM.Recordset        lObjRecordSet     = null;
            Dictionary <string, string> lLstStrParameters = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("SelectFieldName", pStrSelectFieldName);
                lLstStrParameters.Add("WhereFieldName", pStrWhereFieldName);
                lLstStrParameters.Add("WhereFieldValue", pStrWhereFieldValue);
                lLstStrParameters.Add("TableName", pStrTableName);

                lStrQuery = this.GetSQL("GetValueTemplate").Inject(lLstStrParameters);
                lObjRecordSet.DoQuery(lStrQuery);

                if (lObjRecordSet.RecordCount > 0)
                {
                    return(lObjRecordSet.Fields.Item(pStrSelectFieldName).Value.ToString());
                }

                return(string.Empty);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 8
0
        public DateTime GetLastBatchDateByLocation(string pStrFieldName, string pStrTableName, string pStrlocation)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lStrQuery = string.Format(@"
                SELECT MAX({0}) AS Max
                  FROM {1}
                  INNER JOIN [@UG_SU_AUTN] T1 on t0.U_AuctionId = t1.U_Id 
                  where T1.U_Location = '{2}'"
                                          , pStrFieldName, pStrTableName, pStrlocation);

                lObjRecordSet.DoQuery(lStrQuery);


                return(lObjRecordSet.Fields.Item("Max").Value != null?Convert.ToDateTime(lObjRecordSet.Fields.Item("Max").Value) : DateTime.MinValue);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 9
0
        public long GetAuctionId(string pStrAuctionFolio)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = string.Format(@"
                                  SELECT U_Id FROM [@UG_SU_AUTN]
                                    WHERE U_Folio = '{0}'
                                            ", pStrAuctionFolio);

                lObjRecordSet.DoQuery(lStrQuery);

                return(Convert.ToInt64(lObjRecordSet.Fields.Item("U_Id").Value));
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 10
0
        public bool BatchExists(string pStrAuctFolio, int pIntNumber)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lStrQuery = string.Format(@"
                SELECT T0.U_Id
                  FROM [@UG_SU_BAHS] T0
                  INNER JOIN [@UG_SU_AUTN] T1 on t0.U_AuctionId = t1.U_Id 

                  where t1.U_Folio = '{0}' and t0.U_Number = {1}"
                                          , pStrAuctFolio, pIntNumber.ToString());

                lObjRecordSet.DoQuery(lStrQuery);

                return(lObjRecordSet.RecordCount > 0 ? true : false);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 11
0
        public long GetBatchId(int pIntBatchNumber, string pStrAuctionFolio)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = string.Format(@"
                                SELECT T0.U_Id
                                  FROM [@UG_SU_BAHS] T0
                                  INNER JOIN [@UG_SU_AUTN] T1 on t0.U_AuctionId = t1.U_Id 

                                  where t1.U_Folio = '{0}' and t0.U_Number = {1}
                                            ", pStrAuctionFolio, pIntBatchNumber.ToString());

                lObjRecordSet.DoQuery(lStrQuery);

                return(Convert.ToInt64(lObjRecordSet.Fields.Item("U_Id").Value));
            }
            catch (Exception lObjException)
            {
                return(0);

                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 12
0
        public double GetThreePercentPrice(string pStrItemCode, string pStrLocation)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = string.Format(@"
                                            select T0.Price from ITM1 T0
                                            inner join OPLN T1 on T1.ListNum = T0.PriceList
                                            where U_GLO_Location = '{0}' and t0.ItemCode = '{1}'
                                      ", pStrLocation, pStrItemCode);

                lObjRecordSet.DoQuery(lStrQuery);

                return(Convert.ToDouble(lObjRecordSet.Fields.Item("Price").Value));
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 13
0
        public int GetTransId(string pStrAuctionFolio)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = string.Format(@"select TransId from ojdt where ref1 = '{0}' and  Memo like '%Cierre de subasta%'", pStrAuctionFolio);

                lObjRecordSet.DoQuery(lStrQuery);

                return((int)lObjRecordSet.Fields.Item("TransId").Value);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 14
0
        public bool Exists(string pStrWhereFieldName, string pStrWhereFieldValue, string pStrTableName)
        {
            SAPbobsCOM.Recordset        lObjRecordSet     = null;
            Dictionary <string, string> lLstStrParameters = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("WhereFieldName", pStrWhereFieldName);
                lLstStrParameters.Add("WhereFieldValue", pStrWhereFieldValue);
                lLstStrParameters.Add("TableName", pStrTableName);

                lStrQuery = this.GetSQL("ExistsTemplate").Inject(lLstStrParameters);
                lObjRecordSet.DoQuery(lStrQuery);

                return(lObjRecordSet.RecordCount > 0 ? true : false);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 15
0
        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>();
            }
            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
Ejemplo n.º 16
0
        public string GetWareHouse(string pStrUserID)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            string lStrWareHouse = "";

            try
            {
                TicketDAO mObjTicketDAO = new TicketDAO();
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("UserID", pStrUserID);
                string lStrQuery = this.GetSQL("GetWarehouse").Inject(lLstStrParameters);
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrWareHouse = lObjRecordset.Fields.Item(0).Value.ToString();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(string.Format("[GetWareHouse]: {0} ", ex.Message));
                LogService.WriteError(ex);
                UIApplication.ShowError(string.Format("[GetWareHouse]: {0}", ex.Message));
                // UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lStrWareHouse);
        }
Ejemplo n.º 17
0
        public string GetTaxCodeByArticle(string pStrArticle)
        {
            SAPbobsCOM.Recordset        lObjRecordSet     = null;
            Dictionary <string, string> lLstStrParameters = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lStrQuery = string.Format(@"SELECT LnTaxCode FROM OTCX WHERE StrVal1 ='{0}'", pStrArticle);

                lObjRecordSet.DoQuery(lStrQuery);

                return((string)lObjRecordSet.Fields.Item("LnTaxCode").Value);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 18
0
        public static string AddData(SAPbobsCOM.Company oCompany, EXR model)
        {
            RTNMANVAL rtn = new RTNMANVAL();
            int       errCode; string errMessage, strResult = "";

            SAPbobsCOM.SBObob    oSBob = null;
            SAPbobsCOM.Recordset rs    = null;
            try
            {
                oCompany.StartTransaction();

                oSBob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge);
                rs    = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                rs    = oSBob.GetLocalCurrency();
                rs    = oSBob.GetSystemCurrency();

                oSBob.SetCurrencyRate(model.Currency, model.DateRate, model.Rate, true);
                oCompany.EndTransaction(BoWfTransOpt.wf_Commit);

                strResult = "OK";
            }
            catch (Exception e)
            {
                if (oCompany.InTransaction)
                {
                    oCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                ;
                throw;
            }
            return(strResult);
        }
Ejemplo n.º 19
0
        public bool ExistsSaleOrder(string pStrRequestId)
        {
            SAPbobsCOM.Recordset        lObjRecordSet     = null;
            Dictionary <string, string> lLstStrParameters = null;
            bool   lBolResult = false;
            string lStrQuery  = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("RequestId", pStrRequestId);

                lStrQuery = this.GetSQL("CountSaleOrderByRequestId").Inject(lLstStrParameters);
                lObjRecordSet.DoQuery(lStrQuery);

                if (lObjRecordSet.RecordCount > 0)
                {
                    lBolResult = int.Parse(lObjRecordSet.Fields.Item(0).Value.ToString()) > 0;
                }
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }

            return(lBolResult);
        }
Ejemplo n.º 20
0
        public string GetPrice(string pStrWhsCode, string pStrItemCode)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            string lStrPrice = "";

            try
            {
                string lStrQuery = GetItemPrice(pStrWhsCode, pStrItemCode);
                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrPrice = lObjRecordset.Fields.Item(1).Value.ToString();
                }
            }
            catch
            {
                //Ignore
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lStrPrice);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Get Data Source From Configration Table [TableName = @OCFL]
        /// If eventType is not provided, this function will assume as "Tab" event.
        /// </summary>
        /// <param name="formId"></param>
        /// <param name="itemId"></param>
        /// <param name="colId"></param>
        /// <param name="eventType"></param>
        /// <returns></returns>
        public static Recordset GetConfiguration(string formId, string itemId, string colId, int eventType)
        {
            SAPbobsCOM.Recordset oRecordSet = null;
            string documentType             = String.Empty;

            try
            {
                colId = (colId == "" ? "0" : colId); //If colUID is "0", the event return as "".
                if (itemId == "38")                  // Item
                {
                    documentType = "1";
                }
                else if (itemId == "39") // Service
                {
                    documentType = "2";
                }
                else
                {
                    documentType = "3";
                }
                if (formId.Contains("UDO"))
                {
                    formId = System.Text.RegularExpressions.Regex.Replace(formId.Substring(formId.LastIndexOf('_') + 1), @"[\d-]", string.Empty);
                }
                oRecordSet = ((SAPbobsCOM.Recordset)(AddOnUtilities.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
                string strQuery = "SELECT * FROM \"@OCFL\" WHERE \"U_FormId\" = '" + formId + "' AND \"U_ItemId\" = '" + itemId + "' AND \"U_ColumnId\" = '" + colId + "' AND \"U_EventType\" = " + eventType + " AND \"U_DocType\" = " + documentType;
                oRecordSet.DoQuery(strQuery);
            }
            catch (Exception ex)
            {
                AddOnUtilities.MsgBoxWrapper(ex.Message + " " + ex.StackTrace);
            }

            return(oRecordSet);
        }
Ejemplo n.º 22
0
        public double GetDocTotal(string pStrCardCode, string pStrNumAtCard)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            try
            {
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("CardCode", pStrCardCode);
                lLstStrParameters.Add("NumAtCard", pStrNumAtCard);

                string lStrQuery = this.GetSQL("GetDocTotalByFilters").Inject(lLstStrParameters);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    return(Convert.ToDouble(lObjRecordset.Fields.Item(1).Value));
                }
            }
            catch
            {
                //Ignore
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(0);
        }
Ejemplo n.º 23
0
        public int GetNextUgrsFolio(string pStrPrefix)
        {
            SAPbobsCOM.Recordset        lObjRecordSet     = null;
            Dictionary <string, string> lLstStrParameters = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("Prefix", pStrPrefix);

                lStrQuery = this.GetSQL("GetNextUgrsFolio").Inject(lLstStrParameters);
                lObjRecordSet.DoQuery(lStrQuery);

                return(lObjRecordSet.RecordCount > 0 ? (int)lObjRecordSet.Fields.Item("UgrsFolio").Value : 0);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
Ejemplo n.º 24
0
        public string GetRowCodeByPort(string pStrRequestId, int pIntPortId, int pIntPortType)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrResult = "";
            string lStrQuery;

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("RequestId", pStrRequestId);
                lLstStrParameters.Add("PortId", pIntPortId.ToString());
                lLstStrParameters.Add("PortType", pIntPortType.ToString());

                lStrQuery = this.GetSQL("GetRowCodeByPort").Inject(lLstStrParameters);
                lObjRecordSet.DoQuery(lStrQuery);

                lStrResult = lObjRecordSet.Fields.Item(0).Value.ToString();
            }
            catch
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
            finally
            {
            }


            return(lStrResult);
        }
Ejemplo n.º 25
0
        public static void updateSettings(Dictionary <String, String> dict_Settings)
        {
            try
            {
                ors = eCommon.oCompany.GetBusinessObject(BoObjectTypes.BoRecordset) as SAPbobsCOM.Recordset;
                foreach (KeyValuePair <string, string> entry in dict_Settings)
                {
                    ors.DoQuery(String.Format("UPDATE [@TWM_SETTINGS] SET U_TWM_Settings_Value='{0}' WHERE U_TWM_Settings_Type='{1}';", entry.Value, entry.Key));

                    if (entry.Key == "Export_XML_Path")
                    {
                        _settings_xml_Path = entry.Value;
                    }
                    else if (entry.Key == "Save_PO_As_Draft")
                    {
                        _settings_Save_PO_Draft = (entry.Value == "1");
                    }
                    else if (entry.Key == "Save_SO_As_Draft")
                    {
                        _settings_Save_SO_Draft = (entry.Value == "1");
                    }
                }
                eCommon.SBO_Application.StatusBar.SetText("Settings Updated !", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
            }
            catch { }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(ors);
                ors = null;
                GC.Collect();
            }
        }
Ejemplo n.º 26
0
        public bool ColumnExists(string TableName, string FieldID)
        {
            bool oFlag = true;

            try
            {
                SAPbobsCOM.Recordset rsetField = (SAPbobsCOM.Recordset)oDiCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                string s = "Select 1 from [CUFD] Where TableID='" + TableName.Trim() + "' and AliasID='" + FieldID.Trim() + "'";
                rsetField.DoQuery("Select 1 from [CUFD] Where TableID='" + TableName.Trim() + "' and AliasID='" + FieldID.Trim() + "'");
                if (rsetField.EoF)
                {
                    oFlag = false;
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(rsetField);
                rsetField = null;
                GC.Collect();
                return(oFlag);
            }
            catch (Exception ex)
            {
                throw new Exception("hello");
                throw new Exception("Failed to Column Exists : " + ex.Message);
            }
            finally
            {
            }
            return(oFlag);
        }
Ejemplo n.º 27
0
        public double GetTaxImport(string pStrTaxCode)
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string lStrQuery = "";

            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);


                lStrQuery = string.Format(@"
                                            SELECT Rate FROM OSTC WHERE Code = '{0}'", pStrTaxCode);

                lObjRecordSet.DoQuery(lStrQuery);

                return((double)lObjRecordSet.Fields.Item("Rate").Value);
            }
            catch (Exception lObjException)
            {
                throw new QueryException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }
        }
        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_Entrega.srf', Uid);
                oForm = FSBOApp.Forms.Item(uid);
                //Flag := false;

                /*if (GlobalSettings.RunningUnderSQLServer)
                 *  s = "select ISNULL(U_Localidad,'CL') Localidad from [@VID_FEPARAM] where Code = '1'";
                 * else
                 *  s = @"select IFNULL(""U_Localidad"",'CL') ""Localidad"" from ""@VID_FEPARAM"" where ""Code"" = '1' ";
                 *
                 * oRecordSet.DoQuery(s);
                 * if (oRecordSet.RecordCount == 0)
                 *  throw new Exception("Debe parametrizar el Addon Factura Electronica");
                 * else*/
                Localidad = "CL";// ((System.String)oRecordSet.Fields.Item("Localidad").Value).Trim();

                oForm.Freeze(true);
            }
            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
Ejemplo n.º 29
0
        public bool DoQuery(string sql, params dynamic[] values)
        {
            try
            {
                LastCommand = Factory.Scripts.FormatQuery(sql, values);
                Track       = k.Diagnostic.TrackMessages(sql, "Values:", values, "\nSQL Server: Query formated", LastCommand);
                RS          = k.sap.DI.Conn.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset) as SAPbobsCOM.Recordset;
                RS.DoQuery(LastCommand);

                HasLine = !RS.EoF;

                if (HasLine)
                {
                    FieldCount  = RS.Fields.Count;
                    Position    = 0;
                    IsFirstLine = true;
                }
                else
                {
                    Position    = -1;
                    IsFirstLine = false;
                }

                return(HasLine);
            }
            catch (Exception ex)
            {
                k.Diagnostic.Error(LOG, Track, "Error to execute the query.");
                k.Diagnostic.Error(LOG, ex);

                throw ex;
            }
        }
Ejemplo n.º 30
0
        public bool Next(int limit = -1)
        {
            // If it not has line
            if (!HasLine)
            {
                return(false);
            }


            if (IsFirstLine)
            {
                IsFirstLine = false;
                return(true);
            }

            if (++Position >= limit && limit > 0)
            {
                k.Diagnostic.Warning(this.GetHashCode(), Track, "The query is limited to show {0} lines.", limit);

                RS = null;
                return(false);
            }

            RS.MoveNext();

            if (!RS.EoF)
            {
                return(true);
            }
            else
            {
                RS = null;
                return(false);
            }
        }
Ejemplo n.º 31
0
        private void FindData(SAPbouiCOM.Form oForm)
        {
            string cv_ColumnsUID_s;
            string cv_NoEditable_s;
            string cv_ColumnsNAM_s;
            string cv_Right_Just_s;
            string cv_No_Visible_s;

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

            EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;

            try
            {
                oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
                oGrid.SelectionMode = BoMatrixSelect.ms_Single;

                cv_ColumnsUID_s = "U_LINENUM, U_EMPNO, U_EMPNM, U_DEPTCD, U_DEPTNM, U_PASSYNL, U_PASSYNT, U_HEADER, U_LINE,RANK,LASTG";
                cv_NoEditable_s = "U_LINENUM, U_EMPNO, U_EMPNM, U_DEPTCD, U_DEPTNM, U_PASSYNL, U_PASSYNT, U_HEADER, U_LINE,RANK,LASTG";
                cv_ColumnsNAM_s = "#,사번,사원명,부서코드,부서명,본인고과,고과자,헤더정보,라인정보,순위,최종등급";
                cv_Right_Just_s = " ";
                cv_No_Visible_s = "U_HEADER, U_LINE,RANK,LASTG";

                string sQry = "";
                sQry = string.Format(" EXEC [KIS_SP_HR0010B2_HRD] '1','{0}'",EXAMCD);

                B1Connections.theAppl.StatusBar.SetText("데이터 조회중입니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다

                oForm.Freeze(true);

                oForm.DataSources.DataTables.Item("grd1").ExecuteQuery(sQry);
                oGrid.DataTable = oForm.DataSources.DataTables.Item("grd1"); //데이터 그리드에 Display          

                //조회된 내역이 없어도 1줄이 추가되므로 키값을 체크하여 조회안된 경우 1줄 삭제
                if (oGrid.DataTable.Rows.Count == 1 && oGrid.DataTable.GetValue("U_EMPNO", 0).ToString() == "")
                {
                    FN.SetGridTitle(oGrid, cv_ColumnsUID_s, cv_ColumnsNAM_s, cv_No_Visible_s);
                    oForm.Items.Item("edtCREATE").Specific.Value = oGrid.DataTable.Rows.Count;
                    oForm.Items.Item("edtCOMPL").Specific.Value = 0;
                    oForm.Items.Item("edtINCOMPL").Specific.value = oForm.Items.Item("edtPERSON").Specific.Value;
                    B1Connections.theAppl.StatusBar.SetText("데이터가 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터가 없습니다.
                }
                else
                {
                    FN.BindGrid(oGrid, cv_ColumnsUID_s, cv_ColumnsNAM_s, cv_NoEditable_s, cv_No_Visible_s, "", cv_Right_Just_s);
                    FN.SetGridCombo(ref oGrid, "U_PASSYNL", "", " SELECT U_SMLCD,U_SMLNM FROM [@KIS_AD00201] WHERE CODE = 'HR11' AND U_USEYN = 'Y'", "");
                    FN.SetGridCombo(ref oGrid, "U_PASSYNT", "", " SELECT U_SMLCD,U_SMLNM FROM [@KIS_AD00201] WHERE CODE = 'HR11' AND U_USEYN = 'Y'", "");
                    B1Connections.theAppl.StatusBar.SetText("조회완료", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success); //조회완료
                    oGrid.RowHeaders.Width = 0;
                    oGrid.AutoResizeColumns();

                    sQry = string.Format(" EXEC [KIS_SP_HR0010B2_HRD] '2','{0}'",EXAMCD);
                    oRS.DoQuery(sQry);
                    
                    oForm.Items.Item("edtCREATE").Specific.Value = oGrid.DataTable.Rows.Count;
                    oForm.Items.Item("edtCOMPL").Specific.Value = oRS.Fields.Item(0).Value;
                    oForm.Items.Item("edtINCOMPL").Specific.value = Convert.ToInt16(oForm.Items.Item("edtCREATE").Specific.Value) - Convert.ToInt16(oForm.Items.Item("edtCOMPL").Specific.Value);
                }

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText("btnFIND_OnAfterItemPressed " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

            }
            finally
            {
                oForm.Freeze(false);
                oForm.Items.Item("btnSAVE").Enabled = true;
                STATE = true;
                oGrid = null;

            }
        }
Ejemplo n.º 32
0
        public virtual bool ET_btnSAVE_BFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnSAVE").Specific));
            // ADD YOUR ACTION CODE HERE ...
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            try
            {
                string Status = oForm.Items.Item("cboSTATUS").Specific.Value.Trim();
                if (StatusChange(Status) == true)
                    return true;
                else
                    return false;

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

        }
Ejemplo n.º 33
0
        /// <summary>
        /// 분개 저장 TR_COMMON.JournalType 에 따라 분개, 분개취소 전표를 발행한다.
        /// </summary>
        private bool DI_JournalEntries(SAPbouiCOM.Form oForm, SO.SO_COMMON_HRD.JournalType pJournalType)
        {
            bool boolReturn = true;

            int? retValue = null;
            int nError;
            string strError = string.Empty;

            string strJournalEntry = string.Empty;
            //string xSQL = string.Empty;
            StringBuilder sb;

            string xSQL = string.Empty;

            //DateTime dateDoc = DateTime.Today;
            //string strDate = string.Empty;

            string strHEAD_MEMO = string.Empty;
            string strLINE_MEMO = string.Empty;


            string strDocEntry = string.Empty;
            string strPaperType = string.Empty;
            string strCENTNM = string.Empty;
            string strDESC = string.Empty;
            string strDOCDT = string.Empty;

            string strAccount = string.Empty;
            string strDebit = string.Empty;
            string strCredit = string.Empty;
            string strShortName = string.Empty;
            string strCostCd = string.Empty;

            SAPbobsCOM.JournalEntries oJournalEntries = null;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
                oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_SO03201_HRD");
                strDocEntry = oDB_M.GetValue("DocEntry", 0).Trim();
                strDOCDT = oDB_M.GetValue("U_DOCDT", 0).Trim();
                strCENTNM = oDB_M.GetValue("U_CENTNM", 0).Trim();
                strDESC = oDB_M.GetValue("U_DESC", 0).Trim();

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

                /*##### 트랙젝션 시작 #####*/
                B1Connections.diCompany.StartTransaction();

                if (pJournalType == SO.SO_COMMON_HRD.JournalType.A01)
                {
                    xSQL = string.Format(" EXEC KIS_SP_SO0320F1_HRD @pDocEntry = {0} ", strDocEntry);
                    oRS.DoQuery(xSQL);
                    if (!oRS.EoF)
                    {
                        // 헤더셋팅
                        strHEAD_MEMO = "[" + strCENTNM + "] " + strDESC;

                        oJournalEntries.ReferenceDate = Convert.ToDateTime(FN.SetDateFormatToDB(strDOCDT)); //전기일
                        oJournalEntries.DueDate = Convert.ToDateTime(FN.SetDateFormatToDB(strDOCDT));   //만기일
                        oJournalEntries.TaxDate = Convert.ToDateTime(FN.SetDateFormatToDB(strDOCDT));   //증빙일
                        oJournalEntries.Memo = strHEAD_MEMO;
                        oJournalEntries.UserFields.Fields.Item("U_ADDOCTP").Value = "KIS_SO0320_HRD";
                        oJournalEntries.UserFields.Fields.Item("U_BPLID").Value = "1";

                        for (int i = 0; i < oRS.RecordCount; i++)
                        {
                            strAccount = oRS.Fields.Item("ACCOUNT").Value.ToString();
                            strDebit = oRS.Fields.Item("DEBIT").Value.ToString(); //차변
                            strCredit = oRS.Fields.Item("CREDIT").Value.ToString(); //대변
                            strShortName = oRS.Fields.Item("SHORTNM").Value.ToString();
                            strLINE_MEMO = oRS.Fields.Item("MEMO").Value.ToString(); //헤더,라인 메모
                            strCostCd = oRS.Fields.Item("COSTCD").Value.ToString(); // 코스트센터 (운반비 적용시 코스트센터 적용)

                            //기본적으로 Count는 1개이다.
                            if (i > 0)
                                oJournalEntries.Lines.Add();

                            oJournalEntries.Lines.AccountCode = strAccount;
                            oJournalEntries.Lines.LineMemo = strLINE_MEMO;

                            // 거래처코드(관리계정일경우 거래처코드 입력)
                            if (!string.IsNullOrEmpty(strShortName))
                                oJournalEntries.Lines.ShortName = strShortName;

                            // 코스트센터 (운반비 적용시 코스트센터 적용)
                            if (!string.IsNullOrEmpty(strCostCd))
                                oJournalEntries.Lines.CostingCode = strCostCd;

                            if (double.Parse(strDebit) != 0.0)
                            {
                                oJournalEntries.Lines.Debit = double.Parse(strDebit);
                            }
                            else
                            {
                                oJournalEntries.Lines.Credit = double.Parse(strCredit);
                            }
                            oRS.MoveNext();
                        }
                    }

                    // 분개라인이 생성되지 않을을경우 분개를 추가 하지 않는다.기본적으로 Count는 1개이다.
                    if (oJournalEntries.Lines.Count > 1)
                        retValue = oJournalEntries.Add();
                }
                else if (pJournalType == SO.SO_COMMON_HRD.JournalType.A02)
                {
                    // 분개 취소시 분개번호는 존재하고 , 분개 취소번호는 없는경우만 분개취소를 실행한다.
                    if (!string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()) && string.IsNullOrEmpty(oDB_M.GetValue("U_RJDTDOC", 0).Trim()))
                    {
                        oJournalEntries.GetByKey(int.Parse(oDB_M.GetValue("U_JDTDOC", 0).Trim()));
                        retValue = oJournalEntries.Cancel();
                    }
                }

                if (retValue != 0)
                {
                    /*##### 트랙젝션 롤백 #####*/
                    if (B1Connections.diCompany.InTransaction == true)
                    {
                        B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                    }

                    B1Connections.diCompany.GetLastError(out nError, out strError);
                    B1Connections.theAppl.StatusBar.SetText("분개 저장이 실패했습니다. " + strError, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    boolReturn = false;
                }
                else
                {
                    // 분개라인이 존재할경우 키값을 가져온다.
                    if (oJournalEntries.Lines.Count > 1)
                        strJournalEntry = B1Connections.diCompany.GetNewObjectKey();
                    else
                        strJournalEntry = "";


                    if (!string.IsNullOrEmpty(strJournalEntry))
                    {
                        if (pJournalType == SO.SO_COMMON_HRD.JournalType.A01)
                        {
                            sb = new StringBuilder();
                            sb.AppendLine(" UPDATE [@KIS_SO0320T_HRD] SET U_JDTDOC ='{0}' WHERE DocEntry = {1} ");
                        }
                        else
                        {
                            sb = new StringBuilder();
                            sb.AppendLine("  --1.지대수금_헤더 상태값 UPDATE                 ");
                            sb.AppendLine("  UPDATE [@KIS_SO0320T_HRD]                       ");
                            sb.AppendLine("     SET U_RJDTDOC = {0}, Status = 'C'  ");
                            sb.AppendLine("   WHERE DocEntry = {1}                           ");
                            sb.AppendLine("                                                  ");
                            sb.AppendLine("  --2.지대청구_라인(청구입금TRAN) 데이터 삭제     ");
                            sb.AppendLine("  DELETE [@KIS_SO03103_HRD]                       ");
                            sb.AppendLine("   WHERE U_BTYPE = 'KIS_SO0320_HRD' AND U_BENTRY = {1} ");
                            sb.AppendLine("                                                  ");
                            sb.AppendLine("  --3.지대청구_라인(보증금TRAN) 데이터 삭제       ");
                            sb.AppendLine("  DELETE [@KIS_SO03102_HRD]                       ");
                            sb.AppendLine("   WHERE U_BTYPE = 'KIS_SO0320_HRD' AND U_BENTRY = {1} ");

                            sb.AppendLine("   -- 선수금입금_라인                                                                      ");
                            sb.AppendLine("   DELETE A                                                                                ");
                            sb.AppendLine("     FROM [@KIS_SO04201_HRD] A INNER JOIN [@KIS_SO0420T_HRD] B ON A.DocEntry = B.DocEntry  ");
                            sb.AppendLine("    WHERE B.U_BENTRY = {1} AND B.U_BTYPE = 'KIS_SO0320_HRD'                                ");
                            sb.AppendLine("                                                                                           ");
                            sb.AppendLine("   -- 선수금입금_헤더                                                                      ");
                            sb.AppendLine("   DELETE [@KIS_SO0420T_HRD]                                                               ");
                            sb.AppendLine("    WHERE U_BENTRY = {1} AND U_BTYPE = 'KIS_SO0320_HRD'                                    ");
                        }
                        oRS.DoQuery(string.Format(sb.ToString(), strJournalEntry, strDocEntry));

                        /*##### 트랙젝션 커밋 #####*/
                        if (B1Connections.diCompany.InTransaction == true)
                        {
                            B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_Commit);
                        }

                        GetDataLoad(oForm, strDocEntry);
                    }

                    if (pJournalType == SO.SO_COMMON_HRD.JournalType.A01)
                        B1Connections.theAppl.StatusBar.SetText("분개전기 완료 되었습니다. " + strError, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                    else
                        B1Connections.theAppl.StatusBar.SetText("분개전기 취소 되었습니다. " + strError, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }
                oJournalEntries = null;
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText("DI_JournalEntries " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                /*##### 트랙젝션 롤백 #####*/
                if (B1Connections.diCompany.InTransaction == true)
                {
                    B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                }

                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
                if (oJournalEntries != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oJournalEntries);
                    oJournalEntries = null;
                }
            }
            return boolReturn;
        }
Ejemplo n.º 34
0
        private bool UDO_Add_Data()
        {
            SAPbobsCOM.GeneralService oGeneralService = null;
            SAPbobsCOM.GeneralData oGeneralData = null;
            SAPbobsCOM.GeneralDataCollection oChildren = null;
            SAPbobsCOM.GeneralData oChild = null;
            SAPbobsCOM.GeneralDataParams oGeneralParams = null;
            SAPbobsCOM.CompanyService oCompanyService = (SAPbobsCOM.CompanyService)B1Connections.diCompany.GetCompanyService();
            oGrid2 = (SAPbouiCOM.Grid)oForm.Items.Item("grd2").Specific;
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            try
            {

                EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;
                if (GRIDCODE != "")
                {
                    B1Connections.theAppl.StatusBar.SetText("재고과중..", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                    for (int i = 0; i < oGrid2.DataTable.Rows.Count; i++)
                    {
                        string KeyAlias = "Code";
                        string KeyValue = oGrid2.DataTable.GetValue("Code", i);

                        oGeneralService = oCompanyService.GetGeneralService("KIS_HR0020_HRD");
                        oGeneralParams = (SAPbobsCOM.GeneralDataParams)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams);
                        oGeneralParams.SetProperty(KeyAlias, KeyValue);
                        oGeneralData = oGeneralService.GetByParams(oGeneralParams);

                        oChildren = oGeneralData.Child("KIS_HR00203_HRD");

                        for (int j = 0; j < oGrid2.DataTable.Rows.Count; j++)
                        {
                            string PASSYN = oGrid2.DataTable.GetValue("U_PASSYN", j);//전송여부                

                            oChild = oChildren.Item(j);
                            oChild.SetProperty("U_PASSYN", PASSYN);
                        }
                        oGeneralService.Update(oGeneralData);
                    }
                    B1Connections.theAppl.StatusBar.SetText("재고과완료", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }
                else
                {
                    B1Connections.theAppl.StatusBar.SetText("저장할 데이터가 없습니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                oCompanyService = null;
                return false;
            }

            oRS = null;
            oGrid2 = null;
            oGeneralData = null;
            oCompanyService = null;
            oChildren = null;
            oChild = null;
            oGeneralParams = null;
            return true;
        }
Ejemplo n.º 35
0
        public void UpDateData(SAPbouiCOM.Form oForm)
        {
            SAPbouiCOM.Grid oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd").Specific;
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            int Tmp = 0;
            for (int i = 0; i < oGrid.DataTable.Rows.Count; i++)
            {
                if (oGrid.DataTable.Columns.Item("CHK").Cells.Item(i).Value.ToString() == "Y")
                {
                    Tmp = Tmp + 1;
                    string SDELVCD = oGrid.DataTable.GetValue("U_DELVCD", i);
                    string SLINEID = Convert.ToString(oGrid.DataTable.GetValue("LINEID", i));
                    string SPROCOMM = oGrid.DataTable.GetValue("U_PROCOMM", i);
                    string SPROCNM = oGrid.DataTable.GetValue("U_PROCNM", i);

                    //string SPROCDT = oGrid.DataTable.GetValue("U_PROCDT", i).toString("yyyyMMdd");

                    string SPROCDT = FN.SetDateFormatToDB(oGrid.DataTable.GetValue("U_PROCDT", i).ToString(), FN.eDateType.n_YYYYMMDD);


                    StringBuilder pQuery = new StringBuilder();
                    string query = string.Empty;

                    pQuery.AppendLine(" EXEC [KIS_SP_SO0080A_HRD]                 ");
                    pQuery.AppendLine(" 	  	@TYPE='ADD'                       ");
                    pQuery.AppendLine(" 	  ,	@FRRDCD=''                        ");
                    pQuery.AppendLine(" 	  ,	@TORDCD=''                        ");
                    pQuery.AppendLine(" 	  ,	@FRRECVDT=''                      ");
                    pQuery.AppendLine(" 	  ,	@TORECVDT=''                      ");
                    pQuery.AppendLine(" 	  ,	@FRDELVCD=''                      ");
                    pQuery.AppendLine(" 	  ,	@TODELVCD=''                      ");
                    pQuery.AppendLine(" 	  ,	@CALLTP=''                        ");
                    pQuery.AppendLine(" 	  ,	@RECVID=''                        ");
                    pQuery.AppendLine(" 	  ,	@PROSTAT=''                       ");

                    pQuery.AppendLine(" 	  ,	@SDELVCD='{0}'                    ");
                    pQuery.AppendLine(" 	  ,	@SLINEID='{1}'                    ");
                    pQuery.AppendLine(" 	  ,	@SPROCOMM='{2}'                   ");
                    pQuery.AppendLine(" 	  ,	@SPROCNM='{3}'                    ");
                    pQuery.AppendLine(" 	  ,	@SPROCDT='{4}'                    ");
                    string sQry = string.Format(pQuery.ToString(), SDELVCD, SLINEID, SPROCOMM, SPROCNM, SPROCDT);
                    oRS.DoQuery(sQry);

                }
            }
            if (Tmp != 0)
            {
                FindData(oForm);
                B1Connections.theAppl.StatusBar.SetText("갱신되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
            }
            else
            {
                B1Connections.theAppl.StatusBar.SetText("저장할데이터를 체크해주세요.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

            }
            oGrid = null;
            oRS = null;
        }
Ejemplo n.º 36
0
 private void ClearUnManagedObject()
 {
     if ((oEditText != null)) { Marshal.ReleaseComObject(oEditText); } oEditText = null;
     if ((oButton != null)) { Marshal.ReleaseComObject(oButton); } oButton = null;
     if ((oCombo != null)) { Marshal.ReleaseComObject(oCombo); } oCombo = null;
     if ((oForm != null)) { Marshal.ReleaseComObject(oForm); } oForm = null;
     if ((oGrid != null)) { Marshal.ReleaseComObject(oGrid); } oGrid = null;
     if ((oRS != null)) { Marshal.ReleaseComObject(oRS); } oRS = null;
     // ADD YOUR ACTION CODE HERE ...
     System.GC.Collect();
     System.GC.WaitForPendingFinalizers();
 }
Ejemplo n.º 37
0
        /// <summary>
        /// 현재 고과상태의 위아래 한단계 콤보리스트를 생성한다.
        /// </summary>
        /// <param name="pComboBox"></param>
        /// <param name="pEnumWholeTp"></param>
        /// <param name="pYearMonth"></param>
        public static void SetComboValue_STATUS(ref SAPbouiCOM.ComboBox pComboBox, FN.Enum_WholeTp pEnumWholeTp, string pSTATUS)
        {
            SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
            StringBuilder sb = new StringBuilder();
            string sQry = string.Empty;
            string Status = string.Empty;


            try
            {
                if (string.IsNullOrEmpty(pSTATUS))
                {
                    Status = "0";
                }
                else
                {
                    sb.Clear();
                    sb.AppendFormat("  SELECT U_SORT FROM [@KIS_AD00201] WHERE Code = 'HR10' AND U_SMLCD = '{0}'     ", pSTATUS);
                    oRS.DoQuery(sb.ToString());
                    Status = oRS.Fields.Item(0).Value.ToString();
                }
                sb.Clear();
                sb.AppendLine("   SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201]  WHERE CODE = 'HR10' AND U_USEYN = 'Y' ");

                sb.AppendFormat("  AND U_SORT BETWEEN '{0}'-1 AND '{0}'+1                              ", Status);

                sQry = sb.ToString();
                oRS.DoQuery(sQry);
                if (!oRS.EoF)
                {
                    FN.SetComboClear(ref pComboBox);

                    if (pEnumWholeTp == FN.Enum_WholeTp.m_Space)
                        pComboBox.ValidValues.Add("", "");
                    for (int iLooper = 0; iLooper < oRS.RecordCount; iLooper++)
                    {
                        pComboBox.ValidValues.Add(oRS.Fields.Item(0).Value.ToString(), oRS.Fields.Item(1).Value.ToString());
                        oRS.MoveNext();
                    }

                    if (!string.IsNullOrEmpty(pSTATUS))
                        pComboBox.Select(pSTATUS, SAPbouiCOM.BoSearchKey.psk_ByValue);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
                oRS = null;
            }
        }
Ejemplo n.º 38
0
        private void GetCostCenterList()
        {
            StringBuilder sb = new StringBuilder();
            SAPbobsCOM.Recordset oRS = null;
            string expression = string.Empty;
            System.Data.DataRow[] foundRows;
            int iRow;
            bool bModify = false;
            try
            {
                oForm.Freeze(true);
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0010M_HRD");
                oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00101_HRD");

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                //oMatrix.LoadFromDataSource();

                oMatrix.Clear();
                FN.SetMatrixIsNullOrEmptDeleteRow(ref oForm, ref oMatrix, "U_PRCCD");

                sDataTable = FN.SapDBDataSourceToSystemDataTable(oDB_1);

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

                sb.Append(" SELECT Code,Name FROM [@KIS_CO0110M]                               \r");

                if (FN.GetItemValue(ref oForm, "edtCOSTFR") != "" && FN.GetItemValue(ref oForm, "edtCOSTTO") != "")
                    sb.Append("    WHERE Code BETWEEN '" + FN.GetItemValue(ref oForm, "edtCOSTFR") + "' AND '" + FN.GetItemValue(ref oForm, "edtCOSTTO") + "' \r");

                B1Connections.theAppl.StatusBar.SetText("불러오기를 시작합니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                oRS.DoQuery(sb.ToString());

                iRow = oMatrix.VisualRowCount;
                if (!oRS.EoF)
                {
                    for (int i = 0; i < oRS.RecordCount; i++)
                    {
                        expression = "U_PRCCD = '" + oRS.Fields.Item("Code").Value.ToString() + "'";
                        foundRows = sDataTable.Select(expression);

                        if (foundRows.Length < 1)
                        {
                            if (iRow != 0)
                                oDB_1.InsertRecord(iRow-1);

                            //oDB_1.SetValue("U_LINENUM", iRow, (iRow+1).ToString());
                            oDB_1.SetValue("U_PRCCD", iRow, oRS.Fields.Item("Code").Value.ToString());
                            oDB_1.SetValue("U_PRCNM", iRow, oRS.Fields.Item("Name").Value.ToString());

                            iRow += 1;
                            bModify = true;
                        }
                        oRS.MoveNext();
                    }
                    if (bModify)
                    {
                        oMatrix.LoadFromDataSource();
                        if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                    }
                }
                B1Connections.theAppl.StatusBar.SetText("불러오기가 완료 되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다
            }
            catch (Exception ex)
            {
                oForm.Freeze(false);
                B1Connections.theAppl.StatusBar.SetText("GetCostCenterList " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                if (oRS != null)
                {
                    oForm.Freeze(false);
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
                    oRS = null;
                }
            }
        }
Ejemplo n.º 39
0
        private void SetTR(string TYPE)
        {
            bool bModify = false;
            SAPbobsCOM.Recordset oRS = null;
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            try
            {
                oForm.Freeze(true);
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0020M_HRD");
                oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00201_HRD");

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                //oMatrix.LoadFromDataSource();

                oMatrix.FlushToDataSource();
                string strNowDate = B1Connections.diCompany.GetCompanyDate().ToShortDateString();
                strNowDate = FN.SetDateFormatToDB(strNowDate, FN.eDateType.p_YYYYMMDD);

                string Code = string.Empty;
                string YYYYMM = string.Empty;
                string sQry = string.Empty;

                if (SelectRow != -1)
                {
                    if (TYPE == "TR")
                    {
                        Code = oForm.Items.Item("Code").Specific.value.Trim();
                        YYYYMM = oDB_1.GetValue("U_YYYYMM", SelectRow).ToString().Trim();
                        sQry = " EXEC KIS_SP_FI0020B1_HRD '" + YYYYMM + "'";
                        oRS.DoQuery(sQry);
                        if (oRS.RecordCount == 0)
                        {
                            oDB_1.SetValue("U_UPDATEDT", SelectRow, strNowDate.Replace(".", ""));
                            oDB_1.SetValue("U_STATUS", SelectRow, "Y");
                        }
                        sQry = "UPDATE [@KIS_FI00201_HRD] SET U_UPDATEDT = '" + strNowDate.Replace(".", "") + "' ,U_STATUS = 'Y' WHERE Code = '" + Code + "' AND U_YYYYMM = '" + YYYYMM + "'";
                        oRS.DoQuery(sQry);

                    }
                    else
                    {
                        Code = oForm.Items.Item("Code").Specific.value.Trim();
                        YYYYMM = oDB_1.GetValue("U_YYYYMM", SelectRow).ToString().Trim();
                        sQry = " DELETE FROM [@KIS_FI0020B1_HRD] WHERE U_YYYYMM = '" + YYYYMM + "'";
                        sQry = sQry + " DELETE FROM [@KIS_FI0020B2_HRD] WHERE U_YYYYMM = '" + YYYYMM + "'";
                        oRS.DoQuery(sQry);
                        if (oRS.RecordCount == 0)
                        {
                            oDB_1.SetValue("U_UPDATEDT", SelectRow, "");
                            oDB_1.SetValue("U_STATUS", SelectRow, "N");
                        }
                        sQry = "UPDATE [@KIS_FI00201_HRD] SET U_UPDATEDT = NULL ,U_STATUS = 'N' WHERE Code = '" + Code + "' AND U_YYYYMM = '" + YYYYMM + "'";
                        oRS.DoQuery(sQry);
                    }
                    bModify = true;
                }

                if (bModify)
                {
                    oMatrix.LoadFromDataSource();
                    SelectRow = -1;
                }

                B1Connections.theAppl.StatusBar.SetText("배치가 적용되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다
            }
            catch (Exception ex)
            {
                oForm.Freeze(false);
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

            }
            finally
            {
                oForm.Freeze(false);
                oRS = null;
            }
        }
Ejemplo n.º 40
0
        private bool GetMonth() 
        {
            int iRow;
            bool bModify = false;
            try
            {
                oForm.Freeze(true);
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0020M_HRD");
                oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00201_HRD");

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                //oMatrix.LoadFromDataSource();

                oMatrix.Clear();
                string Year = oForm.Items.Item("Code").Specific.value.Trim();
                YYYYCode = Year;
                int Month = 1;
                string YYYYMM = "";
                iRow = oMatrix.VisualRowCount;

                for (int i = 0; i < 12; i++)
                {
                    if (Month.ToString().Length == 1)
                    {
                        YYYYMM = Year + "0" + Month.ToString();
                    }
                    else
                    {
                        YYYYMM = Year + Month.ToString();
                    }
                    oDB_1.InsertRecord(iRow);

                    oDB_1.SetValue("U_YYYYMM", iRow, YYYYMM);

                    Month = Month + 1;
                    iRow += 1;
                    bModify = true;
                    if (i == 11)
                        oDB_1.RemoveRecord(iRow);
                }
                if (bModify)
                {
                    oMatrix.LoadFromDataSource();
                }

                //B1Connections.theAppl.StatusBar.SetText("저장이 완료 되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다
            }
            catch (Exception ex)
            {
                oForm.Freeze(false);
                B1Connections.theAppl.StatusBar.SetText("GetCostCenterList " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                return false;
            }
            finally
            {
                oForm.Freeze(false);
                oRS = null;
            }
            return true;
        }
Ejemplo n.º 41
0
        private bool UDO_Add_Data()
            
        {
            SAPbobsCOM.GeneralService oGeneralService = null;
            SAPbobsCOM.GeneralData oGeneralData = null;
            SAPbobsCOM.GeneralDataCollection oChildren = null;
            SAPbobsCOM.GeneralData oChild = null;
            SAPbobsCOM.CompanyService oCompanyService = (SAPbobsCOM.CompanyService)B1Connections.diCompany.GetCompanyService();
            
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            oRS1 = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            StringBuilder pQuery = new StringBuilder();
            string sQry = string.Empty;

            #region  DataSetting_쿼리문
            pQuery.Clear();
            pQuery.AppendLine("   SELECT                                                                                    ");
            pQuery.AppendLine("      ''				AS EXAMCD                                                               ");
            pQuery.AppendLine("     ,T0.U_EMPNO		AS EMPNO                                                                ");
            pQuery.AppendLine("     ,T0.U_EMPNM		AS EMPNM                                                                ");
            pQuery.AppendLine("     ,''			    AS DTCD                                                                 ");
            pQuery.AppendLine("     ,''			    AS TEAMCD                                                               ");
            pQuery.AppendLine("     ,T1.U_DEPTCD 	AS DEPTCD                                                               ");
            pQuery.AppendLine("     ,T0.U_JIKGBCD	AS JIKGBCD                                                              ");
            pQuery.AppendLine("     ,T0.U_JIKCHCD	AS JIKCHKCD                                                             ");
            pQuery.AppendLine("     ,0 			    AS PASSYN                                                               ");
            pQuery.AppendLine("     ,0				AS CARDPSYN                                                             ");
            pQuery.AppendLine("     ,0 			    AS USEYN                                                                ");
            pQuery.AppendLine("     ,NULL			AS LASTSBF                                                              ");
            pQuery.AppendLine("     ,0				AS LASTGBF                                                              ");
            pQuery.AppendLine("     ,NULL			AS LASTSAF                                                              ");
            pQuery.AppendLine("     ,0				AS LASTGAF                                                              ");
            pQuery.AppendLine("   FROM [@KIS_HR0120M] T0                                                                    ");
            pQuery.AppendLine("   INNER JOIN (                                                                              ");
            pQuery.AppendLine("   			SELECT                                                                          ");
            pQuery.AppendLine("   				   A.Code                                                                   ");
            pQuery.AppendLine("   				 , CASE WHEN B.CNT = 1 THEN                                                 ");
            pQuery.AppendLine("   							CASE WHEN A.U_IDEPTYN = 'Y' THEN MAX(A.U_DEPTCD) ELSE NULL END  ");
            pQuery.AppendLine("   						ELSE                                                                ");
            pQuery.AppendLine("   							MAX(A.U_DEPTCD)                                                 ");
            pQuery.AppendLine("   				   END AS U_DEPTCD                                                          ");
            pQuery.AppendLine("   			FROM [@KIS_HR01202] A                                                           ");
            pQuery.AppendLine("   			INNER JOIN (                                                                    ");
            pQuery.AppendLine("   							SELECT                                                          ");
            pQuery.AppendLine("   								 COUNT(Code)	AS CNT                                      ");
            pQuery.AppendLine("   								,Code                                                       ");
            pQuery.AppendLine("   								,U_IDEPTYN								                    ");
            pQuery.AppendLine("   							FROM [@KIS_HR01202]                                             ");
            pQuery.AppendLine("   							GROUP BY Code,U_IDEPTYN                                         ");
            pQuery.AppendLine("   			) B ON A.Code = B.Code                                                          ");
            pQuery.AppendLine("   			WHERE                                                                           ");
            pQuery.AppendLine("   			NOT EXISTS(                                                                     ");
            pQuery.AppendLine("   						SELECT                                                              ");
            pQuery.AppendLine("   							 COUNT(Code)	AS CNT                                          ");
            pQuery.AppendLine("   							,Code                                                           ");
            pQuery.AppendLine("   							,U_IDEPTYN								                        ");
            pQuery.AppendLine("   						FROM [@KIS_HR01202]                                                 ");
            pQuery.AppendLine("   						WHERE (B.CNT = 1 AND B.U_IDEPTYN = 'N')	                            ");
            pQuery.AppendLine("   						GROUP BY Code,U_IDEPTYN                                             ");
            pQuery.AppendLine("   					 )                                                                      ");
            pQuery.AppendLine("   			GROUP BY A.Code  , B.CNT , A.U_IDEPTYN                                          ");
            pQuery.AppendLine("   ) T1 ON T0.Code = T1.Code                                                                 ");
            pQuery.AppendLine("   WHERE T1.U_DEPTCD IS NOT NULL                                                             ");

            #endregion

            oRS.DoQuery(pQuery.ToString());

            SAPbouiCOM.ProgressBar ProgressBar01 = B1Connections.theAppl.StatusBar.CreateProgressBar(String.Format("고과마스터 생성중...(0/{0})", oRS.RecordCount), oRS.RecordCount, false);
            KIS_COMMON.GLOBAL.PrograssBarExcute = true;

            try
            {

                for (int j = 0; j < oRS.RecordCount; j++)
                {
                    oGeneralService = oCompanyService.GetGeneralService("KIS_HR0020_HRD");
                    oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData);      
                    
                    if (KIS_COMMON.GLOBAL.PrograssBarExcute == true)
                    {
                        ProgressBar01.Value++;
                        ProgressBar01.Text = String.Format("고과마스터 생성중 ... ({0}/{1})", ProgressBar01.Value, oRS.RecordCount);
                        System.Windows.Forms.Application.DoEvents();
                    }

                    #region  DataSetting_헤더
                    string H_Code = FN.GetMaxCode("@KIS_HR0020M_HRD"); ;
                    string H_Name = H_Code;
                    string H_EMPNO = oRS.Fields.Item("EMPNO").Value.ToString();//사번
                    string H_EMPNM = oRS.Fields.Item("EMPNM").Value.ToString();//사원명
                    string H_DTCD = oRS.Fields.Item("DTCD").Value.ToString();//구분코드
                    string H_TEAMCD = oRS.Fields.Item("TEAMCD").Value.ToString();//팀코드
                    string H_DEPTCD = oRS.Fields.Item("DEPTCD").Value.ToString();//부서코드
                    string H_JIKGBCD = oRS.Fields.Item("JIKGBCD").Value.ToString();//직급코드
                    string H_JIKCHKCD = oRS.Fields.Item("JIKCHKCD").Value.ToString();//직책코드
                    string H_PASSYN = oRS.Fields.Item("PASSYN").Value.ToString();//본인작성사용여부
                    string H_CARDPSYN = oRS.Fields.Item("CARDPSYN").Value.ToString();//인재육성카드적성여부
                    string H_USEYN = oRS.Fields.Item("USEYN").Value.ToString();//사용여부
                    string H_LASTSBF = oRS.Fields.Item("LASTSBF").Value.ToString();//항목최종점수_수정전
                    string H_LASTGBF = oRS.Fields.Item("LASTGBF").Value.ToString();//항목최종등급_수정전
                    string H_LASTSAF = oRS.Fields.Item("LASTSAF").Value.ToString();//항목최종점수_수정후
                    string H_LASTGAF = oRS.Fields.Item("LASTGAF").Value.ToString();//항목최종등금_수정후
                    #endregion

                    oGeneralData.SetProperty("Code", H_Code);
                    oGeneralData.SetProperty("Name", H_Name);
                    oGeneralData.SetProperty("U_EXAMCD", EXAMCD);
                    oGeneralData.SetProperty("U_EMPNO", H_EMPNO);
                    oGeneralData.SetProperty("U_EMPNM", H_EMPNM);
                    oGeneralData.SetProperty("U_DTCD", H_DTCD);
                    oGeneralData.SetProperty("U_DEPTCD", H_DEPTCD);
                    oGeneralData.SetProperty("U_TEAMCD", H_TEAMCD);
                    oGeneralData.SetProperty("U_JIKGBCD", H_JIKGBCD);
                    oGeneralData.SetProperty("U_JIKCHKCD", H_JIKCHKCD);
                    oGeneralData.SetProperty("U_PASSYN", H_PASSYN);
                    oGeneralData.SetProperty("U_CARDPSYN", H_CARDPSYN);
                    oGeneralData.SetProperty("U_USEYN", H_USEYN);
                    oGeneralData.SetProperty("U_LASTSBF", H_LASTSBF);
                    oGeneralData.SetProperty("U_LASTGBF", H_LASTGBF);
                    oGeneralData.SetProperty("U_LASTSAF", H_LASTSAF);
                    oGeneralData.SetProperty("U_LASTGAF", H_LASTGAF);
                    oGeneralData.SetProperty("U_STATUS", "Y");

                    oChildren = oGeneralData.Child("KIS_HR00202_HRD");

                    #region  DataSetting_라인쿼리문
                    pQuery.Clear();
                    pQuery.AppendLine("  SELECT                                                             ");
                    pQuery.AppendLine("     A.U_RMK2		AS DTCD			/*객관식 주관식 구분 코드*/     ");
                    pQuery.AppendLine("    ,A.U_RMK3		AS DTNM			/*객관식 주관식 구분 내용*/     ");
                    pQuery.AppendLine("    ,A.U_SMLCD		AS ABILCD		/*항목*/                        ");
                    pQuery.AppendLine("    ,A.U_SMLNM		AS ABILNM		/*항목내용*/                    ");
                    pQuery.AppendLine("    ,B.U_SMLCD		AS COMPOCD		/*세부항목*/                    ");
                    pQuery.AppendLine("    ,B.U_SMLNM		AS COMPONM		/*세부항목내용*/                ");
                    pQuery.AppendLine("    ,NULL			AS SELVAL		/*결과값*/                      ");
                    pQuery.AppendLine("    ,NULL			AS SELVALNM		/*결과값내용*/                  ");
                    pQuery.AppendLine("    ,NULL			AS CONTENT1		/*피고과자의견*/                ");
                    pQuery.AppendLine("    ,NULL			AS CONTENT2		/*고과자의견*/                  ");
                    pQuery.AppendLine("   FROM [@KIS_AD00201] A                                             ");
                    pQuery.AppendLine("   LEFT OUTER JOIN  [@KIS_AD00201] B ON A.U_RMK1 = B.Code            ");
                    pQuery.AppendLine("   WHERE  A.CODE = 'HR07'                                            ");
                    #endregion

                    oRS1.DoQuery(pQuery.ToString());

                    for (int jLooper = 0; jLooper < oRS1.RecordCount; jLooper++)
                    {
                        #region  DataSetting_라인
                        string L_DTCD = oRS1.Fields.Item("DTCD").Value.ToString();//객관식 주관식 구분 코드
                        string L_DTNM = oRS1.Fields.Item("DTNM").Value.ToString();//객관식 주관식 구분 내용
                        string L_ABILCD = oRS1.Fields.Item("ABILCD").Value.ToString();//항목
                        string L_ABILNM = oRS1.Fields.Item("ABILNM").Value.ToString();//항목내용
                        string L_COMPOCD = oRS1.Fields.Item("COMPOCD").Value.ToString();//세부항목
                        string L_COMPONM = oRS1.Fields.Item("COMPONM").Value.ToString();//세부항목내용
                        string L_SELVAL = oRS1.Fields.Item("SELVAL").Value.ToString();//결과값
                        string L_SELVALNM = oRS1.Fields.Item("SELVALNM").Value.ToString();//결과값내용
                        string L_CONTENT1 = oRS1.Fields.Item("CONTENT1").Value.ToString();//피고과자의견
                        string L_CONTENT2 = oRS1.Fields.Item("CONTENT2").Value.ToString();//고과자의견
                        #endregion

                        oChild = oChildren.Add();
                        oChild.SetProperty("U_LINENUM", jLooper + 1);
                        oChild.SetProperty("U_DTCD", L_DTCD);
                        oChild.SetProperty("U_DTNM", L_DTNM);
                        oChild.SetProperty("U_ABILCD", L_ABILCD);
                        oChild.SetProperty("U_ABILNM", L_ABILNM);
                        oChild.SetProperty("U_COMPOCD", L_COMPOCD);
                        oChild.SetProperty("U_COMPONM", L_COMPONM);
                        oChild.SetProperty("U_SELVAL", L_SELVAL);
                        oChild.SetProperty("U_SELVALNM", L_SELVALNM);
                        oChild.SetProperty("U_CONTENT1", L_CONTENT1);
                        oChild.SetProperty("U_CONTENT2", L_CONTENT2);
                        oChild.SetProperty("U_EXAMCD", EXAMCD);
                        oRS1.MoveNext();
                    }

                    oRS.MoveNext();
                    oGeneralService.Add(oGeneralData);

                }

            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            finally
            {
                if (KIS_COMMON.GLOBAL.PrograssBarExcute == true)
                {
                    ProgressBar01.Stop();
                    KIS_COMMON.GLOBAL.PrograssBarExcute = false;
                }
                releaseObject(ProgressBar01);
                oCompanyService = null;
            }
            return true;
        }
Ejemplo n.º 42
0
        public virtual bool ET_cboSTATUS_BFClick(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oComboBox = ((SAPbouiCOM.ComboBox)(oForm.Items.Item("cboSTATUS").Specific));
            // ADD YOUR ACTION CODE HERE ...
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            try
            {
                string sql = string.Format(" SELECT U_RMK2 FROM [@KIS_AD00201] WHERE CODE = 'HR01' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'",oForm.Items.Item("cboYEAR").Specific.Value);
                oRS.DoQuery(sql);

                if (!string.IsNullOrEmpty(oRS.Fields.Item("U_RMK2").Value.ToString()))
                    SetComboValue_STATUS(ref oComboBox, FN.Enum_WholeTp.m_Nothing, oRS.Fields.Item("U_RMK2").Value.ToString());
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            finally
            {
                oForm.Items.Item("btnSAVE").Enabled = false;
                STATE = false;
                oRS = null;
            }
            return true;
        }
Ejemplo n.º 43
0
        private bool UDO_Add_Data_HR00220()
        {
            SAPbobsCOM.GeneralService oGeneralService = null;
            SAPbobsCOM.GeneralData oGeneralData = null;
            SAPbobsCOM.GeneralDataParams oGeneralParams = null;
            SAPbobsCOM.GeneralDataCollection oChildren = null;
            SAPbobsCOM.GeneralData oChild = null;
            SAPbobsCOM.CompanyService oCompanyService = (SAPbobsCOM.CompanyService)B1Connections.diCompany.GetCompanyService();
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            StringBuilder pQuery = new StringBuilder();
            string sQry = string.Empty;
            Boolean Status = false;
            string EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;
            int Cnt = 0;
            SAPbouiCOM.ProgressBar ProgressBar01 = B1Connections.theAppl.StatusBar.CreateProgressBar(String.Format("인사고과반영중...(0/{0})", oGrid.DataTable.Rows.Count), oGrid.DataTable.Rows.Count, false);
            KIS_COMMON.GLOBAL.PrograssBarExcute = true;

            try
            {
                EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;
                if (oGrid.DataTable.Rows.Count > 0)
                {

                    for (int i = 0; i < oGrid.DataTable.Rows.Count; i++)
                    {
                        if (KIS_COMMON.GLOBAL.PrograssBarExcute == true)
                        {
                            ProgressBar01.Value++;
                            ProgressBar01.Text = String.Format("인사고과반영중 ... ({0}/{1})", ProgressBar01.Value, oGrid.DataTable.Rows.Count);
                            System.Windows.Forms.Application.DoEvents();
                        }
                        Cnt++;
                        //추가
                        if (oGrid.DataTable.GetValue("U_HEADER", i) == "")
                        {
                            oGeneralService = oCompanyService.GetGeneralService("KIS_HR0220");
                            oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData);

                            #region  DataSetting_헤더
                            string Code = FN.GetMaxCode("@KIS_HR0220M"); ;
                            string Name = Code;
                            string EMPNO = oGrid.DataTable.GetValue("U_EMPNO", i);//사원
                            string EMPNM = oGrid.DataTable.GetValue("U_EMPNM", i);//사원명
                            string DEPTCD = oGrid.DataTable.GetValue("U_DEPTCD", i);//부서코드
                            string DEPTNM = oGrid.DataTable.GetValue("U_DEPTNM", i);//부서명
                            #endregion

                            oGeneralData.SetProperty("Code", Code);
                            oGeneralData.SetProperty("Name", Code);
                            oGeneralData.SetProperty("U_EMPNO", EMPNO);
                            oGeneralData.SetProperty("U_EMPNM", EMPNM);
                            oGeneralData.SetProperty("U_RMK", "");

                            oChildren = oGeneralData.Child("KIS_HR02201");

                            #region  DataSetting_라인쿼리문
                            pQuery.Clear();
                            pQuery.AppendLine("  SELECT                                                     ");
                            pQuery.AppendLine("   B.U_SMLNM		AS U_SMLNM                                  ");
                            pQuery.AppendLine("  ,D.U_SMLNM		AS U_SMLCD                                  ");
                            pQuery.AppendLine("  ,A.U_EMPNO		AS U_EMPNO                                  ");
                            pQuery.AppendLine("  ,A.U_EMPNM		AS U_EMPNM                                  ");
                            pQuery.AppendLine("  ,C.U_DEPTNM		AS U_DEPTNM                             ");
                            pQuery.AppendLine("  ,A.U_LASTSAF	AS U_LASTSAF                                ");
                            pQuery.AppendLine("  ,A.U_LASTGAF	AS U_LASTGAF                                ");
                            pQuery.AppendLine("  ,B.U_RMK1		AS U_RMK1                                   ");
                            pQuery.AppendLine("  ,E.U_EMPNM		AS U_CHKER                                  ");
                            pQuery.AppendLine("  FROM [@KIS_HR0020M_HRD] A                                  ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_AD00201] B ON A.U_EXAMCD = B.U_SMLCD AND B.Code = 'HR01' AND B.U_USEYN = 'Y'  ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_HR00401] C ON A.U_DEPTCD = C.U_DEPTCD                                         ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_AD00201] D ON A.U_DTCD = D.U_SMLCD AND D.Code = 'HR02' AND B.U_USEYN = 'Y'    ");
                            pQuery.AppendLine("  LEFT JOIN [@KIS_HR00901_HRD] E ON E.U_MEMPNO = A.U_EMPNO                                       ");
                            pQuery.AppendLine("  WHERE A.U_EMPNO = '{0}'                                                                        ");
                            sQry = string.Format(pQuery.ToString(), EMPNO);
                            #endregion
                            oRS.DoQuery(sQry);

                            oChild = oChildren.Add();
                            oChild.SetProperty("U_YYYY", oRS.Fields.Item("U_SMLNM").Value);
                            oChild.SetProperty("U_GUBUN", oRS.Fields.Item("U_SMLCD").Value);
                            oChild.SetProperty("U_DEPTNM", oRS.Fields.Item("U_DEPTNM").Value);
                            oChild.SetProperty("U_GRADE", oRS.Fields.Item("U_LASTGAF").Value);
                            oChild.SetProperty("U_SCORE", oRS.Fields.Item("U_LASTSAF").Value);
                            oChild.SetProperty("U_CHKER", oRS.Fields.Item("U_CHKER").Value);
                            oChild.SetProperty("U_VALUATN", oGrid.DataTable.GetValue("LASTG", i));
                            oChild.SetProperty("U_RMK", oRS.Fields.Item("U_RMK1").Value);

                            oGeneralService.Add(oGeneralData);

                        }
                        else
                        {
                            //갱신
                            string KeyAlias = "Code";
                            string KeyValue = oGrid.DataTable.GetValue("U_HEADER", i);

                            oGeneralService = oCompanyService.GetGeneralService("KIS_HR0220");
                            oGeneralParams = (SAPbobsCOM.GeneralDataParams)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams);
                            oGeneralParams.SetProperty(KeyAlias, KeyValue);
                            oGeneralData = oGeneralService.GetByParams(oGeneralParams);
                            oChildren = oGeneralData.Child("KIS_HR02201");

                            string EMPNO = oGrid.DataTable.GetValue("U_EMPNO", i);//사원

                            #region  DataSetting_라인쿼리문
                            pQuery.Clear();
                            pQuery.AppendLine("  SELECT                                                                 ");
                            pQuery.AppendLine("   B.U_SMLNM 			AS U_SMLNM                                      ");
                            pQuery.AppendLine("  ,D.U_SMLNM 			AS U_SMLCD                                      ");
                            pQuery.AppendLine("  ,A.U_EMPNO 			AS U_EMPNO                                      ");
                            pQuery.AppendLine("  ,A.U_EMPNM 			AS U_EMPNM                                      ");
                            pQuery.AppendLine("  ,C.U_DEPTNM			AS U_DEPTNM                                     ");
                            pQuery.AppendLine("  ,A.U_LASTSAF 			AS U_LASTSAF                                    ");
                            pQuery.AppendLine("  ,A.U_LASTGAF 			AS U_LASTGAF                                    ");
                            pQuery.AppendLine("  ,B.U_RMK1				AS U_RMK1                                       ");
                            pQuery.AppendLine("  ,E.U_EMPNM				AS U_CHKER                                      ");
                            pQuery.AppendLine("  FROM [@KIS_HR0020M_HRD] A                                              ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_AD00201] B ON A.U_EXAMCD = B.U_SMLCD AND B.Code = 'HR01' AND B.U_USEYN = 'Y'  ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_HR00401] C ON A.U_DEPTCD = C.U_DEPTCD                                         ");
                            pQuery.AppendLine("  INNER JOIN [@KIS_AD00201] D ON A.U_DTCD = D.U_SMLCD AND D.Code = 'HR02' AND B.U_USEYN = 'Y'    ");
                            pQuery.AppendLine("  LEFT JOIN [@KIS_HR00901_HRD] E ON E.U_MEMPNO = A.U_EMPNO                                       ");
                            pQuery.AppendLine("  WHERE A.U_EMPNO = '{0}'                                                                        ");
                            pQuery.AppendLine("  AND(A.U_EXAMCD = '{1}')                                                                        ");
                            sQry = string.Format(pQuery.ToString(), EMPNO, EXAMCD);
                            #endregion
                            oRS.DoQuery(sQry);
                         
                            if (oGrid.DataTable.GetValue("U_LINE", i) == 0)
                            {
                                oChild = oChildren.Add();
                            }else
                            {
                                oChild = oChildren.Item(oGrid.DataTable.GetValue("U_LINE", i)-1); ;
                            }
                            oChild.SetProperty("U_YYYY", oRS.Fields.Item("U_SMLNM").Value);
                            oChild.SetProperty("U_GUBUN", oRS.Fields.Item("U_SMLCD").Value);
                            oChild.SetProperty("U_DEPTNM", oRS.Fields.Item("U_DEPTNM").Value);
                            oChild.SetProperty("U_GRADE", oRS.Fields.Item("U_LASTGAF").Value);
                            oChild.SetProperty("U_SCORE", oRS.Fields.Item("U_LASTSAF").Value);
                            oChild.SetProperty("U_CHKER", oRS.Fields.Item("U_CHKER").Value);
                            oChild.SetProperty("U_VALUATN", oGrid.DataTable.GetValue("LASTG", i));
                            oChild.SetProperty("U_RMK", oRS.Fields.Item("U_RMK1").Value);
                            
                            oGeneralService.Update(oGeneralData);

                        }
                        //고과 결과 테이블에 업데이트
                        #region 고과결과 업데이트
                        pQuery.Clear();
                        pQuery.AppendLine("  Update [@KIS_HR0020M_HRD] Set U_EGRADE = '{0}'     ");
                        pQuery.AppendLine("  Where U_EXAMCD = '{1}'                             ");
                        pQuery.AppendLine("  AND U_EMPNO = '{2}'                                ");
                        string LastG = oGrid.DataTable.GetValue("LASTG", i).Trim();
                        string EmpNo = oGrid.DataTable.GetValue("U_EMPNO", i).Trim();
                        sQry = string.Format(pQuery.ToString(), LastG, EXAMCD, EmpNo);
                        oRS.DoQuery(sQry);
                        #endregion
                        Status = true;
                    }

                }
                else
                {
                    Status = false;
                }
            }

            catch (Exception ex)
            {                
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                oCompanyService = null;
                return false;
            }
            finally
            {
                if (KIS_COMMON.GLOBAL.PrograssBarExcute == true)
                {
                    ProgressBar01.Stop();
                    KIS_COMMON.GLOBAL.PrograssBarExcute = false;
                }
                releaseObject(ProgressBar01);
                oGeneralData = null;
                oCompanyService = null;
                if (Status == true)
                    B1Connections.theAppl.MessageBox(Cnt + "개의 고과상태 조정완료로 변경", 1, "확인", "", "");
                else
                    B1Connections.theAppl.StatusBar.SetText("저장할 데이터가 없습니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

            }

            return true;
        }
Ejemplo n.º 44
0
        private void SetMatrixValidate(SAPbouiCOM.Form oForm, SAPbouiCOM.Matrix oMatrix, ItemEvent pVal)
        {
            StringBuilder sb = new StringBuilder();
            string strCode = string.Empty;

            string strCardCode = string.Empty;
            string strCardName = string.Empty;
            string strVatRegNo = string.Empty;
            string strVatGroup = string.Empty;
            string strPerson = string.Empty;
            string strEmail = string.Empty;
            try
            {
                oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);


                if (pVal.ColUID == "U_READCD" || pVal.ColUID == "U_CENTCD")
                {
                    strCode = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);

                    if (string.IsNullOrEmpty(strCode))
                    {
                        if (pVal.ColUID == "U_READCD")
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_READNM", "");
                        else
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CENTNM", "");

                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDCD", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDNM", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_SAUPNO", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_VATGRP", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_PERSON", "");
                        oMatrix.SetCellWithoutValidation(pVal.Row, "U_EMAIL", "");
                    }
                    else
                    {
                        sb.AppendLine(" SELECT T1.CardCode                                                           ");
                        sb.AppendLine("      , T1.CardName                                                           ");
                        sb.AppendLine("      , T1.VATRegNum                                                          ");
                        sb.AppendLine("      , T1.ECVatGroup                                                         ");
                        sb.AppendLine("      , T1.CntctPrsn                                                          ");
                        sb.AppendLine("      , T1.E_Mail                                                             ");
                        if (pVal.ItemUID == "mtx1")
                            sb.AppendLine("   FROM [@KIS_SO0030M_HRD] T0 INNER JOIN OCRD T1 ON T0.U_CARDCD = T1.CardCode ");
                        else
                            sb.AppendLine("   FROM [@KIS_SO0040M_HRD] T0 INNER JOIN OCRD T1 ON T0.U_CARDCD = T1.CardCode ");
                        sb.AppendFormat("  WHERE T0.Code = '{0}'                                            ", strCode);

                        oRS.DoQuery(sb.ToString());
                        if (!oRS.EoF)
                        {
                            //string strNowDate = B1Connections.theAppl.Company.ServerDate;

                            string strNowDate = B1Connections.diCompany.GetCompanyDate().ToShortDateString();
                            strNowDate = FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_WRITEDT", FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD));


                            strCardCode = oRS.Fields.Item("CardCode").Value.ToString();
                            strCardName = oRS.Fields.Item("CardName").Value.ToString();
                            strVatRegNo = oRS.Fields.Item("VATRegNum").Value.ToString();
                            strVatGroup = "A0";
                            //strPerson = oRS.Fields.Item("CntctPrsn").Value.ToString();
                            //strEmail = oRS.Fields.Item("E_Mail").Value.ToString();

                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDCD", strCardCode);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CARDNM", strCardName);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_SAUPNO", strVatRegNo);
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_VATGRP", strVatGroup);
                            //oMatrix.SetCellWithoutValidation(pVal.Row, "U_PERSON", strPerson);
                            //oMatrix.SetCellWithoutValidation(pVal.Row, "U_EMAIL", strEmail);
                        }
                    }
                }

                else if (pVal.ColUID == "U_FRDATE")
                {
                    string strDate = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);
                    strDate = DateTimeLibrary.FirstDayOfCurrentMonth(strDate);
                    oMatrix.SetCellWithoutValidation(pVal.Row, "U_FRDATE", FN.SetDateFormatToDB(strDate, FN.eDateType.n_YYYYMMDD));
                    SetMonthCountToMatrix(oForm, oMatrix, pVal.Row);
                }

                else if (pVal.ColUID == "U_TODATE")
                {
                    string strDate = FN.GetMatirxCellValue(ref oMatrix, pVal.ColUID, pVal.Row);
                    strDate = DateTimeLibrary.LastDayOfCurrentMonth(strDate);
                    oMatrix.SetCellWithoutValidation(pVal.Row, "U_TODATE", FN.SetDateFormatToDB(strDate, FN.eDateType.n_YYYYMMDD));
                    SetMonthCountToMatrix(oForm, oMatrix, pVal.Row);
                }
                else if (pVal.ColUID == "U_MONCNT")
                {
                    SetSupplyAmtToMatrix(oForm, oMatrix, pVal.Row);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 45
0
        /// <summary>
        /// 폼(Form)의 아이템들(Items)에 연결이 필요한 데이타소스(DataSource) 형식을 정의합니다.
        /// </summary>
        private void Act2_DataSourcesBinding() {
            // '// ADD YOUR ACTION CODE HERE ...

            #region ComboBox

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

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


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

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

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

            sql = string.Format(" SELECT U_RMK2 FROM [@KIS_AD00201] WHERE CODE = 'HR01' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'",oForm.Items.Item("cboYEAR").Specific.Value);
            oRS.DoQuery(sql);
            oComboBox.Select(oRS.Fields.Item("U_RMK2").Value.ToString(), BoSearchKey.psk_ByValue);

            #endregion

            // 고과대상자
            sql = string.Format(" select COUNT(*) from [@KIS_HR0120M]");
            oRS.DoQuery(sql);
            oForm.Items.Item("edtPERSON").Specific.Value = oRS.Fields.Item(0).Value.ToString();
      
        }
Ejemplo n.º 46
0
        private static void PrintView()
        {
            SAPbouiCOM.Form oForm = B1Connections.theAppl.Forms.ActiveForm;
            SAPbobsCOM.Recordset oRS = null;
            StringBuilder sb = new StringBuilder();
            string strBillNo = string.Empty;
            string strCardCD = string.Empty;
            string strRptFile = string.Empty;
            string strSP = string.Empty;
            string xSQL = string.Empty;
            string strValue = string.Empty;

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

                if (oForm.PaneLevel == 3)
                {
                    oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd3").Specific;

                    //선택한 BILLNO을 출력하기 위해 임시테이블에 저장한다.
                    for (int i = 0; i <= oGrid.DataTable.Rows.Count - 1; i++)
                    {
                        if (oGrid.DataTable.Columns.Item("CHK").Cells.Item(i).Value == CFL.YES_MARK)
                        {
                            strBillNo = FN.GetGridCellValue(ref oGrid, "BILLNO", i).Trim();
                            sb.AppendFormat(",{0}", strBillNo);
                        }

                        strValue = sb.ToString();
                        if (strValue.Length > 0)
                            strValue = strValue.Remove(0, 1);

                    }

                    if (string.IsNullOrEmpty(strValue))


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

                    //리포트경로설정
                    string pStartPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

                    pStartPath = pStartPath.Substring(0, pStartPath.LastIndexOf("\\"));

                    // 사업장 : 1번 선택, 카테고리: --매출(O) 선택
                    xSQL = string.Format("EXEC KIS_SP_SO0230F2_HRD @pBPLID = '{0}' , @pCATEGORY = '{1}', @pPUBLISH_LIST = '{2}' ", "1", "O", strValue);
                    oRS_Report.DoQuery(xSQL);

                    //데이터테이블가져옴.
                    strRptFile = "\\RPT\\KOR\\" + "KIS_SO0230A_HRD.rpt";
                    System.Data.DataTable dt;
                    dt = CFL.SapRecordSetToDataTable(oRS_Report);

                    using (CystalReportViewer rpt = new AddOnBase.CystalReportViewer())
                    {
                        try
                        {
                            rpt.crxReport.Load(pStartPath + strRptFile);
                            rpt.crxReport.SetDataSource(dt);

                            ////리포트파라미터설정
                            //rpt.ShowDialog();
                            rpt.ShowDialog(CFL.GetSBOWindow());
                            //rpt.Show();

                        }
                        catch (Exception ex)
                        {
                            System.Windows.Forms.MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.ToString(), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
                oForm.Freeze(false);
            }
        }
Ejemplo n.º 47
0
        //고과상태변경
        public virtual bool StatusChange(string Status)
        {
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            StringBuilder pQuery = new StringBuilder();
            string sQry = string.Empty;

            EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;

            try
            {

                oComboBox = ((SAPbouiCOM.ComboBox)(oForm.Items.Item("cboSTATUS").Specific));
                if (B1Connections.theAppl.MessageBox(oComboBox.Selected.Description + "로 저장하시겠습니까?", 1, "OK", "NO") == 2)
                {
                    return false;
                }

                if (Status == "U01")
                {
                    #region 고과상태변경
                    pQuery.Clear();
                    pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U01'    ");
                    pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                    pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                    sQry = string.Format(pQuery.ToString(), EXAMCD);
                    oRS.DoQuery(sQry);
                    #endregion

                }
                else if (Status == "U02")
                {
                    string Cnt = FN.GetRecordsetValue(string.Format("SELECT * FROM [@KIS_HR0020M_HRD] WHERE U_EXAMCD = '{0}'", EXAMCD));
                    if (Cnt != "")
                    {
                        if (B1Connections.theAppl.MessageBox("고과마스터가 이미 생성되었습니다로 새로 저장하시겠습니까?", 1, "OK", "NO") == 2)
                        {
                            #region 고과상태변경
                            pQuery.Clear();
                            pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U02'    ");
                            pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                            pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                            sQry = string.Format(pQuery.ToString(), EXAMCD);
                            oRS.DoQuery(sQry);
                            #endregion

                            return false;
                        }
                    }

                    pQuery.Clear();
                    pQuery.AppendLine(" DELETE FROM [@KIS_HR0020M_HRD] WHERE U_EXAMCD = '{0}'  ");
                    pQuery.AppendLine(" DELETE FROM [@KIS_HR00201_HRD] WHERE U_EXAMCD = '{0}'  ");
                    pQuery.AppendLine(" DELETE FROM [@KIS_HR00202_HRD] WHERE U_EXAMCD = '{0}'  ");
                    pQuery.AppendLine(" DELETE FROM [@KIS_HR00203_HRD] WHERE U_EXAMCD = '{0}'  ");
                    pQuery.AppendLine(" DELETE FROM [@KIS_HR00204_HRD] WHERE U_EXAMCD = '{0}'  ");
                    sQry = string.Format(pQuery.ToString(), EXAMCD);
                    oRS.DoQuery(sQry);

                    // 고과 마스터 생성
                    UDO_Add_Data();

                    #region 고과상태변경
                    pQuery.Clear();
                    pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U02'    ");
                    pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                    pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                    sQry = string.Format(pQuery.ToString(), EXAMCD);
                    oRS.DoQuery(sQry);
                    #endregion

                    if (B1Connections.theAppl.MessageBox("고과마스터생성완료", 1, "확인", "", "") == 1)
                    {
                        oForm.Items.Item("btnFIND").Click(BoCellClickType.ct_Regular);
                    }

                }
                else if (Status == "U03")
                {
                    #region 고과상태변경
                    pQuery.Clear();
                    pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U03'    ");
                    pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                    pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                    sQry = string.Format(pQuery.ToString(), EXAMCD);
                    oRS.DoQuery(sQry);
                    #endregion
                    B1Connections.theAppl.MessageBox("고과상태 고과시작으로 변경", 1, "확인", "", "");
                }
                else if (Status == "U08")
                {

                    //점수,등급 계산및 업데이트
                    oRS.DoQuery("EXEC KIS_SP_HR0010B1_HRD '1',0,0");
                    #region 고과상태변경
                    pQuery.Clear();
                    pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U08'    ");
                    pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                    pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                    sQry = string.Format(pQuery.ToString(), EXAMCD);
                    oRS.DoQuery(sQry);
                    #endregion

                    B1Connections.theAppl.MessageBox("고과상태 고과마감으로 변경", 1, "확인", "", "");
                }
                else if (Status == "U09")
                {
                    if (STATE == false)
                    {
                        B1Connections.theAppl.StatusBar.SetText("조회후 저장해주세요", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                        return false;
                    }
                    else
                    {
                        //인사 KIS_HR00220 업데이트
                        UDO_Add_Data_HR00220();
                        #region 고과상태변경
                        pQuery.Clear();
                        pQuery.AppendLine(" UPDATE [@KIS_AD00201] SET U_RMK2 = 'U09'    ");
                        pQuery.AppendLine(" WHERE CODE = 'HR01' AND U_USEYN = 'Y'       ");
                        pQuery.AppendLine(" AND U_SMLCD = '{0}'                         ");
                        sQry = string.Format(pQuery.ToString(), EXAMCD);
                        oRS.DoQuery(sQry);
                        #endregion

                    }
                }                 
            
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oRS = null;
                oGrid = null;
            }
            return true;

        }
Ejemplo n.º 48
0
        private void ClearUnManagedObject()
        {
            if (oComboBox != null) { Marshal.ReleaseComObject(oComboBox); } oComboBox = null;
            if (oGrid != null) { Marshal.ReleaseComObject(oGrid); } oGrid = null;
            if (oUDS != null) { Marshal.ReleaseComObject(oUDS); } oUDS = null;
            //if (gDs.Tables[oForm.UniqueID + "_Deliver"] != null) gDs.Tables[oForm.UniqueID + "_Deliver"] = null;
            //if (gDs.Tables[oForm.UniqueID + "_Call"] != null) gDs.Tables[oForm.UniqueID + "_Call"] = null;
            if (gDs != null)
            {
                if(gDs.Tables.Contains(oForm.UniqueID + "_Deliver"))
                {
                    gDs.Tables.Remove(oForm.UniqueID + "_Deliver");
                }

                if (gDs.Tables.Contains(oForm.UniqueID + "_Call"))
                {
                    gDs.Tables.Remove(oForm.UniqueID + "_Call");
                }
            }
            if (oDB_M != null) { Marshal.ReleaseComObject(oDB_M); } oDB_M = null;
            if (oMatrix != null) { Marshal.ReleaseComObject(oMatrix); } oMatrix = null;
            if (oDB1_O != null) { Marshal.ReleaseComObject(oDB1_O); } oDB1_O = null;
            if (oDB1_Z != null) { Marshal.ReleaseComObject(oDB1_Z); } oDB1_Z = null;
            if (oDB2_O != null) { Marshal.ReleaseComObject(oDB2_O); } oDB2_O = null;
            if (oDB2_Z != null) { Marshal.ReleaseComObject(oDB2_Z); } oDB2_Z = null;
            if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            if (oEditText != null) { Marshal.ReleaseComObject(oEditText); } oEditText = null;

            if ((oForm != null))
            {
                Marshal.ReleaseComObject(oForm);
            }
            oForm = null;
            // ADD YOUR ACTION CODE HERE ...
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Ejemplo n.º 49
0
        private bool UDO_Add_Data()
        {
            SAPbobsCOM.GeneralService oGeneralService = null;
            SAPbobsCOM.GeneralData oGeneralData = null;
            SAPbobsCOM.GeneralDataParams oGeneralParams = null;
            SAPbobsCOM.GeneralDataCollection oChildren = null;
            SAPbobsCOM.GeneralData oChild = null;
            SAPbobsCOM.CompanyService oCompanyService = (SAPbobsCOM.CompanyService)B1Connections.diCompany.GetCompanyService();
            oGrid2 = (SAPbouiCOM.Grid)oForm.Items.Item("grd2").Specific;
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            double GAP = 0;

            try
            {
                EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;
                if (GRIDCODE != "")
                {
                    B1Connections.theAppl.StatusBar.SetText("고과결과조정중..", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);

                    string KeyAlias = "Code";
                    string KeyValue = GRIDCODE;

                    oGeneralService = oCompanyService.GetGeneralService("KIS_HR0020_HRD");
                    oGeneralParams = (SAPbobsCOM.GeneralDataParams)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams);
                    oGeneralParams.SetProperty(KeyAlias, KeyValue);
                    oGeneralData = oGeneralService.GetByParams(oGeneralParams);

                    string SCORE = oForm.Items.Item("edtLASTSAF").Specific.value;      //수정점수
                    string BASESC = "100";       //기본배점
                    oRS.DoQuery("EXEC KIS_SP_HR0010B1_HRD '2','" + SCORE + "','" + BASESC + "'");

                    GAP = Convert.ToDouble(oForm.Items.Item("edtLASTSAF").Specific.value) - Convert.ToDouble(oForm.Items.Item("edtLASTSBF").Specific.value);

                    GAP = GAP / Convert.ToDouble(oRS.Fields.Item("CHEKERCNT").Value);

                    oGeneralData.SetProperty("U_LASTSAF", SCORE);
                    oGeneralData.SetProperty("U_LASTGAF", oRS.Fields.Item("U_SMLNM").Value);
                    oGeneralData.SetProperty("U_SCOREAD", oForm.Items.Item("edtSCOREAD").Specific.value);

                    oChildren = oGeneralData.Child("KIS_HR00201_HRD");
                    
                    for (int i = 0; i < oChildren.Count; i++)
                    {
                        oChild = oChildren.Item(i);
                        oRS.DoQuery("EXEC KIS_SP_HR0010B1_HRD '2','" + Math.Round(oChild.GetProperty("U_LASTSAF") + GAP, 2) + "','" + oChild.GetProperty("U_BASESC") + "'");
                        oChild.SetProperty("U_LASTSAF", Math.Round(oChild.GetProperty("U_LASTSBF") + GAP, 2));
                        oChild.SetProperty("U_LASTGAF", oRS.Fields.Item("U_SMLNM").Value);
                    }

                    oGeneralService.Update(oGeneralData);

                    B1Connections.theAppl.StatusBar.SetText("고과결과조정완료", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }
                else
                {
                    B1Connections.theAppl.StatusBar.SetText("저장할 데이터가 없습니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                oCompanyService = null;
                return false;
            }

            oRS = null;
            oGrid2 = null;
            oGeneralData = null;
            oCompanyService = null;
            oGeneralParams = null;
            return true;
        }
Ejemplo n.º 50
0
        /// <summary>
        /// 추가모드전환시 자동으로 생성가능한 년월을 가져온다.
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool SetYyyyMm_NextValue(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;
            string strYyyyMm = string.Empty;
            string strDate = string.Empty;
            string strDesc = string.Empty;
            string strValue = string.Empty;
            string strPerson = string.Empty;

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

            try
            {
                strYyyyMm = FN.GetItemValue(ref oForm, "edtYYYYMM");
                strPerson = B1Connections.diCompany.UserName;

                sb = new StringBuilder();
                sb.AppendLine(" SELECT ISNULL ( (SELECT CONVERT (NVARCHAR (6), DATEADD (MM, 1, CONVERT (DATE, U_YYYYMM + '01')), 112)  ");
                sb.AppendLine("                    FROM (SELECT U_YYYYMM, ROW_NUMBER () OVER (ORDER BY U_YYYYMM DESC) AS RegSeq        ");
                sb.AppendLine("                            FROM [@KIS_SO0400T_HRD]                                                     ");
                sb.AppendFormat("                           WHERE Status = 'O' AND U_PERSON = '{0}') AS x                   ", strPerson);
                sb.AppendLine("                   WHERE RegSeq = 1)                                                                    ");
                sb.AppendLine("              , CONVERT (NVARCHAR (6), GETDATE (), 112))                                                ");
                sb.AppendLine("           AS U_YYYYMM                                                                                  ");

                oRS.DoQuery(sb.ToString());
                if (!oRS.EoF)
                {
                    strValue = oRS.Fields.Item("U_YYYYMM").Value.ToString();
                    oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0400T_HRD");
                    oDB_M.SetValue("U_YYYYMM", 0, strValue);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
            return rtnValue;
        }
Ejemplo n.º 51
0
        /// <summary>
        /// 폼(Form)의 아이템들(Items)에 연결이 필요한 데이타소스(DataSource) 형식을 정의합니다.
        /// </summary>
        private void Act2_DataSourcesBinding() {
            // '// ADD YOUR ACTION CODE HERE ...

            #region EditText
            string ItemUID = "";

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

            #endregion

            #region ComboBox

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

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

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

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

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

            #endregion

            #region ChooseFromList

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

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

            #endregion      
        }
Ejemplo n.º 52
0
        private void ClearUnManagedObject()
        {
            if (oDB_M != null) { Marshal.ReleaseComObject(oDB_M); } oDB_M = null;
            if (oDB_1 != null) { Marshal.ReleaseComObject(oDB_1); } oDB_1 = null;
            if (oUDS != null) { Marshal.ReleaseComObject(oUDS); } oUDS = null;
            if (oButton != null) { Marshal.ReleaseComObject(oButton); } oButton = null;
            if (oMatrix != null) { Marshal.ReleaseComObject(oMatrix); } oMatrix = null;
           
            if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            if (oEditText != null) { Marshal.ReleaseComObject(oEditText); } oEditText = null;

            if ((pForm != null)) { Marshal.ReleaseComObject(pForm); } pForm = null;
            if ((oForm != null)) { Marshal.ReleaseComObject(oForm); } oForm = null;
            // ADD YOUR ACTION CODE HERE ...
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Ejemplo n.º 53
0
        /// <summary>
        /// 사원코드로 사원 정보를 조회한다.
        /// </summary>
        /// <param name="pQueryType"></param>
        /// <param name="pEmpNo"></param>
        /// <returns></returns>
        private string GetEmployeeInfo(SO.SO_COMMON_HRD.QueryType_Employee pQueryType, string pEmpNo)
        {
            string rtnValue = string.Empty;
            StringBuilder sb = new StringBuilder();
            try
            {
                if (!string.IsNullOrEmpty(pEmpNo))
                {
                    oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

                    sb.AppendLine(" SELECT TOP 1                                        ");
                    sb.AppendLine("        T0.empID                                     ");
                    sb.AppendLine("      , T0.lastName                                  ");
                    sb.AppendLine("      , ISNULL (T1.Name, '') AS deptName             ");
                    sb.AppendLine("      , ISNULL (T2.name, '') AS PositionName         ");
                    sb.AppendLine("   FROM OHEM T0                                      ");
                    sb.AppendLine("        LEFT JOIN OUDP T1 ON T0.dept = T1.Code       ");
                    sb.AppendLine("        LEFT JOIN OHPS T2 ON T0.position = T2.posID  ");
                    sb.AppendFormat("  WHERE T0.U_EMPNO = '{0}'                 ", pEmpNo);

                    oRS.DoQuery(sb.ToString());
                    if (!oRS.EoF)
                    {
                        if (pQueryType == SO.SO_COMMON_HRD.QueryType_Employee.OHEM_Id)
                            rtnValue = oRS.Fields.Item("empID").Value.ToString();

                        else if (pQueryType == SO.SO_COMMON_HRD.QueryType_Employee.Emp_Name)
                            rtnValue = oRS.Fields.Item("lastName").Value.ToString();

                        else if (pQueryType == SO.SO_COMMON_HRD.QueryType_Employee.Dept_Name)
                            rtnValue = oRS.Fields.Item("deptName").Value.ToString();

                        else if (pQueryType == SO.SO_COMMON_HRD.QueryType_Employee.Postion_Name)
                            rtnValue = oRS.Fields.Item("PositionName").Value.ToString();
                        else
                            rtnValue = "";
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return rtnValue;
        }
Ejemplo n.º 54
0
        public void SetTextApply(SAPbouiCOM.Form oForm)
        {
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            try
            {
                oForm.Freeze(true);

                string cboYEAR = oForm.DataSources.UserDataSources.Item("cboYEAR").Value;
                string cboDTCD = oForm.DataSources.UserDataSources.Item("cboDTCD").Value;

                StringBuilder pQuery = new StringBuilder();
                string query = string.Empty;

                pQuery.AppendLine(" EXEC KIS_SP_HR0140F_HRD               ");
                pQuery.AppendLine("         @cboYEAR		 = '{0}'      ");
                pQuery.AppendLine("        ,@cboDTCD		 = '{1}'      ");

                string sQry = string.Format(pQuery.ToString(), cboYEAR, cboDTCD);
                oRS.DoQuery(sQry);

                //직무만족도
                #region sttHR05

                //업무의양
                #region sttHR0501
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0501").Specific; oStatic.Caption = oRS.Fields.Item("HR0501").Value.ToString();
                //oForm.Items.Item("sttHR0501").TextStyle = (int)BoTextStyle.ts_UNDERLINE;
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0511").Specific; oStatic.Caption = oRS.Fields.Item("HR0511").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0521").Specific; oStatic.Caption = oRS.Fields.Item("HR0521").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0531").Specific; oStatic.Caption = oRS.Fields.Item("HR0531").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0541").Specific; oStatic.Caption = oRS.Fields.Item("HR0541").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0551").Specific; oStatic.Caption = oRS.Fields.Item("HR0551").Value.ToString();
                #endregion

                //업무의양 비율
                #region sttHR05011
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05111").Specific; oStatic.Caption = oRS.Fields.Item("HR05111").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05211").Specific; oStatic.Caption = oRS.Fields.Item("HR05211").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05311").Specific; oStatic.Caption = oRS.Fields.Item("HR05311").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05411").Specific; oStatic.Caption = oRS.Fields.Item("HR05411").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05511").Specific; oStatic.Caption = oRS.Fields.Item("HR05511").Value.ToString();
                #endregion

                //업무난이도
                #region sttHR0502
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0502").Specific; oStatic.Caption = oRS.Fields.Item("HR0502").Value.ToString();
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0512").Specific; oStatic.Caption = oRS.Fields.Item("HR0512").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0522").Specific; oStatic.Caption = oRS.Fields.Item("HR0522").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0532").Specific; oStatic.Caption = oRS.Fields.Item("HR0532").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0542").Specific; oStatic.Caption = oRS.Fields.Item("HR0542").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0552").Specific; oStatic.Caption = oRS.Fields.Item("HR0552").Value.ToString();
                #endregion

                //업무난이도 비율
                #region sttHR05021
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05121").Specific; oStatic.Caption = oRS.Fields.Item("HR05121").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05221").Specific; oStatic.Caption = oRS.Fields.Item("HR05221").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05321").Specific; oStatic.Caption = oRS.Fields.Item("HR05321").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05421").Specific; oStatic.Caption = oRS.Fields.Item("HR05421").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05521").Specific; oStatic.Caption = oRS.Fields.Item("HR05521").Value.ToString();
                #endregion

                //적성적합도
                #region sttHR0503
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0503").Specific; oStatic.Caption = oRS.Fields.Item("HR0503").Value.ToString();
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0513").Specific; oStatic.Caption = oRS.Fields.Item("HR0513").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0523").Specific; oStatic.Caption = oRS.Fields.Item("HR0523").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0533").Specific; oStatic.Caption = oRS.Fields.Item("HR0533").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0543").Specific; oStatic.Caption = oRS.Fields.Item("HR0543").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0553").Specific; oStatic.Caption = oRS.Fields.Item("HR0553").Value.ToString();
                #endregion

                //적성적합도 비율
                #region sttHR05031
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05131").Specific; oStatic.Caption = oRS.Fields.Item("HR05131").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05231").Specific; oStatic.Caption = oRS.Fields.Item("HR05231").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05331").Specific; oStatic.Caption = oRS.Fields.Item("HR05331").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05431").Specific; oStatic.Caption = oRS.Fields.Item("HR05431").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR05531").Specific; oStatic.Caption = oRS.Fields.Item("HR05531").Value.ToString();
                #endregion

                #endregion

                
                //조직만족도
                #region sttHR06

                //상하간의 의사소통
                #region sttHR0601
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0601").Specific; oStatic.Caption = oRS.Fields.Item("HR0601").Value.ToString();
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0611").Specific; oStatic.Caption = oRS.Fields.Item("HR0611").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0621").Specific; oStatic.Caption = oRS.Fields.Item("HR0621").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0631").Specific; oStatic.Caption = oRS.Fields.Item("HR0631").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0641").Specific; oStatic.Caption = oRS.Fields.Item("HR0641").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0651").Specific; oStatic.Caption = oRS.Fields.Item("HR0651").Value.ToString();
                #endregion

                //상하간의 의사소통 비율
                #region sttHR06011
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06111").Specific; oStatic.Caption = oRS.Fields.Item("HR06111").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06211").Specific; oStatic.Caption = oRS.Fields.Item("HR06211").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06311").Specific; oStatic.Caption = oRS.Fields.Item("HR06311").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06411").Specific; oStatic.Caption = oRS.Fields.Item("HR06411").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06511").Specific; oStatic.Caption = oRS.Fields.Item("HR06511").Value.ToString();
                #endregion

                //복리후생제도
                #region sttHR0602
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0602").Specific; oStatic.Caption = oRS.Fields.Item("HR0602").Value.ToString();
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0612").Specific; oStatic.Caption = oRS.Fields.Item("HR0612").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0622").Specific; oStatic.Caption = oRS.Fields.Item("HR0622").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0632").Specific; oStatic.Caption = oRS.Fields.Item("HR0632").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0642").Specific; oStatic.Caption = oRS.Fields.Item("HR0642").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0652").Specific; oStatic.Caption = oRS.Fields.Item("HR0652").Value.ToString();
                #endregion

                //복리후생제도 비율
                #region sttHR06021
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06121").Specific; oStatic.Caption = oRS.Fields.Item("HR06121").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06221").Specific; oStatic.Caption = oRS.Fields.Item("HR06221").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06321").Specific; oStatic.Caption = oRS.Fields.Item("HR06321").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06421").Specific; oStatic.Caption = oRS.Fields.Item("HR06421").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06521").Specific; oStatic.Caption = oRS.Fields.Item("HR06521").Value.ToString();
                #endregion

                //미래비전
                #region sttHR0603
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0603").Specific; oStatic.Caption = oRS.Fields.Item("HR0603").Value.ToString();
                //대단히많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0613").Specific; oStatic.Caption = oRS.Fields.Item("HR0613").Value.ToString();
                //많다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0623").Specific; oStatic.Caption = oRS.Fields.Item("HR0623").Value.ToString();
                //보통이다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0633").Specific; oStatic.Caption = oRS.Fields.Item("HR0633").Value.ToString();
                //적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0643").Specific; oStatic.Caption = oRS.Fields.Item("HR0643").Value.ToString();
                //대단히적다
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR0653").Specific; oStatic.Caption = oRS.Fields.Item("HR0653").Value.ToString();
                #endregion

                //미래비전 비율
                #region sttHR06031
                //대단히많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06131").Specific; oStatic.Caption = oRS.Fields.Item("HR06131").Value.ToString();
                //많다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06231").Specific; oStatic.Caption = oRS.Fields.Item("HR06231").Value.ToString();
                //보통이다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06331").Specific; oStatic.Caption = oRS.Fields.Item("HR06331").Value.ToString();
                //적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06431").Specific; oStatic.Caption = oRS.Fields.Item("HR06431").Value.ToString();
                //대단히적다 비율
                oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("sttHR06531").Specific; oStatic.Caption = oRS.Fields.Item("HR06531").Value.ToString();
                #endregion

                #endregion


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

            finally
            {
                oForm.Freeze(false);
                oRS = null;
                oStatic = null;

            }

        }
Ejemplo n.º 55
0
        private void ClearUnManagedObject()
        {
            if (oFolder != null) { Marshal.ReleaseComObject(oFolder); } oFolder = null;
            if (oComboBox != null) { Marshal.ReleaseComObject(oComboBox); } oComboBox = null;
            if (oOptionBtn != null) { Marshal.ReleaseComObject(oOptionBtn); } oOptionBtn = null;
            if (oGrid != null) { Marshal.ReleaseComObject(oGrid); } oGrid = null;

            if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            if (oUDS != null) { Marshal.ReleaseComObject(oUDS); } oUDS = null;
            if (oEditText != null) { Marshal.ReleaseComObject(oEditText); } oEditText = null;
            if (oButton != null) { Marshal.ReleaseComObject(oButton); } oButton = null;
            if (oForm != null) { Marshal.ReleaseComObject(oForm); } oForm = null;

            // ADD YOUR ACTION CODE HERE ...
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Ejemplo n.º 56
0
        private static void PrintView()
        {
            SAPbouiCOM.Form oForm = B1Connections.theAppl.Forms.ActiveForm;
            StringBuilder sb = new StringBuilder();

            string edtFRDT = string.Empty;
            string edtTODT = string.Empty;

            string cboPAPERTP = string.Empty;

            SAPbobsCOM.Recordset oRS;
            string strReportFiles = string.Empty;

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


                string edtDOCDTF = oForm.DataSources.UserDataSources.Item("edtDOCDTF").Value;
                string edtDOCDTT = oForm.DataSources.UserDataSources.Item("edtDOCDTT").Value;
                string cboPUBLICA = oForm.DataSources.UserDataSources.Item("cboPUBLICA").Value;
                string cboITMGRP = oForm.DataSources.UserDataSources.Item("cboITMGRP").Value;
                string cboPRCCD = oForm.DataSources.UserDataSources.Item("cboPRCCD").Value;
                string edtCARDCDF = oForm.DataSources.UserDataSources.Item("edtCARDCDF").Value;
                string edtSALDTF = oForm.DataSources.UserDataSources.Item("edtSALDTF").Value;
                string edtSALDTT = oForm.DataSources.UserDataSources.Item("edtSALDTT").Value;
                string edtBPCD = oForm.DataSources.UserDataSources.Item("edtBPCD").Value;

                sb.Append(" EXEC [KIS_SP_SD0120F_HRD]                ");
                sb.Append(" 	   @edtDOCDTF	= '{0}'	             ");
                sb.Append(" 	  ,@edtDOCDTT	= '{1}'	             ");
                sb.Append(" 	  ,@cboPUBLICA = '{2}'	             ");
                sb.Append(" 	  ,@cboITMGRP = '{3}'		         ");
                sb.Append(" 	  ,@cboPRCCD = '{4}'		         ");
                sb.Append(" 	  ,@edtCARDCDF = '{5}'	             ");
                sb.Append(" 	  ,@edtSALDTF = '{6}'	             ");
                sb.Append(" 	  ,@edtSALDTT = '{7}'	             ");
                sb.Append(" 	  ,@edtBPCD = '{8}'	                 ");

                oRS.DoQuery(string.Format(sb.ToString(), edtDOCDTF, edtDOCDTT, cboPUBLICA, cboITMGRP, cboPRCCD, edtCARDCDF, edtSALDTF, edtSALDTT, edtBPCD));

                strReportFiles = "\\RPT\\KOR\\KIS_SD0120F_HRD.RPT";

                if (!oRS.EoF)
                {

                    //리포트경로설정
                    string pStartPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
                    pStartPath = pStartPath.Substring(0, pStartPath.LastIndexOf("\\"));

                    //데이터테이블가져옴.
                    System.Data.DataTable dt = FN.GetRecordsetToDataTable(string.Format(sb.ToString(), edtDOCDTF, edtDOCDTT, cboPUBLICA, cboITMGRP, cboPRCCD, edtCARDCDF, edtSALDTF, edtSALDTT, edtBPCD));
                    //dt = FN.SapRecordSetToDataTable(oRS);


                    using (CystalReportViewer rpt = new AddOnBase.CystalReportViewer())
                    {
                        try
                        {
                            rpt.crxReport.Load(pStartPath + strReportFiles);
                            rpt.crxReport.SetDataSource(dt);

                            //리포트파라미터설정
                            for (int i = 0; i <= rpt.crxReport.DataDefinition.FormulaFields.Count - 1; i++)
                            {
                                switch (rpt.crxReport.DataDefinition.FormulaFields[i].Name)
                                {
                                    case "DOCDT":
                                        rpt.crxReport.DataDefinition.FormulaFields[i].Text = "'" + edtSALDTF + " ~ " + edtSALDTT + "'";
                                        break;

                                    //case "CLTNAM":
                                    //    rpt.crxReport.DataDefinition.FormulaFields[i].Text = "'" + B1Connections.diCompany.CompanyName + "'";
                                    //    break;
                                    //case "PRTLMT":
                                    //    rpt.crxReport.DataDefinition.FormulaFields[i].Text = "'" + strFrDate + " ~ " + strToDate + "'";
                                    //    break;
                                }
                            }

                            rpt.ShowDialog(CFL.GetSBOWindow());

                        }
                        catch (Exception ex)
                        {
                            B1Connections.theAppl.StatusBar.SetText("PrintView " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                        }
                    }
                }
                else
                    B1Connections.theAppl.StatusBar.SetText("출력 데이터가 존재 하지 않습니다. ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText("ET_btnPrt_AFItemPressed " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

            }
            finally
            {
                //oForm.Freeze(false);
            }
        }
Ejemplo n.º 57
0
        public virtual void ET_btnISSUE_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnISSUE").Specific));
            // ADD YOUR ACTION CODE HERE ...

            StringBuilder sb = new StringBuilder();
            string strType = string.Empty;
            string strYyyyMm = string.Empty;
            string strCode = string.Empty;
            string strValue = string.Empty;
            string xSQL = string.Empty;
            string strBillType = string.Empty;
            string strIssueDate = string.Empty;

            try
            {
                if (oForm.PaneLevel == 1)
                    oGrid = (SAPbouiCOM.Grid)(oForm.Items.Item("grd1").Specific);
                else if (oForm.PaneLevel == 2)
                    oGrid = (SAPbouiCOM.Grid)(oForm.Items.Item("grd2").Specific);

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

                int rowidx = -1;

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

                    if (oGrid.DataTable.Columns.Item("CHK").Cells.Item(rowidx).Value == CFL.YES_MARK)
                    {
                        //strType = FN.GetGridCellValue(ref oGrid, "DOCTP", rowidx).Trim();
                        //strDocEntry = FN.GetGridCellValue(ref oGrid, "DOCENTRY", rowidx).Trim();
                        //strLineID = FN.GetGridCellValue(ref oGrid, "LINEID", rowidx).Trim();
                        strType = oGrid.DataTable.GetValue("DOCTP", rowidx).ToString().Trim();
                        strYyyyMm = oGrid.DataTable.GetValue("YYYYMM", rowidx).ToString().Trim();
                        strCode = oGrid.DataTable.GetValue("CODE", rowidx).ToString().Trim();

                        sb.AppendFormat(",{0}:{1}:{2}", strType, strYyyyMm, strCode);
                    }
                }

                if (oForm.PaneLevel == 1)
                    strBillType = "A"; // 미발행에서 발행
                else if (oForm.PaneLevel == 2)
                    strBillType = "M"; //수기발행에서 발행

                strIssueDate = oForm.DataSources.UserDataSources.Item("edtISSUEDT").ValueEx;

                strValue = sb.ToString();
                if (strValue.Length > 0)
                    strValue = strValue.Remove(0, 1);

                xSQL = string.Format("EXEC KIS_SP_SO0230B1_HRD @pBILL_TYPE = '{0}', @pISSUE_DATE = '{1}', @pBILL_LIST = '{2}', @pUserSign = {3} ", strBillType, strIssueDate, strValue, B1Connections.diCompany.UserSignature.ToString());
                oRS.DoQuery(xSQL);
                B1Connections.theAppl.StatusBar.SetText("계산서 발행이 완료 되었습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);

                FindData(oForm);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oGrid = null;
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
        }
Ejemplo n.º 58
0
        public virtual void ET_btnCANCLE_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnCANCLE").Specific));
            // ADD YOUR ACTION CODE HERE ...
            string strValue = string.Empty;
            string strBillNo = string.Empty;
            string xSQL = string.Empty;

            StringBuilder sb = new StringBuilder();
            try
            {
                oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oGrid = (SAPbouiCOM.Grid)(oForm.Items.Item("grd3").Specific);
                for (int i = 0; i <= oGrid.DataTable.Rows.Count - 1; i++)
                {
                    if (oGrid.DataTable.Columns.Item("CHK").Cells.Item(i).Value == CFL.YES_MARK)
                    {
                        strBillNo = FN.GetGridCellValue(ref oGrid, "BILLNO", i).Trim();

                        if (FN.GetGridCellValue(ref oGrid, "DTINO", i) != "")
                        {
                            //SY: 전송, CY:고객수락 인건은 발행취소하지 못한다.
                            if (FN.GetGridCellValue(ref oGrid, "DTSTAT", i) == "CY" || FN.GetGridCellValue(ref oGrid, "DTSTAT", i) == "SY")
                            {
                                B1Connections.theAppl.StatusBar.SetText(string.Format("계산서번호[{0}] 는 전자계산서가 발행되어 취소 할 수 없습니다.", strBillNo), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                continue;
                            }
                        }

                        sb.AppendFormat(",'{0}'", strBillNo);
                    }
                }

                strValue = sb.ToString();
                if (strValue.Length > 0)
                {
                    strValue = strValue.Remove(0, 1);

                    xSQL = string.Format(" DELETE [@KIS_SO0230T_HRD] WHERE U_BILLNO IN ({0})  DELETE [@KIS_SO02301_HRD] WHERE U_BILLNO IN ({0})", strValue);
                    oRS.DoQuery(xSQL);
                    B1Connections.theAppl.StatusBar.SetText("발행 취소가 완료 되었습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);

                    FindData(oForm);
                }

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oGrid = null;
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
        }
Ejemplo n.º 59
0
        public virtual bool ET_1_BFClick(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)
            {
                SAPbobsCOM.Recordset oRS = null;
                oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                string Code = oForm.Items.Item("Code").Specific.value.Trim();
                string sQry = "";
                sQry = "Select * From [@KIS_FI0020M_HRD] Where Code = '" + Code + "'";
                oRS.DoQuery(sQry);
                    
                if (oRS.RecordCount > 0)
                {
                    B1Connections.theAppl.StatusBar.SetText("해당 기준년도가 존재합니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); //데이터 조회중입니다             
                    return false;
                }
                if (!GetMonth())
                    return false;
            }

            return true;
        }
Ejemplo n.º 60
0
        /// <summary>
        /// 청구조정 매출취소전 체크
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool BeforeCancle_ValidationCheck(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;
            string strPerson = string.Empty;
            string strYyyyMm = string.Empty;
            string strDate = string.Empty;
            string strDesc = string.Empty;
            string strValue = string.Empty;

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

            try
            {
                strYyyyMm = FN.GetItemValue(ref oForm, "edtYYYYMM");
                strPerson = B1Connections.diCompany.UserName;

                sb = new StringBuilder();
                sb.AppendLine(" SELECT U_YYYYMM                                                                 ");
                sb.AppendLine("   FROM (SELECT U_YYYYMM, ROW_NUMBER () OVER (ORDER BY U_YYYYMM DESC) AS RegSeq  ");
                sb.AppendLine("           FROM [@KIS_SO0400T_HRD]                                               ");
                sb.AppendFormat("          WHERE Status = 'O' AND U_PERSON = '{0}') AS x             ", strPerson);
                sb.AppendLine("  WHERE RegSeq = 1                                                               ");

                oRS.DoQuery(sb.ToString());
                if (!oRS.EoF)
                {
                    strValue = oRS.Fields.Item("U_YYYYMM").Value.ToString();
                    if (strYyyyMm.CompareTo(strValue) >= 0)
                    {
                        rtnValue = true;
                    }
                    else
                    {
                        B1Connections.theAppl.StatusBar.SetText("청구마감월 이후에 생성된 문서가 존재 합니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        rtnValue = false;
                    }
                }
                else
                    rtnValue = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
            }
            return rtnValue;
        }