· 9 years ago · Jan 25, 2017, 08:12 AM
1<?php
2/**
3 * Initial Declaration
4 */
5
6
7/**
8 * Class Module
9 *
10 * @author Arnold P. Orbista
11 *
12 */
13class clsSchoolYear{
14
15 var $conn;
16 var $fieldMap;
17 var $Data;
18
19 /**
20 * Class Constructor
21 *
22 * @param object $dbconn_
23 * @return clsSchoolYear object
24 */
25 function clsSchoolYear($dbconn_ = null){
26 $this->conn =& $dbconn_;
27 $this->fieldMap = array(
28 "sy_datefrom" => "sy_datefrom",
29 "sy_dateto" => "sy_dateto",
30 );
31 }
32
33 /**
34 * Get the records from the database
35 *
36 * @param string $id_
37 * @return array
38 */
39 function dbFetch($id_ = ""){
40
41 $flds = array();
42 $flds[] = "sy_id";
43 $flds[] = "sy_name";
44 $flds[] = "sy_from";
45 $flds[] = "sy_abbr";
46 $flds[] = "DATE_FORMAT(sy_datefrom,'%m-%d-%Y') as sy_datefrom";
47 $flds[] = "DATE_FORMAT(sy_dateto,'%m-%d-%Y') as sy_dateto";
48 $flds[] = "sy_default";
49
50 $fields = implode(",",$flds);
51
52 $sql = "SELECT $fields FROM dps_registrar_db.file_schoolyear WHERE sy_id = ?";
53 $rsResult = $this->conn->Execute($sql,array($id_));
54 if(!$rsResult->EOF){
55 return $rsResult->fields;
56 }
57 }
58 /**
59 * Populate array parameters to Data Variable
60 *
61 * @param array $pData_
62 * @return bool
63 */
64 function doPopulateData($pData_ = array()){
65 if(count($pData_)>0){
66 foreach ($this->fieldMap as $key => $value) {
67 $this->Data[$key] = $pData_[$value];
68 }
69 return true;
70 }
71 return false;
72 }
73
74 /**
75 * Validation function
76 *
77 * @param array $pData_
78 * @return bool
79 */
80 function doValidateData($pData_ = array()){
81 $isValid = true;
82
83// $isValid = false;
84 if (strlen($pData_['sy_datefrom']==0)) {
85 $isValid = false;
86 $_SESSION['eMsg'][]="Date range from field required.";
87 }
88 if (strlen($pData_['sy_dateto']==0)) {
89 $isValid = false;
90 $_SESSION['eMsg'][]="Date range to field required.";
91 }
92
93 return $isValid;
94 }
95
96 /**
97 * Save New
98 *
99 */
100 function doSaveAdd(){
101 /**
102 *
103 * $sy_abbr is the abbreviation of school year
104 * $sy_from = year format only
105 * $sy_to = year format only
106 * $sy_name = concatination of sy_from and sy_to
107 *
108 */
109 $explode_datefrom = explode("-",$_POST['sy_datefrom']);
110 $explode_dateto = explode("-",$_POST['sy_dateto']);
111
112 $sy_abbr = substr($explode_datefrom['2'], 2);
113 $sy_from = $explode_datefrom['2'];
114 $sy_to = $explode_dateto['2'];
115 $syfrom = $explode_datefrom['2'].'-'.$explode_datefrom['0'].'-'.$explode_datefrom['1'];
116 $syto = $explode_dateto['2'].'-'.$explode_dateto['0'].'-'.$explode_dateto['1'];
117// $sy_abbr = strftime("%y",strtotime($_POST['sy_datefrom']));
118// $sy_from = strftime("%Y",strtotime($_POST['sy_datefrom']));
119// $sy_to = strftime("%Y",strtotime($_POST['sy_dateto']));
120
121 $sy_name = $sy_from.'-'.$sy_to;
122 $sy_dateadded = date('Y-m-d');
123
124 if (isset($_POST['sy_default'])) {
125 $sql = 'update dps_registrar_db.file_schoolyear set sy_default = 0';
126 $this->conn->Execute($sql);
127 $sy_default = 1;
128 }
129
130 $add_who = $_SESSION['admin_session_obj']['user_data']['user_name'];
131
132 $flds = array();
133 $flds[] = "sy_datefrom = '$syfrom'";
134 $flds[] = "sy_dateto = '$syto'";
135 $flds[] = "sy_from='$sy_from'";
136 $flds[] = "sy_to='$sy_to'";
137 $flds[] = "sy_name='$sy_name'";
138 $flds[] = "sy_abbr='$sy_abbr'";
139 $flds[] = "sy_default='$sy_default'";
140 $flds[] = "sy_addwho = '$add_who'";
141 $fields = implode(", ",$flds);
142
143 $sql = "INSERT INTO dps_registrar_db.file_schoolyear SET $fields";
144 $this->conn->Execute($sql);
145 //jvc
146
147 $newSY = $sy_from."_".$sy_to;
148
149 $file_applicant_submitted_reqt ="
150 CREATE TABLE IF NOT EXISTS file_applicant_submitted_reqt_".$newSY." (
151 asubreq_id int(10) unsigned NOT NULL AUTO_INCREMENT,
152 asubreqh_id int(10) unsigned NOT NULL,
153 req_reqtype_rel_id int(10) unsigned DEFAULT NULL,
154 asubreq_addwho varchar(64) DEFAULT NULL,
155 asubreq_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
156 asubreq_updatewho varchar(64) DEFAULT NULL,
157 asubreq_updatewhen datetime DEFAULT NULL,
158 asubreq_status tinyint(3) unsigned DEFAULT NULL,
159 requirements_id int(10) unsigned DEFAULT NULL,
160 PRIMARY KEY (asubreq_id),
161 KEY file_applicant_submitted_reqt_".$newSY."_FKIndex1 (asubreqh_id)
162 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
163 ";
164 $this->conn->Execute($file_applicant_submitted_reqt);
165
166 $file_applicant_submitted_reqt_header = "
167 CREATE TABLE IF NOT EXISTS file_applicant_submitted_reqt_header_".$newSY." (
168 asubreqh_id int(10) unsigned NOT NULL AUTO_INCREMENT,
169 sai_id int(10) unsigned NOT NULL,
170 stud_applicant_id int(10) unsigned DEFAULT NULL,
171 asubreq_addwho varchar(64) DEFAULT NULL,
172 asubreq_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
173 asubreq_updatewho varchar(64) DEFAULT NULL,
174 asubreq_updatewhen datetime DEFAULT NULL,
175 asubreq_override tinyint(3) unsigned DEFAULT NULL,
176 asubreq_complete tinyint(3) unsigned DEFAULT NULL,
177 asubreq_requirements text,
178 asubreq_status tinyint(3) unsigned DEFAULT NULL,
179 PRIMARY KEY (asubreqh_id),
180 KEY file_applicant_submitted_reqt_header_".$newSY."_FKIndex1 (sai_id)
181 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
182 ";
183 $this->conn->Execute($file_applicant_submitted_reqt_header);
184
185 $file_assessment_data = "
186 CREATE TABLE IF NOT EXISTS file_assessment_data_".$newSY." (
187 fad_id int(10) NOT NULL AUTO_INCREMENT,
188 stud_applicant_id int(10) DEFAULT NULL,
189 year_code varchar(5) NOT NULL,
190 sy_id int(10) DEFAULT NULL,
191 yl_id int(10) DEFAULT NULL,
192 psc_id int(10) DEFAULT NULL,
193 ps_id int(10) DEFAULT NULL,
194 sct_id int(10) DEFAULT NULL,
195 scd_id int(10) DEFAULT NULL,
196 dependent_emp_id int(10) DEFAULT NULL COMMENT 'parent nung student',
197 incentive float(10,2) DEFAULT 0.00,
198 discount float(10,2) NOT NULL DEFAULT 0.00,
199 prev_balance float(10,2) DEFAULT 0.00,
200 assessment_date date DEFAULT NULL,
201 fad_addwhoid int(10) DEFAULT NULL,
202 fad_addwho varchar(128) DEFAULT NULL,
203 fad_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
204 PRIMARY KEY (fad_id)
205 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
206 ";
207 $this->conn->Execute($file_assessment_data);
208
209
210 $file_assessment_data_dues = "
211 CREATE TABLE IF NOT EXISTS file_assessment_data_dues_".$newSY." (
212 faddues_id int(10) NOT NULL AUTO_INCREMENT,
213 fad_id int(10) DEFAULT NULL,
214 psched_date date DEFAULT NULL,
215 faddues_amount float(10,2) DEFAULT NULL,
216 psched_order int(10) DEFAULT NULL,
217 is_paid int(10) DEFAULT 10 COMMENT '10 = not paid; 20 = paid',
218 PRIMARY KEY (faddues_id)
219 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
220 $this->conn->Execute($file_assessment_data_dues);
221
222 $file_assessment_data_dues_history ="
223 CREATE TABLE IF NOT EXISTS file_assessment_data_dues_history_".$newSY." (
224 fadduesh_id int(10) NOT NULL AUTO_INCREMENT,
225 faddues_id int(10) NOT NULL,
226 fad_id int(10) DEFAULT NULL,
227 psched_date date DEFAULT NULL,
228 faddues_amount float(10,2) DEFAULT NULL,
229 psched_order int(10) DEFAULT NULL,
230 is_paid int(10) DEFAULT 10 COMMENT '10 = not paid; 20 = paid',
231 PRIMARY KEY (fadduesh_id)
232 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
233 $this->conn->Execute($file_assessment_data_dues_history);
234
235 $file_assessment_data_fees ="
236 CREATE TABLE IF NOT EXISTS file_assessment_data_fees_".$newSY." (
237 fadfees_id int(10) NOT NULL AUTO_INCREMENT,
238 fad_id int(10) DEFAULT NULL,
239 pfn_id int(10) DEFAULT NULL,
240 pfn_name varchar(128) DEFAULT NULL,
241 pfd_amount float(10,2) DEFAULT NULL,
242 pfd_order int(10) DEFAULT NULL,
243 pfn_parent_id int(10) DEFAULT 0,
244 PRIMARY KEY (fadfees_id)
245 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
246 $this->conn->Execute($file_assessment_data_fees);
247
248 $file_assessment_data_fees_history ="
249 CREATE TABLE IF NOT EXISTS file_assessment_data_fees_history_".$newSY." (
250 fadfeesh_id int(10) NOT NULL AUTO_INCREMENT,
251 fadfees_id int(10) NOT NULL,
252 fad_id int(10) DEFAULT NULL,
253 pfn_id int(10) DEFAULT NULL,
254 pfn_name varchar(128) DEFAULT NULL,
255 pfd_amount float(10,2) DEFAULT NULL,
256 pfd_order int(10) DEFAULT NULL,
257 pfn_parent_id int(10) DEFAULT 0,
258 PRIMARY KEY (fadfeesh_id)
259 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
260 $this->conn->Execute($file_assessment_data_fees_history);
261
262 $file_assessment_data_history ="
263 CREATE TABLE IF NOT EXISTS file_assessment_data_history_".$newSY." (
264 fadh_id int(10) NOT NULL AUTO_INCREMENT,
265 fad_id int(10) NOT NULL,
266 stud_applicant_id int(10) DEFAULT NULL,
267 year_code varchar(5) NOT NULL,
268 sy_id int(10) DEFAULT NULL,
269 yl_id int(10) DEFAULT NULL,
270 psc_id int(10) DEFAULT NULL,
271 ps_id int(10) DEFAULT NULL,
272 sct_id int(10) DEFAULT NULL,
273 scd_id int(10) DEFAULT NULL,
274 dependent_emp_id int(10) DEFAULT NULL COMMENT 'parent nung student',
275 incentive float(10,2) DEFAULT 0.00,
276 discount float(10,2) NOT NULL DEFAULT 0.00,
277 prev_balance float(10,2) DEFAULT 0.00,
278 assessment_date date DEFAULT NULL,
279 fad_addwhoid int(10) DEFAULT NULL,
280 fad_addwho varchar(128) DEFAULT NULL,
281 fad_addwhen datetime NOT NULL,
282 PRIMARY KEY (fadh_id)
283 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
284 $this->conn->Execute($file_assessment_data_history);
285
286 $file_assessment_data_incentive ="
287 CREATE TABLE IF NOT EXISTS file_assessment_data_incentive_".$newSY." (
288 fai_id int(10) NOT NULL AUTO_INCREMENT,
289 fad_id int(10) NOT NULL,
290 incentive_id int(10) NOT NULL,
291 incentive_name varchar(56) NOT NULL,
292 incentive_amount float(10,2) NOT NULL,
293 PRIMARY KEY (fai_id)
294 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
295 $this->conn->Execute($file_assessment_data_incentive);
296
297 $file_assessment_data_incentive_history ="
298 CREATE TABLE IF NOT EXISTS file_assessment_data_incentive_history_".$newSY." (
299 faih_id int(10) NOT NULL AUTO_INCREMENT,
300 fai_id int(10) NOT NULL,
301 fad_id int(10) NOT NULL,
302 incentive_id int(10) NOT NULL,
303 incentive_name varchar(128) NOT NULL,
304 incentive_amount float(10,2) NOT NULL,
305 PRIMARY KEY (faih_id)
306 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
307 $this->conn->Execute($file_assessment_data_incentive_history);
308
309 $file_break_schedule ="
310 CREATE TABLE IF NOT EXISTS file_break_schedule_".$newSY." (
311 bs_id int(10) unsigned NOT NULL AUTO_INCREMENT,
312 bs_time_start time DEFAULT NULL,
313 bs_time_end time DEFAULT NULL,
314 bs_days smallint(5) unsigned DEFAULT NULL,
315 bs_type varchar(32) DEFAULT NULL,
316 cs_id int(10) unsigned DEFAULT NULL,
317 PRIMARY KEY (bs_id),
318 KEY file_break_schedule_FKIndex1 (cs_id)
319 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
320 $this->conn->Execute($file_break_schedule);
321
322 $file_class_adviser ="
323 CREATE TABLE IF NOT EXISTS file_class_adviser_".$newSY." (
324 ca_id int(10) unsigned NOT NULL AUTO_INCREMENT,
325 emp_id int(10) unsigned DEFAULT NULL,
326 csetup_id int(10) unsigned DEFAULT 0,
327 ca_status int(10) unsigned DEFAULT 0,
328 PRIMARY KEY (ca_id)
329 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
330 $this->conn->Execute($file_class_adviser);
331
332 $file_class_schedule_details ="
333 CREATE TABLE IF NOT EXISTS file_class_schedule_details_".$newSY." (
334 csh_id int(10) unsigned NOT NULL AUTO_INCREMENT,
335 cs_id int(10) unsigned NOT NULL,
336 csh_weekorder int(10) unsigned DEFAULT NULL,
337 csh_sun smallint(5) unsigned DEFAULT NULL,
338 csh_mon smallint(5) unsigned DEFAULT NULL,
339 csh_tue smallint(5) unsigned DEFAULT NULL,
340 csh_wed smallint(5) unsigned DEFAULT NULL,
341 csh_thur smallint(5) unsigned DEFAULT NULL,
342 csh_fri smallint(5) unsigned DEFAULT NULL,
343 csh_sat smallint(5) unsigned DEFAULT NULL,
344 csh_timein time DEFAULT NULL,
345 csh_timeout time DEFAULT NULL,
346 PRIMARY KEY (csh_id),
347 KEY file_class_schedule_header_FKIndex1 (cs_id)
348 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
349 $this->conn->Execute($file_class_schedule_details);
350
351
352 $file_class_schedule_header ="
353 CREATE TABLE IF NOT EXISTS file_class_schedule_header_".$newSY." (
354 cs_id int(10) unsigned NOT NULL AUTO_INCREMENT,
355 cs_name varchar(32) DEFAULT NULL,
356 cs_description varchar(100) DEFAULT NULL,
357 cs_yl_id int(10) unsigned DEFAULT NULL,
358 PRIMARY KEY (cs_id)
359 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
360 $this->conn->Execute($file_class_schedule_header);
361
362 $file_class_setup ="
363 CREATE TABLE IF NOT EXISTS file_class_setup_".$newSY." (
364 csetup_id int(10) unsigned NOT NULL AUTO_INCREMENT,
365 csetup_sec_id int(10) unsigned DEFAULT NULL,
366 csetup_dept_id int(10) unsigned DEFAULT NULL,
367 csetup_yl_id int(10) unsigned DEFAULT NULL,
368 csetup_ct_id int(10) unsigned DEFAULT NULL,
369 csetup_class_size int(10) unsigned DEFAULT NULL,
370 csetup_cs_id int(10) unsigned DEFAULT NULL,
371 csetup_addwho varchar(32) DEFAULT NULL,
372 csetup_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
373 csetup_updatewho varchar(32) DEFAULT NULL,
374 csetup_updatewhen date DEFAULT NULL,
375 sy_id int(10) unsigned DEFAULT NULL,
376 rs_id int(10) unsigned DEFAULT 0,
377 PRIMARY KEY (csetup_id),
378 KEY sy_id_index (sy_id),
379 KEY file_class_setup_".$newSY."_FKIndex1 (csetup_ct_id)
380 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
381 $this->conn->Execute($file_class_setup);
382
383 $file_dropped_students ="
384 CREATE TABLE IF NOT EXISTS file_dropped_students_".$newSY." (
385 fds_id int(16) NOT NULL AUTO_INCREMENT,
386 stud_applicant_id bigint(20) DEFAULT NULL,
387 sec_id int(11) DEFAULT NULL,
388 yl_id int(11) DEFAULT NULL,
389 sy_id int(11) DEFAULT NULL,
390 fds_reason varchar(150) DEFAULT NULL,
391 fds_lastday date DEFAULT NULL,
392 fds_date_letter_received date DEFAULT NULL,
393 fds_datereceived date DEFAULT NULL,
394 isfinal int(1) DEFAULT NULL,
395 fds_addedwho varchar(32) DEFAULT NULL,
396 fds_addedwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
397 fds_updatedwho varchar(32) DEFAULT NULL,
398 fds_updatedwhen datetime DEFAULT NULL,
399 approved_principal varchar(32) DEFAULT NULL,
400 approved_principal_date datetime DEFAULT NULL,
401 approved_guidance varchar(32) DEFAULT NULL,
402 approved_guidance_date datetime DEFAULT NULL,
403 approved_acct varchar(32) DEFAULT NULL,
404 approved_acct_date datetime DEFAULT NULL,
405 approved_registrar varchar(32) DEFAULT NULL,
406 approved_registrar_date datetime DEFAULT NULL,
407 control_no varchar(15) DEFAULT NULL,
408 app_principal int(1) DEFAULT 0,
409 app_guidance int(1) DEFAULT 0,
410 app_acct int(1) DEFAULT 0,
411 app_registrar int(1) DEFAULT 0,
412 app_principal_remarks varchar(50) DEFAULT NULL,
413 app_guidance_remarks varchar(50) DEFAULT NULL,
414 app_acct_remarks varchar(50) DEFAULT NULL,
415 app_registrar_remarks varchar(50) DEFAULT NULL,
416 PRIMARY KEY (fds_id)
417 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
418 $this->conn->Execute($file_dropped_students);
419
420 $file_exam_detail ="
421 CREATE TABLE IF NOT EXISTS file_exam_detail_".$newSY." (
422 esd_id int(10) unsigned NOT NULL AUTO_INCREMENT,
423 esh_id int(10) unsigned NOT NULL DEFAULT 0,
424 esd_date date DEFAULT NULL,
425 esd_timefrom time DEFAULT NULL,
426 esd_timeto time DEFAULT NULL,
427 esd_roomname varchar(64) DEFAULT NULL,
428 esd_examresult float(6,2) DEFAULT NULL,
429 esd_achievementresult float(6,2) DEFAULT NULL,
430 esd_iqresult tinyint(3) unsigned DEFAULT NULL,
431 esd_remarks1 tinyint(3) unsigned DEFAULT NULL,
432 esd_remarks2 text,
433 esd_status tinyint(3) unsigned DEFAULT NULL,
434 stud_applicant_id int(10) unsigned DEFAULT NULL,
435 esd_addwho varchar(64) DEFAULT NULL,
436 esd_addwhen timestamp NULL DEFAULT NULL,
437 esd_updatewho varchar(64) DEFAULT NULL,
438 esd_updatewhen datetime DEFAULT NULL,
439 PRIMARY KEY (esd_id),
440 KEY esh_id_index (esh_id)
441 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
442 $this->conn->Execute($file_exam_detail);
443
444 $file_exam_detail_history ="
445 CREATE TABLE IF NOT EXISTS file_exam_detail_history_".$newSY." (
446 esdh_id int(10) unsigned NOT NULL AUTO_INCREMENT,
447 esd_id int(10) unsigned DEFAULT NULL,
448 esh_id int(10) unsigned DEFAULT NULL,
449 esdh_addwho varchar(64) DEFAULT NULL,
450 esdh_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
451 stud_applicant_id int(10) unsigned DEFAULT NULL,
452 PRIMARY KEY (esdh_id)
453 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
454 $this->conn->Execute($file_exam_detail_history);
455
456 $file_exam_sched_header ="
457 CREATE TABLE IF NOT EXISTS file_exam_sched_header_".$newSY." (
458 esh_id int(10) unsigned NOT NULL AUTO_INCREMENT,
459 yl_id int(10) unsigned NOT NULL,
460 sy_id int(10) unsigned NOT NULL,
461 emp_id int(10) unsigned NOT NULL,
462 esh_examiner varchar(64) NOT NULL,
463 esh_date date NOT NULL,
464 esh_maxnoofexaminees int(3) unsigned NOT NULL,
465 esh_roomname varchar(64) NOT NULL,
466 esh_remarks varchar(100) NOT NULL,
467 esh_timefrom time DEFAULT NULL,
468 esh_timeto time DEFAULT NULL,
469 esh_addwho varchar(64) DEFAULT NULL,
470 esh_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
471 esh_updatewho varchar(64) DEFAULT NULL,
472 esh_updatewhen datetime DEFAULT NULL,
473 PRIMARY KEY (esh_id),
474 KEY sy_id_index (esh_remarks)
475 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
476 $this->conn->Execute($file_exam_sched_header);
477
478 $file_interview_detail ="
479 CREATE TABLE IF NOT EXISTS file_interview_detail_".$newSY." (
480 isd_id int(10) unsigned NOT NULL AUTO_INCREMENT,
481 ish_id int(10) unsigned NOT NULL DEFAULT 0,
482 isd_date date DEFAULT NULL,
483 isd_time time DEFAULT NULL,
484 isd_roomname varchar(64) DEFAULT NULL,
485 isd_status tinyint(3) unsigned DEFAULT NULL,
486 stud_applicant_id int(10) unsigned DEFAULT NULL,
487 isd_recommendation text,
488 isd_addwho varchar(64) DEFAULT NULL,
489 isd_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
490 isd_updatewho varchar(64) DEFAULT NULL,
491 isd_updatewhen datetime DEFAULT NULL,
492 PRIMARY KEY (isd_id),
493 KEY esh_id_index (ish_id)
494 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
495 $this->conn->Execute($file_interview_detail);
496
497 $file_interview_sched_header ="
498 CREATE TABLE IF NOT EXISTS file_interview_sched_header_".$newSY." (
499 ish_id int(10) unsigned NOT NULL AUTO_INCREMENT,
500 sy_id int(10) unsigned NOT NULL,
501 yl_id int(10) unsigned NOT NULL,
502 ish_interviewer varchar(64) NOT NULL,
503 ish_date date NOT NULL,
504 ish_roomname varchar(64) NOT NULL,
505 ish_remarks varchar(100) NOT NULL,
506 ish_time time DEFAULT NULL,
507 esh_addwho varchar(64) DEFAULT NULL,
508 esh_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
509 esh_updatewho varchar(64) DEFAULT NULL,
510 esh_updatewhen datetime DEFAULT NULL,
511 PRIMARY KEY (ish_id)
512 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
513 $this->conn->Execute($file_interview_sched_header);
514
515 $file_permit_to_enroll ="
516 CREATE TABLE IF NOT EXISTS file_permit_to_enroll_".$newSY." (
517 pte_id int(10) unsigned NOT NULL AUTO_INCREMENT,
518 sy_id int(10) unsigned NOT NULL DEFAULT 0,
519 sct_id int(10) unsigned DEFAULT NULL,
520 scd_id int(10) unsigned DEFAULT NULL,
521 stud_applicant_id int(11) NOT NULL,
522 pte_mode_of_payment int(11) unsigned DEFAULT NULL,
523 pte_issuedby int(11) unsigned DEFAULT NULL,
524 pte_issueddate date DEFAULT NULL,
525 pte_insurance_receiver varchar(35) COLLATE latin1_general_ci DEFAULT NULL,
526 pte_guardian varchar(45) COLLATE latin1_general_ci DEFAULT NULL,
527 pte_general_ave float(9,2) NOT NULL,
528 pte_address varchar(200) COLLATE latin1_general_ci DEFAULT NULL,
529 pte_telno varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
530 pte_issuedby_name varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
531 pte_status int(1) unsigned DEFAULT 0,
532 pte_bday date DEFAULT NULL,
533 stud_level_prev int(11) unsigned DEFAULT NULL,
534 stud_level_next int(11) unsigned DEFAULT NULL,
535 pte_celno varchar(15) COLLATE latin1_general_ci DEFAULT NULL,
536 pte_newstudent tinyint(3) unsigned DEFAULT NULL,
537 pte_updatewhen datetime DEFAULT NULL,
538 pte_addwho varchar(64) COLLATE latin1_general_ci DEFAULT NULL,
539 pte_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
540 pte_dependent_to int(10) unsigned DEFAULT NULL,
541 pte_applydiscount int(10) unsigned DEFAULT NULL,
542 psc_id int(10) unsigned DEFAULT NULL,
543 pte_noofchildren_enrolled int(10) unsigned DEFAULT NULL,
544 pte_updatewho varchar(64) COLLATE latin1_general_ci DEFAULT NULL,
545 PRIMARY KEY (pte_id),
546 KEY file_permit_to_enroll_FKIndex1 (stud_applicant_id),
547 KEY file_permit_to_enroll_FKIndex2 (sy_id)
548 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1";
549 $this->conn->Execute($file_permit_to_enroll);
550
551 $file_sectioning_details ="
552 CREATE TABLE IF NOT EXISTS file_sectioning_details_".$newSY." (
553 fs_id int(10) unsigned NOT NULL AUTO_INCREMENT,
554 fs_sec_id int(10) unsigned DEFAULT NULL,
555 fs_stud_applicant_id int(10) unsigned DEFAULT NULL,
556 fs_addwho varchar(32) DEFAULT NULL,
557 fs_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
558 fs_updatewho varchar(32) DEFAULT NULL,
559 fs_updatewhen datetime DEFAULT NULL,
560 fs_yl_id int(10) unsigned DEFAULT NULL,
561 dropped int(1) DEFAULT 0,
562 PRIMARY KEY (fs_id),
563 KEY file_sectioning_details_".$newSY."_FKIndex1 (fs_sec_id)
564 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
565 $this->conn->Execute($file_sectioning_details);
566
567 $file_sectioning_details_temp ="
568 CREATE TABLE IF NOT EXISTS file_sectioning_details_temp_".$newSY." (
569 fs_id int(10) unsigned NOT NULL AUTO_INCREMENT,
570 fs_sec_id int(10) unsigned DEFAULT NULL,
571 fs_stud_applicant_id int(10) unsigned DEFAULT NULL,
572 fs_yl_id int(10) unsigned DEFAULT NULL,
573 PRIMARY KEY (fs_id)
574 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
575 $this->conn->Execute($file_sectioning_details_temp);
576
577 $file_sectioning_header ="
578 CREATE TABLE IF NOT EXISTS file_sectioning_header_".$newSY." (
579 fcheader_id int(10) unsigned NOT NULL AUTO_INCREMENT,
580 fcheader_status int(10) unsigned DEFAULT NULL,
581 fs_sec_id int(10) unsigned DEFAULT NULL,
582 fcheader_addwho varchar(32) DEFAULT NULL,
583 fcheader_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
584 fcheader_updatewho varchar(32) DEFAULT NULL,
585 fcheader_updatewhen datetime DEFAULT NULL,
586 sy_id int(10) unsigned DEFAULT NULL,
587 fs_yl_id int(10) unsigned DEFAULT NULL,
588 PRIMARY KEY (fcheader_id),
589 KEY fcheader_sec_id_index (fs_sec_id),
590 KEY file_sectioning_header_".$newSY."_FKIndex1 (fs_sec_id)
591 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
592 $this->conn->Execute($file_sectioning_header);
593
594 $file_stream_class_details ="
595 CREATE TABLE IF NOT EXISTS file_stream_class_details_".$newSY." (
596 fs_id int(10) unsigned NOT NULL AUTO_INCREMENT,
597 fs_sec_id int(10) unsigned DEFAULT NULL,
598 fs_stud_applicant_id int(10) unsigned DEFAULT NULL,
599 fs_addwho varchar(32) DEFAULT NULL,
600 fs_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
601 fs_updatewho varchar(32) DEFAULT NULL,
602 fs_updatewhen datetime DEFAULT NULL,
603 fs_yl_id int(10) unsigned DEFAULT NULL,
604 dropped int(1) DEFAULT 0,
605 PRIMARY KEY (fs_id),
606 KEY file_stream_class_details_".$newSY."_FKIndex1 (fs_sec_id)
607 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
608 $this->conn->Execute($file_stream_class_details);
609
610 $file_section ="
611 CREATE TABLE IF NOT EXISTS file_section_".$newSY." (
612 section_id int(10) unsigned NOT NULL AUTO_INCREMENT,
613 sy_id int(10) unsigned NOT NULL,
614 ab_id int(10) unsigned NOT NULL,
615 yl_id int(10) unsigned NOT NULL,
616 section_name varchar(255) NOT NULL,
617 section_isactive tinyint(3) unsigned DEFAULT NULL,
618 section_addwho varchar(64) DEFAULT NULL,
619 section_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
620 section_updatewho varchar(64) DEFAULT NULL,
621 section_updatewhen datetime DEFAULT NULL,
622 PRIMARY KEY (section_id)
623 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
624 $this->conn->Execute($file_section);
625
626 $file_stream_class_header ="
627 CREATE TABLE IF NOT EXISTS file_stream_class_header_".$newSY." (
628 fcheader_id int(10) unsigned NOT NULL AUTO_INCREMENT,
629 fcheader_status int(10) unsigned DEFAULT NULL,
630 fs_sec_id int(10) unsigned DEFAULT NULL,
631 fcheader_addwho varchar(32) DEFAULT NULL,
632 fcheader_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
633 fcheader_updatewho varchar(32) DEFAULT NULL,
634 fcheader_updatewhen datetime DEFAULT NULL,
635 sy_id int(10) unsigned DEFAULT NULL,
636 fs_yl_id int(10) unsigned DEFAULT NULL,
637 PRIMARY KEY (fcheader_id),
638 KEY file_stream_class_header_".$newSY."_FKIndex1 (fs_sec_id)
639 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
640 $this->conn->Execute($file_stream_class_header);
641
642 $file_student_enrolled ="
643 CREATE TABLE IF NOT EXISTS file_student_enrolled_".$newSY." (
644 studenrol_id int(10) unsigned NOT NULL AUTO_INCREMENT,
645 section_id bigint(20) NOT NULL,
646 yl_id int(10) unsigned NOT NULL,
647 studenrol_orno varchar(32) DEFAULT NULL,
648 studenrol_amount float(9,2) DEFAULT NULL,
649 studenrol_datepaid date DEFAULT NULL,
650 stud_applicant_id int(10) unsigned DEFAULT NULL,
651 studenrol_addwho varchar(64) DEFAULT NULL,
652 studenrol_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
653 studenrol_updatewho varchar(64) DEFAULT NULL,
654 studenrol_updatewhen datetime DEFAULT NULL,
655 studenrol_status tinyint(3) unsigned DEFAULT NULL,
656 ab_id int(10) unsigned DEFAULT NULL,
657 fse_override int(10) DEFAULT 0,
658 fse_remarks varchar(64) DEFAULT NULL,
659 PRIMARY KEY (studenrol_id),
660 KEY ab_id_index (ab_id),
661 KEY stud_applicant_id (stud_applicant_id)
662 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
663 $this->conn->Execute($file_student_enrolled);
664
665 $file_student_no = "
666 CREATE TABLE IF NOT EXISTS file_student_no_".$newSY." (
667 sn_id int(10) unsigned NOT NULL AUTO_INCREMENT,
668 ab_id int(10) unsigned NOT NULL,
669 stud_applicant_id int(11) NOT NULL,
670 sy_id int(10) unsigned NOT NULL,
671 sn_no varchar(8) NOT NULL,
672 sn_status int(1) unsigned NOT NULL,
673 sn_addwho varchar(64) DEFAULT NULL,
674 sn_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
675 sn_updatewho varchar(64) DEFAULT NULL,
676 sn_updatewhen datetime DEFAULT NULL,
677 PRIMARY KEY (sn_id),
678 KEY file_student_no_FKIndex1 (sy_id),
679 KEY file_student_no_FKIndex2 (stud_applicant_id)
680 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
681 $this->conn->Execute($file_student_no);
682
683 $student_admission_exam = "
684 CREATE TABLE IF NOT EXISTS student_admission_exam_".$newSY." (
685 saexam_id int(10) NOT NULL AUTO_INCREMENT,
686 stud_applicant_id int(11) NOT NULL,
687 saexam_date date NOT NULL,
688 saexam_result int(10) NOT NULL,
689 saexam_remarks int(10) NOT NULL,
690 saexam_addtlremarks varchar(256) NOT NULL,
691 saexam_addwho varchar(128) NOT NULL,
692 saexam_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
693 saexam_updatewho varchar(128) NOT NULL,
694 saexam_updatewhen datetime NOT NULL,
695 PRIMARY KEY (saexam_id)
696 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
697 $this->conn->Execute($student_admission_exam);
698
699 $student_admission_info = "
700 CREATE TABLE IF NOT EXISTS student_admission_info_".$newSY." (
701 sai_id int(10) unsigned NOT NULL AUTO_INCREMENT,
702 stud_applicant_id int(10) unsigned DEFAULT NULL,
703 sai_lastname varchar(128) DEFAULT NULL,
704 sai_firstname varchar(128) DEFAULT NULL,
705 sai_middlename varchar(128) DEFAULT NULL,
706 sai_mothers_maiden_name varchar(128) DEFAULT NULL,
707 sai_nickname varchar(64) DEFAULT NULL,
708 sai_gender varchar(8) DEFAULT NULL,
709 sai_birthday date DEFAULT NULL,
710 sai_age tinyint(3) unsigned DEFAULT NULL,
711 sai_caddress1 varchar(255) DEFAULT NULL,
712 sai_caddress2 varchar(255) DEFAULT NULL,
713 sai_caddress3 varchar(255) DEFAULT NULL,
714 sai_caddress4 varchar(255) DEFAULT NULL,
715 sai_caddress5 varchar(255) DEFAULT NULL,
716 sai_czipcode varchar(16) DEFAULT NULL,
717 sai_sameascurrentadd tinyint(3) unsigned DEFAULT 0,
718 sai_paddress1 varchar(255) DEFAULT NULL,
719 sai_paddress2 varchar(255) DEFAULT NULL,
720 sai_paddress3 varchar(255) DEFAULT NULL,
721 sai_paddress4 varchar(255) DEFAULT NULL,
722 sai_paddress5 varchar(255) DEFAULT NULL,
723 sai_pzipcode varchar(16) DEFAULT NULL,
724 sai_citizenship tinyint(3) unsigned DEFAULT NULL,
725 sai_citizenship_oth varchar(128) DEFAULT NULL,
726 sai_homephone1 varchar(128) DEFAULT NULL,
727 sai_homephone2 varchar(128) DEFAULT NULL,
728 sai_mobilephone1 varchar(128) DEFAULT NULL,
729 sai_mobilephone2 varchar(128) DEFAULT NULL,
730 sai_email varchar(255) DEFAULT NULL,
731 sai_mktg_info text,
732 sai_addwho varchar(64) DEFAULT NULL,
733 sai_addwhen timestamp NULL DEFAULT CURRENT_TIMESTAMP,
734 sai_updatewho varchar(64) DEFAULT NULL,
735 sai_updatewhen datetime DEFAULT NULL,
736 sai_status tinyint(3) unsigned DEFAULT NULL,
737 sai_returnee_yearsgap tinyint(3) unsigned DEFAULT 0,
738 sy_id int(10) unsigned DEFAULT NULL,
739 yl_id int(10) unsigned DEFAULT NULL,
740 sai_lastgyattended int(10) unsigned DEFAULT NULL,
741 sai_studno varchar(64) DEFAULT NULL,
742 ab_id int(10) unsigned DEFAULT 2,
743 PRIMARY KEY (sai_id),
744 KEY stud_applicant_id (stud_applicant_id),
745 KEY ab_id (ab_id)
746 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
747 $this->conn->Execute($student_admission_info);
748
749 $student_admission_interview ="
750 CREATE TABLE IF NOT EXISTS student_admission_interview_".$newSY." (
751 sainterview_id int(10) NOT NULL AUTO_INCREMENT,
752 stud_applicant_id int(10) NOT NULL,
753 sainterview_date date NOT NULL,
754 sainterview_remarks varchar(256) NOT NULL,
755 sainterview_addwho varchar(128) NOT NULL,
756 sainterview_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
757 sainterview_updatewho varchar(128) NOT NULL,
758 sainterview_updatewhen datetime NOT NULL,
759 PRIMARY KEY (sainterview_id)
760 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
761 $this->conn->Execute($student_admission_interview);
762
763 $dps_subject_info ="
764 CREATE TABLE IF NOT EXISTS dps_subject_info_".$newSY." (
765 dps_subject_info_id bigint(20) NOT NULL AUTO_INCREMENT,
766 dps_subject_info_name varchar(255) DEFAULT NULL,
767 dps_subject_info_shortname varchar(128) NOT NULL,
768 subject_level_id bigint(20) DEFAULT NULL,
769 stud_level_id bigint(20) DEFAULT NULL COMMENT '1-for Grade 1, 2- for Grade 2, 3 for Grade 3, 8 for 1st Year etc.',
770 dps_subject_ordinal_value bigint(20) DEFAULT NULL,
771 dps_subject_parent bigint(20) DEFAULT NULL COMMENT 'specify the ID of the parent subject',
772 dps_subject_type char(1) NOT NULL DEFAULT 'P' COMMENT 'if P = parent, if D = Dependent, if S = Streams these are the subjects for Third Year only',
773 dps_subject_no_of_units float(2,1) DEFAULT NULL,
774 dps_subjabbrev_id bigint(20) DEFAULT NULL,
775 sy_id mediumint(20) DEFAULT 1 COMMENT '1 = for AY:2007-2008',
776 dps_subject_percentage float(2,2) DEFAULT NULL,
777 subjectname_appearoncard varchar(50) DEFAULT NULL,
778 hasedited_subjname char(1) NOT NULL DEFAULT 0,
779 font_attrib varchar(128) DEFAULT NULL,
780 subinfo_incompute tinyint(1) NOT NULL,
781 subinfo_incomputec tinyint(1) NOT NULL DEFAULT 1 COMMENT 'to separate conduct gen ave computation',
782 PRIMARY KEY (dps_subject_info_id),
783 KEY subject_level_id (subject_level_id),
784 KEY stud_level_id (stud_level_id),
785 KEY dps_subject_parent (dps_subject_parent)
786 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=358";
787 $this->conn->Execute($dps_subject_info);
788
789 $file_class_type ="
790 CREATE TABLE IF NOT EXISTS file_class_type_".$newSY." (
791 ct_id int(10) unsigned NOT NULL AUTO_INCREMENT,
792 ct_name varchar(32) DEFAULT NULL,
793 ct_description varchar(32) DEFAULT NULL,
794 ct_rank int(10) unsigned DEFAULT NULL,
795 ct_type int(10) unsigned DEFAULT NULL,
796 ct_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
797 ct_addwho varchar(32) DEFAULT NULL,
798 ct_updatewhen date DEFAULT NULL,
799 ct_updatewho varchar(32) DEFAULT NULL,
800 PRIMARY KEY (ct_id)
801 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5";
802 $this->conn->Execute($file_class_type);
803
804 $file_gradeyearlevel ="
805 CREATE TABLE IF NOT EXISTS file_gradeyearlevel_".$newSY." (
806 yl_id int(10) unsigned NOT NULL,
807 sy_id int(10) unsigned NOT NULL,
808 dept_id int(10) unsigned NOT NULL,
809 yl_name varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
810 yl_shortname varchar(64) DEFAULT NULL,
811 yl_ordinal tinyint(3) unsigned DEFAULT NULL,
812 yl_isactive tinyint(3) unsigned DEFAULT NULL,
813 yl_prevlevel int(10) unsigned DEFAULT NULL,
814 yl_nextlevel int(10) unsigned DEFAULT NULL,
815 yl_addwho varchar(64) DEFAULT NULL,
816 yl_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
817 yl_updatewho varchar(64) DEFAULT NULL,
818 yl_updatewhen datetime DEFAULT NULL,
819 PRIMARY KEY (yl_id),
820 KEY file_yearlevel_FKIndex1 (dept_id),
821 KEY sy_id (sy_id)
822 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
823 $this->conn->Execute($file_gradeyearlevel);
824
825 $stream_subject ="
826 CREATE TABLE IF NOT EXISTS stream_subject_".$newSY." (
827 stream_subject_id int(10) unsigned NOT NULL AUTO_INCREMENT,
828 stream_subject_name varchar(100) DEFAULT NULL,
829 dps_subject_info_id int(10) unsigned DEFAULT NULL,
830 sy_id int(10) unsigned DEFAULT NULL,
831 PRIMARY KEY (stream_subject_id),
832 KEY stream_subject_2010_2011_FKIndex1 (stream_subject_id)
833 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
834 $this->conn->Execute($stream_subject);
835
836 $stream_subject_assign ="
837 CREATE TABLE IF NOT EXISTS stream_subject_assign_".$newSY." (
838 sec_subject_id int(10) unsigned NOT NULL AUTO_INCREMENT,
839 csetup_id int(10) unsigned DEFAULT NULL,
840 sec_subject_addwho varchar(32) DEFAULT NULL,
841 sec_subject_addwhen timestamp NULL DEFAULT CURRENT_TIMESTAMP,
842 sec_subject_updatewho varchar(32) DEFAULT NULL,
843 sec_subject_updatewhen datetime DEFAULT NULL,
844 stream_subject_id int(10) unsigned DEFAULT NULL,
845 PRIMARY KEY (sec_subject_id)
846 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
847 $this->conn->Execute($stream_subject_assign);
848
849 $dps_att_daysofschool ="
850 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_att_daysofschool_".$newSY." (
851 days_school_id int(10) unsigned NOT NULL AUTO_INCREMENT,
852 quarter_info tinyint(3) unsigned DEFAULT NULL,
853 month_id tinyint(3) unsigned DEFAULT NULL,
854 actual_count int(10) unsigned DEFAULT NULL,
855 dept_id int(10) unsigned DEFAULT NULL,
856 sy_id int(10) unsigned DEFAULT NULL,
857 days_of_school_addwho varchar(32) DEFAULT NULL,
858 days_of_school_addwhen timestamp NULL DEFAULT CURRENT_TIMESTAMP,
859 days_of_school_updatewho varchar(32) DEFAULT NULL,
860 days_of_school_updatewhen datetime DEFAULT NULL,
861 PRIMARY KEY (days_school_id),
862 KEY month_id (month_id),
863 KEY dept_id (dept_id),
864 KEY sy_id (sy_id)
865 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
866 $this->conn->Execute($dps_att_daysofschool);
867
868 $dps_grade_homeroom ="
869 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_grade_homeroom_".$newSY." (
870 gh_id bigint(20) NOT NULL AUTO_INCREMENT,
871 stud_info_id bigint(20) DEFAULT NULL,
872 sec_id bigint(20) DEFAULT NULL,
873 gh_q1 smallint(6) unsigned DEFAULT NULL,
874 gh_q2 smallint(6) unsigned DEFAULT NULL,
875 gh_q3 smallint(6) unsigned DEFAULT NULL,
876 gh_q4 smallint(6) unsigned DEFAULT NULL,
877 gh_merits float(10,3) DEFAULT NULL,
878 gh_demerits float(10,3) DEFAULT NULL,
879 gh_club float(10,3) DEFAULT NULL,
880 sy_id bigint(20) DEFAULT NULL,
881 stud_applicant_id bigint(20) DEFAULT NULL,
882 isfinalq1 tinyint(3) unsigned DEFAULT NULL,
883 isfinalq2 tinyint(3) unsigned DEFAULT NULL,
884 isfinalq3 tinyint(3) unsigned DEFAULT NULL,
885 isfinalq4 tinyint(3) unsigned DEFAULT NULL,
886 PRIMARY KEY (gh_id),
887 KEY stud_info_id (stud_info_id),
888 KEY sec_id (sec_id),
889 KEY sy_id (sy_id),
890 KEY stud_applicant_id (stud_applicant_id)
891 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
892 $this->conn->Execute($dps_grade_homeroom);
893
894 $dps_promotions_report_advisers ="
895 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_promotions_report_advisers_".$newSY." (
896 pra_id bigint(20) NOT NULL AUTO_INCREMENT,
897 emp_id bigint(20) DEFAULT NULL,
898 teacher_lname varchar(50) DEFAULT NULL,
899 teacher_fname varchar(50) DEFAULT NULL,
900 teacher_mi varchar(5) DEFAULT NULL,
901 sec_id int(16) DEFAULT NULL,
902 yl_id int(11) DEFAULT NULL,
903 sy_id int(11) DEFAULT NULL,
904 ab_id int(11) DEFAULT NULL,
905 pra_updatedwho varchar(32) DEFAULT NULL,
906 pra_updatedwhen datetime DEFAULT NULL,
907 PRIMARY KEY (pra_id)
908 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
909 $this->conn->Execute($dps_promotions_report_advisers);
910
911
912 $dps_promotions_report_data ="
913 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_promotions_report_data_".$newSY." (
914 pr_id bigint(20) NOT NULL AUTO_INCREMENT,
915 stud_info_id bigint(20) DEFAULT NULL,
916 stud_applicant_id bigint(20) DEFAULT NULL,
917 ppd_lastname varchar(100) DEFAULT NULL,
918 ppd_firstname varchar(100) DEFAULT NULL,
919 ppd_middlename varchar(50) DEFAULT NULL,
920 ppd_address varchar(100) DEFAULT NULL,
921 ppd_age float DEFAULT NULL,
922 ppd_bday date DEFAULT NULL,
923 stud_yearsinschool int(10) DEFAULT NULL,
924 ppd_gender varchar(1) DEFAULT NULL,
925 yl_id int(11) DEFAULT NULL,
926 sec_id int(11) DEFAULT NULL,
927 sy_id int(11) DEFAULT NULL,
928 pr_addedwho varchar(32) DEFAULT NULL,
929 pr_addedwhen timestamp NULL DEFAULT CURRENT_TIMESTAMP,
930 pr_updatewho varchar(32) DEFAULT NULL,
931 pr_updatewhen datetime DEFAULT NULL,
932 PRIMARY KEY (pr_id)
933 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
934 $this->conn->Execute($dps_promotions_report_data);
935
936 $dps_promotions_report_details ="
937 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_promotions_report_details_".$newSY." (
938 prd_id int(16) NOT NULL AUTO_INCREMENT,
939 prd_sy_closedate date DEFAULT NULL,
940 prd_date_printed date DEFAULT NULL,
941 prd_principal varchar(150) DEFAULT NULL,
942 prd_supervisor varchar(150) DEFAULT NULL,
943 prd_municipality varchar(150) DEFAULT NULL,
944 prd_issue_date date DEFAULT NULL,
945 prd_superintendent varchar(150) DEFAULT NULL,
946 yl_id int(11) DEFAULT NULL,
947 sy_id int(11) DEFAULT NULL,
948 prd_addedwho varchar(32) DEFAULT NULL,
949 prd_addedwhen timestamp NULL DEFAULT CURRENT_TIMESTAMP,
950 prd_updatedwho varchar(32) DEFAULT NULL,
951 prd_updatewhen datetime DEFAULT NULL,
952 PRIMARY KEY (prd_id)
953 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
954 $this->conn->Execute($dps_promotions_report_details);
955
956 $dps_stream_subject_of_teacher ="
957 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_stream_subject_of_teacher_".$newSY." (
958 dps_stream_subject_of_teacher_id int(10) unsigned NOT NULL AUTO_INCREMENT,
959 emp_id int(10) unsigned DEFAULT NULL,
960 subject_id int(10) unsigned DEFAULT NULL,
961 yl_id int(10) unsigned DEFAULT NULL,
962 section_id int(10) unsigned DEFAULT NULL,
963 sy_id int(10) unsigned DEFAULT NULL,
964 stream_subject_teacher_rel_status int(2) unsigned DEFAULT 0,
965 updated_who int(10) unsigned DEFAULT NULL,
966 updated_when timestamp NULL DEFAULT NULL,
967 added_who int(10) unsigned DEFAULT NULL,
968 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
969 PRIMARY KEY (dps_stream_subject_of_teacher_id)
970 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
971 $this->conn->Execute($dps_stream_subject_of_teacher);
972
973 $dps_student_dayspresent ="
974 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_student_dayspresent_".$newSY." (
975 dayspresent_id int(10) unsigned NOT NULL AUTO_INCREMENT,
976 stud_applicant_id int(10) unsigned DEFAULT NULL,
977 actual_data text,
978 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
979 added_who int(10) unsigned DEFAULT NULL,
980 updated_when timestamp NULL DEFAULT NULL,
981 updated_who int(10) unsigned DEFAULT NULL,
982 PRIMARY KEY (dayspresent_id),
983 KEY stud_applicant_id (stud_applicant_id)
984 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
985 $this->conn->Execute($dps_student_dayspresent);
986
987 $dps_student_noid ="
988 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_student_noid_".$newSY." (
989 no_id_id int(10) unsigned NOT NULL AUTO_INCREMENT,
990 stud_applicant_id int(10) unsigned DEFAULT NULL,
991 actual_data text,
992 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
993 added_who int(10) unsigned DEFAULT NULL,
994 updated_when timestamp NULL DEFAULT NULL,
995 updated_who int(10) unsigned DEFAULT NULL,
996 PRIMARY KEY (no_id_id),
997 KEY stud_applicant_id (stud_applicant_id)
998 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
999 $this->conn->Execute($dps_student_noid);
1000
1001 $dps_student_tardiness ="
1002 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_student_tardiness_".$newSY." (
1003 tardiness_id int(10) unsigned NOT NULL AUTO_INCREMENT,
1004 stud_applicant_id int(10) unsigned DEFAULT NULL,
1005 actual_data text,
1006 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
1007 added_who int(10) unsigned DEFAULT NULL,
1008 updated_when timestamp NULL DEFAULT NULL,
1009 updated_who int(10) unsigned DEFAULT NULL,
1010 PRIMARY KEY (tardiness_id),
1011 KEY stud_applicant_id (stud_applicant_id)
1012 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1013 $this->conn->Execute($dps_student_tardiness);
1014
1015 $dps_student_uniform ="
1016 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_student_uniform_".$newSY." (
1017 uniform_id int(10) unsigned NOT NULL AUTO_INCREMENT,
1018 stud_applicant_id int(10) unsigned DEFAULT NULL,
1019 actual_data text,
1020 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
1021 added_who int(10) unsigned DEFAULT NULL,
1022 updated_when timestamp NULL DEFAULT NULL,
1023 updated_who int(10) unsigned DEFAULT NULL,
1024 PRIMARY KEY (uniform_id),
1025 KEY stud_applicant_id (stud_applicant_id)
1026 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1027 $this->conn->Execute($dps_student_uniform);
1028
1029 $dps_subject_info ="
1030 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_subject_info_".$newSY." (
1031 dps_subject_info_id bigint(20) NOT NULL AUTO_INCREMENT,
1032 dps_subject_info_name varchar(255) DEFAULT NULL,
1033 dps_subject_info_shortname varchar(128) NOT NULL,
1034 subject_level_id bigint(20) DEFAULT NULL,
1035 stud_level_id bigint(20) DEFAULT NULL COMMENT '1-for Grade 1, 2- for Grade 2, 3 for Grade 3, 8 for 1st Year etc.',
1036 dps_subject_ordinal_value bigint(20) DEFAULT NULL,
1037 dps_subject_parent bigint(20) DEFAULT NULL COMMENT 'specify the ID of the parent subject',
1038 dps_subject_type char(1) NOT NULL DEFAULT 'P' COMMENT 'if P = parent, if D = Dependent, if S = Streams these are the subjects for Third Year only',
1039 dps_subject_no_of_units float(2,1) DEFAULT NULL,
1040 dps_subjabbrev_id bigint(20) DEFAULT NULL,
1041 sy_id mediumint(20) DEFAULT 1 COMMENT '1 = for AY:2007-2008',
1042 dps_subject_percentage float(2,2) DEFAULT NULL,
1043 subjectname_appearoncard varchar(50) DEFAULT NULL,
1044 hasedited_subjname char(1) NOT NULL DEFAULT 0,
1045 font_attrib varchar(128) DEFAULT NULL,
1046 subinfo_incompute tinyint(1) NOT NULL,
1047 subinfo_incomputec tinyint(1) NOT NULL DEFAULT 1 COMMENT 'to separate conduct gen ave computation',
1048 PRIMARY KEY (dps_subject_info_id),
1049 KEY subject_level_id (subject_level_id),
1050 KEY stud_level_id (stud_level_id),
1051 KEY dps_subject_parent (dps_subject_parent)
1052 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1053 $this->conn->Execute($dps_subject_info);
1054
1055 $dps_subject_of_teacher ="
1056 CREATE TABLE IF NOT EXISTS dps_grade_db.dps_subject_of_teacher_".$newSY." (
1057 subject_of_teacher_id int(10) unsigned NOT NULL AUTO_INCREMENT,
1058 emp_id int(10) unsigned DEFAULT NULL,
1059 subject_id int(10) unsigned DEFAULT NULL,
1060 yl_id int(10) unsigned DEFAULT NULL,
1061 section_id int(10) unsigned DEFAULT NULL,
1062 sy_id int(10) unsigned DEFAULT NULL,
1063 subject_teacher_rel_status int(2) unsigned DEFAULT 0,
1064 updated_who int(10) unsigned DEFAULT NULL,
1065 updated_when timestamp NULL DEFAULT NULL,
1066 added_who int(10) unsigned DEFAULT NULL,
1067 added_when timestamp NULL DEFAULT CURRENT_TIMESTAMP,
1068 PRIMARY KEY (subject_of_teacher_id)
1069 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1070 $this->conn->Execute($dps_subject_of_teacher);
1071
1072 $grd_academic_ranking ="
1073 CREATE TABLE IF NOT EXISTS dps_grade_db.grd_academic_ranking_".$newSY." (
1074 ac_id bigint(20) NOT NULL AUTO_INCREMENT,
1075 stud_applicant_id bigint(20) DEFAULT NULL,
1076 yl_id int(10) unsigned DEFAULT NULL,
1077 ac_q1_argl varchar(64) DEFAULT NULL,
1078 ac_q2_argl varchar(64) DEFAULT NULL,
1079 ac_q3_argl varchar(64) DEFAULT NULL,
1080 ac_q4_argl varchar(64) DEFAULT NULL,
1081 ac_fg_argl varchar(64) DEFAULT NULL,
1082 ac_q1_persec tinyint(3) unsigned DEFAULT NULL,
1083 ac_q2_persec tinyint(3) unsigned DEFAULT NULL,
1084 ac_q3_persec tinyint(3) unsigned DEFAULT NULL,
1085 ac_q4_persec tinyint(3) unsigned DEFAULT NULL,
1086 ac_fg_persec tinyint(3) unsigned DEFAULT NULL,
1087 ac_q1_perlvl smallint(5) unsigned DEFAULT NULL,
1088 ac_q2_perlvl smallint(5) unsigned DEFAULT NULL,
1089 ac_q3_perlvl smallint(5) unsigned DEFAULT NULL,
1090 ac_q4_perlvl smallint(5) unsigned DEFAULT NULL,
1091 ac_fg_perlvl smallint(5) unsigned DEFAULT NULL,
1092 sy_id int(11) DEFAULT NULL,
1093 ac_addedwho varchar(16) DEFAULT NULL,
1094 ac_addedwhen timestamp NULL DEFAULT NULL,
1095 isrankq1_persec_final tinyint(3) unsigned DEFAULT NULL,
1096 isrankq2_persec_final tinyint(3) unsigned DEFAULT NULL,
1097 isrankq3_persec_final tinyint(3) unsigned DEFAULT NULL,
1098 isrankq4_persec_final tinyint(3) unsigned DEFAULT NULL,
1099 isrankfg_persec_final tinyint(3) unsigned DEFAULT NULL,
1100 section_id int(11) DEFAULT NULL,
1101 sec_id_q1 int(10) unsigned DEFAULT NULL,
1102 sec_id_q2 int(10) unsigned DEFAULT NULL,
1103 sec_id_q3 int(10) unsigned DEFAULT NULL,
1104 sec_id_q4 int(10) unsigned DEFAULT NULL,
1105 sec_id_fg int(10) unsigned DEFAULT NULL,
1106 ac_c1_persec int(10) unsigned DEFAULT NULL,
1107 ac_c2_persec int(10) unsigned DEFAULT NULL,
1108 ac_c3_persec int(10) unsigned DEFAULT NULL,
1109 ac_c4_persec int(10) unsigned DEFAULT NULL,
1110 ac_fc_persec int(11) DEFAULT NULL,
1111 ac_c1_perlvl int(10) unsigned DEFAULT NULL,
1112 ac_c2_perlvl int(10) unsigned DEFAULT NULL,
1113 ac_c3_perlvl int(10) unsigned DEFAULT NULL,
1114 ac_c4_perlvl int(10) unsigned DEFAULT NULL,
1115 ac_fc_perlvl int(11) DEFAULT NULL,
1116 isrankc1_persec_final int(10) unsigned DEFAULT NULL,
1117 isrankc2_persec_final int(10) unsigned DEFAULT NULL,
1118 isrankc3_persec_final int(10) unsigned DEFAULT NULL,
1119 isrankc4_persec_final int(10) unsigned DEFAULT NULL,
1120 isrankfc_persec_final int(11) DEFAULT NULL,
1121 PRIMARY KEY (ac_id),
1122 KEY stud_applicant_id (stud_applicant_id),
1123 KEY yl_id (yl_id),
1124 KEY sy_id (sy_id),
1125 KEY section_id (section_id)
1126 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1127 $this->conn->Execute($grd_academic_ranking);
1128
1129 $grd_clubgrade ="
1130 CREATE TABLE IF NOT EXISTS dps_grade_db.grd_clubgrade_".$newSY." (
1131 clubgrade_id int(11) NOT NULL AUTO_INCREMENT,
1132 stud_applicant_id int(11) NOT NULL,
1133 stud_info_id int(11) NOT NULL,
1134 sec_id int(11) NOT NULL,
1135 cg_q1 int(11) DEFAULT NULL COMMENT 'clubgrade_firstquarter',
1136 cg_q2 int(11) DEFAULT NULL COMMENT 'clubgrade_secondquarter',
1137 cg_q3 int(11) DEFAULT NULL COMMENT 'clubgrade_thirdquarter',
1138 cg_q4 int(11) DEFAULT NULL COMMENT 'clubgrade_fourthquarter',
1139 isfinalq1 int(11) NOT NULL,
1140 isfinalq2 int(11) NOT NULL,
1141 isfinalq3 int(11) NOT NULL,
1142 isfinalq4 int(11) NOT NULL,
1143 cg_addwho varchar(12) NOT NULL,
1144 cg_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1145 cg_updatewho varchar(12) NOT NULL,
1146 cg_updatewhen datetime NOT NULL,
1147 PRIMARY KEY (clubgrade_id)
1148 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1149 $this->conn->Execute($grd_clubgrade);
1150
1151 $grd_gen_average_fg ="
1152 CREATE TABLE IF NOT EXISTS dps_grade_db.grd_gen_average_fg_".$newSY." (
1153 ga_id bigint(20) NOT NULL AUTO_INCREMENT,
1154 stud_info_id bigint(20) DEFAULT NULL,
1155 ga_q1 float(9,3) DEFAULT NULL,
1156 ga_c1 smallint(6) unsigned DEFAULT NULL,
1157 ga_q2 float(9,3) DEFAULT NULL,
1158 ga_c2 smallint(6) unsigned DEFAULT NULL,
1159 ga_q3 float(9,3) DEFAULT NULL,
1160 ga_c3 smallint(6) unsigned DEFAULT NULL,
1161 ga_q4 float(9,3) DEFAULT NULL,
1162 ga_c4 smallint(6) unsigned DEFAULT NULL,
1163 ga_fg float(9,3) DEFAULT NULL,
1164 ga_fc smallint(6) unsigned DEFAULT NULL,
1165 ga_action_taken_fg varchar(64) DEFAULT NULL,
1166 ga_action_taken_fc varchar(64) DEFAULT NULL,
1167 ga_action_taken_prom varchar(64) DEFAULT NULL,
1168 sy_id int(11) DEFAULT NULL,
1169 ga_status int(11) DEFAULT NULL,
1170 stud_applicant_id bigint(20) DEFAULT NULL,
1171 isfinalq1 tinyint(3) unsigned DEFAULT NULL,
1172 isfinalq2 tinyint(3) unsigned DEFAULT NULL,
1173 isfinalq3 tinyint(3) unsigned DEFAULT NULL,
1174 isfinalq4 tinyint(3) unsigned DEFAULT NULL,
1175 isfinalfg tinyint(3) unsigned DEFAULT NULL,
1176 updated_who varchar(35) DEFAULT NULL,
1177 updated_when timestamp NULL DEFAULT NULL,
1178 yl_id int(10) unsigned DEFAULT NULL,
1179 ga_c1_rank float(9,2) DEFAULT NULL,
1180 ga_c2_rank float(9,2) DEFAULT NULL,
1181 ga_c3_rank float(9,2) DEFAULT NULL,
1182 ga_c4_rank float(9,2) DEFAULT NULL,
1183 ga_fc_rank float(9,2) DEFAULT NULL,
1184 PRIMARY KEY (ga_id),
1185 KEY stud_info_id (stud_info_id),
1186 KEY sy_id (sy_id),
1187 KEY stud_applicant_id (stud_applicant_id),
1188 KEY yl_id (yl_id)
1189 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1190 $this->conn->Execute($grd_gen_average_fg);
1191
1192
1193 $grd_subject_grades ="
1194 CREATE TABLE IF NOT EXISTS dps_grade_db.grd_subject_grades_".$newSY." (
1195 sg_id bigint(20) NOT NULL AUTO_INCREMENT,
1196 stud_applicant_id bigint(20) DEFAULT NULL,
1197 stud_info_id bigint(20) DEFAULT NULL,
1198 subject_info_id int(16) DEFAULT NULL,
1199 sec_id bigint(20) DEFAULT NULL,
1200 sg_q1 float(9,2) DEFAULT NULL,
1201 sg_c1 smallint(6) unsigned DEFAULT NULL,
1202 sg_q2 float(9,2) DEFAULT NULL,
1203 sg_c2 smallint(6) unsigned DEFAULT NULL,
1204 sg_q3 float(9,2) DEFAULT NULL,
1205 sg_c3 smallint(6) unsigned DEFAULT NULL,
1206 sg_q4 float(9,2) DEFAULT NULL,
1207 sg_c4 smallint(6) unsigned DEFAULT NULL,
1208 sg_fg float(9,2) DEFAULT NULL,
1209 sg_status int(11) DEFAULT NULL,
1210 sy_id int(11) DEFAULT NULL,
1211 sg_action_taken varchar(255) DEFAULT NULL,
1212 isfinalq1 tinyint(3) unsigned DEFAULT NULL,
1213 isfinalq2 tinyint(3) unsigned DEFAULT NULL,
1214 isfinalq3 tinyint(3) unsigned DEFAULT NULL,
1215 isfinalq4 tinyint(3) unsigned DEFAULT NULL,
1216 isfinalfg tinyint(3) unsigned DEFAULT NULL,
1217 rank_q1 smallint(5) unsigned DEFAULT NULL,
1218 rank_q2 smallint(5) unsigned DEFAULT NULL,
1219 rank_q3 smallint(5) unsigned DEFAULT NULL,
1220 rank_q4 smallint(5) unsigned DEFAULT NULL,
1221 rank_fg smallint(5) unsigned DEFAULT NULL,
1222 isrank_finalq1 tinyint(3) unsigned DEFAULT NULL,
1223 isrank_finalq2 tinyint(3) unsigned DEFAULT NULL,
1224 isrank_finalq3 tinyint(3) unsigned DEFAULT NULL,
1225 isrank_finalq4 tinyint(3) unsigned DEFAULT NULL,
1226 isrank_finalfg tinyint(3) unsigned DEFAULT NULL,
1227 updated_who varchar(35) DEFAULT NULL,
1228 updated_when timestamp NULL DEFAULT NULL,
1229 remarks_q1 varchar(50) DEFAULT NULL,
1230 remarks_q2 varchar(50) DEFAULT NULL,
1231 remarks_q3 varchar(50) DEFAULT NULL,
1232 remarks_q4 varchar(50) DEFAULT NULL,
1233 PRIMARY KEY (sg_id),
1234 KEY stud_applicant_id (stud_applicant_id)
1235 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1236 $this->conn->Execute($grd_subject_grades);
1237
1238 $lib_inventory ="
1239 CREATE TABLE IF NOT EXISTS dps_library_db.lib_inventory_".$newSY." (
1240 lib_inv_id int(11) NOT NULL AUTO_INCREMENT,
1241 book_id int(11) NOT NULL,
1242 ac_id int(11) NOT NULL,
1243 accession_id varchar(256) NOT NULL,
1244 loc_id int(11) NOT NULL,
1245 sy_id int(11) NOT NULL,
1246 lib_inv_addwho varchar(256) NOT NULL,
1247 lib_inv_tagby varchar(120) NOT NULL,
1248 lib_inv_addwhen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1249 status_id int(11) DEFAULT NULL,
1250 book_status_id int(11) DEFAULT NULL COMMENT 'pag 0 ung status ibig sabihin retrieve cya',
1251 source_id int(11) NOT NULL,
1252 date_process date NOT NULL,
1253 book_status_updatewhen date NOT NULL,
1254 PRIMARY KEY (lib_inv_id),
1255 KEY ac_id (ac_id)
1256 ) ENGINE=MyISAM DEFAULT CHARSET=latin1";
1257 $this->conn->Execute($lib_inventory);
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267 $sy_id = $this->conn->Insert_ID();
1268// $path_ = $_SESSION['config_global']['REGISTRAR_PATH'].'/dbmodel/create_new_schoolyear';
1269//
1270// $directory = opendir($path_);
1271// while (false !== ($file = readdir($directory))) {
1272// if($file != '.' && $file != '..'){
1273// $file = $path_.'/'.$file;
1274// $open_file = fopen($file, 'r');
1275// $read_file = fread($open_file, filesize($file));
1276// fclose($open_file);
1277// $sql = str_replace("xxxx_yyyy",$sy_from.'_'.$sy_to,$read_file);
1278//
1279// $this->conn->Execute($sql);
1280//
1281// }
1282//
1283// }
1284
1285 $_SESSION['eMsg']="Successfully Added.";
1286 }
1287
1288
1289 /**
1290 * Save Update
1291 *
1292 */
1293 function doSaveEdit(){
1294 /**
1295 *
1296 * $sy_abbr is the abbreviation of school year
1297 * $sy_from = year format only
1298 * $sy_to = year format only
1299 * $sy_name = concatination of sy_from and sy_to
1300 *
1301 */
1302 $id = $_GET['edit'];
1303 $explode_datefrom = explode("-",$_POST['sy_datefrom']);
1304 $explode_dateto = explode("-",$_POST['sy_dateto']);
1305
1306 $sy_abbr = substr($explode_datefrom['2'], 2);
1307 $sy_from = $explode_datefrom['2'];
1308 $sy_to = $explode_dateto['2'];
1309 $syfrom = $explode_datefrom['2'].'-'.$explode_datefrom['0'].'-'.$explode_datefrom['1'];
1310 $syto = $explode_dateto['2'].'-'.$explode_dateto['0'].'-'.$explode_dateto['1'];
1311// $sy_abbr = strftime("%y",strtotime($_POST['sy_datefrom']));
1312// $sy_from = strftime("%Y",strtotime($_POST['sy_datefrom']));
1313// $sy_to = strftime("%Y",strtotime($_POST['sy_dateto']));
1314 $sy_name = $sy_from.'-'.$sy_to;
1315
1316 if (isset($_POST['sy_default'])) {
1317 $sql = 'update dps_registrar_db.file_schoolyear set sy_default = 0';
1318 $this->conn->Execute($sql);
1319 $sy_default = 1;
1320 }
1321
1322 $flds = array();
1323 $flds[] = "sy_datefrom = '$syfrom'";
1324 $flds[] = "sy_dateto = '$syto'";
1325 $flds[] = "sy_from='$sy_from'";
1326 $flds[] = "sy_to='$sy_to'";
1327 $flds[] = "sy_name='$sy_name'";
1328 $flds[] = "sy_abbr='$sy_abbr'";
1329 $flds[] = "sy_default='$sy_default'";
1330 $fields = implode(", ",$flds);
1331 $sql = "UPDATE dps_registrar_db.file_schoolyear SET $fields WHERE sy_id=$id";
1332 $this->conn->Execute($sql);
1333 $_SESSION['eMsg']="Successfully Updated.";
1334 }
1335
1336 /**
1337 * Delete Record
1338 *
1339 * @param string $id_
1340 */
1341 function doDelete($id_ = ""){
1342 $sql = "DELETE FROM dps_registrar_db.file_schoolyear WHERE sy_id=?";
1343 $this->conn->Execute($sql,array($id_));
1344 $_SESSION['eMsg']="Successfully Deleted.";
1345 }
1346
1347 /**
1348 * Get all the Table Listings
1349 *
1350 * @return array
1351 */
1352 function getTableList(){
1353
1354
1355 // Process the query string and exclude querystring named "p"
1356 if (!empty($_SERVER['QUERY_STRING'])) {
1357 $qrystr = explode("&",$_SERVER['QUERY_STRING']);
1358 foreach ($qrystr as $value) {
1359 $qstr = explode("=",$value);
1360 if ($qstr[0]!="p") {
1361 $arrQryStr[] = implode("=",$qstr);
1362 }
1363 }
1364 $aQryStr = $arrQryStr;
1365 $aQryStr[] = "p=@@";
1366 $queryStr = implode("&",$aQryStr);
1367 }
1368
1369 //bby: search module
1370 $qry = array();
1371 if (isset($_REQUEST['search_field'])) {
1372
1373 // lets check if the search field has a value
1374 if (strlen($_REQUEST['search_field'])>0) {
1375 // lets assign the request value in a variable
1376 $search_field = $_REQUEST['search_field'];
1377
1378 // create a custom criteria in an array
1379 $qry[] = "sy.sy_name like '%$search_field%'";
1380
1381 }
1382 }
1383
1384 // put all query array into one criteria string
1385 $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
1386
1387 $flds = array();
1388 $flds[] = "sy_id";
1389 $flds[] = "sy_name";
1390 $flds[] = "sy_from";
1391 $flds[] = "sy_abbr";
1392 $flds[] = "sy_datefrom";
1393 $flds[] = "sy_dateto";
1394 $flds[] = "sy_default";
1395
1396 $fields = implode(",",$flds);
1397
1398 // Sort field mapping
1399 $arrSortBy = array(
1400 "sy_name"=>"sy_name"
1401 ,"sy_datefrom"=>"sy_datefrom"
1402 ,"sy_dateto"=>"sy_dateto"
1403 ,"status"=>"status"
1404 );
1405
1406 if(isset($_GET['sortby'])){
1407 $strOrderBy = " order by ".$arrSortBy[$_GET['sortby']]." ".$_GET['sortof'];
1408 }
1409
1410 $viewLink = "";
1411 $editLink = "<a href=\"?statpos=schoolyear&edit=',sy.sy_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/edit.gif\" title=\"Edit\" hspace=\"2px\" border=0></a>";
1412 $delLink = "<a href=\"?statpos=schoolyear&delete=',sy.sy_id,'\" onclick=\"return confirm(\'Are you sure, you want to delete?\');\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/trash.gif\" title=\"Delete\" hspace=\"2px\" border=0></a>";
1413
1414 $sql = "select $fields,CONCAT('$viewLink','$editLink','$delLink') as viewdata,
1415 if(sy_default=1,'Default','') as status from dps_registrar_db.file_schoolyear sy
1416 $criteria
1417 $strOrderBy";
1418
1419 $sqlcount = "select count(*) as mycount FROM file_schoolyear $criteria";
1420
1421 $arrFields = array(
1422 "sy_name"=>"School Year",
1423 "sy_datefrom"=>"Date From",
1424 "sy_dateto"=>"Date To",
1425 "status"=>"Status",
1426 "viewdata"=>" "
1427 );
1428
1429 $arrAttribs = array(
1430 "viewdata"=>"width='50' align='center'"
1431 );
1432
1433 $tblDisplayList = new clsTableList($this->conn);
1434 $tblDisplayList->arrFields = $arrFields;
1435 $tblDisplayList->paginator->linkPage = "?statpos=fg&p=@@";
1436 $tblDisplayList->sqlAll = $sql;
1437 $tblDisplayList->sqlCount = $sqlcount;
1438
1439 return $tblDisplayList->getTableList($arrAttribs);
1440 }
1441
1442}
1443
1444?>