/
estimate_edit.php
688 lines (649 loc) · 24.4 KB
/
estimate_edit.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<?php
session_start();
$ses_id = session_id();
require_once("conf/db_connection.php");
require_once("functions.php");
$estimaterefno = $_GET['estimaterefno'];
$qryestimate = new v_service_master;
$resestimate = $dbo->query($qryestimate->Query("WHERE tbl_service_master.estimate_refno = '$estimaterefno'"));
$qrytempjob = new v_service_detail_job;
$restempjob = $dbo->query($qrytempjob->Query("WHERE estimate_refno = '$estimaterefno'"));
$qrytempparts = new v_service_detail_parts;
$restempparts = $dbo->query($qrytempparts->Query("WHERE estimate_refno = '$estimaterefno'"));
$numparts = count($restempparts);
$qrytempaccessory = new v_service_detail_accessory;
$restempaccessory = $dbo->query($qrytempaccessory->Query("WHERE estimate_refno = '$estimaterefno'"));
$numlubricant = count($restempaccessory);
$qrytempmaterial = new v_service_detail_material;
$restempmaterial = $dbo->query($qrytempmaterial->Query("WHERE estimate_refno = '$estimaterefno'"));
$nummaterial = count($restempmaterial);
foreach($resestimate as $rowestimate){
$custid = $rowestimate['customer_id'];
$custname = $rowestimate['customername'];
$address = $rowestimate['cust_address'];
$vehicleid = $rowestimate['vehicle_id'];
$odometer = $rowestimate['odometer'];
$remarks = $rowestimate['remarks'];
$paymentmode = $rowestimate['payment_mode'];
$discount = $rowestimate['discount'];
$worefno = $rowestimate['wo_refno'];
$transstatus = $rowestimate['trans_status'];
$subtotal = $rowestimate['subtotal_amount'];
$total = $rowestimate['total_amount'];
$labordiscount = $rowestimate['labor_discount'];
$partsdiscount = $rowestimate['parts_discount'];
$lubricantdiscount = $rowestimate['lubricant_discount'];
$materialdiscount = $rowestimate['material_discount'];
$seniorcitizen = $rowestimate['senior_citizen'];
$seniorCitizenNo = $rowestimate['senior_citizen_no'];
$discount = $rowestimate['discount'];
$discprice = $rowestimate['discounted_price'];
$odometer = $rowestimate['odometer'];
$recommendation = $rowestimate['recommendation'];
$remarks = $rowestimate['remarks'];
$plateno = $rowestimate['plate_no'];
$makedesc = $rowestimate['make_desc'];
$yeardesc = $rowestimate['year_desc'];
$modeldesc = $rowestimate['model_desc'];
$colordesc = $rowestimate['color_desc'];
$variant = $rowestimate['variant'];
$engineno = $rowestimate['engine_no'];
$chassisno = $rowestimate['chassis_no'];
$serialno = $rowestimate['serial_no'];
}
$isSenior = null;
$subtotal = 0;
if(isset($_POST['option']) && !empty($_POST['option']) && $_POST['option'] == 1){
$qry = null;
$odometer = $_POST['odometer'];
$subtotal = trim(str_replace(",","",$_POST['subtotal']));
$discount = trim(str_replace(",","",$_POST['discount']));
$discounted_price = trim(str_replace(",","",$_POST['discounted_price']));
$vat = $_POST['vat'];
$total_amount = trim(str_replace(",","",$_POST['totalamount']));
$recommendation = null;
$laborDiscount = 0;
$partsDiscount = 0;
$materialDiscount = 0;
$lubricantDiscount = 0;
$seniorCitizen = 0;
if($_POST['txtrecommendation']){
$recommendation = $_POST['txtrecommendation'];
}
if($_POST['txtrecommendation']){
$recommendation = $_POST['txtrecommendation'];
}
if($_POST['laborDiscount']){
$laborDiscount = $_POST['laborDiscount'];
}
if($_POST['partsDiscount']){
$partsDiscount = $_POST['partsDiscount'];
}
if($_POST['materialDiscount']){
$materialDiscount = $_POST['materialDiscount'];
}
if($_POST['lubricantDiscount']){
$lubricantDiscount = $_POST['lubricantDiscount'];
}
if(isset($_POST['senior'])){
$seniorCitizen = 1;
}
if(!empty($_POST['seniorNo'])){
$seniorCitizenNo = $_POST['seniorNo'];
}else{
$seniorCitizenNo = null;
}
switch($_POST['opt']){
case 1:
$qry .= "UPDATE tbl_service_master SET subtotal_amount = '$subtotal',discount = '$discount',discounted_price = '$discounted_price',vat = '$vat',total_amount = '$total_amount',recommendation = '$recommendation',labor_discount = '$laborDiscount',parts_discount = '$partsDiscount',lubricant_discount = '$lubricantDiscount',material_discount = '$materialDiscount', senior_citizen = '$seniorCitizen', senior_citizen_no = '$seniorCitizenNo' WHERE estimate_refno = '$estimaterefno'; ";
$res = $dbo->query($qry);
$msg = "updated";
break;
case 2:
$qry .= "UPDATE tbl_service_master SET subtotal_amount = '$subtotal',discount = '$discount',discounted_price = '$discounted_price',vat = '$vat',total_amount = '$total_amount',recommendation = '$recommendation',labor_discount = '$laborDiscount',parts_discount = '$partsDiscount',lubricant_discount = '$lubricantDiscount',material_discount = '$materialDiscount', senior_citizen = '$seniorCitizen', senior_citizen_no = '$seniorCitizenNo', trans_status = '9' WHERE estimate_refno = '$estimaterefno'; ";
$res = $dbo->query($qry);
$msg = "approved";
break;
case 3:
$qry .= "UPDATE tbl_service_master SET trans_status = '3' WHERE estimate_refno = '$estimaterefno'; ";
$res = $dbo->query($qry);
$msg = "cancelled";
break;
default: break;
}
if(!$res){
echo '<script>alert("There has been an error in updating your data! Please re-process hour transaction."); window.location="estimate_approval.php";</script>';
exit();
}else{
$msg1 .= "Service(s) has been successfully " . $msg;
echo '<script>alert("' . $msg1 . '"); window.location="estimate_edit.php?estimaterefno=' . $estimaterefno . '";</script>';
}
}
?>
<html>
<head
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</head>
<? require_once('inc/datepicker.php'); ?>
<style type="text/css">
div.divTableEstimateCost{ font-size: 11px; }
div.divTableEstimateCost table{ border: 1px solid #ddd; padding: 0; margin: 0; }
div.divTableEstimateCost table th{ background: #0000ff; color: #fff; font-size: 12px; }
div.divTableEstimateCost div.divCost{ border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; font-size: 12px; }
</style>
<script type="text/javascript">
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp = false;
try{
xmlhttp = new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp = false;
}
}
}
return xmlhttp;
}
function CurrencyFormatted(fld){
amount = document.getElementById(fld).value;
var i = parseFloat(amount);
if(isNaN(i)) { i = 0.00; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if(s.indexOf('.') < 0) { s += '.00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
var t = CommaFormatted(s);
document.getElementById(fld).value = t;
}
function CommaFormatted(amount){
var delimiter = ","; // replace comma if desired
amount = new String(amount);
var a = amount.split('.',2)
var d = a[1];
var i = parseInt(a[0]);
if(isNaN(i)) { return ''; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
var n = new String(i);
var a = [];
while(n.length > 3)
{
var nn = n.substr(n.length-3);
a.unshift(nn);
n = n.substr(0,n.length-3);
}
if(n.length > 0) { a.unshift(n); }
n = a.join(delimiter);
if(d.length < 1) { amount = n; }
else { amount = n + '.' + d; }
amount = minus + amount;
return amount;
}
function IsNumeric(sText) {
var ValidChars = "0123456789.,";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
return false;
}else{
return true;
}
}
function getTotalAmount(){
var discount = getTotalDiscount();
var subtotal = document.getElementById("subtotal");
var vat_val = document.getElementById("vat").value;
var discounted_price = document.getElementById("discounted_price");
var totalamount = document.getElementById("totalamount");
var amount = subtotal.value.replace(/,/g, '');
if(amount <= 0){
alert("Please create estimate cost first!");
return false;
}
if(discount.value != ""){
// if(n >= 0){
// // var str = discount.value.replace("%","");
// var disc = parseFloat(amount) * (parseFloat(str.replace(/,/g, '')) / 100);
// var disc_price = parseFloat(amount) - parseFloat(disc);
// amount = disc_price;
// discounted_price.value = amount;
// CurrencyFormatted('discounted_price');
// }else{
// var amount = parseFloat(amount) - parseFloat(discount.value.replace(/,/g, ''));
// discounted_price.value = amount;
// CurrencyFormatted('discounted_price');
// }
}else{
discounted_price.value = "";
discount = 0;
}
if(isNaN(amount) == false){
discountedprice = (parseFloat(amount) - parseFloat(discount));
var vat = parseFloat(discountedprice) * parseFloat(vat_val);
if(document.estimate_form.senior.checked == true){
var vatable = (parseFloat(discountedprice) + 0.00);
}else{
var vatable = (parseFloat(discountedprice) + parseFloat(vat));
}
totalamount.value = vatable;
CurrencyFormatted('totalamount');
}else{
discounted_price.value = "";
discount.value = "";
alert("Incorrent amount!");
discount.focus();
return false;
}
}
function AddCost(type,id,estrefno){
var strURL = "divTableEstimateCost1.php?estimate_refno="+estrefno+"&type="+type+"&id="+id;
var req = getXMLHTTP();
if (req){
req.onreadystatechange = function(){
if (req.readyState == 4){
document.getElementById('divTableEstimateCost').innerHTML = req.responseText;
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function RemoveCost(estrefno,id){
var strURL = "divTableEstimateCost_remove1.php?estimate_refno="+estrefno+"&id="+id;
var req = getXMLHTTP();
if (req){
req.onreadystatechange = function(){
if (req.readyState == 4){
document.getElementById('divTableEstimateCost').innerHTML = req.responseText;
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function chkSenior(){
if(document.estimate_form.senior.checked){
document.estimate_form.seniorNo.readOnly = false;
}else{
document.estimate_form.seniorNo.value = "";
document.estimate_form.seniorNo.readOnly = true;
}
}
function getTotalDiscount(){
var lDiscount = $("#laborDiscount").val();
var pDiscount = $("#partsDiscount").val();
var mDiscount = $("#materialDiscount").val();
var luDiscount = $("#lubricantDiscount").val();
var subtotal = $("#subtotal").val();
if(lDiscount == "" || lDiscount == null){
lDiscount = 0;
}
if(pDiscount == "" || pDiscount == null){
pDiscount = 0;
}
if(mDiscount == "" || mDiscount == null){
mDiscount = 0;
}
if(luDiscount == "" || luDiscount == null){
luDiscount = 0;
}
var totalDiscount = (parseFloat(lDiscount) + parseFloat(pDiscount) + parseFloat(mDiscount) + parseFloat(luDiscount));
var discounted_price = (parseFloat(subtotal.replace(/,/g, '')) - totalDiscount);
// $("#discount").val(totalDiscount);
// var discounted_price = (parseFloat(subtotal) - parseFloat(totalDiscount));
$("#discount").val(totalDiscount.toFixed(2));
$("#discounted_price").val(discounted_price.toFixed(2));
return totalDiscount.toFixed(2);
}
</script>
<body>
<table>
<tr>
<td valign="middle">
<a href="estimate_print.php?estimaterefno=<?=$estimaterefno;?>" target="_blank"><div style="width:100px; height:50px; text-align: center;"><img src="images/print_est.png" width="67" height="47" style="pointer: cursor; width: 67px;" border="0" /></div></a>
</td>
</tr>
</table>
<fieldset form="form_estimate" name="form_estimate">
<legend><p id="title">REFERENCE NUMBER</p></legend>
<span id="divCustInfo">
<table>
<tr>
<td class ="label" width="100"><label name="lbl_customer_id">Estimate: </label>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$estimaterefno;?></td>
</tr>
<? if($worefno != '0'){ ?>
<tr>
<td class ="label"><label name="lbl_customer_id">Work Order: </label>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$worefno;?></td>
</tr>
<? } ?>
</table>
</span>
</fieldset>
<fieldset form="form_estimate" name="form_estimate">
<legend><p id="title">CUSTOMER INFORMATION</p></legend>
<span id="divCustInfo">
<table>
<tr>
<td class ="label" width="100"><label name="lbl_customer_id">Customer Code:</label>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$custid;?></td>
<td></td>
<td class ="label" width="100"><label name="lbl_customer">Customer Name:</label></td>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$custname;?></td>
</tr>
<tr>
<td class ="label"><label name="lbl_custadd">Address:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$address;?></td>
</tr>
</table>
</span>
</fieldset>
<br />
<fieldset form="form_highschool" name="form_highschool">
<legend><p id="title">VEHICLE INFORMATION:</p></legend>
<span id="divCustomerVehicle">
<table>
<tr>
<td class ="label" width="100"><label name="lbl_plateno">Plate Number:</label></td>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$plateno;?></td>
<td></td>
<td class ="label" width="100"><label name="lbl_year">Year:</label></td>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$yeardesc;?></td>
<td></td>
<td class ="label" width="100"><label name="lbl_make">Make:</label></td>
<td align="left" width="200" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$makedesc;?></td>
</tr>
<tr>
<td class ="label"><label name="lbl_model">Model:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$modeldesc;?></td>
<td></td>
<td class ="label"><label name="lbl_color">Color:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$colordesc;?></td>
<td></td>
<td class ="label"><label name="lbl_variant">Variant:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$variant;?></td>
</tr>
<tr>
<td class ="label"><label name="lbl_vehicledescription">Engine No:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$engineno;?></td>
<td></td>
<td class ="label"><label name="lbl_color">Chassis No</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$chassisno;?></td>
<td></td>
<td class ="label"><label name="lbl_serialno">Serial No:</label></td>
<td align="left" style="font-weight: normal; font-size: 12px; border:1px solid #333;"><?=$serialno;?></td>
</tr>
<tr>
<td class ="label"><label name="lbl_vehicledescription">Odometer:</label></td>
<td class ="input"><input type="text" name="odometer" id="odometer" value="<?=$odometer;?>" style="width:235px" id=""></td>
</tr>
</table>
</span>
</fieldset>
<!-- <br />
<table>
<tr>
<td>Please select Package:
<select name="txtpackage" id="txtpackage" onChange="return AddCost('package',this.value,'<?=$estimaterefno;?>');">
<option value="">select Package</option>
<? foreach($respackage as $rowpackage){ ?>
<option value="<?=$rowpackage['package_id'];?>"><?=$rowpackage['package_name'];?></option>
<? } ?>
</select>
</td>
</tr>
</table> -->
<br />
<span id="divTableEstimateCost">
<fieldset form="form_costestimate" name="form_costestimate">
<legend><p id="title">ESTIMATE COST:</p></legend>
<div class="divTableEstimateCost">
<table width="750" border="0">
<tr>
<!--<th><div align="center"><span class="">Make Rate</span></div></th>-->
<th><div align="center"><span class="">Job Cost</span></div></th>
<th><div align="center"><span class="">Parts Cost</span></div></th>
<th><div align="center"><span class="">Material Cost</span></div></th>
<th><div align="center"><span class="">Lubricants Cost</span></div></th>
</tr>
<tr>
<td valign="top"><div align="center" class="divCost">
<?
foreach($restempjob as $rowtempjob){
if($rowtempjob['qty'] > 1){
$qty = $rowtempjob['qty'] . "pcs";
}else{
$qty = $rowtempjob['qty'] . "pc";
}
echo $qty . ' ' . $rowtempjob['job_name'] . '<br />' . $rowtempjob['amount'];
?>
<!-- <a href="#" onClick="RemoveCost('<?=$rowtempjob[estimate_refno];?>','<?=$rowtempjob[id];?>');"><img src="images/del_ico.png" width="15"></a></div><div align="center" class="divCost"> -->
<?
$subtotal += $rowtempjob['amount'];
}
?>
</div></td>
<td valign="top"><div align="center" class="divCost">
<?
foreach($restempparts as $rowtempparts){
if($rowtempparts['qty'] > 1){
$qty = $rowtempparts['qty'] . "pcs";
}else{
$qty = $rowtempparts['qty'] . "pc";
}
echo $qty . ' ' . $rowtempparts['parts_name'] . '<br />' . $rowtempparts['amount'];
?>
<!-- <a href="#" onClick="RemoveCost('<?=$rowtempparts[estimate_refno];?>','<?=$rowtempparts[id];?>');"><img src="images/del_ico.png" width="15"></a></div><div align="center" class="divCost"> -->
<?
$subtotal += $rowtempparts['amount'];
}
?>
</div></td>
<td valign="top"><div align="center" class="divCost">
<?
foreach($restempmaterial as $rowtempmaterial){
$type = 'material';
if($rowtempmaterial['qty'] > 1){
$qty = $rowtempmaterial['qty'] . "pcs";
}else{
$qty = $rowtempmaterial['qty'] . "pc";
}
echo $qty . ' ' . $rowtempmaterial['material_name'] . '<br />' . $rowtempmaterial['amount'];
?>
<!-- <a href="#" onClick="RemoveCost('<?=$rowtempmaterial[estimate_refno];?>','<?=$rowtempmaterial[id];?>');"><img src="images/del_ico.png" width="15"></a></div><div align="center" class="divCost"> -->
<?
$subtotal += $rowtempmaterial['amount'];
}
?>
</div></td>
<td valign="top"><div align="center" class="divCost">
<?
foreach($restempaccessory as $rowtempaccessory){
if($rowtempaccessory['qty'] > 1){
$qty = $rowtempaccessory['qty'] . "pcs";
}else{
$qty = $rowtempaccessory['qty'] . "pc";
}
echo $qty . ' ' . $rowtempaccessory['accessory_name'] . '<br />' . $rowtempaccessory['amount'];
?>
<!-- <a href="#" onClick="RemoveCost('<?=$rowtempaccessory[estimate_refno];?>','<?=$rowtempaccessory[id];?>');"><img src="images/del_ico.png" width="15"></a></div><div align="center" class="divCost"> -->
<?
$subtotal += $rowtempaccessory['amount'];
}
?>
</div></td>
</tr>
</table>
</div>
<form method="Post" name="estimate_form" onSubmit="return ValidateMe();">
</fieldset>
<? if($numtempparts > 0 || $numtempmaterial > 0){ ?>
<br />
<fieldset form="form_remarks" name="form_remarks">
<legend><p id="title">RECOMMENDATION</p></legend>
<table>
<tr>
<td class="input"><textarea name="txtrecommendation" id="txtrecommendation" rows="3" cols="104" style="resize: none;"><?=$recommendation;?></textarea></td>
</tr>
</table>
</fieldset>
<? } ?>
<br />
<fieldset form="form_remarks" name="form_remarks">
<legend><p id="title">REMARKS</p></legend>
<table>
<tr>
<td class="input"><textarea name="txtremarks" id="txtremarks" rows="3" cols="104" style="resize: none;"><?=$remarks;?></textarea></td>
</tr>
</table>
</fieldset>
<br />
<fieldset form="form_totalcost" name="form_totalcost">
<legend><p id="title">TOTAL COST</p></legend>
<table>
<tr>
<td class="label">Senior ID:</td>
<td class="input">
<input type="text" name="seniorNo" <? if($seniorcitizen == 0){ echo 'readonly'; } ?> id="seniorNo" style="width: 200px; text-align: right;" value="<?=$seniorCitizenNo;?>">
<input type="checkbox" name="senior" id="senior" <? if($seniorcitizen == 1){ echo 'checked'; } ?> onClick="chkSenior(); getTotalAmount();" value="1" />
</td>
<td></td>
</tr>
<tr>
<td class="label">Sub Total:</td>
<td class="input"><input type="text" name="subtotal" id="subtotal" value="<?=number_format($subtotal,2);?>" readonly style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<? if($numlabor > 0){ ?>
<tr>
<td class="label">Labor Discount:</td>
<td class="input"><input type="text" value="<?=$labordiscount;?>" name="laborDiscount" id="laborDiscount" value="" onKeyup="return getTotalAmount();" style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<?
}
if($numparts > 0){
?>
<tr>
<td class="label">Parts Discount:</td>
<td class="input"><input type="text" value="<?=$partsdiscount;?>" name="partsDiscount" id="partsDiscount" value="" onKeyup="return getTotalAmount();" style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<?
}
if($nummaterial > 0){
?>
<tr>
<td class="label">Material Discount:</td>
<td class="input"><input type="text" value="<?=$materialdiscount;?>" name="materialDiscount" id="materialDiscount" value="" onKeyup="return getTotalAmount();" style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<?
}
if($numlubricant > 0){
?>
<tr>
<td class="label">Lubricants Discount:</td>
<td class="input"><input type="text" value="<?=$lubricantdiscount;?>" name="lubricantDiscount" id="lubricantDiscount" value="" onKeyup="return getTotalAmount();" style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<? } ?>
<tr>
<td class="label">Total Discounts:</td>
<td class="input"><input type="text" name="discount" readonly id="discount" value="<?=$discount;?>" onBlur="return getTotalAmount();" style="width: 200px; text-align: right;"></td>
<td></td>
</tr>
<tr>
<td class="label">Discounted Price:</td>
<td class="input"><input type="text" name="discounted_price" id="discounted_price" value="<?=$discprice;?>" readonly style="width: 200px; text-align: right;"></td>
<td></td>
<td><span class="label">VAT:</span></td>
<td class="input"><input type="text" name="vat" id="vat" value="<?=getVatValue();?>" readonly style="width: 50px; text-align: right;"></td>
<td class="label">Total Amount:</td>
<? $vatable = ($subtotal * 0.12) + $subtotal;?>
<td class="input"><input type="text" name="totalamount" id="totalamount" value="<?=number_format($total,2);?>" readonly style="width: 200px; text-align: right;"></td>
</tr>
</table>
</fieldset>
</span>
<? if($transstatus == 0){ ?>
<div>
<table>
<tr>
<td>Select Option: </td>
<td><select name="opt" id="opt" style="width: 200px;">
<option value="1">Update</option>
<option value="2">Approve</option>
<option value="3">Cancel</option>
</select></td>
<td><input type="submit" name="tbnsubmit" id="btnsubmit" value="" /></td>
</tr>
</table>
</div>
<input type="hidden" name="option" id="option" value="1" />
</form>
<? } ?>
<script type="text/javascript">
function ValidateMe(){
var totalamnt = document.getElementById("totalamount").value;
var remarks = document.getElementById("txtremarks").value;
// var paymentmode = document.getElementById("paymentmode").value;
// var customerid = document.getElementById("customer_id").value;
// var plateno = document.getElementById("plateno").value;
var odometer = document.getElementById("odometer");
// if(customerid == ""){
// alert("Please select customer by customer code/customer name!");
// return false;
// }else
if(document.estimate_form.senior.checked == true){
if(document.getElementById("seniorNo").value == ""){
alert("Please enter senior citizen no!");
return false;
}
}else if(isNaN(document.getElementById("discount").value) == true){
alert("Please enter correct value of your discount!");
return false;
}else if(totalamnt == "" || totalamnt == 0){
alert("Please select estimates costs!");
return false;
}else if(remarks == ""){
alert("Please enter remarks!");
return false;
}else{
return true;
}
}
</script>
</body>
</html>