public ActionResult ArchiveDetails(Guid id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = stageRepository.GetStageByDeclaration(id); FillDeclarationControl(model.OBK_AssessmentDeclaration); var expDocumentResult = new OBKExpDocumentRepository().GetStageExpDocResult(model.DeclarationId); ViewBag.HasExpDocumentResult = expDocumentResult != null; return(PartialView("~/Views/SafetyAssessment/ArchiveDetails.cshtml", model)); }
/// <summary> /// Акт выполненных работ /// </summary> /// <returns></returns> public ActionResult CertOfComplectFilePdf(Guid id) { OBKExpDocumentRepository expRepo = new OBKExpDocumentRepository(); string name = "Акт выполненных работ.pdf"; StiReport report = new StiReport(); try { report.Load(Server.MapPath("~/Reports/Mrts/OBK/1c/ObkCertificateOfCompletion.mrt")); foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["AssessmentDeclarationId"].ValueObject = id; var declaration = expRepo.GetAssessmentDeclaration(id); report.Dictionary.Variables["ContractId"].ValueObject = declaration.ContractId; report.Dictionary.Variables["ValueAddedTax"].ValueObject = expRepo.GetValueAddedTax(); var refType = db.OBK_Ref_Type.FirstOrDefault(o => o.Id == declaration.TypeId); var expDocument = db.OBK_StageExpDocument.FirstOrDefault(o => o.AssessmentDeclarationId == id); decimal totalCount = 0; if (CodeConstManager.OBK_SA_PARTY.Equals(refType.Code) && expDocument.ExpResult == false) { totalCount = expRepo.GetContractPriceMotivationRefuse(expRepo.GetAssessmentDeclaration(id).ContractId); } else { totalCount = expRepo.GetContractPrice(expRepo.GetAssessmentDeclaration(id).ContractId); } report.Dictionary.Variables["TotalCount"].ValueObject = totalCount; var priceText = RuDateAndMoneyConverter.CurrencyToTxtTenge(Convert.ToDouble(totalCount), false); report.Dictionary.Variables["TotalCountText"].ValueObject = priceText; report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } var stream = new MemoryStream(); report.ExportDocument(StiExportFormat.Pdf, stream); stream.Position = 0; return(new FileStreamResult(stream, "application/pdf")); //return File(stream, "application/pdf", name); }
public ActionResult CertOfComplectFilePdf(Guid zbkCopyId) { OBKExpDocumentRepository expRepo = new OBKExpDocumentRepository(); string name = "Акт выполненных работ.pdf"; var copy = db.OBK_ZBKCopy.FirstOrDefault(o => o.Id == zbkCopyId); var expDocument = db.OBK_StageExpDocument.FirstOrDefault(o => o.Id == copy.OBK_StageExpDocumentId); StiReport report = new StiReport(); try { if (copy.ExpApplication == false) { report.Load(Server.MapPath("~/Reports/Mrts/OBK/1c/ObkCertificateOfCompletionCopyZbkApplication.mrt")); } else { report.Load(Server.MapPath("~/Reports/Mrts/OBK/1c/ObkCertificateOfCompletionCopyZbk.mrt")); } foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["AssessmentDeclarationId"].ValueObject = expDocument.AssessmentDeclarationId; report.Dictionary.Variables["ContractId"].ValueObject = expRepo.GetAssessmentDeclaration((Guid)expDocument.AssessmentDeclarationId).ContractId; var totalCount = payRepo.GetTotalPriceZbkCopy(zbkCopyId); report.Dictionary.Variables["TotalCount"].ValueObject = totalCount; var priceText = RuDateAndMoneyConverter.CurrencyToTxtTenge(Convert.ToDouble(totalCount), false); report.Dictionary.Variables["TotalCountText"].ValueObject = priceText; report.Dictionary.Variables["ZBKCopyId"].ValueObject = copy.Id; report.Dictionary.Variables["PriceNds"].ValueObject = repository.GetZbkCopyNds(zbkCopyId); report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } var stream = new MemoryStream(); report.ExportDocument(StiExportFormat.Pdf, stream); stream.Position = 0; return(new FileStreamResult(stream, "application/pdf")); }
//public int GetStage() //{ // return CodeConstManager.STAGE_OBK_COZ; //} /// <summary> /// выбор заявления /// </summary> /// <param name="id"></param> /// <returns></returns> public virtual ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = GetAssessmentStage(id); FillDeclarationControl(model.OBK_AssessmentDeclaration); var expDocumentResult = new OBKExpDocumentRepository().GetStageExpDocResult(model.DeclarationId); ViewBag.ExpDocumentResult = expDocumentResult?.ExpResult; if (model.OBK_Ref_Stage.Code == "15") { var userId = UserHelper.GetCurrentEmployee().Id; ViewBag.IsCommissionMember = new ncelsEntities() .OBK_OP_Commission .Any(x => x.DeclarationId == model.DeclarationId && x.EmployeeId == userId); } return(PartialView("~/Views/SafetyAssessment/Edit.cshtml", model)); }