Exemple #1
0
        public Structures.ApprovalRulesConsolidatedReport.TableLine CreateTableLine(string reportSessionId,
                                                                                    Sungero.Company.IBusinessUnit businessUnit,
                                                                                    Sungero.Company.IDepartment department,
                                                                                    Sungero.Docflow.IDocumentGroupBase category,
                                                                                    Sungero.Docflow.IApprovalRuleBase rule,
                                                                                    Sungero.Core.Enumeration flow,
                                                                                    string documentKind,
                                                                                    string documentParentType,
                                                                                    Dictionary <Sungero.Core.Enumeration, string> localizedValueCash)
        {
            var line = Structures.ApprovalRulesConsolidatedReport.TableLine.Create();

            line.BusinessUnit    = businessUnit != null ? businessUnit.Name : string.Empty;
            line.Department      = department != null ? department.Name : string.Empty;
            line.ReportSessionId = reportSessionId;
            line.Relation        = department != null && businessUnit != null && Equals(department.BusinessUnit, businessUnit) ? "+" : string.Empty;
            line.Category        = category != null ? category.Name : string.Empty;
            if (rule != null)
            {
                line.ApprovalRule         = rule.Name;
                line.ApprovalRuleId       = rule.Id;
                line.ApprovalRulePriority = rule.Priority;
                line.ApprovalRuleUrl      = Hyperlinks.Get(rule);
                line.Status = localizedValueCash[rule.Status.Value];
            }
            line.DocumentFlow       = localizedValueCash[flow];
            line.DocumentKind       = documentKind;
            line.DocumentParentType = documentParentType;
            return(line);
        }
Exemple #2
0
        /// <summary>
        /// Получить дочерние ящики подразделения.
        /// </summary>
        /// <param name="status">Статус ящика подразделения.</param>
        /// <returns>Список дочерних ящиков подразделений.</returns>
        public List <IDepartmentBox> GetChildBoxes(Sungero.Core.Enumeration status)
        {
            var resultBoxes = new List <IDepartmentBox>();
            var boxes       = DepartmentBoxes.GetAll(b => b.Status == status).ToList();
            var childBoxes  = boxes.Where(b => Equals(b.ParentBox, _obj)).ToList();

            while (childBoxes.Any())
            {
                resultBoxes.AddRange(childBoxes);
                var newBoxes = boxes.Where(b => childBoxes.Any(x => Equals(BoxBases.As(x), b.ParentBox))).ToList();
                childBoxes = newBoxes;
            }

            return(resultBoxes);
        }
Exemple #3
0
        /// <summary>
        /// Сгенерировать ФНС-ид (и связанные свойства) для документа.
        /// </summary>
        /// <param name="stream">Поток с XML в исходном виде.</param>
        /// <param name="rootBox">Ящик, через который будет отправлен документ.</param>
        /// <param name="counterparty">Контрагент.</param>
        /// <param name="formalizedServiceType">Тип документа (УПД, ДПТ, ДПРР).</param>
        /// <param name="isAdjustment">Корректировочный (важно только для УКД).</param>
        /// <returns>Сгенерированный XML новым потоком.</returns>
        private static System.IO.MemoryStream AddOrReplaceSellerTitleInfo(System.IO.MemoryStream stream, ExchangeCore.IBusinessUnitBox rootBox,
                                                                          Parties.ICounterparty counterparty, Sungero.Core.Enumeration formalizedServiceType,
                                                                          bool isAdjustment)
        {
            var counterpartyExchange = counterparty.ExchangeBoxes.SingleOrDefault(c => Equals(c.Box, rootBox));

            if (counterpartyExchange == null)
            {
                throw AppliedCodeException.Create(string.Format("Counterparty {0} must have exchange from box {1}", counterparty.Id, rootBox.Id));
            }

            var sellerTitleInfo = new FormalizeDocumentsParser.SellerTitleInfo();

            if (formalizedServiceType == Docflow.AccountingDocumentBase.FormalizedServiceType.GoodsTransfer)
            {
                sellerTitleInfo.DocumentType = FormalizeDocumentsParser.DocumentType.GoodsTransferDocument;
            }
            else if (formalizedServiceType == Docflow.AccountingDocumentBase.FormalizedServiceType.WorksTransfer)
            {
                sellerTitleInfo.DocumentType = FormalizeDocumentsParser.DocumentType.WorksTransferDocument;
            }
            else if (formalizedServiceType == Docflow.AccountingDocumentBase.FormalizedServiceType.GeneralTransfer)
            {
                sellerTitleInfo.DocumentType = isAdjustment ? FormalizeDocumentsParser.DocumentType.UniversalCorrectionTransferDocument : FormalizeDocumentsParser.DocumentType.UniversalTransferDocument;
            }

            if (rootBox.ExchangeService.ExchangeProvider == ExchangeCore.ExchangeService.ExchangeProvider.Diadoc)
            {
                sellerTitleInfo.Operator = FormalizeDocumentsParser.SupportedEdoOperators.Diadoc;
            }
            else
            {
                sellerTitleInfo.Operator = FormalizeDocumentsParser.SupportedEdoOperators.Synerdocs;
            }
            sellerTitleInfo.Receiver = counterpartyExchange.FtsId;
            sellerTitleInfo.Sender   = rootBox.FtsId;
            return(sellerTitleInfo.AddOrReplaceToXml(stream));
        }
Exemple #4
0
        public List <Structures.ApprovalRulesConsolidatedReport.TableLine> CreateTableDataLines(IEnumerable <IApprovalRuleBase> rules,
                                                                                                string reportSessionId,
                                                                                                Sungero.Company.IBusinessUnit businessUnit,
                                                                                                Sungero.Company.IDepartment department,
                                                                                                Sungero.Docflow.IDocumentGroupBase category,
                                                                                                Sungero.Core.Enumeration flow,
                                                                                                string documentKind,
                                                                                                string documentParentType,
                                                                                                Dictionary <Sungero.Core.Enumeration, string> localizedValueCash)
        {
            var result = new List <Structures.ApprovalRulesConsolidatedReport.TableLine>();

            if (!rules.Any())
            {
                var line = this.CreateTableLine(reportSessionId, businessUnit, department, category, null, flow, documentKind, documentParentType, localizedValueCash);
                result.Add(line);
            }

            foreach (var rule in rules)
            {
                var line = this.CreateTableLine(reportSessionId, businessUnit, department, category, rule, flow, documentKind, documentParentType, localizedValueCash);
                result.Add(line);
            }
            return(result);
        }