}//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
Beispiel #2
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
Beispiel #3
0
        public static void AddRowWithoutDSource(ref SAPbouiCOM.Matrix matrix, int qtty = 1)
        {
            try
            {
                matrix.AddRow(qtty);
                //matrix.FlushToDataSource();

                //matrix.AddRow(qtty);
                //matrix.LoadFromDataSource();
            }catch (Exception ex)
            {
                klib.Shell.WriteLine(R.Project.ID, LOG, ex);
                SUI.Forms.Notification.SendToBarMessage(true, $"Occur a internal error to add a new line. Matrix {matrix.Item.Description}");
            }
        }
Beispiel #4
0
        public virtual void ET_AFRowDataMenu_Delete(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...

            try
            {

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


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




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

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

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

                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #5
0
        private void DBDataSourcesBindingData(SAPbouiCOM.Form oForm, System.Data.DataTable dt, int sIndex)
        {
            try
            {
                System.Collections.Hashtable hashTable = new System.Collections.Hashtable();
                SetHashTable_Seq(ref hashTable, dt);

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

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


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

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

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

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

        }
Beispiel #6
0
        private static void flushAll()
        {
            SAPbouiCOM.Grid oGrid;
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("4").Specific;
            SAPbouiCOM.DataTable dtHistory = oGrid.DataTable;
            oSOForm.Freeze(true);

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



                    int rowCount = 1;

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

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

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



                            rowCount++;
                        }
                    }

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

                        progress.Value += 10;

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

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

                            rowCount++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                oSOForm.Freeze(false);
            }
        }
