QBXML get invoices of inactive customers - qbxml

How to retrieve invoices associated with Inactive customers.
<InvoiceQueryRq requestID='1495465099 0.44979100' iterator='Start'>
<MaxReturned>50</MaxReturned>
<TxnDateRangeFilter>
<FromTxnDate>2017-01-01</FromTxnDate>
<ToTxnDate>2017-05-22</ToTxnDate>
</TxnDateRangeFilter>
<IncludeLineItems>true</IncludeLineItems>
</InvoiceQueryRq>
This query does retrieve invoices, but only those associated with Active Customers. It does not return any invoices associated with Inactive Customers (and there really are some).
If I were retrieving a Customer, then I would use
ActiveStatus>All</ActiveStatus>
but the Onscreen Reference doesn't mention that with InvoiceQuery.

Related

What are the objects in the following list?

Analyze the scenario for a retail store and identify minimum three different objects from the following
customer_name,
customer,
item_id,
description,
bill_amount,
price_per_unit,
item,
pays_bill,
purchases,
employee,
designation
I have tried item_id, bill_amount and designation as they are unique but the answer was wrong.
I also tried a lot of different options for quite a lot of time but did not succeed.
The objects are instances of a class for example employee, customer, item and purchase. In the case of customer, you may have a class name Customer which has it's specified attributes such as customer_name, ``customer_id` etc.
And when you are ready to create a new customer, you will create an object name customer or customer1 which would be instances of the class Customer.
objects are employee, customer, item and purchase.
customer
customer_name,
customer,
item
item_id,
description,
price_per_unit,
item,
purchase
pays_bill,
purchases,
bill_amount,
employee
employee,
designation
Main objects are employee, customer, item and "purchase" contains new fields with the combination of first 3 objects
The correct answer is Customer, Item, Employee

Firestore One-to-Many Relationship Query

I need help, how to make one-to-many queries, for example:
I have 2 collections: customers, orders
customers{
customerId,
fullName,
company,
email,
}
orders{
orderId,
customerId,
createdAt,
}
I want to list all orders in a table with some customers data (customer full name, compa
Congratulations, you are alone in the dark Firestore Forest. Bring back all you have learned of DBMS at the college days and get you hands dirty.
Alternative 1:
First you need to filter the customers that satisfies your criteria. Then, load ALL your orders and filter mannually. I'm not kidding, saddly. The same applies if you need to order orders by customer name, for example. I'll be very happy to see someone downvote this for being wrong.
Reference: https://firebase.google.com/docs/firestore/query-data/queries
Alternative 2:
Stop using Firestore. I think you already done that.

Entity Framework select items with condition from another table

I have a question in Entity Framework.
I have two tables: Customers and Addresses
The Customers table contains information about customers and Addresses contain information about the customer address. Both tables are linked together by CustomerID.
How can I get all Customers objects (from Customers) who are living in the USA (from Addresses) ?
Can anyone help?
You can use .Where like this:
List<Customer> usaCustomers = dbcontext.Customers.Where(c => c.Address.Country == "USA");
This assumes that:
Each customer has only one address
Address entity has Country property

EF reference lookup

I load list of invoices, and I also loaded list of customers, using the same context. If I want to display invoices in a grid, where one column will contain customer's name, I need to somehow fix-up the relationship between the invoices and the customers.
How can I do this?
The problem was that customers list was retrieved with MergeOption.NoTracking, so it was detached from context, and it could not look for relationship.

How to handle entity versions in SQL Server?

I have a SQL Server 2008 R2 database that contains a table that holds my entities from an ad.
It looks something like this :
Title
Price
CreatedDate
UpdatedDate
Description
EndDate
PublishedDate
StateOfProduct
Id
UserId
UserLocationId
Visits
CategoryId
TypeOfAd
AdminComment
ReviewedDate
AmountOfImages
UserPostCode
UserEmail
UserPhoneNr
UserPassword
OwnerType
AdminUserId
InactivatedDate
OldPrice
PriceLastChange
An Ad entity can have the following stages : Published, Waiting for review, Outdated.
Say that the ad is published and the customer decides to edit the ad, this means that the settings on the ad above will change. A change like this demands a new review and that means that the ad will go from Published to Waiting for review.
The problem with this is that when a ad is changed and is waiting for review it is not published anymore.
What I need is to let the ad be published with the old (reviewed) data and when the review is done of the updated ad it will switch places but keep the old id.
The question is how to handle this the right way?
I Suppose that I could have two identical tables to keep record count down and to make it simpler to find published ads but it will be a lot more work to use Entity Framework against two identical tables at the same time.
Another solution might be to add two extra columns in the Ads table that holds the version of the ad and the original adId. The flow will in this case be something like this :
Create Ad(id=1), originalId = null, version = null.
Review Ad(id=1)
Publish Ad(id=1), version = 1
Customer Updates Ad, new Ad(id=2) is created with version set to null(=waiting for review) and originalId = 1
Reviewed Ad(id=2) done, Ad(id=1) will be copied to a new records (id = 3 (or2)), originalId set to 1. Ad(id=2) will be moved/copied to Ad(id1), originalId = null, version = 2.
The ad table might however be vary large with this but it will be a lot easier to trace ads history.
I believe this could be done using many approaches, it's just a matter of preference. What I would do is make a new table named, say, ReviewedAds with int Id, int AdId, bit Reviewed. 1:many relationship with Ads table so AdId from this table is a foreign key and matches Id from Ads table. Then I would display only those ads whose Reviewed bit is set to '1'. Two records in ReviewedAds couldn't have the same AdId and Reviewed bit set to '1'.