Skip to content

Financial Operations Business Logic

The financial operations system manages all financial processes within the Stratpoint Timesheet Application, from invoice generation to payment tracking and accounting system integration. It bridges project work with revenue recognition and financial reporting.

How Financial Operations Work

For Finance Team: 1. Generate invoices based on approved timesheets and milestones 2. Track payment statuses and collection activities 3. Manage accounts receivable and aging reports 4. Integrate with NetSuite accounting system 5. Monitor revenue recognition and compliance

For Project Managers: 1. Set up payment milestones for project billing 2. Track milestone completion and approval status 3. Monitor project revenue and billing progress 4. Generate client billing reports

For Business Leaders: 1. Access real-time financial performance data 2. Monitor cash flow and receivables aging 3. Track revenue by business unit and client 4. Analyze profitability and margin trends

System Features: - Automated invoice generation from approved work - Payment milestone tracking and billing - Accounts receivable management - Collection notice automation - NetSuite ERP integration - Multi-currency support for international clients

Payment Milestone Management

How Payment Milestones Work

Payment milestones are specific deliverables or project phases that trigger billing events:

flowchart LR
    A[Milestone Defined] --> B[Work Completed]
    B --> C[Client Approval]
    C --> D[Invoice Generated]
    D --> E[Payment Received]

Milestone Types

  • Deliverable-Based: Billing triggered by completion of specific deliverables
  • Time-Based: Monthly or periodic billing cycles
  • Percentage-Based: Billing based on project completion percentage
  • Hybrid: Combination of deliverable and time-based billing

Milestone Configuration

  • Amount: Payment value in project currency
  • Due Date: When payment should be received
  • Description: What deliverable triggers the payment
  • Approval Requirements: Who needs to approve before billing
  • Currency: Local or foreign currency billing

Invoice Generation Process

Automatic Invoice Creation

The system automatically generates invoices based on:

flowchart TD
    A[Approved Timesheets] --> B[Calculate Billable Hours]
    B --> C[Apply Billing Rates]
    C --> D[Add Milestone Amounts]
    D --> E[Generate Invoice]
    E --> F[Send to Client]

Invoice Types

  • Time & Materials: Based on approved timesheet hours at agreed rates
  • Fixed Price: Based on completed milestones or percentage completion
  • Monthly Recurring: Regular monthly invoicing for ongoing services
  • Ad-hoc: Special invoices for additional work or adjustments

Invoice Information

  • Invoice Number: System-generated unique identifier
  • Billing Period: Date range covered by the invoice
  • Line Items: Detailed breakdown of work or milestones
  • Tax Calculations: VAT, withholding tax, and other applicable taxes
  • Payment Terms: Due date and payment instructions

Accounts Receivable Management

Payment Tracking

Track the complete payment lifecycle from invoice to collection:

Payment Status Flow: 1. Billed: Invoice sent to client 2. Partially Paid: Partial payment received 3. Paid: Full payment received 4. Overdue: Payment past due date 5. Under Collection: Active collection efforts

Aging Analysis

Monitor how long invoices remain unpaid: - Current: Within payment terms - 1-30 Days: Recently overdue - 31-60 Days: Moderately overdue - 61-90 Days: Significantly overdue - 90+ Days: Severely overdue, may require legal action

Collection Management

Automated system for managing overdue payments: - First Notice: Initial reminder sent automatically - Second Notice: Follow-up with stronger language - Final Notice: Final warning before escalation - Legal Action: Escalation to legal department

Revenue Recognition

Revenue Models

  • Cash Basis: Revenue recognized when payment is received
  • Accrual Basis: Revenue recognized when work is completed
  • Milestone Basis: Revenue recognized when milestones are approved
  • Percentage Completion: Revenue based on project completion percentage

Integration with Accounting

  • NetSuite Integration: Automatic journal entries and revenue posting
  • Unbilled Revenue: Track completed but not yet invoiced work
  • Deferred Revenue: Manage prepayments and deposits
  • Currency Conversion: Handle foreign exchange for international clients

