Yii Framework Forum: Process Writing With Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Process Writing With Yii Rate Topic: -----

#1 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 21 March 2013 - 10:46 AM

Hello friend..
I need to retriev data from the database table and do some calculation and view the result.
Can anyone give me tha idea that how di I do it in proper way with example.calculation something like salary calculation of employement.
pls give me your opinion.
Thank you
0

#2 User is offline   waitforit 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 382
  • Joined: 09-February 11

Posted 21 March 2013 - 11:00 AM

I believe in asking the database for what you want.

IE, do the heavy lifting on the SQL end of things. Why don't you post same samples of your DB structure and what you are trying to get.
0

#3 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 21 March 2013 - 12:16 PM

View Postwaitforit, on 21 March 2013 - 11:00 AM, said:

I believe in asking the database for what you want.

IE, do the heavy lifting on the SQL end of things. Why don't you post same samples of your DB structure and what you are trying to get.



I have the mysql table in following way.
I need to get
totalSalary=BasicSalary+allowence+OTHour*x
x=paymentper othour;

then I need to display total salary in each of the employee separately in their view file...
How do i do it in proper way pls give me more instruction with sample coding...
thank you

Attached File(s)


0

#4 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 22 March 2013 - 10:46 AM

View Postsldra, on 21 March 2013 - 12:16 PM, said:

I have the mysql table in following way.
I need to get
totalSalary=BasicSalary+allowence+OTHour*x
x=paymentper othour;

then I need to display total salary in each of the employee separately in their view file...
How do i do it in proper way pls give me more instruction with sample coding...
thank you



PLS HELP ME ... IAm totally new to yii.this is really important to me.
How do I start.hrlp me.thank you.
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 22 March 2013 - 12:04 PM

Perhaps you should buy a book about Yii?
Sounds like the most cost effective way of getting your Yii programming off the ground.
If not, now would be a good time to start putting some effort into it. Instead of asking that people walk you through it.
"Less noise - more signal"
0

#6 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 23 March 2013 - 04:43 AM

View Postjacmoe, on 22 March 2013 - 12:04 PM, said:

Perhaps you should buy a book about Yii?
Sounds like the most cost effective way of getting your Yii programming off the ground.
If not, now would be a good time to start putting some effort into it. Instead of asking that people walk you through it.

good Idea.Thank tou
0

#7 User is offline   RyanZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-December 12

Posted 23 March 2013 - 07:33 AM

I would create a dynamic attribute in the model
public $totalSalary;


Next I would override the afterFind method

public function afterFind()
{
$this->totalSalary = (($this->basicSalary + $this->allowance + $this->OTHour) * $this->X);

return parent::afterFind();
}


Now your totalSalary property will always contain this calculation after a search.
0

#8 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 24 March 2013 - 09:46 AM

Actually I really need to know that the contribution of model views and controller to solve the problem like that.thank you
0

#9 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 26 March 2013 - 05:20 AM

Is it behoove that the calculation method write in controller. Can we write that function in model.pls tell me. I want to knw the contribution of model view and controller to solve the problem ..pls help me.I need to get the clear idea. thank you
0

#10 User is offline   Denit S. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 13-March 13
  • Location:Netherlands

Posted 26 March 2013 - 07:57 AM

Have you read the definitive guide to Yii?

If not, you really should. It's great read. It explains very well the conventions and gives an overview of how controllers, models and views relate to each other.
Here are some tunes for you to enjoy! listen, listen, listen.
0

#11 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 26 March 2013 - 08:22 PM

View PostDenit S., on 26 March 2013 - 07:57 AM, said:

Have you read the definitive guide to Yii?

If not, you really should. It's great read. It explains very well the conventions and gives an overview of how controllers, models and views relate to each other.

hmmm thank you..
0

#12 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 27 March 2013 - 10:53 AM

View Postsldra, on 26 March 2013 - 08:22 PM, said:

hmmm thank you..

pls Can anyone guide me.can anyone please give an idea or any tutorial,
0

#13 User is offline   Denit S. 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 13-March 13
  • Location:Netherlands

Posted 28 March 2013 - 04:27 PM

http://www.yiiframework.com/doc/blog/
Here are some tunes for you to enjoy! listen, listen, listen.
0

#14 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 02 April 2013 - 05:39 AM

View PostDenit S., on 28 March 2013 - 04:27 PM, said:


If there have any other tutorials regarding above problem pls send me the url. thank you
0

#15 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 04 April 2013 - 10:34 PM

View Postsldra, on 02 April 2013 - 05:39 AM, said:

If there have any other tutorials regarding above problem pls send me the url. thank you

If there have any other tutorials regarding above problem pls send me the url. thank you
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users