Welcome, Guest
Username: Password: Remember me

TOPIC: Calculate data from different feilds and show

Calculate data from different feilds and show 08 Apr 2013 00:50 #7031

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Hi, not a coder :blink: so not even sure where to start.

I have a small number of fields in a monthly report entry form.

- Hours worked
- Total of entry type one
- Total of entry type two
- Total of entry type three
- Total of entry type four

I need to have the following results to be auto calculated and inputed into separate fields once the form is refreshed (or saved) or when ever it is best to happen.

- Total of entry type four x 1000'000 / Hours worked
- Total of (Total of entry type one + Total of entry type two + Total of entry type three + Total of entry type four) x 1000'000 / Hours worked.
- Total of (Total of entry type two + Total of entry type three + Total of entry type four) x 1000'000 / Hours worked.

Hope that is enough information and thanks in advance to anyone is able to help.
The administrator has disabled public write access.

Re: Calculate data from different feilds and show 09 Apr 2013 03:54 #7034

  • JurgenG
  • JurgenG's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Karma: 0
Hey Jonathan,

Seems like you're working on some kind of risk-analysis tool ;)

For this kind of job, you'll really have to get into the source a tiny bit...

For starters, I'd be reluctant to have these fields into the database as they are easily autogenerated... (only exception I could think of: if some other program extracts data from the database that is too stupid to do the calculations itself)

So basically, you'll have to change what you get to see... (in the "MVC" lingo... this is what the V stands for: VIEW)
So you go to the VIEWS directory (be it admin or site, depending on frontend or backend), and select the view you want to edit (you named those views in your pages tab or J-Cook).
In here you have a file called view.html.php and a folder called tmpl. These two are of importance.
In the tmpl folder, you basically have HTML pages with some added PHP snippets to put the dynamic content inside. Reading this shouldn't be that difficult...

I hope you'll have a start with this...

Grtz,
Jurgen.
The administrator has disabled public write access.

Re: Calculate data from different feilds and show 09 Apr 2013 19:16 #7037

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Ah yes you right I am. I am more of a HSEQ professional rather than a programmer, but have a few skills so thought I would have a go at creating my own online risk system. One way to keep the brain ticking. I'll have a look at the templates and see what I can manipulate. Thanks for the response. :)
The administrator has disabled public write access.
Time to create page: 0.194 seconds

Get Started