Multi-Currency Operations

Currency Support

  • Local Currency (PHP): Philippine Peso for domestic clients
  • Foreign Currencies: USD, EUR, and other international currencies
  • Exchange Rate Management: Daily rate updates and conversions
  • Rate Lock: Fix exchange rates for specific contracts

Currency Impact

  • Invoice Generation: Bills in client's preferred currency
  • Payment Tracking: Records in both invoice and local currency
  • Financial Reporting: Converts to PHP for consolidated reporting
  • Tax Calculations: Applies appropriate tax rates based on currency

Financial Reporting

Standard Financial Reports

  • Accounts Receivable Aging: Outstanding invoices by age
  • Revenue Analysis: Revenue trends and performance
  • Collection Reports: Payment collection effectiveness
  • Cash Flow Projections: Expected future cash receipts
  • Bad Debt Analysis: Uncollectible accounts tracking

Business Intelligence

  • Client Payment Patterns: Analysis of client payment behavior
  • Seasonal Trends: Revenue patterns throughout the year
  • Project Profitability: Margin analysis by project and client
  • Resource Utilization: Financial impact of team utilization

Compliance and Controls

Financial Controls

  • Approval Workflows: Multi-level approval for invoices and adjustments
  • Segregation of Duties: Separate roles for billing and collections
  • Audit Trail: Complete history of all financial transactions
  • Reconciliation: Regular matching with external systems

Regulatory Compliance

  • Tax Compliance: Proper tax calculation and reporting
  • Foreign Exchange: Compliance with BSP regulations
  • BIR Requirements: Philippine tax authority compliance
  • International Standards: IFRS and other applicable standards

Technical Implementation Details

For developers and system administrators

Core API Endpoints

Payment Milestone Management:

// Payment milestone CRUD operations
GET /api/v2/payment_milestones                    // List milestones
POST /api/v2/payment_milestones                   // Create milestone
PUT /api/v2/payment_milestones/{id}               // Update milestone
DELETE /api/v2/payment_milestones/{id}            // Delete milestone

// Milestone status updates
POST /api/v2/payment_milestones/updateStatus
{
    "milestoneId": 123,
    "status": "Paid",
    "paymentDate": "2024-03-15",
    "paymentAmount": "50000.00",
    "paymentReference": "BANK-REF-001"
}

Invoice Management:

// Invoice generation and management
POST /api/v2/invoices/generate                    // Generate invoice
GET /api/v2/invoices/{id}                         // Get invoice details
POST /api/v2/invoices/updatePaymentStatus        // Update payment status

// Bulk operations
POST /api/v2/invoices/bulkUpdateStatus           // Bulk status updates
POST /api/v2/invoices/generateMultiple          // Generate multiple invoices

Accounts Receivable:

// AR reports and management
POST /api/v2/accounts_receivable/agingReport     // AR aging analysis
POST /api/v2/accounts_receivable/collectionReport // Collection effectiveness
POST /api/v2/accounts_receivable/paymentForecast  // Cash flow projection

// Payment tracking
POST /api/v2/payments/recordPayment             // Record payment received
POST /api/v2/payments/allocatePayment           // Allocate to invoices

Database Schema

PaymentMilestone Model:

// Core payment milestone fields
'project_id' => 'Project assignment (required)',
'milestone' => 'Milestone description (required)',
'amount_rate' => 'Amount in project currency (required)',
'amount_rate_php' => 'Amount in Philippine Peso',
'due_date' => 'Payment due date (required)',
'start_date' => 'Milestone start date',
'status' => 'Milestone status (Pending, Billed, Paid)',
'approval_date' => 'Client approval date',
'billing_date' => 'Invoice generation date',
'date_paid' => 'Payment received date',
'invoice_number' => 'Generated invoice number',
'po_number' => 'Client purchase order number',
'currency_id' => 'Currency assignment',
'exchange_rate' => 'Exchange rate at billing time'

Invoice Model:

