private void button1_Click(object sender, EventArgs e)
        {
            Report.Backlog.BacklogReport backlog = new BacklogReport();

            dtOrder            = backlog.GetDataProductionOrder2(dtpk_To.Value);
            DicOrderStock      = new Dictionary <string, Planning.SemiFinishedGoods>();
            DicListSemiFGs     = new Dictionary <string, List <Planning.SemiFinishedGoods> >();
            DicProductionOrder = new Dictionary <string, DataTable>();

            for (int i = 0; i < dtOrder.Rows.Count; i++)
            {
                string CO_Code     = dtOrder.Rows[i]["Code_Type"].ToString().Trim();
                string CO_No       = dtOrder.Rows[i]["Code_No"].ToString().Trim();
                string CO_STT      = dtOrder.Rows[i]["STT"].ToString().Trim();
                string product     = dtOrder.Rows[i]["Product_Code"].ToString().Trim();
                string ClientOrder = dtOrder.Rows[i]["Code_Type"].ToString().Trim() + "-" + dtOrder.Rows[i]["Code_No"].ToString().Trim() + "-" + dtOrder.Rows[i]["STT"].ToString().Trim();
                Planning.SemiFinishedGoods semiFinishedGoods    = new Planning.SemiFinishedGoods();
                Planning.Controler.GetSemiFinishedgoods getSemi = new Planning.Controler.GetSemiFinishedgoods();
                semiFinishedGoods = getSemi.GetStockGoodsONSFT("", product);
                List <Planning.SemiFinishedGoods>     semis = getSemi.ListGetSemiFinishedGoods("", product);
                Planning.Controler.GetProductionOrder getProductionOrder = new Planning.Controler.GetProductionOrder();


                var dtPO = getProductionOrder.GetProductionOrderStatus(CO_Code, CO_No, CO_STT);

                DicOrderStock.Add(ClientOrder, semiFinishedGoods);
                DicListSemiFGs.Add(ClientOrder, semis);
                DicProductionOrder.Add(ClientOrder, dtPO);
            }

            dataGridView1.DataSource = dtOrder;
        }
        private void Btn_backlogReport_Click(object sender, EventArgs e)
        {
            string pathsave = "";

            System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Title      = "Browse Excel Files";
            saveFileDialog.DefaultExt = "Excel";
            saveFileDialog.Filter     = "Excel files (*.xlsx)|*.xlsx";

            saveFileDialog.CheckPathExists = true;


            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                pathsave = saveFileDialog.FileName;

                saveFileDialog.RestoreDirectory = true;
                Report.Backlog.BacklogReport backlogReport = new Report.Backlog.BacklogReport();
                backlogReport.ExportExcelToReport(pathsave, Class.valiballecommon.GetStorage()._version);
                var resultMessage = MessageBox.Show("Production Plan export to excel sucessful ! \n\r Do you want to open this file ?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (resultMessage == DialogResult.Yes)
                {
                    FileInfo fi = new FileInfo(pathsave);
                    if (fi.Exists)
                    {
                        System.Diagnostics.Process.Start(pathsave);
                    }
                    else
                    {
                        MessageBox.Show("File doestn't exist !", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }