private void AddTravelExpenses(TravelExpMovTypesEnum pEnumMovType, int pIntRepeat, int pIntDays = 1) { try { for (int i = 0; i < pIntRepeat; i++) { dtTravelExp.Rows.Add(); dtTravelExp.SetValue("#", dtTravelExp.Rows.Count - 1, dtTravelExp.Rows.Count + 1); dtTravelExp.SetValue("MovType", dtTravelExp.Rows.Count - 1, pEnumMovType); dtTravelExp.SetValue("MovCode", dtTravelExp.Rows.Count - 1, ((int)pEnumMovType).ToString()); dtTravelExp.SetValue("Commts", dtTravelExp.Rows.Count - 1, string.Empty); dtTravelExp.SetValue("TravDays", dtTravelExp.Rows.Count - 1, mIntDaysTotal); if (pEnumMovType == TravelExpMovTypesEnum.DayExpenses.Value) //operadores { dtTravelExp.SetValue("EmpCode", dtTravelExp.Rows.Count - 1, (mDtEmployees.GetValue(1, i).ToString() == "0") ? mStrSupervisorCode : mDtEmployees.GetValue(1, i)); dtTravelExp.SetValue("EmpName", dtTravelExp.Rows.Count - 1, string.IsNullOrEmpty(mDtEmployees.GetValue(2, i).ToString()) ? mStrSupervisorName : mDtEmployees.GetValue(2, i)); dtTravelExp.SetValue("AcctCode", dtTravelExp.Rows.Count - 1, mStrExpDayAcct); dtTravelExp.SetValue("TravPrice", dtTravelExp.Rows.Count - 1, mDblExpDayPrice); dtTravelExp.SetValue("TravImp", dtTravelExp.Rows.Count - 1, mIntDaysTotal * mDblExpDayPrice); dtTravelExp.SetValue("EmpType", dtTravelExp.Rows.Count - 1, EmployeesTypesEnum.Operators.GetDescription()); } else if (pEnumMovType == TravelExpMovTypesEnum.TravelExpenses) //supervisor { dtTravelExp.SetValue("EmpCode", dtTravelExp.Rows.Count - 1, mStrSupervisorCode); dtTravelExp.SetValue("EmpName", dtTravelExp.Rows.Count - 1, mStrSupervisorName); dtTravelExp.SetValue("AcctCode", dtTravelExp.Rows.Count - 1, mStrViaticExpAcct); dtTravelExp.SetValue("TravPrice", dtTravelExp.Rows.Count - 1, mDblViaticPrice); dtTravelExp.SetValue("TravImp", dtTravelExp.Rows.Count - 1, mIntDaysTotal * mDblViaticPrice); dtTravelExp.SetValue("EmpType", dtTravelExp.Rows.Count - 1, EmployeesTypesEnum.Supervisors.GetDescription()); } else if (pEnumMovType == TravelExpMovTypesEnum.MinorExpenses) //supervisor { dtTravelExp.SetValue("EmpCode", dtTravelExp.Rows.Count - 1, mStrSupervisorCode); dtTravelExp.SetValue("EmpName", dtTravelExp.Rows.Count - 1, mStrSupervisorName); dtTravelExp.SetValue("AcctCode", dtTravelExp.Rows.Count - 1, mStrMinorPurchAcct); dtTravelExp.SetValue("TravPrice", dtTravelExp.Rows.Count - 1, 0); dtTravelExp.SetValue("TravImp", dtTravelExp.Rows.Count - 1, 0); dtTravelExp.SetValue("EmpType", dtTravelExp.Rows.Count - 1, EmployeesTypesEnum.Supervisors.GetDescription()); } } mtxTravelExp.LoadFromDataSource(); mtxTravelExp.AutoResizeColumns(); if (pEnumMovType == TravelExpMovTypesEnum.MinorExpenses) //supervisor { SAPbouiCOM.CommonSetting lObjCmmnSetting = mtxTravelExp.CommonSetting; lObjCmmnSetting.SetCellEditable(dtTravelExp.Rows.Count, 3, true); lObjCmmnSetting.SetCellEditable(dtTravelExp.Rows.Count, 5, true); } } catch (Exception lObjException) { throw new Exception(string.Format("Error al agregar la solicitud de consumible {0}", lObjException.Message)); } }
public void gridset() { //desahabilitar un campo de la grilla SAPbouiCOM.CommonSetting setear = Grid0.CommonSetting; Grid0.Columns.Item("Código").TitleObject.Sortable = true; for (int i = 1; i <= this.Grid0.DataTable.Rows.Count; i += 1) { setear.SetCellEditable(i, 4, false); } }