コード例 #1
0
        public DataTable GetECLSItemsStockOut(int storeId, int month, int year)
        {
            Items itm = new Items();
            Programs prog = new Programs();
            prog.GetProgramByName("Family Planning");
            DataTable dtItem = itm.GetItemsByProgram(prog.ID);
            GeneralInfo pipline = new GeneralInfo();
            pipline.LoadAll();
            int min = pipline.Min;
            int max = pipline.Max;
            double eop = pipline.EOP;

            DataTable dt = new DataTable();
            string[] cols = { "ID", "FullItemName", "DosageForm", "Strength", "Unit", "StockCode" };
            foreach (string st in cols)
            {
                dt.Columns.Add(st);
            }
            Balance bal = new Balance();
            foreach (DataRow dr in dtItem.Rows)
            {
                Int64 AMC = bal.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, month, year);
                Int64 MinCon = AMC * min;
                Int64 maxCon = AMC * max;
                double eopCon = AMC * (eop + 0.25);
                Int64 SOH = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, month, year);
                decimal MOS = (AMC != 0) ? (SOH / AMC) : 0;
                Int64 reorder = (maxCon > SOH) ? maxCon - SOH : 0;

                if (SOH == 0)
                {
                    object[] obb = { dr["ID"], dr["ItemName"], dr["DosageForm"], dr["Strength"], dr["Unit"], dr["StockCode"] };
                    dt.Rows.Add(obb);
                }
                //string status = (SOH <= eopCon && SOH > 0) ? "Near EOP" : ((SOH > maxCon) ? "Excess Stock" : ((SOH <= 0) ? "Stock Out" : "Normal"));
            }
            return dt;
        }
コード例 #2
0
 public int CountBelowMin(int storeId, int month, int year)
 {
     Items itm = new Items();
     DataTable dtItem = itm.GetAllItems(1);
     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();
     if (storeId == 0)
     {
         count += (from DataRow dr in dtItem.Rows
                   let AMC = bal.CalculateAMCAll(Convert.ToInt32(dr["ID"]), month, year)
                   let MinCon = AMC * min
                   let maxCon = AMC * max
                   let eopCon = AMC * (eop + 0.25)
                   let SOH = bal.GetSOHAll(Convert.ToInt32(dr["ID"]), month, year)
                   let MOS = (AMC != 0) ? (SOH / AMC) : 0
                   let reorder = (maxCon > SOH) ? maxCon - SOH : 0
                   where SOH > eopCon && (SOH <= MinCon)
                   select MinCon).Count();
     }
     else
     {
         count += (from DataRow dr in dtItem.Rows
                   let AMC = bal.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, month, year)
                   let MinCon = AMC * min
                   let maxCon = AMC * max
                   let eopCon = AMC * (eop + 0.25)
                   let SOH = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, month, year)
                   let MOS = (AMC != 0) ? (SOH / AMC) : 0
                   let reorder = (maxCon > SOH) ? maxCon - SOH : 0
                   where SOH > eopCon && (SOH <= MinCon)
                   select MinCon).Count();
     }
     return count;
 }
コード例 #3
0
 public int CountVitalItemsStockOut(int storeId, 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.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, month, year);
         Int64 minCon = AMC * min;
         Int64 maxCon = AMC * max;
         double eopCon = AMC * (eop + 0.25);
         Int64 SOH = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, 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;
 }
