-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode10.html
145 lines (135 loc) · 5.45 KB
/
code10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customer Billing</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #E3F2FD;
color: #0D47A1;
}
.form-container {
display: none;
margin-top: 20px;
padding: 20px;
border: 1px solid #BBDEFB;
border-radius: 8px;
background-color: #FFFFFF;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.form-container.active {
display: block;
}
label {
display: block;
margin-bottom: 8px;
color: #0D47A1;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #90CAF9;
border-radius: 4px;
box-sizing: border-box;
background-color: #E3F2FD;
color: #0D47A1;
}
input:focus {
border-color: #1E88E5;
outline: none;
box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}
button {
padding: 10px 20px;
background-color: #1976D2;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #1565C0;
}
.bill {
margin-top: 20px;
padding: 20px;
border: 1px solid #BBDEFB;
border-radius: 8px;
background-color: #E3F2FD;
color: #0D47A1;
}
</style>
</head>
<body>
<h1>Customer Billing System</h1>
<!-- Customer Information Form -->
<div id="customer-form" class="form-container active">
<h2>Customer Information</h2>
<label for="customer-name">Name</label>
<input type="text" id="customer-name" placeholder="Enter customer name">
<label for="customer-address">Address</label>
<input type="text" id="customer-address" placeholder="Enter customer address">
<label for="customer-phone">Phone Number</label>
<input type="text" id="customer-phone" placeholder="Enter phone number">
<button onclick="showProductForm()">Next</button>
</div>
<!-- Product Information Form -->
<div id="product-form" class="form-container">
<h2>Product Information</h2>
<label for="product-name">Product Name</label>
<input type="text" id="product-name" placeholder="Enter product name">
<label for="product-qty">Quantity</label>
<input type="number" id="product-qty" placeholder="Enter quantity">
<label for="product-rate">Rate</label>
<input type="number" id="product-rate" placeholder="Enter rate per unit">
<button onclick="showBill()">Generate Bill</button>
</div>
<!-- Bill Display -->
<div id="bill" class="form-container">
<h2>Bill</h2>
<div class="bill">
<h3>Customer Information</h3>
<p id="bill-customer-name"></p>
<p id="bill-customer-address"></p>
<p id="bill-customer-phone"></p>
<h3>Product Information</h3>
<p id="bill-product-name"></p>
<p id="bill-product-qty"></p>
<p id="bill-product-rate"></p>
<p id="bill-product-total"></p>
</div>
</div>
<script>
function showProductForm() {
document.getElementById('customer-form').classList.remove('active');
document.getElementById('product-form').classList.add('active');
}
function showBill() {
// Capture Customer Information
const customerName = document.getElementById('customer-name').value;
const customerAddress = document.getElementById('customer-address').value;
const customerPhone = document.getElementById('customer-phone').value;
// Capture Product Information
const productName = document.getElementById('product-name').value;
const productQty = document.getElementById('product-qty').value;
const productRate = document.getElementById('product-rate').value;
const productTotal = productQty * productRate;
// Display Customer Information
document.getElementById('bill-customer-name').textContent = "Name: " + customerName;
document.getElementById('bill-customer-address').textContent = "Address: " + customerAddress;
document.getElementById('bill-customer-phone').textContent = "Phone Number: " + customerPhone;
// Display Product Information
document.getElementById('bill-product-name').textContent = "Product: " + productName;
document.getElementById('bill-product-qty').textContent = "Quantity: " + productQty;
document.getElementById('bill-product-rate').textContent = "Rate: $" + productRate;
document.getElementById('bill-product-total').textContent = "Total: $" + productTotal.toFixed(2);
document.getElementById('product-form').classList.remove('active');
document.getElementById('bill').classList.add('active');
}
</script>
</body>
</html>