Change Log of Purchase Requisition System (PRS)

System Requirements

  1. phpMyAdmin version: 5.2.2
  2. PHP version: 7.2
  3. MySQL version: 5.7.26
  4. PHPRunner version: 10.4
  5. Hard Disk Space: 20 MB

 

Database Structure

TABLE COLUMN
purchase_requisition
uggroups
ugmembers
ugrights
users

 

Live URL

https://prs.sweetco.com.my


 

v. 1.0 2026-04-22 Modification Completed

Replace “Rich Text Box” for “Item Description” field with “Text Box with multiple rows”

BEFORE AFTER

 

Rename “vendor” column to “vendor_details” and replace “Rich Text Box” for “Vendor Details” field with “Text Box with multiple rows”

BEFORE AFTER
 


 

Rename columns and labels

  • rename “vendor_url” column to “vendor_link”
  • rename “Vendor Link” label to “Vendo’s Link”
  • rename “Vendor Email” label to “Vendor’s Email”
  • rename “Item Purpose” label to “Item is Used For”
BEFORE AFTER
 

  • vendor_url
  • vendor_email
  • item_purpose

 

Add “Show/hide fields”

BEFORE AFTER

 

Add users to Purchase Requisition System

BEFORE AFTER

 

v. 1.0 2025-02-19 Modification Completed

Move “Supplier” field after “Unit Price” in edit page

BEFORE AFTER





 

Modify the columns of “purchase_requisition” table

BEFORE AFTER
Table Structure

  1. purchase_requisition_id – int
  2. issued_date – date
  3. company_name – varchar (100)
  4. requested_by – varchar (50)
  5. item_description – longtext
  6. item_photo – mediumtext
  7. quantity_requested – int
  8. quantity_in_stock – int
  9. unit_price – double(9,2)
  10. supplier – longtext
  11. item_purpose – varchar (255)
  12. expected_arrival_date – date
  13. delivery_order_photo – mediumtext
  14. received_item_photo – mediumtext
  15. received_item_date – date
  16. issued_by – varchar(255)
  17. approved_by – varchar(255)
Table Structure

  1. purchase_requisition_id – int
  2. issued_date – date
  3. company_name – varchar (100)
  4. requested_by – varchar (50)
  5. item_description – longtext
  6. item_photo – mediumtext
  7. quantity_requested – int
  8. unit_price – double(9,2)
  9. quantity_in_stock – int
  10. vendor – longtext
  11. vendor_email – varchar(255)
  12. vendor_url – varchar(255)
  13. item_purpose – varchar (255)
  14. expected_arrival_date – date
  15. received_item_date – date
  16. received_item_photo – mediumtext
  17. delivery_order_photo – mediumtext
  18. issued_by – varchar(255)
  19. approved_by – varchar(255)

  • vendor_email
  • vendor_url

 

Rearrange the sequence of grid as per the sequence of columns in “purchase_requisition” table

BEFORE AFTER


 

Rearrange the sequence of labels and text box in edit view as per the sequence of columns in “purchase_requisition” table

BEFORE AFTER





 

Rearrange the sequence of rows in the form to follow the sequence of columns in “purchase_requisition” table

BEFORE AFTER


 

v. 1.0 2025-01-15 Modification Completed

Revise the form

  • remove the “Supplier” at top right of table and move it to the table by adding a row after “Unit Price”.
  • rename the label as “Name and Contact Details of Supplier”, set the format of text (data entry) box to “Basic Rich Text Editor” so that user can enter name, address, contact number, link in allow multiple lines.
BEFORE AFTER
 


 

v. 1.0 2025-01-02 Kaizen Completed

Create “sweetcoc_prs” database and assign “sweetcoc_phpMyBackupPro2024” and “sweetcoc_phprunner” users to the database

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to cPanel -> “Databases” -> “Manage My Databases”.
  2. Under “Create New Database”, create “sweetcoc_prs”.
  3. Under “Add User To Database”, add “sweetcoc_phpMyBackupPro2024” and “sweetcoc_phprunner” to “sweetcoc_prs” database.

 

Create “purchase_requisition” table in “sweetcoc_prs” database

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to cPanel -> “Databases” -> “phpMyAdmin.
  2. Create “purchase_requisition” table.
  3. Add below columns:-
    Name Type
    purchase_requisition_id int(11)
    company_name varchar(100)
    requested_by varchar(50)
    item_description longtext
    item_photo mediumtext
    quantity_requested int(11)
    quantity_in_stock int(11)
    unit_price double(9,2)
    supplier_name varchar(255)
    item_purpose varchar(255)
    expected_arrival_date date
    delivery_order_photo mediumtext
    received_item_photo mediumtext
    received_item_date date
    issued_by varchar(255)
    approved_by varchar(255)

 