コード例 #4
0
        public DataTable OverStockedItems(int storeId, int year, int month, string selectedType, BackgroundWorker bw)
        {
            DataTable dtBal = new DataTable();
            GeneralInfo pipline = new GeneralInfo();
            Items itm = new Items();
            Balance bal = new Balance();
            IssueDoc iss = new IssueDoc();
            ReceiveDoc rec = new ReceiveDoc();
            string[] str = { "FullItemName", "SOH", "AMC", "MOS", "Min", "Max", "ExcessQty", "ExcessAmount", "CategoryId", "SubCategoryID", "ID" };
            foreach (string s in str)
            {
                dtBal.Columns.Add(s);
            }
            pipline.LoadAll();
            int min = pipline.Min;
            int max = pipline.Max;
            double eop = pipline.EOP;
            DataTable dtItem = new DataTable();

            dtItem = ((selectedType == "Drug") ? itm.GetAllItems(1) : itm.GetAllSupply());
            int i = 1;
            foreach (DataRow dr in dtItem.Rows)
            {

                string itemName = dr["FullItemName"].ToString();
                int yer = (month < 11) ? year : year - 1;
                Int64 AMC = bal.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, month, yer);
                Int64 MinCon = AMC * min;
                Int64 maxCon = AMC * max;
                Int64 SOH = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, month, yer);
                if (SOH > maxCon)
                {
                    decimal MOS = (AMC != 0) ? (Convert.ToDecimal(SOH) / Convert.ToDecimal(AMC)) : 0;
                    MOS = Decimal.Round(MOS, 1);

                    Int64 excessQty = SOH - maxCon;
                    double price = rec.GetLastReceivedCost(Convert.ToInt32(dr["ID"]), storeId);
                    double excessAmount = price * excessQty;
                    object[] obj = { itemName, SOH, AMC, MOS, MinCon, maxCon, excessQty, excessAmount, Convert.ToInt32(dr["CategoryId"]), Convert.ToInt32(dr["SubCategoryID"]), Convert.ToInt32(dr["ID"]) };
                    dtBal.Rows.Add(obj);
                }
                bw.ReportProgress(Convert.ToInt32((Convert.ToDouble(i++) / dtItem.Rows.Count) * 100));
            }
            return dtBal;
        }
コード例 #5
0
        //SupplyListToIssue
        public DataTable ItemListToIssue(int storeId, DateTime dtCurrent, string selectedType)
        {
            GeneralInfo pipline = new GeneralInfo();
            DataTable dtList = new DataTable();
            string[] str = { "No", "Stock Code", "FullItemName", "Unit", "SOH", "AMC", "Expired", "CategoryId", "SubCategoryID", "ID", "Status", "IsSelected" };
            foreach (string s in str)
            {
                dtList.Columns.Add(s);
            }
            dtList.Columns[11].DataType = typeof(bool);
            pipline.LoadAll();
            int min = pipline.Min;
            int max = pipline.Max;
            double eop = pipline.EOP;
            // int storeId = (cboStores.SelectedValue != null) ? Convert.ToInt32(cboStores.SelectedValue) : 1;

            int count = 1;
            Balance bal = new Balance();
            Items itmB = new Items();
            DataTable dtItem = ((selectedType == "Drug") ? itmB.GetAllItems(1) : itmB.GetAllSupply());
            int curYear = dtCurrent.Year;
            int curMonth = dtCurrent.Month;
            foreach (DataRow dr in dtItem.Rows)
            {
                int yer = (curMonth < 11) ? curYear : curYear - 1;
                Int64 AMC = bal.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, curMonth, curYear);
                Int64 MinCon = AMC * min;
                Int64 maxCon = AMC * max;
                double eopCon = AMC * (eop + 0.25);
                double beloweopCon = AMC * (eop - 0.25);
                Int64 soh = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, curMonth, curYear);
                string status = (soh <= eopCon && soh > beloweopCon) ? "Near EOP" : ((soh > 0 && soh <= beloweopCon) ? "Below EOP" : ((soh > maxCon && maxCon != 0) ? "Excess Stock" : ((soh <= 0) ? "Stock Out" : "Normal")));//((SOH > beloweopCon && SOH <= MinCon) ? "Below Min" : ((SOH > maxCon && maxCon != 0) ? "Excess Stock" : ((SOH <= 0) ? "Stock Out" : "Normal"));
                string itemName = dr["FullItemName"].ToString();
                Int64 expAmount = itmB.GetExpiredQtyItemsByID(Convert.ToInt32(dr["ID"]), storeId);
                object[] obj = { count.ToString(), dr["StockCode"].ToString(), itemName, dr["Unit"].ToString(), soh, AMC, expAmount, Convert.ToInt32(dr["CategoryId"]), Convert.ToInt32(dr["SubCategoryID"]), Convert.ToInt32(dr["ID"]), status, DBNull.Value };
                dtList.Rows.Add(obj);
                count++;
            }
            return dtList;
        }
