Thursday 26 December 2013

Expenditure Items - and Batches

Expenditure Items in project

For some reason, probably to do with indexes, it's a lot faster to search through the table holding expenditure items via expenditure_item_id than via creation dates, though other things are also pretty fast, like searching by project number.
There's another piece of SQL for a different page... the SQL on this page is more basic, with no link to AP, as not all expenditure items are linked to AP invoices.

-- Basic items checking
SELECT peia.expenditure_item_id trans_id
     , pea.expenditure_group batch
     , pet.expenditure_category expend_type
     , pet.expenditure_type
     , peia.transaction_source tx_src
     , peia.expenditure_item_date exp_date
     , peia.creation_date
     , peia.raw_cost
     , ppa.segment1 project
     , pt.task_number task
     , pec.expenditure_comment comment_
  FROM pa.pa_expenditure_items_all peia
     , pa.pa_expenditures_all pea
     , pa.pa_projects_all ppa
     , pa.pa_tasks pt
     , pa.pa_expenditure_types pet
     , pa.pa_expenditure_comments pec
 WHERE peia.expenditure_id = pea.expenditure_id(+)
   AND peia.project_id = ppa.project_id
   AND peia.task_id = pt.task_id
   AND peia.expenditure_type = pet.expenditure_type
   AND peia.expenditure_item_id = pec.expenditure_item_id
   AND ppa.project_id = pt.project_id
   AND peia.expenditure_item_id > :transid
--   AND ppa.segment1 = :projectnum
ORDER BY peia.expenditure_item_date desc, pt.task_number desc;
/*##############################################################################
#      TOTAL EXPENDITURES FOR A PROJECT
/*############################################################################*/
  SELECT ppa.segment1 project
       , pt.task_number task
       , pt.task_name
       , SUM (peia.raw_cost) total
       , ppa.description      
    FROM pa.pa_expenditure_items_all peia
       , pa.pa_projects_all ppa
       , pa.pa_tasks pt
   WHERE peia.project_id = ppa.project_id
     AND peia.task_id = pt.task_id
     AND ppa.segment1 = '123456'
GROUP BY ppa.segment1
       , pt.task_number
       , pt.task_name
       , ppa.description
ORDER BY ppa.segment1
       , pt.task_number;
/*##############################################################################
#      EXPENDITURE ITEMS LINKED TO COST ITEMS
/*############################################################################*/
SELECT peia.expenditure_item_id trans_id
     , ppa.segment1 project
     , pt.task_number task
     , pps.project_status_name status
     , pea.expenditure_group batch
     , pet.expenditure_category expend_type
     , pet.expenditure_type exp_type
     , peia.transaction_source tx_src
     , peia.expenditure_item_date exp_date
     , peia.creation_date
     , peia.raw_cost
     , peia.quantity
     , peia.request_id
     , peia.request_id exp_item_request_id
     , '### system-references ###'
     , pcdla.*
  FROM pa.pa_expenditure_items_all peia
     , pa.pa_cost_distribution_lines_all pcdla
     , pa.pa_expenditures_all pea
     , pa.pa_projects_all ppa
     , pa.pa_tasks pt
     , pa.pa_expenditure_types pet
     , pa.pa_expenditure_comments pec
     , pa.pa_project_statuses pps
     , applsys.fnd_user fu
 WHERE peia.expenditure_item_id = pcdla.expenditure_item_id
   AND peia.expenditure_id = pea.expenditure_id(+)
   AND peia.project_id = ppa.project_id(+)
   AND peia.task_id = pt.task_id(+)
   AND peia.expenditure_type = pet.expenditure_type(+)
   AND peia.expenditure_item_id = pec.expenditure_item_id(+)
   AND ppa.project_id = pt.project_id
   AND ppa.project_status_code = pps.project_status_code
   AND peia.created_by = fu.user_id(+)
   AND peia.creation_date > '15-MAY-2013'
   AND 1 = 1;

Expenditure Batches

 -- basic batches info

  SELECT *
    FROM pa.pa_expenditure_groups_all pega
   WHERE pega.creation_date >= '22-JAN-2005'
ORDER BY pega.creation_date DESC;
-- batch count per transaction source
  SELECT pega.transaction_source
       , MAX (pega.creation_date) max_date
       , COUNT (*) ct
    FROM pa.pa_expenditure_groups_all pega
   WHERE pega.transaction_source = 'PAYROLL'
GROUP BY transaction_source
ORDER BY 1;

