private void print_Palletcard(int rowindex)
        {
            Cursor = Cursors.WaitCursor;
            FruPak.PF.Common.Code.General.Get_Printer("A4");

            switch (str_product_code)
            {
                case "WPC":
                case "FDA":
                    DialogResult DLR_Weights = new System.Windows.Forms.DialogResult();
                    Form frm_check_weight = new FruPak.PF.Utils.Scanning.Pallet_Weight(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), int_Current_User_Id, bol_write_access);
                    DLR_Weights = frm_check_weight.ShowDialog();
                    frm_check_weight.Dispose();

                    if (FruPak.PF.PrintLayer.Word.Test_for_Word() == true)
                    {
                        try
                        {
                            FruPak.PF.PrintLayer.Word.CloseWord();
                        }
                        catch (Exception ex)
                        {
                            logger.Log(LogLevel.Debug, ex.Message);
                        }
                        FruPak.PF.PrintLayer.WPC_Card.Print(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), true, int_Current_User_Id);
                    }
                    else
                    {
                        string Data = "";
                        Data = Data + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString();
                        Data = Data + ":True";

                        //FruPak.PF.PrintLayer.Word.Printer = "Brother HL-2040 series";
                        FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;  // 16/06/2015 Fixed - Jim worked out there was some hardcoded strings

                        // Phantom 18/12/2014
                        //FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;   // Reverted 06-03-2015

                        DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
                        DataRow dr_Get_Info;
                        for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
                        {
                            dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                            switch (dr_Get_Info["Code"].ToString())
                            {
                                case "PF-TPath":
                                    FruPak.PF.PrintLayer.Word.TemplatePath = dr_Get_Info["Value"].ToString();
                                    break;
                                case "PF-TWPC":
                                    FruPak.PF.PrintLayer.Word.TemplateName = dr_Get_Info["Value"].ToString();
                                    break;
                            }
                        }
                        ds_Get_Info.Dispose();
                        FruPak.PF.PrintLayer.Word.Server_Print(Data, int_Current_User_Id);
                    }
                    break;
                default:
                    if (FruPak.PF.PrintLayer.Word.Test_for_Word() == true)
                    {
                        try
                        {
                            FruPak.PF.PrintLayer.Word.CloseWord();
                        }
                        catch (Exception ex)
                        {
                            logger.Log(LogLevel.Debug, ex.Message);
                        }
                        FruPak.PF.PrintLayer.Pallet_Card.Print(dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString(), true, int_Current_User_Id);
                    }
                    else
                    {
                        string Data = "";
                        Data = Data + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString();
                        Data = Data + ":True";

                        //FruPak.PF.PrintLayer.Word.Printer = "Brother HL-2040 series";

                        // Phantom 18/12/2014
                        FruPak.PF.PrintLayer.Word.Printer = Settings.Printer_Name;

                        DataSet ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
                        DataRow dr_Get_Info;
                        for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
                        {
                            dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                            switch (dr_Get_Info["Code"].ToString())
                            {
                                case "PF-TPath":
                                    FruPak.PF.PrintLayer.Word.TemplatePath = dr_Get_Info["Value"].ToString();
                                    break;
                                case "PF-TPallet":
                                    FruPak.PF.PrintLayer.Word.TemplateName = dr_Get_Info["Value"].ToString();
                                    break;
                            }
                        }
                        ds_Get_Info.Dispose();
                        FruPak.PF.PrintLayer.Word.Server_Print(Data, int_Current_User_Id);
                    }
                    break;
            }
            try
            {
                FruPak.PF.PrintLayer.Word.CloseWord();
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Debug, ex.Message);
            }
            string str_path = "";

            DataSet ds_Get_Info1 = FruPak.PF.Data.AccessLayer.CM_System.Get_Info_Like("PF%");
            DataRow dr_Get_Info1;
            for (int i = 0; i < Convert.ToInt32(ds_Get_Info1.Tables[0].Rows.Count.ToString()); i++)
            {
                dr_Get_Info1 = ds_Get_Info1.Tables[0].Rows[i];
                switch (dr_Get_Info1["Code"].ToString())
                {
                    case "PF-TPPath":
                        str_path = dr_Get_Info1["Value"].ToString();
                        break;
                }
            }
            ds_Get_Info1.Dispose();

            Cursor = Cursors.Default;
            lst_filenames.AddRange(System.IO.Directory.GetFiles(str_path, "*" + dataGridView1.Rows[rowindex].Cells["Barcode"].Value.ToString() + "*", System.IO.SearchOption.TopDirectoryOnly));

            foreach (string filename in lst_filenames)
            {
                File.Delete(filename);
            }
        }
 private void button7_Click(object sender, EventArgs e)
 {
     Form frm = new FruPak.PF.Utils.Scanning.Pallet_Weight(int_User_id, true);
     frm.Show();
 }