示例#1
0
        public byte[] GetPDF(string documentId, Int32 documentTypeId, BaseController claimsApiController, out String name, Boolean isEmpty)
        {
            Int32 serviceTypeId            = _context.DocumentPrintTypes.SingleOrDefault(x => x.Id == documentTypeId).ServiceTypeId.Value;
            ConsumerPrintDocument document = null;

            if (!String.IsNullOrEmpty(documentId))
            {
                document = this.GetDocument(Int32.Parse(documentId));
            }

            String partName = "New";

            name = "";

            if (document != null && !isEmpty)
            {
                partName = this.ConvertInvalidFilePathChars(this.GetContactName(document.Contact));
            }

            var reportViewer = new ReportViewer();

            reportViewer.Reset();
            reportViewer.LocalReport.EnableExternalImages = true;
            reportViewer.ProcessingMode = ProcessingMode.Local;

            IPDFreportModel reportTypeInstance = ReportTypesFactory.GetAppropriatePDFreportType((ServiceTypeIdEnum)serviceTypeId, (DocumentPrintTypeEnum)documentTypeId);

            reportViewer.LocalReport.ReportPath = claimsApiController.Server.MapPath(reportTypeInstance.ReportPath);
            name = reportTypeInstance.GetName(partName);

            var timeObjs = reportTypeInstance.CreateDataSet(document, isEmpty, this);

            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", timeObjs));
            return(RenderPDF(reportViewer));
        }
示例#2
0
        public ConsumerPrintDocument GetModel()
        {
            ConsumerPrintDocument model = new ConsumerPrintDocument();

            if (this.ConsumerPrintDocumentId.HasValue)
            {
                model.Id = this.ConsumerPrintDocumentId.Value;
            }
            else
            {
                model.Id = 0;
            }
            model.ContactId        = this.ContactId;
            model.StatusId         = this.StatusId;
            model.ConsumerId       = this.ConsumerId;
            model.AddedById        = this.AddedById;
            model.UpdatedById      = this.UpdatedById;
            model.ServiceAction1   = this.ServiceAction1;
            model.ServiceAction2   = this.ServiceAction2;
            model.ServiceAction3   = this.ServiceAction3;
            model.ServiceAction4   = this.ServiceAction4;
            model.DateCreated      = this.DateCreated;
            model.DateUpdated      = this.DateUpdated;
            model.Notes            = this.Notes;
            model.EffectiveDate    = this.EffectiveDate;
            model.ServiceTypeId    = this.ServiceTypeId;
            model.ServiceTypeTitle = this.ServiceTypeTitle;
            return(model);
        }
示例#3
0
        public String GetServices(ConsumerPrintDocument document)
        {
            String result = "";
            Int32  i      = 0;

            if (document.ConsumerPrintDocumentValuedOutcomes != null)
            {
                foreach (var valued in document.ConsumerPrintDocumentValuedOutcomes)
                {
                    if (valued.ConsumerPrintDocumentVOServeActions != null)
                    {
                        foreach (var action in valued.ConsumerPrintDocumentVOServeActions)
                        {
                            String item = action.ServeAndAction;
                            if (!String.IsNullOrEmpty(item))
                            {
                                result += "<B>" + (i + 1).ToString() + ". </B><I>" + item + "</I><BR/>";
                                i++;
                            }
                        }
                    }
                }
            }
            return(result);
        }
示例#4
0
        public async Task <Int32> Save(ConsumerPrintDocument dbModel, List <ConsumerPrintDocumentValuedOutcome> outcomes, List <ConsumerPrintDocumentVOServeAction> actions)
        {
            if (dbModel.Id == 0)
            {
                _context.ConsumerPrintDocuments.Add(dbModel);
            }
            else
            {
                var model = await _context.ConsumerPrintDocuments.SingleOrDefaultAsync(x => x.Id == dbModel.Id);

                if (model != null)
                {
                    model.ContactId        = dbModel.ContactId;
                    model.AddedById        = dbModel.AddedById;
                    model.UpdatedById      = dbModel.UpdatedById;
                    model.ServiceAction1   = dbModel.ServiceAction1;
                    model.ServiceAction2   = dbModel.ServiceAction2;
                    model.ServiceAction3   = dbModel.ServiceAction3;
                    model.ServiceAction4   = dbModel.ServiceAction4;
                    model.DateCreated      = dbModel.DateCreated;
                    model.DateUpdated      = dbModel.DateUpdated;
                    model.Notes            = dbModel.Notes;
                    model.EffectiveDate    = dbModel.EffectiveDate;
                    model.ServiceTypeId    = dbModel.ServiceTypeId;
                    model.ServiceTypeTitle = dbModel.ServiceTypeTitle;
                    var outcomes_old = _context.ConsumerPrintDocumentValuedOutcomes.Where(x => x.PrintDocumentId == dbModel.Id);
                    var actions_old  = _context.ConsumerPrintDocumentVOServeActions.Where(x => outcomes_old.Any(z => z.Id == x.PrintDocumentValuedOutcomeId));
                    _context.ConsumerPrintDocumentVOServeActions.RemoveRange(actions_old);
                    _context.ConsumerPrintDocumentValuedOutcomes.RemoveRange(outcomes_old);
                }
            }
            await _context.SaveChangesAsync();

            if (outcomes.Count > 0)
            {
                foreach (var outcome in outcomes)
                {
                    outcome.PrintDocumentId = dbModel.Id;
                    Int32 tempId = outcome.Id;
                    outcome.Id = 0;
                    _context.ConsumerPrintDocumentValuedOutcomes.Add(outcome);
                    await _context.SaveChangesAsync();

                    foreach (var action in actions)
                    {
                        if (action.PrintDocumentValuedOutcomeId == tempId && tempId < 0)
                        {
                            action.PrintDocumentValuedOutcomeId = outcome.Id;
                            _context.ConsumerPrintDocumentVOServeActions.Add(action);
                        }
                    }
                }
                await _context.SaveChangesAsync();
            }
            return(dbModel.Id);
        }
