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
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
using usercake for invoice system need advice - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: using usercake for invoice system need advice (/showthread.php?tid=118)

Pages: 1 2


using usercake for invoice system need advice - ohostme16 - 04-06-2016

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.


using usercake for invoice system need advice - mudmin - 04-06-2016

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.


using usercake for invoice system need advice - astropos - 04-06-2016

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?

??




using usercake for invoice system need advice - ohostme16 - 04-06-2016

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.


using usercake for invoice system need advice - astropos - 04-06-2016

OK; Can you show us your current code?


using usercake for invoice system need advice - ohostme16 - 04-06-2016

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.


using usercake for invoice system need advice - ohostme16 - 04-06-2016

Sorry last post was cut off here is link to full php page
http://pastebin.com/2GskJ82p


using usercake for invoice system need advice - astropos - 04-06-2016

Give me some time to look at it - it'll be tomorrow at least Smile


using usercake for invoice system need advice - ohostme16 - 04-07-2016

thanks for your help


using usercake for invoice system need advice - astropos - 04-07-2016

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?