How to Sum the amounts for calculating rates.
Hi,
I have a requirement in Apps 11i (OAB) that I need to code in PL/SQL. I would be calling a procedure in order to complete this task. When an Extract is run, this code gets executed and should return the amount for that person.
I need to calculate sum of all the amounts for each of the months between START date to the END date.
Ex: Amount = Amount + (for each of the months between START and END date) x Rate.
This START and END date would be calculated in the procedure itself.(dynamic).
Once we get the START date and END date, we need to loop thru some records and find person's rate between those START date and END date.
For rate calculation:
15th day of any month is used as the cut off date for rate calculation.
Suppose from 01-JAN-2006 to 15-MAR-2006 Rate is Rs 10 AND
16-MAR-2006 to 01-JUL-2006 rate is Rs 20 AND person died on 01-JUL-2006
Then rate = Rs(3x10) + Rs(3x20) + full month of July Rs.20 (P.S Here person's death needs to evaluated for the whole month) =30 + 60 + 20 = Rs.110
Typically the start date and end date would be in one particular YEAR. And person may have different rates for different amounts as mentioned above.
Let me if you need any more details..Thank You!
Additional Info:
This data comes from 2 tables in OAB Application where it can be joined with a common ID.
One table lets say Coverage table contains the usual columns Eff_start_date, Eff_end_date along with this it has Coverage_start_date and Coverage_end_date (Dates specifying duration of the person enrolled in particular coverage.)
P.S Rate Changes ONLY when the person enrolls in different coverage.
2nd Table lets say Rate table contains the usual columns Eff_start_date, Eff_end_date along with this it has rate_start_date and rate_end_date and RATE(column) for that duration.(may vary depending upon the coverage).
All the records should be between the START and END date, which will be calculated at runtime.
Unable to submit any sample records.:-(
Well, IF I had given the exact requirement, I would have got the solution by this Time!!! Your comments (and solutions) would definitely help me. Thank You
Message was edited by:
user559682
If i understand you correctly it can be possible with :
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> drop table dates;
Table dropped
SQL> create table dates( "start" date, "end" date, "rate" number);
Table created
SQL> insert into dates values( to_date('01.01.2006', 'DD.MM.YYYY'), to_date('30.05.2006', 'DD.MM.YYYY'), 10);
1 row inserted
SQL> insert into dates values( to_date('01.06.2006', 'DD.MM.YYYY'), to_date('15.09.2006', 'DD.MM.YYYY'), 15);
1 row inserted
SQL> insert into dates values( to_date('16.09.2006', 'DD.MM.YYYY'), to_date('31.12.2006', 'DD.MM.YYYY'), 20);
1 row inserted
SQL> SELECT * FROM dates;
start end rate
01.01.2006 30.05.2006 10
01.06.2006 15.09.2006 15
16.09.2006 31.12.2006 20
SQL> SELECT t.i, d."rate"
2 FROM (SELECT add_months(to_date('01.01.2006', 'DD.MM.YYYY') /* start*/, LEVEL - 1) i
3 FROM dual
4 CONNECT BY LEVEL <= 12) t
5 ,dates d
6 WHERE t.i BETWEEN d."start" AND d."end";
I rate
01.01.2006 10
01.02.2006 10
01.03.2006 10
01.04.2006 10
01.05.2006 10
01.06.2006 15
01.07.2006 15
01.08.2006 15
01.09.2006 15
01.10.2006 20
01.11.2006 20
01.12.2006 20
12 rows selected
SQL> SELECT SUM(d."rate") rs
2 FROM (SELECT add_months(to_date('01.01.2006', 'DD.MM.YYYY') /* start*/, LEVEL - 1) i
3 FROM dual
4 CONNECT BY LEVEL <= 1 +
5 extract(MONTH FROM to_date('10.10.2006', 'DD.MM.YYYY') /*death*/) -
6 extract(MONTH FROM to_date('01.01.2006', 'DD.MM.YYYY') /* start*/)
7 ) t
8 ,dates d
9 WHERE t.i BETWEEN d."start" AND d."end";
RS
130
SQL>
Similar Messages
-
How to calculate the amount for cleared documents.
Hi Experts,
I am working on a program and here i need to display the amount for the cleared document.
I have a scenario where there are two financial document related to a single cleared document.
I can get the amount for financial document from BSAK by passing the BELNR value of the financial document and confirm if it is a clearing document by comparing AUGBL value of BSAK with document number of cleared document.
Actually i am not very clear about the process flow of clearing document.
If anyone can explain me the same.Hello,
Go through this links it will help full
http://help.sap.com/saphelp_sbo2004c/helpdata/en/fd/25f4c6d8888e40a521972d0be5d68b/content.htm
http://help.sap.com/saphelp_45b/helpdata/en/e5/0783e84acd11d182b90000e829fbfe/frameset.htm -
how can I add the amount shown below for year 1999. I would like to add all the amount between 01/22/1999 - 12/17/1999. thank you
here is my simple sql looks like
select sum(l.contamt),b.datelet
from bidlet b, letprop l
where b.LETTING = l.LETTING
and l.LETSTAT='A'
group by b.datelet
Here is my desired out put
Amount year
xxxxxx 1999
xxxxx 2000
xxxxxx 2001
24,692,441 01/22/1999 00:00:00
30,625,058 02/26/1999 00:00:00
810,879 03/16/1999 00:00:00
45,415,715 03/19/1999 00:00:00
34,359,502 04/09/1999 00:00:00
34,967,761 04/23/1999 00:00:00
1,396,831 05/04/1999 00:00:00
40,408,333 05/14/1999 00:00:00
37,556,062 05/28/1999 00:00:00
19,583,374 06/11/1999 00:00:00
45,105,742 06/25/1999 00:00:00
6,096,878 07/23/1999 00:00:00
369,439 08/17/1999 00:00:00
15,293,129 08/27/1999 00:00:00
9,249,995 09/10/1999 00:00:00
9,078,176 09/24/1999 00:00:00
2,153,323 10/22/1999 00:00:00
6,239,335 11/19/1999 00:00:00
26,908,007 12/17/1999 00:00:00user452051 wrote:
how can I add the amount shown below for year 1999.You're very nearly there - all you need to do is convert your dates so they all represent just the year part - you can do this by using the TRUNC function to set the dates to the start of whatever year they belong to:
eg.
TRUNC(sysdate, 'yyyy') -
How to use the GPU for calculations?
Hello everybody,
I am working on a project at the Ruhr-University, where i have to determine the calculation speed of ActionScript, e.g. in calculating MD5 Hash values.
Is it possible to use the GPU for the calculation? It would be the best, when i can use the GPU and the CPU for the calculations.
I already know that ActionScript is running on the CPU und the GPU is used for video rendering.
Is there a chance to use specifically the GPU for the calculation?
Regards
PatrickHOW TO USE Scroll Panes
The JScrollPane API -
How to avoid the Amount and Date values for VOID Cheques
Hi All,
I had created a two window i.e For Amount and Date. If I process the cheque the Amount value and Date should not trigger for VOID CHEQUES.
Can any one tel me how to avoid the Amount and Date values for VOID Cheques
Your help will be greatly appreciated.
Regards
YathishHi,
I dont know which tablel you are referring to, is it PAYR table and the field VOIDR?
If a cheque is voided, it would have a reason and it is stored in VOIDR field of this PAYR table.
Check if the field VOIDR is filled, if it is filled, do not print the amount and date.
Regards
Subramanian -
I have LabView 9.0 and I remember last year when I got it I had to go through several steps in order to upload the templates for Heart Rate, EKG, and Blood Pressure. However, since then, several of my computers have been worked on within the district and the templates are no longer on the main page anymore and I have forgotten the steps to completete to get them back. Can anyone help me??!!
What main page are you referring to? Are you referring to the Getting Started window that has the "VI from Template..." link that pulls up a dialog to select the type of file to create? That has a tree node that you can navigate and there's a VI -> From Template -> User node. If you place the template in the <labview>/templates folder then they will show up in this node.
-
How to sum the column in a table seperated by sign.
How to sum the column in a table separate by sign.
For Example:
A B
10 MOHAN
-15 KUMAR
-25 MARCH
50 MAYSELECT SUM(CASE SIGN(A) WHEN 1 THEN A ELSE NULL END) SUM_POSTIIVE,
SUM(CASE SIGN(A) WHEN -1 THEN A ELSE NULL END) SUM_NEGATIIVE
FROM tbl
/SY. -
How to know the amount of ora 11g page-out memory (sga and pga)?
How to know the amount of oracle 11g page-out memory ( sga and pga) in the SunSolaris 10 Unix and Linux.
I need to know how many oracle memory are being page-out ( all and for a one oracle server process).
thanksYou can monitor the paging with vmstat or sar commands.
http://download.oracle.com/docs/cd/B28359_01/server.111/b32009/tuning.htm#sthref500
You can also get the paging information on OEM home page if configured for your database.
But I don't know if there exists a method with which one can find out how much memory per session/server process is getting paged out. -
How to bill the Government for the purchases made by Customer
Currently client is implementing Oracle applications
Requirement is for every general customer(Citizen) of the client, government is paying the amount for the purchases made(sales orders).
Please let me know how to implement the above scenario.
Can this be acheived by preparing a price list in specific to Government and use the billing address for the customer as Government agency address.
Regards
SriThe other option would be to have 2 different parties.. One for customer and one for Government.. Then create a "Bill_to" account relationship between the two.
-
How to find the workflow for Change Request for the PO's
Hi All,
We have a PO which is pending and we can't receipt it again nor make payment on this. After checking the Approval history for that PO we found that the change request has been made. The change request was to change the amount to be paid to R39196 instead of R58237.00. We don't know where to check the workflow for the change request to identify the cause.
what i need to know is how to find the workflow for that change request? The other workflows can be checked using the po_header_id for the PO's but i am confused with the change request workflow
Your input will be highly appreciated.
Thanks in advance
Rgds,
SoniaFor 11.5.10.2 run this query to determine the keys to search on:
Select wf_item_type, wf_item_key from APPS.po_change_requests where document_type = 'PO' and Document_num = 'put-PO-number-here'
Then use the keys returned by the query to look up the Workflow in
Workflow Administrator Web Applications / Administrator Workflow / Status Monitor
Search using the results returned in fields "Type Internal Name" and "Item Key" in Status Monitor
The query for change requests on a specific Requisition would be:
Select wf_item_type, wf_item_key from APPS.po_change_requests where document_type = 'REQ' and Document_num = 'put-Req-number-here' -
In VB Programming code -- How to access the formula for suppressing a field
In VB Programming code -- How to access the formula for suppressing a field
I am using Crystal Reports 2008 v1
Using VB code, I am attempting to modify a Crystal Report before exporting it into a PDF format and then displaying it on the Web.
My problem is that I am unable to access the formula used to dynamically suppress a field.
The following code is working:
mySections = rd.ReportDefinition.Sections
For Each mySection As CrystalDecisions.CrystalReports.Engine.Section In mySections
' myFieldToChange is a String set to the text of the field I need to adjust the Suppression
iloop = 0
For Each RecObj As CrystalDecisions.CrystalReports.Engine.ReportObject In mySection.ReportObjects
If mySection.ReportObjects.Item(iloop).Name.ToLower = myFieldToChange Then
myTextObject = CType(mySection.ReportObjects.Item(iloop), CrystalDecisions.CrystalReports.Engine.TextObject)
myTextObject.Text = "new field text goes here"
mySection.SectionFormat.EnableSuppress = True
' Here is where I want to change the formula for the Suppression
End if
iloop = iloop + 1
Next
Next
I can not find any reference to the actual suppression formula in the SDK help file.
Note, the EnableSuppress can be set to True for False, but if there is a formula for dynamic suppression, the True or False value is overwritten. The results of the formula determine the suppression.
Is there a way to reference this formula. I know that I can put on in using the Crystal Report Designer software, I need to modify this formula using VB code and the SDK.Hello, Mark;
If you are using the ReportDocument object you do not have access to the Conditional Suppression formula. You can get around it by using a formula field in the report for the supression and then using the FormulaField code to change it at runtime.
If you want to change the supression condition directly at runtime you need to use RAS and the ReportClientDocument.
Elaine -
How to obtain the license for the mentioned products.
Hi All,
Please help me in below licensing issues.
1) Our functional team got the below error while accessing "Job Scheduling Workbench".
Error: The Workbench is inaccessible because Oracle Manufacturing Scheduling has not been licensed. Please work with your Account Manger to purchase the license.
2) Another error message while accessing the navigation Flow Manufacturing --> Product Sync --> Flow Routings
Error: APP-BOM 20972: You cannot access this form
Cause: You do not have a license for Oracle Flow Manufacturing.
Action: Obtain a license for Oracle Flow Manufacturing.
Please guide me how to obtain the license for the above products.
Environment: eBS R12.1.3 on Linux 5.8
Regards,
SivaThanks for providing the document. I follow the document and get back to you for any issues.
Regards,
Siva. -
A^b = n ,How to get the value for a ?
a^b = n ===> n = Math.pow(a,b)
How to get the value for a ?
dose Java have API to get the value for a ?
Thanks for help~~~a^b = n
=>
a = n^(1/b)
So,
a = Math.pow(n,1.0/b) -
How to get the date for the first monday of each month
Dear Members,
How to get the date for the first monday of each month.
I have written the following code
SELECT decode (to_char(trunc(sysdate+30 ,'MM'),'DAY'),'MONDAY ',trunc(sysdate+30 ,'MM'),NEXT_DAY(trunc(sysdate+30 ,'MM'), 'MON')) FROM DUAL
But it look bith complex.
Abhishek
Edited by: 9999999 on Mar 8, 2013 4:30 AMUse IW format - it will make solution NLS independent. And all you need is truncate 7<sup>th</sup> day of each month using IW:
select sysdate current_date,
trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month
from dual
CURRENT_D FIRST_MON
08-MAR-13 04-MAR-13
SQL> Below is list of first monday of the month for this year:
with t as(
select add_months(date '2013-1-1',level-1) dt
from dual
connect by level <= 12
select dt first_of_the_month,
trunc(dt + 6,'iw') first_monday_the_month
from t
FIRST_OF_ FIRST_MON
01-JAN-13 07-JAN-13
01-FEB-13 04-FEB-13
01-MAR-13 04-MAR-13
01-APR-13 01-APR-13
01-MAY-13 06-MAY-13
01-JUN-13 03-JUN-13
01-JUL-13 01-JUL-13
01-AUG-13 05-AUG-13
01-SEP-13 02-SEP-13
01-OCT-13 07-OCT-13
01-NOV-13 04-NOV-13
FIRST_OF_ FIRST_MON
01-DEC-13 02-DEC-13
12 rows selected.
SQL> SY. -
I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class FileRead {
public static void main(String args[]) {
Scanner scan = null;
File file = new File("Results.txt");
String number;
try {
scan = new Scanner(file);
while (scan.hasNext()){
number = scan.next();
System.out.println(number);}
catch (FileNotFoundException ex1){
System.out.println("No such file");
catch (IllegalStateException ex2){
System.out.println("Did you close the read by mistake");
catch (InputMismatchException ex){
System.out.println("File structure incorrect");
finally{
scan.close();}
}Any hints would be greatly appreciated. Thank you in advanceI have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
This code compiles but at run time it comes up with this error
run-single:
java.lang.NoClassDefFoundError: NamedFile
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
import java.util.Scanner;
import java.io.*;
class NamedFileInput
public static void main (String[] args) throws IOException
int num, square;
// this Scanner is used to read what the user enters
Scanner user = new Scanner( System.in );
String fileName;
System.out.print("File Name: ");
fileName = user.nextLine().trim();
File file = new File( fileName ); // create a File object
// this Scanner is used to read from the file
Scanner scan = new Scanner( file );
while( scan.hasNextInt() ) // is there more data to process?
num = scan.nextInt();
square = num * num ;
System.out.println("The square of " + num + " is " + square);
}his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!!
Maybe you are looking for
-
Nothing happens when I insert a card in the SD slot. Running OS X 10.8.2 on a Mid 2010 IMAC.
-
Document library, hide all documents by default.
Hi I have a document library and I want to give access to client. I want to hide all documents by default except the few I share with them. If I upload new document it should not be visible to them by default until I share with them. I have given rea
-
Error in Installing Netweaver--domain controllers are not supported
When i make the pre-requisite check for installing Netweawer 2004s I am getting the follwoing error <b>installation to domain controllers are not supported</b> Pls help me how to resolve this Thanks in Advance
-
How to Identify URL or document after EMET Mitigation?
Hi, is there a way to identify which URL was requested in the Browser or which document was opened in Office or Adobe Reader when EMET triggers a mitigation? This is an important information missing in the logs and there are probably technical reason
-
Upgrade to Snow Leopard using TC
Hi, I've decided that it's probably time to upgrade to Snow Leopard (hoping most of the issues have been resolved) and have a back up of my entire system on a TC. The thing is I was thinking about doing a clean install, wipe my entire HD and start ag