Create “prs.sweetco.com.my” domain

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to cPanel -> “Domains” -> “Domains”.
  2. Add “prs.sweetco.com.my”.

 

Set PHP version of “Purchase Requisition System” to “PHP 7.2”

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to cPanel -> “Software” -> “MultiPHP Manager”.
  2. Check “prs.sweetco.com.my” and change the PHP Version to “PHP 7.2 (ea-php72)”.

 

Create “Purchase Requisition System” project in PRPRunner

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to PHPRunner and create a new project PRS.
  2. Set the database for PRS.

 

Re-arrange the “view” page of PRS

BEFORE AFTER


MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Designer” tab and click “view” tab.
  2. Re-arrange all fields like below:


 

Add “Send Email” function

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Misc” tab and click “Email Settings…”
  2. Set as below:
  3. Go to “Designer” tab, click on “list” page, click on “Insert…” dropdown and click “Custom Button”.
  4. Click “New Button…”
  5. Name the new button as “Send_Email”. In “Client Before tab, place below code:
    var pdfParams = {},
      selectedRecords = pageObj.getSelectedRecords();
     
    if( selectedRecords.length == 0 )
      return false;
     
    params.recordCount = selectedRecords.length;
    params.filenames = [];
     
    var createOnePdf = function( idx ) {
      ajax.addPDF( 'pdf'+idx, pdfParams[idx], function() {
        delete pdfParams[idx];
        if( Object.keys( pdfParams ).length == 0 ) {
            showDialog();
         }
      });
    }
     
    var showDialog = function() {
     ctrl.dialog( {
      title: 'Email ' + params.recordCount + ' PDF files',
      fields: [
         {
            name: 'Email',
            value: 'factory@sweetco.com.my'
         },
         {
            name: 'Subject',
            value: 'Purchase Requisition No.: '
         },
         {
            name: 'Body',
            value: 'This email is generated by Runner-created application',
            type: 'textarea'
         },
         ]
      });
    }
     
    selectedRecords.forEach( function( ajaxRow, idx ) {
      pdfParams[ idx ] = {
         pageType: 'view',
         keys: ajaxRow.getKeys()
      };
      params.filenames.push( 'Purchase_Requisition#'+ajaxRow.getKeys()+'.pdf' )
      createOnePdf( idx );
     
    });
     
    return false;

  6. In “Server” tab, place below code:
    $attachments = array();
    for( $i=0; $i< $params["recordCount"]; ++$i ) {
      $attachments[] = array(
        "path" => $button->saveTempFile( $params["pdf" . $i] ),
        "name" => $params["filenames"][$i]
      );
    }
    $mail = array();
    $mail["to"] = $params["Email"];
    $mail["subject"] = $params["Subject"];
    $mail["body"] = $params["Body"];
    $mail["attachments"] = $attachments;
     
    $ret = runner_mail( $mail );
     
    if( $ret["mailed"] )
    {
      $result["success"] = true;
    }
    else
    {
      $result["message"] = $ret["message"];
        $result["success"] = false;
    }

  7. In “Client After” tab, paste below code:
    if( result.success ) {
        alert("Your email has been sent!");
    } else {
        alert("Error sending " + result.message);
    }

  8. Place the “Send Email” button at the same row as “Add new” button.

 

Add “Print” and “Save PDF” functions

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Designer” tab, select “view” tab, click on “Insert…” dropdown and click “Custom Buttom”.
  2. Click “New button…”.
  3. For:-
    • “Print” button
      • “Client Before” tab
        window.print();
         // Uncomment the following line to prevent execution of "Server" and "Client After" events.
        return false;

    • “Save PDF” button
      • “Server” tab
        $record = $button->getCurrentRecord();
        $result["ID"] = $record["purchase_requisition_id"];

      • “Client After” tab
        var params = {
            table: 'purchase_requisition',
            page: 'view',
            pageType: 'view',
            keys: [result["ID"]],
            scale: 120
        }
        
        Runner.PDF.download(params, 'Purchase Requisition no. ' + result["ID"] + '.pdf');

  4. Re-arrange “Print” and “Save PDF” buttons at the bottom.

Edit “Item Photo”, “Delivery Order Photo” and “Received Item Photo” to allow multiple image upload

BEFORE AFTER
  • Item Photo
  • Delivery Order Photo
  • Received Item Photo

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Designer” tab
  2. Set as below:-
    • item_photo
    • delivery_order_photo
    • received_item_photo

 

Add database security to PRS

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Security” tab, select “Database” and create a new table for “users”.
  2. Add a new user.
  3. Set user group permission.
  4. Add “Big-Boss” to <Admin> group.
  5. Encrypt password.
  6. Set JWT secret key: “YaaBF0qi8Wy7X9Wns2Ci”.

 

