Question

What happens if the resellers customer is to be billed at the same day as the reseller for his resellers subscription? Will the record for the resellers customer subscription be included into the resellers invoice?

Answer

Yes, it will be. At first the resellers customers are billed, only then the resellers themselves. bBillRecurring::getAccountListToBill method sorts accounts to bill by the "Depth", e.g.:

[15-12-18 09:00:00.648 BM          RQ186092 TH26223 TRC]     +++[4] Create bills, first pass {}
[15-12-18 09:00:00.648 TaskRunner_ RQ186092 TH26223 TRC]      +++[5] void bBillRecurring::getAccountListToBill(Int, std::vector<STLRT::Type::Numeric<int>, std::allocator<STLRT::Type::Numeric<int> > >&)()
[15-12-18 09:00:00.648 RDBMS       RQ186092 TH26223 INF] Prepare [0x7f3f5486c650]: SELECT "ABD"."AccountID" FROM "AccountBillingDate" "ABD" CROSS JOIN "Account" "A" CROSS JOIN "AccountInheritance" "AI" WHERE ((("AI"."CustomerAccountID" = "ABD"."AccountID") AND ("AI"."VendorAccountID" = $1)) AND (("ABD"."LastBillingDate" IS NULL) OR ("ABD"."LastBillingDate" < $2))) AND (("A"."AccountID" = "AI"."CustomerAccountID") AND ("A"."AStatus" <> $3)) ORDER BY "AI"."Depth" DESC, "A"."AccountID" DESC

and executes makeBillingForAccount for each records from the list. That means that at first the customers which are deeper in AccountInheritance (resellers and subresellers customers) are billed, only then their vendors. So the only chance of the customer's bill not getting included to the resellers invoice is failed first attempt of account billing.

Internal content