/    Sign up×
Community /Pin to ProfileBookmark

Rotating invoice number fail

Dear Webdeveloper members,

I need an urgent help regarding rotating invoice numbers. For about a month i am trying to rotate invoice numbers for my merchant system, and i am always failing. Number must look something like that: “000000009999”

I tried with javascript and at the moment it looks like that:

[code]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

<html>
<head>
<meta http=equiv=”Content-Type” content=”text/html;charset=ISO-8859-1″>
<title>Example</title>

<script type=”text/javascript”>

onload=function(){document.getElementById(“INVMERCHANT”).value=new Date().getTime();}

</script>

</head>

<form action=”echo.pl” method=”POST” >
<h2>Automatic credit card payment system provided by Kasikorn bank over secured connection.</h2>
<p><img src=”/files/content/images/ssl_secured.jpg” style=”width: 108px; height: 31px;” alt=”” /><img height=”30″ width=”100″ src=”/files/content/images/visa_mastercard_logos.jpg” alt=”” /></p>
<form name=”sendform” method=”post” action=”https://rt05.kasikornbank.com/pgpayment/payment.aspx”>
<h3 style=”color: Red;”><input type=”hidden” id=”MERCHANT2″ name=”MERCHANT2″ value=”401001213339001″ /> <input type=”hidden” id=”TERM2″ name=”TERM2″ value=”70344541″ /><strong>Enter&nbsp; Amount</strong> :<input type=”text” id=”AMOUNT2″ name=”AMOUNT2″ value=”” /> <input type=”hidden” id=”URL2″ name=”URL2″ value=”http://www.thailandholidayhomes.co.uk/” /> <input type=”hidden” id=”RESPURL” name=”RESPURL” value=”” /> <input type=”hidden” id=”IPCUST2″ name=”IPCUST2″ value=”” /> <input type=”hidden” id=”DETAIL2″ name=”DETAIL2″ value=”Booking Deposit” /> (Example 660000 = 6600.00 Baht&nbsp; – six-thousand and six-hundred baht)</h3>
<h3 style=”color: Red;”>Invoice No : <input type=”text” id=”INVMERCHANT” name=”INVMERCHANT” value=”000000009889″ /></h3>
<p><img alt=”” style=”width: 33px; height: 27px;” src=”/files/content/images/attention.png” /><strong>We appologize, at the moment our bank do not accept decimal values, so you need to add additional 2 zeros at the end of final amount</strong></p>
</form>
<p><button onClick=”document.sendform.submit();”> Pay Now!</button></p>
<p><!–<script>document.sendform.submit();</script>–></p>
<div><font><strong>Warning -</strong>&nbsp; paying for a holiday home rental you have found on the internet, directly to the ‘owner’ is very risky, unless you use a credit card&nbsp; <br />
&nbsp;&nbsp; <br />
<strong>The scam </strong>-&nbsp;You may be paying someone who is pretending to be the owner – its very simple for fraudsters to upload a holiday home on an advertising site. It happens all the time and is the scourge of the industry.&nbsp; <br />
&nbsp; <br />
<strong>The solution</strong> – the solution is to <u>always pay by credit card</u>. That way you are fully protected, if you don’t get the goods you have paid for, you contact your card company and get a full and immediate refund. Simple. Plus fraudsters don’t accept credit cards as a rule! </font></div>
<div>&nbsp;</div>
<div><font><strong>Use a registered Company</strong> – <font>Thailand Holiday Homes is the trading style of Holiday Homes (Thailand) Co.Ltd, Registered at Bangkok Number 0205551006458.</font><br />
</font></div>
<div><font><strong>More Support</strong> – Registered with the&nbsp;</font>&nbsp;Tourism Authority of Thailand Licence 13/01116</div>
<div>&nbsp;</div>
<div>Thailand Holiday Homes a company you can TRUST!</div>
</body>
</html>
[/code]

This is using time and date to get unique numbers, but unfortunately my submit button is not working.

Where do i make mistake. Please assist me.

Kind regards
Kal

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 26.2009 — Remove this line:&lt;form action="echo.pl" method="POST" &gt;
Copy linkTweet thisAlerts:
@banevauthorMar 26.2009 — This is generating a proper code, but my bank do not accept,i Think because the number in miliseconds contains more digits.

How can i prepare the same, but to have only 10 digits?

How script will look like if use:

var randomnumber=Math.floor(Math.random()*11)
Copy linkTweet thisAlerts:
@haulinMar 27.2009 — hi. i don't really understand what you mean by "rotating invoice numbers", but if you want your function to produce fairly unique numbers, i think the getTime() is a good idea. if you want them to be 10-digit, simply use the remainder of division by 10^10:

[CODE]
<script type="text/javascript">

onload=function(){document.getElementById("INVMERCHANT").value=new Date().getTime() &#37; 10000000000;}

</script>
[/CODE]

however, this number will begin from zero once in approximately 3 months. maybe you can first divide it by 10, 100 and then apply the modulo...
×

Success!

Help @banev spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...