// Invoice tracking structure
'invoice_number' => 'System-generated invoice number (required)',
'project_id' => 'Project assignment (required)',
'client_id' => 'Client assignment (required)',
'invoice_date' => 'Invoice generation date (required)',
'due_date' => 'Payment due date (required)',
'amount' => 'Total invoice amount (required)',
'currency_id' => 'Currency assignment',
'status' => 'Invoice status (Draft, Sent, Paid, Overdue)',
'payment_terms' => 'Payment terms description',
'line_items' => 'JSON array of invoice line items',
'tax_details' => 'JSON array of tax calculations',
'netsuiteId' => 'NetSuite invoice ID'

Payment Model:

// Payment tracking structure
'invoice_id' => 'Invoice assignment (required)',
'payment_date' => 'Payment received date (required)',
'amount' => 'Payment amount (required)',
'currency_id' => 'Payment currency',
'exchange_rate' => 'Exchange rate at payment time',
'payment_method' => 'Payment method (Bank Transfer, Check, etc.)',
'reference_number' => 'Bank reference or check number',
'notes' => 'Payment notes and comments',
'recorded_by' => 'User who recorded the payment'

Milestone Status Management

Status Workflow:

// Milestone status progression
'Pending' => 'Initial state, work not yet started',
'In Progress' => 'Work is being performed',
'Completed' => 'Work finished, awaiting client approval',
'Approved' => 'Client has approved the deliverable',
'Billed' => 'Invoice has been generated and sent',
'Partially Paid' => 'Partial payment received',
'Paid' => 'Full payment received',
'Cancelled' => 'Milestone cancelled or removed'

Status Business Rules: - Only approved milestones can be billed - Payment amounts must match milestone amounts - Currency conversions recorded at payment time - Status changes trigger automatic notifications

Invoice Generation Logic

Time & Materials Calculation:

// Actual T&M invoice generation
public function generateTimeAndMaterialsInvoice($projectId, $startDate, $endDate)
{
    // Get approved timelogs for the period
    $timelogs = Timelog::where('project_id', $projectId)
        ->whereBetween('date', [$startDate, $endDate])
        ->where('status', 'Approved')
        ->with(['user', 'taskType'])
        ->get();

    $lineItems = [];
    $totalAmount = 0;

    foreach ($timelogs as $timelog) {
        $rate = $timelog->user->getProjectRate($projectId);
        $amount = $timelog->hours * $rate;

        $lineItems[] = [
            'description' => $timelog->taskType->name . ' - ' . $timelog->user->name,
            'hours' => $timelog->hours,
            'rate' => $rate,
            'amount' => $amount,
            'date' => $timelog->date
        ];

        $totalAmount += $amount;
    }

    return [
        'lineItems' => $lineItems,
        'totalAmount' => $totalAmount,
        'period' => ['start' => $startDate, 'end' => $endDate]
    ];
}

Fixed Price Calculation:

// Fixed price milestone billing
public function generateMilestoneInvoice($milestoneId)
{
    $milestone = PaymentMilestone::find($milestoneId);

    if ($milestone->status !== 'Approved') {
        throw new ValidationException('Milestone must be approved before billing');
    }

    $lineItems = [
        [
            'description' => $milestone->milestone,
            'amount' => $milestone->amount_rate,
            'currency' => $milestone->currency->code
        ]
    ];

    return [
        'lineItems' => $lineItems,
        'totalAmount' => $milestone->amount_rate,
        'milestone' => $milestone
    ];
}

NetSuite Integration

Export Functionality:

// NetSuite integration endpoints
POST /api/v2/netsuite/exportInvoices           // Export invoices to NetSuite
POST /api/v2/netsuite/exportPayments           // Export payments to NetSuite
POST /api/v2/netsuite/syncCustomers            // Sync client data
POST /api/v2/netsuite/reconcileAR              // Reconcile accounts receivable

// Data synchronization
POST /api/v2/netsuite/importPayments           // Import payments from NetSuite
POST /api/v2/netsuite/updateInvoiceStatus      // Update invoice status from NetSuite

