Example #1
0
        public void AddInvoicesForUnmatchedCustomer(List <Invoice> input)
        {
            MatchedInvoices.Add(new ObservableCollection <Invoice>(input));
            Status = IdentifyStatus.IdentifiedByExtractionWithUnknownCustomer;

            if (MatchedInvoices.First().Select(_ => _.Value).Sum() == Value)
            {
                FinalMatchedInvoices = MatchedInvoices.First();
            }
        }
Example #2
0
        public void PairMatchedInvoiceValues(List <List <double> > input)
        {
            if (input.IsNullOrEmpty())
            {
                return;
            }

            foreach (List <double> list in input)
            {
                MatchedInvoices.Add(new ObservableCollection <Invoice>(Invoices.Where(_ => list.Contains(_.Value))));
            }

            if (MatchedInvoices.Count == 1 && MatchedInvoices.First().Select(_ => _.Value).Sum() == Value)
            {
                FinalMatchedInvoices = MatchedInvoices.First();
                Status = IdentifyStatus.IdentifiedByMatching;
            }
            else if (MatchedInvoices.Count == 1 && MatchedInvoices.First().Select(_ => _.Value).Distinct().Sum() == Value)
            {
                Status = IdentifyStatus.IdentifiedByMatchingWithMultipleSameValues;
            }
        }
Example #3
0
        public List <string> PairExtractedInvoiceNumbers(List <string> input)
        {
            List <Invoice> pairedInvoices = Invoices.Where(_ => input.Contains(_.InvoiceNumber)).ToList();

            if (!pairedInvoices.IsNullOrEmpty())
            {
                MatchedInvoices.Add(new ObservableCollection <Invoice>(pairedInvoices));

                if (pairedInvoices.Select(_ => _.Value).Sum() == Value)
                {
                    Status = IdentifyStatus.IdentifiedByExtraction;
                    FinalMatchedInvoices = MatchedInvoices.First();
                }
                else
                {
                    Status = IdentifyStatus.PartiallyIdentifiedByExtraction;
                }
            }

            List <string> pairedInvoiceNumbers = pairedInvoices.Select(_ => _.InvoiceNumber).ToList();

            return(input.Where(_ => !pairedInvoiceNumbers.Contains(_)).ToList());
        }