FundsSheetServerFunctions.cs
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using DirRX.Storage.FundsSheet;
namespace DirRX.Storage.Server
{
partial class FundsSheetFunctions
{
/// <summary>
/// Генерация тела документа.
/// </summary>
/// <returns>Версия документа.</returns>
[Public]
public virtual Sungero.Content.IElectronicDocumentVersions GenerateLastVersionFromReport()
{
var report = Storage.Reports.GetFundsSheetReport();
report.Entity = _obj;
_obj.Versions.AddNew();
var version = _obj.LastVersion;
using (var reportMS = new System.IO.MemoryStream())
{
var internalReport = (Sungero.Reporting.Shared.IInternalReport)report;
internalReport.InternalExecute(reportMS);
version.Body.Write(reportMS);
}
version.Note = report.FundsDate.HasValue ? report.FundsDate.Value.Year.ToString() : string.Empty;
version.Author = Users.Current;
version.AssociatedApplication = Sungero.Content.AssociatedApplications.GetByExtension("docx");
_obj.Save();
return version;
}
}
}