Beispiel #7
0
        public static void clsSupplierPurchaseHistory_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            if (oForm != null)
            {
                oForm = oSetupForm;
                SAPbouiCOM.Grid oGrid;
                oGrid   = (SAPbouiCOM.Grid)oForm.Items.Item("4").Specific;
                oMatrix = (SAPbouiCOM.Matrix)oSOForm.Items.Item("38").Specific;
                if (pVal.BeforeAction)
                {
                    switch (pVal.EventType)
                    {
                    //case BoEventTypes.et_FORM_CLOSE:
                    //    BubbleEvent = false;
                    //    oForm.Visible = false;
                    //    break;

                    case BoEventTypes.et_DOUBLE_CLICK:
                        if (pVal.ItemUID == "4")
                        {
                            string strSelCol = "";
                            strSelCol = oGrid.Columns.Item(pVal.ColUID).TitleObject.Caption.ToString();
                            string[] words = strSelCol.Split('-');
                            string[] words1;
                            if (words.Length == 2)
                            {
                                oForm.Freeze(true);
                                for (int i = 0; i < oGrid.Rows.Count; i++)
                                {
                                    if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "")
                                    {
                                        if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "0")
                                        {
                                            words1 = oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim().Split(' ');
                                            if (words1[0].Trim() != "")
                                            {
                                                oGrid.DataTable.SetValue("Order Qty", i, words1[0].Trim());
                                            }
                                        }
                                    }
                                }
                                oForm.Freeze(false);
                            }
                        }
                        break;

                    case BoEventTypes.et_ITEM_PRESSED:
                        if (pVal.ItemUID == "2")
                        {
                            BubbleEvent   = false;
                            oForm.Visible = false;
                        }
                        if (pVal.ItemUID == "3")
                        {
                            flushAll();
                            BubbleEvent   = false;
                            oForm.Visible = false;
                            return;

                            oMatrix.Clear();
                            int j = oMatrix.RowCount;
                            if (j == 0)
                            {
                                oMatrix.AddRow(1, -1);
                            }
                            j = oMatrix.RowCount;

                            for (int i = 0; i < oGrid.Rows.Count; i++)
                            {
                                if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "")
                                {
                                    if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "0")
                                    {
                                        string strItemCode = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim();
                                        string strQty      = oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim();
                                        string strPrice    = oGrid.DataTable.GetValue("Current Purchase Price", i).ToString().Trim();
                                        string strUoM      = oGrid.DataTable.GetValue("UoM", i).ToString().Trim();
                                        try
                                        {
                                            ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(j).Specific).Value  = strItemCode;
                                            ((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(j).Specific).Value = strQty;
                                            try
                                            {
                                                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(j).Specific).Value = strUoM;
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            try
                                            {
                                                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(j).Specific).Value = strPrice;
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            j++;
                                        }
                                        catch (Exception)
                                        {
                                            j++;
                                        }
                                    }
                                }
                            }

                            //oForm.Close();
                            oForm.Visible = false;
                        }
                        break;

                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        if (pVal.ItemUID == "4")
                        {
                            if (pVal.ColUID == "UoM")
                            {
                                if (oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() != "")
                                {
                                    string squery = "Select T2.\"UomCode\",T2.\"UomName\" From OITM T0 Inner Join UGP1 T1 On T0.\"UgpEntry\" = T1.\"UgpEntry\" Inner Join OUOM T2 On T1.\"UomEntry\" = T2.\"UomEntry\" Where T0.\"ItemCode\" = '" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "'";
                                    Utilities.UtilitiesCls.CFLConditionQuery(ref oApplication, ref oCompany, oForm, ref pVal, squery, "UomCode", "10010198", "UomCode", false, true, "4", "UoM", false);
                                }
                            }
                            if (pVal.ColUID == "ItemCode")
                            {
                                SAPbouiCOM.ChooseFromListCollection oCFLs = null;
                                SAPbouiCOM.Conditions oCons = null;
                                SAPbouiCOM.Condition  oCon  = null;
                                oCFLs = oForm.ChooseFromLists;
                                SAPbouiCOM.ChooseFromList oCFL = null;
                                oCFL = oCFLs.Item("CFL_2");

                                oCons = new Conditions();
                                oCFL.SetConditions(oCons);


                                oCons = oCFL.GetConditions();



                                oCon           = oCons.Add();
                                oCon.Alias     = "PrchseItem";
                                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                oCon.CondVal   = "Y";

                                oCon.Relationship = BoConditionRelationship.cr_AND;
                                oCon           = oCons.Add();
                                oCon.Alias     = "frozenFor";
                                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                                oCon.CondVal   = "Y";


                                int intCnt = 2;
                                for (int i = 0; i < oGrid.Rows.Count; i++)
                                {
                                    if (oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim() != "")
                                    {
                                        if (intCnt > 0)
                                        {
                                            oCon.Relationship = BoConditionRelationship.cr_AND;
                                        }
                                        oCon           = oCons.Add();
                                        oCon.Alias     = "ItemCode";
                                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL;
                                        oCon.CondVal   = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim();
                                        intCnt        += 1;
                                    }
                                }

                                oCFL.SetConditions(oCons);
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                else if (pVal.BeforeAction == false)
                {
                    switch (pVal.EventType)
                    {
                    case BoEventTypes.et_ITEM_PRESSED:
                        break;

                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        if (oForm.Mode != SAPbouiCOM.BoFormMode.fm_FIND_MODE)
                        {
                            if (pVal.ItemUID == "4")
                            {
                                if (pVal.ColUID == "ItemCode")
                                {
                                    oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                    string strQry      = "";
                                    string strItemCode = "";
                                    oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal);
                                    if (oDataTable != null)
                                    {
                                        strItemCode = oDataTable.GetValue("ItemCode", 0).ToString();
                                    }
                                    if (strItemCode != "")
                                    {
                                        strQry = " Exec EJ_LoadBPItemDetails '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "', '" + strItemCode + "'";
                                        oRecordSet.DoQuery(strQry);
                                        if (!oRecordSet.EoF)
                                        {
                                            oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode);
                                            oGrid.DataTable.SetValue("ItemName", pVal.Row, oRecordSet.Fields.Item("ItemName").Value.ToString());
                                            oGrid.DataTable.SetValue("Order Qty", pVal.Row, "");
                                            oGrid.DataTable.SetValue("UoM", pVal.Row, oRecordSet.Fields.Item("UoM").Value.ToString());
                                            oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString());
                                        }
                                    }

                                    oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode);
                                    int j = oGrid.Rows.Count;
                                    if (j == oGrid.Rows.Count)
                                    {
                                        oGrid.DataTable.Rows.Add();
                                    }
                                }

                                if (pVal.ColUID == "UoM")
                                {
                                    oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                    string strUoMCode = "";
                                    oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal);
                                    if (oDataTable != null)
                                    {
                                        strUoMCode = oDataTable.GetValue("UomCode", 0).ToString();
                                    }
                                    oGrid.DataTable.SetValue("UoM", pVal.Row, strUoMCode);
                                    string strQry = " Exec EJ_LoadUoMPrice '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "','" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "' ,'" + strUoMCode + "'";
                                    oRecordSet.DoQuery(strQry);
                                    if (!oRecordSet.EoF)
                                    {
                                        oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString());
                                    }
                                }
                            }
                        }
                        break;

                    case BoEventTypes.et_COMBO_SELECT:

                        break;

                    case BoEventTypes.et_FORM_CLOSE:
                        oForm = null;
                        break;

                    default:
                        break;
                    }
                }
            }
        }
        }//fin InitForm

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

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

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

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

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

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

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

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

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

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

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

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

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

                                oMtx.FlushToDataSource();
                            }
                        }
                    }

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

            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific;
                oForm.Freeze(true);
                oMatrix.AddRow(1, -1);
                int i = oMatrix.VisualRowCount;
                oMatrix.DeleteRow(i);
                oMatrix.FlushToDataSource();
                oForm.Freeze(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32      i;
            TFunctions Param;

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

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

                Lista = new List <string>();

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

                VID_DelRow   = false;
                VID_DelRowOK = false;

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

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

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

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

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

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

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

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

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



                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
        private void btnPayments_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            Form lObjPaymentForm    = null;
            Form lObjPaymentFormUDF = null;
            Form lObjAccountForm    = null;

            try
            {
                if (mIntRowSelected > 0)
                {
                    StatusEnum lEnmStatus      = (StatusEnum)int.Parse(DtMatrix.GetValue("C_Status", mIntRowSelected - 1).ToString());
                    string     lStrFolio       = DtMatrix.GetValue("C_Folio", mIntRowSelected - 1).ToString();
                    string     lStrEmpCode     = DtMatrix.GetValue("C_Employe", mIntRowSelected - 1).ToString();
                    string     lStrArea        = DtMatrix.GetValue("C_Area", mIntRowSelected - 1).ToString();
                    double     lDblImport      = double.Parse(DtMatrix.GetValue("C_Amount", mIntRowSelected - 1).ToString());
                    string     lStrEmpName     = mObjPurchasesServiceFactory.GetPurchaseService().GetEmpName(lStrEmpCode);
                    string     lStrLineAccount = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountRefund(lStrArea);
                    //string lStrChkAcct = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountInConfig("GLO_CTAREEMBCHEQ");
                    string lStrChkAcct = cbAccount.Value;
                    // Dictionary<string, string> lStrBankInfo = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetBankInfo(lStrChkAcct);
                    Dictionary <string, string> lStrBankInfo = new Dictionary <string, string>();
                    lStrBankInfo.Add(cbAccount.Value, cbBank.Selected.Description);

                    if (lEnmStatus != StatusEnum.Authorized_Ope_Admon)
                    {
                        UIApplication.ShowError("El reembolso seleccionado no está autorizado");
                        return;
                    }

                    string lStrValidation = ValidatePaymentsFields(lStrFolio, lStrEmpCode, lStrArea, lDblImport, lStrChkAcct, lStrBankInfo, lStrLineAccount);
                    if (!string.IsNullOrEmpty(lStrValidation))
                    {
                        UIApplication.ShowMessageBox(lStrValidation);
                        return;
                    }
                    if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrEmpCode, lStrFolio, lStrArea))

                    /*string lStrDocEntry = DtMatrix.GetValue("C_DocEntry", mIntRowSelected - 1).ToString();
                     * if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrDocEntry))*/
                    {
                        UIApplication.ShowError("Ya existe un pago para el reembolso seleccionado");
                        return;
                    }
                    this.UIAPIRawForm.Freeze(true);
                    UIApplication.GetApplication().ActivateMenuItem("2818");
                    if (!UIApplication.GetApplication().Menus.Item("6913").Checked)
                    {
                        UIApplication.GetApplication().ActivateMenuItem("6913");//2050
                    }

                    lObjPaymentForm    = UIApplication.GetApplication().Forms.GetForm("426", -1);
                    lObjPaymentFormUDF = UIApplication.GetApplication().Forms.GetForm("-426", -1);

                    lObjPaymentForm.Freeze(true);
                    lObjPaymentFormUDF.Freeze(true);
                    SAPbouiCOM.EditText txtDocDate = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10").Specific);
                    txtDocDate.Value = DateTime.Now.ToString("yyyyMMdd");

                    SAPbouiCOM.OptionBtn optionBtnAccount = ((SAPbouiCOM.OptionBtn)lObjPaymentForm.Items.Item("58").Specific);
                    optionBtnAccount.Selected = true;

                    SAPbouiCOM.ComboBox cboPymtType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_PaymentType").Specific);
                    cboPymtType.Select("GLREM", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtCodeMov = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_GLO_CodeMov").Specific);
                    txtCodeMov.Value = lStrFolio;

                    SAPbouiCOM.ComboBox txtCostCenter = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_CostCenter").Specific);
                    txtCostCenter.Select(lStrArea, SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.ComboBox cboAuxiliarType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_FZ_AuxiliarType").Specific);
                    cboAuxiliarType.Select("2", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtName = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10000166").Specific);
                    txtName.Value = lStrEmpName;

                    SAPbouiCOM.EditText txtAuxiliar = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_FZ_Auxiliar").Specific);
                    txtAuxiliar.Value = lStrEmpCode;


                    SAPbouiCOM.Button btnBank = ((SAPbouiCOM.Button)lObjPaymentForm.Items.Item("234000001").Specific);
                    btnBank.Item.Click();

                    lObjAccountForm = UIApplication.GetApplication().Forms.GetForm("196", -1);
                    lObjAccountForm.Freeze(true);
                    SAPbouiCOM.Folder folderCheck = ((SAPbouiCOM.Folder)lObjAccountForm.Items.Item("3").Specific);
                    folderCheck.Item.Click();

                    SAPbouiCOM.Matrix mtxCheck = ((SAPbouiCOM.Matrix)lObjAccountForm.Items.Item("28").Specific);
                    ((SAPbouiCOM.EditText)mtxCheck.Columns.Item("7").Cells.Item(1).Specific).Value = lDblImport.ToString();

                    ComboBox cb = ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific);

                    string ss = lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)]; //lStrBankInfo.ElementAt(0);


                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific).Select(lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)], SAPbouiCOM.BoSearchKey.psk_ByValue); //Banco
                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("4").Cells.Item(1).Specific).Select(lStrBankInfo.Keys.ElementAt(0), SAPbouiCOM.BoSearchKey.psk_ByValue);               //Cuenta?

                    SAPbouiCOM.Button btnOk = ((SAPbouiCOM.Button)lObjAccountForm.Items.Item("1").Specific);
                    btnOk.Item.Click();

                    SAPbouiCOM.Matrix mtxPayment = ((SAPbouiCOM.Matrix)lObjPaymentForm.Items.Item("71").Specific);
                    mtxPayment.AddRow();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("5").Cells.Item(1).Specific).Value = lDblImport.ToString();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(1).Specific).Value = lStrLineAccount; //cuenta de mayor
                }
                else
                {
                    UIApplication.ShowMessageBox("Favor de seleccionar un registro");
                }



                lObjPaymentFormUDF.Freeze(false);
                this.UIAPIRawForm.Freeze(false);



                if (lObjPaymentForm != null)
                {
                    lObjPaymentForm.Freeze(false);
                }
                if (lObjAccountForm != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                if (this.UIAPIRawForm != null)
                {
                    this.UIAPIRawForm.Freeze(false);
                }
                // if (lObjAccountForm. ==) lObjAccountForm.Freeze(false);
                UIApplication.ShowSuccess("Carga de pago terminada");
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (btnPayments_ClickBefore) " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("Error al abrir pantalla de pagos: {0}", ex.Message));
            }
            finally
            {
                if (lObjPaymentFormUDF != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                this.UIAPIRawForm.Freeze(false);
            }
        }
Beispiel #12
0
        private void DBDataSourcesBindingData(SAPbouiCOM.Form oForm, System.Data.DataTable dt, string strFileName)
        {
            try
            {
                //string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyy-MM-dd");//임포트 실행일              
                string U_RELDT = B1Connections.diCompany.GetCompanyDate().ToString("yyyyMMdd");//임포트 실행일
                string U_RELUSER = B1Connections.diCompany.UserName;//임포트 실행 사용자


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

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

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

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

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

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

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

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

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

                        default:
                            break;
                    }
                }

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

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


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


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

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


                #region 바디

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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


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

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

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


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

                #endregion


                #region 합계

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

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

                #endregion


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

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

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

        }