2012 May 21 12:53 PM
Hi All,
Could any one give code for the below scenarios .
Scenario1:
Prices Valid From Valid To
5 15-March 30-April
3 1-April 31-May
3 1-April 31-May
4 30-April 06-June
Output:
Calculation Date | Best Price | Valid From | Valid To |
15th March | $5 | 15th Mar | 31st Mar |
14th April | $3 | 01st Apr | 31st May |
14th May | $3 | 01st Apr | 31st May |
13th Jun | $4 | 01st June | 30th June |
Very Important Scenario
Prices Valid From Valid To
5 15-March 30-April- Customer Mandatory Price
3 1-April 31-May
3 1-April 31-May
4 4-April 06-June
Since If any customer Mandatory Price is there We Should not Break any dates for that Price:
Output:
Calculation Date | Best Price | Valid From | Valid To |
15th March | $5 | 15th Mar | 30 April |
14th April | $5 | 15 March | 30 April |
14th May | $3 | 1May | May 31 |
13th Jun | $4 | 01st June | 30th June |
Scenario3:
Prices Valid From Valid To
2 15-May 30-June
2 15-May 30-June
3 15-May 30-Oct
1 20-July 30-Sep
Calculation Date | Best Price | Valid From | Valid To |
T Date | $2 | 15th May | 30 June |
T Date + 30 | $3 | 15 May | 30 June |
T Date + 60 | $3 | 01 July | 19 July |
T Date + 90 | $1 | 20 July | 30 Sep |
$3 | O1 Oct | 30Oct |
Still we have 4 Price records; we are Inserting New Record (Green Colour) since there is a Gap after 30 September.
Scenario4:
Prices Valid From Valid To
2 15-May 30-June
2 15-May 30-June
3 15-May 30-Sep
1 20-July 30-Sep
Calculation Date | Best Price | Valid From | Valid To |
15th May | $2 | 15th May | 30 June |
14th April | $3 | 15 May | 30 June |
14th May | $3 | 01 July | 19 July |
13th Jun | $1 | 20 July | 30 Sep |
Scenario5:
Prices Valid From Valid To
5 15-May 30-Sep
2 20-May 20-June
2 10-July 20-Aug
Calculation Date | Best Price | Valid From | Valid To |
T Date | $5 | 15th May | 19 May |
T Date + 30 | $2 | 20 May | 20 June |
$5 | 21 June | 09 July | |
T Date + 60 | $2 | 10 July | 20 Aug |
$5 | 21 Aug | 30 Sep |
Still we have 3 Price records; we are Inserting 2 New Record (Green Color) since there are gaps.
Scenario6:
Prices Valid From Valid To
2 15-May 30-sep
2 15-May 30-June
2 25-June 20-Aug
2 20-Aug 10-Sep
Calculation Date | Best Price | Valid From | Valid To |
Date | $2 | 15th May | 30 Sep |
Thanks in advance.
Moderator message : Requirements dumping not allowed, discussion locked.
Message was edited by: Vinod Kumar
2012 May 21 1:07 PM
Hi Uma,
Instead, why don't YOU try to do YOUR work and if you have a specific technical problem, come back and ask for help.
These forums are for help with technical problems, not for people to post their requirements and wait for someone else to complete the work.
Gareth.