示例#5
0
        public ConsumerPrintDocumentViewModel(ConsumerPrintDocument model)
        {
            this.ConsumerPrintDocumentId = model.Id;
            this.ContactId    = model.ContactId;
            this.ContactName  = model.Contact.LastName + ", " + model.Contact.FirstName;
            this.ContactEmail = model.Contact.EmailAddress;
            this.StatusId     = model.StatusId;
            this.StatusName   = model.DocumentPrintStatus.Name;
            this.ConsumerId   = model.ConsumerId;
            this.AddedById    = model.AddedById;
            this.AddedByName  = model.SystemUser.LastName + ", " + model.SystemUser.FirstName;
            this.UpdatedById  = model.UpdatedById;
            if (this.UpdatedById.HasValue)
            {
                this.UpdatedByName = model.SystemUser1.LastName + ", " + model.SystemUser1.FirstName;
            }
            this.ServiceAction1   = model.ServiceAction1;
            this.ServiceAction2   = model.ServiceAction2;
            this.ServiceAction3   = model.ServiceAction3;
            this.ServiceAction4   = model.ServiceAction4;
            this.DateCreated      = model.DateCreated;
            this.DateUpdated      = model.DateUpdated;
            this.Notes            = model.Notes;
            this.EffectiveDate    = model.EffectiveDate;
            this.ServiceTypeId    = model.ServiceTypeId;
            this.ServiceTypeTitle = model.ServiceTypeTitle;
            if (model.ServiceTypeId.HasValue)
            {
                if (!string.IsNullOrEmpty(this.ServiceTypeTitle))
                {
                    this.ServiceTypeName = this.ServiceTypeTitle;
                }
                else
                {
                    this.ServiceTypeName = model.ServiceType.Name;
                }
            }



            if (model.ConsumerPrintDocumentValuedOutcomes != null)
            {
                this.ValuedOutcomes = ConsumerPrintDocumentValuedOutcomeViewModel.GetList(model.ConsumerPrintDocumentValuedOutcomes.ToList());
            }
            else
            {
                this.ValuedOutcomes = new List <ConsumerPrintDocumentValuedOutcomeViewModel>();
            }
        }
示例#6
0
        private string GetRate(ConsumerPrintDocument document)
        {
            var employee = _context.ConsumerEmployees
                           .FirstOrDefault(x => x.ConsumerId == document.ConsumerId &&
                                           x.ContactId == document.ContactId);
            String rate = String.Empty;

            if (employee != null)
            {
                if (employee.Rate.HasValue)
                {
                    rate = String.Format("{0:C2}", employee.Rate);
                }
            }
            return(rate);
        }
示例#7
0
        private List <String> GetValued(ConsumerPrintDocument document)
        {
            List <String> result = new List <string>();

            if (document.ConsumerPrintDocumentValuedOutcomes != null)
            {
                foreach (var valued in document.ConsumerPrintDocumentValuedOutcomes)
                {
                    if (!String.IsNullOrEmpty(valued.ValuedOutcome))
                    {
                        result.Add(valued.ValuedOutcome);
                    }
                }
            }
            int count = 5 - result.Count;

            for (int i = 0; i < count; i++)
            {
                result.Add(String.Empty);
            }
            return(result);
        }
示例#8
0
        private List <String> GetActions(ConsumerPrintDocument document)
        {
            List <String> result = new List <string>();

            if (document.ConsumerPrintDocumentValuedOutcomes != null)
            {
                var i = 0;
                foreach (var valued in document.ConsumerPrintDocumentValuedOutcomes)
                {
                    if (valued.ConsumerPrintDocumentVOServeActions != null)
                    {
                        String actionString = "";
                        foreach (var action in valued.ConsumerPrintDocumentVOServeActions)
                        {
                            String item = action.ServeAndAction;
                            if (!String.IsNullOrEmpty(item))
                            {
                                actionString += "<B>" + (i + 1).ToString() + ". </B><I>" + item + "</I><BR/>";
                                i++;
                            }
                        }
                        if (!String.IsNullOrEmpty(actionString))
                        {
                            result.Add(actionString);
                        }
                    }
                }
            }
            int count = 5 - result.Count;

            for (int i = 0; i < count; i++)
            {
                result.Add(String.Empty);
            }
            return(result);
        }
