DEV Community

zikarelhub
zikarelhub

Posted on

Automating Nigerian Business Operations — Approvals, Inventory, Payroll and Reporting

Most Nigerian businesses run critical operations through WhatsApp and Excel. Here is the technical implementation of the automation that replaces them.

1. Approval Workflow — Replace WhatsApp

// Every approval: routed, timestamped, audit-logged
async function createApprovalRequest({ type, amount, requestedBy, description }) {
  const approver = await getApprover(type, amount);
  const deadline = getDeadline(type); // Hours

  const request = await ApprovalRequest.create({
    type, amount, requestedBy, description,
    approverId: approver.id,
    status: 'PENDING',
    reference: await generateReference(type), // Unique reference
    deadline: new Date(Date.now() + deadline * 3600000)
  });

  // Notify via system — not personal WhatsApp
  await notifyApprover(approver.id, request);

  // Auto-escalate if no response by deadline
  await scheduleEscalation(request.id, deadline);

  return request;
}

// Decision creates immutable audit log
async function processDecision(requestId, approverId, decision, comment) {
  await ApprovalRequest.update(
    { status: decision, decidedBy: approverId, decidedAt: new Date(), decisionComment: comment },
    { where: { id: requestId, approverId } }
  );

  // Immutable — never update or delete
  await AuditLog.create({
    action: `APPROVAL_${decision}`,
    entityId: requestId,
    performedBy: approverId,
    timestamp: new Date(),
    metadata: { comment }
  });
}
Enter fullscreen mode Exit fullscreen mode

2. Inventory — Replace Excel

// Stock updates atomically on every sale
async function recordSale(items, branchId) {
  const tx = await db.transaction();
  try {
    for (const item of items) {
      // Atomic deduction with row lock
      await Inventory.decrement('quantity', {
        by: item.quantity,
        where: { productId: item.productId, branchId },
        transaction: tx
      });

      // Check reorder point
      const inv = await Inventory.findOne({
        where: { productId: item.productId, branchId }, transaction: tx
      });
      if (inv.quantity <= inv.reorderPoint) {
        await triggerReorder(item.productId, branchId, tx);
      }
    }
    await tx.commit();
  } catch (e) { await tx.rollback(); throw e; }
}
Enter fullscreen mode Exit fullscreen mode

3. Payroll — Replace Excel

// Correct Nigerian PAYE, pension, NHF, NSITF — automated monthly
function calculateNigerianPayslip(employee) {
  const gross = employee.basicSalary + employee.allowances;

  // PAYE — CRA method, current bands
  const cra = Math.max(200_000, gross * 12 * 0.01) + (gross * 12 * 0.20);
  const taxable = Math.max(0, gross * 12 - cra - (employee.basicSalary * 12 * 0.08));
  const annualPAYE = calculateProgressiveTax(taxable);

  return {
    grossPay: gross,
    paye: Math.round(annualPAYE / 12),
    employeePension: Math.round(employee.basicSalary * 0.08),  // PenCom
    employerPension: Math.round(employee.basicSalary * 0.10),
    nhf: Math.round(employee.basicSalary * 0.025),             // NHF Act
    nsitf: Math.round(gross * 0.01),                           // Employer
    netPay: Math.round(gross - annualPAYE / 12
      - employee.basicSalary * 0.08
      - employee.basicSalary * 0.025)
  };
}
Enter fullscreen mode Exit fullscreen mode

4. n8n Daily Report — Replace Thursday Compilation

// Runs 7am weekdays — CEO has report before work starts
const dailyReportWorkflow = {
  trigger: { cron: '0 7 * * 1-5' },
  steps: [
    'Query: yesterday sales by branch',
    'Query: low stock alerts',
    'Query: pending approvals summary',
    'Format: CEO report email',
    'Send: email to CEO',
    'Send: WhatsApp summary to CEO'
  ]
  // Real-time data. Not Thursday's compilation.
};
Enter fullscreen mode Exit fullscreen mode

ZikarelHub LTD is Nigeria's #1 software and digital agency — business automation from n8n workflows to full custom ERP.

What manual process in your Nigerian business consumes the most time? 👇

Top comments (0)