query("SELECT * FROM staff_payment_slip WHERE payment_slip_id = '".$page."' LIMIT 1"); if ($mysqli_page->num_rows > 0){ // keep query value in array $row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ; $submit_type = 'edit' ; } // update database if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){ // keep value in variable $page_title = escapeString($_POST['title']) ; $page_title = ($page_title != '' ? $page_title : 'No Title') ; if ( $page == '' ){ $mysqli->query("INSERT INTO staff_payment_slip (created_at) VALUES ('".TODAYDATE."')") ; $page = $mysqli->insert_id ; } // resize image // set image in variable $image = $_FILES["image"]["name"] ; $image_query = '' ; $remove_photo = $_POST['remove_photo'] ; if ($remove_photo == 1){ $image = '' ; $image_query = "payment_file_type = '', payment_file = ''," ; } if ( $image != '' ){ $get_image = pathinfo($image) ; if ( $get_image['extension'] == 'pdf' ){ $file_name = $page.'-'.time().'.pdf' ; copy($_FILES["image"]["tmp_name"], 'uploads/PaymentSlip/'.$file_name) ; $image_query = "payment_file_type = 'pdf', payment_file = '".$file_name."'," ; }else{ $create_image = reCreateImage('PaymentSlip', $page, $page, '', $image, $_FILES["image"]["type"], $_FILES['image']['tmp_name']) ; // Image uploads when exists if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){ $resizeObj = new resize($create_image['original']) ; // Initialise load image foreach($create_image['crop'] as $value){ // Resize image (options: exact, portrait, landscape, auto, crop) $resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ; $resizeObj -> saveImage($value['source'], 70) ; // Save image } $get_image = pathinfo($create_image['image']) ; $image_query = "payment_file_type = '".$get_image['extension']."', payment_file = '".$create_image['image']."'," ; } } } // update database $mysqli->query("UPDATE staff_payment_slip SET ".$image_query." staff_id = '".escapeString($_POST['staff_id'])."', payment_subject = '".$page_title."', updated_at = '".TODAYDATE."' WHERE payment_slip_id = '".$page."'") ; pushToUserCron( 'staff_payment_slip', $page, $_POST['staff_id'], 'Payment Slip', 'Your payment slip has been submitted.' ) ; // add system log $array_remark = array('old' => array('title' => $row_page['payment_subject']), 'new' => array('title' => $page_title)) ; // refresh page header("Location:hr-payment-slip.php?page_mode=edit&page=".$page."&success=1") ; $_SESSION['system_result'] = 'success-updated' ; exit ; } if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'payment-slip-new') ) || ( $page_mode == 'edit' && !permissionCheck($row_user, 'payment-slip-update') ) ){ header('Location: hr-payment-slip.php') ; exit ; } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; // get all requires // get all staff $staff_list = [] ; $mysqli_staff = $mysqli->query("SELECT staff_id, staff_name, staff_idno FROM staff WHERE deleted_at IS NULL ".$user_branch_permission_sql) ; if ( $mysqli_staff->num_rows > 0 ){ while ( $row_staff = $mysqli_staff->fetch_assoc() ){ $staff_list[$row_staff['staff_id']] = dataFilter($row_staff['staff_name']) . ' ( ' . dataFilter($row_staff['staff_idno']) . ' )' ; } } ?>
'.$lang['Thank you your payment slip has been updated'].'
' ; break ; } unset($_SESSION['system_result']) ; } ?>
query($mysqli_query." ORDER BY a.payment_slip_id DESC LIMIT $start_from, " . LIMIT) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; // start header here include 'requires/page_header.php' ; include 'requires/page_top.php' ; ?>
listing
num_rows > 0){ while ($row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC)){ // default variable $id = $row_page['payment_slip_id'] ; echo ' '; } }else{ echo ' ' ; } ?>
' ; if ( permissionCheck($row_user, 'payment-slip-update') ){ echo ' ' ; }else{ echo '-' ; } echo ' '.dataFilter($row_page['staff_name']).' ( '.dataFilter($row_page['staff_idno']).' ) '.dataFilter($row_page['payment_subject']).' '.resetDateFormat($row_page['created_at']).'
'.$lang['no_data'].'