-
Notifications
You must be signed in to change notification settings - Fork 1
/
form.invoice.php
122 lines (118 loc) · 3.53 KB
/
form.invoice.php
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
<script type = "text/javascript" >
function validateInvoice(){
var uid = document.forms["frmInvoice"]["uid"].value;
var customer = document.forms["frmInvoice"]["customer"].value;
var total_amt = document.forms["frmInvoice"]["total_amt"].value;
var balance_due = document.forms["frmInvoice"]["balance_due"].value;
var inv_date = document.forms["frmInvoice"]["inv_date"].value;
var paid_date = document.forms["frmInvoice"]["paid_date"].value;
if(uid == null || uid == ""){
alert("uid can't be empty");
return false;
}
if(customer == null || customer == ""){
alert("customer can't be empty");
return false;
}
if(total_amt == null || total_amt == ""){
alert("total_amt can't be empty");
return false;
}
if(balance_due == null || balance_due == ""){
alert("balance_due can't be empty");
return false;
}
if(inv_date == null || inv_date == ""){
alert("inv_date can't be empty");
return false;
}
if(paid_date == null || paid_date == ""){
alert("paid_date can't be empty");
return false;
}
return true;
}
</script>
<?php
session_start();
include("header.php");
include("class.invoice.dao.php");
include("class.customer.dao.php");
$daoCustomer = new DAOcustomer();
$customer_detail = $daoCustomer->getCustomers($_SESSION['uid']);
?>
<center>
<h3>Add Invoice</h3>
<form name = "frmInvoice" method="POST" action="save.invoice.php" onsubmit = "return validateInvoice();">
<table cellspacing="5" cellpadding="5">
<?php
if(isset($_GET["id"])){
$dao = new DAOinvoice();
$vo = $dao->get($_GET["id"]);
?>
<tr>
<td> Customer Name </td>
<td><select name = "customer" style="width:198px" value = "<?=$vo->customer?>">
<option selected value="<?=$vo->customer?>"><?=$vo->customer?></option>
<?php
foreach( $customer_detail as $name){
echo "<option value=\"$name->name\">$name->name</option>";}
?>
</select></td>
</tr>
<tr>
<td> Total Amount </td>
<td><input type = "text" name = "total_amt" value= "<?=$vo->total_amt?> "/></td>
</tr>
<tr>
<td> Balance Due </td>
<td><input type = "text" name = "balance_due" value= "<?=$vo->balance_due?> "/></td>
</tr>
<tr>
<td> Invoiced On </td>
<td><input type = "text" name = "inv_date" value= "<?=$vo->inv_date?> "/></td>
</tr>
<tr>
<td> Paid On </td>
<td><input type = "text" name = "paid_date" value= "<?=$vo->paid_date?> "/></td>
</tr>
<tr colspan = "2">
<th><input type = "submit" value= "EDIT" /></th>
</tr>
<input type = "hidden" name = "inv_num" value= "<?=$vo->inv_num?> "/>
<?}else{?>
<tr>
<td> Customer Name </td>
<td><select name = "customer" style="width:198px">
<?php
foreach( $customer_detail as $name){
echo "<option value=\"$name->name\">$name->name</option>";}
?>
</select></td>
</tr>
<tr>
<td> Total Amount </td>
<td><input type = "text" name = "total_amt" /></td>
</tr>
<tr>
<td> Balance Due </td>
<td><input type = "text" name = "balance_due" /></td>
</tr>
<tr>
<td> Invoiced On </td>
<td><input type = "text" name = "inv_date" /></td>
</tr>
<tr>
<td> Paid On </td>
<td><input type = "text" name = "paid_date" /></td>
</tr>
<tr colspan = "2">
<th><input type = "submit" class="btn btn-info" value= "ADD" /></th>
</tr>
<?}?>
</table>
</form>
</center>
<?
include("footer.php");
?>