-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecords-Edit2.php
134 lines (127 loc) · 8.57 KB
/
Records-Edit2.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
<?php require_once 'includes/initialize.php';
$p =1;
$record = Record::find_by_id(base64_decode(filter_input(INPUT_GET, "id")));
require_once './layouts/header.php';
if(isset($_POST['submit'])){
$record->cno = trim(filter_input(INPUT_POST, "cno"));
$record->prop = trim(filter_input(INPUT_POST, "prop"));
$record->amtpaid = trim(filter_input(INPUT_POST, "amtpaid"));
$record->doi = trim(filter_input(INPUT_POST, "doi"));
$record->dol = trim(filter_input(INPUT_POST, "dol"));
$record->lno = trim(filter_input(INPUT_POST, "lno"));
$record->pno = trim(filter_input(INPUT_POST, "pno"));
$record->plno = trim(filter_input(INPUT_POST, "plno"));
$record->remarks = trim(filter_input(INPUT_POST, "remarks"));
$record->user = $session->id;
$check = Record::check_existing($record->cno,$record->id,$session->location);
if ($check){
$message = "<div class=\"alert alert-error\">Certificate NO. already exists!</div>";
} else if($record && $record->save()){
// if we were able to create the lmc and save it we
// do the following
$message = "<div class=\"alert alert-success\">Record saved successfully<br />Volume No is <b>{$record->volume}</b><br />Folio No is <b>{$record->folio}</b></div>";
$session->message($message);
if (filter_input(INPUT_GET, "d") == 0){
redirect_to("Records.php");
} else if (filter_input(INPUT_GET, "d")==1) {
redirect_to("Records-Details.php?id=".filter_input(INPUT_GET, "id"));
}
} else {
$message = "<div class=\"alert alert-error\">An error occured!</div>";
}
}
if (filter_input(INPUT_POST, "cancel")){
if (filter_input(INPUT_GET, "d") == 0){
redirect_to("Records.php");
} else if (filter_input(INPUT_GET, "d")==1) {
redirect_to("Records-Details.php?id=".filter_input(INPUT_GET, "id"));
}
}
?>
</head>
<body>
<?php include_once 'layouts/navigation.php'; ?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<?php require_once './layouts/options-records.php'; ?>
</div>
<div class="span10">
<?php if (isset($message)){ echo $message;} ?>
<div class="row-fluid hero-unit">
<div id="" class="">
<h4>Modify Transfer Record for <?php echo $session->locname ?></h4>
<p> </p>
</div>
<form id="newform" action="" method="POST">
<div class="span6">
<label class="">CERTIFICATE NO.</label>
<input readonly="" type="text" name="cno" value="<?php echo $record->cno ?>" class="input-block-level required-entry" required="" />
<label class="">PROPRIETOR.</label>
<input type="text" name="prop" value="<?php echo $record->prop ?>" class="input-block-level required-entry" required="" />
<label class="">AMOUNT PAID</label>
<input type="text" name="amtpaid" value="<?php echo $record->amtpaid ?>" class="input-block-level required-entry" required="" />
<label class="">ISSUE DATE</label>
<input type="date" id="datepicker" name="doi" value="<?php echo $record->doi ?>" class="input-block-level required-entry" required="" />
<label class="">LODGEMENT DATE</label>
<input type="date" id="datepicker1" name="dol" value="<?php echo $record->dol ?>" class="input-block-level required-entry" required="" />
<label class="">LODGEMENT NO.</label>
<input type="text" name="lno" value="<?php echo $record->lno ?>" class="input-block-level required-entry" required="" />
<label class="">PARCEL NO.</label>
<input type="text" name="pno" value="<?php echo $record->pno ?>" class="input-block-level required-entry" required="" />
</div>
<div class="span6">
<label class="">PLAN NO.</label>
<input type="text" name="plno" value="<?php echo $record->plno ?>" class="input-block-level required-entry" required="" />
<label class="">SECTION</label>
<select onchange="load_volume(this.value);" name="section" class="input-block-level required-entry" required="" disabled="">
<?php $sections = Section::find_all_by_location($session->location); if ($sections){ foreach($sections as $section){ ?>
<option value="<?php echo $section->id ?>" <?php if($section->id == $record->section){ echo "selected";} ?>><?php echo $section->no . " - ". $section->name ?></option>
<?php } } ?>
</select>
<label>VOLUME</label>
<input readonly="" type="text" name="volume" id="volume" value="<?php echo $record->volume ?>" class="input-block-level required-entry" required="" />
<label class="">LAST FOLIO NO.</label>
<input type="text" id="lfn" value="<?php echo $record->folio - 1 ?>" class="input-block-level required-entry" required="" />
<label class="">FOLIO NO. FOR THIS RECORD</label>
<input type="text" id="folio" name="folio" value="<?php echo $record->folio ?>" class="input-block-level required-entry" required="" />
<label class="">REMARKS</label>
<textarea name="remarks" class="input-block-level required-entry" required=""><?php echo $record->remarks ?></textarea>
</div>
<p> </p>
<div class="span8">
<input type="submit" class="btn btn-success btn-large" name="submit" value="SAVE"/>
<input type="submit" class="btn btn-danger btn-large" value="CANCEL" name="cancel" />
</div>
</form>
</div><!--/row-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
</div>
<script type="text/javascript">
function load_volume(section){
var volume = document.getElementById('volume');
volume.value = "PLEASE WAIT...";
if(window.XMLHttpRequest) {
mlhttp=new XMLHttpRequest();
}
else {
mlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
mlhttp.onreadystatechange=function(){
if (mlhttp.readyState===4 && mlhttp.status===200){
// alert(mlhttp.responseText);
var datas = mlhttp.responseText.split("&");
document.getElementById('volume').value= datas[0];
var myScripts = editdiv.getElementsByTagName("script");
if (myScripts.length > 0) {
eval(myScripts[0].innerHTML);
}
}
};
mlhttp.open("GET","AjaxSnippets/objects.php?type=volume§ion=" + section,true);
mlhttp.send();
}
</script>
<?php require_once 'layouts/footer.php';