Esempio n. 1
0
 function manage_settings()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = add_msg_if_any($this, $data);
     #default to curriculum settings
     $data = paginate_list($this, $data, 'search_subjects', array('isactive' => 'Y', 'searchstring' => ' AND school = ' . $this->myschool['id']));
     $this->load->view('settings/manage_settings_view', $data);
 }
Esempio n. 2
0
 function get_academia_schools($academia_account_id = '', $data = array())
 {
     #GET SCHOOLS THAT BELONG TO A GIVEN ACCOUNT
     $searchstring = '';
     if (!empty($academia_account_id)) {
         $searchstring = ' AA.id = ' . $academia_account_id . '';
     }
     $data_array = array('searchstring' => $searchstring);
     #GET THE RECORDS
     $school_accounts = paginate_list($this, $data, 'search_acadmia_schools', $data_array);
     return $school_accounts;
 }
Esempio n. 3
0
 function load_archive()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('s'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     if ($this->session->userdata('userid')) {
         $data = paginate_list($this, $data, 'get_user_archived_messages', array('userid' => $this->session->userdata('userid')));
     } else {
         $this->session->set_userdata('xmsg', "WARNING: Your user information could not be resolved.");
         redirect(base_url() . "/admin/logout/m/xmsg");
     }
     $data = add_msg_if_any($this, $data);
     $this->load->view('messages/archive_view', $data);
 }
Esempio n. 4
0
function awarded_beb_to_suspended_providers(){

        $urldata = $this->uri->uri_to_assoc(4, array('m', 'i'));
        $data = assign_to_data($urldata);
        $data = add_msg_if_any($this, $data);
        $data = handle_redirected_msgs($this, $data);
         
        $userid = $this->session->userdata['userid'];
        $pde = mysql_query("select * from  users where userid =".$userid);
        $q = mysql_fetch_array($pde);
 
        $result = paginate_list($this, $data, 'view_bebs',  array('SEARCHSTRING' => '  and bidinvitations.isactive="Y" AND procurement_plan_entries.isactive = "Y"  and bidinvitations.id not in ( select bidinvitation_id FROM contracts  ) and    users.userid = '.$userid.' ORDER BY bestevaluatedbidder.dateadded DESC' ),100);                      
         // $provider = '';
        $provider_selected = '';
        $contract_status = '';
        $visible = 0 ;

        //header information 
          $st = '<div class="widget-body" id="results"><table class="table table-striped table-hover">'.
            '<thead>'.
            '<tr>'.            
            '<th>Procurement Ref Number</th>'.
            '<th class="hidden-480">Selected Provider</th>'.
            '<th class="hidden-480">Subject of Procurement</th>'.
            '<th class="hidden-480">Value</th>'.
            '<th>Status</th>'.
            '<th>Date Added</th>'.
            '</tr>'.
            '</thead>'.
            '<tbody>';
        //end of header information
         foreach ($result['page_list'] as $key => $row) {            
             
      #   print_r($row);

             $provider = rtrim($row['providers'],',');

             $result =   $this-> db->query("SELECT providernames FROM providers where providerid in(".$provider.")")->result_array();
            
             $providerlist = '';
             $x = 0;
 
             foreach($result as $key => $record){

              $providerlist .= $x > 0 ? $record['providernames'].',' : $record['providernames'];
              $provider_selected = str_replace('-', ' ',$record['providernames']);
             # print_r($providerlist);   

              /*get me the provider names and get me the date beb was added :*/
              $provider = $provider_selected;
              $dateadded =  $row['dateadded']; 
             # print_r( $dateadded);  
              $result_data = mysqli_fetch_array($this -> Remoteapi_m -> suspended_provider_betweendates($dateadded,$provider_selected)); 
                if(count($result_data) > 0 )
                {
                    $contract_status = "Y";
                    $visible = 1 ;
                    break;
                }
           

             }
             if($contract_status == "Y")  
             {
                 //records fetch right here
                $bidd = $row['bid_id'];
            #print_r($row['bid_id']); exit();
            $st .=  '<tr> '. 
 
             '<td>'.$row['procurement_ref_no'].'</td>';
             $provider = rtrim($row['providers'],',');

             $result =   $this-> db->query("SELECT providernames FROM providers where providerid in(".$provider.")")->result_array();
             $st .=  '<td class="hidden-480">';
             $providerlist = '';
             $x = 0;

             foreach($result as $key => $record){
              $providerlist .= $x > 0 ? $record['providernames'].',' : $record['providernames'];
              $x ++ ;
             }

            //print_r($providerlist);
            $providerlists = ($x > 1 )? rtrim($providerlist,',').' <span class="label label-info">Joint Venture</span> ' : $providerlist;

            $st .=  $providerlists.'</td>'.
            '<td class="hidden-480">'.$row['subject_of_procurement'].'</td>'.
            '<td class="hidden-480">'.number_format($row['contractprice']).$row['currency'].'</td>'.
            '<td>';
            if($row['isreviewed'] == 'Y')
            {
                 $st .= "<span class='label label-info minst'> Under Administrative Review </span>";
            }
           else
            {
                 $st .= '-';
            }
            $st .=  ' </th>'.
            '<td>'.date('Y-M-d',strtotime($row['dateadded'])).'</th>'.
            '</tr>';
        }

            
             $contract_status  = '';


        }
          $st .=  '</tbody></table></div>';

         if($visible ==  1)
         {   
            //

            $adons  = ' | '.date('d-m-y');

        $level = "Procurement";

        $titles = "Monthly Report on Soon Expiring Contracts for  ".$entityname.'| '. $adons;
        
        $body =  " ".html_entity_decode($st);
        $permission = "awarded_beb_to_suspended_providers";
        $this-> push_permission_all($titles,$body,$level,$permission,$records ['pdeid']);
        
        echo $body;

         #print_r($st);   
      
         }



}
Esempio n. 5
0
 function manage_classes()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the paginated list of the students
     $current_term_arr = current_term($this, $this->myschool['id']);
     $current_term_id = !empty($current_term_arr) ? $current_term_arr['id'] : 0;
     $data = paginate_list($this, $data, 'search_classes_register', array('isactive' => 'Y', 'term' => $current_term_id, 'school' => $this->myschool['id']));
     $data = add_msg_if_any($this, $data);
     $this->load->view('classes/manage_classes_view', $data);
 }
