public override void etAfterClick(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterClick(ref pVal, ref BubbleEvent); if (pVal.ItemUID == "1") { update(); } if (pVal.ItemUID == cmdDR.Item.UniqueID) { int selRow = mtSelRow(mtDC); if (selRow > 0) { double ActVal = Convert.ToDouble(((SAPbouiCOM.EditText)mtDC.GetCellSpecific("V_2", selRow)).Value); string costingCode = Convert.ToString(((SAPbouiCOM.EditText)mtDC.GetCellSpecific("cCostCode", selRow)).Value); if (ActVal > 0) { oApplication.MessageBox("You can not delete already consumed costing code"); return; } else { deleteRow(costingCode); fillDetails(BOQH.GetValue("ItemCode", 0).ToString()); addEmptyRow(mtDC, BOQD, "CostCode"); } } } }
public override void etAfterClick(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterClick(ref pVal, ref BubbleEvent); if (pVal.ItemUID == "1") { update(); } if (pVal.ItemUID == cmdDR.Item.UniqueID) { int selRow = mtSelRow(mtDC); if (selRow > 0) { double ActVal = Convert.ToDouble(((SAPbouiCOM.EditText)mtDC.GetCellSpecific("V_2", selRow)).Value); string costingCode = Convert.ToString(((SAPbouiCOM.EditText)mtDC.GetCellSpecific("cCostCode", selRow)).Value); if (ActVal > 0) { oApplication.MessageBox("You can not delete already consumed costing code"); return; } else { deleteRow(costingCode); fillDetails(BOQH.GetValue("ItemCode", 0).ToString()); addEmptyRow(mtDC, BOQD, "CostCode"); } } } if (pVal.ItemUID == "btAdd") { if (txACode.Value == "" || txAName.Value == "") { } else { SAPbobsCOM.GeneralService oGeneralService; SAPbobsCOM.GeneralData oGeneralData; SAPbobsCOM.CompanyService cmpserv = oCompany.GetCompanyService(); oGeneralService = cmpserv.GetGeneralService("oIBOQ"); oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData); oGeneralData.SetProperty("Code", txACode.Value.ToString()); oGeneralData.SetProperty("Name", txAName.Value.ToString()); oGeneralService.Add(oGeneralData); txACode.Value = ""; txAName.Value = ""; } } }
public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (pVal.ItemUID == txCode.Item.UniqueID) { if (dtSel != null && dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("ItemCode", 0).ToString(); string strName = dtSel.GetValue("ItemName", 0).ToString(); string Remarks = dtSel.GetValue("U_B1_BOQREM", 0).ToString(); string Qty = dtSel.GetValue("U_B1_BOQQty", 0).ToString(); double APC = getAPCCost(strCode); BOQH.SetValue("ItemCode", 0, strCode); BOQH.SetValue("ItemName", 0, strName); BOQH.SetValue("Remarks", 0, Remarks); BOQH.SetValue("Qty", 0, Qty); BOQH.SetValue("APC", 0, APC); fillDetails(strCode); getIndirectCost(strCode); addEmptyRow(mtDC, BOQD, "CostCode"); } } if (pVal.ItemUID == mtDC.Item.UniqueID && pVal.ColUID == "cCode") { if (dtSel != null && dtSel.Rows.Count > 0) { SAPbouiCOM.ComboBox cbColType = (SAPbouiCOM.ComboBox)mtDC.Columns.Item("cType").Cells.Item(pVal.Row).Specific; if (cbColType.Selected.Value == "I") { string strCode = dtSel.GetValue("ItemCode", 0).ToString(); string strName = dtSel.GetValue("ItemName", 0).ToString(); BOQD.SetValue("Code", pVal.Row - 1, strCode); BOQD.SetValue("Name", pVal.Row - 1, strName); } if (cbColType.Selected.Value == "S") { string strCode = dtSel.GetValue("AcctCode", 0).ToString(); string strName = dtSel.GetValue("AcctName", 0).ToString(); BOQD.SetValue("Code", pVal.Row - 1, strCode); BOQD.SetValue("Name", pVal.Row - 1, strName); } mtDC.LoadFromDataSource(); } } }
private void fillDetails(string itemCode) { BOQD.Rows.Clear(); double dbgtTotal = 0.00; double dactTotal = 0.00; // addEmptyRow(mtDC, BOQD, "CostCode"); // string strQD = " Select * from [@B1_DBOQD] where u_ItemCode='" + itemCode + "'"; Hashtable hp = new Hashtable(); hp.Add("~p1", itemCode); string strQD = Program.objHrmsUI.getQryString("DBOQ_FD_005", hp); System.Data.DataTable dtQD = Program.objHrmsUI.getDataTable(strQD, "getting details"); if (dtQD.Rows.Count > 0) { BOQD.Rows.Add(dtQD.Rows.Count); int i = 0; foreach (System.Data.DataRow dr in dtQD.Rows) { BOQD.SetValue("Id", i, (i + 1).ToString()); BOQD.SetValue("CostCode", i, dr["Code"].ToString()); BOQD.SetValue("STD", i, Convert.ToDateTime(dr["U_WBSStD"]).ToString("yyyyMMdd")); BOQD.SetValue("ETD", i, Convert.ToDateTime(dr["U_WBSED"]).ToString("yyyyMMdd")); BOQD.SetValue("WBL", i, Convert.ToString(dr["U_WBSLevel"]).ToString()); BOQD.SetValue("WBD", i, Convert.ToString(dr["U_WBSDscr"]).ToString()); BOQD.SetValue("Type", i, Convert.ToString(dr["U_Type"]).ToString()); BOQD.SetValue("Code", i, Convert.ToString(dr["U_rCode"]).ToString()); BOQD.SetValue("Name", i, Convert.ToString(dr["U_rName"]).ToString()); BOQD.SetValue("Remarks", i, Convert.ToString(dr["U_Remarks"]).ToString()); BOQD.SetValue("Qty", i, Convert.ToString(dr["U_Qty"]).ToString()); BOQD.SetValue("UP", i, Convert.ToString(dr["U_Price"]).ToString()); BOQD.SetValue("BGTC", i, Convert.ToString(dr["U_BgtCost"]).ToString()); double ActValue = getActCost(dr["Code"].ToString()); BOQD.SetValue("ACTC", i, ActValue); dbgtTotal += Convert.ToDouble(dr["U_BgtCost"]); dactTotal += ActValue; i++; } } mtDC.LoadFromDataSource(); BOQH.SetValue("ICB", 0, dbgtTotal); BOQH.SetValue("ICA", 0, dactTotal); oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE; }
private void update() { string ItemCode = Convert.ToString(BOQH.GetValue("ItemCode", 0)); string remarks = Convert.ToString(BOQH.GetValue("Remarks", 0)); if (ItemCode != "") { Hashtable hp = new Hashtable(); hp.Add("~p1", remarks); hp.Add("~p2", cbRule.Selected.Value.ToString().Trim()); hp.Add("~p3", ItemCode); string strUpdate = Program.objHrmsUI.getQryString("IBOQ_CRUD_001", hp); // string strUpdate = "Update \"@B1_IBOQ\" set \"U_Remarks\" = '" + remarks + "',U_AR = '" + cbRule.Selected.Value.ToString().Trim() + "' where Code = '" + ItemCode + "'"; Program.objHrmsUI.ExecQuery(strUpdate, "Updating description"); updateDCodes(ItemCode); } }
private void update() { string ItemCode = Convert.ToString(BOQH.GetValue("ItemCode", 0)); string remarks = Convert.ToString(BOQH.GetValue("Remarks", 0)); string Qty = Convert.ToString(BOQH.GetValue("Qty", 0)); if (ItemCode != "") { Hashtable hp = new Hashtable(); hp.Add("~p1", remarks); hp.Add("~p2", Qty); hp.Add("~p3", ItemCode); string strUpdate = Program.objHrmsUI.getQryString("DBOQ_UP_001", hp); Program.objHrmsUI.ExecQuery(strUpdate, "Updating description"); updateDCodes(ItemCode); } }
private void getIndirectCost(string FACode) { BOQID.Rows.Clear(); System.Data.DataTable dtIndirectCostCode = new System.Data.DataTable(); dtIndirectCostCode.Columns.Add("CostCode"); dtIndirectCostCode.Columns.Add("AR"); dtIndirectCostCode.Columns.Add("Budget"); System.Data.DataTable AMS = new System.Data.DataTable(); AMS.Columns.Add("AM"); AMS.Columns.Add("Father"); Hashtable hp = new Hashtable(); hp.Add("~p1", FACode); System.Data.DataTable dtFA = Program.objHrmsUI.getDataTableQryCode("DBOQ_IC_001", hp, "Fill Root"); if (dtFA.Rows.Count > 0) { foreach (System.Data.DataRow drFA in dtFA.Rows) { string AM = drFA["Code"].ToString(); string Father = drFA["U_Father"].ToString(); while (AM != "0") { AMS.Rows.Add(AM, Father); hp.Clear(); hp.Add("~p1", Father); string strFather = Program.objHrmsUI.getQryString("DBOQ_IC_002", hp); System.Data.DataTable dtFather = Program.objHrmsUI.getDataTable(strFather, "Father"); if (dtFather.Rows.Count > 0) { AM = dtFather.Rows[0]["Code"].ToString(); Father = dtFather.Rows[0]["U_Father"].ToString(); } else { Father = "0"; AM = "Root"; } } } } double indirectCostBudget = 0.00; double indirectCostActual = 0.00; foreach (System.Data.DataRow drAM in AMS.Rows) { hp.Clear(); hp.Add("~p1", drAM["AM"].ToString()); string strSqlAR = Program.objHrmsUI.getQryString("DBOQ_IC_003", hp); System.Data.DataTable dtRule = Program.objHrmsUI.getDataTable(strSqlAR, "Allocation Rule"); if (dtRule.Rows.Count > 0) { foreach (System.Data.DataRow drAR in dtRule.Rows) { hp.Clear(); hp.Add("~p1", drAR["AR"].ToString()); string strCosts = Program.objHrmsUI.getQryString("DBOQ_IC_004", hp); System.Data.DataTable dtCostCodes = Program.objHrmsUI.getDataTable(strCosts, "Indirect Cost Codes"); foreach (System.Data.DataRow drCostCode in dtCostCodes.Rows) { BOQID.Rows.Add(1); BOQID.SetValue("CostCode", BOQID.Rows.Count - 1, drCostCode["code"].ToString()); BOQID.SetValue("STD", BOQID.Rows.Count - 1, Convert.ToDateTime(drCostCode["U_WBSStd"])); BOQID.SetValue("ETD", BOQID.Rows.Count - 1, Convert.ToDateTime(drCostCode["U_WBSED"])); BOQID.SetValue("WBL", BOQID.Rows.Count - 1, drCostCode["U_WBSLevel"].ToString()); BOQID.SetValue("WBD", BOQID.Rows.Count - 1, drCostCode["U_WBSDscr"].ToString()); double indirectCost = getIndirectACt(drCostCode["code"].ToString(), FACode); double indirectBgtCost = Convert.ToDouble(drCostCode["U_BgtCost"]) * (Convert.ToDouble(drAR["AP"]) / 100.00); BOQID.SetValue("BGTC", BOQID.Rows.Count - 1, indirectBgtCost); BOQID.SetValue("ACTC", BOQID.Rows.Count - 1, indirectCost); BOQID.SetValue("Remarks", BOQID.Rows.Count - 1, drCostCode["U_Remarks"].ToString()); indirectCostActual += indirectCost; indirectCostBudget += indirectBgtCost; } } } } BOQH.SetValue("ICB", 0, indirectCostBudget); BOQH.SetValue("ICA", 0, indirectCostActual); BOQH.SetValue("TCB", 0, indirectCostBudget + Convert.ToDouble(BOQH.GetValue("DCB", 0))); BOQH.SetValue("TCA", 0, indirectCostActual + Convert.ToDouble(BOQH.GetValue("DCA", 0))); mtIC.LoadFromDataSource(); }