/// <summary> /// Takes a service (Organisation / Company) and polls company for all invoices within certain date range /// /// Multiple overloads depending on what you're looking for - invoice types, from a particular contact, etc etc etc /// </summary> /// <param name="aService"></param> public List<XeroApi.Model.Invoice> FIlterXeroInvoiceTypesForAquariumInsertComparison(InterResolveXeroService aXeroCompanyToCheckAgainst) { //this is the list we will be passing back and removing items from should they exist in Aquarium List<XeroApi.Model.Invoice> theXeroInvoices = aXeroCompanyToCheckAgainst.GetAllPurchaseInvoicesOfTypesThatNeedToBeInAquariumFromXero(DateTime.Now.AddMonths(-3), DateTime.Now); //now filter these invoices to only the correct 'types' e.g. account codes List<XeroApi.Model.Invoice> theFilteredXeroInvoices = (from invoice in theXeroInvoices where invoice.LineItems.Any( x => x.AccountCode == "54070" ) || invoice.LineItems.Any( x => x.AccountCode == "54110" ) || invoice.LineItems.Any( x => x.AccountCode == "51070" ) || invoice.LineItems.Any( x => x.AccountCode == "54110" ) //ds // .Where(X => X.LineItems.Any(x => x.AccountCode == "54110")) //ds // .Where(X => X.LineItems.Any(x => x.AccountCode == "51110")) //tp trf // .Where(X => X.LineItems.Any(x => x.AccountCode == "51070")) //tp trf select invoice).ToList(); //AccountCode == "42010 - Third Party Income - Scheme Fees (Claimant)") //for that company look for invoice numbers of a certain type //that aren't in the LeadID and Inbound Invoice / Medical Treatment Table (PULL DISTINCT LIST OF INVOICE NUMBERS FROM AQ AND COMPARE) //For each Lead, write in necessary table row to : //MR or Treatment tables (optional) //Inbound invoice table //necessary return theFilteredXeroInvoices; }
public List<XeroApi.Model.Invoice> GetXeroInvoiceNumbersForLastThreeMonths(InterResolveXeroService aXeroCompanyToCheckAgainst) { List<XeroApi.Model.Invoice> invoices = aXeroCompanyToCheckAgainst.GetAllPurchaseInvoicesOfTypesThatNeedToBeInAquariumFromXero(DateTime.Now.AddMonths(-3), DateTime.Now); //do something with these invoices return invoices; }