Results 1 to 3 of 3
  1. #1
    bankTechy is offline Member
    Join Date
    Sep 2013
    Posts
    7
    Rep Power
    0

    Default Asset Monthly Depreciation

    i want to calculate the depreciation of an asset and i want my accumulated value to automatically add the previous monthly depreciation value with the current one any time the user calculates for the monthly depreciation, the accumulated value should pick the results from monthly depreciation and add it to the one it has and output the results.
    example:monthly depreciation is 40 and accumulated value is 0 the result for accumulated value should be 40
    when the value for monthly depreciation is 60 the accumulated value should add 40+60=100.

    this is my code in MySql(i got stuck at the accumulated part)

    drop trigger if exists update_purchases;

    drop trigger if exists insert_purchases;

    drop procedure if exists process_purchase;

    delimiter |

    create procedure process_asset_update (
    in Cost_Of_Acquisition double,
    in Estimated_Useful_Life double,
    inout Monthly_Depreciation double,
    inout Estimated_Residual_Value double,
    inout Accumulated_Depreciation double,

    in Asset_ID integer
    )

    BEGIN
    set monthly_Depreciation = (Cost_Of_Acquisition / Estimated_Useful_Life)/12;
    set Estimated_Residual_Value = 10 *(Cost_Of_Acquisition);
    set Accumulated_Depreciation = monthly_Depreciation ;

    END|# MySQL returned an empty result set (i.e. zero rows).

    CREATE TRIGGER `update_asset_update`
    before update ON `asset_update`
    for each row
    BEGIN
    call process_asset_update(new.Cost_Of_Acquisition,new.E stimated_Useful_Life,new.Monthly_Depreciation,new. Estimated_Residual_Value,new.Accumulated_Depreciat ion,new.Asset_ID);
    END|# MySQL returned an empty result set (i.e. zero rows).

    CREATE TRIGGER `insert_asset_update`
    before insert ON `asset_update`
    for each row
    BEGIN
    call process_asset_update(new.Cost_Of_Acquisition,new.E stimated_Useful_Life,new.Monthly_Depreciation,new. Estimated_Residual_Value,new.Accumulated_Depreciat ion,new.Asset_ID);
    END|

    delimiter ;

    -- insert some sample data

    insert into asset_update (Cost_Of_Acquisition,Estimated_Useful_Life) values(2500,5);
    insert into asset_update (Cost_Of_Acquisition,Estimated_Useful_Life) values(2000,4);

    insert into asset_update (Cost_Of_Acquisition,Estimated_Useful_Life) values(3000,6);

    insert into asset_update (Cost_Of_Acquisition,Estimated_Useful_Life) values(1500,3);

    insert into asset_update (Cost_Of_Acquisition,Estimated_Useful_Life) values(5000,9);

    -- update asset_update set Total = 0;
    can this be achieved using java? if yes pls help and if anyone can also modify mysql code i will appreciate that too
    Please serious help will be appreciated since am working with time THANK YOU

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Asset Monthly Depreciation

    Why do you think this forum is called "Java Forums"?
    Find a MySQL forum and post there.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    amol selokar is offline Member
    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0

    Default Re: Asset Monthly Depreciation

    good question ........ give me some time

Similar Threads

  1. asset monitoring in snmp using java
    By annette in forum Forum Lobby
    Replies: 1
    Last Post: 05-07-2012, 12:09 PM
  2. monthly temperatures
    By droidus in forum New To Java
    Replies: 23
    Last Post: 04-05-2011, 02:21 AM
  3. Depreciation
    By Fondor in forum Java Applets
    Replies: 1
    Last Post: 04-23-2010, 04:54 AM
  4. EnterMedia Digital Asset Management software
    By julieriley in forum Reviews / Advertising
    Replies: 0
    Last Post: 09-23-2009, 04:50 PM
  5. sum of digits depreciation
    By jleas in forum New To Java
    Replies: 13
    Last Post: 11-09-2008, 01:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •