MITRA ERP Portal

User & Technical Documentation
Comprehensive Guide for All Modules
June 2026
Internal Use — Confidential

Table of Contents

1. Overview & Architecture3 1.1 What is MITRA ERP Portal3 1.2 Technology Stack3 1.3 Authentication & Access Control3 1.4 How to Access3 2. Dashboard / Home4 3. Inventory Module4 3.1 Bill of Materials (BOM)4 3.2 Item Creation & Management4 4. Production Module5 5. Purchase Module5 6. Approvals Module6 7. Forms & Registration6 8. Documents7 9. Projects Module7 10. Finance Module7 11. GST Reports Module8 12. Masters8 13. Reports Module9 14. Admin & User Management9 15. Technical Reference10 15.1 Server Setup & Configuration10 15.2 API Routes Reference10 15.3 Project File Structure10 15.4 Deployment & Restart10

1. Overview & Architecture

1.1 What is MITRA ERP Portal

The MITRA ERP Portal is a web-based application that provides a modern, browser-accessible interface for interacting with SAP Business One operations. It enables users across departments to perform critical business functions including inventory management, production control, purchase workflows, financial reporting, GST compliance, and customer/vendor registration — all without requiring direct access to the SAP B1 client application.

The portal streamlines operations by providing role-based access, multi-level approval workflows, and real-time data retrieval from the SAP B1 database via SQL Server. It serves as a unified hub for day-to-day business operations, approvals, and reporting.

1.2 Technology Stack

ComponentTechnology
Backend RuntimeNode.js with Express.js framework
FrontendVanilla HTML, CSS, and JavaScript (no framework)
DatabaseMicrosoft SQL Server
SAP IntegrationSAP B1 Service Layer REST API + Direct SQL queries
AuthenticationJSON Web Tokens (JWT) with 12-hour expiry
HostingWindows Server, port 5000
UI LibraryLucide Icons, Space Grotesk font
Validationexpress-validator for input validation

1.3 Authentication & Access Control

The portal uses JWT token-based authentication. Upon login, users receive a signed token valid for 12 hours. All API endpoints require a valid Bearer token in the Authorization header. The system implements role-based access control with the following roles:

Module-level permissions are assigned per user. The sidebar dynamically shows only the modules each user has access to. Administrators can configure per-user module access from the Admin panel.

1.4 How to Access

Open a web browser and navigate to:

http://<server-ip>:5000

Users will see the login page. After authentication, they are redirected to the Home dashboard with the sidebar showing their permitted modules.

2. Dashboard / Home

Home Dashboard Route: /

The Home page is the landing page of the MITRA ERP Portal, accessible to all authenticated users. It presents a card-based overview of all available modules, providing quick-access navigation to each functional area. The dashboard dynamically renders module cards based on the user's assigned permissions, ensuring each user sees only the features relevant to their role.

The dashboard also provides BOM request statistics (total, pending, approved, SAP-pushed) via the /api/stats endpoint, giving managers and administrators an at-a-glance view of pending workflows.

Key Features:

3. Inventory Module

3.1 Bill of Materials (BOM) Route: /bom

The BOM module enables users to create and update Bills of Materials in SAP Business One through a multi-level approval workflow. Users can compose a BOM by specifying a parent item, quantity, BOM type (Production, Sales, Assembly, Template, or Disassembly), warehouse, distribution rule, project code, and a list of component items with individual quantities, issue methods, and unit costs.

Submitted BOM requests flow through a configurable multi-level approval process (2, 3, or 4 levels) before being pushed to SAP B1 via the Service Layer API. The status flow progresses through DRAFT, PENDING, L1_APPROVED, L2_APPROVED (if 3+ levels), L3_APPROVED (if 4 levels), and finally SAP_PUSHED. Admin users can bypass the approval chain and push BOMs directly to SAP.

Key Features:

3.2 Item Creation & Management Route: /items

The Items module provides functionality to create new items in SAP B1 and view existing items. The "Create Item" view (/items) presents a form for entering item master data, while the "View Items" view (/items?list=1) lists all items with search and filter capabilities. Item creation requests go through an approval workflow managed by the Item Approval system.

The module integrates with SAP B1 lookups for item groups, warehouses, tax codes, GL accounts, and other master data to ensure consistency with the SAP system.

Key Features:

4. Production Module

Production Order Management Routes: /production, /issue-production, /receipt-production, /close-production

The Production module covers the full lifecycle of production orders in SAP Business One. It is divided into four sub-modules, each handling a specific stage of the production process. Users can create new production orders, issue raw materials to production, receive finished goods from production, and close completed production orders.

Sub-modules:

5. Purchase Module

