private void grdGunSonuBakiyeRaporu_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (grdGunSonuBakiyeRaporu.Rows.Count > 0) { double topGiren = 0.0; double topCikan = 0.0; double bakiye = 0.0; foreach (DataGridViewRow row in grdGunSonuBakiyeRaporu.Rows) { if (Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()) > 0.0) { bakiye -= Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()); topCikan += Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()); } if (Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()) > 0.0) { bakiye += Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()); topGiren += Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()); } } TOP_GIREN.SetDoubleData(topGiren); TOP_CIKAN.SetDoubleData(topCikan); BAKIYE.SetDoubleData(bakiye); } }
private void grdKasaHareketRaporu_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (grdKasaHareketRaporu.Rows.Count > 0) { grdKasaHareketRaporu.DataBindingComplete -= grdKasaHareketRaporu_DataBindingComplete; double bakiye = 0.0; double topGiren = 0.0; double topCikan = 0.0; foreach (DataGridViewRow row in grdKasaHareketRaporu.Rows) { if (Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()) > 0.0) { bakiye -= Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()); topCikan += Convert.ToDouble(row.Cells["grdCIKAN_TUTAR"].Value.ToString()); } if (Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()) > 0.0) { bakiye += Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()); topGiren += Convert.ToDouble(row.Cells["grdGIREN_TUTAR"].Value.ToString()); } row.Cells["grdBAKIYE"].Value = bakiye; if (Convert.ToDouble(row.Cells["grdBAKIYE"].Value.ToString()) < 0) { row.Cells["grdBAKIYE"].Style.ForeColor = Color.Red; row.Cells["grdBAKIYE"].Style.Font = new Font("Arial", 9, FontStyle.Bold); } else if (Convert.ToDouble(row.Cells["grdBAKIYE"].Value.ToString()) > 0) { row.Cells["grdBAKIYE"].Style.ForeColor = Color.Green; row.Cells["grdBAKIYE"].Style.Font = new Font("Arial", 9, FontStyle.Bold); } } TOP_GIREN.SetDoubleData(topGiren); TOP_CIKAN.SetDoubleData(topCikan); BAKIYE.SetDoubleData(bakiye); grdKasaHareketRaporu.DataBindingComplete += grdKasaHareketRaporu_DataBindingComplete; } }