Integration Process: 1. Invoice data exported to NetSuite CSV format 2. Customer master data synchronized 3. Payment data imported from NetSuite 4. Reconciliation reports generated 5. Variance analysis for discrepancies

Collection Notice Automation

Collection Process:

// Collection notice generation
public function generateCollectionNotice($paymentMilestoneId, $noticeLevel)
{
    $milestone = PaymentMilestone::find($paymentMilestoneId);
    $daysPastDue = Carbon::now()->diffInDays($milestone->due_date);

    $noticeTemplates = [
        1 => 'first_notice_template',
        2 => 'second_notice_template',
        3 => 'final_notice_template'
    ];

    $notice = new CollectionNotice([
        'payment_milestone_id' => $paymentMilestoneId,
        'notice_level' => $noticeLevel,
        'days_overdue' => $daysPastDue,
        'template' => $noticeTemplates[$noticeLevel],
        'sent_date' => Carbon::now(),
        'status' => 'Sent'
    ]);

    return $notice;
}

Currency Management

Currency Conversion:

// Currency conversion logic
public function convertCurrency($amount, $fromCurrencyId, $toCurrencyId, $effectiveDate = null)
{
    $effectiveDate = $effectiveDate ?: Carbon::now()->format('Y-m-d');

    $rate = ExchangeRate::where('from_currency_id', $fromCurrencyId)
        ->where('to_currency_id', $toCurrencyId)
        ->where('effective_date', '<=', $effectiveDate)
        ->orderBy('effective_date', 'desc')
        ->first();

    if (!$rate) {
        throw new ValidationException('Exchange rate not found for the specified date');
    }

    return [
        'converted_amount' => $amount * $rate->rate,
        'exchange_rate' => $rate->rate,
        'effective_date' => $rate->effective_date
    ];
}

Multi-Currency Support: - ExchangeRate Model: Daily exchange rate updates - Currency Model: Supported currency definitions - Automatic Conversion: Real-time conversion for reporting - Rate Locking: Fixed rates for long-term contracts

Permission System

Financial Operations Permissions: - Permission 150: Can view financial reports - Permission 151: Can generate invoices - Permission 152: Can record payments - Permission 153: Can manage collection notices - Permission 154: Can access NetSuite integration - Permission 155: Can manage exchange rates

Access Validation:

// Actual permission check pattern
if (!hasPermission($this->authUser, 150)) {
    return respondAccessNotAllowed('Financial Operations');
}

// Additional validation for sensitive operations
if ($operation === 'payment_adjustment' && !hasPermission($this->authUser, 152)) {
    return respondAccessNotAllowed('Payment Management');
}

Audit Trail Implementation

Financial Audit Tracking:

// Audit log structure
'table_name' => 'Table affected (invoices, payments, etc.)',
'record_id' => 'Primary key of affected record',
'action' => 'Action performed (create, update, delete)',
'old_values' => 'JSON of previous values',
'new_values' => 'JSON of new values',
'user_id' => 'User who performed the action',
'timestamp' => 'When the action occurred',
'ip_address' => 'Source IP address',
'reason' => 'Business justification for the change'

Performance Optimization

Financial Reporting Optimization: - Indexed queries for aging reports - Cached exchange rates for faster conversion - Materialized views for complex financial calculations - Background processing for bulk operations - Database partitioning for historical data

Business Rules Engine

Validation Rules:

// Invoice generation validation
'project_id' => 'required|exists:projects,id',
'milestone_id' => 'required|exists:payment_milestones,id',
'invoice_date' => 'required|date|before_or_equal:today',
'due_date' => 'required|date|after:invoice_date',
'amount' => 'required|numeric|min:0.01'

// Payment recording validation
'invoice_id' => 'required|exists:invoices,id',
'payment_date' => 'required|date|before_or_equal:today',
'amount' => 'required|numeric|min:0.01|max:outstanding_amount',
'reference_number' => 'required|unique:payments,reference_number'

This financial operations system is designed for enterprise financial management with comprehensive integration capabilities, multi-currency support, and full audit compliance specific to Stratpoint's business operations and regulatory requirements.