Esempio n. 6
0
 function manage_words()
 {
     access_control($this);
     # Get the passed details into the form data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('d'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = paginate_list($this, $data, 'get_word_list', array('searchstring' => ''), 200);
     $data = add_msg_if_any($this, $data);
     $this->load->view('search/manage_words', $data);
 }
Esempio n. 7
0
 function search_procurement_entries()
 {
     #check user access
     check_user_access($this, 'view_procurement_plan_entries', 'redirect');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'plan', 't'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $search_string = '';
     if ($this->session->userdata('isadmin') == 'N') {
         $userdata = $this->db->get_where('users', array('userid' => $this->session->userdata('userid')))->result_array();
         $search_string = ' AND PP.pde_id="' . $userdata[0]['pde'] . '"';
     }
     if ($this->input->post('searchQuery')) {
         $_POST = clean_form_data($_POST);
         $_POST['searchQuery'] = trim($_POST['searchQuery']);
         $search_string .= (!empty($data['plan']) ? ' AND PP.id ="' . decryptValue($data['plan']) . '" ' : '') . ' AND (PPE.procurement_ref_no like "%' . $_POST['searchQuery'] . '%" OR PPE.subject_of_procurement like "%' . $_POST['searchQuery'] . '%" ' . 'OR PPE.estimated_amount like "%' . $_POST['searchQuery'] . '%" ' . 'OR funding_sources.title like "%' . $_POST['searchQuery'] . '%" ' . 'OR U.firstname like "%' . $_POST['searchQuery'] . '%" OR ' . 'U.lastname like "%' . $_POST['searchQuery'] . '%") ';
     }
     $data = paginate_list($this, $data, 'procurement_entries', array('orderby' => 'PPE.dateadded DESC', 'searchstring' => $search_string));
     $data['area'] = 'procurement_entries';
     $this->load->view('includes/add_ons', $data);
 }
Esempio n. 8
0
 function manage_student_sponsors()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data['student_info'] = get_db_object_details($this, 'students', decryptValue($data['i']));
     #Get the paginated list of the students
     $data = paginate_list($this, $data, 'student_sponsors', array('searchstring' => ' AND students.id=' . decryptValue($data['i']), 'orderby' => 'fromdate DESC', 'student' => decryptValue($data['i'])));
     $data = add_msg_if_any($this, $data);
     $this->load->view('students/manage_student_sponsors_view', $data);
 }
