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.
| Component | Technology |
|---|---|
| Backend Runtime | Node.js with Express.js framework |
| Frontend | Vanilla HTML, CSS, and JavaScript (no framework) |
| Database | Microsoft SQL Server |
| SAP Integration | SAP B1 Service Layer REST API + Direct SQL queries |
| Authentication | JSON Web Tokens (JWT) with 12-hour expiry |
| Hosting | Windows Server, port 5000 |
| UI Library | Lucide Icons, Space Grotesk font |
| Validation | express-validator for input validation |
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.
Open a web browser and navigate to:
Users will see the login page. After authentication, they are redirected to the Home dashboard with the sidebar showing their permitted modules.
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.
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.
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.
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.
/production) — Create new production orders by selecting the product item, specifying quantity, planned dates, warehouse, and associated BOM. The system pulls BOM component details from SAP./issue-production) — Issue raw materials and components against an existing production order. Records material consumption from the warehouse to the production floor./receipt-production) — Receive finished goods back into inventory upon production completion. Updates stock quantities and records production output./close-production) — Close a production order after all materials have been issued and finished goods received. Finalizes the production cycle and locks the order from further transactions.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.
/purchase-request) — Initiate internal purchase requests specifying required items, quantities, preferred vendors, and required delivery dates. Serves as the starting point of the procurement workflow./purchase-quotation) — Manage vendor quotations received against purchase requests. Compare pricing, terms, and delivery schedules from multiple vendors to select the best offer./purchase-order) — Create and manage purchase orders sent to vendors. Generated from approved quotations or created directly, these orders formalize the commitment to purchase goods or services./grpo) — Record the receipt of goods against purchase orders. Verifies delivered quantities, updates inventory stock, and triggers accounts payable entries in SAP B1. Supports partial receipts and multi-line document processing.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.
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.
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.
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.
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.
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.
project_approver roleThe 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.
/costing-pl) — View monthly profit and loss statements with revenue, cost of goods sold, operating expenses, and net profit calculations. Data is sourced from SAP GL accounts with costing store snapshots for period comparisons./costing-comparison) — Compare profit and loss performance across multiple periods. Enables month-over-month and year-over-year variance analysis for financial planning./cost-sheet) — Detailed cost breakdown analysis showing direct costs, overhead allocations, and cost center-wise expenditure summaries./balance-sheet) — View the company's balance sheet with assets, liabilities, and equity sections. Pulls account balances from SAP GL accounts organized by the chart of accounts hierarchy./cash-flow) — Cash flow statement showing operating, investing, and financing activities. Tracks cash inflows and outflows for liquidity management./salary) — Salary management and reporting module for processing and viewing employee salary data. Managed through a dedicated salary store with its own data tables.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.
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.
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.
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.
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.
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.
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.
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.
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.
| Variable | Description |
|---|---|
PORT | Server port (default: 5000) |
JWT_SECRET | Secret key for JWT token signing |
SQL_HOST | SQL Server hostname/IP |
SQL_PORT | SQL Server port |
SQL_USER | SQL Server username |
SQL_PASSWORD | SQL Server password |
SQL_DATABASE | SAP B1 database name |
BOM_APPROVAL_LEVELS | Number of BOM approval levels (2, 3, or 4) |
CUST_APPROVAL_LEVELS | Customer approval levels (default: 2) |
| Route Prefix | Description | Auth |
|---|---|---|
/api/auth | Login, profile, token verification | Public / Token |
/api/users | User CRUD (admin) | sap_adder+ |
/api/bom-requests | BOM create/update/approve/reject | Token |
/api/customers | Customer registration & approval | Public / Token |
/api/vendors | Vendor registration & management | Token |
/api/sap | SAP lookups (items, warehouses, GL, tax, etc.) & GRPO | Token |
/api/projects | Project CRUD & approvals | Token |
/api/item-approvals | Item creation approval workflow | Token |
/api/costing | P&L, monthly accounts, cost analysis | Token |
/api/balance-sheet | Balance sheet data | Token |
/api/cash-flow | Cash flow statement data | Token |
/api/costsheet | Cost sheet report data | Token |
/api/salary | Salary data management | Token |
/api/gstr1 | GSTR-1 outward supply report | Token |
/api/gstr2 | GSTR-2 purchase register & TCS | Token |
/api/itc04 | ITC-04 job work report | Token |
/api/reports | General business reports | Token |
/api/general-ledger | GL account transaction report | Token |
/api/business-master | Business partner master data | Token |
/api/chat | AI chatbot assistant | Token |
/api/config | Portal configuration (approval levels) | Public |
/api/health | Health check endpoint | Public |
/api/stats | BOM request statistics | Token |
To restart the portal server:
The server will display connection status in the console. Wait for the "Database ready" message to confirm all services are initialized and available.