public int CountVitalItemsStockOutForAllStore(int month, int year) { Items itm = new Items(); DataTable dtItem = itm.GetVitalItems(); GeneralInfo pipline = new GeneralInfo(); pipline.LoadAll(); int min = pipline.Min; int max = pipline.Max; double eop = pipline.EOP; int count = 0; Balance bal = new Balance(); foreach (DataRow dr in dtItem.Rows) { Int64 AMC = bal.CalculateAMCAll(Convert.ToInt32(dr["ID"]), month, year); Int64 minCon = AMC * min; Int64 maxCon = AMC * max; double eopCon = AMC * (eop + 0.25); Int64 SOH = bal.GetSOHForAllStore(Convert.ToInt32(dr["ID"]), month, year); decimal MOS = (AMC != 0) ? (SOH / AMC) : 0; Int64 reorder = (maxCon > SOH) ? maxCon - SOH : 0; if (SOH == 0) count++; //string status = (SOH <= eopCon && SOH > 0) ? "Near EOP" : ((SOH > maxCon) ? "Excess Stock" : ((SOH <= 0) ? "Stock Out" : "Normal")); } return count; }