-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- Overview
- System Requirements
- Installation and Setup
- Running the Application
- Understanding the eInvoice System
- Code Structure
- Integration with Hotel PMS
- Security Considerations
- References and Resources
eInvoice is a web-based invoicing application built using PHP and the Laravel framework. The system allows users to generate and manage invoices, offering features such as JSON/XML generation and API key testing. It is designed for development and testing purposes, with the potential to be integrated into larger systems, such as a hotel Property Management System (PMS), to automate invoicing processes.
To successfully run the eInvoice application, ensure that your environment meets the following requirements:
- Operating System: Windows 10 or later.
- PHP: Version 8.1 or higher.
- Web Server: Apache (included with XAMPP).
- Database: MySQL (included with XAMPP).
- Composer: A dependency manager for PHP.
- Download XAMPP: Visit the official XAMPP website and download the version that includes PHP 8.1 or higher.
- Install XAMPP: Run the installer and follow the prompts to install XAMPP on your system.
-
Verify PHP Installation: After installation, open the Command Prompt and navigate to the PHP directory within XAMPP:
Ensure that the PHP version is 8.1 or higher.
cd C:\xampp\php php -v
- Download Composer: Visit the Composer website and download the Windows installer.
- Install Composer: Run the installer and ensure it is configured to work with your PHP installation.
-
Verify Composer Installation: In the Command Prompt, run:
composer -V
-
Fork and Clone the Repository:
- Fork the eInvoice repository to your GitHub account.
- Clone the forked repository to your local machine:
git clone https://github.com/yourusername/eInvoice.git cd eInvoice
-
Enable Required Extensions: Open the
php.inifile located in the XAMPP installation directory (C:\xampp\php\php.ini) and enable the following extensions by removing the semicolon (;) in front of each:extension=intl extension=xsl extension=sodium extension=zip
- Restart Apache: Use the XAMPP Control Panel to stop and start the Apache service to apply the changes.
-
Create
.envFile: In the project directory, rename the.env.examplefile to.env:mv .env.example .env
-
Generate Application Key: Run the following command to generate a unique application key:
php artisan key:generate
-
Install PHP Dependencies: Use Composer to install the necessary dependencies:
composer install
-
Update Dependencies (If Needed): If there are issues with the lock file, update the dependencies:
composer update
-
Start the Development Server:
php artisan serve
-
Access the Application: Open a web browser and navigate to
http://localhost:8000to view the eInvoice application.
The eInvoice system is capable of generating invoice data in both JSON and XML formats. This feature is useful for integrating with other systems or for exporting data in standardized formats.
- How It Works: The system retrieves invoice data from the database, processes it, and outputs it in either JSON or XML format, depending on the user's choice.
-
Potential Use Cases:
- Data Export: Export invoices for archival or integration with other accounting systems.
- API Integration: Utilize the generated JSON/XML for communication with external systems, such as a PMS.
The eInvoice application includes a feature for testing API keys. This is essential when integrating with external APIs, such as those provided by the Malaysian Inland Revenue Board (LHDN) for e-invoicing.
- How It Works: Users can input their API keys and test them against predefined endpoints to ensure they are valid and functioning correctly.
- Integration: This feature is particularly useful for testing integration with LHDN’s MyInvois system.
-
Controllers: Handle incoming HTTP requests, process them, and return responses. Located in the
app/Http/Controllersdirectory. -
Models: Represent the application's data structure and business logic. Found in the
app/Modelsdirectory. -
Views: Handle the presentation logic and are usually HTML templates with embedded PHP. Stored in the
resources/viewsdirectory. -
Routes: Define the application's endpoints and map them to controller actions. Defined in the
routes/web.phpfile.
-
artisan: The Laravel command-line interface that helps manage and run the application. -
.env: Contains environment-specific configuration, such as database credentials and API keys. It is essential for setting up the application. -
composer.json: Lists the PHP packages required by the application and their versions. -
php.ini: Configuration file for PHP, where extensions are enabled and other PHP settings are configured.
Integrating the eInvoice system with a hotel Property Management System (PMS) can automate the generation of invoices based on hotel transactions. This would streamline the billing process and reduce the need for manual data entry.
- How It Works: The PMS would trigger the eInvoice system to generate an invoice whenever a transaction is completed (e.g., room booking, additional services). The invoice can be automatically saved or sent to the customer.
The eInvoice system can be extended to integrate with external APIs for enhanced functionality. One such integration could be with LHDN’s MyInvois system, which is part of Malaysia’s e-invoicing initiative.
- LHDN References:
- YouTube Channel for Tutorials: To learn more about how MyInvois and other LHDN systems work, you can refer to the MyInvois LHDN YouTube Channel.
-
Environment Variables: Ensure that sensitive information, such as API keys and database credentials stored in the
.envfile, is secured and not shared publicly. - Production Readiness: The eInvoice application is intended for development and testing. If considering production deployment, additional security measures must be implemented, such as securing routes, validating inputs, and enabling HTTPS.
- LHDN API Documentation: Refer to the official API documentation for integrating with Malaysia’s e-invoicing system:
- YouTube Tutorials
: Watch video tutorials on the MyInvois LHDN YouTube Channel for a better understanding of how to use the e-invoicing system.