Idvd performance suddenly bad---help!!

i dvd has always run good for me on my mini, now today it plays back horribly, stuttering and such.
i repaired permissions
cleared caches
what happened????

hi and thanks. i solved the issue myself. when you open idvd it asks you to make a new project called my great dvd. i did this, and sometimes i mess with it but don't save it. well this turned out to be what was messing things up.
i deleted the my great dvd file from my desktop and restarted idvd and all is well, so just fyi.

Similar Messages

  • What is going on with Apple? I've just downloaded their Mavericks and my computer is performing so badly, I'm wondering if Mavericks is some sort of diabolical malware! How can I get Mavericks out of my computer?

    What is going on with Apple? I've just downloaded their Mavericks and my computer is performing so badly, I'm wondering if Mavericks is some sort of diabolical malware! How can I get Mavericks out of my computer?

    What is your year and specs of your Mac Pro?
    How much RAM installed?
    How full is your Mac's hard drive?
    Do you run any antivirus software on your Mac? Antivirus software can slow down the normal operation of OS X and have negative effects on system performance.
    Do you have apps like MacKeeper or any other maintenance apps like CleanMyMac 1 or 2, TuneUpMyMac or anything like these apps, installed on your Mac?
    These types of apps, while they appear to be helpful, can do too good a job of data "cleanup" causing the potential to do serious data corruption or data deletion and render a perfectly running OS completely dead and useless leaving you with a frozen, non-functional Mac.
    Plus, these type of apps aren't really necessary.
    They really aren't.
    There are manual methods to clear off unnecessary data off of your Mac that are safer and you have complete control over your Mac and not just leave a piece of auto cleaning software in charge of clearing off data off of your Mac.
    These apps potential of causing OS X issues outweighs the implied good and benefits these types of hard drive or memory "cleaning" apps are written to do.
    Plus, the software company's that write these apps make it hard to easily uninstall these apps if something DOES go wrong and these apps work in a way where you have no recovery or revert function to return your Mac back to its former, working state in the event something does go wrong.
    It is best to never download and install these types of apps.
    The risk to your system and data is too great a risk!

  • When i type my email, the text would go on and on and overflows. I mean to say it doesn't autmatically hit the right hand side wall and change to next line! I have to manually press enter and then next line starts. Started happening suddenly.pls help.

    When i type my email, the text would go on and on and overflows. I mean to say it doesn't autmatically hit the right hand side wall and change to next line! I have to manually press enter and then next line starts. Started happening suddenly.pls help.

    Does it happen when you reply to an email? If so, it might be that there's content in the original email (like an image or something similar) that overflows the window content, therefore the Mail app, when you hit the border, follows the content below instead of going on a new line. You might wanna try that.
    Also: Please do not post the whole question in the question title.

  • HT4009 Ok so my problem is I put $100 on my account an it not letting me buy in app purchases an I'm ticked off to the max an idk how to fix this I bough in app the other day perfectly fine I need help bad HELP me

    Ok so my problem is I put $100 on my account an it not letting me buy in app purchases an I'm ticked off to the max an idk how to fix this I bough in app the other day perfectly fine I need help bad HELP me

    You need to Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Urgent help needed - deadline - iDVD project suddenly gone corrupt?

    Ive literally finished and ironed out the problems Ive had with a big Dual Layer project Ive been working on for 2 weeks.
    Yesterday I successfully burned a project to DVD - and I had not been having any problems.
    Then suddenly I tried another burn later in the day - and after all the encoding - iDVD ejected the blank DVD (before burning it) and appeared to freeze. The burn status bar remained complete saying project status: done. However iDVD was frozen like this - and the DVD is blank. I had to force quit as it would not respond.
    I calmly tried again - same thing happened - it ejects the blank CD after encoding and freezes.
    I decided to open a slightly different version of the iDVD project file I had also saved - and had the same problem....
    So I tried to save a disc image instead - this time when I came back iDVD was gone - it had crashed and disappeared leaving no disc image.
    I did some searching in this forum and I made some drive space and trashed my .plist files and repaired disc permissions.
    I did another test burn this morning....SAME ISSUE - IDVD FROZE AND EJECTED THE BLANK DISC AFTER ENCODING....help! I have no idea what happened or what made it start behaving like this - I cant think of anything that changed on my system...and after all this work this bug has happened at the last hurdle....
    Thanks in advance...

    ok - so after all the above tinkering and OSX update, plist trashing and permission repairing as well as shifting assets to an internal drive - I set the iDVD project (which had previously burned ok) to burn again - and lo and behold - after the encoding - the same thing happened again...
    The project encoded - and then right at the end - it just ejected the blank CD and stopped...
    here is a picture of the resulting iDVD screen.
    As you can see - it just says 'done'. And the CD is sitting ejected and blank. The media is a fresh disc Verbatim +R DL. If I close the player nothing happens.
    If I press the 'cancel' button iDVD says 'cleaning up' and just sits there doing nothing. It does not register as 'not responding' in the 'force quit application menu' - but nothing happens.
    This is a real mystery to me. So frustrating I have the project finished! Something weird has happened...
    Hi Rich...this project is a regular 4:3 PAL format.
    I did try making a new project similar to the one Im trying to burn - and got the same result. Ditto with older versions of the project...
    I have just run the Disc 1 hardware test - 'no trouble' result.
    I am re-installing 'bundled software' from disc 1. Then I need to sleep and try burning again tomorrow...
    cheers

  • Bad game performance: "Tibia" - need help to find the error

    hi
    im playing a game called tibia (www.tibia.com) for a long time, back on windows i had no problems with the programm(except that windows itself crashed sometimes while playing ;P).
    since some time they made an linux client again and i tryed it on my pc, running arch with all updates.
    my problem is that sometimes when (probably to much) pictures like garbage and player are shown on the screen(its an 2d mud inspired by ultima) i get performence issues, the program is freezing 2 seconds before i can view another level, just to say an example.
    via "top" i watched what kicks in that uses my cpu so much and it is X.
    ok, now i dont realy know where this post belongs, more here or into newbie's corner, but:
    as i said before i have every possible update for arch and the installed programms.
    i got an geforce fx 5200 with the newest driver(manualy installed because the installer via pacman whont have the new driver because of an outdatet kernel, atleast that was what i remember).
    my problem now is that i just dont know where the error is.
    i know of people, using the same client as i that dont have that issues.
    i already bugged the support forums but as far as i saw they dont realy like arch user, atleast they dont answer to their questions. ;P
    i whant to know if MAYBE someone is here who plays tibia and can tell me that he got the same problems like i do or not.
    or you could give me hints what i could try to solve this problem.
    to write it in one short line:
    the problem is that the process "X" sometimes kicks in, using 100% of the cpu, this happens only while playing "tibia"
    thank you

    Look at Steps #4, #6, #9 and #12.
    http://helpx.adobe.com/dreamweaver/kb/troubleshoot-javascript-errors-dreamweaver-cs4.html
    Nancy O.

  • Performance is bad wile using qaaws in xcelsius - tips to improve?

    Post Author: RMS
    CA Forum: Xcelsius and Live Office
    Hi,
         Im using qaaws as the source for my xceslsius dashboard.
    I am able to create and fetch data using the web services and also display it in components in my model.
    However, the performace is really BAD! Does anyone know how to tune up qaaws performance? Another strange thing that is happening is, when i have my xcelsius up and running, and i click on the web service connector, if i also have a deski query runnning at the same time,  my web service takes FOREVER to show a change in the model. Its almost like nothing is  happening.
    Does anyone know what qaaws and BOXI services have in common? Does qaaws alos have to be managed thru the CCM or the CMC? (server, etc?)
    ANY help will be appreaciated!!
    Thanks!!

    Jason,
    This may not apply to your dashboard, depending on the nature of the data you're bringing back, but I try to minimize the number of separate queries by combining all the ones with the same 'shape' into one query.  For example, if you have several queries bringing back 12 rows - one for each of the past 12 months, you can combine them into a single query with multiple columns.  You can then make use of Excel functions such as VLookup to pick out the particular columns needed for displaying each chart.  You can also click on the 'row' line in the data manager to outline the entire area being brought back, rather than having to do each column individually.
    Again, this may not be applicable for your needs, but I've also found that I could eliminate using query parameters by bringing back a larger amount of data into the spreadsheet in the initial load and then using the Excel functions to pick up the data being requested in the user controls for displaying in the charts.  Using that monthly example above, for instance, you could bring back several years worth of data (at a cost of only 12 rows / year in the spreadsheet), and then use the lookup functions to bring up the year requested in a user control.
    Hope those ideas help,
    Peter

  • How to resolve most of the Oracle SQL , PL/SQL Performance issues with help of quick Checklist/guidelines ?

    Please go thru below important checklist/guidelines to identify issue in any Perforamnce issue and resolution in no time.
    Checklist for Quick Performance  problem Resolution
    ·         get trace, code and other information for given PE case
              - Latest Code from Production env
              - Trace (sql queries, statistics, row source operations with row count, explain plan, all wait events)
              - Program parameters & their frequently used values
              - Run Frequency of the program
              - existing Run-time/response time in Production
              - Business Purpose
    ·         Identify most time consuming SQL taking more than 60 % of program time using Trace & Code analysis
    ·         Check all mandatory parameters/bind variables are directly mapped to index columns of large transaction tables without any functions
    ·         Identify most time consuming operation(s) using Row Source Operation section
    ·         Study program parameter input directly mapped to SQL
    ·         Identify all Input bind parameters being used to SQL
    ·         Is SQL query returning large records for given inputs
    ·         what are the large tables and their respective columns being used to mapped with input parameters
    ·         which operation is scanning highest number of records in Row Source operation/Explain Plan
    ·         Is Oracle Cost Based Optimizer using right Driving table for given SQL ?
    ·         Check the time consuming index on large table and measure Index Selectivity
    ·         Study Where clause for input parameters mapped to tables and their columns to find the correct/optimal usage of index
    ·         Is correct index being used for all large tables?
    ·         Is there any Full Table Scan on Large tables ?
    ·         Is there any unwanted Table being used in SQL ?
    ·         Evaluate Join condition on Large tables and their columns
    ·         Is FTS on large table b'cos of usage of non index columns
    ·         Is there any implicit or explicit conversion causing index not getting used ?
    ·         Statistics of all large tables are upto date ?
    Quick Resolution tips
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    2) Use Data Caching Technique/Options to cache static data
    3) Use Pipe Line Table Functions whenever possible
    4) Use Global Temporary Table, Materialized view to process complex records
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    8) Follow Oracle PL/SQL Best Practices
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    12) Review Join condition on existing query explain plan
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    14) Avoid applying SQL functions on index columns
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    Thanks
    Praful

    I understand you were trying to post something helpful to people, but sorry, this list is appalling.
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    No, use pure SQL.
    2) Use Data Caching Technique/Options to cache static data
    No, use pure SQL, and the database and operating system will handle caching.
    3) Use Pipe Line Table Functions whenever possible
    No, use pure SQL
    4) Use Global Temporary Table, Materialized view to process complex records
    No, use pure SQL
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    No, use pure SQL
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    Makes no sense.
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    What about using the execution trace?
    8) Follow Oracle PL/SQL Best Practices
    Which are?
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    You mean design your database and queries properly?  And table scanning is not always bad.
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    It depends if that is necessary or not.
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    No, consider that too many indexes can have an impact on overall performance and can prevent the CBO from picking the best plan.  There's far more to creating indexes than just picking every column that people are likely to search on; you have to consider the cardinality and selectivity of data, as well as the volumes of data being searched and the most common search requirements.
    12) Review Join condition on existing query explain plan
    Well, if you don't have your join conditions right then your query won't work, so that's obvious.
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    No.  Oracle recommends you do not use hints for query optimization (it says so in the documentation).  Only certain hints such as APPEND etc. which are more related to certain operations such as inserting data etc. are acceptable in general.  Oracle recommends you use the query optimization tools to help optimize your queries rather than use hints.
    14) Avoid applying SQL functions on index columns
    Why?  If there's a need for a function based index, then it should be used.
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    See 13.
    In short, there are no silver bullets for dealing with performance.  Each situation is different and needs to be evaluated on its own merits.

  • Why is browser performance so bad on my new iMac?

    I'm using the latest generation iMac 27 inch with the dual 3.2ghz i5 processors, 8GB of memory, and 1TB HD. Over the past few days I've noticed the page rendering speed of this iMac using Safari has gotten embarassingly bad. I haven't seen problems like this since I was on dialup AOL on my original 7500/100 in 1997. Honestly, my iPhone 4 displays pages incredibly fast just using 3G, so this is really disappointing for a $2k+ computer.
    I enabled the Dev menu and emptied the "caches" (not sure why there was a need for a plural there...), and the performance got worse. I've also tried Opera, OmniWeb, Firefox, Camino, and even Sea Monkey. All of them are affected to some degree. Some put the text up fairly fast, and then spend quite a bit of time loading images, with or without placeholders. Some just sit on a blank page and do nothing for several minutes. I've had quite a few default to the old Lynx-style text pages, like I had followed an old Tripod page link and then backed my way up the link into the owner's user directory.
    I thought that my local net connection may have been a problem, since it was delivering about half its rated speed just a few days ago. However, I loaded up both the DSLReports and Speedtest sites and found that my connection was at a strong 10mb/sec rate. Interestingly, those two sites loaded fairly quickly.
    This is happening globally, across a wide range of both Webkit and KHTML browsers. Is there a pref somewhere that needs to be adjusted?
    Such an awesome machine, otherwise...

    I was amazed at the amount of info you put into that post. Thanks for that effort.
    I made sure Onyx was up-to-date and ran all the schemes you listed. That did nothing. However, reading further in your support thread gave me some ideas. I started looking into third party extensions and plugins. I recalled installing Silverlight a few days ago, for what reason I have no idea, since I trust Microsoft only marginally more than I trust Google. Which is to say, I don't trust either of them at all. So I threw that plugin into the trash.
    I should have checked the performance right there, but I didn't. Right under Silverlight, you mentioned Flash. I decided to check the prefs on it, and found that it was set to allow sites to save info to my computer, and Camera/Mic and Playback were changed from "Block" to "Ask Me". I distinctly remember setting those for maximum privacy. I reset them, cleared all the files, and exited the prefs.
    I just checked them again, and everything is changed back to allow Flash to have its way. Looks like I'll be uninstalling that now...
    I also installed Acrobat recently, just to have an alternative to Preview. Sea Monkey opened an alert box just now, telling me to watch out for the Acrobat plugins, as they've been known to cause problems. Gotta love Adobe.
    Back to the topic at hand, I think it was the Silverlight plugin that caused the slowdown. All my browsers are running at full speed now after I threw that plugin out. (Now if I could just get Safari to allow me to back up a page without re-rendering it every time...)
    Thanks very much for the help.

  • MBP performance very bad

    So I bought my MBP 13" this summer of 09. It's been less than 6 months, and my computer's performance has been pretty bad (since the beginning) compared to my white macbook that I bought in summer 08 and the white macbook that my dad bought afterwards with the nvidia 9400m graphics card.
    What is my problem?
    My problem is that the boot-up is extremely slow (compared to the macbooks). It was fine when I first got it, but just randomly it's giving trouble. I have itunes helper, growl, and stickies running on bootup (just like my old macbook).
    2nd problem is that I am seeing the rainbow ball more often for simple processes, like opening safari or an application like itunes. When I play games like call of duty 4 (on the default optimal settings) it plays fine and then it randomly starts lagging and keeps lagging unless you shut down the game and restart it. At first I thought the lag occurred when there were too many activities going on, but it should stop lagging afterwards. Nope! it still lags. In fact, it just starts lagging randomly even if nothing heavy is going on (like i'm just walking to get to the next checkpoint). The same thing happens to me when I play Farcry 2 on my windows partition. It would play fine and then randomly it would lag horribly.
    So what have I done?
    First, I cleared some space in my disk (I have 160 gig hdd - 30 of which is for Windows XP) so that I had around 30 gigs free on my Mac's partition. It still did not solve the problem.
    Next I backed everything up using Time-machine, and formatted my mac's partition and installed Snow-leopard 10.6.2 on it from Leopard 10.5.8.
    Results:
    Bootup still slow (tiny bit faster)
    Game still lags randomly (and stays laggy even when things "calm" down)
    Performance slightly better, but still not good.
    Can anyone guide me to what might be the source of the problem and if possible a solution please?

    One of the first and easiest diagnostics to perform if something has changed with your computer, and that is what you complaint is as far as I interpret it, is to log in as another User. Create a new User Account and do this. This lets you know if your problem is system wide or user wide.
    Also, and first actually, Repair Permissions and Repair Disk (at least verify) using Disk Utility. It costs nothing and might solve your problem.
    If you used to have enough RAM you still do as RAM does not diminish. This of course assumes you are not using application that are significantly more RAM intensive than you used to use.
    Leaving 10% of your hard drive free is only required if your hard drive is 20GB in total size. In other words, the amount you need free is not a function of the total amount that exists, it is a function of what your computer needs for swap space and that is a function of the particular apps you are running at any given time. After a clean restart, launch Activity Monitor and click the System Memory tab. See how much green unused RAM there is. Note that there will be little if any page outs. Keep Activity Monitor open and position its window such that you can keep an eye on the page outs. Go about your computing activity and note if or under what circumstances the page outs increase in a significant way.
    Ideally you want zero page outs but realistically a few, such as a very small percentage of the page ins is acceptable. The thing is, if your RAM is too little it will show up as excessive page outs. If they are few, and brief, then adding more RAM will only save you the time that it took for the page outs to be incurred.
    Unless I missed it, you did not mention how long it takes your machine to boot. That would be very useful information. Also mention how long you recall it requiring back when it was faster.
    My suspicion is that you have some unwanted application or process going on taking up CPU time. This can be discovered in Activity under %CPU "All Processes" not My Processes. Nothing should be using double digit percentage except the app you are running and that depends entirely on the particular app.
    Unlike a Windows PC you do not have a registry that is constantly filling up with garbage. You do not have a disk that is constantly getting more fragmented and needs tending. You do not have anything that should be constantly getting worse and slowing your machine, unless your hard drive is very very near full. I have tested this a number of times and you can fill the drive to the brim before it gives any measurable slow down with the apps I routinely run. Any slow down problem on the Mac can almost always be discovered and remedied without re-installs or any other extreme measures.

  • IDVD '08 suddenly won't open older iDVD projects

    All of a sudden, my iDVD projects created with iDVD 06 will not open in iDVD '08.
    No changes to the system or software, currently running iDVD 7.0.2.
    I've copied older iDVD projects from an external HD to my desktop and tried to open them with iDVD, and iDVD goes unresponsive after about 5 minutes. I've tried opening them directly from the external HD and still no joy.
    Ownership and permissions don't seem to be a problem, and the files are not "project locked".
    One week ago, this process was working like a charm. (Occasional "project locked" issues, but that's a trivial fix) Now, with absolutely no SW updates or anything, it's hanging up on me.
    Has anyone else experienced this, and if so, have you solved it?
    Thanks in advance!

    Hope the following links help butt if not just come on back. Btw ...This issue has been covered but not always resolved:
    http://discussions.apple.com/thread.jspa?messageID=7597658&#7597658
    http://discussions.apple.com/thread.jspa?messageID=7274901&#7274901
    http://discussions.apple.com/thread.jspa?messageID=7290240&#7290240
    http://discussions.apple.com/thread.jspa?messageID=7092703&#7092703
    http://dancameron.org/general/idvd-08-wont-start

  • Performance Issue ---Need help

    Hello Friends,
    Could you guys please help me in improving the performance. This query takes 2 minutes to run and I was wondering if you guys can just take a look and suggest something. I would really appreciate your help on this
    ALTER PROCEDURE [dbo].test
    @loginid int,
    @branchid int,
    @asofdate datetime,
    @ageperiod int,
    @showdetails bit,
    @programstatus INT,
    @propertytype INT,
    @sortby nvarchar(100)
    AS
    BEGIN
    SET FMTONLY OFF -- will allow temp tables on procedures for fyi reporting
    SET NOCOUNT ON
    SELECT
    mecdate = CONVERT( DATETIME, CONVERT(NVARCHAR(4),monthendyear) + '-' + CONVERT(NVARCHAR(2),monthendmonth) + '-1 00:00:00.000' ),
    branchid
    INTO
    #mecs
    FROM
    tmonthendcompleted
    WHERE
    companyid = 1 -- we should put it as parameter but we only have one company
    AND
    @branchid = -999
    OR branchid = @branchid
    --Create temp table
    CREATE TABLE #tmpAR
    branchid int not null default (0),
    accountid int not null default (0),
    siteid int not null default (0),
    programid int not null default (0),
    routeid int not null default(0),
    invoiceid int not null default (0),
    paymentid int not null default(0),
    transactiondate datetime not null,
    eventname nvarchar(50) not null,
    agingbucketnumber int not null default (0),
    invoicetotal money not null default (0),
    paymenttotal money not null default (0),
    prepay money not null default (0),
    prepayid int not null default(0)
    --Get pending invoices
    INSERT INTO
    #tmpAR (branchid, accountid, siteid, programid, routeid, invoiceid, transactiondate, eventname, agingbucketnumber, invoicetotal)
    SELECT
    invitem.servicecenterid, inv.accountid, est.siteid, invitem.programid,
    ISNULL((select top 1 routeid from tprogramvalue WHERE programid = invitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0),
    inv.invoiceid, inv.invoicedate, max(invitem.itemdescription),
    -- go to first day of invoice month, get max MEC date and datediff to get bucket # (according to asofdate)
    ISNULL((DATEDIFF(MONTH, DATEADD(month, DATEDIFF(month, 0, inv.invoicedate), 0), (SELECT MAX(mecdate) FROM #mecs WHERE branchid = invitem.servicecenterid AND mecdate <= @asofdate)) ),0),
    SUM(invitem.subtotalregular + invitem.fedtaxregular + invitem.statetaxregular + invitem.localtaxregular)
    FROM
    tinvoiceitem invitem
    INNER JOIN tinvoice inv ON invitem.invoiceid = inv.invoiceid
    INNER JOIN tprogram prog ON invitem.programid = prog.programid
    INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
    INNER JOIN testimate est ON prog.estimateid = est.estimateid
    INNER JOIN vreportlogin on invitem.servicecenterid = vreportlogin.branchid
    INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
    WHERE
    vreportlogin.loginid = @loginid
    AND (@branchid=-999 or vreportlogin.branchid = @branchid)
    AND inv.invoicedate < @asofdate
    GROUP BY
    invitem.servicecenterid, inv.accountid, est.siteid, invitem.programid, inv.routeid,
    inv.invoiceid, inv.invoicedate
    HAVING
    (ROUND(SUM(ISNULL([subtotalregular],0) + ISNULL([fedtaxregular],0) + ISNULL([statetaxregular],0) + ISNULL([localtaxregular],0)),2)
    ROUND(ISNULL((select sum(tpaymentitem.amount)
    from tpaymentitem
    inner join tpayment on tpayment.paymentid = tpaymentitem.headerid
    where invoiceid=inv.invoiceid
    and tpayment.datereceived < @asofdate),0)
    ,2)
    ) > 0
    --Get payments to pending invoices
    INSERT INTO
    #tmpAR (branchid, accountid, siteid, programid, routeid, invoiceid, paymentid, transactiondate, eventname, agingbucketnumber, paymenttotal)
    SELECT
    payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid,
    ISNULL((select top 1 routeid from tprogramvalue WHERE programid =payitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0),
    payitem.invoiceid, pay.paymentid, pay.datereceived,
    (select max(tinvoiceitem.itemdescription) from tinvoiceitem where invoiceid = payitem.invoiceid),
    -- go to first day of invoice month, get max MEC date and datediff to get bucket # (according to asofdate)
    ISNULL((DATEDIFF(MONTH, DATEADD(month, DATEDIFF(month, 0, inv.invoicedate), 0), (SELECT MAX(mecdate) FROM #mecs WHERE branchid = payitem.servicecenterid AND mecdate <= @asofdate)) ),0),
    SUM(payitem.amount)
    FROM
    tpaymentitem payitem
    INNER JOIN tpayment pay ON payitem.headerid = pay.paymentid
    INNER JOIN tprogram prog ON payitem.programid = prog.programid
    INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
    INNER JOIN testimate est ON prog.estimateid = est.estimateid
    INNER JOIN tinvoice inv ON payitem.invoiceid = inv.invoiceid
    INNER JOIN vreportlogin on payitem.servicecenterid = vreportlogin.branchid
    INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
    WHERE
    vreportlogin.loginid = @loginid
    AND (@branchid=-999 or vreportlogin.branchid = @branchid)
    AND payitem.invoiceid in (select invoiceid from #tmpAR)
    AND pay.datereceived < @asofdate
    GROUP BY
    payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid, inv.routeid,
    payitem.invoiceid, inv.invoicedate, pay.paymentid, pay.datereceived
    --Get payments to cop
    INSERT INTO
    #tmpAR (branchid, accountid, siteid, programid, routeid, prepayid, transactiondate, eventname, prepay)
    SELECT
    payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid,
    ISNULL((select top 1 routeid from tprogramvalue WHERE programid =payitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0) as routeid,
    pay.paymentid, pay.datereceived, max(progname.programname), SUM(payitem.amount)
    FROM
    tpaymentitem payitem
    INNER JOIN tpayment pay ON payitem.headerid = pay.paymentid
    INNER JOIN tprogram prog ON payitem.programid = prog.programid
    INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
    INNER JOIN tprogramsetupname000 progname ON progname.programtypeid = prog.programtypeid
    INNER JOIN testimate est ON prog.estimateid = est.estimateid
    INNER JOIN vreportlogin on payitem.servicecenterid = vreportlogin.branchid
    INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
    WHERE
    vreportlogin.loginid = @loginid
    AND (@branchid=-999 or vreportlogin.branchid = @branchid)
    AND pay.datereceived < @asofdate
    AND payitem.invoiceid = 0
    GROUP BY
    pay.paymentid, payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid, pay.datereceived
    CREATE TABLE #tmpAR2
    branchid int not null default (0),
    accountid int not null default (0),
    siteid int not null default(0),
    programid int not null default(0),
    routeid int not null default(0),
    invoiceid int not null default(0),
    paymentid int not null default(0),
    prepayid int not null default(0),
    transactiondate datetime,
    transactiondescription nvarchar(200),
    eventname nvarchar(50),
    InBucket01 money default (0),
    InBucket2 money default (0),
    InBucket3 money default (0),
    InBucket4 money default (0),
    InBucket5 money default (0),
    prepay money default (0),
    ProgramInBucket01 money not null default(0),
    ProgramInBucket2 money not null default(0),
    ProgramInBucket3 money not null default(0),
    ProgramInBucket4 money not null default(0),
    ProgramInBucket5 money not null default(0),
    ProgramDebit money not null default(0),
    ProgramCredit money not null default(0),
    ProgramBalance money not null default(0),
    RouteInBucket01 money not null default(0),
    RouteInBucket2 money not null default(0),
    RouteInBucket3 money not null default(0),
    RouteInBucket4 money not null default(0),
    RouteInBucket5 money not null default(0),
    RouteDebit money not null default(0),
    RouteCredit money not null default(0),
    RouteBalance money not null default(0),
    BranchInBucket01 money not null default(0),
    BranchInBucket2 money not null default(0),
    BranchInBucket3 money not null default(0),
    BranchInBucket4 money not null default(0),
    BranchInBucket5 money not null default(0),
    BranchDebit money not null default(0),
    BranchCredit money not null default(0),
    BranchBalance money not null default(0)
    update #tmpAR
    set agingbucketnumber = 4
    where agingbucketnumber > 4
    --Bucket 0 INVOICES
    INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket01, siteid, programid, routeid)
    SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 0
    AND invoicetotal > 0
    --Bucket 0 PAYMENTS
    INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket01, siteid, programid, routeid)
    SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 0
    AND paymenttotal <> 0
    --Bucket 1 INVOICE
    INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket2, siteid, programid, routeid)
    SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 1
    AND invoicetotal > 0
    --Bucket 1 PAYMENT
    INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket2, siteid, programid, routeid)
    SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 1
    AND paymenttotal <> 0
    --Bucket 2 INVOICES
    INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket3, siteid, programid, routeid)
    SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 2
    AND invoicetotal > 0
    --Bucket 2 PAYMENT
    INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket3, siteid, programid, routeid)
    SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 2
    AND paymenttotal <> 0
    --Bucket 3 (91-120 days) INVOICES
    INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket4, siteid, programid, routeid)
    SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 3
    AND invoicetotal > 0
    --Bucket 3 (91-120 days) PAYMENTS
    INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket4, siteid, programid, routeid)
    SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 3
    AND paymenttotal <> 0
    --Bucket 4 (over 120 days) INVOICES
    INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket5, siteid, programid, routeid)
    SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 4
    AND invoicetotal > 0
    --Bucket 4 (over 120 days) PAYMENTS
    INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket5, siteid, programid, routeid)
    SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE agingbucketnumber = 4
    AND paymenttotal <> 0
    --Prepay
    INSERT INTO #tmpAR2 (branchid, accountid, prepayid, transactiondate, transactiondescription, eventname, prepay, siteid, programid, routeid)
    SELECT branchid, accountid, prepayid, transactiondate, dbo.fngetTransactionDescription(prepayid,2) as description, eventname, prepay*-1, siteid, programid, routeid
    FROM #tmpAR
    WHERE prepay <> 0
    DECLARE @InBucket01Total money
    DECLARE @InBucket2Total money
    DECLARE @InBucket3Total money
    DECLARE @InBucket4Total money
    DECLARE @InBucket5Total money
    DECLARE @DebitBalance money
    DECLARE @CreditBalance money
    DECLARE @Balance money
    --PROGRAM TOTALS
    SELECT
    INTO
    #tmpProgramTotals
    FROM
    #tmpAR2
    DECLARE @programid int
    DECLARE @routeid int
    WHILE (select COUNT(*) from #tmpProgramTotals) > 0
    BEGIN
    select top 1 @programid = programid, @routeid = routeid from #tmpProgramTotals
    --Get Program Totals
    select
    @InBucket01Total = SUM(InBucket01),
    @InBucket2Total = SUM(InBucket2),
    @InBucket3Total = SUM(InBucket3),
    @InBucket4Total = SUM(InBucket4),
    @InBucket5Total = SUM(InBucket5),
    @DebitBalance = SUM(InBucket01) + SUM(InBucket2) + SUM(InBucket3) + SUM(InBucket4) + SUM(InBucket5),
    @CreditBalance = SUM(prepay),
    @Balance = ((SUM(InBucket01) + SUM(InBucket2) + SUM(InBucket3) + SUM(InBucket4) + SUM(InBucket5)) + SUM(prepay))
    from #tmpProgramTotals where programid = @programid and routeid = @routeid
    UPDATE
    #tmpAR2
    SET
    ProgramInBucket01 = @InBucket01Total,
    ProgramInBucket2 = @InBucket2Total,
    ProgramInBucket3 = @InBucket3Total,
    ProgramInBucket4 = @InBucket4Total,
    ProgramInBucket5 = @InBucket5Total,
    ProgramDebit = @DebitBalance,
    ProgramCredit = @CreditBalance,
    ProgramBalance = @Balance
    WHERE
    programid = @programid
    AND routeid = @routeid
    delete #tmpProgramTotals where programid = @programid and routeid = @routeid
    END
    DROP TABLE #tmpProgramTotals
    CREATE TABLE #tmpIncludedprepay (paymentid int)
    SELECT
    INTO
    #tmpProgramCredits
    FROM
    #tmpAR2
    WHILE (select COUNT(*) from #tmpProgramCredits) > 0
    BEGIN
    select top 1 @programid = programid, @routeid = routeid from #tmpProgramCredits
    declare @programcreditbalance money
    select @programcreditbalance = ProgramCredit from #tmpAR2 where programid = @programid and routeid = @routeid
    while @programcreditbalance < 0
    BEGIN
    declare @creditamount money
    declare @paymentid int
    select top 1 @creditamount = prepay, @paymentid = prepayid
    from #tmpAR2
    where programid = @programid and routeid = @routeid
    and prepayid <> 0 and prepayid not in (select paymentid from #tmpIncludedprepay)
    and prepay < 0
    order by transactiondate desc
    insert into #tmpIncludedprepay values (@paymentid)
    if @programcreditbalance - @creditamount > 0
    BEGIN
    UPDATE
    #tmpAR2
    SET
    prepay = @programcreditbalance
    WHERE
    prepayid = @paymentid
    END
    set @programcreditbalance = @programcreditbalance - @creditamount
    END
    delete #tmpProgramCredits where programid = @programid and routeid = @routeid
    END
    DROP TABLE #tmpProgramCredits
    DELETE FROM #tmpAR2
    WHERE prepayid <> 0 AND prepayid not in (select paymentid from #tmpIncludedprepay)
    DROP TABLE #tmpIncludedprepay
    SELECT
    acct.accountid,
    acct.accountnum,
    br.branchid,
    br.branchname,
    r.routeid,
    r.routename,
    CASE scontact.businessname WHEN '' THEN scontact.lastname + '. ' + scontact.firstname ELSE scontact.businessname END as Name,
    sphone.phonenumber,
    CASE WHEN prog.canceldate is not null THEN 'Cancelled'
    ELSE CASE WHEN prog.pendingcanceldate is not null THEN 'Pending Cancel'
    ELSE CASE WHEN prog.warrantyexpirationdate <= @asofdate THEN 'Expired'
    ELSE 'Active' END
    END
    END as programstatus,
    CASE WHEN prog.canceldate is not null THEN 3
    ELSE CASE WHEN prog.pendingcanceldate is not null THEN 4
    ELSE CASE WHEN prog.warrantyexpirationdate <= @asofdate THEN 2
    ELSE 1 END
    END
    END as programstatus_indicator,
    prog.programid,
    convert(varchar, transactiondate, 101) as transactiondate,
    transactiondescription,
    eventname,
    (CASE WHEN prepay <> 0 then prepay else InBucket01 END) as InBucket01,
    InBucket2,
    InBucket3,
    InBucket4,
    InBucket5,
    ProgramDebit,
    ProgramCredit,
    ProgramBalance,
    ProgramInBucket01,
    ProgramInBucket2,
    ProgramInBucket3,
    ProgramInBucket4,
    ProgramInBucket5,
    RouteInBucket01,
    RouteInBucket2,
    RouteInBucket3,
    RouteInBucket4,
    RouteInBucket5,
    RouteDebit,
    RouteCredit,
    RouteBalance,
    BranchInBucket01,
    BranchInBucket2,
    BranchInBucket3,
    BranchInBucket4,
    BranchInBucket5,
    BranchDebit,
    BranchCredit,
    BranchBalance,
    Detail = 1,
    Age = CASE @ageperiod
    WHEN 0 THEN 'Debits'
    WHEN 1 THEN 'Credits'
    WHEN 2 THEN '31-60 Days and older'
    WHEN 3 THEN '61-90 Days and older'
    WHEN 4 THEN '91-120 Days and older'
    WHEN 5 THEN '120 Days and older'
    WHEN -999 THEN 'All Balance'
    END,
    PropertyType = CASE sit.propertytype
    WHEN 1 THEN 'Residential'
    WHEN 2 THEN 'Commercial'
    WHEN 5 THEN 'National'
    ELSE ''
    END
    INTO
    #results
    FROM
    #tmpAR2
    INNER JOIN taccount acct ON acct.accountid = #tmpAR2.accountid
    INNER JOIN tbranch br ON br.branchid = #tmpAR2.branchid
    INNER JOIN troute r ON r.routeid = #tmpAR2.routeid
    INNER JOIN tprogram prog ON prog.programid = #tmpAR2.programid
    INNER JOIN testimate est ON est.estimateid = prog.estimateid
    INNER JOIN tsite sit ON sit.siteid = est.siteid
    INNER JOIN tcontact scontact on acct.primarycontactid = scontact.contactid
    INNER JOIN taddress saddr on acct.billingaddressid = saddr.addressid
    LEFT JOIN tcontactphonenumber sphone ON scontact.primaryphoneid = sphone.phoneid
    WHERE
    --Debit Balance
    (@ageperiod <> 0 OR ProgramBalance > 0)
    --Credit Balance
    AND (@ageperiod <> 1 OR ProgramBalance < 0)
    --31-60 Days and older
    AND (@ageperiod <> 2 OR (ProgramInBucket2 > 0 or ProgramInBucket3 > 0 or ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
    --61-90 Days and older
    AND (@ageperiod <> 3 OR (ProgramInBucket3 > 0 or ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
    --90 Days and older
    AND (@ageperiod <> 4 OR (ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
    --120 Days and older
    AND (@ageperiod <> 5 OR ProgramInBucket5 > 0)
    -- property type
    AND (@propertytype = -999 OR sit.propertytype = @propertytype)
    --Need to add a line with null values for the timeline if details are not showing
    IF @showdetails = 0
    BEGIN
    INSERT INTO
    #results
    SELECT DISTINCT
    --TFS-8903 .. JL ... 2/12/2014
    accountid,
    accountnum, branchid, branchname, routeid, routename, Name,
    phonenumber, programstatus,programstatus_indicator,programid, null, null, null,
    null, null, null, null, null,
    ProgramDebit,ProgramCredit, ProgramBalance,
    ProgramInBucket01, ProgramInBucket2, ProgramInBucket3, ProgramInBucket4, ProgramInBucket5,
    RouteInBucket01, RouteInBucket2, RouteInBucket3, RouteInBucket4, RouteInBucket5,
    RouteDebit, RouteCredit, RouteBalance,
    BranchInBucket01, BranchInBucket2, BranchInBucket3, BranchInBucket4, BranchInBucket5,
    BranchDebit, BranchCredit, BranchBalance,
    0, Age, PropertyType
    FROM
    #results
    DELETE FROM #results
    WHERE Detail = 1
    END
    IF @programstatus <> -999 AND @programstatus <> 1 -- ACTIVE
    BEGIN
    DELETE r
    FROM
    #results r
    INNER JOIN tprogram p
    ON r.programid = p.programid
    WHERE
    r.programstatus_indicator = 1
    END
    IF @programstatus <> -999 AND @programstatus <> 2 -- Expired
    BEGIN
    DELETE r
    FROM
    #results r
    INNER JOIN tprogram p
    ON r.programid = p.programid
    WHERE
    r.programstatus_indicator = 2
    END
    IF @programstatus <> -999 AND @programstatus <> 3 -- CANCELLED
    BEGIN
    DELETE r
    FROM
    #results r
    INNER JOIN tprogram p
    ON r.programid = p.programid
    WHERE
    r.programstatus_indicator = 3
    END
    IF @programstatus <> -999 AND @programstatus <> 4 -- PENDING CANCEL
    BEGIN
    DELETE r
    FROM
    #results r
    INNER JOIN tprogram p
    ON r.programid = p.programid
    WHERE
    r.programstatus_indicator = 4
    END
    SELECT
    branchid,
    routeid
    INTO
    #branchesRoutes
    FROM
    tbranchroute
    IF @branchid <> -999
    BEGIN
    DELETE FROM #branchesRoutes
    WHERE branchid <> @branchid
    END
    SELECT
    accountid = ISNULL(res.accountid,0),
    accountnum = ISNULL(res.accountnum, ''),
    branchid = b.branchid,
    branchname = b.branchname,
    routeid = r.routeid,
    routename = r.routename,
    Name = ISNULL(Name,''),
    phonenumber,
    programstatus,
    programid = ISNULL(programid,0),
    transactiondate = transactiondate,
    transactiondescription,
    eventname,
    detail0to30 = InBucket01,
    detail31to60 = InBucket2,
    detail61to90 = InBucket3,
    detailOver90 = InBucket4,
    detailOver120 = InBucket5,
    ProgramDebit = ISNULL(ProgramDebit,0),
    ProgramCredit = ISNULL(ProgramCredit,0),
    ProgramBalance = ISNULL(ProgramBalance,0),
    Program0to30 = ISNULL(ProgramInBucket01,0),
    Program31to60 = ISNULL(ProgramInBucket2,0),
    Program61to90 = ISNULL(ProgramInBucket3,0),
    ProgramOver90 = ISNULL(ProgramInBucket4,0),
    ProgramOver120 = ISNULL(ProgramInBucket5,0),
    Route0to30 = ISNULL(RouteInBucket01,0),
    Route31to60 = ISNULL(RouteInBucket2,0),
    Route61to90 = ISNULL(RouteInBucket3,0),
    RouteOver90 = ISNULL(RouteInBucket4,0),
    RouteOver120 = ISNULL(RouteInBucket5,0),
    RouteDebit = ISNULL(RouteDebit,0),
    RouteCredit = ISNULL(RouteCredit,0),
    RouteBalance = ISNULL(RouteBalance,0),
    Branch0to30 = ISNULL(BranchInBucket01,0),
    Branch31to60 = ISNULL(BranchInBucket2,0),
    Branch61to90 = ISNULL(BranchInBucket3,0),
    BranchOver90 = ISNULL(BranchInBucket4,0),
    BranchOver120 = ISNULL(BranchInBucket5,0),
    BranchDebit = ISNULL(BranchDebit,0),
    BranchCredit = ISNULL(BranchCredit,0),
    BranchBalance = ISNULL(BranchBalance,0),
    ISNULL((select top 1 tfinancestatussetup.financestatus
    from tevent inner join tfinancestatussetup on tevent.financestatusid = tfinancestatussetup.financestatusid
    inner join tprogram on tevent.programid = tprogram.programid
    inner join #results r2 on r2.programid = tprogram.programid
    inner join testimate on testimate.estimateid = tprogram.estimateid
    where testimate.accountid = res.accountid
    order by tevent.submitteddate desc), '') as racstatus,
    Detail = ISNULL(Detail,0),
    Age,
    Case
    when (acc.allowautobill = 1) or
    (select count(accp.programid) from taccountebaprogram accp
    where accp.accountid = acc.accountid ) > 0 then 'Auto Pay'
    else ''
    END as StatusNote,
    CASE @sortby
    WHEN 'name' THEN 1
    ELSE 0
    END as Sort,
    PropertyType,
    hasservices = CASE WHEN res.accountid IS NULL THEN 0 ELSE 1 END
    INTO
    #results2
    FROM
    #results res
    inner join taccount acc on acc.accountid=res.accountid
    inner join #branchesRoutes br on br.routeid = res.routeid AND br.branchid = res.branchid
    inner join troute r ON r.routeid = br.routeid
    inner join tbranch b on b.branchid = br.branchid
    --Set Route Totals
    SELECT
    routeid,
    SUM(ProgramInBucket01) as RouteInBucket01,
    SUM(ProgramInBucket2) as RouteInBucket2,
    SUM(ProgramInBucket3) as RouteInBucket3,
    SUM(ProgramInBucket4) as RouteInBucket4,
    SUM(ProgramInBucket5) as RouteInBucket5, --xx
    SUM(ProgramDebit) as RouteDebit,
    SUM(ProgramCredit) as RouteCredit,
    SUM(ProgramBalance) as RouteBalance
    INTO
    #routetotals
    FROM
    (select distinct
    routeid, programid, ProgramInBucket01, ProgramInBucket2, ProgramInBucket3, ProgramInBucket4, ProgramInBucket5, ProgramDebit, ProgramCredit, ProgramBalance
    from
    #results
    ) t
    GROUP BY
    routeid
    UPDATE
    #results2
    SET
    Route0to30 = t.RouteInBucket01,
    Route31to60 = t.RouteInBucket2,
    Route61to90 = t.RouteInBucket3,
    RouteOver90 = t.RouteInBucket4,
    RouteOver120 = t.RouteInBucket5,
    RouteDebit = t.RouteDebit,
    RouteCredit = t.RouteCredit,
    RouteBalance = t.RouteBalance
    FROM
    #results2
    INNER JOIN #routetotals t on t.routeid = #results2.routeid
    --Set Branch Totals
    SELECT
    branchid,
    SUM(Route0to30) as BranchInBucket01,
    SUM(Route31to60) as BranchInBucket2,
    SUM(Route61to90) as BranchInBucket3,
    SUM(RouteOver90) as BranchInBucket4,
    SUM(RouteOver120) as BranchInBucket5,
    SUM(RouteDebit) as BranchDebit,
    SUM(RouteCredit) as BranchCredit,
    SUM(RouteBalance) as BranchBalance
    INTO
    #branchtotals
    FROM
    (select distinct
    branchid, routeid, Route0to30, Route31to60, Route61to90, RouteOver90, RouteOver120, RouteDebit, RouteCredit, RouteBalance
    from
    #results2
    ) t
    GROUP BY
    branchid
    UPDATE
    #results2
    SET
    Branch0to30 = t.BranchInBucket01,
    Branch31to60 = t.BranchInBucket2,
    Branch61to90 = t.BranchInBucket3,
    BranchOver90 = t.BranchInBucket4,
    BranchOver120 = t.BranchInBucket5,
    BranchDebit = t.BranchDebit,
    BranchCredit = t.BranchCredit,
    BranchBalance = t.BranchBalance
    FROM
    #results2
    INNER JOIN #branchtotals t on t.branchid = #results2.branchid
    SELECT * FROM #results2 -- order by routeid, branchid
    drop table #branchesRoutes
    drop table #tmpAR
    drop table #branchtotals
    drop table #routetotals
    drop table #tmpAR2
    drop table #results
    drop table #results2
    drop table #mecs
    END

    Use this tool on my web site:
    http://www.sommarskog.se/sqlutil/sqltrace.html
    The stored procedure sp_sqltrace sets up a trace filtered for you own spid, and accepts a command batch, which in your case is a call to your stored procedure. It will aggregrate the data per statement. This procedure helps you identify what is taking time.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • EP6 sp12 Performance Issue, Need help to improve performance

    We have a Portal development environment with EP6.0 sp12.
    What we are experiencing is performance issue, It's not extremely slow, but slow compared to normal ( compared to our prod box). For example, after putting the username and password and clicking the <Log on> Button it's taking more than 10 secs for the first home page to appear. Also currently we have hooked the Portal with 3 xAPPS system and one BW system. The time taken for a BW query to appear ( with selection screen) is also more than 10 secs. However access to one other xAPPS is comparatively faster.
    Do we have a simple to use guide( Not a very elaborate one) with step by step guidance to immediately improve the performance of the Portal.
    Simple guide, easy to implement,  with immediate effect is what we are looking for in the short term
    Thanks
    Arunabha

    Hi Eric,
      I have searched but didn't find the Portal Tuning and Optimization Guide as you have suggested, Can you help to find this.
    Subrato,
      This is good and I would obviously read through this, The issue here is this is only for Network.
      But do you know any other guide, which as very basic ( may be 10 steps) and show step by step the process, it would be very helpful. I already have some information from the thread Portal Performance - page loads slow, client cache reset/cleared too often
    But really looking for answer ( steps to do it quickly and effectively) instead of list of various guides.
    It would be very helpful if you or anybody( who has actually done some performance tuning) can send  a basic list of steps that I can do immediately, instead of reading through these large guides.
    I know I am looking for a shortcut, but this is the need of the hour.
    Thanks
    Arun

  • Lookup transformation - Performance Issue -Please help!

    Hi,
     I have a Source table with 5 million rows. I am pulling all the rows from the source table, then doing the lookup with 5 different tables one by one.
    I use Full cache as the lookup table size is very less only. I used 'Ignore Failure' option in lookup table as I need to do the left join. That means, even if there is NO match, those records also should be passed to the bottom.
     Now, the problem is it is taking a lot of time. To load 1,00,000 records, it is taking 1 hour. The how about 5 Million rows? 50 hours? Could you please help me to find out what is the  mistake i am doing here?

    Is the performance still very poor if you only add for example a row count transformation after your source?
    How many rows are there in the lookup tables? Are you only selecting the columns you need? Is the data type of the selected columns very large?
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • IDVD 08 Keeps Freezing, Help!!

    So about 2-3 months ago, I had the same problem with my iDVD 08 and I tried everything to fix it. However nothing worked for me and after countless calls to apple, I just gave up on the application. Now I find that I need this application because of the media projects I am working on. I'll do my best to explain the problem.
    When I open iDVD 08, it displays the normal start menu (new project, open project, etc.) and I click new project and a window pops up, displaying the normal: Save As:.................. and Where:..........
    When I click ok, the application stays open, but I don't see a window. When I attempt to close iDVD, it freezes and I have to force quit. I sent those problem report things over 10 times now and I've tried every thing that apple has told me to do. I've tried deleting the old themes, reinstalling iDVD 08, but nothing seems to be working. I'm sure that I'm not the first person with this problem because I've visited other forums with people asking similar questions (no, there were no responses to those questions). Any advice?

    Suggestion: let's try setting up a separate user account and launching / running iDvd from the new account (if you haven't already).
    Adding a new user account to your computer
    You can create individual user accounts for each person who uses your computer. Each new user has a separate home folder and can adjust his or her own preferences without affecting other users.
    Choose Apple menu > System Preferences and click Accounts.
    If some settings are dimmed, click the lock icon and type an administrator name and password.
    Click Add + and type the user's name.
    If you don't want to use the short name generated automatically, type a new short name. (Once the account is created, you won't be able to change the short name.)
    Type the user's password in the Password and Verify boxes.
    Type a hint to help the user remember the password if they have trouble remembering it at login.
    Click Parental Controls and select options to determine what the user can do with the computer.

Maybe you are looking for