39 comments:

  1. Hi
    I wanted to generate the interface to get the revenue details for miscellaneous transaction. below is my scenario.
    If there is a Project P1 where there has been a revenue generation, but cost is not incurred on the Project, then we have to create that cost in the base entity where actually the People are going to work
    means if the Project P1 belongs to Matrix entity and the Revenue has to be generated to India Entity, then you have to create a expenditure on that Project from India

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. If there is a Project P1 where there has been a revenue generation, but cost is not incurred on the Project...


    Weblogic Application Server training

    ReplyDelete


  4. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.


    UIPath Training in Bangalore

    ReplyDelete

  5. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    amazon-web-services-training-in-bangalore

    big-data-hadoop-training-institute-in-bangalore

    ReplyDelete
  6. Thanks For The Great Information Provided by the blog and it will be very useful for the beginners very well.

    67500/12

    ReplyDelete
  7. Really It's A Great Pleasure reading your Article,learned a lot of new things,we have to keep on updating it,Chicago Immediate care in Chicago.By getting them into one place.Really thanks for posting.Very Thankful for the Informative Post.Really Thanks For Posting.Really Thanks For Sharing.

    ReplyDelete
  8. I am really happy with your blog because your article is very unique and powerful for new reader.
    selenium training in chennai

    ReplyDelete
  9. When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.

    Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR, Chennai

    Amazon Web Services Training in Tambaram, Chennai|Best AWS Training in Tambaram, Chennai

    ReplyDelete
  10. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    python training in pune
    python training institute in chennai
    python training in Bangalore

    ReplyDelete
  11. really a good blog with an informative stuff....

    Vijay Devarakonda Height

    ReplyDelete
  12. I think things like this are really interesting. I absolutely love to find unique places like this. It really looks super creepy though!!
    machine learning training in chennai

    artificial intelligence and machine learning course in chennai

    machine learning classroom training in chennai

    ReplyDelete
  13. Hello, I read your blog occasionally, and I own a similar one, and I was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me insane, so any assistance is very much appreciated.
    Android Course Training in Chennai | Best Android Training in Chennai
    Selenium Course Training in Chennai | Best Selenium Training in chennai
    Devops Course Training in Chennai | Best Devops Training in Chennai

    ReplyDelete
  14. Thanks for sharing this blog. The content is beneficial and useful. Very informative post.
    finance write for us

    ReplyDelete
  15. nice the great blogs and share to good information.
    write for us

    ReplyDelete
  16. Hi,
    Good job & thank you very much for the new information, i learned something new. Very well written. It was sooo good to read and usefull to improve knowledge. Who want to learn this information most helpful. One who wanted to learn this technology IT employees will always suggest you take python training in pune. Because Python course in pune is one of the best that one can do while choosing the course.

    ReplyDelete
  17. Such a great word which you use in your article and article is amazing knowledge. thank you for sharing it.

    Start your journey with RPA Course and get hands-on Experience with 100% Placement assistance from Expert Trainers with 8+ Years of experience @eTechno Soft Solutions Located in BTM Layout Bangalore.

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Nice article and thanks for sharing with us. Its very informative


    Plots in CHITUKULA

    ReplyDelete
  20. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man learn Pega Online Training
    Pega Online Course

    ReplyDelete
  21. Iam so thrilled because of finding your alluring website here.Actually i was searching for Oracle PPM Cloud.Your blog is so astounding and informative too..Iam very happy to find such a creative blog. Iam also find another one by mistake while am searching the same topicOracle Fusion HCM.Thank you soo much.

    ReplyDelete
  22. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here .Same as your blog i found another one Oracle Project Portfolio Management Cloud . Actually I was looking for the same information on internet for Oracle PPM and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

    ReplyDelete

  23. Simply wish to say your article is as astonishing. The clarity in your post is simply great, and I could assume you are an expert on this subject. Same as your blog i found another one Oracle Project Portfolio Management Cloud Software .Actually I was looking for the same information on internet for Oracle PPM and came across your blog. I am impressed by the information that you have on this blog. Thanks a million and please keep up the gratifying work.




    ReplyDelete
  24. Want to set your career towards the software field? Then join hands with Infycle Technologies to make this into reality. Infycle Technologies, the best software training center in Chennai, gives the combined and best software training in Chennai, with various stages of multiple courses such as Big Data, Python, Data Science, Oracle, etc., which professional tutors will guide in the field. The Hands-on practical training and the mock interview sessions will be given to the candidates to face the interviews with full confidence. Apart from all, the candidates will be placed in the top MNC's with the highest salary package in the market. To get it all, call 7502633633 and make this happen for your happy life.
    Best Software Training Center in Chennai | Infycle Technologies

    ReplyDelete
  25. Infycle Technologies, the best software training institute in Chennai offers the best Oracle training in Chennai for students, freshers, and tech professionals. In addition to that, other in-demand courses such as Big Data, Java, Python, Power BI, Digital Marketing will be trained with 200% practical classes. Once the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7502633633 to get more info and a free demo.Best Oracle Training in Chennai | Infycle Technologies

    ReplyDelete
  26. Grab Data Science Certification in Chennai for skyrocketing your career with Infycle Technologies, the best Software Training & Placement institutes in and around Chennai. In addition to the Certification, Infycle also gives the best placement training for personality tests, interview preparation, and mock interviews for leveling up the candidate's grades to a professional level.

    ReplyDelete
  27. Oh man! This blog is sick! How did you make it look like this !
    sccm training
    sccm online training

    ReplyDelete
  28. Best AWS Training provided by Vepsun in Bangalore for the last 12 years. Our Trainer has more than 20+ Years
    of IT Experience in teaching Virtualization and Cloud topics.. we are very delighted to say that Vepsun is
    the Top AWS cloud training Provider in Bangalore. We provide the best atmosphere for our students to learn.
    Our Trainers have great experience and are highly skilled in IT Professionals. AWS is an evolving cloud
    computing platform provided by Amazon with a combination of IT services. It includes a mixture of
    infrastructure as service and packaged software as service offerings and also automation. We have trained
    more than 10000 students in AWS cloud and our trainer Sameer has been awarded as the best Citrix and Cloud
    trainer in india.

    ReplyDelete
  29. Thank for sharing wonderful blog, it is great information. anyone looking SEO Company in Inida

    ReplyDelete
  30. It is Very Useful information about Fast Food. If you love Fast Food Visit Xero Degrees

    ReplyDelete
  31. I have Microsoft Office 2016 installed on a computer that I am replacing and I cannot find the DVD/Product Key. Is there any way to get Download MS Office 2016 With Crack

    ReplyDelete