Step 1:
Create a date field for selecting the date.
Step 2:
Create a report for displaying the data in those dates.
Step 3:
Enter the following code in the page header
Code:
$(function() {
var month = new Array();
month[0] = "Jan";
month[1] = "Feb";
month[2] = "Mar";
month[3] = "Apr";
month[4] = "May";
month[5] = "Jun";
month[6] = "Jul";
month[7] = "Aug";
month[8] = "Sep";
month[9] = "Oct";
month[10] = "Nov";
month[11] = "Dec";
var from_date = $("#P215_FROM_DATE").val();
//alert('from_date'+from_date);
var sec_date = new Date(from_date);
//alert('sec_date'+sec_date));
sec_date.setDate(sec_date.getDate() + 1);
//alert(sec_date.setDate(sec_date.getDate() + 1));
var date = new Date(from_date);
var newdate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
var date1 = new Date(newdate);
//var newdate1 = new Date(newdate.getFullYear(),newdate.getMonth()+1,newdate.getDate()+2);
var dd = newdate.getDate();
var mm = newdate.getMonth();
var y = newdate.getFullYear();
var someFormattedDate1 = dd + '-' + month[mm] + '-' + y;
//alert(someFormattedDate1);
var newdate1=new Date(date.getFullYear(),date.getMonth(),date.getDate()+2);
dd=newdate1.getDate();
mm=newdate1.getMonth();
y=newdate1.getFullYear();
//var dd1 = newdate.getDate() + 1;
//alert('dd1'+dd1);
var someFormattedDate2 = dd + '-' + month[mm] + '-' + y;
//alert(someFormattedDate2);
var newdate2=new Date(date.getFullYear(),date.getMonth(),date.getDate()+3);
dd=newdate2.getDate();
mm=newdate2.getMonth();
y=newdate2.getFullYear();
//var dd2 = newdate.getDate() + 2;
//alert('dd2'+dd2);
var someFormattedDate3 = dd + '-' + month[mm] + '-' + y;
// alert(someFormattedDate3);
var newdate3=new Date(date.getFullYear(),date.getMonth(),date.getDate()+4);
dd=newdate3.getDate();
mm=newdate3.getMonth();
y=newdate3.getFullYear();
//var dd3 = newdate.getDate() + 3;
//alert('dd3'+dd3);
var someFormattedDate4 = dd + '-' + month[mm] + '-' + y;
var newdate4=new Date(date.getFullYear(),date.getMonth(),date.getDate()+5);
dd=newdate4.getDate();
mm=newdate4.getMonth();
y=newdate4.getFullYear();
//var dd4 = newdate.getDate() + 4;
//alert('dd4'+dd4);
var someFormattedDate5 = dd + '-' + month[mm] + '-' + y;
var newdate5=new Date(date.getFullYear(),date.getMonth(),date.getDate()+6);
dd=newdate5.getDate();
mm=newdate5.getMonth();
y=newdate5.getFullYear();
//var dd5 = newdate.getDate() + 5;
//alert('dd5'+dd5);
var someFormattedDate6 = dd + '-' + month[mm] + '-' + y;
var newdate6=new Date(date.getFullYear(),date.getMonth(),date.getDate()+7);
dd=newdate6.getDate();
mm=newdate6.getMonth();
y=newdate6.getFullYear();
//var dd6 = newdate.getDate() + 6;
//alert(dd6);
var someFormattedDate7 = dd + '-' + month[mm] + '-' + y;
$('th[id="head1"]').html(from_date);
$('th[id="head2"]').html(someFormattedDate1);
$('th[id="head3"]').html(someFormattedDate2);
$('th[id="head4"]').html(someFormattedDate3);
$('th[id="head5"]').html(someFormattedDate4);
$('th[id="head6"]').html(someFormattedDate5);
$('th[id="head7"]').html(someFormattedDate6);
$('th[id="head8"]').html(someFormattedDate7);
});
No comments:
Post a Comment