public void Execute(IJobExecutionContext context) { OBKPaymentRepository repo = new OBKPaymentRepository(); var acts = repo.GetCertificateOfCompletions(); foreach (var act in acts) { if (act.ZBKCopyId != null) { act.SendNotification = true; new NotificationManager().SendNotificationFromCompany( "Просим распечатать акт выполненных работ и предоставить Исполнителю с подписью и печатью.", ObjectType.OBK_ZBKCopy, act.ZBKCopyId.ToString(), (Guid)repo.GetZBKCopy((Guid)act.ZBKCopyId).EmployeeId); repo.UpdateNotificationToAct(act); } else { act.OBK_AssessmentDeclaration.StatusId = CodeConstManager.STATUS_OBK_SIGN_ACT; act.SendNotification = true; //отправка уведоления new NotificationManager().SendNotificationFromCompany( string.Format("По заявке №{0} вынесено решение. Просим распечатать акт выполненных работ и предоставить Исполнителю с подписью и печатью.", act.OBK_AssessmentDeclaration.Number), ObjectType.ObkDeclaration, act.OBK_AssessmentDeclaration.Id.ToString(), act.OBK_AssessmentDeclaration.EmployeeId); repo.UpdateNotificationToAct(act); } } }
public ActionResult GetPaymentTemplatePdf(Guid id) { var payRepo = new OBKPaymentRepository(); string name = "Счет на оплату.pdf"; StiReport report = new StiReport(); try { report.Load(Server.MapPath("~/Reports/Mrts/OBK/1c/ObkInvoicePayment.mrt")); foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["ContractId"].ValueObject = id; //итого var totalPriceWithCount = payRepo.GetTotalPriceCount(id); report.Dictionary.Variables["TotalPriceWithCount"].ValueObject = totalPriceWithCount; //в том числе НДС var totalPriceNDS = payRepo.GetTotalPriceNDS(totalPriceWithCount); report.Dictionary.Variables["TotalPriceNDS"].ValueObject = totalPriceNDS; //прописью var priceText = RuDateAndMoneyConverter.CurrencyToTxtTenge(Convert.ToDouble(totalPriceWithCount), false); report.Dictionary.Variables["TotalPriceWithCountName"].ValueObject = priceText; //report.Dictionary.Variables["ChiefAccountant"].ValueObject = payRepo.GetEmpoloyee(Guid.Parse("E1EE3658-0C35-41EB-99FD-FDDC4D07CEC4")); //report.Dictionary.Variables["Executor"].ValueObject = payRepo.GetEmpoloyee(Guid.Parse("55377FAC-A5F0-4093-BBB6-18BD28E53BE1")); report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } var stream = new MemoryStream(); var contractId = payRepo.GetContractIdGuid(id); var directionToPayment = payRepo.GetDirectionToPayments(contractId); var signPayment = payRepo.GetDirectionSignData(directionToPayment.Id); if (signPayment.ChiefAccountantSign != null && signPayment.ExecutorSign != null) { try { report.ExportDocument(StiExportFormat.Word2007, stream); stream.Position = 0; Aspose.Words.Document doc = new Aspose.Words.Document(stream); doc.InserQrCodesToEnd("ChiefAccountantSign", signPayment.ChiefAccountantSign); var pdfFile = new MemoryStream(); doc.Save(pdfFile, SaveFormat.Pdf); pdfFile.Position = 0; stream.Close(); return(new FileStreamResult(pdfFile, "application/pdf")); } catch (Exception e) { Console.WriteLine(e); } } report.ExportDocument(StiExportFormat.Pdf, stream); stream.Position = 0; return(new FileStreamResult(stream, "application/pdf")); }
public void Execute(IJobExecutionContext context) { OBKPaymentRepository repo = new OBKPaymentRepository(); // если есть оплата var declarantPiad = repo.GetDeclarantPaid(); foreach (var dPaid in declarantPiad) { //полная оплата if (dPaid.IsPaid && !dPaid.IsNotFullPaid) { //отправка уведоления new NotificationManager().SendNotificationFromCompany( string.Format("Оплата по счету {0} получена. Теперь Вы можете отправлять на рассмотрение заявку для проведения оценки безопасности качества", dPaid.InvoiceNumber1C), ObjectType.Unknown, dPaid.OBK_Contract.Id.ToString(), (Guid)dPaid.OBK_Contract.EmployeeId); repo.UpdateNotificationToPayment(dPaid, true); } } // если неполная оплата var declarantNotFullPiad = repo.GetDeclarantNotFullPaid(); foreach (var dNotFullPaid in declarantNotFullPiad) { if (dNotFullPaid.IsPaid && dNotFullPaid.IsNotFullPaid) { var pay = Math.Round((decimal)(dNotFullPaid.PaymentBill - dNotFullPaid.PaymentValue), 2); //отправка уведоления new NotificationManager().SendNotificationFromCompany( string.Format("Оплата по счету {0} получена не в полном размере. Просим оплатить остаток суммы {1} для дальнейшей подачи заявки", dNotFullPaid.InvoiceNumber1C, pay), ObjectType.Unknown, dNotFullPaid.OBK_Contract.Id.ToString(), (Guid)dNotFullPaid.OBK_Contract.EmployeeId); repo.UpdateNotificationToPayment(dNotFullPaid, false); } } // если прошел срок оплаты var paidExpired = repo.GetPaidExpired(); foreach (var pExpired in paidExpired) { repo.UpdateStatus(pExpired); } }