workPro Documentation
DC-Wise Reports
DCWISE_QUICK_REFERENCE.md

Quick Reference: Item Info Popup with DC-wise Drilldown

What's New?

Item Popup now shows quantities broken down by EACH Distribution Center (DC)

Instead of just showing total quantities, users can now see:

  • How many items each DC has ordered (BOQ Qty)
  • How many items each DC has completed (Done Qty)
  • Completion percentage for each DC
  • Summary totals across all DCs

Usage

  1. Click any Item Code in the All Work table
  2. Modal opens showing item details
  3. DC-wise Quantities table appears displaying:
    • DC Name (name of each distribution center)
    • BOQ Qty (Yellow) - items ordered for that DC
    • Done Qty (Green) - items completed for that DC
    • % (Blue) - completion percentage (Done/BOQ * 100)
  4. Summary section shows overall totals

Files Changed

Modified:

  • public/all-work.php - Updated showItemInfo() function to use new API

Created:

  • public/api/item-info-drilldown.php - New API for DC-wise quantities
  • Documentation files (this file and others)

Technical Details

API Response Structure

{
  "item": { itemCode, itemName, uom, imagePath, ... },
  "dcWiseQuantities": [
    { dcName: "DC1", boqQuantity: 100, doneQuantity: 45 },
    { dcName: "DC2", boqQuantity: 80, doneQuantity: 65 }
  ],
  "summary": { 
    totalBoqQuantity: 180, 
    totalDoneQuantity: 110,
    completionPercentage: 61.11
  }
}

Database Queries Used

  1. Fetch item from workpro.item table
  2. Group BOQ entries by dcId with SUM(totalQty) for BOQ Qty
  3. Use subquery through work table to get Done Qty per DC
  4. Calculate completion % = (Done / BOQ) * 100

Color Coding

Element Color Hex
Item Code / DC Headers Cyan #0dcaf0
BOQ Quantities Gold #ffc107
Done Quantities Green #28a745
Completion % Blue #17a2b8
Table Background Dark #0d1117

Example Output

┌────────────────────────────────────────────────────────┐
│ Item Code: IGL-001    Item ID: 5    UOM: Meter       │
├────────────────────────────────────────────────────────┤
│ Item Name: IGL Gas Distribution Pipe                 │
├────────────────────────────────────────────────────────┤
│ DC-wise Quantities                                     │
│ ┌──────────┬──────────┬──────────┬─────────┐         │
│ │ DC Name  │ BOQ Qty  │ Done Qty │ %       │         │
│ ├──────────┼──────────┼──────────┼─────────┤         │
│ │ New Delhi│   1000   │   800    │ 80.0%   │         │
│ │ Mumbai   │   800    │   500    │ 62.5%   │         │
│ │ Bangalore│   1200   │   0      │ 0%      │         │
│ └──────────┴──────────┴──────────┴─────────┘         │
│                                                        │
│ TOTAL: 3000 ordered | 1300 completed | 43.3% done   │
└────────────────────────────────────────────────────────┘

Key Improvements

  1. Multi-DC Visibility: See at a glance how each DC is progressing
  2. Performance Tracking: Identify which DCs are lagging
  3. Better Decision Making: Manage resources based on DC-level data
  4. Scalable: Works with any number of DCs
  5. User-Friendly: Clean table layout with color coding

Testing Checklist

  • [ ] Click Item Code → Modal opens
  • [ ] Modal displays item details
  • [ ] Table shows all DCs with data
  • [ ] Numbers are correct and align with database
  • [ ] Colors are properly applied
  • [ ] Completion % calculates correctly
  • [ ] Summary totals match manual calculation
  • [ ] No console errors in browser

Backward Compatibility

  • ✅ Old item-info.php API still works if needed
  • showItemInfo() function still accepts dcId parameter (for future use)
  • ✅ No breaking changes to existing code

Performance

  • Single API call retrieves all DC data
  • Efficient grouping at database level (no N+1 queries)
  • Scales well with additional DCs
  • Loads quickly even with large datasets

Next Steps / Future Enhancements

  1. Add ability to filter/export by DC
  2. Add charts showing DC-wise completion trends
  3. Add pagination if many DCs exist
  4. Add drill-down to see individual BOQs per DC
  5. Add comparison between DCs

Questions?

Refer to:

  • DCWISE_ITEM_DRILLDOWN_SUMMARY.md - Detailed technical documentation
  • DCWISE_VISUAL_REFERENCE.md - Visual layouts and diagrams
workPro Documentation | v1.3
Login to Dashboard