-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
100 lines (74 loc) · 2.29 KB
/
script.js
File metadata and controls
100 lines (74 loc) · 2.29 KB
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
function GetPrint()
{
/*For Print*/
window.print();
}
function BtnAdd()
{
/*Add Button*/
var v = $("#TRow").clone().appendTo("#TBody") ;
$(v).find("input").val('');
$(v).removeClass("d-none");
$(v).find("th").first().html($('#TBody tr').length - 1);
}
function BtnDel(v)
{
/*Delete Button*/
$(v).parent().parent().remove();
GetTotal();
$("#TBody").find("tr").each(
function(index)
{
$(this).find("th").first().html(index);
}
);
}
function Calc(v)
{
/*Detail Calculation Each Row*/
var index = $(v).parent().parent().index();
var qty = document.getElementsByName("qty")[index].value;
var rate = document.getElementsByName("rate")[index].value;
var amt = qty * rate;
document.getElementsByName("amt")[index].value = amt;
GetTotal();
}
function GetTotal()
{
/*Footer Calculation*/
var sum=0;
var amts = document.getElementsByName("amt");
for (let index = 0; index < amts.length; index++)
{
var amt = amts[index].value;
sum = +(sum) + +(amt) ;
}
document.getElementById("FTotal").value = sum;
var gst = document.getElementById("FGST").value;
var net = (sum)- +(gst);
document.getElementById("FNet").value = net;
}
$(document).ready(function() {
$("#datetimeInput").click(function() {
// Get the current date and time
var currentDateTime = new Date();
// Format the date and time in 12-hour format
var formattedDateTime = formatDate(currentDateTime) + ' ' + formatTime(currentDateTime);
// Set the formatted date and time in the input field
$(this).val(formattedDateTime);
});
// Function to format the date as "MM/DD/YYYY"
function formatDate(date) {
var month = date.getMonth() + 1;
var day = date.getDate();
var year = date.getFullYear();
return month + '/' + day + '/' + year;
}
// Function to format the time in 12-hour format
function formatTime(date) {
var hours = date.getHours() % 12 || 12; // Ensure 12-hour format
var minutes = date.getMinutes();
var ampm = date.getHours() >= 12 ? 'PM' : 'AM';
return hours + ':' + (minutes < 10 ? '0' : '') + minutes + ' ' + ampm;
}
});