Click here to Skip to main content
15,896,278 members
Articles / Multimedia / GDI+

Internal Supply Chain, Visibility via 200 plus 3D Chart Reports - Part II

Rate me:
Please Sign up or sign in to vote.
5.00/5 (15 votes)
8 Oct 2009CPOL4 min read 53.8K   5.3K   46  
This article focuses on internal supply chain management systems visibility via chart reports, and provides assessment apparatus to manage and monitor activities spawned during business processes, hence paves the way for timely and precise business decisions.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace ISCMS.Main.ChartDialog
{
    class PlantSegregation
    {
        Main.Chart.PlantSegment _plantSegment;
        Main.Chart.Charts _charts;
        Main.Chart.ChartBy _chartBy;
        bool _is_Segregation;
        Main.Chart _chart;
        ISCMS.DataAccess.Procurement pr;
        ISCMS.DataAccess.Manufacturing man;
        ISCMS.DataAccess.Warehouse war;
      
        public PlantSegregation(Main.Chart.PlantSegment plantSegment,
        Main.Chart.Charts charts,
        Main.Chart.ChartBy chartBy,bool is_Segregation,
            Main.Chart chart)
        {
            _plantSegment = plantSegment;
            _charts = charts;
            _chartBy = chartBy;
            _is_Segregation = is_Segregation;
            _chart = chart;

        }

        public DataRow[] Process()
        {
            pr = new ISCMS.DataAccess.Procurement();
            switch (_plantSegment)
            {
                
                case Chart.PlantSegment.Procurement:
                    pr = new ISCMS.DataAccess.Procurement();
                    _chart._is_Raw_Material = true;
                    return Procurement();
                    
                case Chart.PlantSegment.Work_In_Progress:
                    man = new ISCMS.DataAccess.Manufacturing();
                    return WIP();
                
                case Chart.PlantSegment.Warehouse:
                    war = new ISCMS.DataAccess.Warehouse();
                    return Warehouse();

            }
            return new DataRow[0];
        }

        public int ProcessItem(int index)
        {
            switch (_plantSegment)
            {
                case Chart.PlantSegment.Procurement:
                    return ProcurementItem(index);

                case Chart.PlantSegment.Work_In_Progress:
                    return WIPItem(index);

                case Chart.PlantSegment.Warehouse:
                    return WarehouseItem(index);

            }
            return  0;
        }

        #region Procurement
        DataRow[] Procurement()
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Segregated_Cost == _chartBy ||
                        Chart.ChartBy.Cumulative_Cost == _chartBy)
                        return RM_BarCost();
                    else
                        return RM_BarQuantity();
                    

                case Chart.Charts.Kagi:
                    return RM_Kagi();
                    

                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_LineCost();
                    else
                        return RM_LineQuantity();
                    

                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                         Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_PieCost();
                    else
                        return RM_PieQuantity();

                case Chart.Charts.Pareto:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                         Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_ParetoCost();
                    else
                        return RM_ParetoQuantity();
            }

            return new DataRow[0];
        }

        int ProcurementItem(int index)
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_BarCostItem(index);
                    else
                        return RM_BarQuantityItem(index);


                case Chart.Charts.Kagi:
                    return RM_KagiItem(index);


                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                         Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_LineCostItem(index);
                    else
                        return RM_LineQuantityItem(index);


                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_PieCostItem(index);
                    else
                        return RM_PieQuantityItem(index);

                case Chart.Charts.Pareto:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return RM_ParetoCostItem(index);
                    else
                        return RM_ParetoQuantityItem(index);
            }

            return 0;
        }

        #region Procurement Item
        // Bar
        int RM_BarCostItem(int index)
        {
            
            if (_is_Segregation)
            {
               
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
                    case "RM_WIP_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Consumed_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_In_Transit_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);


                    case "RM_Current_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Current_Minus_Reserved_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Reserved_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
                }
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
       
                    case "RM_WIP_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
       
                    case "RM_Consumed_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
       
                    case "RM_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Current_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "RM_Reserved_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
                }
            }
            return 0;
        }
        int RM_BarQuantityItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "RM_WIP_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_Consumed_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_In_Transit_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "RM_Current_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_Current_Minus_Reserved_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_Reserved_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);
                }

            }
            else
            {
              
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);
                        

                    case "RM_WIP_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);
                        

                    case "RM_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);
                        

                    case "RM_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "RM_Current_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "RM_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);
                        
                }
            }
            return 0;
        }

        // Line
        int RM_LineCostItem(int index)
        {
           
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {

                    case "RM_Waste_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                       

                    case "RM_Consumed_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return  Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_In_Transit_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
         
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Waste_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);
                        //- Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_In_Transit_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"])
                        ;


                    case "RM_Reserved_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);
                                                                    
                }
            }

            return  0;
        }
        int RM_LineQuantityItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {

                    case "RM_Waste_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Consumed_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);
                        //- Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_In_Transit_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }

            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Cumulative_Quantity_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);


                    case "RM_Waste_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);
                        //- Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_In_Transit_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"])
                        ;


                    case "RM_Reserved_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }

            return 0;

        }

        // Pie
        int RM_PieCostItem(int index)
        {
            if (_is_Segregation)
            {

               
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "RM_In_Transit_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 40;
        }
        int RM_PieQuantityItem(int index)
        {
            if (_is_Segregation)
            {

               
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "RM_In_Transit_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 100;

        }

        // Pareto
        int RM_ParetoCostItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "RM_In_Transit_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 40;
        }
        int RM_ParetoQuantityItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "RM_WIP_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "RM_Consumed_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "RM_In_Transit_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "RM_Current_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "RM_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 100;

        }


        // Kagi
        int RM_KagiItem(int index)
        {
            switch (_chart._chartName)
            {
                    case "RM_Waste_Rates":
                        return 0;


                    case "RM_WIP_Rates":
                        return 0;

                    case "RM_Current_Rates":
                        return 0;
            } 
 

            return 0;

        }
        #endregion


        #region Non Procurement Item
        // Bar
        DataRow[] RM_BarCost()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";
            if (_is_Segregation)
            {
               
                switch ( _chart._chartName )
                {
                    case "RM_Waste_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material waste by cost " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material "
                            );


                    case "RM_WIP_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material in Manufacturing Phase by cost " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 3 and Is_Raw_Material "
                            );

                    case "RM_Consumed_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " a consumed Raw Material to produce goods by cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 5 and Is_Raw_Material "
                            );

                    case "RM_In_Transit_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit by cost b/w " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material "
                            );


                    case "RM_Current_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material current stock by cost " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Current_Minus_Reserved_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserve by cost " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Reserved_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material Reserve by cost " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material "
                            );
                        
                }

            
            }
            else
            {
                
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Waste by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material "
                             );  
                    case "RM_WIP_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material in Manufacturing phase by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 2 and Transaction_Status_ID = 3 and Is_Raw_Material "
                             ); 
                    case "RM_Consumed_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Consumed to produce goods by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 2 and Transaction_Status_ID = 5 and Is_Raw_Material "
                             ); 
                    case "RM_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material In-Transit by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material "
                             );


                    case "RM_Current_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Current by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Current - Reserve  by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Reserved_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Reserve by cost " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material "
                            );
                }
            }

            System.Windows.Forms.MessageBox.Show("not done " + _chart._chartName);
       
            return new DataRow[0];
        }
        DataRow[] RM_BarQuantity()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "N0";
            if (_is_Segregation)
            {
            
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material waste by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                               _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                               " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material "
                               );  

                    case "RM_WIP_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material in Manufacturing Phase by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                                   _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                                   " Transaction_Type_ID = 2 and Transaction_Status_ID = 3 and Is_Raw_Material "
                                   ); 

                    case "RM_Consumed_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material Consumed during Manufacturing Phase by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                          _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                          " Transaction_Type_ID = 2 and Transaction_Status_ID = 5 and Is_Raw_Material "
                          ); 

                    case "RM_In_Transit_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                                _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                                " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material "
                                );


                    case "RM_Current_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material current stock by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Current_Minus_Reserved_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserve by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Reserved_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material Reserve by Quantity " + _chart._period;
                        return pr.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material "
                            );


                }

            }
            else
            {
                
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Waste by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                                _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material "
                                );   

                    case "RM_WIP_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material in Manufacturing Phase by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                                    _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                    " Transaction_Type_ID = 2 and Transaction_Status_ID = 3 and Is_Raw_Material "
                                    ); 

                    case "RM_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Consumed to produce goods by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 5 and Is_Raw_Material "
                            );  

                    case "RM_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material In Transit by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                                _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material "
                                );

                    case "RM_Current_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Current by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Current - Reserve  by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material "
                            );

                    case "RM_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Reserve by Quantity " + _chart._period;
                        return pr.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material "
                            );
                }
            }
            System.Windows.Forms.MessageBox.Show("not done " + _chart._chartName);
            return new DataRow[0];
        }

        // Line
        DataRow[] RM_LineCost()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";
            if (_is_Segregation)
            {
                
                switch ( _chart._chartName )
                {
                    case "RM_Waste_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Raw Material Waste cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "RM_WIP_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Raw Material In Process cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                       
                    case "RM_Consumed_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Raw Material Consumed cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "RM_In_Transit_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "RM_Current_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material Current cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "RM_Current_Minus_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserved cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );


                    case "RM_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Raw Material Reserve cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                }
            }
            else
            {
                
                switch (_chart._chartName)
                {
                    case "RM_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Raw Material inventory cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();




                    case "RM_Waste_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Raw Material Waste cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Raw Material In Process cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Raw Material Consumed cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material Current cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserved cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "RM_Reserved_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Raw Material Reserve cost " + _chart._period;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }
            }
            return new DataRow[0];
        }
        DataRow[] RM_LineQuantity()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "N0";
            if (_is_Segregation)
            {
               
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Raw Material Waste Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_WIP_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Raw Material In Process Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_Consumed_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Raw Material Consumed Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_In_Transit_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_Current_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material Current Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserved Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();


                    case "RM_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Raw Material Reserve Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                }
            }
            else
            {

                switch (_chart._chartName)
                {
                    case "RM_Cumulative_Quantity_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Raw Material inventory Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();




                    case "RM_Waste_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Raw Material Waste Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Raw Material In Process Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Raw Material Consumed Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material Current Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Raw Material current - Reserved Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "RM_Reserved_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Raw Material Reserve Quantity " + _chart._period;
                        return pr.RawMaterialStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }

            }
            return new DataRow[0];

        }

        // Pie
        DataRow[] RM_PieCost()
        {
            if (_is_Segregation)
            {
               

            }
            else
            {
                
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material waste by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material in Manufacturing Phae by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material Consumed to produce goods by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material In-Transit by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "RM_Current_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material Current by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material current - Reserved by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Reserved_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material Reserve by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date,_chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] RM_PieQuantity()
        {
            if (_is_Segregation)
            {
                
            }
            else
            {
              
                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material waste by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material in Manufacturing Phae by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material Consumed to produce goods by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material In-Transit by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material Current by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material current - Reserved by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material Reserve by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];
        
        }


        // Pareto
        DataRow[] RM_ParetoCost()
        {
            if (_is_Segregation)
            {


            }
            else
            {

                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material waste by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material in Manufacturing Phae by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material Consumed to produce goods by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material In-Transit by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "RM_Current_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material Current by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material current - Reserved by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._title = " Raw Material Reserve by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] RM_ParetoQuantity()
        {
            if (_is_Segregation)
            {

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "RM_Waste_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material waste by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_WIP_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material in Manufacturing Phae by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Consumed_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material Consumed to produce goods by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_In_Transit_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material In-Transit by Quantity " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material Current by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Current_Minus_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material current - Reserved by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "RM_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Raw Material Reserve by cost " + _chart._period;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];

        }

        // Kagi
        DataRow[] RM_Kagi()
        {
                _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";
                switch (_chart._chartName)
                {
                    case "RM_Waste_Rates":
                        _chart._title = _chart._goods_Name + " Raw Material Waste cost ";
                        return pr.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 6 and Transaction_Type_ID = 2 " );


                    case "RM_WIP_Rates":
                        _chart._title = _chart._goods_Name + " Raw Material WIP cost ";
                        return pr.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 3 and Transaction_Type_ID = 2 ");

                    case "RM_Current_Rates":
                        _chart._title = _chart._goods_Name + " Raw Material Received cost ";
                        return pr.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 1 and Transaction_Type_ID = 1 ");
                }
            return new DataRow[0];
        }
        #endregion

        #endregion

        #region WIP

        DataRow[] WIP()
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_BarCost();
                    else
                        return WIP_BarQuantity();


                case Chart.Charts.Kagi:
                    return WIP_Kagi();


                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_LineCost();
                    else
                        return WIP_LineQuantity();


                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_PieCost();
                    else
                        return WIP_PieQuantity();
            }

            return new DataRow[0];
        }

        int WIPItem(int index)
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_BarCostItem(index);
                    else
                        return WIP_BarQuantityItem(index);


                case Chart.Charts.Kagi:
                    return WIP_KagiItem(index);


                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_LineCostItem(index);
                    else
                        return WIP_LineQuantityItem(index);


                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return WIP_PieCostItem(index);
                    else
                        return WIP_PieQuantityItem(index);
            }

            return 0;
        }

        #region WIP Item
        // Bar
        int WIP_BarCostItem(int index)
        {
            if (_is_Segregation)
            {

                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);
                    case "WIP_WIP_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "WIP_Consumed_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "WIP_In_Transit_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                }
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "WIP_WIP_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "WIP_Consumed_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "WIP_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                }
            }
            return 0;
        }
        int WIP_BarQuantityItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);


                    case "WIP_WIP_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "WIP_Consumed_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "WIP_In_Transit_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                }

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);
                        

                    case "WIP_WIP_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);
                        

                    case "WIP_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);
                        

                    case "WIP_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                        
                }
            }
            return 0;
        }

        // Line
        int WIP_LineCostItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {
                    case "WIP_Segregated_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);
                }

            }
            else
            {
                switch (_chart._chartName)
                {
                    case "WIP_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);
                }
            }



            return 0;
        }
        int WIP_LineQuantityItem(int index)
        {
            if (_is_Segregation)
            {

            }
            else
            {

            }
            return 0;

        }

        // Pie
        int WIP_PieCostItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "WIP_WIP_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "WIP_Consumed_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "WIP_In_Transit_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                }
            }
            return 0;
        }
        int WIP_PieQuantityItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "WIP_WIP_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "WIP_Consumed_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "WIP_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);
                }
            }
            return 0;

        }

        // Kagi
        int WIP_KagiItem(int index)
        {
            if (_is_Segregation)
            {

            }
            else
            {

            }
            return 0;

        }
        #endregion


        #region Non Procurement Item
        // Bar
        DataRow[] WIP_BarCost()
        {
            if (_is_Segregation)
            {
          
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material waste by cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();


                    case "WIP_WIP_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material in Manufacturing Phase by cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "WIP_Consumed_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " a consumed Raw Material to produce goods by cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "WIP_In_Transit_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit by cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();


                }


            }
            else
            {
          
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Waste by cost b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_WIP_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material in Manufacturing phase by cost b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_Consumed_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material Consumed to produce goods by cost b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._title = "Raw Material In-Transit by cost b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }
            }
            return new DataRow[0];
        }
        DataRow[] WIP_BarQuantity()
        {
            if (_is_Segregation)
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material waste by Quantity b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();


                    case "WIP_WIP_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material in Manufacturing Phase by Quantity b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "WIP_Consumed_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material Consumed during Manufacturing Phase by Quantity b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "WIP_In_Transit_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Raw Material In-Transit by Quantity b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();
                }

            }
            else
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Waste by Quantity b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "WIP_WIP_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material in Manufacturing Phase by Quantity b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "WIP_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material Consumed to produce goods by Quantity b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "WIP_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._title = "Raw Material In Transit by Quantity b/w " + _chart._start_Date + " to " +
                                        _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }
            }
            return new DataRow[0];
        }

        // Line
        DataRow[] WIP_LineCost()
        {
            if (_is_Segregation)
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Segregated_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material inventory cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();
                }
            }
            else
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Raw Material inventory cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] WIP_LineQuantity()
        {
            if (_is_Segregation)
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Segregated_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Raw Material inventory cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();
                }
            }
            else
            {
               
                switch (_chart._chartName)
                {
                    case "WIP_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Raw Material inventory cost b/w " + _chart._start_Date + " to " +
                            _chart._end_Date;
                        return pr.RawMaterialStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];

        }

        // Pie
        DataRow[] WIP_PieCost()
        {
            if (_is_Segregation)
            {


            }
            else
            {
              
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material waste by cost at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_WIP_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material in Manufacturing Phae by cost at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_Consumed_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material Consumed to produce goods by cost at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_In_Transit_By_Cost_Aggregation_Pie":
                        _chart._title = " Raw Material In-Transit by cost at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] WIP_PieQuantity()
        {
            if (_is_Segregation)
            {
                
            }
            else
            {
                
                switch (_chart._chartName)
                {
                    case "WIP_Waste_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material waste by Quantity at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_WIP_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material in Manufacturing Phae by Quantity at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_Consumed_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material Consumed to produce goods by Quantity at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "WIP_In_Transit_By_Quantity_Aggregation_Pie":
                        _chart._title = " Raw Material In-Transit by Quantity at " + _chart._start_Date;
                        return pr.RMAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];

        }

        // Kagi
        DataRow[] WIP_Kagi()
        {
           
            switch (_chart._chartName)
            {
                case "WIP_Rates":
                    _chart._title = _chart._goods_Name + " Raw Material inventory cost b/w " + _chart._start_Date + " to " +
                        _chart._end_Date;
                    return pr.GetKagiList(_chart._goods_ID).Tables[0].Select();
            }
            return new DataRow[0];
        }
        #endregion
        #endregion



        #region Warehouse

        DataRow[] Warehouse()
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Segregated_Cost == _chartBy ||
                        Chart.ChartBy.Cumulative_Cost == _chartBy)
                        return FG_BarCost();
                    else
                        return FG_BarQuantity();


                case Chart.Charts.Kagi:
                    return FG_Kagi();


                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_LineCost();
                    else
                        return FG_LineQuantity();


                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                         Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_PieCost();
                    else
                        return FG_PieQuantity();

                case Chart.Charts.Pareto:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                         Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_ParetoCost();
                    else
                        return FG_ParetoQuantity();
            }

            return new DataRow[0];


           
        }

        int WarehouseItem(int index)
        {
            switch (_charts)
            {
                case Chart.Charts.Bar:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_BarCostItem(index);
                    else
                        return FG_BarQuantityItem(index);


                case Chart.Charts.Kagi:
                    return FG_KagiItem(index);


                case Chart.Charts.Line:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_LineCostItem(index);
                    else
                        return FG_LineQuantityItem(index);


                case Chart.Charts.Pie:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_PieCostItem(index);
                    else
                        return FG_PieQuantityItem(index);

                case Chart.Charts.Pareto:
                    if (Chart.ChartBy.Cumulative_Cost == _chartBy ||
                        Chart.ChartBy.Segregated_Cost == _chartBy)
                        return FG_ParetoCostItem(index);
                    else
                        return FG_ParetoQuantityItem(index);
            }

            return 0;
        }

        #region FG Item
        // Bar
        int FG_BarCostItem(int index)
        {
                if (_is_Segregation)
            {
               
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);
                    case "FG_WIP_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Consumed_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_In_Transit_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);


                    case "FG_Current_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Current_Minus_Reserved_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Reserved_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Sales_Return_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Sales_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);


                    case "FG_Gross_Profit_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Net_Profit_By_Cost_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    

                }
            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_WIP_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Consumed_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Current_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Reserved_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Sales_Return_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Sales_By_Cost_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Cost"]);

                    case "FG_Gross_Profit_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return ( Convert.ToInt32(_chart.rows[index]["Cost"]) - Convert.ToInt32(_chart.rows[index]["Current_Cost"]) );

                    case "FG_Net_Profit_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return ( Convert.ToInt32(_chart.rows[index]["Cost"]) - Convert.ToInt32(_chart.rows[index]["Current_Cost"]) );
                }
            }
            return 0;
        }
        int FG_BarQuantityItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "FG_WIP_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Consumed_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_In_Transit_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    
                    case "FG_Current_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Current_Minus_Reserved_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Reserved_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Sales_Return_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Sales_By_Quantity_Segregation":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    
                }

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "FG_WIP_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "FG_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "FG_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);


                    case "FG_Current_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Sales_Return_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                    case "FG_Sales_By_Quantity_Aggregation_Bar":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Unit"]);

                }
            }

            System.Windows.Forms.MessageBox.Show(_chart._chartName);
            return 0;
        }

        // Line
        int FG_LineCostItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {

                    case "FG_Waste_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);


                    case "FG_Consumed_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_In_Transit_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Sold"]);

                    case "FG_Sales_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Sold"]);

                    case "FG_Gross_Profit_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                    case "FG_Net_Profit_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                }

            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);


                    case "FG_Waste_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Consumed_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_In_Transit_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"])
                        ;


                    case "FG_Reserved_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Sold"]);

                    case "FG_Sales_By_Cost_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Sold"]);

                    case "FG_Gross_Profit_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                    case "FG_Net_Profit_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                }
            }

            return 0;
        }
        int FG_LineQuantityItem(int index)
        {
            if (_is_Segregation)
            {
                switch (_chart._chartName)
                {

                    case "FG_Waste_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);


                    case "FG_Consumed_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_In_Transit_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);


                    case "FG_Sales_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);


                    

                }

            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Cumulative_Quantity_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);


                    case "FG_Waste_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Consumed_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_In_Transit_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                       - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"])
                        ;


                    case "FG_Reserved_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_By_Quantity_Aggregation_Line":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);



                }
            }

            return 0;


        }

        // Pie
        int FG_PieCostItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"]);

                    case "FG_Consumed_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "FG_In_Transit_By_Cost_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Sold"]);

                    case "FG_Sales_By_Cost_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Sold"]);

                    case "FG_Gross_Profit_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                    case "FG_Net_Profit_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);



                }
            }
            return 40;
        }
        int FG_PieQuantityItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Consumed_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "FG_In_Transit_By_Quantity_Aggregation_Pie":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_By_Quantity_Aggregation_Pie":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 100;

        }

        // Pareto
        int FG_ParetoCostItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"]);

                    case "FG_Consumed_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "FG_In_Transit_By_Cost_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Incomming_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Sold"]);

                    case "FG_Sales_By_Cost_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Sold"]);

                    case "FG_Gross_Profit_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);

                    case "FG_Net_Profit_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Gross_Profit"]);



                }
            }
            return 40;
        }
        int FG_ParetoQuantityItem(int index)
        {
            if (_is_Segregation)
            {


            }
            else
            {
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"]);

                    case "FG_WIP_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);

                    case "FG_Consumed_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Finished"]);

                    case "FG_In_Transit_By_Quantity_Aggregation_Pareto":
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Expected"]);

                    case "FG_Current_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"]);


                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        return Convert.ToInt32(_chart.rows[index]["Incomming_Current"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Waste"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_InProcess"])
                        - Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_Return_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                    case "FG_Sales_By_Quantity_Aggregation_Pareto":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        return Convert.ToInt32(_chart.rows[index]["Outgoing_Expected"]);

                }
            }
            return 100;

        }

        // Kagi
        int FG_KagiItem(int index)
        {
            if (_is_Segregation)
            {

            }
            else
            {

            }
            return 0;

        }
        #endregion


        #region Non Procurement Item
        // Bar
        DataRow[] FG_BarCost()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";

            //System.Windows.Forms.MessageBox.Show(" fg barcist");
            //_chart._title = _chart._goods_Name + " Raw Material waste by cost b/w " + _chart._start_Date + " to " +
            //               _chart._end_Date;
            //return pr.TransactionCostQuantityByDayGoods(
            //    _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
            //    //" Transaction_Type_ID = 2 and Transaction_Status_ID = 6 "
            //    );
            
            
            
            if (_is_Segregation)
            {
                
                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods waste by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 "
                            );


                    case "FG_WIP_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods in Manufacturing Phase by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 3 "
                            );

                    case "FG_Consumed_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " a consumed Finished Goods to produce goods by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 "
                            );

                    case "FG_In_Transit_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 "
                            );


                    case "FG_Current_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods current stock by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 "
                            );

                    case "FG_Current_Minus_Reserved_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserve by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 "
                            );

                    case "FG_Reserved_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 "
                            );


                    case "FG_Sales_Return_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods sales Return by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 4 "
                            );

                    case "FG_Sales_By_Cost_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods sales by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 "
                            );

                    case "FG_Gross_Profit_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods sales by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 "
                            );

                    case "FG_Net_Profit_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods sales by cost " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 "
                            );

                }


            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Waste by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material = false "
                             );
                    case "FG_WIP_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods in Manufacturing phase by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 1 and Transaction_Status_ID = 3 and Is_Raw_Material = false"
                             );
                    case "FG_Consumed_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Consumed to produce goods by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                             );
                    case "FG_In_Transit_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods In-Transit by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                             _chart._start_Date, _chart._end_Date).Tables[0].Select(
                             " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                             );


                    case "FG_Current_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Current by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false"
                            );

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Current - Reserve  by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false"
                            );

                    case "FG_Reserved_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Reserve by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                            );

                    case "FG_Sales_Return_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Sales Return by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );

                    case "FG_Sales_By_Cost_Aggregation_Bar":
                        _chart._title = "Finished Goods Sales by cost " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );

                    case "FG_Gross_Profit_Aggregation_Bar":
                        _chart._title = "Finished Goods Gross Profit " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );

                    case "FG_Net_Profit_Aggregation_Bar":
                        _chart._title = "Finished Goods Net Profit " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );
                }
            }

            System.Windows.Forms.MessageBox.Show("not done " + _chart._chartName);

            return new DataRow[0];
        }
        DataRow[] FG_BarQuantity()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "N0";
            if (_is_Segregation)
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods waste by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                               _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                               " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material = false"
                               );

                    case "FG_WIP_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods in Manufacturing Phase by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                                   _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                                   " Transaction_Type_ID = 1 and Transaction_Status_ID = 3 and Is_Raw_Material = false"
                                   );

                    case "FG_Consumed_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods Consumed during Manufacturing Phase by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                          _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                          " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                          );

                    case "FG_In_Transit_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                                _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                                " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                                );


                    case "FG_Current_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods current stock by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false "
                            );

                    case "FG_Current_Minus_Reserved_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserve by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false"
                            );

                    case "FG_Reserved_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                            );

                    case "FG_Sales_Return_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Return by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );

                    case "FG_Sales_By_Quantity_Segregation":
                        _chart._title = _chart._goods_Name + " Finished Goods Sales by Quantity " + _chart._period;
                        return war.TransactionCostQuantityByDayGoods(
                            _chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 and Is_Raw_Material = false"
                            );


                }

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Waste by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                                _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                " Transaction_Type_ID = 2 and Transaction_Status_ID = 6 and Is_Raw_Material = false"
                                );

                    case "FG_WIP_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods in Manufacturing Phase by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                                    _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                    " Transaction_Type_ID = 1 and Transaction_Status_ID = 3 and Is_Raw_Material = false"
                                    );

                    case "FG_Consumed_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Consumed to produce goods by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                            );

                    case "FG_In_Transit_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods In Transit by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                                _chart._start_Date, _chart._end_Date).Tables[0].Select(
                                " Transaction_Type_ID = 1 and Transaction_Status_ID = 2 and Is_Raw_Material = false"
                                );

                    case "FG_Current_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Current by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false"
                            );

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Current - Reserve  by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 1 and Is_Raw_Material = false"
                            );

                    case "FG_Reserved_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Reserve by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 2 and Is_Raw_Material = false "
                            );

                    case "FG_Sales_Return_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Sales Return by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 1 and Transaction_Status_ID = 4 and Is_Raw_Material = false "
                            );

                    case "FG_Sales_By_Quantity_Aggregation_Bar":
                        _chart._title = "Finished Goods Sales by Quantity " + _chart._period;
                        return war.TransactionCostQuatityByDay(
                            _chart._start_Date, _chart._end_Date).Tables[0].Select(
                            " Transaction_Type_ID = 2 and Transaction_Status_ID = 4 and Is_Raw_Material = false "
                            );
                }
            }
            System.Windows.Forms.MessageBox.Show("not done ");
            return new DataRow[0];
        }

        // Line
        DataRow[] FG_LineCost()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";
            if (_is_Segregation)
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Finished Goods Waste cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_WIP_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Finished Goods In Process cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Consumed_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Finished Goods Consumed cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_In_Transit_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Current_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Finished Goods Current cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Current_Minus_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserved cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );


                    case "FG_Reserved_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Sales_Return_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Return cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Sales_By_Cost_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Gross_Profit_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Gross Profit " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );

                    case "FG_Net_Profit_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Net Profit " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select(
                            );
                }
            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Cumulative_Cost_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Finished Goods inventory cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();




                    case "FG_Waste_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Finished Goods Waste cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Finished Goods In Process cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Finished Goods Consumed cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Finished Goods Current cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostByGoods(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserved cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Reserved_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Sales_Return_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Return cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Sales_By_Cost_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales cost " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Gross_Profit_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Gross Profit " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Net_Profit_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Net Profit " + _chart._period;
                        return war.FinishedGoodsStatusOnDateCostAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }
            }
            return new DataRow[0];
        }
        DataRow[] FG_LineQuantity()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "N0";
            if (_is_Segregation)
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Finished Goods Waste Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_WIP_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Finished Goods In Process Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Consumed_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Finished Goods Consumed Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_In_Transit_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Current_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Finished Goods Current Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserved Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();


                    case "FG_Reserved_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Sales_Return_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Return Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                    case "FG_Sales_By_Quantity_Segregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateByRM(_chart._start_Date, _chart._end_Date, _chart._goods_ID).Tables[0].Select();

                }
            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Cumulative_Quantity_Line_Chart":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = "Finished Goods inventory Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();




                    case "FG_Waste_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Red;
                        _chart._title = _chart._goods_Name + " Finished Goods Waste Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Yellow;
                        _chart._title = _chart._goods_Name + " Finished Goods In Process Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Black;
                        _chart._title = _chart._goods_Name + " Finished Goods Consumed Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Orange;
                        _chart._title = _chart._goods_Name + " Finished Goods In-Transit Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.Green;
                        _chart._title = _chart._goods_Name + " Finished Goods Current Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.GreenYellow;
                        _chart._title = _chart._goods_Name + " Finished Goods current - Reserved Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Reserved_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Reserve Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_Return_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Return Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_By_Quantity_Aggregation_Line":
                        _chart._serial_Color = System.Drawing.Color.DarkBlue;
                        _chart._title = _chart._goods_Name + " Finished Goods Sales Quantity " + _chart._period;
                        return war.FinishedGoodsStatusOnDateQuantitytAll(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                }

            }
            return new DataRow[0];

        }

        // Pie
        DataRow[] FG_PieCost()
        {
            if (_is_Segregation)
            {


            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods waste by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods in Manufacturing Phae by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods Consumed to produce goods by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods In-Transit by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Current_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods Current by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods current - Reserved by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Reserved_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods Reserve by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_Return_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods Sales Return by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_By_Cost_Aggregation_Pie":
                        _chart._title = " Finished Goods Sales by cost at " + _chart._start_Date;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Gross_Profit_Aggregation_Pie":
                        _chart._title = " Finished Goods Gross Profit " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Net_Profit_Aggregation_Pie":
                        _chart._title = " Finished Goods Sales by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] FG_PieQuantity()
        {
            if (_is_Segregation)
            {

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods waste by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods in Manufacturing Phae by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods Consumed to produce goods by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods In-Transit by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods Current by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods current - Reserved by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Reserved_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods Reserve by cost at " + _chart._start_Date;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_Return_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods Sales Return by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_By_Quantity_Aggregation_Pie":
                        _chart._title = " Finished Goods Sales by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];
        
        }

        // Pareto
        DataRow[] FG_ParetoCost()
        {
            if (_is_Segregation)
            {


            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods waste by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods in Manufacturing Phae by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods Consumed to produce goods by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods In-Transit by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();


                    case "FG_Current_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods Current by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods current - Reserved by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Reserved_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods Reserve by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_Return_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods Sales Return by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_By_Cost_Aggregation_Pareto":
                        _chart._title = " Finished Goods Sales by cost at " + _chart._start_Date;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Gross_Profit_Aggregation_Pareto":
                        _chart._title = " Finished Goods Gross Profit " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Net_Profit_Aggregation_Pareto":
                        _chart._title = " Finished Goods Sales by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }
            }
            return new DataRow[0];
        }
        DataRow[] FG_ParetoQuantity()
        {
            if (_is_Segregation)
            {

            }
            else
            {

                switch (_chart._chartName)
                {
                    case "FG_Waste_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods waste by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_WIP_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods in Manufacturing Phae by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Consumed_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods Consumed to produce goods by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_In_Transit_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods In-Transit by Quantity " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods Current by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Current_Minus_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods current - Reserved by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Reserved_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods Reserve by cost at " + _chart._start_Date;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_Return_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods Sales Return by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();

                    case "FG_Sales_By_Quantity_Aggregation_Pareto":
                        _chart._title = " Finished Goods Sales by cost " + _chart._period;
                        return war.FGAggCostOnDate(_chart._start_Date, _chart._end_Date).Tables[0].Select();
                }

            }
            return new DataRow[0];

        }

        // Kagi
        DataRow[] FG_Kagi()
        {
            _chart.chart1.ChartAreas[0].AxisY.LabelStyle.Format = "C0";
            switch (_chart._chartName)
            {
                case "FG_Waste_Rates":
                    _chart._title = _chart._goods_Name + " Finished Goods Waste cost " + _chart._period;
                    return war.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 6 and Transaction_Type_ID = 2 ");


                case "FG_WIP_Rates":
                    _chart._title = _chart._goods_Name + " Finished Goods WIP cost " + _chart._period;
                    return war.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 3 and Transaction_Type_ID = 1 ");

                case "FG_Current_Rates":
                    _chart._title = _chart._goods_Name + " Finished Goods Received cost " + _chart._period;
                    return war.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 1 and Transaction_Type_ID = 1 ");

                case "FG_Sales_Rates":
                    _chart._title = _chart._goods_Name + " Finished Goods Sales cost " + _chart._period;
                    return war.GetKagiList(_chart._goods_ID).Tables[0].Select(" Transaction_Status_ID = 2 and Transaction_Type_ID = 4 ");
            }
            return new DataRow[0];
        }
        #endregion
        #endregion

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation

33 members

Comments and Discussions