private void Print_OnExtraExport(object sender, EventArgs e)
        {
            if (m_print == null || m_Entity == null)
            {
                return;
            }
            Print print = new Print();

            switch (m_print.FileName)
            {
            case "程序审查意见落实表":
                m_print.BatchAddPicture("程序文件", "程序审查意见落实表", m_Entity);
                break;

            case "程序文件表单":
                m_print.BatchAddPicture("程序文件", "程序文件表单", m_Entity);
                break;

            case "管理程序封面模板":
                m_print.BatchAddPicture("程序文件", "管理程序封面模板", m_Entity);
                break;
            }

            switch (m_print.FileName)
            {
            case "程序文件表单":
                //Print print = new Print();
                // 批准人
                m_print.Write("操作人", m_Entity.ApproveName, WordMgr.WriteMode.Down, 1);
                m_print.Write("同意/否决", m_Entity.ApproverIsAgree, WordMgr.WriteMode.Down, 1);
                m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_APPROVE, m_Entity.ApproveComment), WordMgr.WriteMode.Down, 1);
                if (string.IsNullOrEmpty(lblApproveDate.Text))
                {
                    m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_APPROVE) /*m_print.CheckDateTime(m_Entity.ApproveDate.ToShortDateString())*/, WordMgr.WriteMode.Down, 1);
                }
                else
                {
                    m_print.Write("日期", m_print.CheckDateTime(lblApproveDate.Text.ToString()), WordMgr.WriteMode.Down, 1);
                }

                // 质保审查
                if (m_Entity.ProgramSort != "工作程序")
                {
                    m_print.Write("操作人", m_Entity.QualityNames, WordMgr.WriteMode.Down, 2);
                    m_print.Write("同意/否决", m_Entity.QualityIsAgree, WordMgr.WriteMode.Down, 2);
                    m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_QG, m_Entity.QualityComment), WordMgr.WriteMode.Down, 2);
                    if (string.IsNullOrEmpty(lblQGDate.Text))
                    {
                        m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_QG), WordMgr.WriteMode.Down, 2);
                    }
                    else
                    {
                        m_print.Write("日期", m_print.CheckDateTime(lblQGDate.Text.ToString()), WordMgr.WriteMode.Down, 2);
                    }
                }

                // 审核
                m_print.Write("操作人", m_Entity.AuditName, WordMgr.WriteMode.Down, 3);
                m_print.Write("同意/否决", m_Entity.AuditorIsAgree, WordMgr.WriteMode.Down, 3);
                m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_AUDIT, m_Entity.AuditComment), WordMgr.WriteMode.Down, 3);
                if (string.IsNullOrEmpty(lblAuditDate.Text))
                {
                    m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_AUDIT), WordMgr.WriteMode.Down, 3);
                }
                else
                {
                    m_print.Write("日期", m_print.CheckDateTime(lblAuditDate.Text.ToString()), WordMgr.WriteMode.Down, 3);
                }

                // 校对
                m_print.Write("操作人", m_Entity.CheckName, WordMgr.WriteMode.Down, 4);
                m_print.Write("同意/否决", m_Entity.CheckerIsAgree, WordMgr.WriteMode.Down, 4);
                m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_CHECK, m_Entity.CheckComment), WordMgr.WriteMode.Down, 4);
                if (string.IsNullOrEmpty(lblCheckDate.Text))
                {
                    m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_CHECK), WordMgr.WriteMode.Down, 4);
                }
                else
                {
                    m_print.Write("日期", m_print.CheckDateTime(lblCheckDate.Text.ToString()), WordMgr.WriteMode.Down, 4);
                }

                // 编写
                m_print.Write("操作人", m_Entity.WriteName, WordMgr.WriteMode.Down, 5);
                m_print.Write("同意/否决", m_Entity.WriterIsAgree, WordMgr.WriteMode.Down, 5);
                m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_WRITE, m_Entity.WriteComment), WordMgr.WriteMode.Down, 5);
                //M_20100414 huangqi des:编写时间改为FirstDraftDate
                //begin
                if (m_Entity.FirstDraftDate == DateTime.MinValue)    //string.IsNullOrEmpty(lblWriteDate.Text))
                {
                    if (m_Entity.DraftDate == DateTime.MinValue)
                    {
                        ucPrint.Write("日期", "", WordMgr.WriteMode.Down, 5);
                    }
                    else
                    {
                        ucPrint.Write("日期", m_Entity.DraftDate.ToShortDateString(), WordMgr.WriteMode.Down, 5);
                    }
                }
                else
                {
                    m_print.Write("日期", m_Entity.FirstDraftDate.ToShortDateString(), WordMgr.WriteMode.Down, 5);
                }
                //end
                ////////////////////////////////////////////////////////////////////////////////////////
                ArrayList al1 = new ArrayList();
                if (m_Entity.DeptSignList == null)
                {
                    goto LEADERSIGN;
                }
                for (int i = 0; i < m_Entity.DeptSignList.Count; i++)
                {
                    ArrayList tmp = new ArrayList();
                    M_ProgramFile.DeptSign item = m_Entity.DeptSignList[i];
                    tmp.Add(item.DeptName);
                    tmp.Add(item.Name);
                    tmp.Add(item.IsAgree);
                    tmp.Add(m_print.CheckDateTime(item.SubmitDate.ToShortDateString()));
                    tmp.Add(item.Comment);
                    tmp.Add(item.DealCondition);
                    tmp.Add(m_print.CheckDateTime(item.DealDate.ToShortDateString()));
                    al1.Add(tmp);
                }
                //al1.AddRange(m_Entity.DeptSignList);
                m_print.WriteTable(2, al1);
                //////////////////////////////////////////////////////////////////////////////////////////