Esempio n. 9
0
 function fetch_beb_list($idx = 0, $data = array())
 {
     #	exit('erere');
     switch ($idx) {
         case 0:
             switch ($data['level']) {
                 #fetching Archived BEBs
                 case 'archive':
                     # code...
                     $userid = $this->session->userdata['userid'];
                     $pde = mysql_query("select * from  users where userid =" . $userid);
                     $q = mysql_fetch_array($pde);
                     #$query = $this->Query_reader->get_query_by_code('view_bebs',  array('SEARCHSTRING' => ' and 1 and 1    and bidinvitations.procurement_id   in ( select procurement_ref_id FROM contracts  ) 	and users.userid = '.$userid.' ORDER BY bestevaluatedbidder.dateadded DESC','limittext'=>'limit 10' ));
                     #print_r($query); exit();
                     if ($this->session->userdata('isadmin') == 'N') {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1 and bidinvitations.procurement_id  in ( select procurement_ref_id FROM contracts  )	and users.userid = ' . $userid . ' ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     } else {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1 and bidinvitations.procurement_id  in ( select procurement_ref_id FROM contracts  )	 ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     }
                     break;
                     #fetch active BEBs
                 #fetch active BEBs
                 case 'active':
                     $userid = $this->session->userdata['userid'];
                     $pde = mysql_query("select * from  users where userid =" . $userid);
                     $q = mysql_fetch_array($pde);
                     #$query = $this->Query_reader->get_query_by_code('view_bebs',  array('SEARCHSTRING' => ' and 1 and 1    and bidinvitations.procurement_id not in ( select procurement_ref_id FROM contracts  ) 	and users.userid = '.$userid.' ORDER BY bestevaluatedbidder.dateadded DESC','limittext'=>10 ));
                     #print_r($query); exit();
                     if ($this->session->userdata('isadmin') == 'N') {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1    and bidinvitations.procurement_id not in ( select procurement_ref_id FROM contracts  ) 	and users.userid = ' . $userid . ' ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     } else {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1    and bidinvitations.procurement_id not in ( select procurement_ref_id FROM contracts  ) 	  ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     }
                     break;
                 default:
                     $userid = $this->session->userdata['userid'];
                     $pde = mysql_query("select * from  users where userid =" . $userid);
                     $q = mysql_fetch_array($pde);
                     if ($this->session->userdata('isadmin') == 'N') {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1  and bidinvitations.procurement_id not in ( select procurement_ref_id FROM contracts  ) and 	users.userid = ' . $userid . ' ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     } else {
                         $result = paginate_list($this, $data, 'view_bebs', array('SEARCHSTRING' => ' and 1 and 1  and bidinvitations.procurement_id not in ( select procurement_ref_id FROM contracts  )  ORDER BY bestevaluatedbidder.dateadded DESC'), 10);
                         return $result;
                     }
                     break;
             }
             break;
         default:
             # code...
             break;
     }
 }
Esempio n. 10
0
 function save_borrower_form()
 {
     access_control($this);
     $schooldetails = $this->session->userdata('schoolinfo');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     if (!empty($data['i'])) {
         $editid = decryptValue($data['i']);
         $data['formdata'] = $this->Query_reader->get_row_as_array('get_borrower_by_id', array('id' => $editid));
         $data['formdata']['search'] = $data['formdata']['firstname'] . " " . $data['formdata']['middlename'] . " " . $data['formdata']['lastname'];
     }
     // var_dump($data);
     #####comment out.. use model values
     #Get the Item details
     $stockid = decryptValue($data['s']);
     #$stockid = $data['s'];
     $data['stockdata'] = $this->Query_reader->get_row_as_array('get_stock_by_id', array('id' => $stockid));
     #Get the Item details
     #Check if the user is simply viewing the deal
     #TODO: Add the force-users-without-other-permissions-to-view condition
     if (!empty($data['a']) && decryptValue($data['a']) == 'view') {
         $data['isview'] = "Y";
     }
     if ($this->input->post('saveborrower')) {
         $required_fields = array('name', 'type', 'dateborrowed', 'taken', 'libraryid');
         $_POST = clean_form_data($_POST);
         $validation_results = validate_form('', $_POST, $required_fields);
         $borrowerperiod = validate_borrower_period($_POST['dateborrowed'], $_POST['datereturned']);
         if ($validation_results['bool'] && $borrowerperiod == "") {
             $_POST['copiestaken'] = sizeof($_POST['items']);
             if (!empty($data['formdata']) && !empty($data['i'])) {
                 $save_result = $this->db->query($this->Query_reader->get_query_by_code('update_borrower', array_merge($_POST, array('id' => $editid))));
             } else {
                 // echo($this->Query_reader->get_query_by_code('add_borrower', array_merge($_POST, array('school' => $schooldetails['id'], 'createdby'=>$this->session->userdata('userid'))) ));
                 // exit();
                 $save_result = $this->db->query($this->Query_reader->get_query_by_code('add_borrower', array_merge($_POST, array('school' => $schooldetails['id'], 'createdby' => $this->session->userdata('userid')))));
             }
             if ($save_result) {
                 $borrowerid = $this->db->insert_id();
                 for ($i = 0; $i < sizeof($_POST['items']); $i++) {
                     $save_result2 = $this->db->query($this->Query_reader->get_query_by_code('add_borroweditems', array('borrower' => $borrowerid, 'item' => $_POST['items'][$i])));
                     $updateitem = $this->db->query($this->Query_reader->get_query_by_code('update_item_borrowed', array('id' => $_POST['items'][$i], 'isavailable' => 0)));
                 }
                 if ($save_result2 && $updateitem) {
                     $data['msg'] = "The borrower has been saved.";
                     #die($data['msg']);
                     $this->session->set_userdata('sres', $data['msg']);
                     redirect(base_url() . "library/manage_borrowers/m/sres");
                 } else {
                     $data['msg'] = "ERROR: The borrower was not saved. Please contact your administrator.";
                 }
             } else {
                 $data['msg'] = "ERROR: The borrower was not saved. Please contact your administrator.";
                 #die($data['msg']);
             }
         }
         #Validation
         if ((empty($validation_results['bool']) || !empty($validation_results['bool']) && !$validation_results['bool']) && empty($data['msg'])) {
             $data['msg'] = "WARNING: The highlighted fields are required.";
         }
         if ($borrowerperiod != "") {
             $data['msg'] = "WARNING: " . $borrowerperiod;
         }
         $data['requiredfields'] = $validation_results['requiredfields'];
         $data['formdata'] = $_POST;
     }
     if (!empty($data['a']) && decryptValue($data['a']) == 'view') {
         $data = paginate_list($this, $data, 'get_borrowed_items', array('isactive' => 'Y', 'searchstring' => ' AND b.borrower = ' . $data['formdata']['id']));
         $data['isviewing'] = TRUE;
         $data['area'] = 'borrower_details';
         $this->load->view('incl/addons', $data);
     } else {
         $this->load->view('library/new_borrower', $data);
     }
     $data['students'] = $this->librarymodel->get_students();
 }
