}//fin FormEvent

        private void Distribuir()
        {
            Int64 iFolio;
            Int64 iDesde;
            Int64 iHasta;
            Int32 i;

            SAPbouiCOM.EditText oEditText;

            try
            {
                oMtx.Clear();
                oMtx.FlushToDataSource();
                oEditText = (EditText)(oForm.Items.Item("Desde").Specific);
                iDesde    = Convert.ToInt64((System.String)(oEditText.Value), _nf);
                oEditText = (EditText)(oForm.Items.Item("Hasta").Specific);
                iHasta    = Convert.ToInt64((System.String)(oEditText.Value), _nf);
                if (iDesde <= 0)
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar Folio desde", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else if (iHasta <= 0)
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar Folio hasta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else if (iDesde >= iHasta)
                {
                    FSBOApp.StatusBar.SetText("Ingrese rango Folio correcto", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    i = 0;
                    for (iFolio = iDesde; iFolio <= iHasta; iFolio++)
                    {
                        oDBDSD.InsertRecord(i);
                        oDBDSD.SetValue("U_Folio", i, Convert.ToString(iFolio));
                        oDBDSD.SetValue("U_Estado", i, "D");
                        i++;
                    }

                    if (Convert.ToDouble((System.String)(oDBDSD.GetValue("U_Folio", i)), _nf) == 0)
                    {
                        oDBDSD.RemoveRecord(i);
                    }

                    oMtx.LoadFromDataSource();
                    oColumn = oMtx.Columns.Item("Folio");
                    oColumn.TitleObject.Sortable = true;
                    oColumn.TitleObject.Sort(SAPbouiCOM.BoGridSortType.gst_Ascending);
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("Distribuir: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin Distribuir
        }//fin InitForm

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

            SAPbouiCOM.DataTable oDataTable;
            String sValue, sValue1;

            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        //BubbleEvent := ValidarDatosFE();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    if (pVal.ColUID == "V_0")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = (System.String)(oDataTable.GetValue("Code", 0));
                            sValue1 = (System.String)(oDataTable.GetValue("Name", 0));

                            oMtx.FlushToDataSource();
                            oDBDSD.SetValue("U_Indicato", pVal.Row - 1, sValue);
                            oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1);
                            if (pVal.Row == oMtx.RowCount)
                            {
                                oDBDSD.InsertRecord(pVal.Row);
                            }
                            oMtx.LoadFromDataSource();
                            oMtx.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Beispiel #3
0
        }//fin InitForm

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

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

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                {
                    if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)) && (pVal.BeforeAction))
                    {
                        BubbleEvent = false;
                        if (Limpiar())
                        {
                            GuardarRegistros();
                            oMtx.FlushToDataSource();
                            i = oMtx.RowCount + 1;
                            oMtx.AddRow(1, i);
                            oEditText       = (EditText)(oMtx.Columns.Item("Code").Cells.Item(i).Specific);
                            oEditText.Value = "";

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

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


                            oSetting = oMtx.CommonSetting;
                            i        = 1;
                            while (i < oMtx.RowCount)
                            {
                                if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "")
                                {
                                    oSetting.SetCellEditable(i, 1, false);
                                }
                                i++;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin MenuEvent

        private void GuardarRegistros()
        {
            TFunctions Reg;
            Int32      i;
            Int32      DocEntryAsig;
            String     User, Pass;

            try
            {
                if (ValidarMatrix())
                {
                    Reg       = new TFunctions();
                    Reg.SBO_f = FSBOf;
                    oMtx.FlushToDataSource();
                    FCmpny.StartTransaction();

                    i = 0;
                    while (i < oMtx.RowCount)
                    {
                        User = (System.String)(oDBDSH.GetValue("U_Usuario", i));

                        Pass = (System.String)(oDBDSH.GetValue("U_Password", i));
                        //s = Reg.Encriptar(Pass);
                        oDBDSH.SetValue("U_Password", i, Pass);

                        if ((System.String)(oDBDSH.GetValue("DocEntry", i)) == "")
                        {
                            DocEntryAsig = Reg.FEMultiSocAdd((System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i)));
                            oDBDSH.SetValue("DocEntry", i, DocEntryAsig.ToString());
                        }
                        else
                        {
                            Reg.FEMultiSocUpt((System.String)(oDBDSH.GetValue("DocEntry", i)), (System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i)));
                        }

                        //oDBDSH.SetValue("U_Password", i, Pass);
                        i++;
                    }
                    FCmpny.EndTransaction(BoWfTransOpt.wf_Commit);
                    oDBDSH.InsertRecord(i);
                    oMtx.LoadFromDataSource();
                    oMtx.AutoResizeColumns();
                    FSBOApp.StatusBar.SetText("Sociedades registradas satisfactoriamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
        }//fin GuardarRegistros
Beispiel #5
0
        private void ProcessPosting()
        {
            mtWO.FlushToDataSource();
            for (int i = 0; i < dtWebO.Rows.Count; i++)
            {
                string sel = dtWebO.GetValue("sel", i).ToString();
                if (sel == "Y")
                {
                    clearOrderInfo();
                    string webId = dtWebO.GetValue("WebNum", i).ToString();;
                    //try
                    //{
                    addWebOrder(webId);
                    postDocument();
                    //}
                    //catch (Exception ex)
                    //{
                    //    oApplication.StatusBar.SetText("Error adding order " + webId + " \n\r " + ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);

                    //}
                }
            }

            oApplication.StatusBar.SetText("Process completed", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
            getOrders();
        }
Beispiel #6
0
        private void updateModuleSetup()
        {
            mtAddon.FlushToDataSource();
            string updateAddon = "";

            for (int i = 0; i < dtHead.Rows.Count; i++)
            {
                updateAddon += "Update [@B1_MODULES] set U_LicenseKey='" + dtHead.GetValue("LK", i).ToString() + "',U_Enabled='" + dtHead.GetValue("Active", i).ToString() + "' where Code='" + dtHead.GetValue("AC", i).ToString() + "' ;";
            }



            int result = Program.objHrmsUI.ExecQuery(updateAddon, "Updating Module Setup");

            saveSettings();
            Program.objHrmsUI.createConfigurationTables();
            Program.objHrmsUI.loadSettings();
            Program.objHrmsUI.loadAddons();
        }
Beispiel #7
0
        private void AddPrefix()
        {
            //int i = 0;
            EditText oEditText = null;
            string   newPhone  = String.Empty;

            oItem     = oForm.Items.Item("txtPhone");
            oEditText = (EditText)oItem.Specific;

            oMatrix.FlushToDataSource();

            oDBDataSource = oForm.DataSources.DBDataSources.Item("OCRD");

            for (int i = 0; i <= oDBDataSource.Size - 1; i++)
            {
                newPhone = oDBDataSource.GetValue("Phone1", i);
                newPhone = newPhone.Trim(Char.Parse(" "));
                oDBDataSource.SetValue("Phone1", 1, oEditText.String + newPhone);
            }
            oMatrix.LoadFromDataSource();
        }
Beispiel #8
0
        public virtual void ET_mtx2_AFChooseFromList(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx2").Specific));
            // ADD YOUR ACTION CODE HERE ...
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.DataTable oDataTable = oCFLEvento.SelectedObjects;
            bool bModify = false;

            try
            {
                switch (pVal.ColUID)
                {
                    case "U_CENTCD"://지국
                        if (oDataTable != null)
                        {
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CENTCD", oDataTable.GetValue("Code", 0).ToString());
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_CENTNM", oDataTable.GetValue("Name", 0).ToString());
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_PERSON", oDataTable.GetValue("U_BRCMNG", 0).ToString()); //지국장명
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_EMAIL", oDataTable.GetValue("U_EMAIL", 0).ToString()); // 메일
                            oMatrix.SetCellWithoutValidation(pVal.Row, "U_VATGRP", "A0");

                            SetMatrixValidate(oForm, oMatrix, pVal);
                            bModify = true;
                        }
                        break;
                    default:
                        break;
                }

                if (bModify)
                {
                    if (oForm.Mode == BoFormMode.fm_OK_MODE)
                    {
                        oMatrix.FlushToDataSource();
                        oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oCFLEvento = null;
                oDataTable = null;
            }
        }
Beispiel #9
0
        private void SetItemEnabled(SAPbouiCOM.Form oForm)
        {
            string strTransID = string.Empty;
            string strRejTran = string.Empty;
            string strStatus = string.Empty;
            string strAcctCd = string.Empty;
            string strTYPE = string.Empty;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
                strTransID = oDB_M.GetValue("U_JDTDOC", 0).Trim();
                strRejTran = oDB_M.GetValue("U_RJDTDOC", 0).Trim();
                strTYPE = oDB_M.GetValue("U_TYPE", 0).Trim();

                oCheckBox = (SAPbouiCOM.CheckBox)oForm.Items.Item("chkACCTIN").Specific;
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;

                FN.SetAutoManagedAttribute(ref oForm, "edtDOCNUM,cboTYPE,edtCENTCD,edtCENTNM,cboSTATUS,edtDOCDT,cboMETHOD,cboACCTCD,edtBNKACCT,edtBNKBRCH,edtBNKHOLD,edtAMT,edtJDTDOC,edtRJDTDOC,btnTRAN,btnCANCTR,btnPOPUP,chkACCTIN,mtx", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_All, BoModeVisualBehavior.mvb_False);
                FN.SetAutoManagedAttribute(ref oForm, "edtDOCNUM,cboTYPE,edtCENTCD,edtCENTNM,cboSTATUS,edtDOCDT,cboMETHOD,cboACCTCD,edtBNKACCT,edtBNKBRCH,edtBNKHOLD,edtAMT,chkACCTIN", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Find, BoModeVisualBehavior.mvb_True);


                // 분개처리 상태
                if (string.IsNullOrEmpty(strTransID) == false && string.IsNullOrEmpty(strRejTran))
                {
                    FN.SetAutoManagedAttribute(ref oForm, "btnCANCTR", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True);
                }
                // 일반문서상태
                else if (string.IsNullOrEmpty(strTransID))
                {
                    //FN.SetItemEnable(oForm, "btnCANCTR", false);

                    if (oCheckBox.Checked || strTYPE == "O")
                    {
                        //strAcctCd = FN.GetRecordsetValue(" SELECT U_RMK1 FROM [@KIS_AD00201] WHERE Code = 'SO19' AND U_SMLCD = 'U204' ");
                        //oDB_M.SetValue("U_ACCTCD", 0, strAcctCd);

                        FN.SetAutoManagedAttribute(ref oForm, "edtDOCDT,cboMETHOD,cboACCTCD,edtBNKACCT,edtBNKHOLD,edtAMT,btnTRAN,chkACCTIN,cboACCTCD", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True);
                        FN.SetAutoManagedAttribute(ref oForm, "cboTYPE,edtCENTCD,edtCENTNM,edtDOCDT,cboMETHOD,edtBNKACCT,edtBNKHOLD,edtAMT,chkACCTIN,cboACCTCD", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Add, BoModeVisualBehavior.mvb_True);

                        oMatrix.Clear();
                        oMatrix.FlushToDataSource();
                    }
                    else
                    {
                        //oDB_M.SetValue("U_ACCTCD", 0, "");
                        FN.SetAutoManagedAttribute(ref oForm, "edtDOCDT,cboMETHOD,cboACCTCD,edtBNKACCT,edtBNKHOLD,mtx,btnPOPUP,btnTRAN,chkACCTIN", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True);
                        FN.SetAutoManagedAttribute(ref oForm, "cboTYPE,edtCENTCD,edtCENTNM,edtDOCDT,cboMETHOD,edtBNKACCT,edtBNKHOLD,btnPOPUP,chkACCTIN,mtx", BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Add, BoModeVisualBehavior.mvb_True);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #10
0
        //고과자 업데이트
        private bool UDO_Add_Data_UPDATE(string KeyValue)
        {
            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();
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            SAPbouiCOM.DBDataSource oKIS_HR00203_HRD = oForm.DataSources.DBDataSources.Item("@KIS_HR00203_HRD");
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            int CNT = 0;
            string SAVE = ""; //저장유무
            try
            {
                EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;

                CNT = CNT + 1;
                string SaveCheck = string.Empty;
                string sQry = string.Empty;
                string KeyAlias = "Code";
                //string KeyValue = oGrid.DataTable.GetValue("Code", i);
                decimal CHKRATE = 0;//평가비율         

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

                oMatrix.FlushToDataSource();

                for (int j = 0; j < oMatrix.RowCount + 1; j++)
                {
                    int LINENUM = j + 1;//라인번호
                    string CHEKER = string.Empty; ;//고과구분
                    string EMPNO = string.Empty; ;//사원코드
                    string EMPNM = string.Empty; ;//사원명
                    string JIKGBCD = string.Empty; ;//직급
                    string JIKCHKCD = string.Empty; ; ;//직책
                    string DEPTCD = string.Empty; ;//부서
                    string EMPCD = string.Empty; ;//본인여부 
                    string DBEMPCD = string.Empty; ;//DB본인여부 

                    /*고과상태 시작이면 변경상태확인하여 UPDATE 및 INSERT*/

                    sQry = string.Format("SELECT U_CHEKER,U_EMPNO,U_EMPCD FROM [@KIS_HR00203_HRD] WHERE Code = '{0}' AND U_LINENUM = '{1}'",KeyValue,LINENUM);
                    oRS.DoQuery(sQry);
                    if (oRS.RecordCount > 0)
                    {
                        if (oRS.Fields.Item("U_EMPCD").Value == "T")
                        {
                            if ((FN.GetMatirxCellValue(ref oMatrix, "U_CHEKER", LINENUM - 1) == oRS.Fields.Item("U_CHEKER").Value) && (FN.GetMatirxCellValue(ref oMatrix, "U_EMPNO", LINENUM - 1) == oRS.Fields.Item("U_EMPNO").Value))
                            {
                                //평가비율 수정
                                SAVE = "T";
                                CHKRATE = Convert.ToDecimal(oKIS_HR00203_HRD.GetValue("U_CHKRATE", j - 1));//평가비율         
                                SaveCheck = "U";
                            }
                            else
                            {
                                //고과자 변경
                                SAVE = "T";
                                CHEKER = oKIS_HR00203_HRD.GetValue("U_CHEKER", j - 1).Trim();//고과구분
                                EMPNO = oKIS_HR00203_HRD.GetValue("U_EMPNO", j - 1).Trim();//사원코드
                                EMPNM = oKIS_HR00203_HRD.GetValue("U_EMPNM", j - 1).Trim();//사원명
                                JIKGBCD = oKIS_HR00203_HRD.GetValue("U_JIKGBCD", j - 1).Trim();//직급
                                JIKCHKCD = oKIS_HR00203_HRD.GetValue("U_JIKCHKCD", j - 1).Trim();//직책
                                DEPTCD = oKIS_HR00203_HRD.GetValue("U_DEPTCD", j - 1).Trim();//부서
                                CHKRATE = Convert.ToDecimal(oKIS_HR00203_HRD.GetValue("U_CHKRATE", j - 1));//평가비율         
                                EMPCD = "T";//본인여부  
                                SaveCheck = "D";
                            }
                            DBEMPCD = "T";
                        }
                        else
                        {
                            DBEMPCD = "L";
                        }
                    }
                    else
                    {
                        if (oMatrix.VisualRowCount >= LINENUM - 1)
                        {
                            if (FN.GetMatirxCellValue(ref oMatrix, "U_EMPNO", LINENUM - 1) != "")
                            {
                                //고과자 추가
                                SAVE = "T";
                                CHEKER = oKIS_HR00203_HRD.GetValue("U_CHEKER", j - 1).Trim();//고과구분
                                EMPNO = oKIS_HR00203_HRD.GetValue("U_EMPNO", j - 1).Trim();//사원코드
                                EMPNM = oKIS_HR00203_HRD.GetValue("U_EMPNM", j - 1).Trim();//사원명
                                JIKGBCD = oKIS_HR00203_HRD.GetValue("U_JIKGBCD", j - 1).Trim();//직급
                                JIKCHKCD = oKIS_HR00203_HRD.GetValue("U_JIKCHKCD", j - 1).Trim();//직책
                                DEPTCD = oKIS_HR00203_HRD.GetValue("U_DEPTCD", j - 1).Trim();//부서
                                CHKRATE = Convert.ToDecimal(oKIS_HR00203_HRD.GetValue("U_CHKRATE", j - 1));//평가비율         
                                EMPCD = "T";//본인여부  
                                DBEMPCD = "";
                                SaveCheck = "N";
                            }
                            else
                                DBEMPCD = "L";
                        }
                        else
                            DBEMPCD = "L";
                    }


                    #region 기존행은 갱신, 신규 데이터는 추가하기

                    if (((SaveCheck == "U") || (SaveCheck == "D")) && (DBEMPCD == "T"))
                    {
                        int oRow = LINENUM - 1;
                        oChild = oChildren.Item(oRow);
                    }
                    else
                    {
                        if ((SaveCheck == "N") && (DBEMPCD == ""))
                            oChild = oChildren.Add();
                    }

                    if (DBEMPCD != "L")
                    {
                        if (SaveCheck != "U")
                        {
                            oChild.SetProperty("U_LINENUM", LINENUM);
                            oChild.SetProperty("U_CHEKER", CHEKER);
                            oChild.SetProperty("U_EMPNO", EMPNO);
                            oChild.SetProperty("U_EMPNM", EMPNM);
                            oChild.SetProperty("U_JIKGBCD", JIKGBCD);
                            oChild.SetProperty("U_JIKCHKCD", JIKCHKCD);
                            oChild.SetProperty("U_DEPTCD", DEPTCD);
                            oChild.SetProperty("U_PASSYN", "U01");
                            oChild.SetProperty("U_SCORE", 0);
                            oChild.SetProperty("U_GRADE", "");
                            oChild.SetProperty("U_EMPCD", EMPCD);
                            oChild.SetProperty("U_EXAMCD", EXAMCD);
                        }
                        oChild.SetProperty("U_CHKRATE", Convert.ToString(CHKRATE));
                    }

                    #endregion

                    oGeneralService.Update(oGeneralData);
                }
            }

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

            oKIS_HR00203_HRD = null;
            oGeneralData = null;
            oCompanyService = null;
            oChildren = null;
            oChild = null;
            oGeneralParams = null;
            return true;
        }
Beispiel #11
0
        private bool DataToDbDataSource_DELIVER(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;
            try
            {
                oDB1_O = oForm.DataSources.DBDataSources.Item("@KIS_SO00301_HRD");
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_ORIG").Specific;
                oMatrix.FlushToDataSource();
                /*
                // 1. 메트릭스 삭제대상 삭제 적용
                var objDelete = from row in gDs.Tables[oForm.UniqueID + "_Deliver"].AsEnumerable()
                                where row.Field<string>("ROWSTATE") == "D"
                                select new
                                {
                                    vIDX = row.Field<Int32>("IDX") +1                               
                                };

                foreach (var itemSub in objDelete)
                {
                    //삭제할것들 선택한다.
                    oMatrix.SelectRow(itemSub.vIDX, true, true);
                }

                // 선택된 Rows를 삭제한다.
                int iSelectIdx = 0;

                while (iSelectIdx != -1)
                {
                    iSelectIdx = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);
                    if (iSelectIdx != -1)
                        oMatrix.DeleteRow(iSelectIdx);
                }
                if(objDelete.Count() > 0)
                    oMatrix.FlushToDataSource();
                */

                // 2. 수정, 추가된내역 적용
                var objModify = from row in gDs.Tables[oForm.UniqueID + "_Deliver"].AsEnumerable()
                                where row.Field<string>("ROWSTATE") == "M" || row.Field<string>("ROWSTATE") == "I"
                                select new
                                {
                                    vIDX = row.Field<Int32>("IDX")
                                    ,
                                    vDELVCD = row.Field<string>("DELVCD")
                                    ,
                                    vRDEPT = row.Field<string>("RDEPT")
                                    ,
                                    vPAPERTP = row.Field<string>("PAPERTP")
                                    ,
                                    vPAYCD = row.Field<string>("PAYCD")
                                    ,
                                    vPAYNM = row.Field<string>("PAYNM")
                                    ,
                                    vTEL = row.Field<string>("TEL")
                                    ,
                                    vMOBILE = row.Field<string>("MOBILE")
                                    ,
                                    vADDR1 = row.Field<string>("ADDR1")
                                    ,
                                    vADDR2 = row.Field<string>("ADDR2")
                                    ,
                                    vADDR1_D = row.Field<string>("ADDR1_D")
                                    ,
                                    vADDR2_D = row.Field<string>("ADDR2_D")
                                    ,
                                    vCENTCD = row.Field<string>("CENTCD")
                                    ,
                                    vCENTNM = row.Field<string>("CENTNM")
                                    ,
                                    vDELVFR = row.Field<string>("DELVFR")
                                    ,
                                    vDELVTO = row.Field<string>("DELVTO")
                                    ,
                                    vDELVCNT = row.Field<Int32>("DELVCNT")
                                    ,
                                    vMETHOD = row.Field<string>("METHOD")
                                    ,
                                    vSAILCD = row.Field<string>("SAILCD")
                                    ,
                                    vSAILNM = row.Field<string>("SAILNM")
                                    ,
                                    vSDEPT = row.Field<string>("SDEPT")
                                    ,
                                    vSTATUS = row.Field<string>("STATUS")
                                    ,
                                    vNOTE = row.Field<string>("NOTE")
                                    ,
                                    vJOINDT = row.Field<string>("JOINDT")
                                    ,
                                    vCLOSEDT = row.Field<string>("CLOSEDT")
                                    ,
                                    vUSERSG1 = row.Field<string>("USERSG1")
                                    ,
                                    vREADTP = row.Field<string>("READTP")
                                    ,
                                    vBTEL1 = row.Field<string>("BTEL1")
                                    ,
                                    vBTEL2 = row.Field<string>("BTEL2")
                                    ,
                                    vROWSTATE = row.Field<string>("ROWSTATE")
                                };

                foreach (var itemSub in objModify)
                {
                    if (itemSub.vROWSTATE == "I")
                        SetDbDataSourceAddRow(ref oForm, ref oMatrix, ref oDB1_O, "U_DELVCD");

                    oDB1_O.SetValue("U_DELVCD", itemSub.vIDX, itemSub.vDELVCD);
                    oDB1_O.SetValue("U_RDEPT", itemSub.vIDX, itemSub.vRDEPT);
                    oDB1_O.SetValue("U_PAPERTP", itemSub.vIDX, itemSub.vPAPERTP);
                    oDB1_O.SetValue("U_READTP", itemSub.vIDX, itemSub.vREADTP);

                    oDB1_O.SetValue("U_PAYCD", itemSub.vIDX, itemSub.vPAYCD);
                    oDB1_O.SetValue("U_PAYNM", itemSub.vIDX, itemSub.vPAYNM);

                    oDB1_O.SetValue("U_TEL", itemSub.vIDX, itemSub.vTEL);
                    oDB1_O.SetValue("U_MOBILE", itemSub.vIDX, itemSub.vMOBILE);
                    oDB1_O.SetValue("U_ADDR1", itemSub.vIDX, itemSub.vADDR1);
                    oDB1_O.SetValue("U_ADDR2", itemSub.vIDX, itemSub.vADDR2);
                    oDB1_O.SetValue("U_ADDR1_D", itemSub.vIDX, itemSub.vADDR1_D);
                    oDB1_O.SetValue("U_ADDR2_D", itemSub.vIDX, itemSub.vADDR2_D);
                    oDB1_O.SetValue("U_CENTCD", itemSub.vIDX, itemSub.vCENTCD);
                    oDB1_O.SetValue("U_CENTNM", itemSub.vIDX, itemSub.vCENTNM);
                    oDB1_O.SetValue("U_DELVFR", itemSub.vIDX, itemSub.vDELVFR);
                    oDB1_O.SetValue("U_DELVTO", itemSub.vIDX, itemSub.vDELVTO);
                    oDB1_O.SetValue("U_DELVCNT", itemSub.vIDX, itemSub.vDELVCNT.ToString());
                    oDB1_O.SetValue("U_METHOD", itemSub.vIDX, itemSub.vMETHOD);
                    oDB1_O.SetValue("U_STATUS", itemSub.vIDX, itemSub.vSTATUS);
                    oDB1_O.SetValue("U_SAILCD", itemSub.vIDX, itemSub.vSAILCD);
                    oDB1_O.SetValue("U_SAILNM", itemSub.vIDX, itemSub.vSAILNM);
                    oDB1_O.SetValue("U_SDEPT", itemSub.vIDX, itemSub.vSDEPT);
                    oDB1_O.SetValue("U_NOTE", itemSub.vIDX, itemSub.vNOTE);
                    oDB1_O.SetValue("U_JOINDT", itemSub.vIDX, itemSub.vJOINDT);
                    oDB1_O.SetValue("U_CLOSEDT", itemSub.vIDX, itemSub.vCLOSEDT);
                    oDB1_O.SetValue("U_USERSG1", itemSub.vIDX, itemSub.vUSERSG1); //등록자

                    oDB1_O.SetValue("U_BTEL1", itemSub.vIDX, itemSub.vBTEL1); //분국전화1
                    oDB1_O.SetValue("U_BTEL2", itemSub.vIDX, itemSub.vBTEL2); //분국전화2

                }
                if (objModify.Count() > 0)
                    oMatrix.LoadFromDataSource();

                rtnValue = true;
            }
            catch (Exception)
            {
                throw;
            }
            return rtnValue;
        }
Beispiel #12
0
        public virtual void ET_mtx1_AFChooseFromList(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            SAPbouiCOM.DataTable oDataTable = null;

            oDataTable = FN.GetCFLSelectedObjects(pVal);

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

            string edtORDERRA = ((SAPbouiCOM.EditText)oForm.Items.Item("edtORDERRA").Specific).Value;
            string edtBPRATE = ((SAPbouiCOM.EditText)oForm.Items.Item("edtBPRATE").Specific).Value;

            try
            {
                if (oDataTable != null)
                {
                    oMatrix.FlushToDataSource();

                    int iRow = pVal.Row - 1;

                    switch (pVal.ColUID)
                    {
                        case "U_ITMGRPCD":
                        case "U_ITMGRPNM":
                            for (int iLooper = 0; iLooper < oDataTable.Rows.Count; iLooper++)
                            {
                                if (oKIS_SD00301_HRD.Size - 1 < iRow)
                                {
                                    oKIS_SD00301_HRD.InsertRecord(oKIS_SD00301_HRD.Size);
                                }

                                oKIS_SD00301_HRD.Offset = iRow;

                                oKIS_SD00301_HRD.SetValue("U_ITMGRPCD", oKIS_SD00301_HRD.Offset, oDataTable.GetValue("Code", iLooper).ToString());
                                oKIS_SD00301_HRD.SetValue("U_ITMGRPNM", oKIS_SD00301_HRD.Offset, oDataTable.GetValue("Name", iLooper).ToString());
                                //01.우선순위 로드.
                                oMatrix.LoadFromDataSource();

                                //02.실수주자 수수료 계산
                                oMatrix.SetCellWithoutValidation(iRow +1, "U_ORDERRAT", edtORDERRA);
                                SetCalc("U_ORDERRAT", iRow + 1);
                                //02.대행사 수수료 계산
                                oMatrix.SetCellWithoutValidation(iRow + 1, "U_BPRATE", edtBPRATE);
                                SetCalc("U_BPRATE", iRow + 1);

                                iRow++;
                            }

                            break;
                        default:
                            break;
                    }
                    
                    //행추가
                    //FN.SetMatrixAddRow(ref oForm, ref oMatrix, ref oKIS_SD00301, FN.RowSelectMode.CellClick, "U_ITMGRPCD");
                    //SetMatrixColumnVATGRP(gl_U_VATCD, gl_U_VATCDBP);
                    //SetMatrixRowNumbering(oMatrix, "U_LINENUM");

                    SetMatrixAddRow(FN.RowSelectMode.None);
                    SetMatrixCalc_Sum();

                    if (oForm.Mode == BoFormMode.fm_OK_MODE)
                        oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oKIS_SD00301_HRD = null;
                oDataTable = null;
            }
        }
        }//fin InitForm

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

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

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

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

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

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

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

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

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

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

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

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

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

                                oMtx.FlushToDataSource();
                            }
                        }
                    }

                    if ((pVal.ItemUID == "btnBorrar") && (!pVal.BeforeAction))
                    {
                        Borrar();
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            oForm.Freeze(false);
        }//fin FormEvent
Beispiel #14
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);
                oMatrix.AddRow(1, -1);
                int i = oMatrix.VisualRowCount;
                oMatrix.DeleteRow(i);
                oMatrix.FlushToDataSource();
                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #15
0
        public virtual void ET_mtx1_AFComboSelect(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            string sQry = "";

            if (pVal.ColUID == "U_DTCD")
            {
                string DTCD = FN.GetMatirxCellValue(ref oMatrix, "U_DTCD", pVal.Row);
                string DTNM = "";

                sQry = string.Format(" SELECT U_SMLNM FROM [@KIS_AD00201]  WHERE CODE = 'HR02' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'", DTCD);

                oRS.DoQuery(sQry);

                DTNM = oRS.Fields.Item("U_SMLNM").Value.ToString();

                oMatrix.SetCellWithoutValidation(pVal.Row, "U_DTNM", DTNM);
                oMatrix.FlushToDataSource();

            }
            else if (pVal.ColUID == "U_ABILCD")
            {
                string ABILCD = FN.GetMatirxCellValue(ref oMatrix, "U_ABILCD", pVal.Row);
                string ABILNM = "";

                sQry = string.Format(" SELECT U_SMLNM FROM [@KIS_AD00201]  WHERE CODE = 'HR03' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'", ABILCD);

                oRS.DoQuery(sQry);

                ABILNM = oRS.Fields.Item("U_SMLNM").Value.ToString();

                oMatrix.SetCellWithoutValidation(pVal.Row, "U_ABILNM", ABILNM);
                oMatrix.FlushToDataSource();
            }
            else if (pVal.ColUID == "U_COMPOCD")
            {
                string COMPOCD = FN.GetMatirxCellValue(ref oMatrix, "U_COMPOCD", pVal.Row);
                string COMPONM = "";

                sQry = string.Format(" SELECT U_SMLNM FROM [@KIS_AD00201]  WHERE CODE = 'HR04' AND U_USEYN = 'Y' AND U_SMLCD = '{0}'", COMPOCD);

                oRS.DoQuery(sQry);

                COMPONM = oRS.Fields.Item("U_SMLNM").Value.ToString();

                oMatrix.SetCellWithoutValidation(pVal.Row, "U_COMPONM", COMPONM);
                oMatrix.FlushToDataSource();
            }
        }
Beispiel #16
0
        private void DBDataSourcesBindingData(SAPbouiCOM.Form oForm, System.Data.DataTable dt, string strFileName)
        {
            try
            {
                SetLayOut();

                //string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyy-MM-dd");//임포트 실행일              
                string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyyMMdd");//임포트 실행일
                string U_RELUSER = B1Connections.diCompany.UserName;//임포트 실행 사용자


                oMatrix = oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);

                //oMatrix.Clear();
               oMatrix.FlushToDataSource();

               if (heDataTable_EB22 != null) heDataTable_EB22.Clear();
               if (boDataTable_EB22 != null) boDataTable_EB22.Clear();
               if (trDataTable_EB22 != null) trDataTable_EB22.Clear();


                for (int i = 0; i < dt.Rows.Count; i++)
                {

                    string upRowText = dt.Rows[i][0].ToString();
                    string dataType = string.Empty;

                    // dataType - H : 헤더, R : 바디, T : 합계
                    dataType = dt.Rows[i][0].ToString().Substring(0, 1);

                    switch (dataType)
                    {
                        case "H":
                            SetDataTable(LayOutDataTable_EB22, ref heDataTable_EB22, upRowText, dataType);
                            break;

                        case "R":
                            SetDataTable(LayOutDataTable_EB22, ref boDataTable_EB22, upRowText, dataType);
                            break;

                        case "T":
                            SetDataTable(LayOutDataTable_EB22, ref trDataTable_EB22, upRowText, dataType);
                            break;

                        default:
                            break;
                    }
                }


                #region 헤더
                string S0290 = trDataTable_EB22.Rows[0]["0290"].ToString().Trim();  // 총건수
                string S0300 = trDataTable_EB22.Rows[0]["0300"].ToString().Trim();  // 전액출금불능건수
                string S0310 = trDataTable_EB22.Rows[0]["0310"].ToString().Trim();  // 전액출금불능금액
                string S0320 = trDataTable_EB22.Rows[0]["0320"].ToString().Trim();  // 부분출금불능건수
                string S0330 = trDataTable_EB22.Rows[0]["0330"].ToString().Trim();  // 부분출금불능금액
                string S0340 = trDataTable_EB22.Rows[0]["0340"].ToString().Trim();  // 센터검증오류건수
                string S0350 = trDataTable_EB22.Rows[0]["0350"].ToString().Trim();  // FILLER
                string S0360 = trDataTable_EB22.Rows[0]["0360"].ToString().Trim();  // 출금은행 수수료
                string S0370 = trDataTable_EB22.Rows[0]["0370"].ToString().Trim();  // 입금은행 수수료
                string S0380 = trDataTable_EB22.Rows[0]["0380"].ToString().Trim();  // FILLER
                string S0390 = trDataTable_EB22.Rows[0]["0390"].ToString().Trim();  // MAC 검증값

                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_ETOTCNT", S0290);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EFULCNT", S0300);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EFULAMT", S0310);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EPATCNT", S0320);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EPATAMT", S0330);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_ERRCNT", S0340);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_OCMMAMT", S0360);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_IMMAMT", S0370);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EMAC", S0390);
                FN.SetDataSourceValue(oForm, "@KIS_SO0190T_HRD.U_EFILE", Path.GetFileName(strFileName));
                //FN.SetItemValue(ref oForm, "edtEFILE", Path.GetFileName(strFileName));
                #endregion

                #region 바디
                string LineId = string.Empty;
                string U_READCD = string.Empty;
                string U_PAYNO = string.Empty;
                string U_BNKACCT = string.Empty;
                string U_SERNO = string.Empty;
                string U_REQAMT = string.Empty;

                string U_IMPAMT = string.Empty;

                string filterExpression = string.Empty;

                for (int r1 = 1; r1 <= oMatrix.VisualRowCount; r1++)
                {
                    LineId = FN.GetMatirxCellValue(ref oMatrix, "LineId", r1);  //oMatrix.GetCellSpecific("LineId", r1).ToString();
                    U_READCD = FN.GetMatirxCellValue(ref oMatrix, "U_READCD", r1);
                    U_PAYNO = FN.GetMatirxCellValue(ref oMatrix, "U_PAYNO", r1);
                    U_BNKACCT = FN.GetMatirxCellValue(ref oMatrix, "U_BNKACCT", r1);
                    U_SERNO = FN.GetMatirxCellValue(ref oMatrix, "U_SERNO", r1);
                    U_REQAMT = FN.GetMatirxCellValue(ref oMatrix, "U_REQAMT", r1);

                    //filterExpression = string.Format("0120 = '{0}' AND 0140 = '{1}' AND 0110 = '{2}'", U_PAYNO, U_BNKACCT, U_TAKEGBN);
                    //System.Data.DataRow[] foundRows = boDataTable_EB22.Select(filterExpression);


                    IEnumerable<DataRow> sDataRows = (from a in boDataTable_EB22.AsEnumerable()
                                                      where a.Field<string>("0100") == U_SERNO
                                                         && a.Field<string>("0200") == U_PAYNO
                                                         //&& a.Field<string>("0130") == U_BNKACCT
                                                      select a).Take(1);


                    //if (foundRows.Length == 0)

                    if (sDataRows.Count() == 0)
                    {
                        oMatrix.SetCellWithoutValidation(r1, "U_RESCD", "");
                        oMatrix.SetCellWithoutValidation(r1, "U_IMPCD", "");
                        oMatrix.SetCellWithoutValidation(r1, "U_IMPAMT", "");
                        oMatrix.SetCellWithoutValidation(r1, "U_DEPAMT", U_REQAMT);
                    }
                    else
                    {
                        System.Data.DataTable serchTable = sDataRows.CopyToDataTable();

                        U_IMPAMT = serchTable.Rows[0]["0140"].ToString().Trim();

                        oMatrix.SetCellWithoutValidation(r1, "U_RESCD", serchTable.Rows[0]["0160"].ToString().Trim());  // 결과코드
                        oMatrix.SetCellWithoutValidation(r1, "U_IMPCD", serchTable.Rows[0]["0170"].ToString().Trim());  // 불능코드
                        oMatrix.SetCellWithoutValidation(r1, "U_IMPAMT", U_IMPAMT);  // 출금불능금액
                        oMatrix.SetCellWithoutValidation(r1, "U_DEPAMT", (decimal.Parse(U_REQAMT) - decimal.Parse(U_IMPAMT)).ToString());  // 입금금액

                        //oMatrix.SetCellWithoutValidation(r1, "U_RESCD", foundRows[0]["0180"].ToString().Trim());
                        //oMatrix.SetCellWithoutValidation(r1, "U_IMPCD", foundRows[0]["0190"].ToString().Trim());
                    }
                }
                #endregion

                oMatrix.FlushToDataSource();

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

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

        }
Beispiel #17
0
        public virtual void ET_CallBack_AFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("CallBack").Specific));

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

            if (string.IsNullOrEmpty(popupID)) return;

            // 리턴 DataTable
            SAPbouiCOM.DataTable rDT = KIS_SO0000F_HRD.GetReturnDT(popupID, oForm.UniqueID);
            
            int rowIdx = KIS_SO0000F_HRD.GetSelectRowIdx(popupID, oForm.UniqueID);

            switch (popupID)
            {
                case "지번주소":
                    oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1").Specific;
                    oMatrix.SetCellWithoutValidation(rowIdx, "U_ZIPCD1", rDT.GetValue("ZIP_CD", 0));
                    oMatrix.SetCellWithoutValidation(rowIdx, "U_ADDR1", rDT.GetValue("RADDR_KOR", 0));
                    
                    oMatrix.FlushToDataSource();
                    break;

                case "거리주소":
                    oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1").Specific;
                    oMatrix.SetCellWithoutValidation(rowIdx, "U_ZIPCD2", rDT.GetValue("ZIP_CD", 0));
                    oMatrix.SetCellWithoutValidation(rowIdx, "U_ADDR2", rDT.GetValue("RADDR_KOR", 0));
                    
                    oMatrix.FlushToDataSource();
                    break;

                case "분국조회":
                    string KeyValue = rDT.GetValue("U_BRCCD", 0).ToString();
                    if (!string.IsNullOrEmpty(KeyValue))
                    {
                        GetDataLoad(oForm, KeyValue);
                    }

                    break;

                default:
                    break;
            }
        }
