Cash Register Drawer

Developer
Size
3,124 Kb
Views
30,360

How do I make an cash register drawer?

What is a cash register drawer? How do you make a cash register drawer? This script and codes were developed by Shikun Ke on 28 November 2022, Monday.

Cash Register Drawer Previews

Cash Register Drawer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cash Register Drawer</title> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wallpaper"> <div class="title text-center"> Cash Register Drawer </div> <div class="container"> <div class="row"> <div class="col-xs-6"> <div class="input"> <label>Number of bills adding:</lable> <ul class="list-group gray_back"> <li class="list-group-item"> <input type="text" id="ONE HUNDRED"> One Hundred</input></li> <li class="list-group-item"> <input type="text" id="TWENTY"> Twenty</input></li>
<li class="list-group-item"> <input type="text" id="TEN"> Ten</input></li>
<li class="list-group-item"> <input type="text" id="FIVE"> Five</input></li>
<li class="list-group-item"> <input type="text" id="ONE"> One</input></li>
<li class="list-group-item"> <input type="text" id="QUARTER"> Quarter</input></li>
<li class="list-group-item"> <input type="text" id="DIME"> Dime</input></li>
<li class="list-group-item"> <input type="text" id="NICKEL">Nickel</input></li>
<li class="list-group-item"> <input type="text" id="PENNY">Penny</input></li>
</ul>
<button class="btn btn-default" onclick="add()">Submit</button>
<button class="btn btn-default" onclick="reset()">Reset</button> </div>
</div> <div class="col-xs-6"> <div class="input"> <label>Price and Cash:</lable> <ul class="list-group gray_back"> <li class="list-group-item"> <input type="text" id="price"> Price</input></li> <li class="list-group-item"> <input type="text" id="cash"> Cash</input></li>
</ul>
<button class="btn btn-default" onclick="change()">Get Change</button><br />
<br />
<br />
<br />
<br />
<ul class="list-group gray_back big_font"> <li> Remaining Money:<span id="money"></span></li> <li>Change:<span id="change"></span></li> </ul>
</div>
</div>
</div>
</div>
</div> <script src="js/index.js"></script>
</body>
</html>

Cash Register Drawer - Script Codes CSS Codes

.wallpaper{ height:550px; background:url('http://www.smerconish.com/wordpress/wp-content/uploads/2015/08/money-background-images-uongflup.jpg'); background-size:cover;
}
.title{ font-weight:700; font-family:"Comic Sans MS", cursive, sans-serif; font-size:30px; margin: auto; padding-top:30px;
}
.input{ position:absolute; font-size:10px; left:0px;
}
.list-group-item{ background-color:#CCCCCC;
}
.big_font{ font-size:20px; background-color:#CCCCCC;
}

Cash Register Drawer - Script Codes JS Codes

var drawer = [0,0,0,0,0,0,0,0,0];
var weight = [100,20,10,5,1,0.25,0.1,0.05,0.01];
var remain = 0; var value = ["ONE HUNDRED", "TWENTY","TEN","FIVE","ONE","QUARTER","DIME","NICKEL","PENNY"];
function cashier(price, cash) { var change = cash - price; // Here is your change, ma'am. var remaining = Number(change.toFixed(2)); var success = false; var number = []; var i = 0; while(i<9) { j = 0; while(j<drawer[i]) { j = j + 1; if(j*weight[i]>remaining) { j = j - 1; break; } } number.push(j); remaining = remaining - j*weight[i]; remaining = Number(remaining.toFixed(2)); if(remaining == 0) { success = true; break; } else i = i + 1; } var remain_current = []; for(i=0;i<9;i++) { remain_current.push(drawer[i]-number[i]); remain = remain + remain_current[i]*weight[i]; } current = remain_current.reduce(function(previousVal,currentVal){ return previousVal + currentVal; }) var output = []; if(success == true) { if(current == 0) return "Closed"; else { for(i=0;i<9;i++) { var temp = []; if(number[i]==0||number[i]==null) continue; else{ var temp_num = number[i]*weight[i]; temp.push(value[i]); temp.push(Number(temp_num.toFixed(2))); output.push(temp); } } return output; } } else return "Insufficient Funds";
}
function add(){ for(i=0;i<9;i++) { var x = document.getElementById(value[i]).value; drawer[i] = drawer[i] + Number(x); } document.getElementById("test").innerHTML = drawer; for(i=0;i<9;i++) { remain = remain + drawer[i]*weight[i]; } document.getElementById("money").innerHTML = remain.toFixed(2);
}
function reset(){ drawer = [0,0,0,0,0,0,0,0,0]; remain = 0;
}
function change(){ var price0 = document.getElementById("price").value; var cash0 = document.getElementById("cash").value; var price = Number(price0); var cash = Number(cash0); if(price = cash) document.getElementById("change").innerHTML="0"; else { var output = cashier(price,cash,drawer); if(typeof(output)!="string") { var temp = ""; for(i=0;i<output.length;i++) { temp = temp + "<li>"+output[i][0]+":"+output[i][1]+"</li>"; document.getElementById("change").innerHTML = temp; }
} else document.getElementById("change").innerHTML=output; } document.getElementById("money").innerHTML=remain.toFixed(2);
}
Cash Register Drawer - Script Codes
Cash Register Drawer - Script Codes
Home Page Home
Developer Shikun Ke
Username BarryKe
Uploaded November 28, 2022
Rating 3
Size 3,124 Kb
Views 30,360
Do you need developer help for Cash Register Drawer?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Shikun Ke (BarryKe) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!