The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using usercake for invoice system need advice
#1
Hi first of all thanks @mudmin for your advice thus far you help has been much appreciated.

I am creating a reseller platform with 3 levels of login all is working great bar one thing now i don't know if it is php or jquery/javascript/ajax related but i have an invoice creation form that uses dynamic data to populate the hosting plan choice box that in turn updates the price based on selection. So far so good now I have hit a bit of a snag i want to be able to allow resellers to select quantity of plans required as you would normal invoices but i want to take the data from the query pulled by ajax and insert it into a javascript calculation for example:

reseller chooses plan from drop down, price is updated via ajax and an input box shows with price for that plan, reseller enters qty required the total field should then update with the formula as follows: price * qty = total.

i have tried many approaches jquery scripts etc but none work it seems it is being interfered with by other jquery i have in app that performs other tasks.

I am at a loss as what to do or how to approach it. Any help will be appreciated here and was told to have a word with @astropos so hopefully you can help.
  Reply
#2
As you said, @astropos is way better at that sort of stuff. I can tell you that this community is great in helping you figure that sort of stuff out. My advice would be 2 fold to get you going in the right direction.

On userspice com it would be best if you posted some code snippets of what you're trying to do on pastebin or hastebin and share the links here so people can get a better look at how you're trying to accomplish this.

My gut says that the people on userspice will be REALLY able to help you with anything userspice related. When it comes to using the built in class or interacting with our database, we're pretty decent at that kind of stuff. For more generic ajax/jquery stuff, you might want to consider posting those snippets on stackoverflow.com. At this point the bulk of the jquery we're using in userspice is bootstrap related, so I doubt that any of that is interfering with what you're trying to accomplish. Again, let's get some eyes on the code itself and we'll get you going in the right direction.
  Reply
#3
I saw this on UC Smile

The form has data, you want to accept input that will modify that data.

Add a form field for qty and one for total, and a button to 'do' the calculation.
In your jquery, when the button is clicked, get the contents of [data] and the contents of [qty], do your calculation, write the new value to the total field.

If you have multiple lines per invoice you might need to check that you have unique form field names.

Isn't it just regular javascript, wrapped in a click event?

??

  Reply
#4
Hi thanks for quick response @astropos, Basically a little more than form fields wrapped in javsscript. I am trying to get the data from qty and price to multiply together and show in total after qty is input so possibly when input focus is triggered or oninput not sure tried both approaches but can never seem to pass the price variable to Javascript function to calculate.
  Reply
#5
OK; Can you show us your current code?
  Reply
#6
The JavaScript to do calculation

http://pastebin.com/CJnNWaBm

Ajax that calls the data

http://pastebin.com/VB83K6V5

One input the price input is dynamically created by Ajax the other two qty and total are normal input type text.

Below is whole php page to submit invoice to a php processing page.
  Reply
#7
Sorry last post was cut off here is link to full php page
http://pastebin.com/2GskJ82p
  Reply
#8
Give me some time to look at it - it'll be tomorrow at least Smile
  Reply
#9
thanks for your help
  Reply
#10
Sorry, I'm struggling to follow what all that js is doing.

Are you loading form elements by ajax before the main form is submitted?

Could the javascript calculation be attempting to access dom elements that have not been created yet?

Are all your form elements named correctly?


  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)