コード例 #6
0
        public DataTable GetVitalItemsStockOut(int storeId, int month, int year)
        {
            Items itm = new Items();
            DataTable dtItem = itm.GetVitalItems();
            GeneralInfo pipline = new GeneralInfo();
            pipline.LoadAll();

            DataTable dt = new DataTable();
            string[] cols = { "ID", "ItemName", "DosageForm", "Strength", "Unit", "StockCode" };
            foreach (string st in cols)
            {
                dt.Columns.Add(st);
            }

            int min = pipline.Min;
            int max = pipline.Max;
            double eop = pipline.EOP;

            Balance bal = new Balance();
            foreach (DataRow dr in dtItem.Rows)
            {
                Int64 AMC = bal.CalculateAMC(Convert.ToInt32(dr["ID"]), storeId, month, year);
                Int64 MinCon = AMC * min;
                Int64 maxCon = AMC * max;
                double eopCon = AMC * (eop + 0.25);
                Int64 SOH = bal.GetSOH(Convert.ToInt32(dr["ID"]), storeId, month, year);
                decimal MOS = (AMC != 0) ? (SOH / AMC) : 0;
                Int64 reorder = (maxCon > SOH) ? maxCon - SOH : 0;
                if (SOH == 0)
                {
                    object[] obb = { dr["ID"], dr["ItemName"], dr["DosageForm"], dr["Strength"], dr["Unit"], dr["StockCode"] };
                    dt.Rows.Add(obb);
                }
            }
            return dt;
        }
        private void DetailAmc()
        {
            //dtDate.Value = DateTime.Now;
            //dtDate.CustomFormat = "MM/dd/yyyy";
            //DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text);

            ReceivingUnits du = new ReceivingUnits();
            DataTable dtDus = du.GetApplicableDUsAll(_itemId);
            int col = 0;
            Balance bal = new Balance();
            IssueDoc iss = new IssueDoc();
            Stores stor = new Stores();
            stor.GetActiveStores();
            DataTable dtStores = stor.DefaultView.ToTable();
            //lstTrendAmc.Items.Clear();
            foreach (DataRow drStr in dtStores.Rows)
            {
                int storeId = Convert.ToInt32(drStr["ID"]);
                //Int64 soh = bal.GetSOH(itemId, storeId, dtCurrent.Month, dtCurrent.Year);
                //Int64 amc = bal.CalculateAMC(itemId, storeId, dtCurrent.Month, dtCurrent.Year);
                //Int64 issue = iss.GetIssuedQuantityByMonth(itemId, storeId, dtCurrent.Month, dtCurrent.Year);
                //decimal mos = ((amc > 0) ? Convert.ToDecimal(soh) / Convert.ToDecimal(amc) : 0);
                //mos = Decimal.Round(mos, 1);

                int[] mon = { 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

                long[] cons = new long[12];
                for (int i = 0; i < mon.Length; i++)
                {
                    int yr = (mon[i] > 10) ? _dtCurrent.Year - 1 : _dtCurrent.Year;
                    if (!(yr == _dtCurrent.Year && mon[i] > _dtCurrent.Month && mon[i] < 11))
                    {

                        cons[i] = bal.CalculateAMC(_itemId, storeId, mon[i], yr);
                    }
                    else
                        cons[i] = 0;
                }

                string[] str = { drStr["StoreName"].ToString(), ((cons[0] != 0) ? cons[0].ToString("#,###") : "0"), ((cons[1] != 0) ? cons[1].ToString("#,###") : "0"), ((cons[2] != 0) ? cons[2].ToString("#,###") : "0"), ((cons[3] != 0) ? cons[3].ToString("#,###") : "0"), ((cons[4] != 0) ? cons[4].ToString("#,###") : "0"), ((cons[5] != 0) ? cons[5].ToString("#,###") : "0"), ((cons[6] != 0) ? cons[6].ToString("#,###") : "0"), ((cons[7] != 0) ? cons[7].ToString("#,###") : "0"), ((cons[8] != 0) ? cons[8].ToString("#,###") : "0"), ((cons[9] != 0) ? cons[9].ToString("#,###") : "0"), ((cons[10] != 0) ? cons[10].ToString("#,###") : "0"), ((cons[11] != 0) ? cons[11].ToString("#,###") : "0") };
                ListViewItem lstItm = new ListViewItem(str);

                if (col != 0)
                {
                    lstItm.BackColor = Color.FromArgb(233, 247, 248);

                    col = 0;
                }
                else
                {
                    col++;
                }
                //lstTrendAmc.Items.Add(lstItm);
            }
            //lstTrendAmc.Items.Add(new ListViewItem());
            foreach (DataRow drDus in dtDus.Rows)
            {
                int duid = Convert.ToInt32(drDus["ID"]);
                //Int64 soh = bal.GetDUSOH(itemId, duid, dtCurrent.Month, dtCurrent.Year);
                //Int64 amc = bal.CalculateDUAMC(itemId, duid, dtCurrent.Month, dtCurrent.Year, 0);
                //Int64 issue = iss.GetDUIssueByMonth(itemId, duid, dtCurrent.Month, dtCurrent.Year);
                //decimal mos = ((amc > 0) ? Convert.ToDecimal(soh) / Convert.ToDecimal(amc) : 0);
                //mos = Decimal.Round(mos, 1);
                int[] mon = { 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

                long[] cons = new long[12];
                for (int i = 0; i < mon.Length; i++)
                {
                    int yr = (mon[i] > 10) ? _dtCurrent.Year - 1 : _dtCurrent.Year;
                    if (!(yr == _dtCurrent.Year && mon[i] > _dtCurrent.Month && mon[i] < 11))
                    {
                        cons[i] = bal.CalculateDUAMC(_itemId, duid, mon[i], yr, 0);
                    }
                    else
                        cons[i] = 0;
                }

                string[] str = { drDus["Name"].ToString(), ((cons[0] != 0) ? cons[0].ToString("#,###") : "0"), ((cons[1] != 0) ? cons[1].ToString("#,###") : "0"), ((cons[2] != 0) ? cons[2].ToString("#,###") : "0"), ((cons[3] != 0) ? cons[3].ToString("#,###") : "0"), ((cons[4] != 0) ? cons[4].ToString("#,###") : "0"), ((cons[5] != 0) ? cons[5].ToString("#,###") : "0"), ((cons[6] != 0) ? cons[6].ToString("#,###") : "0"), ((cons[7] != 0) ? cons[7].ToString("#,###") : "0"), ((cons[8] != 0) ? cons[8].ToString("#,###") : "0"), ((cons[9] != 0) ? cons[9].ToString("#,###") : "0"), ((cons[10] != 0) ? cons[10].ToString("#,###") : "0"), ((cons[11] != 0) ? cons[11].ToString("#,###") : "0") };
                ListViewItem lstItm = new ListViewItem(str);

                if (col != 0)
                {
                    lstItm.BackColor = Color.FromArgb(233, 247, 248);
                    col = 0;
                }
                else
                {
                    col++;
                }
                //  lstTrendAmc.Items.Add(lstItm);
            }
        }
        /// <summary>
        /// Generates Past 12 Months charts
        /// </summary>
        private void GenerateChartsPastMonths()
        {
            Balance bal = new Balance();
            GeneralInfo info = new GeneralInfo();
            info.LoadAll();
            DataTable dtList = new DataTable();
            DataTable dtAmc = new DataTable();
            DataTable dtMOS = new DataTable();
            DataTable dtIss = new DataTable();
            DataTable dtRec = new DataTable();
            DataTable dtBB = new DataTable();

            //foreach(string s in co)
            //{
            dtList.Columns.Add("Month");
            dtList.Columns.Add("Value");
            dtList.Columns[1].DataType = typeof(Int64);

            dtMOS.Columns.Add("Month");
            dtMOS.Columns.Add("Value");
            dtMOS.Columns[1].DataType = typeof(Int32);

            dtAmc.Columns.Add("Month");
            dtAmc.Columns.Add("Value");
            dtAmc.Columns[1].DataType = typeof(Int64);

            dtIss.Columns.Add("Month");
            dtIss.Columns.Add("Value");
            dtIss.Columns[1].DataType = typeof(Int64);

            dtRec.Columns.Add("Month");
            dtRec.Columns.Add("Value");
            dtRec.Columns[1].DataType = typeof(Int64);

            dtBB.Columns.Add("Month");
            dtBB.Columns.Add("Value");
            dtBB.Columns[1].DataType = typeof(Int64);

            //dtDate.Value = DateTime.Now;
            //dtDate.CustomFormat = "MM/dd/yyyy";
            //DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text);
            DateTime dtPast = _dtCurrent.AddMonths(-11);
            //CALENDAR:
            string[] wer = { "Mes", "Tek", "Hed", "Tah", "Tir", "Yek", "Meg", "Miz", "Gen", "Sen", "Ham", "Neh" };
            string[] co = new string[12];
            int[] mon = new int[12];
            int[] yr = new int[12];
            int intialM = dtPast.Month;
            int j = 0;
            while (dtPast <= _dtCurrent && j < 12)
            {
                //mon[j] = intialM;
                //co[j] = wer[intialM-1];
                //yr[j] = (intialM < 11)?dtPast.Year: dtPast.Year +1;
                //dtPast = dtPast.AddMonths(1);
                //intialM = dtPast.Month;
                mon[j] = dtPast.Month;
                co[j] = wer[intialM - 1];
                yr[j] = dtPast.Year;
                dtPast = dtPast.AddMonths(1);
                intialM = dtPast.Month;
                j++;
            }
            //{ 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            long[] cons = new long[12];
            long[] amc = new long[12];
            DataTable dtBal = new DataTable();
            IssueDoc issd = new IssueDoc();
            Items recd = new Items();

            YearEnd yEnd = new YearEnd();
            Int64 bb = yEnd.GetBBalance(_year, _storeId, _itemId, 10);
            object[] objBB = { "Ham", bb };
            dtBB.Rows.Add(objBB);

            for (int i = 0; i < mon.Length; i++)
            {
                Int64 con = bal.GetSOH(_itemId, _storeId, mon[i], yr[i]);
                object[] str = { co[i], con };
                amc[i] = bal.CalculateAMC(_itemId, _storeId, mon[i], yr[i]);
                object[] objAmc = { co[i], amc[i] };
                decimal mos = (amc[i] > 0) ? (Convert.ToDecimal(con) / Convert.ToDecimal(amc[i])) : 0;
                mos = Decimal.Round(mos, 1);

                object[] objMos = { co[i], mos };
                Int64 issval = issd.GetIssuedQuantityByMonth(_itemId, _storeId, mon[i], yr[i]);
                object[] objIss = { co[i], issval };

                Int64 recVal = recd.GetQuantityReceiveByItemPerMonth(mon[i], _itemId, _storeId, yr[i]);
                object[] objrec = { co[i], recVal };

                dtList.Rows.Add(str);
                dtAmc.Rows.Add(objAmc);
                dtMOS.Rows.Add(objMos);
                dtIss.Rows.Add(objIss);
                dtRec.Rows.Add(objrec);
                //}
            }
            // string[] str = { ((cons[0] != 0) ? cons[0].ToString("") : "0"), ((cons[1] != 0) ? cons[1].ToString() : "0"), ((cons[2] != 0) ? cons[2].ToString() : "0"), ((cons[3] != 0) ? cons[3].ToString() : "0"), ((cons[4] != 0) ? cons[4].ToString() : "0"), ((cons[5] != 0) ? cons[5].ToString() : "0"), ((cons[6] != 0) ? cons[6].ToString() : "0"), ((cons[7] != 0) ? cons[7].ToString() : "0"), ((cons[8] != 0) ? cons[8].ToString() : "0"), ((cons[9] != 0) ? cons[9].ToString() : "0"), ((cons[10] != 0) ? cons[10].ToString() : "0"), ((cons[11] != 0) ? cons[11].ToString() : "0")};
            chartAmc.Series.Clear();
            chartComp.Series.Clear();
            chartBar.Series.Clear();
            chartMOS.Series.Clear();
            consuTrend.Series.Clear();

            Series ser = new Series("Stock On Hand", ViewType.Line);
            ser.DataSource = dtList;
            ser.ArgumentScaleType = ScaleType.Qualitative;
            ser.ArgumentDataMember = "Month";
            ser.ValueScaleType = ScaleType.Numerical;
            ser.ValueDataMembers.AddRange(new string[] { "Value" });
            chartBar.Series.Add(ser);

            Series serB = new Series("Begining Balance", ViewType.Bar);
            serB.DataSource = dtBB;
            serB.ArgumentScaleType = ScaleType.Qualitative;
            serB.ArgumentDataMember = "Month";
            serB.ValueScaleType = ScaleType.Numerical;
            serB.PointOptions.ValueNumericOptions.Format = NumericFormat.Number;
            serB.PointOptions.ValueNumericOptions.Precision = 0;
            serB.ValueDataMembers.AddRange(new string[] { "Value" });
            chartComp.Series.Add(serB);

            Series serRec = new Series("Received Qty", ViewType.Bar);
            serRec.DataSource = dtRec;
            serRec.ArgumentScaleType = ScaleType.Qualitative;
            serRec.ArgumentDataMember = "Month";
            serRec.ValueScaleType = ScaleType.Numerical;
            serRec.ValueDataMembers.AddRange(new string[] { "Value" });
            chartComp.Series.Add(serRec);

            Series serAmc = new Series("Average Monthly Consumption", ViewType.Line);
            serAmc.DataSource = dtAmc;
            serAmc.ArgumentScaleType = ScaleType.Qualitative;
            serAmc.ArgumentDataMember = "Month";
            serAmc.ValueScaleType = ScaleType.Numerical;
            serAmc.ValueDataMembers.AddRange(new string[] { "Value" });
            chartAmc.Series.Add(serAmc);

            Series serIss = new Series("Issue Qty", ViewType.Bar);
            serIss.DataSource = dtIss;
            serIss.ArgumentScaleType = ScaleType.Qualitative;
            serIss.ArgumentDataMember = "Month";
            serIss.ValueScaleType = ScaleType.Numerical;
            serIss.ValueDataMembers.AddRange(new string[] { "Value" });
            chartComp.Series.Add(serIss);

            Series serSOH = new Series("SOH", ViewType.Bar);
            serSOH.DataSource = dtList;
            serSOH.ArgumentScaleType = ScaleType.Qualitative;
            serSOH.ArgumentDataMember = "Month";
            serSOH.ValueScaleType = ScaleType.Numerical;
            serSOH.ValueDataMembers.AddRange(new string[] { "Value" });
            chartComp.Series.Add(serSOH);

            Series sercons = new Series("Consumption Trend", ViewType.Line);
            sercons.DataSource = dtIss;
            sercons.ArgumentScaleType = ScaleType.Qualitative;
            sercons.ArgumentDataMember = "Month";
            sercons.ValueScaleType = ScaleType.Numerical;
            sercons.ValueDataMembers.AddRange(new string[] { "Value" });
            consuTrend.Series.Add(sercons);

            Series serMos = new Series("Month Of Stock", ViewType.Line);
            serMos.DataSource = dtMOS;
            serMos.ArgumentScaleType = ScaleType.Qualitative;
            serMos.ArgumentDataMember = "Month";
            serMos.ValueScaleType = ScaleType.Numerical;
            serMos.ValueDataMembers.AddRange(new string[] { "Value" });

            chartMOS.Series.Add(serMos);
            ((XYDiagram)chartMOS.Diagram).AxisY.Range.MaxValue = 12;

            Int64 amcCurent = bal.CalculateAMC(_itemId, _storeId, _dtCurrent.Month, _year);
            //Int64 soh = bal.GetSOH(itemId,storeId,dtCurrent.Month,year);
            //if (bal.RowCount > 0)
            //{
            Int64 min = info.Min * amcCurent;
            Int64 max = info.Max * amcCurent;
            ConstantLine target = new ConstantLine();
            target.AxisValue = min;
            //which min and max to show month
            ((XYDiagram)chartBar.Diagram).AxisY.ConstantLines.Clear();
            target.Visible = true;
            target.Title.Text = "Current Min value is " + target.AxisValue.ToString() + " " + lblBUnit.Text;
            target.Color = Color.Red;
            target.LineStyle.Thickness = 2;
            // ((XYDiagram)chartBar.Diagram).AxisY.ConstantLines.Add(target);

            ConstantLine targetMax = new ConstantLine();
            targetMax.AxisValue = max;
            //which min and max to show month
            targetMax.Visible = true;
            targetMax.Title.Text = "Current Max value is " + targetMax.AxisValue.ToString() + " " + lblBUnit.Text;
            targetMax.Color = Color.Blue;
            targetMax.LineStyle.Thickness = 2;
            //((XYDiagram)chartBar.Diagram).AxisY.ConstantLines.Add(targetMax);
            //}
        }