jBilling Error: An Invoice could not be generated - invoice

When I want to generate an invoice to an order following error is displayed:
"There has been an error:
An Invoice could not be generated. The purchase order does not have any applicable periods to be invoiced.
Verify the data of the purchase order or contact customer service to review your business rules."
I disabled pro-rating and I set following settings to plug-ins:
Invoice presentation
com.sapienter.jbilling.server.pluggableTask.InvoiceCompositionTask
Billing process: order periods calculation
com.sapienter.jbilling.server.pluggableTask.OrderPeriodTask
It is not working yet. Any Idea? help me quickly please.
Thanks a lot.

when you create order, you will see period filed on order screen which is one time or monthly.
select one time and try to create order. if you select monthly then only one invoice will create for that order because it is recurring order and then next bill set to next month.
if you want to create invoice again for same order then try to manage billing proces to next invoice date or update next bill date to curent month in purchase order table.

Related

Need a SUMIF =SUM(C3-(SUM(E3:N3))) but if E14<0 dont subtract

I have simple problem which I can't get the right twist on it.
I have a list of "products" with their stock in the range of D3:D13 with a set price, an original stock and a list of "customers" in the range of E3:L3.
Each customer can take a product and the updated stock currently is:
[=SUM(C3-(SUM(E3:L3))) ]
If we take one person he has his combined cost for how many products he took on E14
If a person pays their cost (E14 > 0) and nulls the products he took currently the updated stock gets rested. That is what I dont want.
Basically: SUM Stock IF (any of E14:L14) > 0 THEN =SUM(C3-(SUM(E3:N3)))
Update:
Example:
https://docs.google.com/spreadsheets/d/1SEssivZ8jCbqedc8TG_PO4uWLN_QzpRQwxJ_bGwHvQg/edit?usp=sharing Hope the link works.
That is basically everything and this works for me currently.
The issue is if a user decides to pay their dept.
For example User 1 pays.
Then the currently calculated price for the user (E14) get's nulled and also the cells for how much products they took (E3:E12).
But then because how it is done currently the updated stock gets updated again with the items the user1 took previously because we nulled the E3:E12. But the products where already taken. That is what I want to prevent.

How can I show the record with the nearest future due date?

I am working on an app that tracks invoices and the payments associated with those invoices, but have come across a problem.
An invoice can have many payments, and in the payments table I have the following columns: "amount_paid", "balance", "due_date".
What I am trying to do is show just the payment with the next upcoming "due_date" for each invoice.
Can anyone point me in the right direction?
Just get the next payment by date for each invoice, like so;
Payment.where(invoice_id: 1).order(due_date: :desc).first
Hope this helps.

Creating a subscription in Stripe - I'm confused

I use stripe subscriptions for my users with one plan for, say, $10 per month for 100 API requests and that's a standard price. However, if the user has used 150 API requests, I charge them $10 + $3. For 200 and more requests it's $10 + $7.
Say, I've subscribed the user on October 9th. On November 9th the webhook event invoice.created will be called by stripe. So if the user has used 150 API requests, I have to add $3 more to the basic price (I can do that only within 1 hours according to Stripe documentation https://support.stripe.com/questions/metered-subscription-billing).
if even.type == 'invoice.created'
Stripe::InvoiceItem.create(
customer: stripe_customer_id,
invoice: event.data.object.invoice
amount: 300,
currency: 'usd',
description: 'additional price'
)
The questions:
Will the event invoice.created, indeed, be called on November 9th for the first time?
Will that additional price of $3 be added to the current invoice of $10 for October 9th-November 9th or will it be added to the future invoice for November 9th-December 9th? From the documentation it's not clear.
How do I add metadata to the original invoice of $10? I can add metadata to the additional invoice but in case the user has used less 100 API request I don't have to create the additional invoice at all, so I can't rely to the additional invoice.
It says
Create any invoice items before your customer is subscribed to the
plan, and then create the subscription via an update customer
subscription call.
but I subscribe the user once and forever on October 9th! How can I create an InvoiceItem before or on that (on October 9th) date if one month hasn't passed yet, and thus it's not known how many API calls the user makes (on October 9th the user has made, obviously, zero API calls)? I can only create InvoiceItems in 30 days because it's when I know how much to charge them on top on the $10! On October 9th I don't know that. Don't I understand anything?
Each time an invoice is created, you get the event invoice.created on your webhook. So when you subscribe a customer to a monthly plan on the 9th of November, you will get this event on the 9th of November, on the 9th of December, on the 9th of January, etc.
The first invoice for a subscription (generated when you create a subscription) is always closed immediately, so it is not possible to add an invoice item at that point. If that's something you want to do (for a setup fee for example) you need to create the invoice item before creating the subscription. That way it would get added automatically to the first invoice created when subscribing your customer.
In your case, you want to add fees to the next invoice based on the number of API requests your customer made during the month that just ended. So in the invoice.created event you need to detect whether it's a new month starting or the first one. If it's a new month, you then need to decide whether you have to add an Invoice Item to the user or not (based on the number of API requests).
You can't add metadata to the previous invoice from the month before. You just need to add the invoice item to the current invoice (for the month that is starting) and put a description indicating that the extra line item is for the consumption for the previous month.

Netsuite Tax Item Script

I have customers that have several ship to addresses in netsuite. My problem is this, each one of those ship to addresses needs a different tax item. So if I were to enter a sales order and select the customer, I need some way that when I select a ship to(from the drop down) the tax item is filled in with the correct one. I have yet to find a way to link a certain ship to address to a certain tax item, not to mention have it fill in once the ship to address is selected on a sales order. Any help is appreciated.
If these tax items are just for your reference, then you can create a custom record type and store the reference shipto & taxitem.
Then you can use client script to populate the taxitem based on the shipto by querying the custom record type.

QBFC Billadd Transaction

I have an application that interfaces with QuickBooks and I am using the BILLADD transaction. The application pulls bill transactions from another data base and updates quickbooks. The billadd transactions that we are pushing to quickbooks have several expense lines. Some of the expense lines are negative(credits) to the vendor. I can manually enter a negative number on a new bill, but the get an error when trying to do it programmatically.
Can anyone tell me if it is possible to do this with billadd or do I need a different transaction type to add the credits?
Scott
As long as the total of the bill is not negative, you should be able to add negative expenses. If you need to enter a negative bill, you would need to enter it as a IVendorCreditAddRq. I tested it with adding a bill with -10, +100, and -50 line expenses and was able to save it without a problem.
Could you post your request and the response you are getting?

Resources