Sales Pipeline & Deal Management Business Logic¶
The sales pipeline system manages deals from initial contact through project conversion within the Stratpoint Timesheet Application. It integrates with Pipedrive CRM to track sales opportunities, forecast revenue, and manage sales budgets.
How Sales Pipeline Works¶
For Sales Teams: 1. Import deal data from Pipedrive CRM or create deals manually 2. Track deals through various pipeline stages with probability percentages 3. Set sales budgets by business unit, line of business, and client type 4. Generate forecasting reports and revenue predictions 5. Convert won deals into billable projects
For Management: 1. Monitor sales performance against budgets and targets 2. Review pipeline health and deal progression velocity 3. Analyze win/loss patterns and industry trends 4. Track revenue forecasts and achievement metrics 5. Make strategic decisions based on sales analytics
System Features: - Complete deal lifecycle management with stage progression - Pipedrive CRM integration for data synchronization - Multi-dimensional sales budget planning and tracking - Advanced forecasting with probability-weighted calculations - Industry classification and market analysis - Comprehensive sales analytics and reporting
Deal Lifecycle Management¶
Deal Status Flow¶
stateDiagram-v2
[*] --> Prospecting: New lead
Prospecting --> Scoping: Qualified opportunity
Scoping --> Proposing: Requirements defined
Proposing --> Negotiations: Proposal submitted
Negotiations --> Closing: Terms agreed
Closing --> Won: Deal signed
Closing --> Lost: Deal rejected
Won --> [*]: Convert to project
Lost --> [*]: Archive for analysis
Pipeline Stages and Probabilities¶
Low Probability (10-25%) - 10-Prospecting: Initial contact and qualification - 09-Scoping: Requirements gathering and needs assessment
Medium Probability (30-50%) - 08-Proposing: Proposal development and submission - 05-Extension: Contract extension negotiations
High Probability (60-80%) - 07-Negotiations Started: Active contract negotiations - 06-Final Proposal: Proposal submitted and under review - 04-Extension: Extension contracts in final stages - 03-Closing: Final approval and signing process
Confirmed Deals - 01-Booked: Signed contracts with purchase orders - 02-Booked - No PO: Signed but pending purchase order
Final Outcomes - 00a-Won: Successfully closed and converted to projects - 00b-Lost: Lost opportunities with analysis data - Deleted: Removed from active pipeline
What Each Stage Means¶
- Prospecting/Scoping: Early qualification and discovery phases
- Proposing: Active proposal development and presentation
- Negotiations: Contract terms and pricing discussions
- Closing: Final approvals and contract execution
- Booked: Confirmed deals ready for project initiation
Pipedrive Integration¶
How CRM Synchronization Works¶
flowchart TD
A[Pipedrive CRM] --> B[CSV Export]
B --> C[System Import]
C --> D[Field Mapping]
D --> E[Data Validation]
E --> F[Stage Synchronization]
F --> G[Historical Snapshots]
Import Process Details¶
- File Upload: CSV files from Pipedrive (maximum 5MB)
- Automatic Mapping: Pipedrive fields mapped to internal structure
- Data Validation: Comprehensive validation of dates, amounts, and stages
- Duplicate Handling: Smart detection of existing vs. new deals
- Stage History: Complete progression tracking from import
- Client Matching: Automatic organization-to-client mapping
What Gets Imported¶
- Deal ID and title from Pipedrive
- Stage information and progression history
- Deal amounts and currency data
- Client/organization details
- Sales person assignments
- Creation and update timestamps
- Expected close dates
Sales Budget Management¶
Budget Structure¶
Sales budgets are organized across multiple dimensions:
Organizational Dimensions: - Business Unit: Technology, Consulting, Operations, etc. - Line of Business: Service categories and offerings - Sales Person: Individual sales responsibility
Client Categories: - Existing Client: Growth targets for current accounts - New Business: Net new client acquisition targets
Budget Planning Process¶
flowchart TD
A[Annual Planning] --> B[Set Overall Targets]
B --> C[Allocate by Business Unit]
C --> D[Distribute by Line of Business]
D --> E[Assign to Sales People]
E --> F[Monthly Distribution]
F --> G[Performance Tracking]
Monthly Budget Distribution¶
- Flexible Allocation: Supports uneven monthly distribution
- Seasonal Adjustments: Accommodates business cycles
- Performance Tracking: Monthly achievement monitoring
- Variance Analysis: Budget vs. actual comparison
Budget Types and Focus¶
- Existing Client Budgets: Account growth and expansion
- New Business Budgets: Market penetration and client acquisition
- Industry Specific: Targeted sector development
- Geographic Focus: Regional market expansion
Deal Progression and Tracking¶
Stage Progression Rules¶
- Forward Movement: Deals typically advance through stages sequentially
- Stage Jumping: System tracks unusual progressions for analysis
- Regression Handling: Backward movement indicates deal risks
- Velocity Metrics: Time spent in each stage for forecasting
Deal Information Tracking¶
- Deal Details: Title, description, and scope
- Financial Data: Deal value, currency, and payment terms
- Timeline: Expected close dates and milestone tracking
- Stakeholders: Sales person, client contacts, and decision makers
- Competition: Competitive landscape and positioning
Historical Analysis¶
- Stage Duration: Average time spent in each pipeline stage
- Conversion Rates: Stage-to-stage progression percentages
- Win/Loss Patterns: Success factors and failure analysis
- Seasonal Trends: Quarterly and annual performance patterns
Forecasting and Analytics¶
Revenue Prediction Models¶
flowchart LR
A[Deal Value] --> B[Stage Probability]
B --> C[Expected Value]
C --> D[Time Distribution]
D --> E[Revenue Forecast]
Forecasting Capabilities¶
- Probability-Weighted: Expected value calculations based on stage
- Time-Based: Revenue distribution over projected timelines
- Scenario Planning: Best case, worst case, and expected outcomes
- Historical Patterns: Trend analysis and seasonal adjustments
Key Analytics Features¶
- Pipeline Health: Deal quality and progression velocity
- Achievement Tracking: Budget vs. actual performance comparison
- Win Rate Analysis: Success rates by stage, sales person, and industry
- Competitive Intelligence: Win/loss analysis against competitors
Multi-Dimensional Reporting¶
By Business Dimension: - Business unit and line of business performance - Sales person individual and team metrics - Client relationship and account growth - Industry sector analysis and trends
By Time Period: - Monthly performance and trend analysis - Quarterly business reviews and planning - Annual achievement and strategic planning - Historical comparison and growth analysis
Industry Classification¶
Industry Management¶
- Classification System: Simple name-based industry categories
- Deal Categorization: Industry assignment for market analysis
- Trend Tracking: Industry-specific performance monitoring
- Market Intelligence: Competitive positioning by sector
Industry Analytics¶
- Market Penetration: Share analysis within specific industries
- Growth Opportunities: Expansion potential by sector
- Profitability Analysis: Margin comparison across industries
- Competitive Position: Market standing evaluation
Win/Loss Management¶
Won Deal Processing¶
When deals are successfully closed: 1. Status Update: Automatic progression to "Won" status 2. Project Creation: Optional initialization of delivery project 3. Revenue Activation: Integration with financial tracking systems 4. Budget Achievement: Credit toward sales targets and quotas 5. Performance Metrics: Sales person and team achievement tracking
Lost Deal Analysis¶
For unsuccessful opportunities: 1. Status Assignment: Classification as "Lost" with preservation of data 2. Reason Documentation: Capture specific loss reasons for learning 3. Competitive Analysis: Track losses to specific competitors 4. Pattern Recognition: Identify common failure points 5. Process Improvement: Use insights for sales methodology enhancement
Success Metrics¶
- Overall Win Rate: Percentage of deals successfully closed
- Stage-Specific Rates: Conversion rates at each pipeline stage
- Sales Performance: Individual and team achievement metrics
- Market Analysis: Win rates by industry and client type
Technical Implementation Details¶
For developers and system administrators
Core API Endpoints¶
Deal Management:
// Pipedrive import processing
POST /deals/import_pipedrive
{
"file": "pipedrive_export.csv",
"mapping": {
"deal_id": "Pipedrive Deal ID",
"title": "Deal Title",
"stage": "Stage",
"value": "Deal Value"
}
}
// Deal status and stage updates
PUT /deals/{id}/status
{
"stage": "07-Negotiations Started",
"probability": 70,
"notes": "Contract terms under review"
}
Sales Budget Management:
// Budget creation and management
POST /api/v2/sales-budgets
{
"year": 2024,
"businessUnit_id": 1,
"businessLine_id": 2,
"salesUser_id": 123,
"budgetType": "New Business",
"targetAmount": "500000.00",
"monthlyDistribution": [...]
}
// Achievement tracking
GET /api/v2/sales-budgets/achievement-report
POST /api/v2/sales-budgets/variance-analysis
Forecasting and Analytics:
// Pipeline forecasting
POST /api/v2/deals/pipeline-forecast
{
"startDate": "2024-01-01",
"endDate": "2024-12-31",
"businessUnit_id": 1,
"confidence": "weighted"
}
// Deal progress analysis
GET /api/v2/deals/progress-analysis
POST /api/v2/deals/win-loss-report
Database Schema¶
Deal Model Structure:
// Core deal fields
'title' => 'Deal name and description (required)',
'client_id' => 'Client organization assignment (required)',
'businessUnit_id' => 'Business unit responsibility (required)',
'businessLine_id' => 'Line of business classification (required)',
'salesUser_id' => 'Sales person assignment (required)',
'stage' => 'Current pipeline stage (required)',
'dealValue' => 'Total deal amount (required)',
'currency_id' => 'Currency assignment (required)',
'expectedCloseDate' => 'Projected closure date (nullable)',
'probabilityOfClosing_id' => 'Stage probability reference (required)',
// Pipedrive integration fields
'pipedriveId' => 'Original Pipedrive deal ID (nullable)',
'pipedriveStage' => 'Original Pipedrive stage name (nullable)',
'dealExtractedDate' => 'Import timestamp (nullable)',
'dealCreatedDate' => 'Original creation date (nullable)',
'dealUpdatedDate' => 'Last update timestamp (nullable)',
'dealClosedOn' => 'Actual closure date (nullable)',
// Business classification
'industry_id' => 'Industry classification (nullable)',
'dealType' => 'Deal category classification (nullable)',
'notes' => 'Additional deal information (nullable)'
Sales Budget Model:
// Budget structure fields
'year' => 'Budget year (required)',
'businessUnit_id' => 'Business unit assignment (required)',
'businessLine_id' => 'Line of business (required)',
'salesUser_id' => 'Sales person responsibility (required)',
'budgetType' => 'Existing Client or New Business (required)',
'client_id' => 'Specific client (for existing client budgets)',
'clientOthers' => 'New business client description (nullable)',
'targetAmount' => 'Total annual target (required)',
// Monthly distribution
'january' => 'January target amount',
'february' => 'February target amount',
// ... (continued for all months)
'december' => 'December target amount'
Deal Stage History:
// Stage progression tracking
'deal_id' => 'Deal reference (required)',
'fromStage' => 'Previous stage (nullable)',
'toStage' => 'New stage (required)',
'changeDate' => 'Date of stage change (required)',
'changedBy' => 'User who made the change (required)',
'notes' => 'Reason for change (nullable)',
'probabilityChange' => 'Probability adjustment (nullable)'
Pipedrive Integration Implementation¶
CSV Import Processing:
// Actual import validation rules
'Deal ID' => 'required|unique:deals,pipedriveId',
'Title' => 'required|string|max:255',
'Stage' => 'required|string',
'Value' => 'required|numeric|min:0',
'Expected Close Date' => 'nullable|date',
'Organization' => 'required|string'
Field Mapping Logic:
// Mapping Pipedrive to internal fields
$dealData = [
'title' => $row['Title'],
'pipedriveId' => $row['Deal ID'],
'pipedriveStage' => $row['Stage'],
'dealValue' => floatval(str_replace(',', '', $row['Value'])),
'expectedCloseDate' => parseDate($row['Expected Close Date']),
'dealExtractedDate' => now(),
'stage' => mapPipedriveStage($row['Stage']),
'probabilityOfClosing_id' => getProbabilityByStage($mappedStage)
];
Data Validation Framework: - File size validation (maximum 5MB) - CSV structure and header validation - Required field presence checking - Data type and format validation - Business rule validation (dates, amounts, stages) - Duplicate detection and handling
Probability and Stage Management¶
Probability of Closing Model:
// Stage probability definitions
'description' => 'Stage name (required)',
'percentage' => 'Probability percentage (0-100)',
'pipeline' => 'Pipeline category (HIGH, MED, LOW, BOOKED)',
'isActive' => 'Stage availability flag',
'sortOrder' => 'Display sequence order'
Stage Business Rules: - Each stage has fixed probability percentage - Stage progression tracked with complete history - Backward movement flagged for analysis - Won/Lost outcomes tracked separately - Deleted deals preserved for historical analysis
Sales Budget Management System¶
Budget Validation Rules:
// Budget creation validation
'year' => 'required|integer|min:2020|max:2030',
'targetAmount' => 'required|numeric|min:0',
'budgetType' => 'required|in:Existing Client,New Business',
'monthlyTotal' => 'required|equals:targetAmount'
Monthly Distribution Logic:
// Monthly budget allocation
public function validateMonthlyDistribution($data)
{
$monthlyTotal = array_sum([
$data['january'], $data['february'], $data['march'],
$data['april'], $data['may'], $data['june'],
$data['july'], $data['august'], $data['september'],
$data['october'], $data['november'], $data['december']
]);
return $monthlyTotal == $data['targetAmount'];
}
Forecasting and Analytics Engine¶
Pipeline Forecasting Implementation:
// Probability-weighted forecasting
public function calculatePipelineForecast($filters)
{
$deals = Deal::active()
->with(['probabilityOfClosing', 'client', 'businessUnit'])
->when($filters['businessUnit_id'], function($q, $bu) {
return $q->where('businessUnit_id', $bu);
})
->get();
$forecast = $deals->map(function($deal) {
return [
'dealValue' => $deal->dealValue,
'weightedValue' => $deal->dealValue * ($deal->probabilityOfClosing->percentage / 100),
'expectedClose' => $deal->expectedCloseDate,
'stage' => $deal->stage
];
});
return $forecast;
}
Deal Progress Analysis:
// Week-over-week progression tracking
public function analyzeDealProgress($startDate, $endDate)
{
$stageChanges = DealStageHistory::whereBetween('changeDate', [$startDate, $endDate])
->with(['deal', 'user'])
->get()
->groupBy(['deal_id', 'changeDate']);
return $stageChanges->map(function($changes) {
return [
'forward_movement' => $changes->where('stage_direction', 'forward')->count(),
'backward_movement' => $changes->where('stage_direction', 'backward')->count(),
'average_days_in_stage' => $changes->avg('days_in_previous_stage')
];
});
}
Industry Classification System¶
Industry Model Structure:
// Simple industry classification
'name' => 'Industry name (required, unique)',
'description' => 'Industry description (nullable)',
'isActive' => 'Availability flag (default: true)',
'deleted_at' => 'Soft deletion timestamp (nullable)'
Industry Analytics Queries:
-- Deal distribution by industry
SELECT i.name, COUNT(d.id) as deal_count, SUM(d.dealValue) as total_value
FROM industries i
LEFT JOIN deals d ON i.id = d.industry_id
WHERE d.stage NOT IN ('00b-Lost', 'Deleted')
GROUP BY i.id, i.name
ORDER BY total_value DESC;
External System Integration¶
NetSuite Integration:
// Won deal to project conversion
public function convertToProject($dealId)
{
$deal = Deal::findOrFail($dealId);
if ($deal->stage === '00a-Won') {
$project = Project::create([
'name' => $deal->title,
'client_id' => $deal->client_id,
'businessUnit_id' => $deal->businessUnit_id,
'projectManagerUserId' => $deal->salesUser_id,
'source_deal_id' => $deal->id,
'startDate' => now(),
'status' => 'Active'
]);
// Sync to NetSuite
$this->syncProjectToNetSuite($project);
return $project;
}
}
Performance Optimization: - Indexed queries for large deal datasets - Cached probability calculations - Optimized bulk import processing - Background job processing for heavy analytics
Reporting and Dashboard Data¶
Dashboard Metrics Structure:
{
"pipelineSummary": {
"totalValue": "2500000.00",
"weightedValue": "1250000.00",
"dealCount": 127,
"averageSize": "19685.04"
},
"stageDistribution": {
"prospecting": {"count": 45, "value": "450000.00"},
"proposing": {"count": 23, "value": "920000.00"},
"closing": {"count": 8, "value": "640000.00"}
},
"budgetAchievement": {
"target": "2000000.00",
"actual": "1650000.00",
"percentage": "82.5%"
}
}
This sales pipeline and deal management system provides comprehensive sales operations management with sophisticated forecasting, budget tracking, and analytics capabilities essential for enterprise sales organizations.