Change the title of the project to “Purchase Requisition System v.1.0”

BEFORE AFTER

MODIFICATION in PHPRunner or cPanel or PHPMyAdmin

  1. Go to “Editor” tab, double-click on “PRS” logo.
  2. Rename it to “Purchase Requisition System v.1.0”.

 

v. 1.0 2025-01-02 Beta Testing Completed

TEST OBJECTIVE: Can PRS add another user?

TESTING METHODOLGY TEST RESULT
  1. Log in to PRS using:-
    • Username = Big-Boss
    • Password = 2024$BF#Taufiq
  2. Go to “Admin Area”.
  3. Click on “Add/Edit users” -> “Add new”.
  4. Add:-
    • Username = Sweetco-Public
    • Password = #2023Sweetco
 


 

TEST OBJECTIVE: Can “Item Photo”, “Delivery Order Photo” and “Received Item Photo” fields upload multiple images?

TESTING METHODOLGY TEST RESULT
  1. Add new record in Purchase Requisition.
  2. Go to “Item Photo”, “Delivery Order Photo” and “Received Item Photo” fields and upload more than 1 image to these fields.
  • Item Photo
  • Delivery Order Photo
  • Received Item Photo

 

TEST OBJECTIVE: Can “Send Email” function email the selected record to any email?

TESTING METHODOLGY TEST RESULT
  1. Select any record in Purchase Requisition.
  2. Click “Send Email” button.
  3. Send to “t1@mobitek.my”
 

 

How To Automatically Run MySQL Dump in Windows and Linux to Backup MySQL Database

Windows

  1. Create a batch file “sweetcoc_ams_backup.bat” for mysqldump. Copy below code into the batch file:-
    @echo off
    REM set mysqldump path
    SET mysqldump_path="C:\wamp64\bin\mysql\mysql5.7.26\bin\mysqldump.exe"
    REM credentials to connect to MySQL server
    SET mysql_user=root
    SET mysql_password=
    REM backup storage location
    SET backup_folder="C:\wamp64\www\database_backups"
    REM backup file name
    SET backup_name=%backup_folder%\sweetcoc_ams_%DATE:~-4%-%DATE:~7,2%-%DATE:~4,2%.sql
    REM create backup
    "C:\wamp64\bin\mysql\mysql5.7.26\bin\mysqldump.exe" -u %mysql_user%
    sweetcoc_ams > %backup_name%
  2. Create a new Task Scheduler that executes the batch file.

 

Linux

  1. Create a new PHP file and copy below code into it.
    <?php
    
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    $database = '*****';
    $user = '*****';
    $pass = '*****';
    $host = '*****';
    //$dir = dirname(__FILE__) . '/dump.sql';
    $dir = dirname(__FILE__);
    
    echo "Backing up database to {$dir}.";
    echo "\n";
    
    exec("mysqldump --user={$user} --password={$pass} --host={$host} --no-tablespaces {$database} | zip > \${HOME}/database_backup/{$database}_`date '+%Y-%m-%d_%H:%M'`.sql.zip", $output);
    
    echo "\n";
    echo "Backup completed.";
    
    ?>
  2. Create a new Cron Job and point to the path where the PHP file is saved.
    /usr/local/bin/php
    /home4/sweetcoc/database_backup/mysqldump.php
  3. The Cron Job will save the database as below:-

 

Restoring a Back-Up Database

  1. Go to “D:\” drive in UBS-SERVER.
  2. Compress “AMS Back-Up” folder to “AMS Back-Up.zip”.
  3. Copy “AMS Back-Up.zip” into “C:\wamp64\www\” folder in HP-6305-W7PRO and extract it.
  4. After extracted, move all folders inside “AMS Back-Up” folder to the root folder of “C:\wamp64\www\”. The folder hierarchy should be as below:-
  5. Go to “Start”, search for “wampserver” and run “Wampserver64”.
  6. Wait and ensure the icon is green in “System Tray” that indicates all services are running.
  7. If not then click on “Wampserver64” icon and select “Restart All Services”.
  8. Click on Windows “System Tray” dropdown -> click “Wamserver64” icon -> click “phpMyAdmin”. “phpMyAdmin” will be opened on the browser.
  9. Enter the “username = root” and leave the password empty. Click “Go”.
  10. Click on “sweetcoc_ams” database -> click “Import”.
  11. Click “Choose file”.
  12. Browse “C:\wamp64\www\database_backups”, sort the files by “Date modified” and open the latest SQL file.
  13. Leave everything as it is and click “Go”.
  14. Go to browser and open “http://localhost/punchcard”.
  15. Finally HP-6305-W7PRO” will have the latest version of “E-Punch Card” and “sweetcoc_ams” database.