Esempio n. 11
0
 function manage_user_groups()
 {
     access_control($this, array('admin'));
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the paginated list of users
     $data = paginate_list($this, $data, 'get_user_group_list', array('searchstring' => 'UG.isactive ="Y"', 'orderby' => 'ORDER BY UG.groupname ASC'));
     $data = handle_redirected_msgs($this, $data);
     $data = add_msg_if_any($this, $data);
     $data['page_title'] = 'Manage user groups';
     $data['current_menu'] = 'view_user_groups';
     $data['view_to_load'] = 'users/manage_user_groups_v';
     $data['search_url'] = 'admin/search_user_groups';
     $data['form_title'] = $data['page_title'];
     $this->load->view('dashboard_v', $data);
 }
Esempio n. 12
0
 function generate_report()
 {
     access_control($this);
     $schooldetails = $this->session->userdata('schoolinfo');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     if ($this->input->post('generatepdf') || $this->input->post('generateexcel')) {
         $required_fields = array('type');
         $_POST = clean_form_data($_POST);
         $validation_results = validate_form('', $_POST, $required_fields);
         if ($validation_results['bool']) {
             $_POST = clean_form_data($_POST);
             $searchstring = '1';
             if ($_POST['type'] == 1) {
                 if (isset($_POST['datefrom']) && isset($_POST['dateto']) && $_POST['datefrom'] != "" && $_POST['dateto'] != "") {
                     $searchstring .= " AND  UNIX_TIMESTAMP(i.datecreated) <= '" . strtotime($_POST['dateto'] . ' 23:59:59') . "' AND UNIX_TIMESTAMP(i.datecreated) >= '" . strtotime($_POST['datefrom']) . "'";
                 }
                 if (isset($_POST['item']) && $_POST['item'] != "") {
                     $searchstring .= " AND i.itemid=" . $_POST['item'];
                 }
                 $querycode = 'get_inventory_list';
                 $data['dateto'] = $_POST['dateto'];
                 $data['datefrom'] = $_POST['datefrom'];
                 #Get the paginated list of the purchases
                 $data = paginate_list($this, $data, $querycode, array('isactive' => 'Y', 'searchstring' => ' i.school = ' . $schooldetails['id'] . ' AND (' . $searchstring . ')'));
                 $report_type = 'purchases_report';
                 $report_name = "PURCHASES REPORT";
                 if ($this->input->post('generateexcel')) {
                     $size = sizeof($data['page_list']);
                     $maxdate = date("j M, Y", GetTimeStamp($data['page_list'][$size - 1]['datecreated']));
                     $mindate = date("j M, Y", GetTimeStamp($data['page_list'][0]['datecreated']));
                     if (!empty($data['datefrom'])) {
                         $from = date("j M, Y", GetTimeStamp($data['datefrom']));
                     } else {
                         $from = $maxdate;
                     }
                     if (!empty($data['dateto'])) {
                         $to = date("j M, Y", GetTimeStamp($data['dateto']));
                     } else {
                         $to = $mindate;
                     }
                     $mydata = array($schooldetails['schoolname']);
                     $this->excelexport->addRow($mydata);
                     $mydata = array($report_name, "", "", "From :", $from, "", "", "To :", $to);
                     $this->excelexport->addRow($mydata);
                     $mydata = array("Date", "Item Name", "Supplier", "Invoice Number", "Quanity", "Price");
                     $this->excelexport->addRow($mydata);
                     $sum = 0;
                     foreach ($data['page_list'] as $row) {
                         $price = $row['price'] * $row['quantity'];
                         $sum += $price;
                         $mydata = array(date("j M, Y", GetTimeStamp($row['datecreated'])), $row['itemname'], $row['supplier'], $row['invoicenumber'], $row['quantity'], number_format($price, 0, '.', ','));
                         $this->excelexport->addRow($mydata);
                     }
                     $mydata = array("Total", "", "", "", "", number_format($sum, 0, '.', ','));
                     $this->excelexport->addRow($mydata);
                 }
             } elseif ($_POST['type'] == 3) {
                 if (isset($_POST['datefrom']) && isset($_POST['dateto']) && $_POST['datefrom'] != "" && $_POST['dateto'] != "") {
                     $searchstring .= " AND  UNIX_TIMESTAMP(i.datecreated) <= '" . strtotime($_POST['dateto'] . ' 23:59:59') . "' AND UNIX_TIMESTAMP(i.datecreated) >= '" . strtotime($_POST['datefrom']) . "'";
                 }
                 if (isset($_POST['item']) && $_POST['item'] != "") {
                     $searchstring .= " AND i.itemid=" . $_POST['item'];
                 }
                 $querycode = 'get_inventory_list';
                 $data['dateto'] = $_POST['dateto'];
                 $data['datefrom'] = $_POST['datefrom'];
                 #Get the paginated list of the deals
                 $data = paginate_list($this, $data, 'get_transaction_list', array('isactive' => 'Y', 'searchstring' => ' t.school = ' . $schooldetails['id'] . ' AND (' . $searchstring . ')'));
                 $report_type = 'issuing_report';
                 $report_name = "ISSUING REPORT";
                 if ($this->input->post('generateexcel')) {
                     $size = sizeof($data['page_list']);
                     $maxdate = date("j M, Y", GetTimeStamp($data['page_list'][$size - 1]['dateadded']));
                     $mindate = date("j M, Y", GetTimeStamp($data['page_list'][0]['dateadded']));
                     if (!empty($data['datefrom'])) {
                         $from = date("j M, Y", GetTimeStamp($data['datefrom']));
                     } else {
                         $from = $maxdate;
                     }
                     if (!empty($data['dateto'])) {
                         $to = date("j M, Y", GetTimeStamp($data['dateto']));
                     } else {
                         $to = $mindate;
                     }
                     $mydata = array($schooldetails['schoolname']);
                     $this->excelexport->addRow($mydata);
                     $mydata = array($report_name, "", "", "From :", $from, "", "", "To :", $to);
                     $this->excelexport->addRow($mydata);
                     $mydata = array("Date", "Item Name", "Quantity", "Issued To");
                     $this->excelexport->addRow($mydata);
                     foreach ($data['page_list'] as $row) {
                         $mydata = array(date("j M, Y", GetTimeStamp($row['dateadded'])), $row['itemname'], $row['quantity'], $row['firstname'] . " " . $row['lastname']);
                         $this->excelexport->addRow($mydata);
                     }
                 }
             } elseif ($_POST['type'] == 2) {
                 #Get the paginated list of the inventory
                 $data = paginate_list($this, $data, 'get_item_list', array('isactive' => 'Y', 'searchstring' => ' school = ' . $schooldetails['id']));
                 $report_type = 'inventory_report';
                 $report_name = "INVENTORY REPORT";
                 if ($this->input->post('generateexcel')) {
                     $mydata = array($schooldetails['schoolname']);
                     $this->excelexport->addRow($mydata);
                     $mydata = array($report_name, "", "", "", date("j M, Y", time()));
                     $this->excelexport->addRow($mydata);
                     $mydata = array("Item Name", "In", "Out", "Stocked", "Units");
                     $this->excelexport->addRow($mydata);
                     foreach ($data['page_list'] as $row) {
                         $stocked = get_stocked($this, $row['id']);
                         $sold = get_sold($this, $row['id']);
                         $remaining = $stocked - $sold;
                         #Assign zeros to empty values
                         if (empty($stocked)) {
                             $stocked = 0;
                         }
                         if (empty($sold)) {
                             $sold = 0;
                         }
                         $mydata = array($row['itemname'], $remaining, $sold, $stocked, $row['unitspecification']);
                         $this->excelexport->addRow($mydata);
                     }
                 }
             }
             #Format the statement
             $report_html = '';
             #$financial_details = array();
             $this->load->library('parser');
             $data['schoolname'] = $schooldetails['schoolname'];
             $data['report_html'] = $report_html;
             $output = $this->parser->parse('reports/' . $report_type, $data, true);
             if ($this->input->post('generatepdf')) {
                 gen_pdf($this, $output);
             } else {
                 $this->excelexport->download($report_type . '.xls');
             }
         }
         if ((empty($validation_results['bool']) || !empty($validation_results['bool']) && !$validation_results['bool']) && empty($data['msg'])) {
             $data['msg'] = "WARNING: The highlighted fields are required.";
         }
         $data['requiredfields'] = $validation_results['requiredfields'];
         $data['formdata'] = $_POST;
     }
     $this->load->view('inventory/new_report_view');
 }