Purchase Workflow Management Routes: /purchase-request, /purchase-quotation, /purchase-order, /grpo

The Purchase module provides end-to-end procurement management, covering the complete purchase cycle from initial request through to goods receipt. Each stage is handled by a dedicated sub-module with its own interface and workflow.

Sub-modules:

6. Approvals Module

6.1 External Approval (Portal Approvals) Route: /approvals

The External Approval module manages the portal's internal approval workflows for BOM requests, customer registrations, and item creation requests. Approvers see a unified queue of pending requests relevant to their role level. The multi-level approval system routes requests through the appropriate chain: Manager (L1), Senior Manager (L2), and SAP Adder (L3/Final), with configurable 2, 3, or 4-level workflows.

Key Features:

6.2 SAP Approval Route: /sap-approvals

The SAP Approval module provides an interface for managing SAP Business One's native approval procedures. It surfaces approval requests generated by SAP B1's built-in approval workflow engine, allowing authorized users to review and act on pending SAP documents (such as purchase orders, invoices, and other transactional documents) directly from the web portal without opening the SAP client.

Key Features:

7. Forms & Registration

7.1 Customer Registration Route: /register

The Customer Registration form allows users to submit new customer (Business Partner) records for creation in SAP B1. The form captures comprehensive business partner data including company details, contact information, billing and shipping addresses (with support for multiple addresses), currency preferences, GST/PAN details, MSME information, and file attachments. Submitted registrations go through a verification and approval workflow before being pushed to SAP as a new customer master record.

Key Features:

7.2 Vendor Registration Route: /vendor-register

The Vendor Registration form mirrors the customer registration process but is tailored for vendor (supplier) business partners. It captures vendor-specific information, AP account mappings, and vendor BP group classifications. Registered vendors follow a similar approval workflow before being created in the SAP B1 system as vendor-type business partners.

Key Features:

8. Documents

Document Management Route: /documents

The Documents module provides a centralized document management interface for uploading, organizing, and retrieving business documents associated with SAP transactions. Users can upload files and attachments, which are stored in the server's /uploads directory and linked to relevant business records. This module serves as a repository for supporting documentation such as purchase orders, invoices, delivery notes, and other transactional evidence.

Key Features:

9. Projects Module

Project Management Routes: /project-form, /project-approvals

The Projects module enables users to create, view, and manage project records with an integrated approval workflow. The "New Project" view (/project-form?new=1) provides a form for defining new project details, while the "View Projects" view (/project-form?list=1) displays all existing projects with filtering and search. The "Project Approvals" view (/project-approvals) presents a queue for project approvers to review and approve pending project submissions.

Project data is managed through a dedicated project store with its own database tables, supporting full CRUD operations and approval state management.

Key Features:

10. Finance Module

Financial Reporting & Analysis Routes: /costing-pl, /costing-comparison, /cost-sheet, /balance-sheet, /cash-flow, /salary

The Finance module provides a comprehensive suite of financial reporting tools that pull data directly from the SAP B1 database. It enables management to view and analyze key financial statements and reports without exporting data from the SAP client.

Sub-modules:

11. GST Reports Module

11.1 GSTR-1 (Sales Register) Route: /gstr1

The GSTR-1 module generates the outward supply register required for GST filing in India. It pulls sales invoice data from the SAP B1 database and formats it according to the GSTR-1 filing requirements. Users can filter by date range and export the data for upload to the GST portal. The report covers B2B invoices, B2C invoices, credit/debit notes, and other categories as required by the GSTR-1 format.

Key Features:

11.2 GSTR-2 Purchase Register Route: /gstr2

The GSTR-2 module generates the inward supply (purchase) register for GST compliance. It extracts purchase invoice data from SAP B1 and presents it in the GSTR-2 format. The module includes TCS (Tax Collected at Source) upload functionality, allowing users to upload TCS data files and reconcile them against purchase records for accurate GST reporting.

Key Features:

11.3 ITC-04 Job Work Register Route: /itc04

The ITC-04 module generates the job work register required under GST for tracking goods sent to and received from job workers. It pulls data from SAP B1 related to job work transactions and formats the report according to the ITC-04 filing requirements. This is essential for manufacturers who outsource production processes to third-party job workers.

Key Features:

12. Masters

Business Master Route: /business-master

The Business Master module provides an interface for viewing and managing business partner master data from SAP B1. It allows users to search, view, and manage customer and vendor master records, including contact details, address information, financial terms, and classification data. The module serves as a quick-reference tool for business partner information without requiring direct SAP client access.

Key Features:

13. Reports Module

13.1 Reports Dashboard Route: /reports