LEADERSIGN:
                ArrayList al2 = new ArrayList();
                if (m_Entity.LeaderSignList == null)
                {
                    break;
                }
                for (int i = 0; i < m_Entity.LeaderSignList.Count; i++)
                {
                    ArrayList tmp = new ArrayList();
                    M_ProgramFile.LeaderSign item = m_Entity.LeaderSignList[i];
                    tmp.Add(item.Name);
                    tmp.Add(item.IsAgree);
                    tmp.Add(m_print.CheckDateTime(item.Date.ToShortDateString()));
                    tmp.Add(item.Comment);
                    tmp.Add(item.DealCondition);
                    tmp.Add(m_print.CheckDateTime(item.DealDate.ToShortDateString()));
                    al2.Add(tmp);
                }
                //al2.AddRange(m_Entity.LeaderSignList);
                m_print.WriteTable(3, al2);
                break;

            case "程序审查意见落实表":
                ArrayList al22 = new ArrayList();
                al22 = GeneratorTableData(2, m_Entity);
                m_print.WriteTable(2, al22);
                ArrayList al3 = new ArrayList();
                al3 = GeneratorTableData(3, m_Entity);
                m_print.WriteTable(3, al3);
                //ArrayList al5 = new ArrayList();
                //al5 = GeneratorTableData(5, m_Entity);
                //m_print.WriteTable(5, al5);
                break;

            case "管理程序封面模板":
                ArrayList alPage1  = new ArrayList();
                ArrayList newarr   = new ArrayList();
                ArrayList childarr = new ArrayList();
                alPage1 = GeneratorTableDataEx(m_print, 2, m_Entity);
                int curr = -1;
                for (int i = 0; i < alPage1.Count; i++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        newarr.Add((alPage1[i] as ArrayList)[j].ToString());
                        if ((alPage1[i] as ArrayList)[j].ToString() == "质量保证处")
                        {
                            curr = i * 6 + j;
                        }
                    }
                }
                if (curr != -1)
                {
                    childarr.Add(newarr[curr].ToString());
                    childarr.Add(newarr[curr + 1].ToString());
                    childarr.Add(newarr[curr + 2].ToString());
                    newarr.RemoveRange(curr, 3);
                    newarr.Insert(0, childarr[0].ToString());
                    newarr.Insert(1, childarr[1].ToString());
                    newarr.Insert(2, childarr[2].ToString());
                    alPage1 = new ArrayList();
                    for (int k = 0; k < newarr.Count; k += 6)
                    {
                        childarr = new ArrayList();

                        childarr.Add(newarr[k].ToString());
                        childarr.Add(newarr[k + 1].ToString());
                        childarr.Add(newarr[k + 2].ToString());
                        childarr.Add(newarr[k + 3].ToString());
                        childarr.Add(newarr[k + 4].ToString());
                        childarr.Add(newarr[k + 5].ToString());
                        alPage1.Add(childarr);
                    }
                }
                m_print.WriteTable(2, alPage1);

                ArrayList alPage2 = new ArrayList();
                alPage2 = GeneratorTableDataEx(m_print, 3, m_Entity);
                m_print.WriteTable(3, alPage2);

                ArrayList alPage3 = new ArrayList();
                alPage3 = GeneratorTableDataEx(m_print, 5, m_Entity);
                m_print.WriteTable(5, alPage3);

                string[] value = { m_Entity.DocumentTitle, m_Entity.ProgramCode, m_Entity.Edition };
                m_print.WriteHeaderFooter("程序名称", value, WordMgr.WriteMode.Shift);

                if (alPage1.Count == 0)
                {
                    m_print.DeleteString("部门会签表(排列不分先后)");
                    m_print.DeleteTable(2);
                    if (alPage2.Count == 0)
                    {
                        m_print.DeleteString("公司领导审定");
                        m_print.DeleteTable(2);

                        if (!m_Entity.IsProgramCompanCheck)
                        {
                            m_print.DeleteString("中国核电工程有限公司会签");
                            m_print.DeleteTable(2);
                        }
                    }
                }
                else if (alPage2.Count == 0)
                {
                    m_print.DeleteString("公司领导审定");
                    m_print.DeleteTable(3);

                    if (!m_Entity.IsProgramCompanCheck)
                    {
                        m_print.DeleteString("中国核电工程有限公司会签");
                        m_print.DeleteTable(3);
                    }
                }
                else
                {
                    if (!m_Entity.IsProgramCompanCheck)
                    {
                        m_print.DeleteString("中国核电工程有限公司会签");
                        m_print.DeleteTable(4);
                    }
                }

                break;
            }
        }
        private void ucPrint_OnBeginExport(object sender, EventArgs e)
        {
            UC_Print ucPrint = sender as UC_Print;
            Print print = new Print();
            B_PF cEntity = null;
            //SetEntity(cEntity);
            if (base.IsPreview)
            {
                cEntity = base.EntityData != null ? base.EntityData as B_PF : new B_PF();
            }
            else
            {
                cEntity = this.ControlToEntity(false) as B_PF;
            }
            cEntity.ProcessID = base.ProcessID;
            cEntity.WorkItemID = base.WorkItemID;

            print.SetPrintBeginExport(ucPrint, cEntity);
        }
 private void ucPrint_OnAttachExport(object sender, EventArgs e)
 {
     UC_Print ucPrint = sender as UC_Print;
     Print print = new Print();
     B_PF cEntity = null;
     //SetEntity(cEntity);
     if (base.IsPreview)
     {
         cEntity = base.EntityData != null ? base.EntityData as B_PF : new B_PF();
     }
     else
     {
         cEntity = this.ControlToEntity(false) as B_PF;
     }
     print.SetPrintAttachExport(ucPrint, cEntity);
 }
        private void Print_OnExtraExport(object sender, EventArgs e)
        {
            if (m_print == null || m_Entity == null) return;
            Print print = new Print();

            switch (m_print.FileName)
            {
                case "程序审查意见落实表":
                    m_print.BatchAddPicture("程序文件", "程序审查意见落实表", m_Entity);
                    break;
                case "程序文件表单":
                    m_print.BatchAddPicture("程序文件", "程序文件表单", m_Entity);
                    break;
                case "管理程序封面模板":
                    m_print.BatchAddPicture("程序文件", "管理程序封面模板", m_Entity);
                    break;
            }

            switch (m_print.FileName)
            {
                case "程序文件表单":
                    //Print print = new Print();
                    // 批准人
                    m_print.Write("操作人", m_Entity.ApproveName, WordMgr.WriteMode.Down, 1);
                    m_print.Write("同意/否决", m_Entity.ApproverIsAgree, WordMgr.WriteMode.Down, 1);
                    m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_APPROVE, m_Entity.ApproveComment), WordMgr.WriteMode.Down, 1);
                    if (string.IsNullOrEmpty(lblApproveDate.Text))
                    { m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_APPROVE)/*m_print.CheckDateTime(m_Entity.ApproveDate.ToShortDateString())*/, WordMgr.WriteMode.Down, 1); }
                    else
                    { m_print.Write("日期", m_print.CheckDateTime(lblApproveDate.Text.ToString()), WordMgr.WriteMode.Down, 1); }

                    // 质保审查
                    if (m_Entity.ProgramSort != "工作程序")
                    {
                        m_print.Write("操作人", m_Entity.QualityNames, WordMgr.WriteMode.Down, 2);
                        m_print.Write("同意/否决", m_Entity.QualityIsAgree, WordMgr.WriteMode.Down, 2);
                        m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_QG, m_Entity.QualityComment), WordMgr.WriteMode.Down, 2);
                        if (string.IsNullOrEmpty(lblQGDate.Text))
                        { m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_QG), WordMgr.WriteMode.Down, 2); }
                        else
                        { m_print.Write("日期", m_print.CheckDateTime(lblQGDate.Text.ToString()), WordMgr.WriteMode.Down, 2); }
                    }

                    // 审核
                    m_print.Write("操作人", m_Entity.AuditName, WordMgr.WriteMode.Down, 3);
                    m_print.Write("同意/否决", m_Entity.AuditorIsAgree, WordMgr.WriteMode.Down, 3);
                    m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_AUDIT, m_Entity.AuditComment), WordMgr.WriteMode.Down, 3);
                    if (string.IsNullOrEmpty(lblAuditDate.Text))
                    { m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_AUDIT), WordMgr.WriteMode.Down, 3); }
                    else
                    { m_print.Write("日期", m_print.CheckDateTime(lblAuditDate.Text.ToString()), WordMgr.WriteMode.Down, 3); }

                    // 校对
                    m_print.Write("操作人", m_Entity.CheckName, WordMgr.WriteMode.Down, 4);
                    m_print.Write("同意/否决", m_Entity.CheckerIsAgree, WordMgr.WriteMode.Down, 4);
                    m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_CHECK, m_Entity.CheckComment), WordMgr.WriteMode.Down, 4);
                    if (string.IsNullOrEmpty(lblCheckDate.Text))
                    { m_print.Write("日期", GetLastDate(m_print, ProcessConstString.StepName.ProgramFile.STEP_CHECK), WordMgr.WriteMode.Down, 4); }
                    else
                    { m_print.Write("日期", m_print.CheckDateTime(lblCheckDate.Text.ToString()), WordMgr.WriteMode.Down, 4); }

                    // 编写
                    m_print.Write("操作人", m_Entity.WriteName, WordMgr.WriteMode.Down, 5);
                    m_print.Write("同意/否决", m_Entity.WriterIsAgree, WordMgr.WriteMode.Down, 5);
                    m_print.Write("意见", GetPFComment(ProcessConstString.StepName.ProgramFile.STEP_WRITE, m_Entity.WriteComment), WordMgr.WriteMode.Down, 5);
                    //M_20100414 huangqi des:编写时间改为FirstDraftDate
                    //begin
                    if (m_Entity.FirstDraftDate == DateTime.MinValue)//string.IsNullOrEmpty(lblWriteDate.Text))
                    {
                        if (m_Entity.DraftDate == DateTime.MinValue)
                        {
                            ucPrint.Write("日期", "", WordMgr.WriteMode.Down, 5);
                        }
                        else
                        {
                            ucPrint.Write("日期", m_Entity.DraftDate.ToShortDateString(), WordMgr.WriteMode.Down, 5);
                        }
                    }
                    else
                    { m_print.Write("日期", m_Entity.FirstDraftDate.ToShortDateString(), WordMgr.WriteMode.Down, 5); }
                    //end
                    ////////////////////////////////////////////////////////////////////////////////////////
                    ArrayList al1 = new ArrayList();
                    if (m_Entity.DeptSignList == null) goto LEADERSIGN;
                    for (int i = 0; i < m_Entity.DeptSignList.Count; i++)
                    {
                        ArrayList tmp = new ArrayList();
                        M_ProgramFile.DeptSign item = m_Entity.DeptSignList[i];
                        tmp.Add(item.DeptName);
                        tmp.Add(item.Name);
                        tmp.Add(item.IsAgree);
                        tmp.Add(m_print.CheckDateTime(item.SubmitDate.ToShortDateString()));
                        tmp.Add(item.Comment);
                        tmp.Add(item.DealCondition);
                        tmp.Add(m_print.CheckDateTime(item.DealDate.ToShortDateString()));
                        al1.Add(tmp);
                    }
                    //al1.AddRange(m_Entity.DeptSignList);
                    m_print.WriteTable(2, al1);
                //////////////////////////////////////////////////////////////////////////////////////////
                LEADERSIGN:
                    ArrayList al2 = new ArrayList();
                if (m_Entity.LeaderSignList == null) break;
                for (int i = 0; i < m_Entity.LeaderSignList.Count; i++)
                {
                    ArrayList tmp = new ArrayList();
                    M_ProgramFile.LeaderSign item = m_Entity.LeaderSignList[i];
                    tmp.Add(item.Name);
                    tmp.Add(item.IsAgree);
                    tmp.Add(m_print.CheckDateTime(item.Date.ToShortDateString()));
                    tmp.Add(item.Comment);
                    tmp.Add(item.DealCondition);
                    tmp.Add(m_print.CheckDateTime(item.DealDate.ToShortDateString()));
                    al2.Add(tmp);
                }
                //al2.AddRange(m_Entity.LeaderSignList);
                m_print.WriteTable(3, al2);
                break;

                case "程序审查意见落实表":
                ArrayList al22 = new ArrayList();
                al22 = GeneratorTableData(2, m_Entity);
                m_print.WriteTable(2, al22);
                ArrayList al3 = new ArrayList();
                al3 = GeneratorTableData(3, m_Entity);
                m_print.WriteTable(3, al3);
                //ArrayList al5 = new ArrayList();
                //al5 = GeneratorTableData(5, m_Entity);
                //m_print.WriteTable(5, al5);
                break;

                case "管理程序封面模板":
                ArrayList alPage1 = new ArrayList();
                ArrayList newarr = new ArrayList();
                ArrayList childarr = new ArrayList();
                alPage1 = GeneratorTableDataEx(m_print, 2, m_Entity);
                int curr = -1;
                for (int i = 0; i < alPage1.Count; i++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        newarr.Add((alPage1[i] as ArrayList)[j].ToString());
                        if ((alPage1[i] as ArrayList)[j].ToString() == "质量保证处")
                        {
                            curr = i * 6 + j;
                        }
                    }
                }
                if (curr != -1)
                {
                    childarr.Add(newarr[curr].ToString());
                    childarr.Add(newarr[curr + 1].ToString());
                    childarr.Add(newarr[curr + 2].ToString());
                    newarr.RemoveRange(curr, 3);
                    newarr.Insert(0, childarr[0].ToString());
                    newarr.Insert(1, childarr[1].ToString());
                    newarr.Insert(2, childarr[2].ToString());
                    alPage1 = new ArrayList();
                    for (int k = 0; k < newarr.Count; k += 6)
                    {
                        childarr = new ArrayList();

                        childarr.Add(newarr[k].ToString());
                        childarr.Add(newarr[k + 1].ToString());
                        childarr.Add(newarr[k + 2].ToString());
                        childarr.Add(newarr[k + 3].ToString());
                        childarr.Add(newarr[k + 4].ToString());
                        childarr.Add(newarr[k + 5].ToString());
                        alPage1.Add(childarr);
                    }
                }
                m_print.WriteTable(2, alPage1);

                ArrayList alPage2 = new ArrayList();
                alPage2 = GeneratorTableDataEx(m_print, 3, m_Entity);
                m_print.WriteTable(3, alPage2);

                ArrayList alPage3 = new ArrayList();
                alPage3 = GeneratorTableDataEx(m_print, 5, m_Entity);
                m_print.WriteTable(5, alPage3);

                string[] value = { m_Entity.DocumentTitle, m_Entity.ProgramCode, m_Entity.Edition };
                m_print.WriteHeaderFooter("程序名称", value, WordMgr.WriteMode.Shift);

                if (alPage1.Count == 0)
                {
                    m_print.DeleteString("部门会签表(排列不分先后)");
                    m_print.DeleteTable(2);
                    if (alPage2.Count == 0)
                    {
                        m_print.DeleteString("公司领导审定");
                        m_print.DeleteTable(2);

                        if (!m_Entity.IsProgramCompanCheck)
                        {
                            m_print.DeleteString("中国核电工程有限公司会签");
                            m_print.DeleteTable(2);
                        }
                    }
                }
                else if (alPage2.Count == 0)
                {
                    m_print.DeleteString("公司领导审定");
                    m_print.DeleteTable(3);

                    if (!m_Entity.IsProgramCompanCheck)
                    {
                        m_print.DeleteString("中国核电工程有限公司会签");
                        m_print.DeleteTable(3);
                    }
                }
                else
                {
                    if (!m_Entity.IsProgramCompanCheck)
                    {
                        m_print.DeleteString("中国核电工程有限公司会签");
                        m_print.DeleteTable(4);
                    }
                }

                break;
            }
        }
        private void Print_OnBeginExport(object sender, EventArgs e)
        {
            if (m_print == null || m_print.m_ls == null || m_print.m_ls.Count == 0) return;
            Print print = new Print();

            m_Entity = m_print.m_CurrEntity as B_PF;
            m_Entity.ProcessID = base.ProcessID;
            m_Entity.WorkItemID = base.WorkItemID;
            print.SetPrintBeginExport(m_print, m_Entity);
        }
        private void Print_OnAttachExport(object sender, EventArgs e)
        {
            if (m_print == null || m_Entity == null) return;
            Print print = new Print();

            print.SetPrintAttachExport(m_print, m_Entity);
        }