예제 #1
0
파일: frm_150.cs 프로젝트: ubaidmughal/SAP
        private void fillCmb()
        {
            string subGrpCode = Convert.ToString(dbOITM.GetValue("U_SubGrp", 0));

            while (cbSubGroup.ValidValues.Count > 1)
            {
                try
                {
                    cbSubGroup.ValidValues.Remove(1, BoSearchKey.psk_Index);
                }
                catch { }
            }
            if (cbSubGroup.ValidValues.Count == 0)
            {
                cbSubGroup.ValidValues.Add("-1", "[No Sub Group]");
            }
            cbSubGroup.Select(0, BoSearchKey.psk_Index);


            fillChilds(dbOITM.GetValue("ItmsGrpCod", 0), "");

            try
            {
                if (subGrpCode != "-1" && subGrpCode != "")
                {
                    cbSubGroup.Select(subGrpCode.Trim(), BoSearchKey.psk_ByValue);
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #2
0
        private void openITB()
        {
            frm_ITB objScr = new frm_ITB();

            objScr.rootGroup     = dbOITB.GetValue("ItmsGrpCod", 0);
            objScr.rootGroupName = dbOITB.GetValue("ItmsGrpNam", 0);
            try
            {
                objScr.CreateForm(oApplication, "ACHR.XMLScreen.ln_English.xml_ITB.xml", oCompany, "frm_ITB");
                oApplication.Forms.Item("frm_ITB").Select();
            }
            catch (Exception ex)
            {
                oApplication.MessageBox(ex.Message);
            }
        }
예제 #3
0
파일: frm_141.cs 프로젝트: ubaidmughal/SAP
 public override void etAfterClick(ref ItemEvent pVal, ref bool BubbleEvent)
 {
     base.etAfterClick(ref pVal, ref BubbleEvent);
     if (pVal.ItemUID == btALC.Item.UniqueID)
     {
         postAllocationJE(Convert.ToInt32(dbOPCH.GetValue("DocEntry", 0)));
         //oApplication.MessageBox("Posting Allocation Entry");
     }
 }
        }//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 MenuEvent

        private void GuardarRegistros()
        {
            TFunctions Reg;
            Int32      _return;

            try
            {
                if (Validar())
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select count(*) 'cont' from [@VID_FEDIST] where DocEntry = '{0}'";
                    }
                    else
                    {
                        s = @"select COUNT(*) ""cont"" from ""@VID_FEDIST"" where ""DocEntry"" = '{0}' ";
                    }
                    s = String.Format(s, (System.String)(oDBDSH.GetValue("DocEntry", 0)));
                    oRecordSet.DoQuery(s);
                    Reg       = new TFunctions();
                    Reg.SBO_f = FSBOf;
                    oMtx.FlushToDataSource();
                    if ((System.Int32)(oRecordSet.Fields.Item("cont").Value) == 0)
                    {
                        _return = Reg.FEDistAdd(oDBDSH, oDBDSD);
                    }
                    else
                    {
                        _return = Reg.FEDistUpt(oDBDSH, oDBDSD);
                    }

                    if (_return > 0)
                    {
                        oDBDSH.SetValue("DocEntry", 0, Convert.ToString(_return));
                        oForm.Mode = BoFormMode.fm_OK_MODE;
                    }
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin GuardarRegistros
예제 #6
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 InitForm

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

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

            try
            {
                if ((pVal.ItemUID == "1") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if (oForm.Mode == BoFormMode.fm_OK_MODE)
                    {
                        BubbleEvent = true;
                    }
                    else
                    {
                        BubbleEvent = false;

                        if (oForm.Mode == BoFormMode.fm_ADD_MODE)
                        {
                            oDBDSHeader.SetValue("Code", 0, "1");
                            bRes = Funciones.AddDataSource1("VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null);
                        }
                        else if (oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                        {
                            bRes = Funciones.UpdDataSource1("M", ((System.String)oDBDSHeader.GetValue("Code", 0)).Trim(), "VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null);
                        }


                        if (bRes)
                        {
                            oForm.Mode = BoFormMode.fm_OK_MODE;
                            FSBOApp.StatusBar.SetText("Se registraron satisfactoriamente los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("No se ha registrado los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
예제 #8
0
        public override void etAfterClick(ref ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterClick(ref pVal, ref BubbleEvent);
            if (pVal.ItemUID == B1_INS.Item.UniqueID)
            {
                if (oForm.Mode != BoFormMode.fm_OK_MODE)
                {
                    oApplication.MessageBox("Please save changes before sending it for inspaction");
                    return;
                }
                string DE        = Convert.ToString(dbOWOR.GetValue("DocEntry", 0));
                string BS        = Convert.ToString(dbOWOR.GetValue("U_B1_QA_INSBSN", 0));
                int    StartFrom = Convert.ToInt32(dbOWOR.GetValue("U_B1_QA_INSBSNST", 0));

                if (BS == "")
                {
                    oApplication.MessageBox("Please update Batch / Serial # for item");
                    return;
                }
                string GR = Convert.ToString(dbOWOR.GetValue("U_B1_QA_INSGR", 0));
                if (GR != "")
                {
                    oApplication.MessageBox("Already Sent for Inspaction");
                    return;
                }
                string ItemCode   = Convert.ToString(dbOWOR.GetValue("ItemCode", 0));
                double plannedQty = Convert.ToDouble(dbOWOR.GetValue("PlannedQty", 0));
                B1_INS.Item.Enabled = false;
                PostInspaction(DE, ItemCode, plannedQty, BS, StartFrom);
                B1_INS.Item.Enabled = true;
            }
        }
예제 #9
0
        public override void etAfterCmbSelect(ref ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterCmbSelect(ref pVal, ref BubbleEvent);
            if (pVal.ItemUID == "39")
            {
                fillCmb();
            }
            if (pVal.ItemUID == cbSubGroup.Item.UniqueID.ToString())
            {
                string subGrpCode2 = Convert.ToString(dbOITM.GetValue("U_SubGrp2", 0));

                fillCmb2(subGrpCode2);
            }
        }
        }//fin AddChooseFromList

        public new void MenuEvent(ref MenuEvent pVal, ref Boolean BubbleEvent)
        {
            //Int32 Entry;
            base.MenuEvent(ref pVal, ref BubbleEvent);
            try
            {
                //1281 Buscar;
                //1282 Crear
                //1284 cancelar;
                //1285 Restablecer;
                //1286 Cerrar;
                //1288 Registro siguiente;
                //1289 Registro anterior;
                //1290 Primer Registro;
                //1291 Ultimo Registro;

                if ((pVal.MenuUID != "") && (pVal.BeforeAction == false))
                {
                    if ((pVal.MenuUID == "1288") || (pVal.MenuUID == "1289") || (pVal.MenuUID == "1290") || (pVal.MenuUID == "1291"))
                    {
                        if (oMtx.RowCount > 0)
                        {
                            if ((System.String)(oDBDSD.GetValue("U_Indicato", oMtx.RowCount - 1)) != "")
                            {
                                oMtx.AddRow(1, oMtx.RowCount);
                                oMtx.FlushToDataSource();
                                oDBDSD.SetValue("U_Indicato", oMtx.RowCount - 1, "");
                                oDBDSD.SetValue("U_Descrip", oMtx.RowCount - 1, "");
                                oMtx.LoadFromDataSource();
                            }
                        }
                    }

                    if (pVal.MenuUID == "1282")
                    {
                        oMtx.AddRow(1, 1);
                        oMtx.FlushToDataSource();
                        oDBDSD.SetValue("U_Indicato", oMtx.RowCount - 1, "");
                        oDBDSD.SetValue("U_Descrip", oMtx.RowCount - 1, "");
                        oMtx.LoadFromDataSource();
                    }
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("MenuEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        } //fin MenuEvent
예제 #11
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();
        }
예제 #12
0
        }//fin FormEvent

        private Boolean AddDatos(String Tipo)
        {
            TFunctions Param;
            String     usuario;
            String     password;
            Boolean    _return;
            String     UserWSCL;
            String     PassWSCL;

            try
            {
                _return = false;
                if (ValidacionFinal())
                {
                    usuario  = (System.String)(oDBDSHeader.GetValue("U_Usuario", 0)).Trim();
                    password = (System.String)(oDBDSHeader.GetValue("U_Password", 0)).Trim();
                    UserWSCL = (System.String)(oDBDSHeader.GetValue("U_UserWSCL", 0)).Trim();
                    PassWSCL = (System.String)(oDBDSHeader.GetValue("U_PassWSCL", 0)).Trim();

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

                    s = Param.Encriptar(usuario);
                    oDBDSHeader.SetValue("U_Usuario", 0, s);

                    s = Param.Encriptar(password);
                    oDBDSHeader.SetValue("U_Password", 0, s);

                    if (UserWSCL != "")
                    {
                        s = Param.Encriptar(UserWSCL);
                        oDBDSHeader.SetValue("U_UserWSCL", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_UserWSCL", 0, "");
                    }

                    if (PassWSCL != "")
                    {
                        s = Param.Encriptar(PassWSCL);
                        oDBDSHeader.SetValue("U_PassWSCL", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_PassWSCL", 0, "");
                    }

                    if (DSOpDif.Value == "1")
                    {
                        oDBDSHeader.SetValue("U_TipoDif", 0, "P");
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_TipoDif", 0, "M");
                    }

                    if (Tipo == "1")
                    {
                        _return = Param.ParamUpd(oDBDSHeader);
                    }
                    else
                    {
                        _return = Param.ParamAdd(oDBDSHeader);
                    }

                    oDBDSHeader.SetValue("U_Usuario", 0, usuario);
                    oDBDSHeader.SetValue("U_Password", 0, password);
                    oDBDSHeader.SetValue("U_UserWSCL", 0, UserWSCL);
                    oDBDSHeader.SetValue("U_PassWSCL", 0, PassWSCL);

                    _return = true;
                }
                return(_return);
            }
            catch (Exception e)
            {
                OutLog("AddDatos : " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.StatusBar.SetText("AddDatos : " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return(false);
            }
        }//fin AddDatos
예제 #13
0
        private void SetSystemDataTable(SAPbouiCOM.Form oForm)
        {
            try
            {     
                oDB1_O = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301_HRD");
                oDB2_O = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00302_HRD");

                oDB1_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301Z_HRD");
                oDB1_Z.Clear();
                             
                //if (gDs.Tables[oForm.UniqueID + "_Deliver"] != null)
                //    gDs.Tables[oForm.UniqueID + "_Deliver"].Clear();
                //else
                //    gDs.Tables[oForm.UniqueID + "_Deliver"] = SetParameterDataTableSchema(oForm.UniqueID+"Deliver");

                if (gDs.Tables.Contains(oForm.UniqueID + "_Deliver"))
                {
                    gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.Clear();
                }
                else
                {
                    System.Data.DataTable dt = SetParameterDataTableSchema(oForm.UniqueID + "_Deliver");
                    gDs.Tables.Add(dt);
                }
                if (oDB1_O.Size > 0 && oDB1_O.GetValue("U_DELVCD", 0).ToString().Trim() != "")
                {

                    for (int i = 0; i < oDB1_O.Size; i++)
                    {
                        System.Data.DataRow dr;

                        // 데이터 필터를 위해 DataTable에 담는다.
                        dr = gDs.Tables[oForm.UniqueID + "_Deliver"].NewRow();

                        dr["IDX"] = i; // "DataTable 고유ID"
                        dr["LINEID"] = oDB1_O.GetValue("LineId", i);//"원본라인번호";
                        dr["DELVCD"] = oDB1_O.GetValue("U_DELVCD", i).Trim(); //"배달코드";
                        dr["RDEPT"] = oDB1_O.GetValue("U_RDEPT", i).Trim(); //"부서";
                        dr["PAPERTP"] = oDB1_O.GetValue("U_PAPERTP", i).Trim(); //"지종";
                        dr["PAYCD"] = oDB1_O.GetValue("U_PAYCD", i).Trim(); //"요금제코드";
                        dr["PAYNM"] = oDB1_O.GetValue("U_PAYNM", i).Trim(); //"요금제명";
                        dr["TEL"] = oDB1_O.GetValue("U_TEL", i).Trim(); //"연락처";
                        dr["MOBILE"] = oDB1_O.GetValue("U_MOBILE", i).Trim(); //"휴대폰";
                        dr["ADDR1"] = oDB1_O.GetValue("U_ADDR1", i).Trim(); //"주소1";
                        dr["ADDR2"] = oDB1_O.GetValue("U_ADDR2", i).Trim(); //"주소2";
                        dr["ADDR1_D"] = oDB1_O.GetValue("U_ADDR1_D", i).Trim(); //"주소1상세";
                        dr["ADDR2_D"] = oDB1_O.GetValue("U_ADDR2_D", i).Trim(); //"주소2상세";
                        dr["CENTCD"] = oDB1_O.GetValue("U_CENTCD", i).Trim(); //"지국";
                        dr["CENTNM"] = oDB1_O.GetValue("U_CENTNM", i).Trim(); //"지국명";
                        dr["DELVFR"] = oDB1_O.GetValue("U_DELVFR", i).Trim(); //"배달시작일";
                        dr["DELVTO"] = oDB1_O.GetValue("U_DELVTO", i).Trim(); //"배달종료일";
                        dr["DELVCNT"] = oDB1_O.GetValue("U_DELVCNT", i).Trim(); //"배달부수";
                        dr["METHOD"] = oDB1_O.GetValue("U_METHOD", i).Trim(); //"가입방법";
                        dr["SAILCD"] = oDB1_O.GetValue("U_SAILCD", i).Trim(); //"유치자";
                        dr["SAILNM"] = oDB1_O.GetValue("U_SAILNM", i).Trim(); //"유치자";
                        dr["STATUS"] = oDB1_O.GetValue("U_STATUS", i).Trim(); //"배달상태";
                        dr["SDEPT"] = oDB1_O.GetValue("U_SDEPT", i).Trim(); //"유치부서";
                        dr["NOTE"] = oDB1_O.GetValue("U_NOTE", i).Trim(); //"배달상세";

                        dr["JOINDT"] = oDB1_O.GetValue("U_JOINDT", i).Trim(); //"가입일자";
                        dr["CLOSEDT"] = oDB1_O.GetValue("U_CLOSEDT", i).Trim(); //"해지일자";
                        dr["USERSG1"] = oDB1_O.GetValue("U_USERSG1", i).Trim(); //"등록자";
                        dr["READTP"] = oDB1_O.GetValue("U_READTP", i).Trim(); //"독자구분";

                        dr["BTEL1"] = oDB1_O.GetValue("U_BTEL1", i).Trim(); //"분국전화1";
                        dr["BTEL2"] = oDB1_O.GetValue("U_BTEL2", i).Trim(); //"분국전화1";

                        dr["ROWSTATE"] = ""; // 기본: "", 수정: M, 신규: I, 삭제: D 
                        gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.Add(dr);


                        oDB1_Z.InsertRecord(i);

                        oDB1_Z.SetValue("U_NO", i, (i + 1).ToString());//"번호";
                        oDB1_Z.SetValue("U_IDX", i, (i).ToString());//"DataTable 고유ID";
                        oDB1_Z.SetValue("LineId", i, oDB1_O.GetValue("LineId", i));//"원본라인번호";
                        oDB1_Z.SetValue("U_DELVCD", i, oDB1_O.GetValue("U_DELVCD", i).Trim()); //"배달코드";
                        oDB1_Z.SetValue("U_RDEPT", i, oDB1_O.GetValue("U_RDEPT", i).Trim()); //"부서";
                        oDB1_Z.SetValue("U_PAPERTP", i, oDB1_O.GetValue("U_PAPERTP", i).Trim()); //"지종";
                        oDB1_Z.SetValue("U_PAYCD", i, oDB1_O.GetValue("U_PAYCD", i).Trim()); //"요금제코드";
                        oDB1_Z.SetValue("U_PAYNM", i, oDB1_O.GetValue("U_PAYNM", i).Trim()); //"요금제명";
                        oDB1_Z.SetValue("U_TEL", i, oDB1_O.GetValue("U_TEL", i).Trim()); //"연락처";
                        oDB1_Z.SetValue("U_MOBILE", i, oDB1_O.GetValue("U_MOBILE", i).Trim()); //"휴대폰";
                        oDB1_Z.SetValue("U_ADDR1", i, oDB1_O.GetValue("U_ADDR1", i).Trim()); //"주소1";
                        oDB1_Z.SetValue("U_ADDR2", i, oDB1_O.GetValue("U_ADDR2", i).Trim()); //"주소2";
                        oDB1_Z.SetValue("U_ADDR1_D", i, oDB1_O.GetValue("U_ADDR1_D", i).Trim()); //"주소1";
                        oDB1_Z.SetValue("U_ADDR2_D", i, oDB1_O.GetValue("U_ADDR2_D", i).Trim()); //"주소2";
                        oDB1_Z.SetValue("U_CENTCD", i, oDB1_O.GetValue("U_CENTCD", i).Trim()); //"지국";
                        oDB1_Z.SetValue("U_CENTNM", i, oDB1_O.GetValue("U_CENTNM", i).Trim()); //"지국명";
                        oDB1_Z.SetValue("U_DELVFR", i, oDB1_O.GetValue("U_DELVFR", i).Trim()); //"배달시작일";
                        oDB1_Z.SetValue("U_DELVTO", i, oDB1_O.GetValue("U_DELVTO", i).Trim()); //"배달종료일";
                        oDB1_Z.SetValue("U_DELVCNT", i, oDB1_O.GetValue("U_DELVCNT", i).Trim()); //"배달부수";
                        oDB1_Z.SetValue("U_METHOD", i, oDB1_O.GetValue("U_METHOD", i).Trim()); //"가입방법";
                        oDB1_Z.SetValue("U_SAILCD", i, oDB1_O.GetValue("U_SAILCD", i).Trim()); //"유치자";
                        oDB1_Z.SetValue("U_SAILNM", i, oDB1_O.GetValue("U_SAILNM", i).Trim()); //"유치자";
                        oDB1_Z.SetValue("U_STATUS", i, oDB1_O.GetValue("U_STATUS", i).Trim()); //"배달상태";
                        oDB1_Z.SetValue("U_SDEPT", i, oDB1_O.GetValue("U_SDEPT", i).Trim()); //"유치부서";
                        oDB1_Z.SetValue("U_NOTE", i, oDB1_O.GetValue("U_NOTE", i).Trim()); //"배달상세";

                        oDB1_Z.SetValue("U_JOINDT", i, oDB1_O.GetValue("U_JOINDT", i).Trim()); //"가입일자";
                        oDB1_Z.SetValue("U_CLOSEDT", i, oDB1_O.GetValue("U_CLOSEDT", i).Trim()); //"해지일자";
                        oDB1_Z.SetValue("U_USERSG1", i, oDB1_O.GetValue("U_USERSG1", i).Trim()); //"등록자";
                        oDB1_Z.SetValue("U_READTP", i, oDB1_O.GetValue("U_READTP", i).Trim()); //"등록자";     

                        oDB1_Z.SetValue("U_BTEL1", i, oDB1_O.GetValue("U_BTEL1", i).Trim()); //"분국전화1";
                        oDB1_Z.SetValue("U_BTEL2", i, oDB1_O.GetValue("U_BTEL2", i).Trim()); //"분국전화2";    
                    }
                }

                //if (gDs.Tables[oForm.UniqueID + "_Call"] != null)
                //    gDs.Tables[oForm.UniqueID + "_Call"].Clear();
                //else
                //    gDs.Tables[oForm.UniqueID + "_Call"] = SetParameterDataTableSchema(oForm.UniqueID+"Call");
                if (gDs.Tables.Contains(oForm.UniqueID + "_Call"))
                {
                    gDs.Tables[oForm.UniqueID + "_Call"].Rows.Clear();
                }
                else
                {
                    System.Data.DataTable dt = SetParameterDataTableSchema(oForm.UniqueID + "_Call");
                    gDs.Tables.Add(dt);
                }

                if (oDB2_O.Size > 0 && oDB2_O.GetValue("U_DELVCD", 0).ToString().Trim() != "")
                {
                    for (int i = 0; i < oDB2_O.Size; i++)
                    {
                        System.Data.DataRow dr;

                        // 데이터 필터를 위해 DataTable에 담는다.
                        dr = gDs.Tables[oForm.UniqueID + "_Call"].NewRow();
                        dr["IDX"] = i; //"DataTable 고유ID";
                        dr["LINEID"] = oDB2_O.GetValue("LineId", i);//"원본라인번호";
                        dr["DELVCD"] = oDB2_O.GetValue("U_DELVCD", i).Trim(); //"배달코드"
                        dr["CALLTP"] = oDB2_O.GetValue("U_CALLTP", i).Trim(); //"콜유형"
                        dr["MEMO"] = oDB2_O.GetValue("U_MEMO", i).Trim(); //"접수내용"
                        dr["RECVID"] = oDB2_O.GetValue("U_RECVID", i).Trim(); //"접수자ID"
                        dr["RECVNM"] = oDB2_O.GetValue("U_RECVNM", i).Trim(); //"접수자명"
                        dr["RECVDT"] = oDB2_O.GetValue("U_RECVDT", i).Trim(); //"접수일자"
                        dr["RECVTI"] = oDB2_O.GetValue("U_RECVTI", i).Trim(); //"접수시간"
                        dr["RECVTI"] = oDB2_O.GetValue("U_RECVTI", i).Trim(); //"접수시간"
                        dr["PROCID"] = oDB2_O.GetValue("U_PROCID", i).Trim(); //"처리자ID"
                        dr["PROCNM"] = oDB2_O.GetValue("U_PROCNM", i).Trim(); //"처리자명"
                        dr["PROCDT"] = oDB2_O.GetValue("U_PROCDT", i).Trim(); //"처리일자"
                        dr["PROSTAT"] = oDB2_O.GetValue("U_PROSTAT", i).Trim(); //"처리상태"
                        dr["ROWSTATE"] = ""; // 기본: "", 수정: M, 신규: I, 삭제: D 
                        gDs.Tables[oForm.UniqueID + "_Call"].Rows.Add(dr);
                    }
                }
                //else
                //{
                //    gDs.Tables[oForm.UniqueID + "_Call"].Rows.Clear();
                //}


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

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

                // 데이터 로드하면 메트릭스 선택된행 값 초기화 함.(중요)
                gDeliverySelect = -1;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #14
0
        public virtual bool ET_BFDataMenu_Remove(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {
                if (B1Connections.theAppl.MessageBox(" 독자코드 전체를 삭제하시겠습니까? ", 1, "예", "아니오", "") != 1)
                {
                    return false;
                }

                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                if (SO.SO_COMMON_HRD.Authority == SO.SO_COMMON_HRD.AuthorityType.H_Manager)
                {
                    if (!oDB_M.GetValue("Code", 0).Trim().StartsWith("H"))
                    {
                        B1Connections.theAppl.StatusBar.SetText("삭제 권한이 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                        return false;
                    }
                }
                else if (SO.SO_COMMON_HRD.Authority == SO.SO_COMMON_HRD.AuthorityType.J_Manager)
                {
                    if (!oDB_M.GetValue("Code", 0).Trim().StartsWith("J"))
                    {
                        B1Connections.theAppl.StatusBar.SetText("삭제 권한이 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                        return false;
                    }
                }
                else
                {
                    B1Connections.theAppl.StatusBar.SetText("삭제 권한이 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    return false;
                }


                string strExists = FN.GetRecordsetValue(string.Format(" SELECT COUNT(1) FROM [@KIS_SO01401_HRD] WHERE U_READCD = '{0}' ", oDB_M.GetValue("Code", 0).Trim()));
                if (int.Parse(strExists) > 0)
                {
                    B1Connections.theAppl.StatusBar.SetText("트랜젝션이 발생한 데이터는 삭제 할 수 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    return false;
                }

            }
            catch (Exception)
            {
                throw;
            }
            return true;
        }
예제 #15
0
        private void FindRequestData(SAPbouiCOM.Form oForm)
        {
            //ADD YOUR ACTION CODE HERE ...
            SAPbouiCOM.Grid oGrid;

            StringBuilder sb;
            string strREADCD = string.Empty;


            try
            {
                oForm.Freeze(true);
                oUDS = oForm.DataSources.UserDataSources;
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                strREADCD = oDB_M.GetValue("Code", 0).Trim();

                sb = new StringBuilder();
                //조회
                /*
                sb.AppendLine(" SELECT M.U_REQYM    AS U_YYYYMM                                                                                             ");
                sb.AppendLine("      , M.U_AMT      AS REQAMT                                                                                               ");
                sb.AppendLine("      , M.U_DATE     AS DEPO_DATE                                                                                            ");
                sb.AppendLine("      , M.U_INAMT    AS DEPO_AMT                                                                                             ");
                sb.AppendLine("      , M.U_SMLNM + ' ' + M.U_SMLNM2    AS U_PMETHOD                                                                         ");
                sb.AppendLine("      , M.U_STATUS   AS U_STATUS                                                                                             ");
                sb.AppendLine("   FROM (                                                                                                                    ");
                sb.AppendLine(" 		SELECT A.U_READCD                                                                                                   ");
                sb.AppendLine(" 			 , A.U_REQYM                                                                                                    ");
                sb.AppendLine(" 			 , (SELECT SUM(CASE ISNULL(F.U_TYPE, '') WHEN '110' THEN ISNULL(F.U_DEBIT, 0)                                   ");
                sb.AppendLine(" 												 WHEN '120' THEN (-1) * ISNULL(F.U_CREDIT, 0)                               ");
                sb.AppendLine(" 											     ELSE 0 END)                                                                ");
                sb.AppendLine(" 			      FROM [@KIS_SO01403_HRD] F                                                                                 ");
                sb.AppendLine(" 			     WHERE A.DocEntry = F.DocEntry                                                                              ");
                sb.AppendLine(" 				   AND A.LineId = F.U_UPLINEID                                                                              ");
                sb.AppendLine(" 				   AND F.U_TYPE IN ('110', '120') ) AS U_AMT                                                                ");
                sb.AppendLine(" 			 , CASE WHEN ISNULL(B.U_TYPE, '') NOT IN ('110', '120','150') THEN ISNULL(B.U_CREDIT, 0) ELSE 0 END AS U_INAMT  ");
                sb.AppendLine(" 			 , B.U_DATE					                                                                                    ");
                sb.AppendLine(" 			 , ISNULL(B.U_DEBIT,0) AS U_DEBIT                                                                               ");
                sb.AppendLine(" 			 , ISNULL(B.U_CREDIT,0) AS U_CREDIT                                                                             ");
                sb.AppendLine(" 			 , B.U_TYPE                                                                                                     ");
                sb.AppendLine(" 			 , (SELECT F.U_SMLNM FROM [@KIS_AD00201] F WHERE F.Code = 'SO54' AND F.U_CD = B.U_TYPE) AS U_SMLNM              ");
                sb.AppendLine(" 			 , (SELECT F.U_SMLNM FROM [@KIS_AD00201] F WHERE F.Code = 'SO51' AND F.U_SMLCD = B.U_SUBTYPE) AS U_SMLNM2       ");
                sb.AppendLine(" 			 , A.U_STATUS                                                                                                   ");
                sb.AppendLine(" 		  FROM [@KIS_SO01401_HRD] A                                                                                         ");
                sb.AppendLine(" 		       LEFT OUTER JOIN [@KIS_SO01403_HRD] B ON A.DocEntry = B.DocEntry                                              ");
                sb.AppendLine(" 													AND A.LineId = B.U_UPLINEID                                             ");
                sb.AppendLine(" 													AND B.U_TYPE NOT IN ('110', '120', '150')                               ");
                sb.AppendLine(" 	   ) M                                                                                                                  ");
                sb.AppendLine("   WHERE M.U_AMT <> 0 AND M.U_READCD = '{0}'                                                                                 ");
                sb.AppendLine("   ORDER BY M.U_READCD, M.U_REQYM                                                                                            ");
                */

                sb.AppendLine(" SELECT CASE WHEN ROW_NUMBER() OVER (PARTITION BY M.U_READCD, M.U_REQYM ORDER BY M.U_READCD, M.U_REQYM, M.U_AMT, M.DocEntry, M.LineId, M.U_DATE) = 1 THEN M.U_REQYM ELSE NULL END AS U_YYYYMM                                                     ");
                sb.AppendLine("      , CASE WHEN ROW_NUMBER() OVER (PARTITION BY M.U_READCD, M.U_REQYM ORDER BY M.U_READCD, M.U_REQYM, M.U_AMT, M.DocEntry, M.LineId, M.U_DATE) = 1 THEN M.U_AMT ELSE NULL END AS REQAMT                                                         ");
                sb.AppendLine("      , M.U_DATE     AS DEPO_DATE                                                                                            ");
                sb.AppendLine("      , M.U_INAMT    AS DEPO_AMT                                                                                             ");
                sb.AppendLine("      , M.U_SMLNM + (CASE ISNULL(M.U_SMLNM2,'') WHEN '' THEN '' ELSE ' ' + M.U_SMLNM2 END) AS U_PMETHOD                      ");
                sb.AppendLine("      , M.U_STATUS   AS U_STATUS                                                                                             ");
                sb.AppendLine("   FROM (                                                                                                                    ");
                sb.AppendLine(" 		SELECT A.U_READCD                                                                                                   ");
                sb.AppendLine(" 			 , A.U_REQYM                                                                                                    ");
                sb.AppendLine(" 			 , A.DocEntry                                                                                                   ");
                sb.AppendLine(" 			 , A.LineId                                                                                                     ");
                sb.AppendLine(" 			 , ISNULL((SELECT SUM(ISNULL(F.U_DEBIT, 0))                                                                     ");
                sb.AppendLine(" 			             FROM [@KIS_SO01403_HRD] F                                                                          ");
                sb.AppendLine(" 			            WHERE A.DocEntry = F.DocEntry                                                                       ");
                sb.AppendLine(" 				          AND A.LineId = F.U_UPLINEID                                                                       ");
                sb.AppendLine(" 				          AND F.U_TYPE IN ('110') ), 0) AS U_AMT                                                            ");
                sb.AppendLine(" 			 , CASE WHEN ISNULL(B.U_TYPE, '') NOT IN ('110','150','910','920','000') THEN ISNULL(B.U_CREDIT, 0) ELSE 0 END AS U_INAMT         ");
                sb.AppendLine(" 			 , B.U_DATE					                                                                                    ");
                sb.AppendLine(" 			 , ISNULL(B.U_DEBIT,0) AS U_DEBIT                                                                               ");
                sb.AppendLine(" 			 , ISNULL(B.U_CREDIT,0) AS U_CREDIT                                                                             ");
                sb.AppendLine(" 			 , B.U_TYPE                                                                                                     ");
                sb.AppendLine(" 			 , (SELECT F.U_SMLNM FROM [@KIS_AD00201] F WHERE F.Code = 'SO54' AND F.U_CD = B.U_TYPE) AS U_SMLNM              ");
                sb.AppendLine(" 			 , (SELECT F.U_SMLNM FROM [@KIS_AD00201] F WHERE F.Code = 'SO51' AND F.U_SMLCD = B.U_SUBTYPE) AS U_SMLNM2       ");
                sb.AppendLine(" 			 , A.U_STATUS                                                                                                   ");
                sb.AppendLine(" 		  FROM [@KIS_SO01401_HRD] A                                                                                         ");
                sb.AppendLine(" 		       LEFT OUTER JOIN [@KIS_SO01403_HRD] B ON A.DocEntry = B.DocEntry                                              ");
                sb.AppendLine(" 													AND A.LineId = B.U_UPLINEID                                             ");
                sb.AppendLine(" 													AND B.U_TYPE NOT IN ('110','150','910','920','000')                                       ");
                sb.AppendLine(" 	   ) M                                                                                                                  ");
                sb.AppendLine("   WHERE M.U_AMT <> 0 AND M.U_READCD = '{0}'                                                                                 ");
                sb.AppendLine("   ORDER BY M.U_READCD, M.U_REQYM                                                                                            ");

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

                oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd").Specific;
                oForm.DataSources.DataTables.Item("grd").ExecuteQuery(string.Format(sb.ToString(), strREADCD));
                oGrid.DataTable = oForm.DataSources.DataTables.Item("grd"); //데이터 그리드에 Display                  

                //1. 납부방법
                //FN.SetComboBoxValidValues(oGrid, "U_PMETHOD", " SELECT U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code ='SO09' ", FN.Enum_WholeTp.m_Nothing);

                //2. 상태
                FN.SetComboBoxValidValues(oGrid, "U_STATUS", " SELECT 'O' [Code], '미납' AS [Name] UNION ALL SELECT 'C' [Code], '완납' AS [Name]  ", FN.Enum_WholeTp.m_Nothing);

                //조회된 내역이 없어도 1줄이 추가되므로 키값을 체크하여 조회안된 경우 1줄 삭제
                if (oGrid.DataTable.Rows.Count == 1 && (oGrid.DataTable.GetValue("U_YYYYMM", 0).ToString() == null || oGrid.DataTable.GetValue("U_YYYYMM", 0).ToString() == ""))
                {
                    FN.SetGridTitle(oGrid
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.ColumnUid)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.ColumnName)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.NotVisible)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.NotEditable));

                }
                else
                {
                    FN.BindGrid(oGrid
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.ColumnUid)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.ColumnName)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.NotEditable)
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.NotVisible)
                        , ""
                        , GetGridFieldInfo(oForm, SO.SO_COMMON_HRD.GridTitleType.AlignRight));

                    //FN.SetColoumnColor(oForm, "grd3", "#E0ECF8", "ETAX_YN,DTINO,DTSTAT"); //그리드 BG 기본색(#E6E6FA)
                    oGrid.RowHeaders.Width = 0;
                    oGrid.AutoResizeColumns();
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText("FindRequestData " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
                oForm.Refresh();
            }
        }
예제 #16
0
        private string CreateData(SAPbouiCOM.Form oForm)
        {
            string rtnValue = string.Empty;
            StringBuilder sb = new StringBuilder();
            string xSQL = string.Empty;
            string strYYYYMM = string.Empty;

            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0400T_HRD");
                strYYYYMM = oDB_M.GetValue("U_YYYYMM", 0).Trim();

                xSQL = string.Format(" EXEC KIS_SP_SO0400A1_HRD @pYYYYMM     = '{0}', @pUserSign = {1} ", strYYYYMM, B1Connections.diCompany.UserSignature.ToString());
                rtnValue = FN.GetRecordsetValue(xSQL);
            }
            catch (Exception)
            {
                throw;
            }
            return rtnValue;
        }
예제 #17
0
 public virtual void ET_mtx_AFClick(ItemEvent pVal) {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx").Specific));
     // ADD YOUR ACTION CODE HERE ...
     oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0020M_HRD");
     oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00201_HRD");
     if (pVal.Row != 0)
     {
         oMatrix.SelectRow(pVal.Row, true, false);
         SelectRow = pVal.Row -1;
         if (oDB_1.GetValue("U_STATUS", pVal.Row-1).ToString() == "Y")
         {
             oForm.Items.Item("btnTR").Enabled = false;
             oForm.Items.Item("btnCAN").Enabled = true;
         }
         else
         {
             oForm.Items.Item("btnTR").Enabled = true;
             oForm.Items.Item("btnCAN").Enabled = false;
         }
     }
 }
예제 #18
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oCombo;
            TFunctions Param;

            SAPbouiCOM.CheckBox oCheckBox;
            SAPbouiCOM.EditText oEditText;

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

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

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

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

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

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

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

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkMon").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkDteTra").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearD").Specific);
                //oCheckBox.ValOn = "Y";
                //oCheckBox.ValOff = "N";

                //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearDS").Specific);
                //oCheckBox.ValOn = "Y";
                //oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkPrint").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkDistrib").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkVal90").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("MultiSoc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("ValDescL").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("GeneraT").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("SubirSuc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("AbrirDoc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkFProv").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oEditText            = (EditText)(oForm.Items.Item("Pasword").Specific);
                oEditText.IsPassword = true;


                //Configuración RadioButtons
                DSOpDif = oForm.DataSources.UserDataSources.Add("rbOpDif", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
                ((OptionBtn)oForm.Items.Item("opDifPor").Specific).DataBind.SetBound(true, "", "rbOpDif"); //1

                ((OptionBtn)oForm.Items.Item("opDifMon").Specific).DataBind.SetBound(true, "", "rbOpDif"); //2
                ((OptionBtn)oForm.Items.Item("opDifMon").Specific).GroupWith("opDifPor");


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

                //s := 'Select count(*) cant from [@VID_FEPARAM]';
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"Select count(*) CANT
                                ,U_Usuario
                                ,U_Password
                                ,U_UserWSCL
                                ,U_PassWSCL
                                ,ISNULL(U_TipoDif,'M') 'U_TipoDif'
                            from [@VID_FEPARAM] 
                            group by U_Usuario
                                ,U_Password
                                ,U_UserWSCL
                                ,U_PassWSCL
                                ,ISNULL(U_TipoDif,'M')";
                }
                else
                {
                    s = @"Select count(*) ""CANT"" 
                           ,""U_Usuario"" 
                           ,""U_Password""
                           ,""U_UserWSCL""
                           ,""U_PassWSCL""
                           ,IFNULL(""U_TipoDif"",'M') ""U_TipoDif""
                      from ""@VID_FEPARAM"" 
                     group by ""U_Usuario"" 
                             ,""U_Password""
                             ,""U_UserWSCL""
                             ,""U_PassWSCL""
                             ,IFNULL(""U_TipoDif"",'M') ";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("CANT").Value) > 0)
                {
                    Param       = new TFunctions();
                    Param.SBO_f = FSBOf;

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

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

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

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

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

                    oForm.PaneLevel = 101;

                    if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "Y")
                    {
                        oForm.Items.Item("chkDistrib").Visible = false;
                        oForm.Items.Item("AbrirDoc").Visible   = true;
                    }
                    else if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "N")
                    {
                        oForm.Items.Item("chkDistrib").Visible = true;
                        oForm.Items.Item("AbrirDoc").Visible   = false;
                    }

                    oForm.Freeze(false);
                    if (((System.String)oRecordSet.Fields.Item("U_TipoDif").Value).Trim() == "M")
                    {
                        DSOpDif.Value = "2";
                    }
                    //((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true;
                    else
                    {
                        DSOpDif.Value = "1";
                    }
                    //((OptionBtn)oForm.Items.Item("opDifPor").Specific).Selected = true;
                }
                else
                {
                    oForm.SupportedModes = 3;
                    oForm.Mode           = BoFormMode.fm_ADD_MODE;
                    oForm.PaneLevel      = 101;
                    ((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true;
                }
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            finally
            {
                oForm.Freeze(false);
            }


            return(Result);
        }//fin InitForm
예제 #19
0
        private void SetButtonEnabled(SAPbouiCOM.Form oForm)
        {
            string strTransID = string.Empty;
            string strRejTran = string.Empty;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0280T_HRD");
                strTransID = oDB_M.GetValue("U_JDTDOC", 0).Trim();
                strRejTran = oDB_M.GetValue("U_RJDTDOC", 0).Trim();


                if (string.IsNullOrEmpty(strTransID))
                {
                    FN.SetItemEnable(oForm, "btnJDT", true);
                    FN.SetItemEnable(oForm, "cboDEPYM", true);
                    FN.SetItemEnable(oForm, "edtDEPDT", true);
                    FN.SetItemEnable(oForm, "extREMARK", true);
                    FN.SetItemEnable(oForm, "edtBNKCD", true);
                    FN.SetItemEnable(oForm, "edtCMMAMT", true);
                }
                else
                {
                    FN.SetItemEnable(oForm, "btnJDT", false);
                    FN.SetItemEnable(oForm, "cboDEPYM", false);
                    FN.SetItemEnable(oForm, "edtDEPDT", false);
                    FN.SetItemEnable(oForm, "extREMARK", false);
                    FN.SetItemEnable(oForm, "edtBNKCD", false);
                    FN.SetItemEnable(oForm, "edtCMMAMT", false);
                }

                if (string.IsNullOrEmpty(strTransID) == false && string.IsNullOrEmpty(strRejTran))
                    FN.SetItemEnable(oForm, "btnREJDT", true);
                else
                    FN.SetItemEnable(oForm, "btnREJDT", false);

                if (oForm.Mode == BoFormMode.fm_ADD_MODE)
                    FN.SetItemEnable(oForm, "btnFIND", true);
                else
                    FN.SetItemEnable(oForm, "btnFIND", false);

            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #20
0
        private void GetDataLoad(SAPbouiCOM.Form oForm)
        {
            string strYYYYMM = oForm.DataSources.UserDataSources.Item("U_YYYYMM").Value.Trim();
            string strCENTCD = oForm.DataSources.UserDataSources.Item("U_CENTCD").Value.Trim();
            string strCENTNM = oForm.DataSources.UserDataSources.Item("U_CENTNM").Value.Trim();
            string strBENTRY = oForm.DataSources.UserDataSources.Item("U_BENTRY").Value.Trim();

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

            //헤더데이터를 조회
            QueryWithConditions_MASTER(ref oDB_M, strYYYYMM, strCENTCD);
            if (oDB_M.Size > 0)
            {
                string strDocEntry = oDB_M.GetValue("DocEntry", 0).Trim();
                //헤더를 기준으로 라인데이터 조회
                QueryWithConditions(ref oDB_1, "DocEntry", strDocEntry);
                oForm.Mode = BoFormMode.fm_OK_MODE;

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                oMatrix.LoadFromDataSource();
            }
            else
            {
                string strSTATUS = oForm.DataSources.UserDataSources.Item("U_STATUS").Value.Trim();
                if (strSTATUS == "P")
                {
                    // 아무것도 없는 마스터에 값을 입력할려고 하면 오류 발생 
                    // 폼 모드 Add모드로 강제로 전환 하고 데이터 입력해야함.
                    oForm.Mode = BoFormMode.fm_ADD_MODE;
                }
                oDB_M.SetValue("U_YYYYMM", 0, strYYYYMM);
                oDB_M.SetValue("U_CENTCD", 0, strCENTCD);
                oDB_M.SetValue("U_CENTNM", 0, strCENTNM);
                oDB_M.SetValue("U_BENTRY", 0, strBENTRY);
                oDB_M.SetValue("U_BTYPE", 0, "KIS_SO0310_HRD");
            }
        }
        }//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
예제 #22
0
        public virtual bool ET_BFRightClick(ContextMenuInfo pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            // ADD YOUR ACTION CODE HERE ...

            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0400T_HRD");
            if (SO.SO_COMMON_HRD.Authority == SO.SO_COMMON_HRD.AuthorityType.None && oDB_M.GetValue("U_STATUS", 0).Trim() == "R")
                oForm.EnableMenu("1283", false); //제거
            return true;
        }
예제 #23
0
        public virtual bool ET_grd_BFValidate(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...

            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0400T_HRD");
            //if (pVal.InnerEvent == false && pVal.ItemChanged == true)
            //{
            if (string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()) == false)
            {
                B1Connections.theAppl.StatusBar.SetText("분개전기가된 문서는 수정할 수 없습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            //}
            return true;
        }
예제 #24
0
 public virtual bool ET_1_BFItemPressed(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));
     // ADD YOUR ACTION CODE HERE ...
     if (oForm.Mode == BoFormMode.fm_ADD_MODE)
     {
         if (BeforModifyData_CheckAuthority(oForm))
         {
             if (BeforeExecute_ValidationCheck(oForm))
             {
                 string strDocEntry = CreateData(oForm);
                 if (!string.IsNullOrEmpty(strDocEntry))
                 {
                     gDocEntry = strDocEntry;
                     oForm.Mode = BoFormMode.fm_OK_MODE;
                     GetDataLoad(oForm, strDocEntry);
                     SetItemEnabled(oForm);
                 }
             }
         }
         return false;
     }
     else if (oForm.Mode == BoFormMode.fm_UPDATE_MODE)
     {
         if (BeforModifyData_CheckAuthority(oForm))
         {
             oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0400T_HRD");
             string strRtnValue = FN.GetRecordsetValue(string.Format(" SELECT COUNT (1)  FROM [@KIS_SO0310T_HRD] WHERE U_YYYYMM = '{0}' AND ISNULL (U_RJDTDOC, '') = '' ", oDB_M.GetValue("U_YYYYMM", 0).Trim()));
             if (int.Parse(strRtnValue) > 0)
             {
                 B1Connections.theAppl.StatusBar.SetText("지대청구가 생성되면 수정 할 수 없습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                 return false;
             }
         }
     }
     oForm.Freeze(true);
     UpDateDate(oForm);
     FindData(oForm);
     oForm.Freeze(false);
     return false;
 }
예제 #25
0
        public virtual bool ET_btnTRAN_BFClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnTRAN").Specific));
            // ADD YOUR ACTION CODE HERE ...

            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
            if (string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()) == false)
            {
                B1Connections.theAppl.StatusBar.SetText("분개전기가된 문서는 다시전기 할 수 없습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            if (oForm.Mode == BoFormMode.fm_UPDATE_MODE)
            {
                B1Connections.theAppl.StatusBar.SetText("데이터가 수정되었습니다. 저장후 진행해주세요. ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                return false;
            }
            return true;
        }
예제 #26
0
 public virtual bool ET_BFRightClick(ContextMenuInfo pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     // ADD YOUR ACTION CODE HERE ...  
     oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
     if (oDB_M.GetValue("U_JDTDOC", 0).Trim() != "" && oDB_M.GetValue("U_RJDTDOC", 0).Trim() != "")
         oForm.EnableMenu("1283", true); //제거
     else if (oDB_M.GetValue("U_JDTDOC", 0).Trim() != "")
         oForm.EnableMenu("1283", false); //제거
     else
         oForm.EnableMenu("1283", true); //제거
     return true;
 }
예제 #27
0
        public static void clsSalesOrder_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            oForm            = oSetupForm;
            oHDBDataSource   = oForm.DataSources.DBDataSources.Item("ORDR");
            oChildDataSource = oForm.DataSources.DBDataSources.Item("RDR1");
            oMatrix          = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

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

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

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

                        if (oHDBDataSource.GetValue("DocStatus", oHDBDataSource.Offset).ToString().Trim() != "O")
                        {
                            BubbleEvent = false;
                        }
                        // strDocEntry = oHDBDataSource.GetValue("DocEntry", 0).Trim();
                        //strDocType = oHDBDataSource.GetValue("U_DocType", 0).Trim();
                    }
                    break;


                default:
                    break;
                }
            }
            else if (pVal.BeforeAction == false)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                    //Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("2").Left + oForm.Items.Item("2").Width + 6, oForm.Items.Item("2").Top, oForm.Items.Item("2").Width, oForm.Items.Item("2").Height, "Sales History", true, 0, "");
                    Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("46").Left, oForm.Items.Item("46").Top + 20, oForm.Items.Item("46").Width, oForm.Items.Item("2").Height, "Sales History", true, 0, "46");
                    ColsFromHistory = new List <string> {
                        "1", "11", "14", "1470002145"
                    };
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "1")
                    {
                        if (oForm.Mode != BoFormMode.fm_FIND_MODE)
                        {
                            if (pVal.ActionSuccess)
                            {
                                if (oWaitForm != null)
                                {
                                    try
                                    {
                                        oWaitForm.Close();
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    oWaitForm = null;
                                }
                            }
                        }
                    }

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

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

                        if (oWaitForm == null)
                        {
                            string strQry;
                            oWaitForm = clsSBO.LoadForm("EJ_OCSH.srf", "EJ_OCSH", oApplication);
                            try
                            {
                                oWaitForm.Settings.MatrixUID = "4";
                                oWaitForm.Settings.Enabled   = true;
                            }
                            catch { }

                            oWaitForm.State = BoFormStateEnum.fs_Maximized;

                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("8").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("54").Specific).Value.Trim();
                            oWaitForm.Freeze(true);
                            oWaitForm.DataSources.DataTables.Add("@dtTemp");
                            SAPbouiCOM.Grid oGrid;
                            oGrid = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;

                            oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

                            strQry = "EXEC dbo.EJ_CustomerSalesHistory  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "','" + ((SAPbouiCOM.EditText)oForm.Items.Item("8").Specific).Value.Trim() + "'";
                            System.Data.DataTable dtHistory = clsSBO.getDataTable(strQry, "History", oCompany);
                            oWaitForm.DataSources.DataTables.Item(0).ExecuteQuery(strQry);


                            oGrid.DataTable = oWaitForm.DataSources.DataTables.Item(0);
                            string strCardCode = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            int    i           = 0;
                            //foreach (System.Data.DataRow dr in dtHistory.Rows)
                            //{
                            //    try
                            //    {
                            //        if (dr["ItemCode"].ToString() != "")
                            //        {
                            //            SAPbobsCOM.ItemPriceReturnParams itemPrice = clsSBO.getUnitPriceSys(oCompany,dr["ItemCode"].ToString().Trim(), strCardCode , 1, DateTime.Now.Date, dr["UoM"].ToString().Trim());
                            //            oGrid.DataTable.SetValue("Current Selling Price", i, itemPrice.Price);
                            //            i++;
                            //        }
                            //    }
                            //    catch { }

                            //}

                            oGrid.Columns.Item(0).Editable = true;
                            SAPbouiCOM.EditTextColumn oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(0));
                            oEditTxt.ChooseFromListUID     = "CFL_2";
                            oEditTxt.ChooseFromListAlias   = "ItemCode";
                            oGrid.Columns.Item(1).Editable = false;
                            string showName = clsSBO.getColVisibility("EJ_OCSH", "ItemName", oCompany.UserName, oCompany);
                            if (showName == "N")
                            {
                                oGrid.Columns.Item(1).Visible = false;
                            }

                            oGrid.Columns.Item(2).Editable = true;
                            oGrid.Columns.Item(3).Editable = true;
                            oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(3));
                            oEditTxt.ChooseFromListUID     = "CFL_3";
                            oEditTxt.ChooseFromListAlias   = "UomCode";
                            oGrid.Columns.Item(4).Editable = true;


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

                            oGrid.AutoResizeColumns();
                            oGrid.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Auto;
                            oGrid.DataTable.Rows.Add(1);

                            clsCustomerSalesHistory.oForm        = oWaitForm;
                            clsCustomerSalesHistory.oSOForm      = oForm;
                            clsCustomerSalesHistory.ORDR         = oForm.DataSources.DBDataSources.Item("ORDR");
                            clsCustomerSalesHistory.cardCode     = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            clsCustomerSalesHistory.oCompany     = oCompany;
                            clsCustomerSalesHistory.oApplication = oApplication;
                            clsCustomerSalesHistory.isAdding     = oForm.Mode == BoFormMode.fm_ADD_MODE ? true : false;
                            clsCustomerSalesHistory.CallingForm  = "SO";
                            clsCustomerSalesHistory.myDocNum     = Convert.ToInt32(((SAPbouiCOM.EditText)oForm.Items.Item("8").Specific).Value.Trim());
                            oWaitForm.Freeze(false);
                        }
                        else
                        {
                            SAPbouiCOM.Grid oGrid;
                            oGrid = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;

                            try
                            {
                                for (int i = 1; i < oMatrix.RowCount; i++)
                                {
                                    bool boolAvailable = false;
                                    for (int j = 0; j < oGrid.Rows.Count; j++)
                                    {
                                        if (((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific).Value.Trim() == oGrid.DataTable.GetValue("ItemCode", j).ToString().Trim())
                                        {
                                            boolAvailable = true;
                                            oGrid.DataTable.SetValue("Order Qty", j, Convert.ToInt32(Convert.ToDouble(((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(i).Specific).Value.Trim())));
                                            break;
                                        }
                                    }
                                    if (boolAvailable == false)
                                    {
                                        int intGridRow = 0;
                                        if (oGrid.DataTable.GetValue("ItemCode", oGrid.Rows.Count - 2).ToString().Trim() == "")
                                        {
                                            intGridRow = oGrid.Rows.Count - 2;
                                        }
                                        else
                                        {
                                            intGridRow = oGrid.Rows.Count - 1;
                                        }

                                        oGrid.DataTable.SetValue("ItemCode", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("ItemName", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("3").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("Order Qty", intGridRow, Convert.ToInt32(Convert.ToDouble(((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(i).Specific).Value.Trim())));
                                        oGrid.DataTable.SetValue("UoM", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(i).Specific).Value.Trim());
                                        string input = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(i).Specific).Value.Trim();
                                        SAPbobsCOM.ItemPriceReturnParams itemPrice = clsSBO.getUnitPriceSys(oCompany, oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim(), ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim(), 1, DateTime.Now.Date, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("Current Selling Price", pVal.Row, itemPrice.Price);


                                        //oGrid.DataTable.SetValue("Current Selling Price", intGridRow, new string(input.Where(c => (Char.IsDigit(c) || c == '.' || c == ',')).ToArray()));

                                        oGrid.DataTable.Rows.Add();
                                    }
                                }
                            }
                            catch (Exception)
                            {
                            }


                            oWaitForm.Visible = true;
                        }
                    }
                    break;



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


                    break;



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

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

                default:
                    break;
                }
            }
        }
예제 #28
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;
            }
        }
예제 #29
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;

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

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

                Lista = new List <string>();

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

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

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

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

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

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

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

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

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

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

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

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

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

                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
예제 #30
0
        /// <summary>
        /// 분개 저장 TR_COMMON.JournalType 에 따라 분개, 분개취소 전표를 발행한다.
        /// </summary>
        private bool DI_JournalEntries(SAPbouiCOM.Form oForm, SO.SO_COMMON_HRD.JournalType pJournalType)
        {
            bool boolReturn = true;

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

            string strJournalEntry = string.Empty;
            string xSQL = string.Empty;

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

            string strDate = string.Empty;
            string strMEMO = string.Empty;
            string strDocEntry = string.Empty;

            SAPbobsCOM.JournalEntries oJournalEntries = null;

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

            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0280T_HRD");
                oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_SO02801_HRD");

                strDocEntry = oDB_M.GetValue("DocEntry", 0).Trim();

                B1Connections.diCompany.StartTransaction();

                switch (pJournalType)
                {
                    //분개
                    case SO_COMMON_HRD.JournalType.A01:
                        if (string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()))
                        {
                            // 차변 - 보통예금
                            string strDebitAmt = string.Empty;
                            string[] arrDebit = { "U102" };
                            string[,] strAccount_Debit = new string[arrDebit.Length, 4];

                            for (int i = 0; i < arrDebit.Length; i++)
                            {
                                strAccount_Debit[i, 0] = arrDebit[i];
                                strAccount_Debit[i, 1] = "";
                            }

                            // 차변 수수료(U503) -> 미지급금-거래처로 변경 
                            string strDebitCMMAmt = string.Empty;
                            string[] arrDebitCMM = { "U205" };
                            string[,] strAccount_DebitCMM = new string[arrDebitCMM.Length, 4];

                            for (int i = 0; i < arrDebitCMM.Length; i++)
                            {
                                strAccount_DebitCMM[i, 0] = arrDebitCMM[i];
                                strAccount_DebitCMM[i, 1] = "";
                            }

                            // 대변 - 외상매출계정-헤경지대, 외상매출계정-KH지대
                            string strCreditAmt = string.Empty;
                            string[] arrCredit = { "U103", "U104" };
                            string[,] strAccount_Credit = new string[arrCredit.Length, 4];

                            for (int i = 0; i < arrCredit.Length; i++)
                            {
                                strAccount_Credit[i, 0] = arrCredit[i];
                                strAccount_Credit[i, 1] = "";
                            }



                            strMEMO = oDB_M.GetValue("U_DEPDT", 0).Trim() + " 신용카드 입금";

                            //DateTime dateDoc = Convert.ToDateTime(FN.SetDateFormatToDB(FN.GetItemValue(ref oForm, "edtTAKEDT"))); //B1Connections.diCompany.GetCompanyDate(); //DateTime.Today;
                            DateTime dateDoc = Convert.ToDateTime(FN.SetDateFormatToDB(FN.GetItemValue(ref oForm, "edtDEPDT")));

                            // 헤더셋팅
                            oJournalEntries.ReferenceDate = dateDoc;    //전기일
                            oJournalEntries.DueDate = dateDoc;          //만기일
                            oJournalEntries.TaxDate = dateDoc;          //증빙일
                            oJournalEntries.Memo = strMEMO;
                            oJournalEntries.UserFields.Fields.Item("U_ADDOCTP").Value = "KIS_SO0280_HRD";
                            oJournalEntries.UserFields.Fields.Item("U_BPLID").Value = "1";

                            //arrTemp[0] : 계정코드
                            //arrTemp[1] : 지종
                            //arrTemp[2] : 계정종류 - 1이면 관리계정
                            string[] arrTemp = new string[4];
                            string shortName = string.Empty;
                            string costCenter = string.Empty;
                            string acct = string.Empty;

                            // 총 입금액
                            double tAmt = GetMatrixSumValue("U_DEPAMT", "");
                            double tCnt = GetMatrixCntValue("");

                            double dAmt = 0;
                            double dCnt = 1;

                            double dCMMAmt = 0;
                            double dCMMAmt_temp = 0;

                            double U_CMMAMT = double.Parse(oDB_M.GetValue("U_CMMAMT", 0).Trim());

                            // 차변
                            for (int i = 0; i < strAccount_Debit.GetLength(0); i++)
                            {
                                //arrTemp = FN.GetRecordsetArrayValue(string.Format(" SELECT U_RMK1,U_RMK2,U_RMK3,U_RMK4 FROM [@KIS_AD00201] WHERE Code = 'SO19' AND U_SMLCD = '{0}' ", strAccount_Debit[i, 0]));
                                arrTemp[0] = FN.GetItemValue(ref oForm, "edtBNKACCT");
                                arrTemp[1] = "";
                                arrTemp[2] = "";

                                // 공통코드에 없는 경우 그대로 사용
                                // 자동이체에서 보통예금은 각 행의 주거래은행에 해당하는 계정코드를 사용한다.
                                if (arrTemp != null)
                                {
                                    strAccount_Debit[i, 0] = arrTemp[0];    // 계정코드
                                    strAccount_Debit[i, 1] = arrTemp[1];    // 지종
                                    strAccount_Debit[i, 2] = arrTemp[2];    // 계정종류 - 1 : 관리계정, 2 : 판관
                                    acct = "";
                                }
                                else
                                    acct = strAccount_Debit[i, 0];

                                string[] arrPaper = strAccount_Debit[i, 1].Split(',');

                                dCMMAmt_temp = 0;

                                for (int j = 0; j < arrPaper.Length; j++)
                                {
                                    shortName = GetShortName(strAccount_Debit[i, 2], strAccount_Debit[i, 0], arrPaper[j]);
                                    costCenter = GetCostCenter(strAccount_Debit[i, 2], arrPaper[j]);

                                    dAmt = GetMatrixSumValue("U_DEPAMT", arrPaper[j]);
                                    dCnt = GetMatrixCntValue(arrPaper[j]);
                                    dCnt = (dCnt == 0 ? 1 : dCnt);


                                    //dCMMAmt = U_CMMAMT;
                                    //dCMMAmt = U_CMMAMT * (dAmt / tAmt);
                                    if (j == arrPaper.Length - 1)
                                        dCMMAmt = U_CMMAMT - dCMMAmt_temp;
                                    else
                                        dCMMAmt = Math.Truncate(U_CMMAMT * (dCnt / tCnt));

                                    dCMMAmt_temp += dCMMAmt;


                                    if (dAmt == 0) continue;

                                    if (!string.IsNullOrEmpty(oJournalEntries.Lines.AccountCode)) oJournalEntries.Lines.Add();

                                    oJournalEntries.Lines.AccountCode = strAccount_Debit[i, 0];
                                    oJournalEntries.Lines.ShortName = shortName;    // strAccount_Debit[i, 0];
                                    oJournalEntries.Lines.CostingCode = costCenter;
                                    oJournalEntries.Lines.LineMemo = strMEMO;
                                    oJournalEntries.Lines.Debit = dAmt - dCMMAmt;
                                }
                            }

                            // 차변 - 수수료 - 배율로 계산하여 처리함
                            for (int i = 0; i < strAccount_DebitCMM.GetLength(0); i++)
                            {
                                arrTemp = FN.GetRecordsetArrayValue(string.Format(" SELECT U_RMK1,U_RMK2,U_RMK3,U_RMK4 FROM [@KIS_AD00201] WHERE Code = 'SO19' AND U_SMLCD = '{0}' ", strAccount_DebitCMM[i, 0]));

                                if (arrTemp != null)
                                {
                                    strAccount_DebitCMM[i, 0] = arrTemp[0];    // 계정코드
                                    strAccount_DebitCMM[i, 1] = arrTemp[1];    // 지종
                                    strAccount_DebitCMM[i, 2] = arrTemp[2];    // 계정종류 - 1 : 관리계정, 2 : 판관
                                    acct = "";
                                }
                                else
                                    acct = strAccount_DebitCMM[i, 0];

                                string[] arrPaper = strAccount_DebitCMM[i, 1].Split(',');

                                dCMMAmt_temp = 0;

                                for (int j = 0; j < arrPaper.Length; j++)
                                {
                                    shortName = GetShortName(strAccount_DebitCMM[i, 2], strAccount_DebitCMM[i, 0], arrPaper[j]);
                                    costCenter = GetCostCenter(strAccount_DebitCMM[i, 2], arrPaper[j]);

                                    dAmt = GetMatrixSumValue("U_DEPAMT", arrPaper[j]);
                                    dCnt = GetMatrixCntValue(arrPaper[j]);
                                    dCnt = (dCnt == 0 ? 1 : dCnt);


                                    //dCMMAmt = U_CMMAMT;
                                    //dCMMAmt = U_CMMAMT * (dAmt / tAmt);
                                    if (j == arrPaper.Length - 1)
                                        dCMMAmt = U_CMMAMT - dCMMAmt_temp;
                                    else
                                        dCMMAmt = Math.Truncate(U_CMMAMT * (dCnt / tCnt));

                                    dCMMAmt_temp += dCMMAmt;


                                    if (dCMMAmt == 0) continue;

                                    if (!string.IsNullOrEmpty(oJournalEntries.Lines.AccountCode)) oJournalEntries.Lines.Add();

                                    oJournalEntries.Lines.AccountCode = strAccount_DebitCMM[i, 0];
                                    oJournalEntries.Lines.ShortName = shortName;    // strAccount_DebitCMM[i, 0];
                                    oJournalEntries.Lines.CostingCode = costCenter;
                                    oJournalEntries.Lines.LineMemo = strMEMO;
                                    oJournalEntries.Lines.Debit = dCMMAmt;
                                }
                            }

                            // 대변
                            for (int i = 0; i < strAccount_Credit.GetLength(0); i++)
                            {
                                arrTemp = FN.GetRecordsetArrayValue(string.Format(" SELECT U_RMK1,U_RMK2,U_RMK3,U_RMK4 FROM [@KIS_AD00201] WHERE Code = 'SO19' AND  U_SMLCD = '{0}' ", strAccount_Credit[i, 0]));

                                if (arrTemp != null)
                                {
                                    strAccount_Credit[i, 0] = arrTemp[0];   // 계정코드
                                    strAccount_Credit[i, 1] = arrTemp[1];   // 지종
                                    strAccount_Credit[i, 2] = arrTemp[2];   // 계정종류 - 1 : 관리계정, 2 : 판관
                                    acct = "";
                                }
                                else
                                    acct = strAccount_Credit[i, 0];

                                string[] arrPaper = strAccount_Credit[i, 1].Split(',');

                                for (int j = 0; j < arrPaper.Length; j++)
                                {
                                    shortName = GetShortName(strAccount_Credit[i, 2], strAccount_Credit[i, 0], arrPaper[j]);
                                    costCenter = GetCostCenter(strAccount_Credit[i, 2], arrPaper[j]);

                                    dAmt = GetMatrixSumValue("U_DEPAMT", arrPaper[j]);

                                    if (dAmt == 0) continue;

                                    if (!string.IsNullOrEmpty(oJournalEntries.Lines.AccountCode)) oJournalEntries.Lines.Add();

                                    oJournalEntries.Lines.AccountCode = strAccount_Credit[i, 0];
                                    oJournalEntries.Lines.ShortName = shortName;    // strAccount_Credit[i, 0];
                                    oJournalEntries.Lines.CostingCode = costCenter;
                                    oJournalEntries.Lines.LineMemo = strMEMO;
                                    oJournalEntries.Lines.Credit = dAmt;
                                }
                            }

                            // 분개라인이 생성되지 않을을경우 분개를 추가 하지 않는다.기본적으로 Count는 1개이다.
                            if (oJournalEntries.Lines.Count > 1)
                                retValue = oJournalEntries.Add();
                        }
                        break;

                    // 역분개
                    case SO_COMMON_HRD.JournalType.A02:
                        // 분개 취소시 분개번호는 존재하고 , 분개 취소번호는 없는경우만 분개취소를 실행한다.
                        if (!string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()) && string.IsNullOrEmpty(oDB_M.GetValue("U_RJDTDOC", 0).Trim()))
                        {
                            oJournalEntries.GetByKey(int.Parse(oDB_M.GetValue("U_JDTDOC", 0).Trim()));
                            retValue = oJournalEntries.Cancel();
                        }
                        break;

                    default:
                        break;
                }


                if (retValue != 0)
                {
                    if (B1Connections.diCompany.InTransaction == true)
                    {
                        B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                    }

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


                    if (!string.IsNullOrEmpty(strJournalEntry))
                    {
                        xSQL = string.Format(" EXEC [KIS_SP_SO0281A_HRD] @pDocEntry = {0}, @pJournalType = '{1}', @pJournalEntry = {2} ", strDocEntry, pJournalType, strJournalEntry);
                        oRS.DoQuery(xSQL);
                    }

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

                    GetDataLoad(oForm, strDocEntry);
                    //SetJDTItemProp(oForm);

                    if (pJournalType == SO.SO_COMMON_HRD.JournalType.A01)
                        B1Connections.theAppl.StatusBar.SetText("신용카드 입금 전기 완료 되었습니다. " + strError, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                    else
                        B1Connections.theAppl.StatusBar.SetText("신용카드 입금 전기 취소 완료 되었습니다. " + strError, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }

                oJournalEntries = null;
            }

            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText("DI_JournalEntries " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                boolReturn = false;
            }
            finally
            {
                if (B1Connections.diCompany.InTransaction == true)
                {
                    B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack);
                }

                if (oJournalEntries != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oJournalEntries);
                    oJournalEntries = null;
                }
                if (xSQL != null)
                {
                    //System.Runtime.InteropServices.Marshal.ReleaseComObject(xSQL);
                    xSQL = null;
                }
            }

            return boolReturn;
        }
예제 #31
0
        public virtual void ET_btnPAYMETH_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnPAYMETH").Specific));
            // ADD YOUR ACTION CODE HERE ...


            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");

                string strChildFormID = oForm.DataSources.UserDataSources.Item("cFORMUID").Value;
                if (!FN.GetFormExistsChk(strChildFormID))
                {
                    Dictionary<string, string> dicParam = new Dictionary<string, string>();

                    dicParam.Add("U_BANKNM", oDB_M.GetValue("U_BANKNM", 0).ToString());
                    dicParam.Add("U_BNKACCT", oDB_M.GetValue("U_BNKACCT", 0).ToString());
                    dicParam.Add("U_CREDTBP", oDB_M.GetValue("U_CREDTBP", 0).ToString());
                    dicParam.Add("U_DEPNAME", oDB_M.GetValue("U_DEPNAME", 0).ToString());
                    dicParam.Add("U_CREDTNO", oDB_M.GetValue("U_CREDTNO", 0).ToString());
                    dicParam.Add("U_VALIDMY", oDB_M.GetValue("U_VALIDMY", 0).ToString());
                    dicParam.Add("U_CREDTNM", oDB_M.GetValue("U_CREDTNM", 0).ToString());
                    dicParam.Add("U_JMNO", oDB_M.GetValue("U_JMNO", 0).ToString());

                    dicParam.Add("U_JMNOYN", oDB_M.GetValue("U_JMNOYN", 0).ToString());

                    KIS_SO0031A_HRD SO0031A_HRD = new KIS_SO0031A_HRD();
                    SO0031A_HRD.A00_SubFormInit(oForm.UniqueID, dicParam);
                    SO0031A_HRD = null;
                }

            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #32
0
        /// <summary>
        /// 선수금차감 화면로드
        /// </summary>
        /// <param name="oForm"></param>
        private void OpenPopup(SAPbouiCOM.Form oForm)
        {
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0420T_HRD");

                string strChildFormID = oForm.DataSources.UserDataSources.Item("cFORMUID").Value;
                if (!FN.GetFormExistsChk(strChildFormID))
                {
                  
                    Dictionary<string, string> dicParam = new Dictionary<string, string>();
                    dicParam.Add("U_CENTCD", oDB_M.GetValue("U_CENTCD", 0).Trim());
                    dicParam.Add("U_CENTNM", oDB_M.GetValue("U_CENTNM", 0).Trim());

                    KIS_SO0312F_HRD SO0312F_HRD = new KIS_SO0312F_HRD();
                    SO0312F_HRD.A00_SubFormInit(oForm.UniqueID, dicParam);
                    SO0312F_HRD = null;
                }
                else
                {
                    pForm = pForm = B1Connections.theAppl.Forms.Item(strChildFormID);
                    pForm.Select();
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }
예제 #33
0
        // 데이터 저장후 LineId 값을 DataTabel에 적용한다.
        private bool DbDataSourceToDataTable(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = true;
            System.Data.DataRow[] findRows = null;
            int idx = 0;
            try
            {

                //삭제상태인 데이터 삭제
                //DataTableDeleteRows("D");


                oDB1_O = oForm.DataSources.DBDataSources.Item("@KIS_SO00301_HRD");
                oDB2_O = oForm.DataSources.DBDataSources.Item("@KIS_SO00302_HRD");

                // 1. 배송리스트
                findRows = gDs.Tables[oForm.UniqueID + "_Deliver"].Select(" ROWSTATE = 'I' OR ROWSTATE = 'M' ", "");
                foreach (System.Data.DataRow dr in findRows)
                {
                    idx = int.Parse(dr["IDX"].ToString());
                    // 라인ID 적용
                    //gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["LINEID"] = oDB1_O.GetValue("LineId", idx).ToString();

                    // 상태값 초기화
                    gDs.Tables[oForm.UniqueID + "_Deliver"].Rows[idx]["ROWSTATE"] = "";
                }


                // 2. 상담리스트
                findRows = gDs.Tables[oForm.UniqueID + "_Call"].Select(" ROWSTATE = 'I' OR ROWSTATE = 'M' ", "");
                foreach (System.Data.DataRow dr in findRows)
                {
                    idx = int.Parse(dr["IDX"].ToString());
                    // 라인ID 적용
                    gDs.Tables[oForm.UniqueID + "_Call"].Rows[idx]["LINEID"] = oDB2_O.GetValue("LineId", idx).ToString();

                    // 상태값 초기화
                    gDs.Tables[oForm.UniqueID + "_Call"].Rows[idx]["ROWSTATE"] = "";
                }
            }
            catch (Exception)
            {
                rtnValue = false;
                throw;
            }
            finally
            {
                findRows = null;
            }
            return rtnValue;
        }
예제 #34
0
        private void GetDataLoad(SAPbouiCOM.Form oForm, string pDocEntry)
        {
            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0280T_HRD");
            oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_SO02801_HRD");

            //헤더데이터를 조회
            QueryWithConditions(ref oDB_M, "DocEntry", pDocEntry);
            if (oDB_M.Size > 0)
            {
                //헤더를 기준으로 라인데이터 조회
                QueryWithConditions(ref oDB_1, "DocEntry", oDB_M.GetValue("DocEntry", 0));

                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
            oMatrix.LoadFromDataSource();

            SetButtonEnabled(oForm);
        }
예제 #35
0
        private bool PopUpOpenBefore_Validation(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = true;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
                if (oDB_M.GetValue("U_TYPE", 0).Trim() == "")
                {
                    B1Connections.theAppl.StatusBar.SetText("수급/지급 구분이 선택되지 않았습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    oForm.Items.Item("cboTYPE").Click(BoCellClickType.ct_Regular);
                    rtnValue = false;
                }

                if (oDB_M.GetValue("U_CENTCD", 0).Trim() == "")
                {
                    B1Connections.theAppl.StatusBar.SetText("지국이 입력되지 않았습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    oForm.Items.Item("edtCENTCD").Click(BoCellClickType.ct_Regular);
                    rtnValue = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return rtnValue;
        }
예제 #36
0
        public virtual bool ET_1_BFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));

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

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

                        string DocEntry = "";
                        return true;

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

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

                        //    oMatrix.LoadFromDataSource();

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

                        //return false;

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

            //FN.GetRecordsetValue("EXEC [KIS_SP_ADDON] @work_type = 'I', @object_type = 'KIS_SO0160_HRD'");
            return true;
        }
예제 #37
0
        private void SetComboBox_Method(SAPbouiCOM.Form oForm)
        {
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
                string strTYPE = oDB_M.GetValue("U_TYPE", 0).Trim();
                string strACCTYN = oDB_M.GetValue("U_ACCTYN", 0).Trim();
                string strLIST = string.Empty;
                if (strTYPE == "I")
                {
                    if (strACCTYN == "Y")
                    {
                        strLIST = "'S04','S05'";
                    }
                    else
                    {
                        strLIST = "'S04','S05','S11'";// 현금, 무통장, 보증금대체
                    }
                }
                else
                {
                    strLIST = "'S04','S05','S12'";// 현금, 무통장, 미지급금대체

                }

                if (String.IsNullOrEmpty(strLIST))
                {
                    oComboBox = oForm.Items.Item("cboMETHOD").Specific;
                    FN.SetComboClear(ref oComboBox);
                    oDB_M.SetValue("U_METHOD", 0, "");
                }
                else
                {
                    oComboBox = oForm.Items.Item("cboMETHOD").Specific;
                    FN.SetComboClear(ref oComboBox);
                    oDB_M.SetValue("U_METHOD", 0, "");
                    FN.SetComboBoxValidValues(oForm, string.Format(" SELECT  U_SMLCD, U_SMLNM FROM [@KIS_AD00201] WHERE Code = 'SO51' AND U_SMLCD IN ({0}) ", strLIST), "cboMETHOD", FN.Enum_WholeTp.m_Space, "");
                }



            }
            catch (Exception)
            {

                throw;
            }
        }
        }//fin FormEvent

        private Boolean AddDatos(String Tipo)
        {
            TFunctions Param;;
            Boolean    _return;
            String     UserED;
            String     PwdED;
            String     UserWS;
            String     PassWS;

            try
            {
                _return = false;
                if (ValidacionFinal())
                {
                    UserED = (System.String)(oDBDSHeader.GetValue("U_UserED", 0)).Trim();
                    PwdED  = (System.String)(oDBDSHeader.GetValue("U_PwdED", 0)).Trim();
                    UserWS = (System.String)(oDBDSHeader.GetValue("U_UserWS", 0)).Trim();
                    PassWS = (System.String)(oDBDSHeader.GetValue("U_PassWS", 0)).Trim();

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

                    if (UserED != "")
                    {
                        s = Param.Encriptar(UserED);
                        oDBDSHeader.SetValue("U_UserED", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_UserED", 0, "");
                    }

                    if (PwdED != "")
                    {
                        s = Param.Encriptar(PwdED);
                        oDBDSHeader.SetValue("U_PwdED", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_PwdED", 0, "");
                    }

                    if (UserWS != "")
                    {
                        s = Param.Encriptar(UserWS);
                        oDBDSHeader.SetValue("U_UserWS", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_UserWS", 0, "");
                    }

                    if (PassWS != "")
                    {
                        s = Param.Encriptar(PassWS);
                        oDBDSHeader.SetValue("U_PassWS", 0, s);
                    }
                    else
                    {
                        oDBDSHeader.SetValue("U_PassWS", 0, "");
                    }

                    if (Tipo == "1")
                    {
                        _return = Param.ParamUpd(oDBDSHeader);
                    }
                    else
                    {
                        _return = Param.ParamAdd(oDBDSHeader);
                    }

                    oDBDSHeader.SetValue("U_UserED", 0, UserED);
                    oDBDSHeader.SetValue("U_PwdED", 0, PwdED);
                    oDBDSHeader.SetValue("U_UserWS", 0, UserWS);
                    oDBDSHeader.SetValue("U_PassWS", 0, PassWS);

                    _return = true;
                }
                return(_return);
            }
            catch (Exception e)
            {
                OutLog("AddDatos : " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.StatusBar.SetText("AddDatos : " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return(false);
            }
        }//fin AddDatos
예제 #39
0
        private void SetComboBox_AcctCode(SAPbouiCOM.Form oForm)
        {
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
                string strTYPE = oDB_M.GetValue("U_TYPE", 0).Trim();
                string strMETHOD = oDB_M.GetValue("U_METHOD", 0).Trim();
                string strACCTYN = oDB_M.GetValue("U_ACCTYN", 0).Trim();
                string strLIST = string.Empty;

                if (strACCTYN == "Y")
                {

                    if (strMETHOD == "S04" || strMETHOD == "S05") // 현금,무통장
                    {
                        if (strTYPE == "I") // 수금(입금)
                        {
                            strLIST = "'U201','U204'"; // 선수금, 보증금
                        }
                        else
                        {
                            strLIST = "'U204'"; // 보증금
                        }
                    }

                    else if (strMETHOD == "S11") //보증금대체
                    {
                        strLIST = "'U204'";
                    }
                    else if (strMETHOD == "S12") // 미지급금대체
                    {
                        strLIST = "'U204'";
                    }
                }


                if (String.IsNullOrEmpty(strLIST))
                {
                    oComboBox = oForm.Items.Item("cboACCTCD").Specific;
                    FN.SetComboClear(ref oComboBox);
                    oDB_M.SetValue("U_ACCTCD", 0, "");
                }
                else
                {
                    oComboBox = oForm.Items.Item("cboACCTCD").Specific;
                    FN.SetComboClear(ref oComboBox);
                    oDB_M.SetValue("U_ACCTCD", 0, "");

                    FN.SetComboBoxValidValues(oForm, string.Format(" SELECT  U_RMK1, U_SMLNM FROM [@KIS_AD00201] WHERE Code = 'SO19' AND U_SMLCD IN ({0}) ", strLIST), "cboACCTCD", FN.Enum_WholeTp.m_Space, "");
                }

            }
            catch (Exception)
            {

                throw;
            }
        }
예제 #40
0
        /// <summary>
        /// 배송코드 채번
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private string GetMaxDelivCode(SAPbouiCOM.Form oForm)
        {
            string strCode = string.Empty;
            string strRtnValue = string.Empty;
            int iMaxIdx = 0;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                strCode = oDB_M.GetValue("Code", 0).ToString();

                // 
                if (gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.Count > 0 && gDs.Tables[oForm.UniqueID + "_Deliver"] != null)
                    iMaxIdx = int.Parse(gDs.Tables[oForm.UniqueID + "_Deliver"].Compute(" MAX(LINEID) ", "").ToString());

                strRtnValue = strCode.Substring(0, 10) + "_" + (iMaxIdx + 1).ToString().PadLeft(4, '0');
            }
            catch (Exception)
            {
                throw;
            }
            return strRtnValue;
        }
예제 #41
0
        public virtual void ET_AFFormDataLoad(BusinessObjectInfo pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            // ADD YOUR ACTION CODE HERE ...

            SetItemEnabled(oForm);

            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
            gDocEntry = oDB_M.GetValue("DocEntry", 0).Trim();
  
        }
예제 #42
0
        /// <summary>
        /// 독자코드 존재여부 : 저장된 코드가 있으면 True 없으면 False
        /// </summary>
        /// <param name="oForm"></param>
        /// <returns></returns>
        private bool GetCodeExists(SAPbouiCOM.Form oForm)
        {
            bool rtnValue = false;
            string strSQL = string.Empty;
            string strCode = string.Empty;
            string strValue = string.Empty;
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                strCode = oDB_M.GetValue("Code", 0);
                strSQL = string.Format(" SELECT COUNT(1) FROM [@KIS_SO0030M_HRD] WHERE Code = '{0}' ", strCode);

                strValue = FN.GetRecordsetValue(strSQL);
                if (strValue != "0")
                    rtnValue = true;
            }
            catch (Exception)
            {
                throw;
            }
            return rtnValue;
        }
예제 #43
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;
            }
        }
예제 #44
0
        private void GetAdvanceAmt(SAPbouiCOM.Form oForm)
        {           
            string strREADCD = string.Empty;
            try
            {
                oForm.Freeze(true);
                oUDS = oForm.DataSources.UserDataSources;
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
                strREADCD = oDB_M.GetValue("Code", 0).Trim();

               string strRtnValue =  FN.GetRecordsetValue(string.Format( " SELECT ISNULL(U_AMT,0) FROM KIS_VW_SO02401_HRD WHERE U_READCD = '{0}' " , strREADCD));
               oUDS.Item("edtADVANCE").Value = strRtnValue;

            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText("GetAdvanceAmt " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Freeze(false);
                oForm.Refresh();
            }
        }
예제 #45
0
        /// <summary>
        /// 분개 저장 TR_COMMON.JournalType 에 따라 분개, 분개취소 전표를 발행한다.
        /// </summary>
        private bool DI_JournalEntries(SAPbouiCOM.Form oForm, SO.SO_COMMON_HRD.JournalType pJournalType)
        {
            bool boolReturn = true;

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

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

            string xSQL = string.Empty;

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

                        GetDataLoad(oForm, strDocEntry);
                    }

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

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

                if (oRS != null) { Marshal.ReleaseComObject(oRS); } oRS = null;
                if (oJournalEntries != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oJournalEntries);
                    oJournalEntries = null;
                }
            }
            return boolReturn;
        }
예제 #46
0
 /// <summary>
 /// 데이터 있을때 패드워드타입, 없을때 일반 EditText 타입으로 변환
 /// </summary>
 /// <param name="oForm"></param>
 private void SetCreditKey_ItemAttribute(SAPbouiCOM.Form oForm)
 {
     try
     {
         SAPbouiCOM.EditText oEditText = oForm.Items.Item("edtCREDKEY").Specific;
         string strCreditKey = string.Empty;
         oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0030M_HRD");
         if (oDB_M.Size > 0)
         {
             strCreditKey = oDB_M.GetValue("U_CREDKEY", 0).Trim();
             if (string.IsNullOrEmpty(strCreditKey))
                 oEditText.IsPassword = false;
             else
                 oEditText.IsPassword = true;
         }
         else
         {
             oEditText.IsPassword = false;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #47
0
        public virtual bool ET_BFDataMenu_Remove(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0320T_HRD");
            if (string.IsNullOrEmpty(oDB_M.GetValue("U_JDTDOC", 0).Trim()) == false && string.IsNullOrEmpty(oDB_M.GetValue("U_RJDTDOC", 0).Trim()) == true)
            {
                B1Connections.theAppl.StatusBar.SetText("분개전기가된 문서는 삭제 할수 없습니다.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                return false;
            }
            else
                return true;
        }
예제 #48
0
        public static void clsAPCreditMemo_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            oForm            = oSetupForm;
            oHDBDataSource   = oForm.DataSources.DBDataSources.Item("ORPC");
            oChildDataSource = oForm.DataSources.DBDataSources.Item("RPC1");
            oMatrix          = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

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

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

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

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

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

                default:
                    break;
                }
            }

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

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

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

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

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

                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("8").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("54").Specific).Value.Trim();
                            oWaitForm.Freeze(true);
                            oWaitForm.DataSources.DataTables.Add("@dtTemp");
                            SAPbouiCOM.Grid oGrid;
                            oGrid      = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;
                            oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                            //  strQry = "Exec \"EJ_SupplierCMPurchaseHistory\"  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "'";
                            strQry = "Exec \"EJ_SupplierPurchaseHistory\"  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "'";

                            oWaitForm.DataSources.DataTables.Item(0).ExecuteQuery(strQry);
                            oGrid.DataTable = oWaitForm.DataSources.DataTables.Item(0);
                            oGrid.Columns.Item(0).Editable = true;
                            SAPbouiCOM.EditTextColumn oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(0));
                            oEditTxt.ChooseFromListUID     = "CFL_2";
                            oEditTxt.ChooseFromListAlias   = "ItemCode";
                            oGrid.Columns.Item(1).Editable = false;
                            oGrid.Columns.Item(2).Editable = true;
                            oGrid.Columns.Item(3).Editable = true;
                            oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(3));
                            oEditTxt.ChooseFromListUID     = "CFL_3";
                            oEditTxt.ChooseFromListAlias   = "UomCode";
                            oGrid.Columns.Item(4).Editable = true;
                            oGrid.Columns.Item(0).Editable = true;

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

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

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

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

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

                default:
                    break;
                }
            }
        }
예제 #49
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