</th> </tr> </thead> <tbody> <?php if (!empty($formdata['contract_amount'])) { foreach ($formdata['contract_amount'] as $contract_amount) { if (is_array($contract_amount)) { $contract_amount_arr[0] = $contract_amount['amount']; $contract_amount_arr[1] = $contract_amount['currency_id']; $contract_amount_arr[2] = $contract_amount['xrate']; $contract_amount_arr[3] = $contract_amount['title']; } else { $contract_amount_arr = explode('__', $contract_amount); } print '<tr>' . '<td style="text-align:center">' . '<a title="Click to remove" href="javascript:void(0);">' . '<i class="fa fa-remove"></i></a>' . '<input type="hidden" name="contract_amount[]" value="' . $contract_amount_arr[0] . '__' . $contract_amount_arr[1] . '__' . $contract_amount_arr[2] . '__' . $contract_amount_arr[3] . '" />' . '</td>' . '<td>' . addCommas($contract_amount_arr[0], 0) . '</td>' . '<td class="hidden-phone" style="font-size:11px"><strong>' . $contract_amount_arr[3] . '</strong></td>' . '<td class="right-align-text hidden-phone">' . '<input type="hidden" class="curId" value="' . $contract_amount_arr[1] . '" />' . '<span class"number">' . addCommas($contract_amount_arr[2], 0) . '</span></td>' . '<td style="text-align:right" class="right-align-text hidden-phone">' . '<span class"number">' . addCommas(removeCommas($contract_amount_arr[0]) * removeCommas($contract_amount_arr[2]), 0) . '</span>' . '</td></tr>'; } } ?> </tbody> </table> </div> </div> <div class="form-actions"> <button type="submit" name="save" value="save" class="btn blue"><i class="fa fa-ok"></i> Save</button> <button type="reset" name="cancel" value="cancel" class="btn"><i class="fa fa-remove"></i> Cancel</button> </div>
function addCommas($number, $no_decimal_places = 2) { if (!isset($number) || $number == "" || $number <= 0) { return number_format('0.00', $no_decimal_places, '.', ','); } else { return number_format(removeCommas($number), $no_decimal_places, '.', ','); } }
} else { $table_HTML .= "<table cellpadding='5' cellspacing='0' border='0'>\r\r\n\t\t\t<tr><td><b>Top " . NUM_OF_ROWS_PER_PAGE . " Search Results:</b></td><td align='right'><a href='javascript:void(0)' onClick=\"hideLayerSet('" . $layer . "')\"><img src='" . base_url() . "images/delete_icon.png' border='0' /></a></td></tr></table>" . format_notice("No sector meets search."); } } else { if (!empty($area) && $area == 'nav_amt_details') { $table_HTML .= $combined_js_HTML . $combined_css_HTML; if ((!empty($unfunded) || $unfunded == 0) && !empty($fundedamount)) { $table_HTML .= "<b>Unfunded Amount:</b> \$" . addCommas($unfunded) . " NAV: \$" . addCommas(removeCommas(restore_bad_chars($fundedamount))); } else { $table_HTML .= format_notice("<span class='error'>Invalid Commitment or funded amount.</span>"); } } else { if (!empty($area) && $area == 'called_amt_details') { $table_HTML .= $combined_js_HTML . $combined_css_HTML; if ((!empty($uncalled) || $uncalled == 0) && !empty($dealamount) && $uncalled >= 0) { $perc = addCommas($uncalled / removeCommas($dealamount) * 100); $table_HTML .= "<b>Uncalled Amount:</b> \$" . addCommas($uncalled) . " (" . $perc . "%)"; } else { $table_HTML .= format_notice("<span class='error'>Invalid called or commitment amount.</span>"); } } else { if (!empty($area) && $area == 'new_section_details') { $table_HTML .= $combined_js_HTML . $combined_css_HTML; if (!empty($a) && decryptValue($a) == 'add') { $table_HTML .= format_notice("New section added") . "<select name='fileunder' id='fileunder' class='selectfield' onchange=\"showWithValue('fileunder', 'addbtn', 'addfields')\">"; $section_list = $this->db->query($this->Query_reader->get_query_by_code('search_file_under', array('searchstring' => ''))); $options = $section_list->result_array(); $selected = restore_bad_chars($sectionname); $options = array_merge(array(array('fileunder' => $selected)), $options); $table_HTML .= get_select_options($options, 'fileunder', 'fileunder', ''); $table_HTML .= "</select>";
function show_nav_details() { 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); if (!empty($data['fundedamount']) && !empty($data['commitmentamount'])) { $fundedamount = removeCommas(restore_bad_chars($data['fundedamount'])); $commitmentamount = removeCommas(restore_bad_chars($data['commitmentamount'])); $fundedamt = !empty($fundedamount) ? $fundedamount : 0; $commitmentamt = !empty($commitmentamount) ? $commitmentamount : 0; } if (!empty($fundedamt) && !empty($commitmentamt)) { $data['unfunded'] = $commitmentamt - $fundedamt; } $data['area'] = "nav_amt_details"; $data = add_msg_if_any($this, $data); $this->load->view('incl/addons', $data); }
function save_bid_invitation() { # 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 = add_msg_if_any($this, $data); #check user access #1: for editing if (!empty($data['i'])) { check_user_access($this, 'edit_bid_invitation', 'redirect'); } else { check_user_access($this, 'create_invitation_for_bids', 'redirect'); } if (!empty($_POST['save']) || !empty($_POST['approve'])) { $required_fields = array('procurement_id', 'invitation_to_bid_date', 'pre_bid_meeting_date', 'bid_submission_deadline', 'display_of_beb_notice', 'bid_receipt_address', 'documents_inspection_address', 'documents_address_issue', 'bid_openning_address', 'bid_openning_date', 'bid_evaluation_from', 'bid_evaluation_to', 'display_of_beb_notice', 'contract_award_date', 'initiated_by', 'vote_no', 'date_initiated', 'dateofconfirmationbyao', 'sequencenumber', 'procurement_details_quantity', 'quantityifb'); # $query = mysql_query("SELECT * FROM procurement_plan_entries WHERE id='".$_POST['procurement_id']."' limit 1 ") ; # $reslt = mysql_fetch_array($query); #$total_procurement_quantity = $reslt['total_ifb_quantity']; #$procurement_quantity = $reslt['quantity']; #print_r($_POST); exit(); $_POST = clean_form_data($_POST); $validation_results = validate_form('', $_POST, $required_fields); $bid_validation_results = $this->validate_ifb_form($_POST); $data['procurement_details_quantity'] = $_POST['procurement_details_quantity']; /* validation for procurement format */ #exit(); /* end */ $_POST['procurement_ref_no'] = $_POST['sequencenumber'] . $_POST['procurement_ref_no']; #Only proceed if the validation for required fields passes if ($validation_results['bool'] && $bid_validation_results['result']) { #check if an active bid invitation already exists for selected procurement ref no $similar_bid_invitation = $this->db->query($this->Query_reader->get_query_by_code('search_bidinvitation', array('orderby' => 'A.procurement_ref_no', 'limittext' => '', 'searchstring' => ' A.procurement_id = "' . $_POST['procurement_id'] . '" AND B.total_ifb_quantity >= B.quantity AND A.isactive="Y"' . (!empty($data['i']) ? ' AND A.id !="' . decryptValue($data['i']) . '"' : ''))))->result_array(); if (!empty($similar_bid_invitation)) { $data['msg'] = "WARNING: A bid invitation for the selected procurement reference number already exists."; } else { #format time dependent dates #1. bid_submission_deadline_time if (!empty($_POST['bid_submission_deadline_time'])) { $_POST['bid_submission_deadline'] = $_POST['bid_submission_deadline'] . ' ' . date("H:i", strtotime($_POST['bid_submission_deadline_time'])) . ':00'; } #2. bid_submission_deadline_time if (!empty($_POST['bid_openning_date_time'])) { $_POST['bid_openning_date'] = $_POST['bid_openning_date'] . ' ' . date("H:i", strtotime($_POST['bid_openning_date_time'])) . ':00'; } #3. pre_bid_meeting_date_time if (!empty($_POST['pre_bid_meeting_date_time'])) { $_POST['pre_bid_meeting_date'] = $_POST['pre_bid_meeting_date'] . ' ' . date("H:i", strtotime($_POST['pre_bid_meeting_date_time'])) . ':00'; } #4, bid validity finding:: if (!empty($_POST['hasbidvalididy']) && $_POST['hasbidvalididy'] == 'y') { $_POST['validity'] = removeCommas($_POST['hasbidvalididy']); $_POST['validityperiod'] = date('Y-m-d', strtotime($_POST['bidvalidtity'])); } #print_r($_POST); $_POST['bid_documents_price'] = removeCommas($_POST['bid_documents_price']); $_POST['bid_security_amount'] = removeCommas($_POST['bid_security_amount']); #$_POST['dateofconfirmationbyao'] = date('Y-m-d',$_POST['dateofconfirmationbyao']); #$_POST['procurement_ref_no'] = $_POST['sequencenumber'].$_POST['procurement_ref_no']; $query = $this->db->query("SELECT * FROM procurement_plan_entries WHERE id='" . $_POST['procurement_id'] . "' ")->result_array(); if (!empty($query)) { #print_r($query); $entryquantity = $query[0]['quantity']; $total_ifb_quantity = $query[0]['total_ifb_quantity']; $totall = $_POST['quantityifb'] + $total_ifb_quantity; } //exit(); if (!empty($data['i'])) { #exit('reached'); $_POST = array_merge($_POST, array('invitation_id' => decryptValue($data['i']))); $result = $this->db->query($this->Query_reader->get_query_by_code('update_bid_invitation', $_POST)); #exit($this->db->last_query()); $bid_invitation_id = decryptValue($data['i']); $query = mysql_query("UPDATE procurement_plan_entries SET total_ifb_quantity ='" . $totall . "' WHERE \tid='" . $_POST['procurement_id'] . "' limit 1 ") or die("" . mysql_error()); } else { $_POST['author'] = $this->session->userdata('userid'); //$bidinviatns = $this->Query_reader->get_query_by_code('add_bid_invitation', $_POST); $result = $this->db->query($this->Query_reader->get_query_by_code('add_bid_invitation', $_POST)); $bid_invitation_id = $this->db->insert_id(); $query = mysql_query("UPDATE procurement_plan_entries SET total_ifb_quantity ='" . $totall . "' WHERE \tid='" . $_POST['procurement_id'] . "' limit 1 ") or die("" . mysql_error()); } } #event has been added successfully if (!empty($result) && $result) { /* #Notify approvers $procurement_details = $this->Query_reader->get_row_as_array('procurement_plan_details', array('searchstring'=>' procurement_plan_entries.procurement_ref_no ="'. $_POST['procurement_ref_no'] .'"', 'limittext'=>'', 'orderby'=>' procurement_plan_entries.dateadded ' )); if(!empty($procurement_details)) { $this->load->model('notification_m', 'notifications'); $receipients = $this->notifications->notification_access('approve_invitation_for_bids', $procurement_details['pde_id']); if(!empty($receipients)) { $msg_title = 'Request to approve Invitation for Bids'; $msg_body = 'Hello'. '<p>An Invitation for bids process that needs your approval has been initiated by '. $this->session->userdata('firstname') . ' ' . $this->session->userdata('lastname') .'.</p>'. '<p>The procurement reference number '. $_POST['procurement_ref_no'] .' and subject of procurement is '. $procurement_details['subject_of_procurement'] .'. To view more details and approve/reject the IFB click '. '<a href="'. base_url() .'bids/approve_bid_invitation/i/'. encryptValue($bid_invitation_id) .'">here</a>'.' </p>'. '<p>regards, <br /> System message</p>'; $notification_result = $this->db->insert('notifications', array('triggeredby'=>$this->session->userdata('userid'), 'title'=>$msg_title, 'body'=>$msg_body, 'receipients'=>$receipients, 'msgtype'=>'IFB_Approval_Request')); } } */ $data['msg'] = "SUCCESS: The bid invitation details have been saved."; $this->session->set_userdata('sres', $data['msg']); #user clicked publish if (!empty($_POST['approve'])) { redirect('bids/approve_bid_invitation/m/sres/i/' . encryptValue($bid_invitation_id) . (!empty($data['v']) ? "/v/" . $data['v'] : '')); } else { if (!empty($bid_invitation_id)) { #all I need is credentials $data['notifyrop'] = $bid_invitation_id; } redirect('bids/manage_bid_invitations/m/sres' . (!empty($data['v']) ? "/v/" . $data['v'] : '')); } } else { if (empty($data['msg'])) { $data['msg'] = "ERROR: The bid invitation details could not be saved or were not saved correctly."; /* if(!empty($_POST['procurement_ref_no'])) $data['formdata']['procurement_details'] = $this->Query_reader->get_row_as_array('search_table', array('table'=>'procurement_plan_entries', 'orderby'=>'procurement_ref_no', 'limittext' =>'','searchstring' => ' id = "'.$_POST['procurement_ref_no'].'" AND isactive="Y"')); */ } } } 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']; } elseif (!$bid_validation_results['result'] && empty($data['msg'])) { $data['msg'] = "WARNING: " . $bid_validation_results['msg']; $data['requiredfields'] = $bid_validation_results['error_fields']; } } $data['formdata'] = $_POST; #print_array($_POST); exit(); $app_select_str = ' procurement_plan_entries.isactive="Y" '; if ($this->session->userdata('isadmin') == 'N') { $userdetails = $this->db->get_where('users', array('userid' => $this->session->userdata('userid')))->result_array(); $app_select_str .= ' AND procurement_plans.pde_id ="' . $userdetails[0]['pde'] . '"'; } if (!empty($data['i'])) { $app_select_str .= ' AND bidinvitations.id ="' . decryptValue($data['i']) . '" '; } else { $app_select_str .= ' AND IF(procurement_plan_entries.total_ifb_quantity >= procurement_plan_entries.quantity,COALESCE(bidinvitations.id, 0) < 1,COALESCE(bidinvitations.id, 0) > 1 ) '; #$app_select_str .= ' AND COALESCE(bidinvitations.id, 0) < 1'; } $data['procurement_plan_entries'] = $this->db->query($this->Query_reader->get_query_by_code('ProcurementPlanDetails', array('searchstring' => $app_select_str, 'limittext' => '', 'orderby' => ' procurement_plan_entries.dateadded ')))->result_array(); $data['currencies'] = $this->db->get_where('currencies', array('isactive' => 'Y'))->result_array(); $data['page_title'] = !empty($data['i']) ? 'Edit bid invitation' : 'Create bid invitation'; $data['current_menu'] = 'create_invitation_for_bids'; $data['view_to_load'] = 'bids/bid_invitation_form'; $data['view_data']['form_title'] = $data['page_title']; //print_r($data); $this->load->view('dashboard_v', $data); }
function award_contract() { # Get the passed details into the url data array if any $urldata = $this->uri->uri_to_assoc(3, array('m', 's', 'i')); # Pick all assigned data $data = assign_to_data($urldata); $data = add_msg_if_any($this, $data); if ($this->input->post('save')) { $required_fields = array('date_signed', 'commencement_date', 'completion_date'); $data['formdata'] = $_POST; if (empty($_POST['contract_amount'])) { $validation_results['bool'] = FALSE; $validation_results['requiredfields'] = 'contract_amount'; } else { $_POST = clean_form_data($_POST); $validation_results = validate_form('', $_POST, $required_fields); } #Only proceed if the validation for required fields passes if ($validation_results['bool']) { #Check if a contract with a similar name already exists $contract_name_query = $this->Query_reader->get_query_by_code('search_table', array('table' => 'contracts', 'limittext' => '', 'orderby' => 'id', 'searchstring' => ' procurement_ref_id="' . $_POST['prefid'] . '" AND isactive="Y"')); $contract_name_query_result = $this->db->query($contract_name_query); if ($contract_name_query_result->num_rows() < 1) { $_POST = array_merge($_POST, array('author' => $this->session->userdata('userid'))); $result = $this->db->query($this->Query_reader->get_query_by_code('award_contract', $_POST)); if ($result) { $contract_id = $this->db->insert_id(); #Add the contract prices foreach ($_POST['contract_amount'] as $contract_amount) { $amount_values = explode('__', $contract_amount); $this->db->insert('contract_prices', array('contract_id' => $contract_id, 'amount' => removeCommas($amount_values[0]), 'xrate' => removeCommas($amount_values[2]), 'currency_id' => removeCommas($amount_values[1]), 'author' => $this->session->userdata('userid'))); } } } else { $data['msg'] = "ERROR: A contract has already been awarded for the selected procurement ref number."; } #exit($this->db->_error_message()); #Format and send the errors if (!empty($result) && $result) { $this->session->set_userdata('usave', "The contract data has been successfully saved."); redirect("contracts/manage_contracts/m/usave"); } else { if (empty($data['msg'])) { $data['msg'] = "ERROR: The contract could not be saved or was not saved correctly."; } } } # End validation 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['contractdetails'] = $_POST; } $app_select_str = ''; if ($this->session->userdata('isadmin') == 'N') { $userdetails = $this->db->get_where('users', array('userid' => $this->session->userdata('userid')))->result_array(); $app_select_str .= ' AND PP.pde_id ="' . $userdetails[0]['pde'] . '"'; } $data['procurement_plan_entries'] = $this->db->query($this->Query_reader->get_query_by_code('uncontracted_procurements', array('searchstring' => $app_select_str, 'limittext' => '', 'orderby' => ' PPE.procurement_ref_no ')))->result_array(); $data['currencies'] = $this->db->get_where('currencies', array('isactive' => 'Y'))->result_array(); $data['page_title'] = !empty($data['i']) ? 'Edit contract details' : 'Award contract'; $data['current_menu'] = 'award_contract'; $data['view_to_load'] = 'contracts/contract_award_form'; $data['form_title'] = $data['page_title']; $this->load->view('dashboard_v', $data); }
function save_procurement_entry() { #check user access #1: for editing if (!empty($data['i'])) { check_user_access($this, 'edit_procurement_entry', 'redirect'); } else { check_user_access($this, 'add_procurement_entry', 'redirect'); } # Get the passed details into the url data array if any $urldata = $this->uri->uri_to_assoc(3, array('m', 'p', 'v')); # Pick all assigned data $data = assign_to_data($urldata); $data = add_msg_if_any($this, $data); $data = handle_redirected_msgs($this, $data); $plan_info = $this->procurement_plan_m->get_by_id(decryptValue($data['v'])); if (!empty($plan_info)) { $plan_info = $plan_info[0]; } #print_array($_POST); if (!empty($_POST['save_entry']) || !empty($_POST['save_and_new'])) { $data['formdata'] = $_POST; $required_fields = array('subject_of_procurement', 'pde_department', 'procurement_type', 'estimated_amount', 'currency', 'funding_source', 'procurement_method', 'contracts_committee_approval_date', 'contracts_committee_approval_of_shortlist_date', 'bid_issue_date', 'bid_closing_date', 'submission_of_evaluation_report_to_cc', 'cc_approval_of_evaluation_report', 'quantity'); if (!empty($_POST['currency']) && $_POST['currency'] > 1) { $required_fields = array_merge($required_fields, array('exchange_rate')); } #$_POST = clean_form_data($_POST); $validation_results = validate_form('', $_POST, $required_fields); #Only proceed if the validation for required fields passes if ($validation_results['bool']) { $procurement_plan_data = array('subject_of_procurement' => $this->input->post('subject_of_procurement'), 'procurement_type' => $this->input->post('procurement_type'), 'procurement_method' => $this->input->post('procurement_method'), 'pde_department' => $this->input->post('pde_department'), 'funding_source' => $this->input->post('funding_source'), 'estimated_amount' => removeCommas($this->input->post('estimated_amount')), 'currency' => $this->input->post('currency'), 'exchange_rate' => $_POST['currency'] == 1 ? 1 : $this->input->post('exchange_rate'), 'pre_bid_events_date' => custom_date_format('Y-m-d', $this->input->post('pre_bid_events_date')), 'contracts_committee_approval_date' => custom_date_format('Y-m-d', $this->input->post('contracts_committee_approval_date')), 'publication_of_pre_qualification_date' => custom_date_format('Y-m-d', $this->input->post('publication_of_pre_qualification_date')), 'proposal_submission_date' => custom_date_format('Y-m-d', $this->input->post('proposal_submission_date')), 'contracts_committee_approval_of_shortlist_date' => custom_date_format('Y-m-d', $this->input->post('contracts_committee_approval_of_shortlist_date')), 'bid_issue_date' => custom_date_format('Y-m-d', $this->input->post('bid_issue_date')), 'bid_submission_opening_date' => custom_date_format('Y-m-d', $this->input->post('bid_issue_date')), 'bid_closing_date' => custom_date_format('Y-m-d', $this->input->post('bid_closing_date')), 'submission_of_evaluation_report_to_cc' => custom_date_format('Y-m-d', $this->input->post('submission_of_evaluation_report_to_cc')), 'secure_necessary_approval_date' => custom_date_format('Y-m-d', $this->input->post('necessary_approval_date')), 'contract_award' => custom_date_format('Y-m-d', $this->input->post('contract_award')), 'best_evaluated_bidder_date' => custom_date_format('Y-m-d', $this->input->post('best_evaluated_bidder_date')), 'contract_sign_date' => custom_date_format('Y-m-d', $this->input->post('contract_sign_date')), 'cc_approval_of_evaluation_report' => custom_date_format('Y-m-d', $this->input->post('cc_approval_of_evaluation_report')), 'negotiation_date' => custom_date_format('Y-m-d', $this->input->post('negotiation_date')), 'negotiation_approval_date' => custom_date_format('Y-m-d', $this->input->post('negotiation_approval_date')), 'performance_security' => custom_date_format('Y-m-d', $this->input->post('performance_security')), 'accounting_officer_approval_date' => custom_date_format('Y-m-d', $this->input->post('accounting_officer_approval_date')), 'best_evaluated_bidder_date' => custom_date_format('Y-m-d', $this->input->post('best_evaluated_bidder_date')), 'advanced_payment_date' => custom_date_format('Y-m-d', $this->input->post('advanced_payment_date')), 'solicitor_general_approval_date' => custom_date_format('Y-m-d', $this->input->post('solicitor_general_approval_date')), 'mobilise_advance_payment' => custom_date_format('Y-m-d', $this->input->post('mobilise_advance_payment')), 'substantial_completion' => custom_date_format('Y-m-d', $this->input->post('substantial_completion')), 'final_acceptance' => custom_date_format('Y-m-d', $this->input->post('final_acceptance')), 'procurement_plan_id' => $plan_info['id'], 'quantity' => $this->input->post('quantity')); #check if the procurement already exists $similar_proc_ref_no = $this->Query_reader->get_row_as_array('search_table', array('table' => ' procurement_plan_entries', 'orderby' => 'procurement_ref_no', 'limittext' => '', 'searchstring' => ' procurement_plan_id = "' . $plan_info['id'] . '" AND pde_department ="' . $_POST['pde_department'] . '" AND subject_of_procurement = "' . $_POST['subject_of_procurement'] . '"' . (!empty($data['i']) ? ' AND id !="' . decryptValue($data['i']) . '"' : ''))); if (!empty($similar_proc_ref_no)) { $data['msg'] = 'ERROR: An entry with a similar subject of procurement <b><i>(' . $_POST['subject_of_procurement'] . ')</i></b> has already been created already exists.'; } else { if (!empty($data['i'])) { $procurement_plan_data['updated_by'] = $this->session->userdata('userid'); $result = $this->db->update('procurement_plan_entries', clean_form_data($procurement_plan_data), array('id' => decryptValue($data['i']))); } else { #$procurement_plan_data['procurement_ref_no'] = procurement_plan_ref_number_hint($plan_info['pde_id'], $this->input->post("procurement_type"), $plan_info['financial_year'], decryptValue($data['v'])); $procurement_plan_data['author'] = $this->session->userdata('userid'); $result = $this->procurement_plan_entry_m->create($procurement_plan_data); } } #exit($this->db->last_query()); #event has been added successfully if (!empty($result) && $result) { $data['msg'] = "SUCCESS: The procurement entry details have been saved."; $this->session->set_userdata('sres', $data['msg']); #user clicked publish if (!empty($_POST['save_and_new'])) { redirect('procurement/load_procurement_entry_form/m/sres' . (!empty($data['v']) ? "/v/" . $data['v'] : '')); } else { redirect('procurement/procurement_plan_entries/m/sres' . (!empty($data['v']) ? "/v/" . $data['v'] : '')); } } elseif (empty($data['msg'])) { $data['msg'] = "ERROR: The procurement entry details could not be saved or were not saved correctly."; } } 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']; } if ($plan_info) { if ($plan_info) { //get the plan id $pde_id = $plan_info['pde_id']; $financial_year = $plan_info['financial_year']; $data['page_title'] = get_pde_info_by_id($pde_id, 'title') . ' financial year (' . $financial_year . ') entries'; $data['current_menu'] = 'view_procurement_plans'; $data['plan_info'] = $plan_info; $data['financial_year'] = $financial_year; $data['view_to_load'] = 'procurement/admin/register_entry_v'; $data['view_data']['form_title'] = $data['page_title']; $data['plan_id'] = decryptValue($this->uri->segment(4)); $data['pde_id'] = $pde_id; //print_array($data); //load view $this->load->view('dashboard_v', $data); } else { echo error_template('No plan for this year'); } } else { //if pde does not exist //TODO redirect to a more good looking page echo error_template('No data to display'); } }