feat: 품질관리·대시보드·결재 양식 개선

- 품질관리 수주선택 필터링 + 검사 상태 자동 재계산
- 제품검사 요청서 Document(EAV) 자동생성 및 동기화
- 현황판 결재 카드 approvalOnly 스코프 + sub_label 추가
- 캘린더 어음 만기일 일정 연동
- QuoteStatService codebridge DB 커넥션 연결
- 테넌트 부트스트랩 기본 결재 양식 자동 시딩
This commit is contained in:
2026-03-10 11:29:56 +09:00
parent c46b950fde
commit bd500a87bd
7 changed files with 316 additions and 42 deletions

View File

@@ -44,23 +44,8 @@ public function aggregateDaily(int $tenantId, Carbon $date): int
")
->first();
// 상담 (sales_prospect_consultations)
$consultationCount = DB::connection('mysql')
->table('sales_prospect_consultations')
->whereDate('created_at', $dateStr)
->count();
// 영업 기회 (sales_prospects - tenant_id 없음, created_at 기반)
$prospectStats = DB::connection('mysql')
->table('sales_prospects')
->whereDate('created_at', $dateStr)
->whereNull('deleted_at')
->selectRaw("
COUNT(*) as created_count,
SUM(CASE WHEN status = 'contracted' THEN 1 ELSE 0 END) as won_count,
SUM(CASE WHEN status = 'lost' THEN 1 ELSE 0 END) as lost_count
")
->first();
// sales_prospect_consultations, sales_prospects는 codebridge DB에 이관되었고
// tenant_id가 없어 테넌트별 집계 불가 → 제외
StatQuotePipelineDaily::updateOrCreate(
['tenant_id' => $tenantId, 'stat_date' => $dateStr],
@@ -71,14 +56,9 @@ public function aggregateDaily(int $tenantId, Carbon $date): int
'quote_rejected_count' => $quoteStats->rejected_count ?? 0,
'quote_conversion_count' => $conversionCount,
'quote_conversion_rate' => $conversionRate,
'prospect_created_count' => $prospectStats->created_count ?? 0,
'prospect_won_count' => $prospectStats->won_count ?? 0,
'prospect_lost_count' => $prospectStats->lost_count ?? 0,
'prospect_amount' => 0, // sales_prospects에 금액 컬럼 없음
'bidding_count' => $biddingStats->cnt ?? 0,
'bidding_won_count' => $biddingStats->won_count ?? 0,
'bidding_amount' => $biddingStats->total_amount ?? 0,
'consultation_count' => $consultationCount,
]
);
@@ -90,4 +70,4 @@ public function aggregateMonthly(int $tenantId, int $year, int $month): int
// 견적 도메인은 일간 테이블만 운영 (월간은 Phase 4에서 필요시 추가)
return 0;
}
}
}