Building a Multi-Company Stock and Consumption Web App from Excel

Multi-Company Architecture Disbursement Register Serverless Data Sync

Managing shared facilities across multiple entities creates constant recordkeeping friction. Facility administrators must track office supplies, pantry groceries, housekeeping chemicals, security guards and utility sub-meters across separate cost centers. Typically, these records sit inside monthly workbooks like Aug - 2026 ODMSLLP Monthly Consumption.xlsx, burdened by complex tabs and formula errors.

This tutorial forms Part 2 of our series on converting spreadsheets into browser applications using artificial intelligence. Following Part 1's admin task register, this guide builds a complete multi-company consumption manager, stock ledger and manpower tracker running entirely client-side without server costs.

Series Part Application Focus Core Architectural Mechanism Curriculum Status
Part 1 Admin Task Register Task matrices, client-side encryption and priority timers Published in Series
Part 2 (Current) Stock and Consumption Manager Multi-company registers, attendance cycles and dynamic CSV sync Current Implementation Guide
Part 3 Expense Variance Dashboard Budget allocations, live Google Sheets sync and variance alerts Upcoming Tutorial

The Multi-Company Excel Dilemma: Why Shared Workbooks Collapse

Tracking supplies across operating units in Excel creates recurring friction. One business buys paper supplies, another covers water bills and security agencies invoice by attendance. Three core issues arise:

  • Formula Corruption: Thirty-one day columns across dozens of products slow calculation. Accidental edits overwrite carryover formulas, triggering inventory mismatches.
  • Mismatched Tracking Modes: Consumables require depletion math, guards require attendance cycles and meters require dual-reading formulas. Forcing these into one table format creates confusion.
  • Version Discrepancies: Emailing monthly sheets between warehouse staff and accounting causes version drift, obscuring real inventory balances.

Translating sheets, like our models for SOC Monthly Consumption Report in Excel and Ather Stock Allocation & Inventory, into a browser app delivers automated stock math, vendor filtering and structured synchronization.

Architectural Blueprint: Modeling Multi-Mode Data Structures

Before writing prompts or generating interface code, you must establish clear data structures. Unlike simple task logs, an industrial consumption manager must handle four distinct operational tracking behaviors within one centralized data store.

Tracking Mode Target Operations Data Flow and Calculation Logic Primary Interface Controls
Standard Inventory Stationery, printer toner, housekeeping items, medical kits Opening Stock + Received Orders - Daily Usage = Net Closing Stock Date input cells (1 to 31), vendor dropdowns, batch order modal
Manpower Attendance Outsourced security guards, supervisors, housekeeping teams Status cycle (P / A / H / WO). Total Present Days × Daily Wage Rate = Invoice Total Interactive toggle cells, weekend color coding, agency filter
Sub-Meter Utilities Floor electricity meters, generator lines, backup circuits Closing Meter Reading - Opening Meter Reading = Consumed kWh × Unit Rate Meter identifier badges, start/end reading fields, power alerts
Bulk Liquid Supplies Drinking water cans, commercial water tankers, bulk lubricants Daily delivered count × Contract unit rate = Department billing Daily intake fields, supplier selection, unit voucher tags

To communicate these requirements to an artificial intelligence model, specify explicit operational rules. Detail business relationships, master catalog tabs, status rules and layout structures in your prompt.

Claude chat prompt defining multi-company consumption logic, attendance modes, utility forms and data synchronization rules

Prompt engineering breakdown: Defining business rules, master tabs, attendance cycles and data flows before generating code.

Prompt Structuring Rule: Divide prompts into functional blocks: entities, tracking modes, calculation formulas, default vendor records and sync rules. Providing authentic vendor names like Veebha or Sumant ensures realistic data structures rather than empty mockups.

Core Interface Tour: From Secure Sign-In to Real-Time Dashboards

The web application, ODMSLLP ConsumPro, unites facility workflows in a single browser window. A client-side authentication modal prevents unauthorized edits to daily records.

ODMSLLP ConsumPro authentication modal showing login credentials and multi-company tracking system header