Esempio n. 13
0
 function page_list()
 {
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 's'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = paginate_list($this, $data, 'get_page_list', array('searchstring' => ''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('wiki/page_list_view', $data);
 }
Esempio n. 14
0
 function fetch_beb_list($idx = 0, $data = array())
 {
     switch ($idx) {
         case 0:
             $userid = $this->session->userdata['userid'];
             $pde = mysql_query("select * from  users where userid =" . $userid);
             $q = mysql_fetch_array($pde);
             $result = paginate_list($this, $data, 'view_disposal_bebs', array('SEARCHSTRING' => '  1 and 1 and 	users.userid = ' . $userid . ' '), 200);
             #$query = $this->Query_reader->get_query_by_code('view_disposal_bebs', array('SEARCHSTRING' => '  1 and 1 and 	users.userid = '.$userid.' ORDER BY bestevaluatedbidder.dateadded DESC ' ,'limittext' => ' '));
             #print_r($query); exit();
             #$result = $this->db->query($query)->result_array();
             return $result;
             return $result;
             break;
         default:
             # code...
             break;
     }
 }
Esempio n. 15
0
 function get_invitation_response()
 {
     access_control($this, array('admin'));
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = paginate_list($this, $data, 'get_inv_response_list', array('isactive' => 'Y', 'searchstring' => ''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('deals/invitation_response_view', $data);
 }
Esempio n. 16
0
 function search_bid_invitations()
 {
     check_user_access($this, 'view_bid_invitations', 'redirect');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'p'));
     # Pick all assigned data
     $data = @assign_to_data($urldata);
     $search_string = '';
     if ($this->session->userdata('isadmin') == 'N') {
         $userdata = $this->db->get_where('users', array('userid' => $this->session->userdata('userid')))->result_array();
         $search_string = ' AND procurement_plans.pde_id="' . $userdata[0]['pde'] . '"';
     }
     if ($this->input->post('searchQuery')) {
         $_POST = clean_form_data($_POST);
         $_POST['searchQuery'] = trim($_POST['searchQuery']);
         $search_string .= ' AND (procurement_plan_entries.procurement_ref_no like "%' . $_POST['searchQuery'] . '%" OR procurement_plan_entries.subject_of_procurement like "%' . $_POST['searchQuery'] . '%" ' . 'OR bidinvitations.bid_security_amount like "%' . $_POST['searchQuery'] . '%" ' . 'OR pdes.pdename like "%' . $_POST['searchQuery'] . '%" ' . 'OR users.firstname like "%' . $_POST['searchQuery'] . '%" OR ' . 'users.lastname like "%' . $_POST['searchQuery'] . '%") ';
         $data = paginate_list($this, $data, 'bid_invitation_details', array('orderby' => 'bid_dateadded DESC', 'searchstring' => 'bidinvitations.isactive = "Y" ' . $search_string));
     } else {
         $data = paginate_list($this, $data, 'bid_invitation_details', array('orderby' => 'bid_dateadded DESC', 'searchstring' => 'bidinvitations.isactive = "Y" ' . $search_string));
     }
     $data['area'] = 'bid_invitations';
     $this->load->view('includes/add_ons', $data);
 }
Esempio n. 17
0
 function manage_disposal_contracts($idx = 0, $data = array())
 {
     switch ($idx) {
         case 0:
             $userid = $this->session->userdata['userid'];
             $pde = mysql_query("select * from  users where userid =" . $userid);
             $q = mysql_fetch_array($pde);
             $query = $this->Query_reader->get_query_by_code('manage_disposal_contracts', array('SEARCHSTRING' => ' AND  E.pde_id = ' . $q['pde'] . ' ', 'limittext' => ' '));
             # print_r($query); exit();
             $result = paginate_list($this, $data, 'manage_disposal_contracts', array('SEARCHSTRING' => ' AND  E.pde_id = ' . $q['pde'] . ' '), 200);
             #$result = $this->db->query($query)->result_array();
             return $result;
             return $result;
             break;
             # view_disposal_contracts
             #view_disposal_contracts
         # view_disposal_contracts
         #view_disposal_contracts
         default:
             # code...
             break;
     }
 }
Esempio n. 18
0
 function search_pdetypes($s, $data, $search)
 {
     $search_string = 'and ( pdetypes.pdetype  like "%' . $search . '%")';
     $result = paginate_list($this, $data, 'fetchpdetypes', array('STATUS' => '', 'orderby' => ' ORDER BY pdetypeid ', 'searchstring' => $search_string), 200);
     return $result;
 }
Esempio n. 19
0
 function search_pdes($s, $data, $search)
 {
     $search_string = 'and ( pdes.pdename   like "%' . $search . '%" OR pdes.abbreviation like "%' . $search . '%" OR  pdes.code like "%' . $search . '%")';
     $result = paginate_list($this, $data, 'fetchpdes', array('STATUS' => '', 'orderby' => ' ORDER BY create_date ', 'searchstring' => $search_string), 200);
     return $result;
 }
Esempio n. 20
0
 function manage_exams()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the paginated list of the students
     $data = paginate_list($this, $data, 'search_exams', array('searchstring' => ' AND isactive = "Y" AND school = ' . $this->myschool['id']));
     $data = add_msg_if_any($this, $data);
     $this->load->view('exams/manage_exams_view', $data);
 }
Esempio n. 21
0
 function fetchbeb($data, $searchstring = '')
 {
     # and bestevaluatedbidder.ispublished = "Y"  and  receipts.beb="Y" order by bestevaluatedbidder.dateadded DESC
     /*$query = $this->Query_reader->get_query_by_code('fetchbebs', array('SEARCHSTRING' => $searchstring.' and bestevaluatedbidder.ispublished = "Y"  and  receipts.beb="Y" order by bestevaluatedbidder.dateadded DESC','limittext' => '' ));
     	 print_r($query); exit(); */
     $result = paginate_list($this, $data, 'fetchbebs', array('SEARCHSTRING' => $searchstring . ' and bestevaluatedbidder.ispublished = "Y"  and  receipts.beb="Y" order by bestevaluatedbidder.dateadded DESC'), 10);
     return $result;
     $issactive = "Y";
     $result = paginate_list($this, $data, 'fetchbebs', array('SEARCHSTRING' => 'and bestevaluatedbidder.ispublished = "Y"  and  receipts.beb="Y" order by bestevaluatedbidder.dateadded DESC'), 1);
     return $result;
 }
Esempio n. 22
0
 function search_awarded_contracts()
 {
     $urldata = $this->uri->uri_to_assoc(3, array('m'));
     #Pick all assigned data
     $data = assign_to_data($urldata);
     $searchstring = '';
     if (!empty($_POST)) {
         #    $searchstring = '1 = 1';
         if (!empty($_POST['procurement_entity']) && $_POST['procurement_entity'] > 0) {
             $searchstring .= ' AND  pdes.pdeid =' . mysql_real_escape_string($_POST['procurement_entity']);
         }
         if (!empty($_POST['procurement_type']) && $_POST['procurement_type'] > 0) {
             $searchstring .= ' AND PPE.procurement_type =' . mysql_real_escape_string($_POST['procurement_type']);
         }
         if (!empty($_POST['procurement_method']) && $_POST['procurement_method'] > 0) {
             $searchstring .= ' AND PPE.procurement_method =' . mysql_real_escape_string($_POST['procurement_method']);
         }
         if (!empty($_POST['sourceof_funding']) && $_POST['sourceof_funding'] > 0) {
             $searchstring .= ' AND PPE.funding_source =' . mysql_real_escape_string($_POST['sourceof_funding']);
         }
         if (!empty($_POST['subjectof_procurement'])) {
             $subject_of_procurement = mysql_real_escape_string($_POST['subjectof_procurement']);
             $searchstring .= ' AND  PPE.subject_of_procurement like "%' . $subject_of_procurement . '%" ';
         }
         if (!empty($_POST['financial_year'])) {
             $financial_year = mysql_real_escape_string($_POST['financial_year']);
             $searchstring .= ' AND  PP.financial_year like "%' . $financial_year . '%" ';
         }
         if (!empty($_POST['service_providers'])) {
             $contract_providers = mysql_real_escape_string($_POST['service_providers']);
             $searchstring .= ' AND providernames LIKE "%' . $contract_providers . '%"';
         }
         if (!empty($_POST['contracts_status'])) {
             switch ($_POST['contracts_status']) {
                 case 'A':
                     $searchstring .= ' AND actual_completion_date IS NULL OR actual_completion_date = " "';
                     break;
                 case 'C':
                     $searchstring .= ' AND actual_completion_date != " " OR actual_completion_date IS NOT NULL';
                     break;
             }
         }
     }
     $this->session->set_userdata('searchengineA', $searchstring);
     #$query = $this->Query_reader->get_query_by_code('get_published_contracts',  array('orderby' => 'date_signed DESC', 'searchstring' => $searchstring,'limittext'=>''));
     # print_r($query); exit();
     $data = paginate_list($this, $data, 'get_published_contracts', array('orderby' => 'date_signed DESC', 'searchstring' => $searchstring), 10);
     $data['view_to_load'] = 'public/includes/awarded_contracts';
     $data['current_menu'] = 'awarded_contracts';
     $this->load->view('public/includes/search_awarded_contracts', $data);
 }
Esempio n. 23
0
 function manage()
 {
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 's'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = paginate_list($this, $data, 'get_image_list', array('searchstring' => ' AND isshown=\'Y\''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('photo/manage_photos_view', $data);
 }
Esempio n. 24
0
 function notifyrop($bidinvitation)
 {
     $bidinvitation = $bidinvitation;
     #################################################
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(2, array('m', 'p'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = add_msg_if_any($this, $data);
     #print_r($data); exit();
     $data = handle_redirected_msgs($this, $data);
     $search_str = '';
     $level = $status = $this->uri->segment(3);
     $data['level'] = $level;
     $search_str = ' AND bidinvitations.id="' . $bidinvitation . '"';
     $records = paginate_list($this, $data, 'bid_invitation_details', array('orderby' => 'bid_dateadded DESC', 'searchstring' => 'bidinvitations.isactive = "Y"  AND bidinvitations.id not in (SELECT bid_id FROM receipts INNER JOIN bidinvitations ON receipts.bid_id =  bidinvitations.id  INNER JOIN bestevaluatedbidder
   ON receipts.receiptid = bestevaluatedbidder.pid  WHERE receipts.beb="Y" ) ' . $search_str), 10);
     #bid invitation details
     $recorded_data = $records['page_list'][0];
     #procurement type::
     $procurementType = $recorded_data['procurement_type'];
     if ($procurementType == 'Non consultancy services' || $procurementType == 'Consultancy Services') {
         $procurementType = "Services";
     }
     #connect to ROP to fetch providers with that procurement method.
     $this->load->model('Remoteapi_m');
     $emaillist = $this->Remoteapi_m->emaillist_providers($procurementType);
     #  print_r($recorded_data);
     $str = '<table>' . '<tr> <th colspan="2"><h2> RE: BID INVITATION </h2> </th> </tr>' . '<tr> <th> PROCUREMENT AND DISPOSING ENTITY </th> <td>' . $recorded_data['pdename'] . '<td> </tr>' . '<tr> <th> FINANCIAL YEAR </th> <td>' . $recorded_data['financial_year'] . '<td> </tr>' . '<tr> <th> PROCUREMENT REFERENCE NUMBER </th> <td>' . $recorded_data['procurement_ref_no'] . '<td> </tr>' . '<tr> <th> SUBJECT OF PROCUREMENT </th> <td>' . $recorded_data['subject_of_procurement'] . '<td> </tr>' . '<tr> <th> PROCUREMENT TYPE </th> <td>' . $recorded_data['procurement_type'] . '<td> </tr>' . '<tr> <th> PROCUREMENT METHOD </th> <td>' . $recorded_data['procurement_method'] . '<td> </tr>' . '<tr> <th> SOURCE OF FUNDING </th> <td>' . $recorded_data['funding_source'] . '<td> </tr>' . '<tr> <th>BID SUBMISSION DEADLINE </th> <td>' . date('m -d,Y', strtotime($recorded_data['bid_submission_deadline'])) . '<td> </tr>' . '</table>' . ' NOTE : <BR/>' . ' FOR MORE INFORMATION : ';
     $strbody = html_entity_decode($str);
     #  $this->load->library('email');
     echo "sending starts <br/> <br/>";
     echo "<ul>";
     while ($row = mysqli_fetch_array($emaillist)) {
         $this->email->from('*****@*****.**', 'Tender Portal Notifications');
         $this->email->to('' . $row['email'] . '');
         //   $this->email->cc('*****@*****.**');
         #$this->email->bcc('*****@*****.**');
         $this->email->subject('RE: BID INVITATION');
         $this->email->message('' . $strbody . '');
         $this->email->send();
         echo "<li>" . $row['email'] . "</li>";
     }
     echo "</ul><br/><br/>Sending Finished";
     #fetch data about these guys
     ## fetch records ###
     # print_r($records['page_list'][0]);
     ##################################################
     # end
 }
Esempio n. 25
0
 function manage_help()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('s', 'i'));
     # Pick all assigned data
     $data = restore_bad_chars_in_array(assign_to_data($urldata));
     #Get the paginated list of the help items
     $data = paginate_list($this, $data, 'get_help_list', array('searchstring' => ''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('help/manage_help_view', $data);
 }
Esempio n. 26
0
 function manage_incidents()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $student_id = !empty($data['i']) ? decryptValue($data['i']) : '';
     #get the student info
     $data['student_details'] = $this->Query_reader->get_row_as_array('get_students_list', array('isactive' => 'Y', 'searchstring' => ' AND id=\'' . $student_id . '\'', 'limittext' => ''));
     #Get the paginated list of incidents
     $data = paginate_list($this, $data, 'search_discipline', array('isactive' => 'Y', 'searchstring' => (!empty($student_id) ? ' students.id=\'' . $student_id . '\'' : '1=1') . '  ORDER BY incidentdate DESC', 'school' => '\'' . $this->myschool['id'] . '\''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('discipline/manage_incidents_view', $data);
 }
Esempio n. 27
0
 function manage_miscelleneous()
 {
     access_control($this);
     $schooldetails = $this->session->userdata('schoolinfo');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the paginated list of the deals
     $data = paginate_list($this, $data, 'get_miscelleneous_list', array('isactive' => 'Y', 'searchstring' => '1'));
     $data = add_msg_if_any($this, $data);
     $this->load->view('students/manage_miscelleneous_view', $data);
 }
Esempio n. 28
0
 function report_list()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i', 'up'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $isactive = !empty($data['t']) && decryptValue($data['t']) == 'archive' ? 'N' : 'Y';
     #Get the paginated list of the reports
     $data = paginate_list($this, $data, 'get_user_report_list', array('userid' => $this->session->userdata('userid'), 'isactive' => $isactive, 'searchstring' => ''));
     $data = add_msg_if_any($this, $data);
     $this->load->view('reports/user_report_list_view', $data);
 }
Esempio n. 29
0
 function manage_staff()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the paginated list of users
     $data = paginate_list($this, $data, 'search_school_users', array('limittext' => '', 'searchstring' => ' AND school =' . $this->myschool['id']));
     $data = add_msg_if_any($this, $data);
     $data = handle_redirected_msgs($this, $data);
     $this->load->view('user/manage_staff_view', $data);
 }
Esempio n. 30
0
 function manage_documents()
 {
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'a'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $section_result = $this->db->query($this->Query_reader->get_query_by_code('get_document_sections', array()));
     $sections = array();
     foreach ($section_result->result_array() as $row) {
         array_push($sections, $row['value']);
     }
     $data = paginate_list($this, $data, 'get_documents_list', array('sections' => "'" . implode("','", $sections) . "'"));
     $data = add_msg_if_any($this, $data);
     $this->load->view('documents/documents_list_view', $data);
 }