public void COLOR_FILAS() { int alto = 0; int bajo = 0; int medio = 0; foreach (DataGridViewRow row in DG.Rows) { if (Convert.ToDecimal(row.Cells["VALOR_TOTAL"].Value.ToString()) <= 30) { row.DefaultCellStyle.BackColor = Color.Green; bajo++; } else if (Convert.ToDecimal(row.Cells["VALOR_TOTAL"].Value.ToString()) > 30 && Convert.ToDecimal(row.Cells["VALOR_TOTAL"].Value.ToString()) <= 60) { row.DefaultCellStyle.BackColor = Color.Orange; medio++; } else { row.DefaultCellStyle.BackColor = Color.Red; alto++; } } lbl_alto.Text = alto.ToString(); lbl_bajo.Text = bajo.ToString(); lbl_medio.Text = medio.ToString(); DG.ClearSelection(); }
private void mAdditemBill(string strItemName, string strUnit, double dblFromQty, double dblToQty, double dblRate, double dblDiscount) { int selRaw; string strDown = ""; Boolean blngCheck = false; for (int j = 0; j < DG.RowCount; j++) { if (DG[0, j].Value != null) { strDown = DG[0, j].Value.ToString(); } if (strItemName == strDown.ToString()) { blngCheck = true; } } if (blngCheck == false) { DG.AllowUserToAddRows = true; selRaw = Convert.ToInt16(DG.RowCount.ToString()); selRaw = selRaw - 1; DG.Rows.Add(); DG[0, selRaw].Value = strItemName; DG[1, selRaw].Value = Utility.gGetBaseUOM(strComID, strItemName); DG[2, selRaw].Value = dblFromQty.ToString(); DG[3, selRaw].Value = dblToQty.ToString(); DG[4, selRaw].Value = dblRate.ToString(); DG[5, selRaw].Value = dblDiscount.ToString(); DG[6, selRaw].Value = "Delete"; DG.AllowUserToAddRows = false; uctxtItemName.Text = ""; uctxtFromQty.Text = "1"; uctxtToQty.Text = "9999"; uctxtUnit.Text = ""; uctxtRate.Text = ""; uctxtDiscount.Text = ""; uctxtItemName.Focus(); DG.ClearSelection(); int nColumnIndex = 2; int nRowIndex = DG.Rows.Count - 1; DG.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; DG.FirstDisplayedScrollingRowIndex = nRowIndex; } }
private void frmMpoCommManual_Load(object sender, EventArgs e) { lstBranch.Visible = false; mClear(); this.DG.DefaultCellStyle.Font = new Font("verdana", 9); DG.Columns.Add(Utility.Create_Grid_Column("Ledger Name", "Ledger Name", 280, true, DataGridViewContentAlignment.TopLeft, true)); DG.Columns.Add(Utility.Create_Grid_Column("Ledger Name", "Ledger Name", 300, false, DataGridViewContentAlignment.TopLeft, true)); DG.Columns[1].Frozen = true; DG.Columns[0].DefaultCellStyle.BackColor = Color.Beige; //DG.Columns[1].DefaultCellStyle.BackColor = Color.Bisque; List <AccountsLedger> oogrp = accms.mDisplayLedgerlistt(strComID, 1).ToList(); if (oogrp.Count > 0) { foreach (AccountsLedger ogrp in oogrp) { DG.Rows.Add(); DG.Columns.Add(Utility.Create_Grid_Column(ogrp.strLedgerName, ogrp.strLedgerName, 80, true, DataGridViewContentAlignment.TopLeft, false)); } } lstBranch.ValueMember = "BranchID"; lstBranch.DisplayMember = "BranchName"; lstBranch.DataSource = accms.mFillBranch(strComID, Utility.gblnAccessControl, Utility.gstrUserName).ToList(); uctxtBranch.Text = Utility.gstrBranchName; List <AccountdGroup> ooMonth = accms.mDisplayMonthsetupList(strComID, "1").ToList(); if (oogrp.Count > 0) { uctxtMonthID.Text = ooMonth[0].strMonthID; strMonthID = ooMonth[0].strMonthID; } mloadParty(0); DG.ClearSelection(); DG[1, 0].Selected = true; }
private void mAdditem(string strItemName, double dblQty, string strGiftItem, double dbltoQty) { int selRaw; string strDown = ""; Boolean blngCheck = false; for (int j = 0; j < DG.RowCount; j++) { if (DG[0, j].Value != null) { strDown = DG[0, j].Value.ToString(); } if (strItemName == strDown.ToString()) { blngCheck = true; } } if (blngCheck == false) { DG.AllowUserToAddRows = true; selRaw = Convert.ToInt16(DG.RowCount.ToString()); selRaw = selRaw - 1; DG.Rows.Add(); DG[0, selRaw].Value = strItemName; DG[1, selRaw].Value = dblQty + " " + Utility.gGetBaseUOM(strComID, strItemName); // DG[2, selRaw].Value = strGiftItem; DG[2, selRaw].Value = dbltoQty + " " + Utility.gGetBaseUOM(strComID, strItemName); DG[3, selRaw].Value = "Delete"; DG.AllowUserToAddRows = false; uctxtItemName.Text = ""; uctxtQty.Text = ""; uctxtBonusQty.Text = ""; uctxtItemName.Focus(); DG.ClearSelection(); int nColumnIndex = 2; int nRowIndex = DG.Rows.Count - 1; DG.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; DG.FirstDisplayedScrollingRowIndex = nRowIndex; } }
private void mAdditem(string strLedgerName, string strMerzeName) { int selRaw; string strDown = ""; Boolean blngCheck = false; for (int j = 0; j < DG.RowCount; j++) { if (DG[0, j].Value != null) { strDown = DG[1, j].Value.ToString(); } if (strLedgerName == strDown.ToString()) { blngCheck = true; MessageBox.Show("MPO Name already Exists!"); uctxtLedgerName.Focus(); return; } } if (blngCheck == false) { DG.AllowUserToAddRows = true; selRaw = Convert.ToInt16(DG.RowCount.ToString()); selRaw = selRaw - 1; DG.Rows.Add(); DG[0, selRaw].Value = strMerzeName; DG[1, selRaw].Value = strLedgerName; DG.AllowUserToAddRows = false; uctxtLedgerName.Text = ""; DG.ClearSelection(); int nColumnIndex = 2; int nRowIndex = DG.Rows.Count - 1; DG.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; DG.FirstDisplayedScrollingRowIndex = nRowIndex; } }