Lightweight client-side authentication modal with pre-configured administrative and staff role access.

After sign-in, the Monthly Summary Dashboard provides high-level metric cards and an itemized matrix. Executives quickly review active items, cycle days, order counts and total consumption value in Indian Rupees (₹).

Multi-company consumption dashboard showing KPI metric cards, period days, rupee expense totals and category summary matrix

Executive summary view aggregating company expenses, tracked item counts and department disbursements in Indian Rupees.

The summary matrix groups items by mode. Consumables show unit counts, while security and housekeeping show attendance days. Every row calculates expenditure in Indian Rupees (₹), enabling immediate departmental budget checks.

The Daily Disbursement Ledger: Live Consumption and Stock Math

The Register view acts as the daily ledger. Supervisors select company, consumption category, month and vendor from the header filter bar.

Daily disbursement register grid with day columns 1 to 31, opening stock carryover, received orders and rupee unit rates

Daily consumption tracking matrix with automated opening stock flow, bulk order entry and live closing balance math.

The register incorporates four automated capabilities:

  1. Automatic Stock Carryover: Opening stock imports the prior month closing balance, eliminating re-entry errors across billing cycles.
  2. Interactive Day Columns: Staff log daily usage across thirty-one date cells. Total consumption and closing balances recalculate instantly.
  3. Order Quantities Panel: Entering new stock arrivals in the bottom panel adds units directly to available inventory.
  4. Financial Valuation: Contracted rates in Indian Rupees (₹), such as A4 Paper at ₹230 per box or Toner at ₹450 per unit, multiply by usage to compute monthly expense totals.

Managing Master Entities: Products, Manpower and User Permissions

Centralized master tables maintain operational consistency across nine dedicated panels: Companies, Consumption Types, Vendors, Items, Employees, Electricity Meters, Rates, Months and Users.

Configuring Product and Material Masters

Facility managers register new items with their commercial parameters: company entity, material category, vendor, brand, unit of measure, tax HSN code and default rupee rate.

Inventory master panel showing item registration form with brand, unit of measure, HSN code and default rupee rate fields

Centralized product catalog form establishing standard units of measure, vendor links and baseline item rates in Indian Rupees.

Configuring Outsource Manpower and Guard Rosters

The Employee master panel connects guards, supervisors and cleaners to authorized vendor agencies like Gallent Security, OOPL Services or Imperial Services.

Employee master management panel linking security guards and housekeepers to vendor agencies with per-day wage rates

Manpower configuration table assigning staff to outsourced vendor agencies alongside day wage rates for automated billing.

Each profile stores an employee ID, designation and day rate in Indian Rupees (₹), from ₹400 daily for cleaners to ₹700 for security supervisors. Clicking attendance cells cycles states: Present (P), Absent (A), Half Day (H) and Weekly Off (WO), automatically calculating agency invoice totals.

Role-Based Access Control and Granular Permissions

Floor staff should record daily usage without permissions to alter contractual rates. The Users panel provides granular controls for each profile.

User administration and role-based permissions panel showing granular access toggle chips for staff and administrator accounts

Granular role-based access control panel assigning distinct view, register and sync permissions across user tiers.

Administrators configure six permissions: Dashboard, Register, Master, Sync, Data Entry and Orders. Staff accounts can be locked strictly to data entry, shielding master records from accidental edits.

Debugging AI-Generated Web Apps: Resolving Script and DOM Failures

Building single-file applications with generative artificial intelligence frequently produces subtle runtime bugs. During our initial build of ODMSLLP ConsumPro, the application halted due to JavaScript compilation errors in the browser console. Knowing how to diagnose and resolve these issues is essential when assembling AI software.

Browser Error Code Underlying Root Cause Operational Impact Engineering Resolution
SyntaxError: Invalid or unexpected token Shell scripts writing code via heredocs double-escaped newline characters (\\n inside string templates) Browser halts JavaScript parsing; entire application fails to initialize Write script blocks using direct file generation or clean Python string writers without shell escaping
ReferenceError: doLogin is not defined Top-level DOM event listeners executed before the HTML document finished loading, throwing unhandled exceptions Script execution crashes before function declarations are processed in memory Defer all DOM event binding until DOMContentLoaded or inside an explicit initAll() lifecycle function
TypeError: Cannot read properties of null Company filter dropdown attempted to call loadRegister() before dependent category options were populated Register grid renders blank or throws null pointer errors upon selection Wire change handlers to cascade through dependency chains: onRegCoChange() → populate types → loadRegister()