Beispiel #18
0
        //고과자 신규생성
        private bool UDO_Add_Data_NEW(string KeyValue)
        {
            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();
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            SAPbouiCOM.DBDataSource oKIS_HR00203_HRD = oForm.DataSources.DBDataSources.Item("@KIS_HR00203_HRD");
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            int CNT = 0;
            string SAVE = ""; //저장유무
            try
            {
                EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;

                CNT = CNT + 1;
                string SaveCheck = string.Empty;
                string sQry = string.Empty;
                string KeyAlias = "Code";
                //string KeyValue = oGrid.DataTable.GetValue("Code", i);
                decimal CHKRATE = 0;//평가비율         

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

                oMatrix.FlushToDataSource();

                for (int j = 0; j < oMatrix.RowCount + 1; j++)
                {
                    int LINENUM = j + 1;//라인번호
                    string CHEKER = string.Empty; ;//고과구분
                    string EMPNO = string.Empty; ;//사원코드
                    string EMPNM = string.Empty; ;//사원명
                    string JIKGBCD = string.Empty; ;//직급
                    string JIKCHKCD = string.Empty; ; ;//직책
                    string DEPTCD = string.Empty; ;//부서
                    string EMPCD = string.Empty; ;//본인여부 
                    string DBEMPCD = string.Empty; ;//DB본인여부 

                    if (j == 0)
                    {
                        //1,2,3 고과자 생성후 마지막라인에 본인고과 추가
                        SAVE = "L";
                        CHEKER = EMPCODE;//고과구분
                        EMPNO = FN.GetRecordsetValue(string.Format("SELECT U_EMPNO FROM [@KIS_HR0020M_HRD] WHERE Code = '{0}'", KeyValue));//사원코드
                        EMPNM = FN.GetRecordsetValue(string.Format("SELECT U_EMPNM FROM [@KIS_HR0020M_HRD] WHERE Code = '{0}'", KeyValue));//사원명
                        JIKGBCD = FN.GetRecordsetValue(string.Format("SELECT U_JIKGBCD FROM [@KIS_HR0020M_HRD] WHERE Code = '{0}'", KeyValue)); //직급
                        JIKCHKCD = FN.GetRecordsetValue(string.Format("SELECT U_JIKCHKCD FROM [@KIS_HR0020M_HRD] WHERE Code = '{0}'", KeyValue));//직책
                        DEPTCD = FN.GetRecordsetValue(string.Format("SELECT U_DEPTCD FROM [@KIS_HR0020M_HRD] WHERE Code = '{0}'", KeyValue));//부서
                        CHKRATE = 0;//평가비율         
                        EMPCD = "L";//본인여부 
                        DBEMPCD = "";
                    }
                    else
                    {
                        if (oKIS_HR00203_HRD.GetValue("U_CHEKER", j - 1).ToString().Trim() != "")
                        {
                            //고과자
                            SAVE = "T";
                            CHEKER = oKIS_HR00203_HRD.GetValue("U_CHEKER", j - 1);//고과구분
                            EMPNO = oKIS_HR00203_HRD.GetValue("U_EMPNO", j - 1);//사원코드
                            EMPNM = oKIS_HR00203_HRD.GetValue("U_EMPNM", j - 1);//사원명
                            JIKGBCD = oKIS_HR00203_HRD.GetValue("U_JIKGBCD", j - 1);//직급
                            JIKCHKCD = oKIS_HR00203_HRD.GetValue("U_JIKCHKCD", j - 1);//직책
                            DEPTCD = oKIS_HR00203_HRD.GetValue("U_DEPTCD", j - 1);//부서
                            CHKRATE = Convert.ToDecimal(oKIS_HR00203_HRD.GetValue("U_CHKRATE", j - 1));//평가비율         
                            EMPCD = "T";//본인여부  
                            DBEMPCD = "";
                        }
                        else
                        {
                            SAVE = "";
                        }
                    }
                    if (SAVE != "")
                    {
                        oChild = oChildren.Add();
                        oChild.SetProperty("U_LINENUM", LINENUM);
                        oChild.SetProperty("U_CHEKER", CHEKER);
                        oChild.SetProperty("U_EMPNO", EMPNO);
                        oChild.SetProperty("U_EMPNM", EMPNM);
                        oChild.SetProperty("U_JIKGBCD", JIKGBCD);
                        oChild.SetProperty("U_JIKCHKCD", JIKCHKCD);
                        oChild.SetProperty("U_DEPTCD", DEPTCD);
                        oChild.SetProperty("U_PASSYN", "U01");
                        oChild.SetProperty("U_SCORE", 0);
                        oChild.SetProperty("U_GRADE", "");
                        oChild.SetProperty("U_EMPCD", EMPCD);
                        oChild.SetProperty("U_EXAMCD", EXAMCD);
                        oChild.SetProperty("U_CHKRATE", Convert.ToString(CHKRATE));
                    }
                }

                oGeneralService.Update(oGeneralData);

            }

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

            oKIS_HR00203_HRD = null;
            oGeneralData = null;
            oCompanyService = null;
            oChildren = null;
            oChild = null;
            oGeneralParams = null;
            return true;
        }
