private void InsertIncentiveTrans() { if (s_mName == "A") { for (int i = 0; i <= dt_ExeName.Rows.Count - 1; i++) { IncGenBO.i_ExeId = Convert.ToInt32(grdIGView.GetRowCellValue(i, "ExecutiveId")); IncGenBO.d_Amount = Convert.ToDecimal(grdIGView.GetRowCellValue(i, "Amount")); if (IncGenBO.d_Amount != 0) { IncentiveDL.InsertAmount("A", IncGenBO); } } } else { for (int i = 0; i <= dt_ExeName.Rows.Count - 1; i++) { IncGenBO.i_ExeId = Convert.ToInt32(grdIGView.GetRowCellValue(i, "ExecutiveId")); IncGenBO.i_IncGenId = i_mId; IncGenBO.d_Amount = Convert.ToDecimal(grdIGView.GetRowCellValue(i, "Amount")); if (IncGenBO.d_Amount != 0) { IncentiveDL.InsertAmount("E", IncGenBO); } } } }
private void PopulateGrid() { DataTable dt = new DataTable(); dt = IncentiveDL.SelectIncGen(); grdIncDet.DataSource = dt; grdIncDetView.PopulateColumns(); grdIncDetView.Columns["IncentiveId"].Visible = false; grdIncDetView.Columns["Narration"].Visible = false; grdIncDetView.Columns["TotalAmount"].Visible = false; grdIncDetView.Columns["IDate"].Caption = "Date"; grdIncDetView.Columns["FDate"].Caption = "From Date"; grdIncDetView.Columns["TDate"].Caption = "To Date"; grdIncDetView.Columns["IRefNo"].Caption = "Reference No"; }
private void btnOk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BsfGlobal.FindPermission("Incentive Details-Add") == false) { MessageBox.Show("You don't have Rights to Incentive Details-Add"); return; } grdIGView.FocusedRowHandle = grdIGView.FocusedRowHandle + 1; if (DEDate.EditValue == null) { return; } if (DETo.EditValue == null) { return; } IncGenBO.DE_Date = Convert.ToDateTime(DEDate.EditValue.ToString()); IncGenBO.DE_From = Convert.ToDateTime(DEFrom.EditValue.ToString()); IncGenBO.DE_To = Convert.ToDateTime(DETo.EditValue.ToString()); IncGenBO.s_RefNo = txtRefNo.Text; IncGenBO.s_Narration = txtNarration.Text; IncGenBO.d_TotalAmount = Convert.ToDecimal(CommFun.IsNullCheck(grdIGView.Columns["Amount"].SummaryText.ToString(), CommFun.datatypes.vartypenumeric)); if (s_mName == "A") { IncentiveDL.InsertIncGen("A", IncGenBO); InsertIncentiveTrans(); Close(); } else { IncentiveDL.InsertIncGen("E", IncGenBO); InsertIncentiveTrans(); bar1.Visible = false; bar3.Visible = false; panelControl1.Controls.Clear(); frmIncentiveDetails frmID = new frmIncentiveDetails() { TopLevel = false, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill }; panelControl1.Controls.Add(frmID); frmID.Show(); } }
private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BsfGlobal.FindPermission("Incentive Details-Delete") == false) { MessageBox.Show("You don't have Rights to Incentive Details-Delete"); return; } if (grdIncDetView.FocusedRowHandle >= 0) { if (MessageBox.Show("Do You Want Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { i_IncId = Convert.ToInt32(grdIncDetView.GetFocusedRowCellValue("IncentiveId").ToString()); IncentiveDL.DeleteIncDet(i_IncId); grdIncDetView.DeleteRow(grdIncDetView.FocusedRowHandle); } } }
private void EditIncGen() { btnGenerate.Enabled = false; DataTable dt = new DataTable(); dt_IncGen = new DataTable(); dt_IncGenTrans = new DataTable(); dt_IncGen = IncentiveDL.SelectIncGen(); using (DataView dv = new DataView(dt_IncGen) { RowFilter = String.Format("IncentiveId={0}", i_mId) }) { dt_IncGen = dv.ToTable(); if (dt_IncGen.Rows.Count > 0) { IncGenBO.i_IncGenId = i_mId; DEDate.EditValue = Convert.ToDateTime(dt_IncGen.Rows[0]["IDate"].ToString()); DEFrom.EditValue = Convert.ToDateTime(dt_IncGen.Rows[0]["FDate"].ToString()); DETo.EditValue = Convert.ToDateTime(dt_IncGen.Rows[0]["TDate"].ToString()); txtRefNo.Text = dt_IncGen.Rows[0]["IRefNo"].ToString(); txtNarration.Text = dt_IncGen.Rows[0]["Narration"].ToString(); dt_IncGenTrans = IncentiveDL.SelectIncGenTrans(IncGenBO); if (dt_IncGenTrans.Rows.Count > 0) { dt = (grdIG.DataSource) as DataTable; for (int i = 0; i <= dt_IncGenTrans.Rows.Count - 1; i++) { grdIGView.SetRowCellValue(i, grdIGView.Columns["Amount"].ToString(), dt_IncGenTrans.Rows[i]["Amount"].ToString()); } } } } grdIGView.UpdateSummary(); }
private void GenerateInc() { if (s_mName != "E") { if (DEFrom.EditValue == null || DEFrom.EditValue.ToString() == "") { return; } if (DETo.EditValue == null || DETo.EditValue.ToString() == "") { return; } } dt_ExeName = new DataTable(); dt_ExeName = CommFun.FillExec(); DataTable dt_Gen = new DataTable(); dt_Gen.Columns.Add("RowId", typeof(int)); dt_Gen.Columns.Add("ExecutiveId", typeof(int)); dt_Gen.Columns.Add("ExecutiveName", typeof(string)); dt_Gen.Columns.Add("Amount", typeof(decimal)).DefaultValue = 0; for (int row = 0; row <= dt_ExeName.Rows.Count - 1; row++) { DataRow dr = dt_Gen.NewRow(); dr["RowId"] = dt_Gen.Rows.Count + 1; dr["ExecutiveName"] = dt_ExeName.Rows[row]["ExecName"].ToString(); dr["ExecutiveId"] = Convert.ToInt32(dt_ExeName.Rows[row]["ExecId"]); dt_Gen.Rows.Add(dr); } if (s_mName != "E") { string s_Date1 = string.Format("{0:MM/yyyy}", DEFrom.EditValue); string s_Date2 = string.Format("{0:MM/yyyy}", DETo.EditValue); string[] s1 = s_Date1.Split('/'); string[] s2 = s_Date2.Split('/'); DataSet ds = new DataSet(); DataTable dtI = new DataTable(); DataTable dtV = new DataTable(); IncBO.FromMonth = Convert.ToInt32(s1[0]); IncBO.ToMonth = Convert.ToInt32(s2[0]); IncBO.FromYear = Convert.ToInt32(s1[1]); IncBO.ToYear = Convert.ToInt32(s2[1]); ds = IncentiveDL.GetIncentive(); dtI = ds.Tables["Inc"]; dtV = ds.Tables["Value"]; DataView dv; DataRow[] drT; for (int i = 0; i < dt_Gen.Rows.Count; i++) { int iExecId = Convert.ToInt32(dt_Gen.Rows[i]["ExecutiveId"].ToString()); decimal dAmtL = 0; decimal dAmtR = 0; decimal dNetValue = 0; dv = new DataView(dtI); dv.RowFilter = "ExecutiveId = " + iExecId + " And IncentiveType='L'"; if (dv.ToTable().Rows.Count > 0) { for (int x = 0; x < dv.ToTable().Rows.Count; x++) { dAmtL = dAmtL + Convert.ToDecimal(dv.ToTable().Rows[x]["IncValue"].ToString()); } } dv = new DataView(dtI); dv.RowFilter = "ExecutiveId = " + iExecId + " And IncentiveType='R'"; if (dv.ToTable().Rows.Count > 0) { for (int x = 0; x < dv.ToTable().Rows.Count; x++) { dAmtR = dAmtR + Convert.ToDecimal(dv.ToTable().Rows[x]["IncValue"].ToString()); } } dv = new DataView(dtV); dv.RowFilter = "ExecutiveId = " + iExecId; if (dv.ToTable().Rows.Count > 0) { dNetValue = Convert.ToDecimal(dv.ToTable().Rows[0]["Amt"].ToString()); } drT = dt_Gen.Select("ExecutiveId = " + iExecId + " "); if (drT.Length > 0) { drT[0]["Amount"] = (dNetValue * dAmtR / 100) + dAmtL; } } } grdIG.DataSource = dt_Gen; grdIGView.PopulateColumns(); grdIGView.Columns["RowId"].Visible = false; grdIGView.Columns["ExecutiveId"].Visible = false; grdIGView.Columns["ExecutiveName"].OptionsColumn.AllowEdit = false; grdIGView.Columns["Amount"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; grdIGView.Columns["Amount"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; grdIGView.Columns["Amount"].DisplayFormat.FormatString = BsfGlobal.g_sDigitFormat; grdIGView.Columns["Amount"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; grdIGView.Columns["Amount"].SummaryItem.DisplayFormat = BsfGlobal.g_sDigitFormatS; }
public static void DeleteIncDet(int argId) { IncentiveDL.DeleteIncDet(argId); }
public static DataTable SelectIncGenTrans(IncentiveBO IncGenBO) { return(IncentiveDL.SelectIncGenTrans(IncGenBO)); }
public static DataTable SelectIncGen() { return(IncentiveDL.SelectIncGen()); }
public static void InsertAmount(string argMode, IncentiveBO IncGenBO) { IncentiveDL.InsertAmount(argMode, IncGenBO); }
public static int InsertIncGen(string argMode, IncentiveBO IncGenBO) { return(IncentiveDL.InsertIncGen(argMode, IncGenBO)); }