The most common failure in AI web tools stems from premature Document Object Model access. If an AI script places document.getElementById('reg-co').addEventListener(...) at the top level of a <script> block, the browser executes that line before the corresponding <select> tag is parsed. This immediately halts script execution. As documented in the official MDN Web Docs on Document Object Model (DOM), scripts must always defer element access until the document structure is fully ready.

The snippet below shows the production pattern for safe lifecycle initialization and state synchronization using localStorage:

// Safe lifecycle initialization pattern
document.addEventListener('DOMContentLoaded', function() {
  // Load persistent application state from browser localStorage
  loadApplicationState();
  
  // Attach event listeners only after DOM elements are ready
  setupEventListeners();
});

function setupEventListeners() {
  var coSelect = document.getElementById('reg-co');
  if (coSelect) {
    coSelect.addEventListener('change', onRegCoChange);
  }
}

function onRegCoChange() {
  // Populate dependent category dropdowns before rendering grid
  updateCategoryDropdown();
  loadRegister();
}

function calculateClosingStock(opening, orders, dailyArray) {
  var totalUsage = dailyArray.reduce(function(acc, val) {
    return acc + (Number(val) || 0);
  }, 0);
  return (Number(opening) || 0) + (Number(orders) || 0) - totalUsage;
}

This organized architecture ensures that data flows predictably, dropdown options populate in sequence and inventory formulas execute without runtime crashes.

Serverless Data Synchronization: Scoped Templates and Cloud Sync

Operational tools do not require costly database servers. Hosted SQL databases typically cost ₹2,500 to ₹15,000 monthly in subscriptions and maintenance. Using native browser APIs and structured file exchanges, our app delivers reliable sync at ₹0 infrastructure cost.

Data synchronization interface showing CSV JSON file import, Google Drive URL fetcher and scoped CSV template export tools

Serverless data synchronization suite supporting file uploads, Google Drive URL fetching and structured CSV template downloads.

The Sync panel delivers four data workflows:

  • Scoped CSV Template Generator: Generates formatted CSV templates scoped to specific companies and categories, pre-loaded with valid item codes and vendor names to avoid header errors.
  • Direct File Uploads: Supervisors import monthly numbers via CSV or JSON file readers, recalculating balances and updating localStorage in milliseconds.
  • Google Drive URL Fetching: Fetches shared Google Drive CSV links into browser memory for distributed teams.
  • JSON Backup Archives: Creates instant offline snapshots of master tables and transaction records, protecting against data loss.

For operations tracking utility sub-meters alongside inventory, this workflow pairs with our guide on Towal Tower Electricity & DG Billing to reconcile power meters and diesel stocks.

Operational Schema Repository

To help operations teams and developers adapt this framework, the complete source code, unpopulated data schemas and sample test records are available in our public repository. Inspect the HTML structure, CSS rules and JavaScript logic to adapt them for your workflows.

Operational Schema Repository

Examine the clean, unpopulated ledger schema and starter web code in our project repository.

Inspect Blank Ledger Schema on GitHub

Transitioning from fragile spreadsheets to interactive client-side web tools gives companies faster entries, automated stock reconciliation and clear accountability. If your facility manages unique utility rate slabs or seasonal attendance shifts, leave a comment below and let us know how you handle daily stock reconciliation.

Subham Ghadge

Subham Ghadge

Verified Lead Author

Operations Analytics Specialist and creator of Subu Data Labs. Developing corporate spreadsheet frameworks, automated utility billing engines, custom VBA macros, and full-stack web applications.

Next Article →

Comments

Subu Data Labs | Excel to Web Apps, Dashboards & Automation

Contact form

Name

Email *

Message *