The Reports module provides a centralized reporting dashboard for generating and viewing various business reports from the SAP B1 database. It offers a collection of predefined report templates covering sales, purchases, inventory, and other operational metrics. Users can specify date ranges and filters to generate reports tailored to their analytical needs.

Key Features:

13.2 General Ledger Report Route: /general-ledger

The General Ledger Report provides detailed GL account transaction listings from the SAP B1 database. Users can view individual account activity with debits, credits, and running balances for any specified period. The report supports filtering by account code, date range, and other criteria to drill down into specific financial transactions recorded in the general ledger.

Key Features:

14. Admin & User Management

Administration Panel Route: /admin

The Admin module is the central administration panel for managing portal users, roles, and module access permissions. Accessible only to users with admin or sap_adder roles, it provides a complete user management interface for creating, editing, and deactivating user accounts. Administrators can assign roles, configure per-user module permissions, set approval departments, and link portal users to SAP user IDs.

Key Features:

User Profile Route: /profile

Each user has a personal profile page where they can update their display name, email address, and password. The profile page shows current role and module assignments (read-only) and provides a secure password change mechanism that requires the current password for verification before allowing updates.

15. Technical Reference

15.1 Server Setup & Configuration

The application is a Node.js Express server defined in server.js. It listens on port 5000 (configurable via the PORT environment variable) and binds to 0.0.0.0 for network-wide access. Configuration is managed through environment variables loaded via dotenv.

VariableDescription
PORTServer port (default: 5000)
JWT_SECRETSecret key for JWT token signing
SQL_HOSTSQL Server hostname/IP
SQL_PORTSQL Server port
SQL_USERSQL Server username
SQL_PASSWORDSQL Server password
SQL_DATABASESAP B1 database name
BOM_APPROVAL_LEVELSNumber of BOM approval levels (2, 3, or 4)
CUST_APPROVAL_LEVELSCustomer approval levels (default: 2)

15.2 API Routes Reference

Route PrefixDescriptionAuth
/api/authLogin, profile, token verificationPublic / Token
/api/usersUser CRUD (admin)sap_adder+
/api/bom-requestsBOM create/update/approve/rejectToken
/api/customersCustomer registration & approvalPublic / Token
/api/vendorsVendor registration & managementToken
/api/sapSAP lookups (items, warehouses, GL, tax, etc.) & GRPOToken
/api/projectsProject CRUD & approvalsToken
/api/item-approvalsItem creation approval workflowToken
/api/costingP&L, monthly accounts, cost analysisToken
/api/balance-sheetBalance sheet dataToken
/api/cash-flowCash flow statement dataToken
/api/costsheetCost sheet report dataToken
/api/salarySalary data managementToken
/api/gstr1GSTR-1 outward supply reportToken
/api/gstr2GSTR-2 purchase register & TCSToken
/api/itc04ITC-04 job work reportToken
/api/reportsGeneral business reportsToken
/api/general-ledgerGL account transaction reportToken
/api/business-masterBusiness partner master dataToken
/api/chatAI chatbot assistantToken
/api/configPortal configuration (approval levels)Public
/api/healthHealth check endpointPublic
/api/statsBOM request statisticsToken

15.3 Project File Structure

backend/ server.js Entry point — Express app, middleware, inline routes .env Environment variables (SQL, JWT, ports) routes/ Modular route handlers sap.js SAP lookups & GRPO gstr1.js, gstr2.js, itc04.js GST report routes projects.js Project CRUD & approvals costing.js P&L and costing routes balanceSheet.js Balance sheet route cashFlow.js Cash flow route salary.js Salary route costsheet.js Cost sheet route reports.js General reports generalLedger.js GL report vendors.js Vendor management businessMaster.js Business master data itemApproval.js Item approval workflow chatbot.js AI chatbot services/ Data access & business logic hanaStore.js Customer data store (SQL) hanaUsers.js User authentication & management sapServiceLayer.js SAP B1 Service Layer API client bomRequestStore.js BOM request persistence hanaItemStore.js Item data store hanaVendorStore.js Vendor data store projectStore.js Project data store costingStore.js Costing & P&L data store salaryStore.js Salary data store cashFlowStore.js Cash flow data store companyConfig.js Multi-company configuration sqlPool.js SQL connection pool middleware/ auth.js JWT verification middleware public/ Static frontend files index.html Home/dashboard page sidebar.js Shared sidebar navigation *.html Module-specific pages docs/ Documentation files

15.4 Deployment & Restart

To restart the portal server:

1. Stop the running process on port 5000 (e.g., taskkill /F /PID <process-id> or stop the service) 2. Navigate to the project directory: cd d:\Project\backend 3. Start the server: node server.js

The server will display connection status in the console. Wait for the "Database ready" message to confirm all services are initialized and available.