- "content": "## Overview\n\nEnterprise-scale ERP XL customization framework for pharmaceutical companies and retail chains. Developed custom callbacks, document processing workflows, and third-party system integrations using Comarch Hydra SDK and XL API.\n\n## Key Projects\n\n### Document Automation System\n\n- **Custom callbacks** for sales orders (ZS), invoices (FS/FZ), and warehouse documents (WZ/PZ)\n- **Dynamic UI extensions** - buttons, forms, and validation logic injected into standard ERP windows\n- **Batch processing** - automated document state changes, price updates, and VAT corrections\n- **Real-time validation** - business rule enforcement before document confirmation\n\n### Pharmacy Chain Integration (OLMED)\n\n- **OSOZ-EDI parser** - processing government reporting files for pharmaceutical transactions\n- **GIF/NFZ compliance** - automated reporting to Polish health authorities\n- **Multi-pharmacy synchronization** - centralized inventory and pricing across 9 locations\n- **Prescription validation** - real-time checks against government databases\n\n### Retail DRS Integration (Deposit Return System)\n\n- **Bottle deposit tracking** - automatic VAT and pricing calculations for returnable packaging\n- **XML export/import** - bi-directional data exchange with DRS provider systems\n- **Document splitting** - separating deposit transactions from regular sales\n- **Reconciliation reporting** - monthly settlement reports with providers\n\n### Payment Processing Automation\n\n- **Card payment reconciliation** - automated matching of terminal reports to ERP documents\n- **Avista integration** - API connector for payment gateway\n- **Multi-currency handling** - automatic exchange rate application and adjustment posting\n- **Cash register integration** - daily closure automation with variance reporting\n\n## Technical Architecture\n\n### Callback Framework\n\nSubscribeProcedure attribute for invoice customization with dynamic button injection and event handling.\n\n### API Integration Layer\n\n- **ModifyShowedDocument** pattern - editing open documents without closing\n- **Session management** - thread-safe API access with automatic cleanup\n- **Transaction handling** - atomic operations with rollback support\n- **Batch mode** - high-performance bulk processing\n\n### Database Operations\n\n- **ORM abstraction** - LinqToDB for type-safe queries\n- **Stored procedures** - complex business logic in T-SQL\n- **Dynamic SQL** - runtime-generated queries for flexible reporting\n- **Connection pooling** - optimized database access patterns\n\n## Challenges and Solutions\n\n### Performance Optimization\n\n**Challenge:** XML parsing causing 30-second delays on large invoice batches\n\n**Solution:** Moved processing to SQL functions, reduced time to under 2 seconds\n\n### Thread Safety\n\n**Challenge:** Callback events firing from different threads causing race conditions\n\n**Solution:** Implemented AttachThreadToClarion pattern with proper synchronization\n\n### API Limitations\n\n**Challenge:** XL API doesn't support all document field modifications\n\n**Solution:** Hybrid approach - API for structural changes, direct SQL for edge cases\n\n### User Experience\n\n**Challenge:** Long-running operations blocking UI\n\n**Solution:** Progress indicators, async processing, and incremental updates\n\n## Integration Points\n\n- **Comarch ERP XL API** (v20250) - document manipulation and business logic\n- **SQL Server** - CDN database schema with custom tables and procedures\n- **External EDI systems** - XML-based data exchange\n- **Payment gateways** - REST API integration (Avista, Przelewy24)\n- **Government systems** - OSOZ, GIF, NFZ reporting portals\n\n## Tech Stack\n\n- C# / .NET Framework 4.8 - compatibility with ERP XL runtime\n- Comarch Hydra SDK - callback framework and UI extensions\n- SQL Server 2019 - database backend\n- LinqToDB - ORM for type-safe data access\n- WinForms - custom dialog windows\n- XML/XSLT - document transformations\n\n## Delivered Value\n\n- 24-64 hour project cycles - rapid development and deployment\n- 120 PLN/hour partner rate - cost-effective custom development\n- Zero downtime deployments - callbacks loaded without ERP restart\n- Regulatory compliance - automated JPK, VAT-7, and pharmaceutical reporting\n- Process automation - eliminated manual data entry and reconciliation tasks\n\n## Code Patterns\n\n### Event-Driven Architecture\n\nCallbacks with async event handlers for document processing with automatic form refresh.\n\n### Repository Pattern\n\nDatabase repository with async methods for type-safe document retrieval using LinqToDB.\n\n### Extension Methods\n\nCustom extension methods for ERP control value extraction and type conversion.\n\n## Project Highlights\n\n- **Multi-client deployments** - same codebase adapted for 5+ companies\n- **Version control** - Git with semantic versioning for callback DLLs\n- **Documentation** - comprehensive inline comments and technical guides\n- **Maintainability** - layered architecture with clear separation of concerns\n- **Extensibility** - plugin-based design for easy feature addition"
0 commit comments