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; } } }
/// <summary> /// Se le da el formato al grid para visualizarlo /// </summary> /// <param name="grid">Nombre del grid</param> public void FormatoGrid(Grid grid) { try { _oForma.Freeze(true); if (!grid.DataTable.IsEmpty) { grid.RowHeaders.TitleObject.Caption = "#"; for (int noLinea = 0; noLinea < grid.Rows.Count; noLinea++) { grid.RowHeaders.SetText(noLinea, (noLinea + 1).ToString()); } grid.Columns.Item("DocEntry").Editable = false; grid.Columns.Item("DocEntry").TitleObject.Caption = "DocEntry"; SAPbouiCOM.EditTextColumn oColTransferStock = grid.Columns.Item("DocEntry") as SAPbouiCOM.EditTextColumn; oColTransferStock.LinkedObjectType = LINK_TRANSFERENCIA_STOCK; grid.Columns.Item("DocEntry").Width = 60; grid.Columns.Item("Crear").Editable = true; grid.Columns.Item("Crear").TitleObject.Caption = "Crear"; grid.Columns.Item("Crear").Width = 90; if (!grid.DataTable.IsEmpty) { grid.Columns.Item("Crear").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox; } grid.Columns.Item("DocNum").Editable = false; grid.Columns.Item("DocNum").TitleObject.Caption = "Número traspaso"; grid.Columns.Item("DocNum").Width = 90; grid.Columns.Item("CodigoUsuario").Editable = false; grid.Columns.Item("CodigoUsuario").TitleObject.Caption = "Usuario"; grid.Columns.Item("Serie").Editable = false; grid.Columns.Item("Serie").TitleObject.Caption = "Solicitud"; grid.Columns.Item("CodigoPromotor").Editable = false; grid.Columns.Item("CodigoPromotor").TitleObject.Caption = "Código promotor"; grid.Columns.Item("NombrePromotor").Editable = false; grid.Columns.Item("NombrePromotor").TitleObject.Caption = "Nombre promotor"; grid.Columns.Item("CodigoPlan").Editable = false; grid.Columns.Item("CodigoPlan").TitleObject.Caption = "Código plan"; SAPbouiCOM.EditTextColumn oColPlan = grid.Columns.Item("CodigoPlan") as SAPbouiCOM.EditTextColumn; oColPlan.LinkedObjectType = LINK_ARTICULO; grid.Columns.Item("NombrePlan").Editable = false; grid.Columns.Item("NombrePlan").TitleObject.Caption = "Nombre plan"; grid.Columns.Item("NombrePlan").Width = 120; grid.Columns.Item("FormaDePago").Editable = false; grid.Columns.Item("FormaDePago").TitleObject.Caption = "Forma de pago"; grid.Columns.Item("FormaDePago").Width = 90; grid.Columns.Item("OrigenSolicitud").Editable = false; grid.Columns.Item("OrigenSolicitud").TitleObject.Caption = "Origen de solicitud"; grid.Columns.Item("OrigenSolicitud").Width = 90; grid.Columns.Item("InversionInicial").Editable = false; grid.Columns.Item("InversionInicial").TitleObject.Caption = "Inversión inicial"; grid.Columns.Item("InversionInicial").Width = 80; grid.Columns.Item("Comision").Editable = false; grid.Columns.Item("Comision").TitleObject.Caption = "Comisión"; grid.Columns.Item("Comision").Width = 80; grid.Columns.Item("ImportePapeleria").Editable = false; grid.Columns.Item("ImportePapeleria").TitleObject.Caption = "Importe papelería"; grid.Columns.Item("ImportePapeleria").Width = 80; grid.Columns.Item("ImporteRecibido").Editable = false; grid.Columns.Item("ImporteRecibido").TitleObject.Caption = "Importe recibido"; grid.Columns.Item("ImporteRecibido").Width = 80; grid.Columns.Item("ExcedenteInvIni").Visible = false; grid.Columns.Item("ExcedenteInvIni").TitleObject.Caption = "Excedente individual. inicial"; grid.Columns.Item("ExcedenteInvIni").Width = 90; grid.Columns.Item("Bono").Visible = false; grid.Columns.Item("Bono").TitleObject.Caption = "Bono"; grid.Columns.Item("Bono").Width = 80; grid.CollapseLevel = 1; _oGridPrecontratos.AutoResizeColumns(); } else { _Application.MessageBox("No se encontraron registros"); grid.DataTable.Clear(); } } catch (Exception ex) { throw new Exception("Error al dar formato al grid *FormatoGrid* : " + ex.Message); } finally { _oForma.Freeze(false); _oForma.Update(); } }
/// <summary> /// Se le da el formato al grid para visualizarlo /// </summary> /// <param name="grid">Nombre del grid</param> public void FormatoGrid(Grid grid) { try { _oForma.Freeze(true); grid.RowHeaders.TitleObject.Caption = "#"; for (int noLinea = 0; noLinea < grid.Rows.Count; noLinea++) { grid.RowHeaders.SetText(noLinea, (noLinea + 1).ToString()); } grid.Columns.Item("CodigoID").Editable = false; grid.Columns.Item("CodigoID").TitleObject.Caption = " "; grid.Columns.Item("CodigoID").Width = 15; SAPbouiCOM.EditTextColumn oColCodEmp = grid.Columns.Item("CodigoID") as SAPbouiCOM.EditTextColumn; oColCodEmp.LinkedObjectType = LINK_DM_COBRADORES; grid.Columns.Item("CodCobrador").Editable = false; grid.Columns.Item("CodCobrador").TitleObject.Caption = "Código"; grid.Columns.Item("NomCobrador").Editable = false; grid.Columns.Item("NomCobrador").TitleObject.Caption = "Cobrador"; grid.Columns.Item("SeriePrograma").Editable = true; grid.Columns.Item("SeriePrograma").TitleObject.Caption = "Serie programa"; //grid.Columns.Item("SerieMalba").Editable = true; //grid.Columns.Item("SerieMalba").TitleObject.Caption = "Serie malba"; grid.Columns.Item("SerieCooperativa").Editable = true; grid.Columns.Item("SerieCooperativa").TitleObject.Caption = "Serie cooperativa"; grid.Columns.Item("SeriePanteon").Editable = true; grid.Columns.Item("SeriePanteon").TitleObject.Caption = "Serie panteón"; grid.Columns.Item("ComisionPanteon").Editable = true; grid.Columns.Item("ComisionPanteon").TitleObject.Caption = "Comisión panteón %"; grid.Columns.Item("SueldoCooperativa").Editable = true; grid.Columns.Item("SueldoCooperativa").TitleObject.Caption = "Sueldo cooperativa %"; grid.Columns.Item("SueldoApoyo").Editable = true; grid.Columns.Item("SueldoApoyo").TitleObject.Caption = "Sueldo apoyo %"; grid.Columns.Item("ComisionCooperativa").Editable = true; grid.Columns.Item("ComisionCooperativa").TitleObject.Caption = "Comisión cooperativa %"; grid.Columns.Item("ComisionApoyo").Editable = true; grid.Columns.Item("ComisionApoyo").TitleObject.Caption = "Comisión apoyo %"; grid.Columns.Item("Efectividad").Editable = true; grid.Columns.Item("Efectividad").TitleObject.Caption = "Efectividad %"; grid.Columns.Item("SueldoBase").Editable = true; grid.Columns.Item("SueldoBase").TitleObject.Caption = "Sueldo base"; if (!grid.DataTable.IsEmpty) { grid.Columns.Item("SueldoBase").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox; } //Agregar filtros a columnas del grid grid.Columns.Item("SeriePrograma").TitleObject.Sortable = true; grid.Columns.Item("SeriePrograma").TitleObject.Sort(BoGridSortType.gst_Ascending); //grid.Columns.Item("SerieMalba").TitleObject.Sortable = true; //grid.Columns.Item("SerieMalba").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("SerieCooperativa").TitleObject.Sortable = true; grid.Columns.Item("SerieCooperativa").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("SeriePanteon").TitleObject.Sortable = true; grid.Columns.Item("SeriePanteon").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("ComisionPanteon").TitleObject.Sortable = true; grid.Columns.Item("ComisionPanteon").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("SueldoCooperativa").TitleObject.Sortable = true; grid.Columns.Item("SueldoCooperativa").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("SueldoApoyo").TitleObject.Sortable = true; grid.Columns.Item("SueldoApoyo").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("ComisionCooperativa").TitleObject.Sortable = true; grid.Columns.Item("ComisionCooperativa").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("ComisionApoyo").TitleObject.Sortable = true; grid.Columns.Item("ComisionApoyo").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("Efectividad").TitleObject.Sortable = true; grid.Columns.Item("Efectividad").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("CodCobrador").TitleObject.Sortable = true; grid.Columns.Item("CodCobrador").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("NomCobrador").TitleObject.Sortable = true; grid.Columns.Item("NomCobrador").TitleObject.Sort(BoGridSortType.gst_Ascending); grid.Columns.Item("CodigoID").TitleObject.Sortable = true; grid.Columns.Item("CodigoID").TitleObject.Sort(BoGridSortType.gst_Ascending); } catch (Exception ex) { throw new Exception("Error al dar formato al grid *FormatoGrid* : " + ex.Message); } finally { _oForma.Freeze(false); } }
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; } } }