How to Upgrade SERVERLINK

  1. Firstly, create a restore point.
  2. Open SERVERLINK, in “HOME”, click on the update.
  3. Let SERVERLINK download the update.
  4. After the download has been completed, a popup will appear. Click “Yes”.
  5. Click “Next” on each Setup.

    Note: if you choose “Only dowload setup (do not install)” , then the setup file is downloaded into this folder “C:\Users\…\AppData\Local\Temp\UpdateRelease.exe“. Run the “UpdateRelease.exe” at a later date.

  6. Restart UBS-SERVER.
  7. Finally, check the version displayed is the latest version (s.c.).

Comparison of E-mail API used in PHP

Runner_Mail() PHPMailer() PHP Mail()
SMTP, user name, password, port, etc. are set inside the PHPRunner UI

PHPMailer() is called by Runner_Mail()

SMTP is set inside the PHP code itself

SMTP is set in “PHP.ini”
<?php

require_once(“include/dbcommon.php”);

 

$email = “t1@mobitek.my”;

$msg = “”;

$subject = “New data record”;

 

$msg.= “Message: [Message]\r\n”;

$msg.= “Recipient: Recipient\r\n”;

$msg.= “Date/Time: DateTimeQueue\r\n”;

runner_mail(array(‘to’ => ‘$email’, ‘subject’ => $subject, ‘body’ => $msg));

?>

<?php
include_once(‘libs/phpmailer/class.phpmailer.php’);
include_once(‘libs/phpmailer/class.smtp.php’);$mail = new PHPMailer( true );
// Mail settings
$mail->isSMTP();   //Send using SMTP
$mail->Host = ‘mail.sweetco.com.my’;   //Set the SMTP server to send through
$mail->SMTPAuth = true;   //Enable SMTP authentication
$mail->Username = ‘factory@sweetco.com.my‘;   //SMTP username
$mail->Password = ‘2022@Beranang@Factory’;   //SMTP password
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;        //Enable implicit TLS encryption
$mail->Port = 587;   //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
$mail->setFrom(‘support@mobitek.my‘, ‘MOBITEK Support’);
$mail->isHTML(false);$mail->To = “t1@mobitek.my”;
$mail->Subject = “This is Subject”;
$mail->Body = “This the body”;
$mail->Send();?>
Open “php.ini” and search for “smtp” (there are no entries for no username and password)

 

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from =“admin@wampserver.invalid”

; For Unix only.  You may supply arguments as well (default: “sendmail -t -i”).
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog

MOBITEK Q25 4G Modem Can Use IP Address instead of COM Port Number

TEST OBJECTIVE TESTING METHODOLOGY TEST RESULT
Can hyper terminal connect to MOBITEK Q25 4G Modem via IP address instead of COM port and run “hyper terminal test“?
  1. Connect MOBITEK Q25 4G Modem  to LAN via LAN port.
  2. Assign IP address to Q25 using USR-TCP232 to be in the same subnet of the LAN. For this example:
    • the gateway is “192.168.10.1”
    • set the IP address for Q25 in this subnet “192.168.10.???”
    • Get the “Module port” of Q25 in USR-TCP232
  3. Run hyper terminal and connect using “TCP/IP (Winsock)”.
  4. Enter the “Host address” and “Port number”
  5. Type “AT” to Hyper Terminal to see if Q25 is responding
  • 860147050425139
  • 860147050425154

How to Implement Log-In Page using “Database” for a Web Application

  1. Edit “Email settings…” in “Misc” tab.
  2. Add new table “users” in “Security” tab.
  3. Set “Dynamic permissions” in “Security” tab. Add a new user.
  4. Build and run the PHPRunner project in localhost. Log in using the username and password added previously. Let the PHPRunner project open in localhost.
  5. Go to PHPRunner project again. Enable “Password hashing (encryption)” in “Registration and passwords…”.
  6. Build and run PHPRunner project again in localhost.
  7. Go to “Admin Area”.
  8. Go to “Add/Edit users”, edit the password. To use back the same password, first change the password to another password. Save it and then edit it back to change to the original password.

MOBITEK Q25 Can Use Internet Application and Send SMS at the Same Time

TEST OBJECTIVE TESTING METHODOLOGY TEST RESULT
Can MOBITEK Q25 connect to internet and send out SMS at the same time?
  1. Connect to internet, refer to https://mobitek-system.com/blog/category/iot/mobitek-q25-4g-modem/
  2. Use hyper terminal  to send out SMS (hyper-terminal test as per QC).
  3. Do not close the COM port in hyper terminal, keep it open (connected). Open web browser and visit www.mobitek.my
TEST 1

 

TEST 2