|
1 | 1 | <?php |
2 | | -// Check if ticket_id and invoice_id are set in the URL |
3 | | -$addToExistingInvoice = isset($_GET['ticket_id']) && isset($_GET['invoice_id']); |
4 | 2 | $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_status LIKE 'Draft' AND invoice_client_id = $client_id ORDER BY invoice_number ASC"); |
5 | 3 |
|
6 | 4 | ?> |
|
17 | 15 | <form action="post.php" method="post" autocomplete="off"> |
18 | 16 | <input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>"> |
19 | 17 | <div class="modal-body bg-white"> |
20 | | - <?php |
21 | | - if (mysqli_num_rows($sql_invoices) > 0) { |
22 | | - ?> |
23 | | - |
| 18 | + <?php if (mysqli_num_rows($sql_invoices) > 0) { ?> |
| 19 | + |
24 | 20 | <ul class="nav nav-pills nav-justified mb-3"> |
25 | 21 | <li class="nav-item"> |
26 | | - <?php if (!$addToExistingInvoice): ?> |
27 | | - <a class="nav-link active" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a> |
28 | | - <?php else: ?> |
29 | | - <a class="nav-link" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a> |
30 | | - <?php endif; ?> |
| 22 | + <a class="nav-link active" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a> |
31 | 23 | </li> |
32 | 24 | <li class="nav-item"> |
33 | | - <?php if ($addToExistingInvoice): ?> |
34 | | - <a class="nav-link active" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a> |
35 | | - <?php else: ?> |
36 | | - <a class="nav-link" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a> |
37 | | - <?php endif; ?> |
| 25 | + <a class="nav-link" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a> |
38 | 26 | </li> |
39 | | - <?php |
40 | | - } else { |
41 | | - ?> |
| 27 | + <?php } else { ?> |
42 | 28 | <div class="alert alert-warning" role="alert"> |
43 | 29 | <i class="fa fa-fw fa-exclamation-triangle mr-2"></i>No draft invoices found. Please create a new invoice first. |
44 | 30 | </div> |
45 | | - <?php |
46 | | - } |
47 | | - ?> |
| 31 | + <?php } ?> |
48 | 32 | </ul> |
49 | 33 |
|
50 | 34 | <hr> |
51 | 35 |
|
52 | 36 | <div class="tab-content"> |
53 | 37 |
|
54 | | - <?php if (!$addToExistingInvoice): ?> |
55 | 38 | <div class="tab-pane fade show active" id="pills-create-invoice"> |
56 | | - <?php else: ?> |
57 | | - <div class="tab-pane fade" id="pills-create-invoice"> |
58 | | - <?php endif; ?> |
59 | 39 |
|
60 | 40 | <div class="form-group"> |
61 | 41 | <label>Invoice Date <strong class="text-danger">*</strong></label> |
|
109 | 89 |
|
110 | 90 | <?php |
111 | 91 |
|
112 | | - if (mysqli_num_rows($sql_invoices) > 0) { |
113 | | - if ($addToExistingInvoice): ?> |
| 92 | + if (mysqli_num_rows($sql_invoices) > 0) { ?> |
| 93 | + |
114 | 94 | <div class="tab-pane fade show active" id="pills-add-to-invoice"> |
115 | | - <?php else: ?> |
116 | | - <div class="tab-pane fade" id="pills-add-to-invoice"> |
117 | | - <?php endif;?> |
118 | 95 | <div class="form-group"> |
119 | 96 | <label>Invoice</label> |
120 | 97 | <div class="input-group"> |
|
134 | 111 | $invoice_date = nullable_htmlentities($row['invoice_date']); |
135 | 112 | $invoice_due = nullable_htmlentities($row['invoice_due']); |
136 | 113 | $invoice_amount = floatval($row['invoice_amount']); |
137 | | - |
138 | | - |
139 | | - if ($invoice_status == "Draft") { |
140 | | - |
141 | 114 | ?> |
142 | | - <option value="<?php echo $invoice_id; ?>" <?php if ($invoice_id == $_GET['invoice_id']) { |
143 | | - echo "selected"; |
144 | | - }?>><?php echo "$invoice_prefix$invoice_number $invoice_scope"; ?></option> |
145 | | - <?php |
146 | | - } |
147 | | - } |
148 | | - ?> |
| 115 | + <option value="<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number | $invoice_scope"; ?></option> |
| 116 | + <?php } ?> |
| 117 | + |
149 | 118 | </select> |
150 | 119 | </div> |
151 | 120 | </div> |
152 | 121 | </div> |
153 | | - <?php |
154 | | - } |
155 | | - ?> |
| 122 | + |
| 123 | + <?php } ?> |
156 | 124 | </div> |
| 125 | + |
157 | 126 | <hr> |
| 127 | + |
158 | 128 | <div class="form-group"> |
159 | 129 | <label>Item <strong class="text-danger">*</strong></label> |
160 | 130 | <div class="input-group"> |
|
222 | 192 | $tax_percent = floatval($row['tax_percent']); |
223 | 193 | ?> |
224 | 194 | <option value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option> |
225 | | - |
226 | | - <?php |
227 | | - } |
228 | | - ?> |
| 195 | + <?php } ?> |
229 | 196 | </select> |
230 | 197 |
|
231 | 198 | </div> |
|
0 commit comments