示例#9
0
 public override IEnumerable <object> CreateDataSet(ConsumerPrintDocument document, bool isEmpty, ConsumerPrintDocumentsManagement consumerManagement)
 {
     return(consumerManagement.GenerateDataSetForMonthlyProgressSummary(DocumentType, document, isEmpty));
 }
示例#10
0
 public virtual IEnumerable <object> CreateDataSet(ConsumerPrintDocument document, bool isEmpty, ConsumerPrintDocumentsManagement consumerManagement)
 {
     return(new List <object>());
 }
示例#11
0
 public override IEnumerable <object> CreateDataSet(ConsumerPrintDocument document, bool isEmpty, ConsumerPrintDocumentsManagement consumerManagement)
 {
     return(consumerManagement.GenerateDataSetForDocumentationRecord(DocumentType, document, isEmpty));
 }
示例#12
0
        private string GetTitle(ConsumerPrintDocument document)
        {
            string title = (string.IsNullOrEmpty(document.ServiceTypeTitle) ? "Respite" : document.ServiceTypeTitle);

            return(title.ToUpper());
        }
示例#13
0
        public IEnumerable <object> GenerateDataSetForMonthlyProgressSummary(DocumentPrintTypeEnum DocumentType, ConsumerPrintDocument document, bool isEmpty)
        {
            ReportDataSetModel dataSet = new ReportDataSetModel();

            if (document != null)
            {
                List <String> actions = GetActions(document);
                List <String> valued  = GetValued(document);
                dataSet.ReportHeader          = ITCraftFrame.EnumUtils.ToDescriptionString(DocumentType);
                dataSet.PatientName           = this.GetConsumerName(document.Consumer);
                dataSet.Medicaid              = this.GetMedicaidNumberByDate(document.Consumer, document.EffectiveDate);// document.Consumer.MedicaidNo;
                dataSet.ServiceAction1        = actions[0];
                dataSet.ServiceAction2        = actions[1];
                dataSet.ServiceAction3        = actions[2];
                dataSet.ServiceAction4        = actions[3];
                dataSet.ValuedOutcome1        = valued[0];
                dataSet.ValuedOutcome2        = valued[1];
                dataSet.ValuedOutcome3        = valued[2];
                dataSet.ValuedOutcome4        = valued[3];
                dataSet.ValuedOutcomeFormated = string.Join(" ", valued[0], valued[1], valued[2], valued[3]);

                if (!isEmpty)
                {
                    dataSet.EffectiveDate = document.EffectiveDate.HasValue ? document.EffectiveDate.Value.ToString("MMMM yyyy", CultureInfo.InvariantCulture) : "";
                    dataSet.ContactName   = this.GetContactName(document.Contact);
                }
            }
            return(new[] { dataSet });
        }
示例#14
0
        public IEnumerable <object> GenerateDataSetForDocumentationRecord(DocumentPrintTypeEnum DocumentType, ConsumerPrintDocument document, bool isEmpty)
        {
            ReportDataSetModel dataSet = new ReportDataSetModel();

            if (document != null)
            {
                string        title          = GetTitle(document);
                List <String> valued         = GetValued(document);
                DateTime?     lastReviewDate = null;
                lastReviewDate = document.Consumer.ConsumerHabReviews
                                 .Where(x => x.ServiceId == document.ServiceTypeId)
                                 .OrderByDescending(x => x.DateReview)
                                 .Select(x => x.DateReview).FirstOrDefault();

                ReportAddressModel currentAddress = getCurrentAddress(document.Consumer, lastReviewDate);

                dataSet.LastReviewDate     = lastReviewDate.ToDateString();
                dataSet.PatientName        = this.GetConsumerName(document.Consumer);
                dataSet.EffectiveDate      = document.EffectiveDate.ToDateString2();
                dataSet.Address            = this.GetAddress(currentAddress);
                dataSet.ServiceDescription = this.GetServices(document);
                dataSet.Medicaid           = this.GetMedicaidNumberByDate(document.Consumer, document.EffectiveDate);// document.Consumer.MedicaidNo;
                dataSet.Title                 = title;
                dataSet.ReportHeader          = ITCraftFrame.EnumUtils.ToDescriptionString(DocumentType);
                dataSet.ValuedOutcome1        = valued[0];
                dataSet.ValuedOutcome2        = valued[1];
                dataSet.ValuedOutcome3        = valued[2];
                dataSet.ValuedOutcome4        = valued[3];
                dataSet.ValuedOutcomeFormated = string.Join(" ", valued[0], valued[1], valued[2], valued[3]);

                if (!isEmpty)
                {
                    dataSet.ContactName          = this.GetContactName(document.Contact);
                    dataSet.JobTitle             = document.Contact.JobTitle;
                    dataSet.WorkerAddress        = this.GetAddress(document.Contact);
                    dataSet.Rate                 = GetRate(document);
                    dataSet.ConsumerSityStateZip = GetSityStateZip(currentAddress);
                    dataSet.ContactSityStateZip  = GetContactSityStateZip(document.Contact);
                }
            }
            return(new [] { dataSet });
        }