Jump to content

Invoice


Guest black76

Recommended Posts

Guest black76

Hello

I wonder if anyone can help me. I got a javascript wich I want to use in my cubecart and this script allows me to set a date wich the invoice is due to be payed. The javascript current settings is to be payed in five days and shows the date. I want to change the settings in order to make it to be payd in five working days, cutting off saturdays and sundays. The script looks like this:

<script LANGUAGE="JavaScript">

<!-- Begin

var AddDays = 5; // How many days ahead of the current date

TDate = new Date();

TDay = new Array('Sunday', 'Monday', 'Tuesday',

'Wednesday', 'Thursday', 'Friday', 'Saturday');

TMonth = new Array('January', 'February', 'March',

'April', 'May','June', 'July', 'August', 'September',

'October', 'November', 'December');

MonthDays = new Array('31', '28', '31', '30',

'31', '30', '31', '31', '30', '31', '30', '31');

function isLeapYear (Year) {

if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {

return true;

}

else {

return false;

}

}

CurYear = TDate.getYear();

CurMonth = TDate.getMonth();

CurDayOw = TDate.getDay();

CurDay = TDate.getDate();

month = TMonth[CurMonth];

if (month == 'February') {

if (((CurYear % 4)==0) && ((CurYear % 100)!=0) || ((CurYear %

400)==0)) {

MonthDays[1] = 29;

}

else {

MonthDays[1] = 28;

}

}

days = MonthDays[CurMonth];

CurDay += AddDays;

if (CurDay > days) {

if (CurMonth == 11) {

CurMonth = 0;

month = TMonth[CurMonth];

CurYear = CurYear + 1

}

else {

month = TMonth[CurMonth+1];

}

CurDay = CurDay - days;

}

CurDayOw += AddDays;

function adjustDay (cday) {

if (cday > 6) {

cday -= 6;

CurDayOw = TDay[cday-1];

adjustDay(cday-1);

}

else {

CurDayOw = TDay[cday];

return true;

}

}

adjustDay(CurDayOw);

TheDate = CurDayOw + ', ';

TheDate += month + ' ';

TheDate += CurDay + ', ';

if (CurYear<100) CurYear="19" + CurYear;

TheDate += CurYear;

document.write("<center>");

document.write(AddDays + " days from now is ... " + TheDate);

document.write("</center>");

// End -->

</script>

Once again thankx for any help

Long life to cubecart...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...