Beispiel #19
0
        private bool UDO_Add_Data(string Keys)
        {
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd1").Specific;
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            SAPbouiCOM.DBDataSource oKIS_HR00203_HRD = oForm.DataSources.DBDataSources.Item("@KIS_HR00203_HRD");
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            int CNT = 0;
            decimal CHKRATECHK = 0;


            Boolean Status = false;
            string[] strData;
            string Key = string.Empty;
            EXAMCD = oForm.Items.Item("cboYEAR").Specific.Value;
            strData = Keys.Split(',');

            SAPbouiCOM.ProgressBar ProgressBar01 = B1Connections.theAppl.StatusBar.CreateProgressBar(String.Format("고과항목생성중...(0/{0})", strData.Length), strData.Length, false);
            KIS_COMMON.GLOBAL.PrograssBarExcute = true;


            try
            { 
                for (int i = 0; i < strData.Length; i++)
                {
                    if (KIS_COMMON.GLOBAL.PrograssBarExcute == true)
                    {
                        ProgressBar01.Value++;
                        ProgressBar01.Text = String.Format("고과자생성중 ... ({0}/{1})", ProgressBar01.Value, strData.Length);
                        System.Windows.Forms.Application.DoEvents();
                    }

                    Status = true;
                    CNT = CNT + 1;
                    string sQry = string.Empty;
                    string KeyValue = strData[i].Trim();
                    //string KeyValue = oGrid.DataTable.GetValue("Code", i);
                    string TmpStatus = FN.GetRecordsetValue(string.Format("SELECT U_RMK2 FROM [@KIS_AD00201] WHERE Code = 'HR01' AND U_SMLCD = '{0}'", EXAMCD));
                    decimal CHKRATE = 0;//평가비율         

                    /*고과상태가 설정이면 DELETE INSERT*/
                    if (TmpStatus == "U02")
                    {
                        sQry = " DELETE FROM [@KIS_HR00203_HRD] WHERE Code = '" + KeyValue + "'";
                        oRS.DoQuery(sQry);
                    }

                    sQry = " SELECT * FROM [@KIS_HR00201_HRD] WHERE Code = '" + KeyValue + "'";
                    oRS.DoQuery(sQry);
                    if (oRS.RecordCount > 0)
                    {
                        CHECK = true;
                    }
                    else
                    {
                        CHECK = false;
                    }

                    oMatrix.FlushToDataSource();

                    /* 평가비율합 100 Check*/
                    CHKRATECHK = 0;
                    for (int j = 0; j < oMatrix.RowCount; j++)
                    {
                        CHKRATE = Convert.ToDecimal(oKIS_HR00203_HRD.GetValue("U_CHKRATE", j));
                        CHKRATECHK = CHKRATECHK + CHKRATE;
                    }
                    if (CHKRATECHK != 100)
                    {
                        CHKRATECHK = -1;
                        return false;
                    }

                    /*고과상태 시작이면 변경상태확인하여 UPDATE 및 INSERT*/
                    if (TmpStatus == "U03")
                    {
                        string NewCHEKER = FN.GetRecordsetValue(string.Format("SELECT U_EMPNO FROM [@KIS_HR00203_HRD] WHERE Code = '{0}'", KeyValue));
                        if (NewCHEKER == "")
                        {
                            //신규 추가
                            UDO_Add_Data_NEW(KeyValue);
                        }
                        else
                        {
                            //UPDATE 문
                            UDO_Add_Data_UPDATE(KeyValue);
                        }
                    }
                    else
                    {
                        //신규 추가
                        UDO_Add_Data_NEW(KeyValue);
                    }

                    //고과자 평가항목 등록
                    if (CHECK == true)
                    {
                        UDO_Add_Data_2(KeyValue);
                    }

                }
            }

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

                oRS = null;
                oKIS_HR00203_HRD = null;
                oMatrix = null;
                oGrid = null;
                if (CHKRATECHK != -1)
                {
                    if (Status != true)
                    {
                        B1Connections.theAppl.StatusBar.SetText("선택된 데이터가 없습니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    }
                    else
                        B1Connections.theAppl.StatusBar.SetText(CNT + "개의 고과자생성완료", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }
                else
                {
                    B1Connections.theAppl.StatusBar.SetText("선택한 평가비율합이 100이 아닙니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
            }
            return true;
        }
Beispiel #20
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 ...'
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            SAPbouiCOM.DBDataSource oKIS_HR00203_HRD = oForm.DataSources.DBDataSources.Item("@KIS_HR00203_HRD");
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            string TMP = "";
            oMatrix.FlushToDataSource();
            for (int i = 0 ; i < oKIS_HR00203_HRD.Size; i++)
            {
                TMP = TMP + oKIS_HR00203_HRD.GetValue("U_CHEKER", i).Trim() + ",";
            }
            string sQry = " EXEC KIS_SP_HR0010B0_HRD '" + TMP + "'";
            oRS.DoQuery(sQry);
            if (oRS.RecordCount != 0)
            {
                B1Connections.theAppl.StatusBar.SetText("중복된 고과구분이 있습니다", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                oKIS_HR00203_HRD = null;
                oRS = null;
                oMatrix = null;
                return false;
            }

            string Keys = SelectCode(oForm, "grd1", "Code");



            UDO_Add_Data(Keys);

            oKIS_HR00203_HRD = null;
            oRS = null;
            oMatrix = null;

            return true;
        }
Beispiel #21
0
        public virtual void ET_mtx1_AFChooseFromList(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            SAPbouiCOM.DataTable oDataTable = null;
            SAPbouiCOM.DBDataSource oKIS_HR00203_HRD = oForm.DataSources.DBDataSources.Item("@KIS_HR00203_HRD");
            oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            oDataTable = FN.GetCFLSelectedObjects(pVal);

            if (pVal.ColUID == "U_EMPNO")
            {
                try
                {
                    if (oDataTable != null)
                    {
                        oMatrix.FlushToDataSource();
                        string sQry = " SELECT B.U_DEPTCD FROM [@KIS_HR0120M] A INNER JOIN [@KIS_HR01202] B ON A.Code = B.Code";
                               sQry = sQry + "\r\n" + " WHERE A.U_EMPNO = '" + oDataTable.GetValue("U_EMPNO", 0).ToString() + "'";
                               oRS.DoQuery(sQry);

                        oKIS_HR00203_HRD.SetValue("U_EMPNO", pVal.Row-1, oDataTable.GetValue("U_EMPNO", 0).ToString());
                        oKIS_HR00203_HRD.SetValue("U_EMPNM", pVal.Row - 1, oDataTable.GetValue("U_EMPNM", 0).ToString());
                        oKIS_HR00203_HRD.SetValue("U_DEPTCD", pVal.Row - 1, oRS.Fields.Item("U_DEPTCD").Value);
                        oKIS_HR00203_HRD.SetValue("U_JIKGBCD", pVal.Row - 1, oDataTable.GetValue("U_JIKGBCD", 0).ToString());
                        oKIS_HR00203_HRD.SetValue("U_JIKCHKCD", pVal.Row - 1, oDataTable.GetValue("U_JIKCHCD", 0).ToString());
                        oMatrix.LoadFromDataSource();
                    }
                }
                catch (Exception ex)
                {
                    B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
                finally
                {
                    oRS = null;
                    oDataTable = null;
                    oKIS_HR00203_HRD = null; ;
                }
            }

        }
Beispiel #22
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;
            }
        }
Beispiel #23
0
        }//fin InitForm

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

            SAPbouiCOM.DataTable oDataTable;
            String sValue, sValue1;

            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        //BubbleEvent := ValidarDatosFE();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction) && (pVal.ItemUID == "mtx"))
                {
                    if (pVal.ColUID == "V_0")
                    {
                        oMtx.FlushToDataSource();
                        sValue = ((System.String)oDBDSD.GetValue("U_CodeImp", pVal.Row - 1)).Trim();
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            s = @"select Code, Name from OSTA where Code = '{0}'
                                  UNION ALL
                                  select WTCode 'Code', WTName 'Name' from OWHT where Inactive = 'N' and WTCode = '{0}'";
                        }
                        else
                        {
                            s = @"select ""Code"", ""Name"" from ""OSTA"" where ""Code"" = '{0}'
                                  UNION ALL
                                  select ""WTCode"" ""Code"", ""WTName"" ""Name"" from ""OWHT"" where ""Inactive"" = 'N' and ""WTCode"" = '{0}' ";
                        }
                        s = String.Format(s, sValue);
                        oRecordSet.DoQuery(s);

                        if (oRecordSet.RecordCount == 0)
                        {
                            FSBOApp.StatusBar.SetText("No se encuentra Impuesto o Retención: " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            sValue1 = ((System.String)oRecordSet.Fields.Item("Name").Value).Trim();


                            oDBDSD.SetValue("U_CodeImp", pVal.Row - 1, sValue);
                            oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1);
                            if (pVal.Row == oMtx.RowCount)
                            {
                                oDBDSD.InsertRecord(pVal.Row);
                            }
                            oMtx.LoadFromDataSource();
                            oMtx.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Beispiel #24
0
        private bool DeleteMatrixRows_CALL(string pDeliveryCode)
        {
            bool bRtnValue = true;
            System.Data.DataRow[] findRows = null;
            string strIdx = string.Empty;
            int iBtnValue = -1;
            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_ORIG").Specific;
                findRows = gDs.Tables[oForm.UniqueID + "_Call"].Select(string.Format(" DELVCD = '{0}' ", pDeliveryCode));

                // 1. 메트릭스 삭제대상 삭제 적용
                if (findRows.Count() > 0)
                {
                    iBtnValue = B1Connections.theAppl.MessageBox("상담이력이 존재 합니다. 삭제하시겠습니까?", 1, "&Yes", "&No", "");

                    if (iBtnValue == 1)
                    {
                        foreach (System.Data.DataRow dr in findRows)
                        {
                            //삭제할것들 선택한다.
                            strIdx = dr["IDX"].ToString();
                            oMatrix.SelectRow(int.Parse(strIdx) + 1, true, true);

                            gDs.Tables[oForm.UniqueID + "_Call"].Rows.Remove(dr);
                        }

                        // 선택된 Rows를 삭제한다.
                        int iSelectIdx = 0;

                        while (iSelectIdx != -1)
                        {
                            iSelectIdx = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);
                            if (iSelectIdx != -1)
                                oMatrix.DeleteRow(iSelectIdx);
                        }
                        if (findRows.Count() > 0)
                            oMatrix.FlushToDataSource();
                    }
                    else
                        bRtnValue = false;
                }
            }

            catch (Exception)
            {
                bRtnValue = false;
                throw;
            }
            finally
            {
                findRows = null;
            }
            return bRtnValue;
        }
Beispiel #25
0
        private void SetChildDataToMatrix(SAPbouiCOM.Form oForm)
        {
            SAPbouiCOM.Form cForm = B1Connections.theAppl.Forms.Item(oForm.DataSources.UserDataSources.Item("cFORMUID").ValueEx);
            oMatrix = oForm.Items.Item("mtx").Specific;
            string strREADCD = string.Empty;
            string strCENTCD = string.Empty;
            string strADVRECV = string.Empty;
            string strUpLineId = string.Empty;
            bool bModify = false;
            try
            {
                oForm.Freeze(true);
                SAPbouiCOM.Grid cGrid = cForm.Items.Item("grd").Specific;
                for (int i = 0; i < cGrid.DataTable.Rows.Count; i++)
                {
                    if (FN.GetGridCellValue(ref cGrid, "CHK", i) == "Y")
                    {

                        strREADCD = FN.GetGridCellValue(ref cGrid, "U_READCD", i);
                        strCENTCD = FN.GetGridCellValue(ref cGrid, "U_CENTCD", i);
                        strADVRECV = FN.GetGridCellValue(ref cGrid, "U_ADVRECV", i);
                        strUpLineId = oForm.DataSources.UserDataSources.Item("U_BLINEID").ValueEx;

                        oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_SO04201_HRD");

                        if (string.IsNullOrEmpty(strCENTCD) == false)
                        {                                

                            SetMatrixAddRow(ref oForm, ref oMatrix, ref oDB_1, "U_READCD");

                            oMatrix.SetCellWithoutValidation(oMatrix.VisualRowCount, "U_READCD", FN.GetGridCellValue(ref cGrid, "U_READCD", i));
                            oMatrix.SetCellWithoutValidation(oMatrix.VisualRowCount, "U_READNM", FN.GetGridCellValue(ref cGrid, "U_READNM", i));
                            oMatrix.SetCellWithoutValidation(oMatrix.VisualRowCount, "U_ADVAMT", FN.GetGridCellValue(ref cGrid, "U_ADVRECV", i));
                            oMatrix.SetCellWithoutValidation(oMatrix.VisualRowCount, "U_ADVSUBT", FN.GetGridCellValue(ref cGrid, "U_ADVRECV", i));

                            bModify = true;
                        }

                    }
                }
                if (bModify)
                {
                    oMatrix.FlushToDataSource();
                    if (oForm.Mode == BoFormMode.fm_OK_MODE)
                        oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                oForm.Freeze(false);
                if (oMatrix != null) { Marshal.ReleaseComObject(oMatrix); } oMatrix = null;
                if (cForm != null) { Marshal.ReleaseComObject(cForm); } cForm = null;
            }
        }
Beispiel #26
0
        public virtual void ET_btnSTOP_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnSTOP").Specific));
            // ADD YOUR ACTION CODE HERE ...

            int idx = 0;
            string strRowStat = string.Empty;
            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific;
                oDB1_Z = oForm.DataSources.DBDataSources.Item("@KIS_SO00301Z_HRD");

                
                string strNowDate  = B1Connections.diCompany.GetCompanyDate().ToShortDateString();
                strNowDate = FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD);

                string strStopDate = oForm.DataSources.UserDataSources.Item("edtSTOPDT").ValueEx;
                
                //if (String.IsNullOrEmpty(strNowDate))
                //{
                //    B1Connections.theAppl.StatusBar.SetText("중지 일자가 입력되지 않았습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                //    //oForm.Items.Item("btnSTOP").Click(0);
                //    return ;
                //}

                for (int i = 1; i <= oMatrix.VisualRowCount; i++)
                {
                    idx = GetDataTableIndexByMatrix(oMatrix, i);
                    strRowStat = gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["ROWSTATE"].ToString(); //Row상태값

                    if (strNowDate.CompareTo(strStopDate) >= 0)
                    {
                        // 상태값
                        oMatrix.SetCellWithoutValidation(i, "U_STATUS", "US");
                        gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["STATUS"] = "US";

                    }
                    else
                    {
                        // 상태값
                        oMatrix.SetCellWithoutValidation(i, "U_STATUS", "UO");
                        gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["STATUS"] = "UO";

                    }


                    // 중지일자
                    //oMatrix.SetCellWithoutValidation(i, "U_CLOSEDT", strStopDate);
                    //gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["CLOSEDT"] = FN.SetDateFormatToDB(strStopDate, FN.eDateType.n_YYYYMMDD);
                    oMatrix.SetCellWithoutValidation(i, "U_CLOSEDT", strNowDate);
                    gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["CLOSEDT"] = FN.SetDateFormatToDB(strNowDate, FN.eDateType.n_YYYYMMDD);

                    // 배달종료일자 
                    oMatrix.SetCellWithoutValidation(i, "U_DELVTO", strStopDate);
                    gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["DELVTO"] = FN.SetDateFormatToDB(strStopDate, FN.eDateType.n_YYYYMMDD);

                    if (string.IsNullOrEmpty(strRowStat))
                    {
                        gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["ROWSTATE"] = "M";
                        SetSumNumberOfCofies(oForm);
                    }
                }

                if (oMatrix.VisualRowCount > 0)
                {
                    oMatrix.FlushToDataSource();

                    if (oForm.Mode == BoFormMode.fm_OK_MODE)
                        oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #27
0
        private void DBDataSourcesBindingData(SAPbouiCOM.Form oForm, System.Data.DataTable dt, int sIndex)
        {
            try
            {
                System.Collections.Hashtable hashTable = new System.Collections.Hashtable();
                SetHashTable_Seq(ref hashTable, dt);

                oMatrix = oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);
                oMatrix.Clear();

                string U_RDCD = string.Empty;
                string U_DELVCD = string.Empty;
                int seq;


                for (int i = sIndex; i < dt.Rows.Count; i++)
                {
                    oMatrix.AddRow();

                    U_RDCD = dt.Rows[i]["U_RDCD"].ToString();
                    seq = GetHashTable_NextSeq(ref hashTable, U_RDCD);
                    U_DELVCD = U_RDCD + "_" + seq.ToString().PadLeft(4, '0');

                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDCD", U_RDCD);
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDNM", dt.Rows[i]["U_RDNM"].ToString());
                    //oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DELVCD", dt.Rows[i]["U_DELVCD"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DELVCD", U_DELVCD);
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDEPT", dt.Rows[i]["U_RDEPT"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PAPERTP", dt.Rows[i]["U_PAPERTP"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_TYPE", dt.Rows[i]["U_TYPE"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PAYCD", dt.Rows[i]["U_PAYCD"].ToString());
                    //oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PAYNM", dt.Rows[i][6].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_TEL", dt.Rows[i]["U_TEL"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR1", dt.Rows[i]["U_ADDR1"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR1_D", dt.Rows[i]["U_ADDR1_D"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR2", dt.Rows[i]["U_ADDR2"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR2_D", dt.Rows[i]["U_ADDR2_D"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_CENTCD", dt.Rows[i]["U_CENTCD"].ToString());
                    //oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_CENTNM", dt.Rows[i][11].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DELVFR", dt.Rows[i]["U_DELVFR"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DELVCNT", dt.Rows[i]["U_DELVCNT"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_METHOD", dt.Rows[i]["U_METHOD"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_SDEPT", dt.Rows[i]["U_SDEPT"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_SAILCD", dt.Rows[i]["U_SAILCD"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_SAILNM", dt.Rows[i]["U_SAILNM"].ToString());
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_STATUS", "UO");
                    oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_NOTE", "");
                }

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

        }
Beispiel #28
0
        private void SetMatrixRemoveBlankRow()
        {
            oMatrix = oForm.Items.Item("mtx1").Specific;

            oMatrix.FlushToDataSource();

            SAPbouiCOM.DBDataSource oKIS_SD00501_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SD00501_HRD");

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

            oMatrix.LoadFromDataSource();

            SetMatrixRowNumbering(oMatrix, "U_LINENUM");
        }
Beispiel #29
0
        public virtual void ET_mtx1_AFComboSelect(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                if (pVal.ItemChanged)
                {
                    switch (oMatrix.Columns.Item(pVal.ColUID).UniqueID)
                    {

                        case "U_VATCD"://매출 부가세
                        case "U_VATCDBP"://매입 부가세
                            oMatrix.FlushToDataSource();
                            SetCalc(pVal.ColUID, pVal.Row);
                            break;
                        default:
                            break;
                    }

                    SetMatrixCalc_Sum();
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
Beispiel #30
0
        private void DBDataSourcesBindingData(SAPbouiCOM.Form oForm, System.Data.DataTable dt, string strFileName)
        {
            try
            {
                //string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyy-MM-dd");//임포트 실행일              
                string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyyMMdd");//임포트 실행일
                string U_RELUSER = B1Connections.diCompany.UserName;//임포트 실행 사용자


                oMatrix = oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);

                oMatrix.Clear();
                oMatrix.FlushToDataSource();

                heDataTable.Clear();
                boDataTable.Clear();
                trDataTable.Clear();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //oMatrix.AddRow();
                    //oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ERRCD", dt.Rows[i][0].ToString());
                    //oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ERRMSG", dt.Rows[i][0].ToString());

                    string upRowText = dt.Rows[i][0].ToString();
                    string dataType = string.Empty;

                    // dataType - 11 : 헤더, 22 : 바디, 33 : 합계
                    dataType = dt.Rows[i][0].ToString().Substring(0, 2);

                    switch (dataType)
                    {
                        case "11":
                            SetGiroTable(ref heDataTable, upRowText, dataType);
                            break;

                        case "22":
                            SetGiroTable(ref boDataTable, upRowText, dataType);
                            break;

                        case "33":
                            SetGiroTable(ref trDataTable, upRowText, dataType);
                            break;

                        default:
                            break;
                    }
                }

                // 수납자료의 고객관리번호를 Concat
                var linqTable = (from a in boDataTable.AsEnumerable() select new { U_RDNO = "'" + a.Field<string>("0140").Trim() + "'" });
                string output = String.Join(",", linqTable.AsEnumerable().Select(a => a.U_RDNO).ToArray());

                
                #region 유효성 체크 - 지로청구 자료가 삭제된 고객관리번호 표시 (개별입금에서 처리하기로 함)
                DBDataSourcesBindingData(oForm, output.Replace("'", ""));
                #endregion


                // 수납자료의 고객관리번호에 해당하는 청구자료 조회
                //output = "14030000000040204118";
                System.Data.DataTable sKIS_SO01601_HRD = null;
                System.Data.DataTable sKIS_SO0220M_HRD = null;
                sKIS_SO01601_HRD = FN.GetRecordsetToDataTable(string.Format("SELECT * FROM [@KIS_SO01601_HRD] WHERE U_RDNO IN ({0})", output)); // 지로청구 테이블
                sKIS_SO0220M_HRD = FN.GetRecordsetToDataTable(string.Format("SELECT * FROM [@KIS_SO0220M_HRD] WHERE U_RDNO IN ({0})", output)); // 지로개별인쇄 테이블


                #region 헤더
                string U_GIRONO = heDataTable.Rows[0]["0020"].ToString().Substring(2, 7);

                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_TRNSDT", heDataTable.Rows[0]["0050"].ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_RELUSER", U_RELUSER);
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_RELDT", U_RELDT);
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_FILENM", Path.GetFileName(strFileName));
                //FN.SetItemValue(ref oForm, "edtTRNSDT", heDataTable.Rows[0]["0050"].ToString());    //이체일자
                //FN.SetItemValue(ref oForm, "edtRELUSER", U_RELUSER);                                //실행자
                //FN.SetItemValue(ref oForm, "edtRELDT", U_RELDT);                                    //실행일
                //FN.SetItemValue(ref oForm, "edtFILENM", Path.GetFileName(strFileName));             //업로드파일
                #endregion


                #region 바디

                string U_RDNO = string.Empty;
                string U_DEPAMT = string.Empty;
                string U_CMMAMT = string.Empty;
                string U_DEPDT = string.Empty;
                string U_ERRCD = string.Empty;
                string U_ERRMSG = string.Empty;
                string U_PREQYM = string.Empty;
                string U_CENTGBN = string.Empty;
                string U_BPPER = string.Empty;

                int U_NOMCNT_S = 0;
                int U_UNSCNT_S = 0;
                int U_TOTCNT_S = boDataTable.Rows.Count;

                int U_NOMAMT_S = 0;
                int U_UNSAMT_S = 0;
                int U_TOTAMT_S = 0;
                int U_CMMAMT_S = 0;

                DataRow[] errDr = null;
                DataRow[] dataDr = null;
                System.Data.DataTable sDataTable = null;

                for (int boidx = 0; boidx < boDataTable.Rows.Count; boidx++)
                {
                    U_RDNO = boDataTable.Rows[boidx]["0140"].ToString();
                    U_DEPAMT = boDataTable.Rows[boidx]["0150"].ToString();
                    U_CMMAMT = boDataTable.Rows[boidx]["0170"].ToString();
                    U_DEPDT = boDataTable.Rows[boidx]["0100"].ToString();
                    U_ERRCD = boDataTable.Rows[boidx]["0160"].ToString();

                    U_TOTAMT_S = U_TOTAMT_S + int.Parse(U_DEPAMT);
                    U_CMMAMT_S = U_CMMAMT_S + int.Parse(U_CMMAMT);

                    errDr = ErrorDataTable.Select(string.Format("U_CD='{0}'", U_ERRCD));
                    if (errDr.Length > 0)
                    {
                        U_ERRMSG = errDr[0]["U_SMLNM"].ToString();
                        U_UNSCNT_S++;
                        U_UNSAMT_S = U_UNSAMT_S + int.Parse(U_DEPAMT);
                    }

                    #region linq datarow
                    //IEnumerable<DataRow> sDataRows = (from a in sKIS_SO01601_HRD.AsEnumerable()
                    //                                  where a.Field<string>("U_RDNO") == U_RDNO //14030000000040204118
                    //                                  select a).Take(1);

                    //System.Data.DataTable rTable = sDataRows.CopyToDataTable();
                    //rTable.Rows[0]["U_RDCD"].ToString();
                    #endregion
                    #region linq foreach
                    //var lKIS_SO01601_HRD = (from a in sKIS_SO01601_HRD.AsEnumerable()
                    //                        where a.Field<string>("U_RDNO") == U_RDNO
                    //                        select new
                    //                        {
                    //                            U_GIRONO = a.Field<string>("U_GIRONO").Trim(),
                    //                            U_RDCD = a.Field<string>("U_RDCD").Trim(),
                    //                            U_RDNM = a.Field<string>("U_RDNM").Trim(),
                    //                            U_RDNO = a.Field<string>("U_RDNO").Trim(),
                    //                            U_ZIPCD1 = a.Field<string>("U_ZIPCD1").Trim(),
                    //                            U_ADDR1 = a.Field<string>("U_ADDR1").Trim(),
                    //                            U_ADDR1_D = a.Field<string>("U_ADDR1_D").Trim(),
                    //                            U_ZIPCD2 = a.Field<string>("U_ZIPCD2").Trim(),
                    //                            U_ADDR2 = a.Field<string>("U_ADDR2").Trim(),
                    //                            U_ADDR2_D = a.Field<string>("U_ADDR2_D").Trim(),
                    //                            U_BRCCD = a.Field<string>("U_BRCCD").Trim(),
                    //                            U_REQYM = a.Field<string>("U_REQYM").Trim(),
                    //                            U_CNT = a.Field<int>("U_CNT"),
                    //                            U_USEYM = a.Field<string>("U_USEYM").Trim(),
                    //                            U_REQAMT = a.Field<int>("U_REQAMT"),
                    //                            U_PMETHOD = a.Field<string>("U_PMETHOD").Trim(),
                    //                            U_MARKYM = a.Field<string>("U_MARKYM").Trim(),
                    //                            U_PAYCD = a.Field<string>("U_PAYCD").Trim()
                    //                        }).Take(1);

                    //foreach (var linqRow in lKIS_SO01601_HRD)
                    //{
                    //    linqRow.U_ADDR1
                    //}
                    #endregion


                    // 지로청구내역 조회
                    sDataTable = null;
                    dataDr = null;

                    sDataTable = sKIS_SO01601_HRD.Copy();
                    dataDr = sDataTable.Select(string.Format("U_RDNO='{0}'", U_RDNO));

                    if (dataDr.Length == 0)
                    {
                        sDataTable = sKIS_SO0220M_HRD.Copy();
                        dataDr = sKIS_SO0220M_HRD.Select(string.Format("U_RDNO='{0}'", U_RDNO));
                    }

                    if (dataDr.Length > 0)
                    {
                        oMatrix.AddRow();

                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_GIRONO", U_GIRONO);                                           // 지로번호
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDNO", U_RDNO);                                               // 고객관리번호
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DEPAMT", U_DEPAMT);                                           // 입금액
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_CMMAMT", U_CMMAMT);                                           // 수수료
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_DEPDT", U_DEPDT);                                             // 입금일자
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ERRCD", U_ERRCD);                                             // 에러코드
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ERRMSG", U_ERRMSG);                                           // 에러명칭


                        if (sDataTable.Columns.Contains("U_PREQYM"))
                            U_PREQYM = dataDr[0]["U_PREQYM"].ToString();
                        else
                            U_PREQYM = dataDr[0]["U_REQYM"].ToString();

                        if (sDataTable.Columns.Contains("U_CENTGBN"))
                            U_CENTGBN = dataDr[0]["U_CENTGBN"].ToString();
                        else
                            U_CENTGBN = "";

                        if (sDataTable.Columns.Contains("U_BPPER"))
                            U_BPPER = dataDr[0]["U_BPPER"].ToString();
                        else
                            U_BPPER = "";


                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDCD", dataDr[0]["U_RDCD"].ToString());                   // 독자코드
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_RDNM", dataDr[0]["U_RDNM"].ToString());                   // 청구처이름
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ZIPCD1", dataDr[0]["U_ZIPCD1"].ToString());               // 우편번호1
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR1", dataDr[0]["U_ADDR1"].ToString());                 // 주소1
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR1_D", dataDr[0]["U_ADDR1_D"].ToString());             // 주소1 상세
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ZIPCD2", dataDr[0]["U_ZIPCD2"].ToString());               // 우편번호2
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR2", dataDr[0]["U_ADDR2"].ToString());                 // 주소2
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_ADDR2_D", dataDr[0]["U_ADDR2_D"].ToString());             // 주소2 상세
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_BRCCD", dataDr[0]["U_BRCCD"].ToString());                 // 지국코드
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_BRCNM", dataDr[0]["U_BRCNM"].ToString());                 // 지국명칭
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_REQYM", dataDr[0]["U_REQYM"].ToString());                 // 청구월 (TR)
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_CNT", dataDr[0]["U_CNT"].ToString());                     // 부수
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_USEYM", dataDr[0]["U_USEYM"].ToString());                 // 사용월 (TR)
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_REQAMT", dataDr[0]["U_REQAMT"].ToString());               // 청구금액
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PMETHOD", dataDr[0]["U_PMETHOD"].ToString());             // 납부방법
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_MARKYM", dataDr[0]["U_MARKYM"].ToString());               // 표기년월
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PAYCD", dataDr[0]["U_PAYCD"].ToString());                 // 요금제코드
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PAPERTP", dataDr[0]["U_PAPERTP"].ToString());             // 지종
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_CENTGBN", U_CENTGBN);                                     // 분국구분
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_BPPER", U_BPPER);                                         // 담당자
                        oMatrix.SetCellWithoutValidation(oMatrix.RowCount, "U_PREQYM", U_PREQYM);                                       // 지로청구월 (지로청구마스터의 청구월)
                    }
                    //else
                    //{
                    //    throw new Exception("고객관리번호[" + U_RDNO + "]가 존재하지 않습니다. 지로청구 자료를 확인해 주세요.");
                    //}
                }

                #endregion


                #region 합계

                U_NOMCNT_S = U_TOTCNT_S - U_UNSCNT_S;
                U_NOMAMT_S = U_TOTAMT_S - U_UNSAMT_S;

                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_NOMCNT", U_NOMCNT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_UNSCNT", U_UNSCNT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_TOTCNT", U_TOTCNT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_NOMAMT", U_NOMAMT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_UNSAMT", U_UNSAMT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_TOTAMT", U_TOTAMT_S.ToString());
                FN.SetDataSourceValue(oForm, "@KIS_SO0170T_HRD.U_CMMAMT", U_CMMAMT_S.ToString());

                #endregion


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

                oMatrix.Clear();
                oMatrix.FlushToDataSource();

                heDataTable.Clear();
                boDataTable.Clear();
                trDataTable.Clear();
            }
            finally
            {
                oForm.Freeze(false);
            }

        }
Beispiel #31
0
        public virtual bool ET_BFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {



                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(gSelMtx).Specific;
                string strIndex = FN.GetMatirxCellValue(ref oMatrix, "U_IDX", gRowIdx);
                //string strLineID = gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[int.Parse(strIndex)]["LINEID"].ToString();
                string strDeliveryCode = FN.GetMatirxCellValue(ref oMatrix, "U_DELVCD", gRowIdx);
                int idx = int.Parse(strIndex);

                if (gSelMtx == "mtx1_DUMY")
                {
                    //// 메인삭제전 상담이력을 삭제한다.
                    if (DeleteMatrixRows_CALL(strDeliveryCode))
                    {
                        // 1. DataTable 에서 행삭제
                        gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.RemoveAt(idx);

                        oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_ORIG").Specific;
                        if (oMatrix.VisualRowCount > idx)
                        {

                            //ExportDataSetToFiles();
                            // 화면단에서 행추가한건에대해서 원본메트릭스에서 삭제하지 않는다.

                            // 2. 원본 데이터 삭제
                            oMatrix.DeleteRow(idx + 1);
                            oMatrix.FlushToDataSource();

                        }

                        // 3. 구독부수 재계산하고 적용한다.
                        SetSumNumberOfCofies(oForm);
                    }
                    else
                        return false;
                }
                else
                {
                    oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_ORIG").Specific;

                    // 1. DataTable 에서 행삭제
                    gDs.Tables[oForm.UniqueID + "_Call"].Rows.RemoveAt(idx);
                    if (oMatrix.VisualRowCount > idx)
                    {
                        // 2. 원본 데이터 삭제
                        oMatrix.DeleteRow(idx + 1);
                        oMatrix.FlushToDataSource();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return true;
        }
Beispiel #32
0
        /// <summary>
        /// 저장 전에 필수 항목을 체크 합니다.
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool BeforeSave(SAPbouiCOM.Form oForm)
        {
            SAPbouiCOM.DBDataSource oKIS_SO00401_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SO00401_HRD");

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

                oMatrix.FlushToDataSource();
                FN.SetDBDataSourceDeleteRow(ref oKIS_SO00401_HRD, "U_CENTCD");
                oMatrix.LoadFromDataSource();


                // 1.필수 항목 체크
                string chkColumnList = string.Empty;
                string chkStaticList = string.Empty;

                chkColumnList = "cboAREA,edtCode,edtName,cboBRCGBN,edtCARDCD,edtCARDNM"; //cboPAPERTP,edtPAYCNT
                chkStaticList = "sttAREA,sttCode,sttName,sttBRCGBN,sttCARDCD,sttCARDNM"; //sttPAPERTP,sttPAYCNT
                if (!FN.CondValidationChk(oForm, chkColumnList, chkStaticList)) return false;


                chkColumnList = "U_CENTCD,U_CENTNM,U_SNM,U_STATUS||U_CENTGBN";
                //if (!FN.ValidationChk(oForm, "mtx1", chkColumnList)) return false;
                if (!SO.SO_COMMON_HRD.ValidationChk(oForm, "mtx1", chkColumnList)) return false;

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

            return true;
        }
Beispiel #33
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {

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


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




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

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

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

                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32      i;
            TFunctions Param;

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

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

                Lista = new List <string>();

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

                VID_DelRow   = false;
                VID_DelRowOK = false;

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

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

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

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

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

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

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

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

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



                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Beispiel #35
0
        public virtual void ET_mtx2_DUMY_AFDoubleClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx2_DUMY").Specific));
            // ADD YOUR ACTION CODE HERE ...
            string sTYPE = "";
            try
            {
                if (pVal.Row != 0)
                {
                    //접수자ID 와 로그인 ID 가 다를경우 접수내용 수정 불가
                    oMatrix.FlushToDataSource();

                    if ((oMatrix.GetCellSpecific("U_RECVID", pVal.Row).Value.Trim() == B1Connections.diCompany.UserName.ToString()) && (sFindTY == "F"))
                    { sTYPE = "TRUE"; }
                    else { sTYPE = "FASLE"; }

                    oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                    string extCOM = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_MEMO", pVal.Row)).Value.Trim();
                    string strChildFormID = oForm.DataSources.UserDataSources.Item("cFORMUID2").Value;
                    if (!FN.GetFormExistsChk(strChildFormID))
                    {
                        KIS_SO0033A_HRD SO0033A_HRD = new KIS_SO0033A_HRD();
                        SO0033A_HRD.A00_SubFormInit(oForm.UniqueID, pVal.Row, extCOM, "접수내용", "CallBack", sTYPE);
                        SO0033A_HRD = null;
                    }
                    else
                    {
                        SAPbouiCOM.Form pForm = pForm = B1Connections.theAppl.Forms.Item(strChildFormID);
                        KIS_SO0033A_HRD.extSetting(pForm, extCOM, pVal.Row);
                        pForm.Select();
                        pForm = null;
                    }
                }

            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #36
0
        private void updateInvoice()
        {
            int k = dtDetail.Rows.Count;

            Hashtable oldDelWhs = new Hashtable(), oldTypeCode = new Hashtable(), oldPickWhs = new Hashtable();

            for (int i = 0; i < k; i++)
            {
                oldDelWhs.Add(i, Convert.ToString(dtDetail.GetValue("DelWhs", i)));
                oldTypeCode.Add(i, Convert.ToString(dtDetail.GetValue("TypeCode", i)));
                oldPickWhs.Add(i, Convert.ToString(dtDetail.GetValue("PickWhs", i)));
            }
            mtDet.FlushToDataSource();

            //if (!validateinput())
            //{
            //    return;
            //}


            string DIERror = "";


            string updatShipDate = "";

            for (int i = 0; i < k; i++)
            {
                DateTime ndelDate = Convert.ToDateTime(dtDetail.GetValue("nDelDate", i));
                DateTime deldate  = Convert.ToDateTime(dtDetail.GetValue("DelDate", i));
                if (ndelDate != deldate)
                {
                    if (ndelDate < DateTime.Now.Date)
                    {
                        oApplication.SetStatusBarMessage("Old Delivery Date for Line : " + (i + 1).ToString());
                        return;
                    }
                }
            }


            updatShipDate = "";
            for (int i = 0; i < k; i++)
            {
                // updatShipDate += "Update inv1  set shipdate='" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "', FreeTxt = 'what reading'   where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";

                string PickDate  = Convert.ToString(dtDetail.GetValue("nPickDate", i));
                string PickShift = dtDetail.GetValue("nPickShift", i);
                if (PickDate != "" && PickShift != "")
                {
                    updatShipDate += "Update inv1 set U_DelTypCd = '" + Convert.ToString(dtDetail.GetValue("TypeCode", i)) + "' ,  shipdate='" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "' , U_DelShift='" + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "',";
                    updatShipDate += "  U_DeliveryWH ='" + Convert.ToString(dtDetail.GetValue("DelWhs", i)) + "',U_PickingWh='" + Convert.ToString(dtDetail.GetValue("PickWhs", i)) + "' , U_PickShift ='" + Convert.ToString(dtDetail.GetValue("nPickShift", i)) + "' , u_PickDate = '" + Convert.ToString(dtDetail.GetValue("nPickDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                }
                else
                {
                    updatShipDate += "Update inv1 set  U_DelTypCd = '" + Convert.ToString(dtDetail.GetValue("TypeCode", i)) + "' , shipdate='" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "' , U_DeliveryWH ='" + Convert.ToString(dtDetail.GetValue("DelWhs", i)) + "',U_PickingWh='" + Convert.ToString(dtDetail.GetValue("PickWhs", i)) + "' ,  U_DelShift='" + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "' where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                }
            }


            Program.objHrmsUI.ExecQuery(updatShipDate, "Temp Update Ship Date");


            try
            {
                SAPbobsCOM.Documents ARInv = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
                ARInv.GetByKey(Convert.ToInt32(Convert.ToString(dtDetail.GetValue("DocEntry", 0))));

                for (int i = 0; i < k; i++)
                {
                    int lineNum = Convert.ToInt32(Convert.ToString(dtDetail.GetValue("LineNum", i)));
                    ARInv.Lines.SetCurrentLine(i);
                    try
                    {
                        // ARInv.Lines.ShipDate = Convert.ToDateTime(dtDetail.GetValue("nDelDate", i));
                        ARInv.Lines.UserFields.Fields.Item("U_DelTypCd").Value   = Convert.ToString(dtDetail.GetValue("TypeCode", i));
                        ARInv.Lines.UserFields.Fields.Item("U_DelShift").Value   = Convert.ToString(dtDetail.GetValue("nDelShift", i));
                        ARInv.Lines.UserFields.Fields.Item("U_DeliveryWH").Value = Convert.ToString(dtDetail.GetValue("DelWhs", i));
                        ARInv.Lines.UserFields.Fields.Item("U_PickingWh").Value  = Convert.ToString(dtDetail.GetValue("PickWhs", i));
                        ARInv.Lines.UserFields.Fields.Item("U_PickShift").Value  = Convert.ToString(dtDetail.GetValue("nPickShift", i));
                        if (Convert.ToString(dtDetail.GetValue("nPickDate", i)) != "")
                        {
                            ARInv.Lines.UserFields.Fields.Item("U_PickDate").Value = Convert.ToDateTime(dtDetail.GetValue("nPickDate", i));
                        }
                        else
                        {
                            ARInv.Lines.UserFields.Fields.Item("U_PickDate").Value = "";
                        }
                        //   ARInv.Lines.FreeText = "What Reaching";
                        //     ARInv.Lines.SetCurrentLine(lineNum);
                    }
                    catch (Exception ex)
                    {
                        oApplication.SetStatusBarMessage("Assigning Values : " + ex.Message);
                        DIERror += "Assignment Error : " + ex.Message;
                    }
                }
                int result = 0;
                result = ARInv.Update();
                if (result != 0)
                {
                    int    errorCode = 0;
                    string errmsg    = "";
                    oCompany.GetLastError(out errorCode, out errmsg);
                    oApplication.SetStatusBarMessage(errmsg);
                    DIERror      += errmsg;
                    updatShipDate = "";
                    for (int i = 0; i < k; i++)
                    {
                        // updatShipDate += "Update inv1  set shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";


                        string PickDate  = Convert.ToString(dtDetail.GetValue("nPickDate", i));
                        string PickShift = dtDetail.GetValue("nPickShift", i);
                        if (PickDate != "" && PickShift != "")
                        {
                            updatShipDate += "Update inv1 set U_DelTypCd = '" + oldTypeCode[i].ToString() + "' ,  shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "' , U_DelShift='" + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "',";
                            updatShipDate += "  U_DeliveryWH ='" + oldDelWhs[i].ToString() + "',U_PickingWh='" + oldPickWhs[i].ToString() + "' , U_PickShift ='" + Convert.ToString(dtDetail.GetValue("PickShift", i)) + "' , u_PickDate = '" + Convert.ToString(dtDetail.GetValue("PickDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                        }
                        else
                        {
                            updatShipDate += "Update inv1 set  U_DelTypCd = '" + oldTypeCode[i].ToString() + "' , shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "' , U_DeliveryWH ='" + oldDelWhs[i].ToString() + "',U_PickingWh='" + oldPickWhs[i].ToString() + "' ,  U_DelShift='" + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "' where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                        }
                    }
                    Program.objHrmsUI.ExecQuery(updatShipDate, "Temp Update Ship Date");
                }
                else
                {
                    for (int i = 0; i < k; i++)
                    {
                        string oinvHeader = "";

                        oinvHeader += " update oinv set header = isnull( convert(varchar,header),'')  + ' Schedule Updated for  " + Convert.ToString(dtDetail.GetValue("LineNum", i)) + " -" + Convert.ToString(dtDetail.GetValue("ItemCode", i)) + ". Old Values (" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "," + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "," + Convert.ToString(dtDetail.GetValue("PickDate", i)) + "," + Convert.ToString(dtDetail.GetValue("PickShift", i)) + ") ";
                        oinvHeader += "  New Values (" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "," + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "," + Convert.ToString(dtDetail.GetValue("nPickDate", i)) + "," + Convert.ToString(dtDetail.GetValue("nPickShift", i)) + ") ' where docentry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' ";

                        Program.objHrmsUI.ExecQuery(oinvHeader, "Updating Remarks");
                    }
                }
            }
            catch (Exception ex)
            {
                DIERror = ex.Message;

                oApplication.SetStatusBarMessage("General Error !" + ex.Message + " Known Error " + DIERror, BoMessageTime.bmt_Short, false);
                updatShipDate = "";
                for (int i = 0; i < k; i++)
                {
                    // updatShipDate += "Update inv1  set shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ; ";
                    string PickDate  = Convert.ToString(dtDetail.GetValue("nPickDate", i));
                    string PickShift = dtDetail.GetValue("nPickShift", i);
                    if (PickDate != "" && PickShift != "")
                    {
                        updatShipDate += "Update inv1 set U_DelTypCd = '" + oldTypeCode[i].ToString() + "' ,  shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "' , U_DelShift='" + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "',";
                        updatShipDate += "  U_DeliveryWH ='" + oldDelWhs[i].ToString() + "',U_PickingWh='" + oldPickWhs[i].ToString() + "' , U_PickShift ='" + Convert.ToString(dtDetail.GetValue("PickShift", i)) + "' , u_PickDate = '" + Convert.ToString(dtDetail.GetValue("PickDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                    }
                    else
                    {
                        updatShipDate += "Update inv1 set  U_DelTypCd = '" + oldTypeCode[i].ToString() + "' , shipdate='" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "' , U_DeliveryWH ='" + oldDelWhs[i].ToString() + "',U_PickingWh='" + oldPickWhs[i].ToString() + "' ,  U_DelShift='" + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "' where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ;";
                    }
                }
                Program.objHrmsUI.ExecQuery(updatShipDate, "Temp Update Ship Date");
            }



            //// Old Code ///

            /*
             * if (!validateinput())
             * {
             *  return;
             * }
             * int k = dtDetail.Rows.Count;
             * for (int i = 0; i < k; i++)
             * {
             *  string updateLine="";
             *  string oinvHeader = "";
             *  string PickDate = Convert.ToString( dtDetail.GetValue("nPickShift",i));
             *  string PickShift = dtDetail.GetValue("nPickShift",i);
             *  if(PickDate !="" && PickShift!="")
             *  {
             *      updateLine = "Update inv1 set U_DelTypCd = '" + Convert.ToString(dtDetail.GetValue("TypeCode", i)) + "' ,  shipdate='" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "' , U_DelShift='" + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "',";
             *      updateLine += "  U_DeliveryWH ='" + Convert.ToString(dtDetail.GetValue("DelWhs", i)) + "',U_PickingWh='" + Convert.ToString(dtDetail.GetValue("PickWhs", i)) + "' , U_PickShift ='" + Convert.ToString(dtDetail.GetValue("nPickShift", i)) + "' , u_PickDate = '" + Convert.ToString(dtDetail.GetValue("nPickDate", i)) + "'  where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ";
             *
             *  }
             *  else
             *  {
             *      updateLine = "Update inv1 set  U_DelTypCd = '" + Convert.ToString(dtDetail.GetValue("TypeCode", i)) + "' , shipdate='" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "' , U_DeliveryWH ='" + Convert.ToString(dtDetail.GetValue("DelWhs", i)) + "',U_PickingWh='" + Convert.ToString(dtDetail.GetValue("PickWhs", i)) + "' ,  U_DelShift='" + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "' where DocEntry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' and linenum='" + Convert.ToString(dtDetail.GetValue("LineNum", i)) + "' ";
             *  }
             *  oinvHeader += " update oinv set header = isnull( convert(varchar,header),'')  + ' Schedule Updated for  " + Convert.ToString(dtDetail.GetValue("LineNum", i)) + " -" + Convert.ToString(dtDetail.GetValue("ItemCode", i)) + ". Old Values (" + Convert.ToString(dtDetail.GetValue("DelDate", i)) + "," + Convert.ToString(dtDetail.GetValue("DelShift", i)) + "," + Convert.ToString(dtDetail.GetValue("PickDate", i)) + "," + Convert.ToString(dtDetail.GetValue("PickShift", i)) + ") ";
             *  oinvHeader += "  New Values (" + Convert.ToString(dtDetail.GetValue("nDelDate", i)) + "," + Convert.ToString(dtDetail.GetValue("nDelShift", i)) + "," + Convert.ToString(dtDetail.GetValue("nPickDate", i)) + "," + Convert.ToString(dtDetail.GetValue("nPickShift", i)) + ") ' where docentry = '" + Convert.ToString(dtDetail.GetValue("DocEntry", i)) + "' ";
             *
             *  Program.objHrmsUI.ExecQuery(updateLine, "Updating Schedule");
             *  Program.objHrmsUI.ExecQuery(oinvHeader, "Updating Remarks");
             *
             *
             *
             * }
             *
             *
             *
             *//// old Code Ended


            //    oApplication.SetStatusBarMessage("Schedule Updated Successfully!", BoMessageTime.bmt_Short, false);
            if (DIERror == "")
            {
                oApplication.SetStatusBarMessage("Schedule Updated Successfully!", BoMessageTime.bmt_Short, false);
                loadInvoice();
            }
        }