CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Calculation

Print topic Send  topic

Author Message
master

Posts: 4
Posted: 07/07/2009, 1:44 PM

Hi Everyone,
I need a little help with the calculation i built a salary record form using record builder with ajax feature i take the values from database of basic_salary, house_rent and other allowances now i want the sum of these values in the total_salary text box Is there i any way i cant do it any example will help a lot .

Regards
_________________
WanTed
View profile  Send private message
damian

Posts: 838
Posted: 07/07/2009, 11:51 PM

i would love to be able to help but i have never gotten a ccs ajax component to work! i would love to get ajax working - i can see so many ways it would make things easier for users
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
jjrjr1


Posts: 942
Posted: 07/08/2009, 2:15 AM

I might be confused as to what you are needing here since adding values sound pretty easy.

Is your question how to add values in javascript after you get the values from the ajax service or how to add the values in the ajax service and return the summed vales to the javascript by the ajax service???

Adding numbers is pretty basic to applications.

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
master

Posts: 4
Posted: 07/08/2009, 8:27 AM

Hi Thanks for replies and jjrjr can u plz give me simple example how to do addition and subtraction coz on the record form i am getting three values form the database through ajax and now on the fourth text box i want the sum of the above 3 values in that text box.

"'''' how to add the values in the ajax service and return the summed vales to the javascript by the ajax service??? """""

yes kinda like u said n also plz share some basic example of addtion n subtraction .

Regards
_________________
WanTed
View profile  Send private message
jjrjr1


Posts: 942
Posted: 07/08/2009, 1:39 PM

On the javascript side after your current ajax service gives you your 3 values just use standard javascript to add them up and put them into your 4th field.

Like this:

total = value1+value2+value3;

Where total will be the value placed into your 4th field

After you calculate total It can be put into input field or just a label location on your page.

Substraction in javacript is just as easy.

value = bigvalue-smallvalue;

If you want the ajax service to do the addition, that is easy also.

PHP addition is like this

$Total=$Value1+$Value2+$Value3;
(Substraction is also similar $Value = $BigValue-$SmallValue);

Then (Assuming your service is a CCS built ajax service) add a label component to the html of the ajax service. Then in the before show event add your 3 values and put them into your new label.

Then make the appropriate changes to your calling page ajax routine to handle the new value

Easy.

Hope that helps

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
master

Posts: 4
Posted: 07/08/2009, 4:47 PM

"""" On the javascript side after your current ajax service gives you your 3 values just use standard javascript to add them up and put them into your 4th field.

Like this:

total = value1+value2+value3;

Where total will be the value placed into your 4th field """"""

i have tried this now the problem is when i click on calculate it calculates and shows value for a sec then all fields became blank :( if i comment the form then it works fine results remains there but as per requirement i am building a record form so i want to store all the fields in the database i google for 2 hours but havent find any solution

Regards
_________________
WanTed
View profile  Send private message
damian

Posts: 838
Posted: 07/08/2009, 6:43 PM

if you do the sum in your sql (something like select A, B, C, A+B+C as D, C-B as E from table where 1) you should be able to reference A, B, C, D, E.....

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
jjrjr1


Posts: 942
Posted: 07/08/2009, 9:09 PM

Now I am confused also.

What is the calculate button for???

I thought the values were coming from an ajax request. Does Calculate call the ajax request???

Without knowing what your code is doing and what it is suppose to do when calculate is hit My best guess is that it is acting like a submit button.

But I do not know.

Please let me know and I will try to help


_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
master

Posts: 4
Posted: 07/23/2009, 11:02 AM

Hey Thanks jjrjr1 n others to for helping i got that working thorugh a simple way using javascript. Thanks a lot. Due to my Exam i was busy so i havent reply, now am free. one more help code charge studio generates very complex code Is there any way book site forum that will help me out in order to understand that, i know lil php but still wana study .

Regards
_________________
WanTed
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.