2023-03-03 合同打印修改,在线编辑文档控件增加
This commit is contained in:
@@ -397,354 +397,8 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
|
||||
Print(Id);
|
||||
BLL.PHTGL_ActionPlanFormationService.PrintFile( Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ActionPlanID
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public void Print(string Id)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
var lwfirwork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Id);
|
||||
initTemplatePath = "File\\Word\\PHTGL\\施工招标实施计划审批表.docx";
|
||||
if (lwfirwork != null)
|
||||
{
|
||||
if (PHTGL_ActionPlanReviewService.IsSpecialProject(lwfirwork.ProjectID))
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\施工招标实施计划审批表LW.docx";
|
||||
|
||||
}
|
||||
}
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
///更新书签
|
||||
var getFireWork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Id);
|
||||
var Act = PHTGL_ActionPlanReviewService.GetPHTGL_ActionPlanReviewByActionPlanID(Id);
|
||||
var list = PHTGL_ActionPlanFormation_Sch1Service.GetListPHTGL_ActionPlanFormation_Sch1ById(Id);
|
||||
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
Bookmark txtActionPlanCode = doc.Range.Bookmarks["ActionPlanCode"];
|
||||
Bookmark txtBidProject = doc.Range.Bookmarks["txtBidProject"];
|
||||
Bookmark txtName = doc.Range.Bookmarks["txtName"];
|
||||
Bookmark txtCreateTime = doc.Range.Bookmarks["CreateTime"];
|
||||
Bookmark txtProjectName = doc.Range.Bookmarks["txtProjectName"];
|
||||
Bookmark txtUnit = doc.Range.Bookmarks["txtUnit"];
|
||||
Bookmark txtConstructionSite = doc.Range.Bookmarks["txtConstructionSite"];
|
||||
Bookmark txtBiddingProjectScope = doc.Range.Bookmarks["txtBiddingProjectScope"];
|
||||
Bookmark txtBiddingProjectContent = doc.Range.Bookmarks["txtBiddingProjectContent"];
|
||||
Bookmark txtTimeRequirements = doc.Range.Bookmarks["txtTimeRequirements"];
|
||||
Bookmark txtQualityRequirement = doc.Range.Bookmarks["txtQualityRequirement"];
|
||||
Bookmark txtHSERequirement = doc.Range.Bookmarks["txtHSERequirement"];
|
||||
Bookmark txtTechnicalRequirement = doc.Range.Bookmarks["txtTechnicalRequirement"];
|
||||
Bookmark txtCurrentRequirement = doc.Range.Bookmarks["txtCurrentRequirement"];
|
||||
Bookmark txtSub_Selection = doc.Range.Bookmarks["txtSub_Selection"];
|
||||
Bookmark txtBid_Selection = doc.Range.Bookmarks["txtBid_Selection"];
|
||||
Bookmark txtContractingMode_Select = doc.Range.Bookmarks["txtContractingMode_Select"];
|
||||
Bookmark txtPriceMode_Select = doc.Range.Bookmarks["txtPriceMode_Select"];
|
||||
Bookmark txtMaterialsDifferentiate = doc.Range.Bookmarks["txtMaterialsDifferentiate"];
|
||||
Bookmark txtImportExplain = doc.Range.Bookmarks["txtImportExplain"];
|
||||
Bookmark txtShortNameList = doc.Range.Bookmarks["txtShortNameList"];
|
||||
Bookmark txtEvaluationMethods = doc.Range.Bookmarks["txtEvaluationMethods"];
|
||||
Bookmark txtEvaluationPlan = doc.Range.Bookmarks["txtEvaluationPlan"];
|
||||
Bookmark txtBiddingMethods_Select = doc.Range.Bookmarks["txtBiddingMethods_Select"];
|
||||
Bookmark txtSchedulePlan = doc.Range.Bookmarks["txtSchedulePlan"];
|
||||
#region 附件表
|
||||
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
for (int i = 1; i < 14; i++)
|
||||
{
|
||||
string txtPlanningContent = "txtPlanningContent" + Convert.ToString(i);
|
||||
string txtRemarks = "txtRemarks" + Convert.ToString(i);
|
||||
string value_ActionPlan = "";
|
||||
string value_Remarks = "";
|
||||
var model = list.Find(e => e.SortIndex == Convert.ToString(i));
|
||||
if (model != null)
|
||||
{
|
||||
value_ActionPlan = model.ActionPlan;
|
||||
value_Remarks = model.Remarks;
|
||||
}
|
||||
string[] key = { txtPlanningContent, txtRemarks };
|
||||
object[] value = { value_ActionPlan, value_Remarks };
|
||||
doc.MailMerge.Execute(key, value);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
if (txtActionPlanCode != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtActionPlanCode.Text = getFireWork.ActionPlanCode;
|
||||
}
|
||||
}
|
||||
if (txtName != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtName.Text = getFireWork.ProjectShortName;
|
||||
}
|
||||
|
||||
}
|
||||
if (txtBidProject != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
|
||||
txtBidProject.Text = getFireWork.BidProject;
|
||||
}
|
||||
}
|
||||
if (txtCreateTime != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
|
||||
txtCreateTime.Text = string.Format("{0:D}", getFireWork.CreateTime);
|
||||
}
|
||||
}
|
||||
if (Act != null)
|
||||
{
|
||||
if (Act.State == Const.ContractReview_Complete)
|
||||
{
|
||||
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", Act.Approval_Construction, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", Act.ConstructionManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "DeputyGeneralManager", Act.DeputyGeneralManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", Act.ProjectManager, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (txtProjectName != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtProjectName.Text = getFireWork.ProjectName;
|
||||
}
|
||||
}
|
||||
if (txtUnit != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtUnit.Text = getFireWork.Unit;
|
||||
|
||||
}
|
||||
}
|
||||
if (txtConstructionSite != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtConstructionSite.Text = getFireWork.ConstructionSite;
|
||||
|
||||
}
|
||||
}
|
||||
if (txtBiddingProjectScope != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtBiddingProjectScope.Text = getFireWork.BiddingProjectScope;
|
||||
|
||||
}
|
||||
}
|
||||
if (txtBiddingProjectContent != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtBiddingProjectContent.Text = getFireWork.BiddingProjectContent;
|
||||
|
||||
}
|
||||
}
|
||||
if (txtTimeRequirements != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtTimeRequirements.Text = getFireWork.TimeRequirements;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtQualityRequirement != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtQualityRequirement.Text = getFireWork.QualityRequirement;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtHSERequirement != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtHSERequirement.Text = getFireWork.HSERequirement;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtTechnicalRequirement != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtTechnicalRequirement.Text = getFireWork.TechnicalRequirement;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtCurrentRequirement != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtCurrentRequirement.Text = getFireWork.CurrentRequirement;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtSub_Selection != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtSub_Selection.Text = getFireWork.Sub_Selection;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtBid_Selection != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtBid_Selection.Text = getFireWork.Bid_Selection;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtContractingMode_Select != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtContractingMode_Select.Text = getFireWork.ContractingMode_Select;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtPriceMode_Select != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtPriceMode_Select.Text = getFireWork.PriceMode_Select;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtMaterialsDifferentiate != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtMaterialsDifferentiate.Text = getFireWork.MaterialsDifferentiate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtImportExplain != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtImportExplain.Text = getFireWork.ImportExplain;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtShortNameList != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtShortNameList.Text = getFireWork.ShortNameList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtEvaluationMethods != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtEvaluationMethods.Text = getFireWork.EvaluationMethods;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtEvaluationPlan != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtEvaluationPlan.Text = getFireWork.EvaluationPlan;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtBiddingMethods_Select != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtBiddingMethods_Select.Text = getFireWork.BiddingMethods_Select;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (txtSchedulePlan != null)
|
||||
{
|
||||
if (getFireWork != null)
|
||||
{
|
||||
txtSchedulePlan.Text = getFireWork.SchedulePlan;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(getFireWork.AttachUrlContent))
|
||||
{
|
||||
|
||||
var Path = newUrl.Replace(".docx", "编辑栏.docx"); //word文件保存路径
|
||||
AsposeWordHelper.HtmlIntoWord(getFireWork.AttachUrlContent, Path);
|
||||
Document doc2 = new Document(Path);
|
||||
DocumentBuilder builder = new DocumentBuilder(doc2);
|
||||
//doc2.FirstSection.PageSetup.SectionStart = SectionStart.OddPage;
|
||||
builder.PageSetup.PaperSize = PaperSize.A4;
|
||||
doc.AppendDocument(doc2, ImportFormatMode.UseDestinationStyles);
|
||||
doc.UpdateWordCount();
|
||||
File.Delete(Path);
|
||||
}
|
||||
|
||||
doc.Save(newUrl);
|
||||
//生成PDF文件
|
||||
string pdfUrl = newUrl.Replace(".docx", ".pdf");
|
||||
BLL.AsposeWordHelper.WordIntoPdf(newUrl, pdfUrl);
|
||||
//Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
////验证参数
|
||||
//if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
//doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
string fileName = Path.GetFileName(filePath).Replace("施工招标实施计划审批表", getFireWork.ActionPlanCode + "施工分包实施计划");
|
||||
FileInfo info = new FileInfo(pdfUrl);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(newUrl);
|
||||
File.Delete(pdfUrl);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -435,8 +435,10 @@
|
||||
return;
|
||||
}
|
||||
string ActionPlanID = Act.ActionPlanID;
|
||||
ActionPlanFormation actionPlanFormation = new ActionPlanFormation();
|
||||
actionPlanFormation.Print(ActionPlanID);
|
||||
//ActionPlanFormation actionPlanFormation = new ActionPlanFormation();
|
||||
//actionPlanFormation.Print(ActionPlanID);
|
||||
BLL.PHTGL_ActionPlanFormationService.PrintFile( ActionPlanID);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -378,91 +378,88 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 打印
|
||||
/// <summary>
|
||||
/// ApproveUserReviewById
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
public void Print(string Id)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
initTemplatePath = "File\\Word\\PHTGL\\施工招标评标小组名单审批表.docx";
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
///更新书签
|
||||
var getFireWork = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(Id);
|
||||
var Bid = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(getFireWork.BidDocumentsReviewId);
|
||||
var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Bid.ActionPlanID);
|
||||
#region 评标小组成员名单
|
||||
string strSql = @" SELECT Number = row_number() over(order by ID)
|
||||
,APP.ApproveUserName as Name
|
||||
,APP.ApproveUserSpecial as Special
|
||||
,APP.ApproveUserUnit as Unit
|
||||
,APP.Remarks as Remarks"
|
||||
+ @" FROM PHTGL_BidApproveUserReview_Sch1 AS APP "
|
||||
+ @"where 1=1 AND ApproveUserReviewID = @ApproveUserReviewID ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ApproveUserReviewID", Id));
|
||||
//public void Print(string Id)
|
||||
//{
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
// string initTemplatePath = string.Empty;
|
||||
// string uploadfilepath = string.Empty;
|
||||
// string newUrl = string.Empty;
|
||||
// string filePath = string.Empty;
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\施工招标评标小组名单审批表.docx";
|
||||
// uploadfilepath = rootPath + initTemplatePath;
|
||||
// newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
// filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
// if (File.Exists(newUrl))
|
||||
// {
|
||||
// File.Delete(newUrl);
|
||||
// }
|
||||
// File.Copy(uploadfilepath, newUrl);
|
||||
// ///更新书签
|
||||
// var getFireWork = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(Id);
|
||||
// var Bid = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(getFireWork.BidDocumentsReviewId);
|
||||
// var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Bid.ActionPlanID);
|
||||
// #region 评标小组成员名单
|
||||
// string strSql = @" SELECT Number = row_number() over(order by ID)
|
||||
// ,APP.ApproveUserName as Name
|
||||
// ,APP.ApproveUserSpecial as Special
|
||||
// ,APP.ApproveUserUnit as Unit
|
||||
// ,APP.Remarks as Remarks"
|
||||
// + @" FROM PHTGL_BidApproveUserReview_Sch1 AS APP "
|
||||
// + @"where 1=1 AND ApproveUserReviewID = @ApproveUserReviewID ";
|
||||
// List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
// listStr.Add(new SqlParameter("@ApproveUserReviewID", Id));
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
tb.TableName = "Table";
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
doc.MailMerge.ExecuteWithRegions(tb);
|
||||
#endregion
|
||||
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
Dic_File.Add("txtBidProject", getFireWork.BidProject);
|
||||
Dic_File.Add("txtBidDocumentCode", Bid.BidDocumentsCode);
|
||||
foreach (var item in Dic_File)
|
||||
{
|
||||
string[] key = { item.Key };
|
||||
object[] value = { item.Value };
|
||||
doc.MailMerge.Execute(key, value);
|
||||
// SqlParameter[] parameter = listStr.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// tb.TableName = "Table";
|
||||
// Document doc = new Aspose.Words.Document(newUrl);
|
||||
// doc.MailMerge.ExecuteWithRegions(tb);
|
||||
// #endregion
|
||||
// Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
// Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
// Dic_File.Add("txtBidProject", getFireWork.BidProject);
|
||||
// Dic_File.Add("txtBidDocumentCode", Bid.BidDocumentsCode);
|
||||
// foreach (var item in Dic_File)
|
||||
// {
|
||||
// string[] key = { item.Key };
|
||||
// object[] value = { item.Value };
|
||||
// doc.MailMerge.Execute(key, value);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
if (getFireWork.State == Const.ContractReview_Complete)
|
||||
{
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "DeputyGeneralManager", getFireWork.DeputyGeneralManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
// if (getFireWork.State == Const.ContractReview_Complete)
|
||||
// {
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "DeputyGeneralManager", getFireWork.DeputyGeneralManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
|
||||
}
|
||||
doc.Save(newUrl);
|
||||
//生成PDF文件
|
||||
string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
//验证参数
|
||||
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(pdfUrl);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(newUrl);
|
||||
File.Delete(pdfUrl);
|
||||
}
|
||||
// }
|
||||
// doc.Save(newUrl);
|
||||
// //生成PDF文件
|
||||
// string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
// Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
// //验证参数
|
||||
// if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
// doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
// string fileName = Path.GetFileName(filePath);
|
||||
// FileInfo info = new FileInfo(pdfUrl);
|
||||
// long fileSize = info.Length;
|
||||
// System.Web.HttpContext.Current.Response.Clear();
|
||||
// System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
// System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
// System.Web.HttpContext.Current.Response.Flush();
|
||||
// System.Web.HttpContext.Current.Response.Close();
|
||||
// File.Delete(newUrl);
|
||||
// File.Delete(pdfUrl);
|
||||
//}
|
||||
|
||||
protected void btnPrinter_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -472,7 +469,7 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
Print(Id);
|
||||
BLL.PHTGL_BidApproveUserReviewService.PrintFile( Id);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -416,99 +416,99 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
/// BidDocumentsReviewId
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public void Print(string Id)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
initTemplatePath = "File\\Word\\PHTGL\\招标文件审批表.docx";
|
||||
var lwfirwork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
|
||||
if (lwfirwork != null)
|
||||
{
|
||||
if (PHTGL_ActionPlanReviewService.IsSpecialProject(lwfirwork.ProjectId))
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\招标文件审批表LW.docx";
|
||||
//public void Print(string Id)
|
||||
//{
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
// string initTemplatePath = string.Empty;
|
||||
// string uploadfilepath = string.Empty;
|
||||
// string newUrl = string.Empty;
|
||||
// string filePath = string.Empty;
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\招标文件审批表.docx";
|
||||
// var lwfirwork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
|
||||
// if (lwfirwork != null)
|
||||
// {
|
||||
// if (PHTGL_ActionPlanReviewService.IsSpecialProject(lwfirwork.ProjectId))
|
||||
// {
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\招标文件审批表LW.docx";
|
||||
|
||||
}
|
||||
}
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
// }
|
||||
// }
|
||||
// uploadfilepath = rootPath + initTemplatePath;
|
||||
// newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
// filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
// if (File.Exists(newUrl))
|
||||
// {
|
||||
// File.Delete(newUrl);
|
||||
// }
|
||||
// File.Copy(uploadfilepath, newUrl);
|
||||
// Document doc = new Aspose.Words.Document(newUrl);
|
||||
|
||||
///更新书签
|
||||
var getFireWork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
|
||||
var Act = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(getFireWork.ActionPlanID);
|
||||
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
|
||||
var model_ControlManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ControlManager);
|
||||
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
|
||||
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
|
||||
// ///更新书签
|
||||
// var getFireWork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
|
||||
// var Act = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(getFireWork.ActionPlanID);
|
||||
// var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
|
||||
// var model_ControlManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ControlManager);
|
||||
// var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
|
||||
// var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
|
||||
|
||||
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
Dic_File.Add("txtCode", string.Format("{0:yyyyMMdd}", Convert.ToDateTime(getFireWork.CreatTime)));
|
||||
Dic_File.Add("txtBidDocumentCode", getFireWork.BidDocumentsCode);
|
||||
Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
Dic_File.Add("txtProjectCode", Act.ProjectCode);
|
||||
Dic_File.Add("txtBidContent", getFireWork.BidContent);
|
||||
Dic_File.Add("txtBidType", getFireWork.BidType);
|
||||
Dic_File.Add("txtBidDocumentsName", getFireWork.BidDocumentsName);
|
||||
Dic_File.Add("Bidding_SendTime", string.Format("{0:D}", getFireWork.Bidding_SendTime));
|
||||
Dic_File.Add("Bidding_StartTime", string.Format("{0:D}", getFireWork.Bidding_StartTime));
|
||||
// Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
// Dic_File.Add("txtCode", string.Format("{0:yyyyMMdd}", Convert.ToDateTime(getFireWork.CreatTime)));
|
||||
// Dic_File.Add("txtBidDocumentCode", getFireWork.BidDocumentsCode);
|
||||
// Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
// Dic_File.Add("txtProjectCode", Act.ProjectCode);
|
||||
// Dic_File.Add("txtBidContent", getFireWork.BidContent);
|
||||
// Dic_File.Add("txtBidType", getFireWork.BidType);
|
||||
// Dic_File.Add("txtBidDocumentsName", getFireWork.BidDocumentsName);
|
||||
// Dic_File.Add("Bidding_SendTime", string.Format("{0:D}", getFireWork.Bidding_SendTime));
|
||||
// Dic_File.Add("Bidding_StartTime", string.Format("{0:D}", getFireWork.Bidding_StartTime));
|
||||
|
||||
if (getFireWork.State == Const.ContractReview_Complete)
|
||||
{
|
||||
Dic_File.Add("ConstructionManagerTime", string.Format("{0:D}", DateTime.Parse(model_ConstructionManager.ApproveDate)));
|
||||
Dic_File.Add("ControlManagerTime", string.Format("{0:D}", DateTime.Parse(model_ControlManager.ApproveDate)));
|
||||
Dic_File.Add("Approval_ConstructionTime", string.Format("{0:D}", DateTime.Parse(model_Approval_Construction.ApproveDate)));
|
||||
Dic_File.Add("ProjectManagerTime", string.Format("{0:D}", DateTime.Parse(model_ProjectManager.ApproveDate)));
|
||||
// if (getFireWork.State == Const.ContractReview_Complete)
|
||||
// {
|
||||
// Dic_File.Add("ConstructionManagerTime", string.Format("{0:D}", DateTime.Parse(model_ConstructionManager.ApproveDate)));
|
||||
// Dic_File.Add("ControlManagerTime", string.Format("{0:D}", DateTime.Parse(model_ControlManager.ApproveDate)));
|
||||
// Dic_File.Add("Approval_ConstructionTime", string.Format("{0:D}", DateTime.Parse(model_Approval_Construction.ApproveDate)));
|
||||
// Dic_File.Add("ProjectManagerTime", string.Format("{0:D}", DateTime.Parse(model_ProjectManager.ApproveDate)));
|
||||
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ControlManager", getFireWork.ControlManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
Dic_File.Add("ConstructionManagerTime", " 年 月 日");
|
||||
Dic_File.Add("ControlManagerTime", " 年 月 日");
|
||||
Dic_File.Add("Approval_ConstructionTime", " 年 月 日");
|
||||
Dic_File.Add("ProjectManagerTime", " 年 月 日");
|
||||
}
|
||||
foreach (var item in Dic_File)
|
||||
{
|
||||
string[] key = { item.Key };
|
||||
object[] value = { item.Value };
|
||||
doc.MailMerge.Execute(key, value);
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ControlManager", getFireWork.ControlManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Dic_File.Add("ConstructionManagerTime", " 年 月 日");
|
||||
// Dic_File.Add("ControlManagerTime", " 年 月 日");
|
||||
// Dic_File.Add("Approval_ConstructionTime", " 年 月 日");
|
||||
// Dic_File.Add("ProjectManagerTime", " 年 月 日");
|
||||
// }
|
||||
// foreach (var item in Dic_File)
|
||||
// {
|
||||
// string[] key = { item.Key };
|
||||
// object[] value = { item.Value };
|
||||
// doc.MailMerge.Execute(key, value);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
doc.Save(newUrl);
|
||||
//生成PDF文件
|
||||
string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
//验证参数
|
||||
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
string fileName = Path.GetFileName(filePath).Replace("招标文件审批表", getFireWork.BidDocumentsCode + "招标文件审批表");
|
||||
FileInfo info = new FileInfo(pdfUrl);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(newUrl);
|
||||
File.Delete(pdfUrl);
|
||||
}
|
||||
// doc.Save(newUrl);
|
||||
// //生成PDF文件
|
||||
// string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
// Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
// //验证参数
|
||||
// if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
// doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
// string fileName = Path.GetFileName(filePath).Replace("招标文件审批表", getFireWork.BidDocumentsCode + "招标文件审批表");
|
||||
// FileInfo info = new FileInfo(pdfUrl);
|
||||
// long fileSize = info.Length;
|
||||
// System.Web.HttpContext.Current.Response.Clear();
|
||||
// System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
// System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
// System.Web.HttpContext.Current.Response.Flush();
|
||||
// System.Web.HttpContext.Current.Response.Close();
|
||||
// File.Delete(newUrl);
|
||||
// File.Delete(pdfUrl);
|
||||
//}
|
||||
|
||||
protected void btnPrinter_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -518,7 +518,7 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
Print(Id);
|
||||
BLL.PHTGL_BidDocumentsReviewService.PrintFile(Id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -214,12 +214,7 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
|
||||
private bool Save()
|
||||
{
|
||||
if (DropDepart.SelectedValue == Const._Null)
|
||||
{
|
||||
ShowNotify("请选择部门!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//if (Approval_Construction.SelectedValue==Const._Null)
|
||||
//{
|
||||
// ShowNotify("请选择施工管理部审批人员!", MessageBoxIcon.Warning);
|
||||
|
||||
@@ -475,164 +475,164 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
/// SetSubReviewID
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public void Print(string Id)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
string strSql = "";
|
||||
var getFireWork = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewById(Id);
|
||||
var BidUser = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(getFireWork.ApproveUserReviewID);
|
||||
var BidDoc = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(BidUser.BidDocumentsReviewId);
|
||||
var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(BidDoc.ActionPlanID);
|
||||
//public void Print(string Id)
|
||||
//{
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
// string initTemplatePath = string.Empty;
|
||||
// string uploadfilepath = string.Empty;
|
||||
// string newUrl = string.Empty;
|
||||
// string filePath = string.Empty;
|
||||
// string strSql = "";
|
||||
// var getFireWork = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewById(Id);
|
||||
// var BidUser = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(getFireWork.ApproveUserReviewID);
|
||||
// var BidDoc = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(BidUser.BidDocumentsReviewId);
|
||||
// var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(BidDoc.ActionPlanID);
|
||||
|
||||
|
||||
switch (getFireWork.Type)
|
||||
{
|
||||
case PHTGL_SetSubReviewService.Type_ConEvaluation:
|
||||
if (Act != null)
|
||||
{
|
||||
if (PHTGL_ActionPlanReviewService.IsSpecialProject(Act.ProjectID))
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于综合评估法)LW.docx";
|
||||
// switch (getFireWork.Type)
|
||||
// {
|
||||
// case PHTGL_SetSubReviewService.Type_ConEvaluation:
|
||||
// if (Act != null)
|
||||
// {
|
||||
// if (PHTGL_ActionPlanReviewService.IsSpecialProject(Act.ProjectID))
|
||||
// {
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于综合评估法)LW.docx";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于综合评估法).docx";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于综合评估法).docx";
|
||||
|
||||
}
|
||||
}
|
||||
strSql = @" SELECT
|
||||
Sch2.Company as Company
|
||||
,Sch2.Price_ReviewResults as Price_ReviewResults
|
||||
,Sch2.Skill_ReviewResults as Skill_ReviewResults
|
||||
,Sch2.Business_ReviewResults as Business_ReviewResults
|
||||
,Sch2.Synthesize_ReviewResults as Synthesize_ReviewResults
|
||||
,Sch2.Remarks as Remarks "
|
||||
+ @" FROM PHTGL_SetSubReview_Sch2 AS Sch2 "
|
||||
+ @"where 1=1 AND SetSubReviewID = @SetSubReviewID order by SortIndex ";
|
||||
break;
|
||||
case PHTGL_SetSubReviewService.Type_MinPrice:
|
||||
if (Act != null)
|
||||
{
|
||||
if (PHTGL_ActionPlanReviewService.IsSpecialProject(Act.ProjectID))
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于经评审的最低投标报价法)LW.docx";
|
||||
// }
|
||||
// }
|
||||
// strSql = @" SELECT
|
||||
// Sch2.Company as Company
|
||||
// ,Sch2.Price_ReviewResults as Price_ReviewResults
|
||||
// ,Sch2.Skill_ReviewResults as Skill_ReviewResults
|
||||
// ,Sch2.Business_ReviewResults as Business_ReviewResults
|
||||
// ,Sch2.Synthesize_ReviewResults as Synthesize_ReviewResults
|
||||
// ,Sch2.Remarks as Remarks "
|
||||
// + @" FROM PHTGL_SetSubReview_Sch2 AS Sch2 "
|
||||
// + @"where 1=1 AND SetSubReviewID = @SetSubReviewID order by SortIndex ";
|
||||
// break;
|
||||
// case PHTGL_SetSubReviewService.Type_MinPrice:
|
||||
// if (Act != null)
|
||||
// {
|
||||
// if (PHTGL_ActionPlanReviewService.IsSpecialProject(Act.ProjectID))
|
||||
// {
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于经评审的最低投标报价法)LW.docx";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于经评审的最低投标报价法).docx";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// initTemplatePath = "File\\Word\\PHTGL\\确定分包商审批表(用于经评审的最低投标报价法).docx";
|
||||
|
||||
}
|
||||
}
|
||||
strSql = @" SELECT
|
||||
Sch1.Company as Company
|
||||
,Sch1.ReviewResults as ReviewResults
|
||||
,Sch1.Remarks as Remarks "
|
||||
+ @" FROM PHTGL_SetSubReview_Sch1 AS Sch1 "
|
||||
+ @"where 1=1 AND SetSubReviewID = @SetSubReviewID order by SortIndex ";
|
||||
break;
|
||||
default: /* 可选的 */
|
||||
Alert.ShowInTop("请先编制审批类型!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// }
|
||||
// }
|
||||
// strSql = @" SELECT
|
||||
// Sch1.Company as Company
|
||||
// ,Sch1.ReviewResults as ReviewResults
|
||||
// ,Sch1.Remarks as Remarks "
|
||||
// + @" FROM PHTGL_SetSubReview_Sch1 AS Sch1 "
|
||||
// + @"where 1=1 AND SetSubReviewID = @SetSubReviewID order by SortIndex ";
|
||||
// break;
|
||||
// default: /* 可选的 */
|
||||
// Alert.ShowInTop("请先编制审批类型!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// uploadfilepath = rootPath + initTemplatePath;
|
||||
// newUrl = uploadfilepath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".docx");
|
||||
// filePath = initTemplatePath.Replace(".docx", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
|
||||
// if (File.Exists(newUrl))
|
||||
// {
|
||||
// File.Delete(newUrl);
|
||||
// }
|
||||
// File.Copy(uploadfilepath, newUrl);
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@SetSubReviewID", Id));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
tb.TableName = "Table";
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
doc.MailMerge.ExecuteWithRegions(tb);
|
||||
// List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
// listStr.Add(new SqlParameter("@SetSubReviewID", Id));
|
||||
// SqlParameter[] parameter = listStr.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// tb.TableName = "Table";
|
||||
// Document doc = new Aspose.Words.Document(newUrl);
|
||||
// doc.MailMerge.ExecuteWithRegions(tb);
|
||||
|
||||
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
|
||||
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
|
||||
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
|
||||
var model_DeputyGeneralManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.DeputyGeneralManager);
|
||||
// var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
|
||||
// var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
|
||||
// var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
|
||||
// var model_DeputyGeneralManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.DeputyGeneralManager);
|
||||
|
||||
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
Dic_File.Add("txtSetSubReviewCode", getFireWork.SetSubReviewCode);
|
||||
Dic_File.Add("txtBidDocumentsCode", BidDoc.BidDocumentsCode);
|
||||
Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
Dic_File.Add("txtBidContent", BidDoc.BidContent);
|
||||
Dic_File.Add("txtBidding_StartTime", string.Format("{0:D}", BidDoc.Bidding_StartTime));
|
||||
// Dictionary<string, object> Dic_File = new Dictionary<string, object>();
|
||||
// Dic_File.Add("txtSetSubReviewCode", getFireWork.SetSubReviewCode);
|
||||
// Dic_File.Add("txtBidDocumentsCode", BidDoc.BidDocumentsCode);
|
||||
// Dic_File.Add("txtProjectName", Act.ProjectShortName);
|
||||
// Dic_File.Add("txtBidContent", BidDoc.BidContent);
|
||||
// Dic_File.Add("txtBidding_StartTime", string.Format("{0:D}", BidDoc.Bidding_StartTime));
|
||||
|
||||
if (getFireWork.State == Const.ContractReview_Complete)
|
||||
{
|
||||
// if (getFireWork.State == Const.ContractReview_Complete)
|
||||
// {
|
||||
|
||||
Dic_File.Add("txtConstructionManagerIdea", model_ConstructionManager.ApproveIdea.Length > 3 ? model_ConstructionManager.ApproveIdea : "同意");
|
||||
Dic_File.Add("ConstructionManagerTime", string.Format("{0:D}", DateTime.Parse(model_ConstructionManager.ApproveDate)));
|
||||
// Dic_File.Add("txtConstructionManagerIdea", model_ConstructionManager.ApproveIdea.Length > 3 ? model_ConstructionManager.ApproveIdea : "同意");
|
||||
// Dic_File.Add("ConstructionManagerTime", string.Format("{0:D}", DateTime.Parse(model_ConstructionManager.ApproveDate)));
|
||||
|
||||
Dic_File.Add("txtApproval_ConstructionIdea", model_Approval_Construction.ApproveIdea.Length > 3 ? model_Approval_Construction.ApproveIdea : "同意");
|
||||
Dic_File.Add("Approval_ConstructionTime", string.Format("{0:D}", DateTime.Parse(model_Approval_Construction.ApproveDate)));
|
||||
// Dic_File.Add("txtApproval_ConstructionIdea", model_Approval_Construction.ApproveIdea.Length > 3 ? model_Approval_Construction.ApproveIdea : "同意");
|
||||
// Dic_File.Add("Approval_ConstructionTime", string.Format("{0:D}", DateTime.Parse(model_Approval_Construction.ApproveDate)));
|
||||
|
||||
Dic_File.Add("ProjectManagerIdea", model_ProjectManager.ApproveIdea.Length > 3 ? model_ProjectManager.ApproveIdea : "同意");
|
||||
Dic_File.Add("ProjectManagerTime", string.Format("{0:D}", DateTime.Parse(model_ProjectManager.ApproveDate)));
|
||||
// Dic_File.Add("ProjectManagerIdea", model_ProjectManager.ApproveIdea.Length > 3 ? model_ProjectManager.ApproveIdea : "同意");
|
||||
// Dic_File.Add("ProjectManagerTime", string.Format("{0:D}", DateTime.Parse(model_ProjectManager.ApproveDate)));
|
||||
|
||||
Dic_File.Add("txtDeputyGeneralManagerIdea", model_DeputyGeneralManager.ApproveIdea.Length > 3 ? model_DeputyGeneralManager.ApproveIdea : "同意");
|
||||
Dic_File.Add("DeputyGeneralManagerTime", string.Format("{0:D}", DateTime.Parse(model_DeputyGeneralManager.ApproveDate)));
|
||||
// Dic_File.Add("txtDeputyGeneralManagerIdea", model_DeputyGeneralManager.ApproveIdea.Length > 3 ? model_DeputyGeneralManager.ApproveIdea : "同意");
|
||||
// Dic_File.Add("DeputyGeneralManagerTime", string.Format("{0:D}", DateTime.Parse(model_DeputyGeneralManager.ApproveDate)));
|
||||
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "DeputyGeneralManager", getFireWork.DeputyGeneralManager, "");
|
||||
AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "Approval_Construction", getFireWork.Approval_Construction, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ConstructionManager", getFireWork.ConstructionManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "DeputyGeneralManager", getFireWork.DeputyGeneralManager, "");
|
||||
// AsposeWordHelper.InsertImg(doc, rootPath, "ProjectManager", getFireWork.ProjectManager, "");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Dic_File.Add("txtConstructionManagerIdea", "");
|
||||
Dic_File.Add("ConstructionManagerTime", " 年 月 日");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Dic_File.Add("txtConstructionManagerIdea", "");
|
||||
// Dic_File.Add("ConstructionManagerTime", " 年 月 日");
|
||||
|
||||
Dic_File.Add("txtApproval_ConstructionIdea", "");
|
||||
Dic_File.Add("Approval_ConstructionTime", " 年 月 日");
|
||||
// Dic_File.Add("txtApproval_ConstructionIdea", "");
|
||||
// Dic_File.Add("Approval_ConstructionTime", " 年 月 日");
|
||||
|
||||
Dic_File.Add("ProjectManagerIdea", "");
|
||||
Dic_File.Add("ProjectManagerTime", " 年 月 日");
|
||||
// Dic_File.Add("ProjectManagerIdea", "");
|
||||
// Dic_File.Add("ProjectManagerTime", " 年 月 日");
|
||||
|
||||
Dic_File.Add("txtDeputyGeneralManagerIdea", "");
|
||||
Dic_File.Add("DeputyGeneralManagerTime", " 年 月 日");
|
||||
// Dic_File.Add("txtDeputyGeneralManagerIdea", "");
|
||||
// Dic_File.Add("DeputyGeneralManagerTime", " 年 月 日");
|
||||
|
||||
}
|
||||
foreach (var item in Dic_File)
|
||||
{
|
||||
string[] key = { item.Key };
|
||||
object[] value = { item.Value };
|
||||
doc.MailMerge.Execute(key, value);
|
||||
}
|
||||
// }
|
||||
// foreach (var item in Dic_File)
|
||||
// {
|
||||
// string[] key = { item.Key };
|
||||
// object[] value = { item.Value };
|
||||
// doc.MailMerge.Execute(key, value);
|
||||
// }
|
||||
|
||||
|
||||
doc.Save(newUrl);
|
||||
//生成PDF文件
|
||||
string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
//验证参数
|
||||
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(pdfUrl);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(newUrl);
|
||||
File.Delete(pdfUrl);
|
||||
}
|
||||
// doc.Save(newUrl);
|
||||
// //生成PDF文件
|
||||
// string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
// Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
// //验证参数
|
||||
// if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
// doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
// string fileName = Path.GetFileName(filePath);
|
||||
// FileInfo info = new FileInfo(pdfUrl);
|
||||
// long fileSize = info.Length;
|
||||
// System.Web.HttpContext.Current.Response.Clear();
|
||||
// System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
// System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
// System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
// System.Web.HttpContext.Current.Response.Flush();
|
||||
// System.Web.HttpContext.Current.Response.Close();
|
||||
// File.Delete(newUrl);
|
||||
// File.Delete(pdfUrl);
|
||||
//}
|
||||
|
||||
protected void btnPrinter_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -642,7 +642,7 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
Print(Id);
|
||||
BLL.PHTGL_SetSubReviewService.PrintFile(Id);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -419,7 +419,7 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
BLL.PHTGL_ContractReviewService.Print(Id);
|
||||
BLL.PHTGL_ContractReviewService.PrintFile(Id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace FineUIPro.Web.PHTGL.ContractCompile
|
||||
string Id = Grid1.SelectedRowID;
|
||||
//ContractReview contractReview = new ContractReview();
|
||||
//contractReview.Print(Id);
|
||||
BLL.PHTGL_ContractReviewService.Print(Id);
|
||||
BLL.PHTGL_ContractReviewService.PrintFile(Id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,11 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
}
|
||||
if (e.CommandName == "export")
|
||||
{
|
||||
ActionPlanFormation actionPlanFormation = new ActionPlanFormation();
|
||||
//ActionPlanFormation actionPlanFormation = new ActionPlanFormation();
|
||||
var Act = BLL.PHTGL_ActionPlanReviewService.GetPHTGL_ActionPlanReviewById(fileId);
|
||||
actionPlanFormation.Print(Act.ActionPlanID);
|
||||
//actionPlanFormation.Print(Act.ActionPlanID);
|
||||
BLL.PHTGL_ActionPlanFormationService.PrintFile( Act.ActionPlanID);
|
||||
|
||||
return;
|
||||
}
|
||||
if (e.CommandName == "download")
|
||||
@@ -209,8 +211,8 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
return;
|
||||
}
|
||||
string ActionPlanID = Act.ActionPlanID;
|
||||
ActionPlanFormation actionPlanFormation = new ActionPlanFormation();
|
||||
actionPlanFormation.Print(ActionPlanID);
|
||||
BLL.PHTGL_ActionPlanFormationService.PrintFile(ActionPlanID);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -105,8 +105,10 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
}
|
||||
if (e.CommandName == "export")
|
||||
{
|
||||
ApproveUserReview approveUserReview = new ApproveUserReview();
|
||||
approveUserReview.Print(fileId);
|
||||
BLL.PHTGL_BidApproveUserReviewService.PrintFile( fileId);
|
||||
|
||||
//ApproveUserReview approveUserReview = new ApproveUserReview();
|
||||
//approveUserReview.Print(fileId);
|
||||
return;
|
||||
}
|
||||
if (e.CommandName == "download")
|
||||
|
||||
@@ -135,8 +135,10 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
}
|
||||
if (e.CommandName == "export")
|
||||
{
|
||||
BidDocumentsReview bidDocumentsReview = new BidDocumentsReview();
|
||||
bidDocumentsReview.Print(fileId);
|
||||
BLL.PHTGL_BidDocumentsReviewService.PrintFile(fileId);
|
||||
|
||||
//BidDocumentsReview bidDocumentsReview = new BidDocumentsReview();
|
||||
//bidDocumentsReview.Print(fileId);
|
||||
return;
|
||||
}
|
||||
if (e.CommandName == "download")
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
BLL.PHTGL_ContractReviewService.Print(Id);
|
||||
BLL.PHTGL_ContractReviewService.PrintFile(Id);
|
||||
|
||||
//BLL.Common.FastReport.ResetData();
|
||||
//Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
|
||||
@@ -145,8 +145,10 @@ namespace FineUIPro.Web.PHTGL.Filing
|
||||
|
||||
if (e.CommandName == "export")
|
||||
{
|
||||
SetSubReview setSubReview = new SetSubReview();
|
||||
setSubReview.Print(fileId);
|
||||
BLL.PHTGL_SetSubReviewService.PrintFile(fileId);
|
||||
|
||||
//SetSubReview setSubReview = new SetSubReview();
|
||||
//setSubReview.Print(fileId);
|
||||
return;
|
||||
}
|
||||
if (e.CommandName == "download")
|
||||
|
||||
Reference in New Issue
Block a user