public void GenerateExpiryChart() { // Generate the pie Chart for the Current SOH and EXpired Drugs ReceiveDoc rec = new ReceiveDoc(); Balance bal = new Balance(); chartPie.Series.Clear(); Item itm = new Item(); int storeId = Convert.ToInt32(cboStores.SelectedValue); object[] objExp = itm.CountExpiredItemsAndAmount(storeId); Int64 expAmount = Convert.ToInt64(objExp[0]); Double expCost = Convert.ToDouble(objExp[1]); // TOFIX --------- object[] nearObj = itm.CountNearlyExpiredQtyAmount(storeId); Int64 nearExpAmount = Convert.ToInt64(nearObj[0]); double nearExpCost = Convert.ToDouble(nearObj[1]); object[] sohObj = {0,0}; //itm.GetAllSohQtyAmount(storeId); Int64 soh = Convert.ToInt64(sohObj[0]); double sohPrice = Convert.ToDouble(sohObj[1]); Int64 normal = (soh - nearExpAmount - expAmount); Int64 nearExpiry = nearExpAmount; Int64 expired = expAmount; object[] obj = { normal, nearExpiry, expired }; DataTable dtSOHList = new DataTable(); dtSOHList.Columns.Add("Type"); dtSOHList.Columns.Add("Value"); dtSOHList.Columns[1].DataType = typeof(Int64); double normalPrice = (sohPrice - nearExpCost - expAmount); Int64 totItm = normal + nearExpiry + expired; object[] oo = { "Normal : " + normalPrice.ToString("C"), obj[0] }; dtSOHList.Rows.Add(oo); object[] oo3 = { "Expired : " + expCost.ToString("C"), obj[2] }; dtSOHList.Rows.Add(oo3); object[] oo2 = { "Near Expiry : " + nearExpCost.ToString("C"), obj[1] }; dtSOHList.Rows.Add(oo2); decimal per = 0; if (Convert.ToDecimal(totItm) > 0) { per = Convert.ToDecimal(normal) / Convert.ToDecimal(totItm) * 100; } Series serExpired = new Series("pie", ViewType.Pie3D); serExpired.DataSource = dtSOHList; serExpired.ArgumentScaleType = ScaleType.Qualitative; serExpired.ArgumentDataMember = "Type"; serExpired.ValueScaleType = ScaleType.Numerical; serExpired.ValueDataMembers.AddRange(new string[] { "Value" }); serExpired.PointOptions.PointView = PointView.ArgumentAndValues; serExpired.LegendText = "Key"; serExpired.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent; serExpired.PointOptions.ValueNumericOptions.Precision = 0; ((PieSeriesLabel)serExpired.Label).Position = PieSeriesLabelPosition.TwoColumns; ((PiePointOptions)serExpired.PointOptions).PointView = PointView.ArgumentAndValues; chartPie.Series.Add(serExpired); chartPie.Size = new System.Drawing.Size(1000, 500); }