Initial commit
This commit is contained in:
375
.claude/plan-multi-page.md
Normal file
375
.claude/plan-multi-page.md
Normal file
@@ -0,0 +1,375 @@
|
||||
# Piano Implementazione Multi-Pagina per Report Designer
|
||||
|
||||
## Obiettivo
|
||||
Aggiungere la gestione di template multi-pagina al report designer, permettendo di creare documenti PDF con più pagine, ognuna con i propri elementi.
|
||||
|
||||
---
|
||||
|
||||
## Analisi dello Stato Attuale
|
||||
|
||||
### Frontend
|
||||
- **EditorCanvas.tsx**: Renderizza un singolo canvas Fabric.js che rappresenta una pagina
|
||||
- **ReportEditorPage.tsx**: Gestisce `template.elements` come array flat (tutti gli elementi)
|
||||
- **AprtTemplate**: Ha già un campo `sections` ma non è usato per le pagine
|
||||
- Gli elementi hanno già un campo `section` (header/body/footer) ma non `pageIndex`
|
||||
|
||||
### Backend
|
||||
- **ReportGeneratorService.cs**: Genera PDF con una sola pagina (`container.Page(...)`)
|
||||
- **AprtModels.cs**: Definisce `AprtSection` con `repeatOnPages` (pensato per header/footer ripetuti)
|
||||
|
||||
### Metalinguaggio APRT
|
||||
- Attualmente non supporta concetto di "pagine multiple"
|
||||
- Gli elementi hanno posizione assoluta relativa alla pagina
|
||||
|
||||
---
|
||||
|
||||
## Approccio Proposto
|
||||
|
||||
### Opzione Scelta: Array di Pagine nel Template
|
||||
|
||||
Modificare la struttura del template per includere un array esplicito di pagine:
|
||||
|
||||
```typescript
|
||||
interface AprtTemplate {
|
||||
// ... existing fields
|
||||
pages: AprtPage[]; // NUOVO
|
||||
elements: AprtElement[]; // Rimane per backward compatibility
|
||||
}
|
||||
|
||||
interface AprtPage {
|
||||
id: string;
|
||||
name: string;
|
||||
pageSize?: PageSize; // Override opzionale (default: dal meta)
|
||||
orientation?: PageOrientation; // Override opzionale
|
||||
margins?: AprtMargins; // Override opzionale
|
||||
backgroundColor?: string;
|
||||
elements: string[]; // Array di ID elementi che appartengono a questa pagina
|
||||
}
|
||||
|
||||
interface AprtElement {
|
||||
// ... existing fields
|
||||
pageId?: string; // NUOVO - ID della pagina di appartenenza
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Modifiche Richieste
|
||||
|
||||
### 1. Frontend - Types (`report.ts`)
|
||||
|
||||
```typescript
|
||||
// Aggiungere:
|
||||
export interface AprtPage {
|
||||
id: string;
|
||||
name: string;
|
||||
pageSize?: PageSize;
|
||||
orientation?: PageOrientation;
|
||||
margins?: AprtMargins;
|
||||
backgroundColor?: string;
|
||||
}
|
||||
|
||||
// Modificare AprtTemplate:
|
||||
export interface AprtTemplate {
|
||||
// ... existing
|
||||
pages: AprtPage[]; // Aggiungere
|
||||
}
|
||||
|
||||
// Modificare AprtElement:
|
||||
export interface AprtElement {
|
||||
// ... existing
|
||||
pageId?: string; // Aggiungere
|
||||
}
|
||||
|
||||
// Aggiornare defaultTemplate:
|
||||
export const defaultTemplate: AprtTemplate = {
|
||||
// ... existing
|
||||
pages: [{
|
||||
id: 'page-1',
|
||||
name: 'Pagina 1'
|
||||
}],
|
||||
};
|
||||
```
|
||||
|
||||
### 2. Frontend - Nuovo Componente `PageNavigator.tsx`
|
||||
|
||||
Barra laterale sinistra o tabs per navigare tra le pagine:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ [+ Aggiungi Pagina] │
|
||||
├─────────────────────────────────────────────────┤
|
||||
│ ┌─────────┐ Pagina 1 (A4 Portrait) [⋮] │
|
||||
│ │ thumb │ 5 elementi │
|
||||
│ └─────────┘ │
|
||||
├─────────────────────────────────────────────────┤
|
||||
│ ┌─────────┐ Pagina 2 (A4 Portrait) [⋮] │
|
||||
│ │ thumb │ 3 elementi ● │ ← Selezionata
|
||||
│ └─────────┘ │
|
||||
└─────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Funzionalità:
|
||||
- Lista pagine con miniatura
|
||||
- Aggiunta nuova pagina
|
||||
- Duplicazione pagina
|
||||
- Eliminazione pagina (con conferma)
|
||||
- Riordinamento drag-and-drop
|
||||
- Indicatore pagina attiva
|
||||
|
||||
### 3. Frontend - Modifiche a `ReportEditorPage.tsx`
|
||||
|
||||
```typescript
|
||||
// Nuovo state:
|
||||
const [currentPageId, setCurrentPageId] = useState<string>('page-1');
|
||||
|
||||
// Computed:
|
||||
const currentPage = template.pages.find(p => p.id === currentPageId);
|
||||
const currentPageElements = template.elements.filter(e => e.pageId === currentPageId);
|
||||
|
||||
// Handlers:
|
||||
const handleAddPage = () => { /* ... */ };
|
||||
const handleDeletePage = (pageId: string) => { /* ... */ };
|
||||
const handleDuplicatePage = (pageId: string) => { /* ... */ };
|
||||
const handleReorderPages = (fromIndex: number, toIndex: number) => { /* ... */ };
|
||||
const handleUpdatePageSettings = (pageId: string, updates: Partial<AprtPage>) => { /* ... */ };
|
||||
|
||||
// Quando si aggiunge un elemento, assegnare pageId corrente:
|
||||
const handleAddElement = (type: ElementType) => {
|
||||
const newElement = {
|
||||
// ... existing
|
||||
pageId: currentPageId, // NUOVO
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
### 4. Frontend - Modifiche a `EditorCanvas.tsx`
|
||||
|
||||
- Ricevere solo gli elementi della pagina corrente
|
||||
- Opzionalmente mostrare indicatore numero pagina
|
||||
|
||||
```typescript
|
||||
interface EditorCanvasProps {
|
||||
// ... existing
|
||||
pageIndex?: number; // Numero pagina per visualizzazione
|
||||
totalPages?: number; // Totale pagine
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Frontend - Modifiche a `PropertiesPanel.tsx`
|
||||
|
||||
Quando nessun elemento è selezionato, mostrare le impostazioni della pagina corrente:
|
||||
- Formato pagina (override rispetto al default)
|
||||
- Orientamento (override)
|
||||
- Margini (override)
|
||||
- Colore sfondo
|
||||
|
||||
### 6. Frontend - Modifiche a `EditorToolbar.tsx`
|
||||
|
||||
Aggiungere pulsanti per navigazione veloce:
|
||||
- `[◀ Pagina Prec]` / `[Pagina Succ ▶]`
|
||||
- Indicatore `Pagina 1 di 3`
|
||||
|
||||
### 7. Backend - Modifiche a `AprtModels.cs`
|
||||
|
||||
```csharp
|
||||
public class AprtTemplate
|
||||
{
|
||||
// ... existing
|
||||
|
||||
[JsonPropertyName("pages")]
|
||||
public List<AprtPage> Pages { get; set; } = new();
|
||||
}
|
||||
|
||||
public class AprtPage
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("pageSize")]
|
||||
public string? PageSize { get; set; }
|
||||
|
||||
[JsonPropertyName("orientation")]
|
||||
public string? Orientation { get; set; }
|
||||
|
||||
[JsonPropertyName("margins")]
|
||||
public AprtMargins? Margins { get; set; }
|
||||
|
||||
[JsonPropertyName("backgroundColor")]
|
||||
public string? BackgroundColor { get; set; }
|
||||
}
|
||||
|
||||
public class AprtElement
|
||||
{
|
||||
// ... existing
|
||||
|
||||
[JsonPropertyName("pageId")]
|
||||
public string? PageId { get; set; }
|
||||
}
|
||||
```
|
||||
|
||||
### 8. Backend - Modifiche a `ReportGeneratorService.cs`
|
||||
|
||||
```csharp
|
||||
public async Task<byte[]> GeneratePdfAsync(int templateId, Dictionary<string, object> dataContext)
|
||||
{
|
||||
// ... load template
|
||||
|
||||
var document = Document.Create(container =>
|
||||
{
|
||||
// Raggruppa elementi per pagina
|
||||
var pages = aprt.Pages.Any()
|
||||
? aprt.Pages
|
||||
: new List<AprtPage> { new AprtPage { Id = "default" } };
|
||||
|
||||
foreach (var page in pages)
|
||||
{
|
||||
// Determina dimensioni pagina (override o default)
|
||||
var pageSize = page.PageSize ?? aprt.Meta.PageSize;
|
||||
var orientation = page.Orientation ?? aprt.Meta.Orientation;
|
||||
var margins = page.Margins ?? aprt.Meta.Margins;
|
||||
|
||||
// Filtra elementi per questa pagina
|
||||
var pageElements = aprt.Elements
|
||||
.Where(e => e.Visible && (e.PageId == page.Id ||
|
||||
(string.IsNullOrEmpty(e.PageId) && page.Id == pages[0].Id)))
|
||||
.ToList();
|
||||
|
||||
container.Page(p =>
|
||||
{
|
||||
var dims = GetPageDimensionsMm(pageSize, orientation);
|
||||
p.Size(dims.Width, dims.Height, Unit.Millimetre);
|
||||
p.Margin(0);
|
||||
|
||||
// Render elementi della pagina
|
||||
var pageImageBytes = RenderContentToBitmap(
|
||||
pageElements, dims.Width, dims.Height,
|
||||
dataContext, resources, 300f);
|
||||
|
||||
p.Content().Image(pageImageBytes).FitArea();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return document.GeneratePdf();
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Migrazione Template Esistenti
|
||||
|
||||
Per backward compatibility, i template senza `pages` funzionano come prima:
|
||||
|
||||
```csharp
|
||||
// Nel backend:
|
||||
if (!aprt.Pages.Any())
|
||||
{
|
||||
// Crea pagina di default con tutti gli elementi
|
||||
aprt.Pages.Add(new AprtPage { Id = "page-1", Name = "Pagina 1" });
|
||||
foreach (var element in aprt.Elements.Where(e => string.IsNullOrEmpty(e.PageId)))
|
||||
{
|
||||
element.PageId = "page-1";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
// Nel frontend (ReportEditorPage.tsx):
|
||||
useEffect(() => {
|
||||
if (existingTemplate) {
|
||||
const parsed = JSON.parse(existingTemplate.templateJson);
|
||||
|
||||
// Migrazione: se manca pages, creane una di default
|
||||
if (!parsed.pages || parsed.pages.length === 0) {
|
||||
parsed.pages = [{ id: 'page-1', name: 'Pagina 1' }];
|
||||
// Assegna tutti gli elementi esistenti alla prima pagina
|
||||
parsed.elements?.forEach(el => {
|
||||
if (!el.pageId) el.pageId = 'page-1';
|
||||
});
|
||||
}
|
||||
|
||||
// ... rest of loading
|
||||
}
|
||||
}, [existingTemplate]);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ordine di Implementazione
|
||||
|
||||
### Fase 1: Struttura Dati (30 min)
|
||||
1. [ ] Aggiornare `report.ts` con `AprtPage` e modifiche a `AprtTemplate`/`AprtElement`
|
||||
2. [ ] Aggiornare `AprtModels.cs` con le stesse strutture
|
||||
3. [ ] Aggiornare `defaultTemplate` con pagina di default
|
||||
|
||||
### Fase 2: Backend PDF Multi-Pagina (30 min)
|
||||
4. [ ] Modificare `ReportGeneratorService.GeneratePdfAsync` per iterare sulle pagine
|
||||
5. [ ] Aggiungere logica di migrazione per template esistenti
|
||||
6. [ ] Testare generazione PDF con template multi-pagina manuale
|
||||
|
||||
### Fase 3: Frontend - PageNavigator (1 ora)
|
||||
7. [ ] Creare componente `PageNavigator.tsx`
|
||||
8. [ ] Integrare in `ReportEditorPage.tsx` (layout con sidebar sinistra)
|
||||
9. [ ] Implementare selezione pagina corrente
|
||||
|
||||
### Fase 4: Frontend - Gestione Elementi per Pagina (30 min)
|
||||
10. [ ] Modificare `ReportEditorPage.tsx` per filtrare elementi per pagina
|
||||
11. [ ] Assegnare `pageId` agli elementi nuovi
|
||||
12. [ ] Aggiornare `EditorCanvas.tsx` per ricevere solo elementi pagina corrente
|
||||
|
||||
### Fase 5: Frontend - CRUD Pagine (45 min)
|
||||
13. [ ] Implementare aggiunta pagina
|
||||
14. [ ] Implementare duplicazione pagina (con copia elementi)
|
||||
15. [ ] Implementare eliminazione pagina
|
||||
16. [ ] Implementare riordinamento pagine (drag-and-drop)
|
||||
|
||||
### Fase 6: Frontend - Settings Pagina (30 min)
|
||||
17. [ ] Modificare `PropertiesPanel.tsx` per mostrare settings pagina corrente
|
||||
18. [ ] Supportare override formato/orientamento/margini per pagina
|
||||
|
||||
### Fase 7: UI Polish (30 min)
|
||||
19. [ ] Aggiungere navigazione rapida in toolbar
|
||||
20. [ ] Miniature pagine nel navigator
|
||||
21. [ ] Indicatore pagina corrente nel canvas
|
||||
|
||||
### Fase 8: Test e Documentazione (30 min)
|
||||
22. [ ] Test completo flusso multi-pagina
|
||||
23. [ ] Test migrazione template esistenti
|
||||
24. [ ] Aggiornare CLAUDE.md con documentazione
|
||||
|
||||
---
|
||||
|
||||
## Considerazioni UX
|
||||
|
||||
1. **Default intuitivo**: Template nuovo ha 1 pagina, utente può aggiungerne altre
|
||||
2. **Copia/Incolla tra pagine**: Gli elementi copiati mantengono posizione, si può incollare su altra pagina
|
||||
3. **Keyboard shortcuts**:
|
||||
- `Page Up` / `Page Down` per navigare
|
||||
- `Ctrl+Shift+N` per nuova pagina
|
||||
4. **Undo/Redo**: Le operazioni su pagine sono incluse nella history
|
||||
5. **Preview**: Mostra tutte le pagine del PDF generato
|
||||
|
||||
---
|
||||
|
||||
## File da Modificare
|
||||
|
||||
| File | Tipo Modifica |
|
||||
|------|---------------|
|
||||
| `frontend/src/types/report.ts` | Aggiungere `AprtPage`, modificare `AprtTemplate`, `AprtElement` |
|
||||
| `frontend/src/pages/ReportEditorPage.tsx` | Gestione stato pagina corrente, filtro elementi |
|
||||
| `frontend/src/components/reportEditor/PageNavigator.tsx` | NUOVO - Navigatore pagine |
|
||||
| `frontend/src/components/reportEditor/EditorCanvas.tsx` | Ricevere elementi filtrati |
|
||||
| `frontend/src/components/reportEditor/PropertiesPanel.tsx` | Settings pagina corrente |
|
||||
| `frontend/src/components/reportEditor/EditorToolbar.tsx` | Navigazione rapida |
|
||||
| `src/Apollinare.API/Services/Reports/AprtModels.cs` | Aggiungere `AprtPage` |
|
||||
| `src/Apollinare.API/Services/Reports/ReportGeneratorService.cs` | Loop pagine per PDF |
|
||||
| `CLAUDE.md` | Documentazione feature |
|
||||
|
||||
---
|
||||
|
||||
## Stima Tempo Totale
|
||||
**~4 ore** per implementazione completa
|
||||
97
.gitignore
vendored
Normal file
97
.gitignore
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
# Build output
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# .NET
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.suo
|
||||
*.cache
|
||||
*.dll
|
||||
*.exe
|
||||
*.pdb
|
||||
project.lock.json
|
||||
.vs/
|
||||
*.nupkg
|
||||
*.snupkg
|
||||
packages/
|
||||
*.DotSettings.user
|
||||
|
||||
# ASP.NET
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# NuGet
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Database files
|
||||
*.db
|
||||
*.db-journal
|
||||
*.sqlite
|
||||
|
||||
# Node.js
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Frontend build output
|
||||
dist/
|
||||
dist-ssr/
|
||||
*.local
|
||||
.vite/
|
||||
|
||||
# IDE and editors
|
||||
.idea/
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
*.swp
|
||||
*.swo
|
||||
*.sw?
|
||||
*~
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Python virtual environment
|
||||
.venv/
|
||||
venv/
|
||||
ENV/
|
||||
env/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
.Python
|
||||
pip-log.txt
|
||||
|
||||
# Secrets and environment
|
||||
*.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
appsettings.Development.json
|
||||
appsettings.*.local.json
|
||||
secrets.json
|
||||
|
||||
# Testing
|
||||
coverage/
|
||||
*.coverage
|
||||
TestResults/
|
||||
|
||||
# Misc
|
||||
*.log
|
||||
*.bak
|
||||
*.tmp
|
||||
*.temp
|
||||
912
CLAUDE.md
Normal file
912
CLAUDE.md
Normal file
@@ -0,0 +1,912 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start - Session Recovery
|
||||
|
||||
**Ultima sessione:** 28 Novembre 2025
|
||||
|
||||
**Stato progetto:** Migrazione Oracle APEX → .NET + React TypeScript in corso
|
||||
|
||||
**Lavoro completato nell'ultima sessione:**
|
||||
|
||||
- **NUOVA FEATURE: Gestione Multi-Pagina nel Report Designer** - Completata
|
||||
- Nuovo tipo `AprtPage` per definire pagine con impostazioni individuali (size, orientation, margins, backgroundColor)
|
||||
- Ogni elemento ha `pageId` per assegnazione a pagina specifica
|
||||
- Nuovo componente `PageNavigator.tsx` - sidebar con lista pagine, context menu, rinomina, duplica, elimina, riordina
|
||||
- Navigazione rapida pagine in `EditorToolbar.tsx` (pulsanti prev/next, indicatore "X / Y")
|
||||
- `PropertiesPanel.tsx` aggiornato per mostrare/modificare impostazioni pagina corrente
|
||||
- Backend `ReportGeneratorService.cs` genera PDF multi-pagina correttamente
|
||||
- Migrazione automatica template legacy (elementi senza pageId assegnati a prima pagina)
|
||||
|
||||
- **FIX CRITICO: Rotazione oggetti nel PDF** - Gli oggetti ruotati nel canvas ora vengono posizionati correttamente nel PDF generato
|
||||
- Implementata la formula Fabric.js per calcolare il centro di rotazione
|
||||
- Coordinate corrette per `originX='left'`, `originY='top'`
|
||||
|
||||
**Lavoro completato nelle sessioni precedenti:**
|
||||
|
||||
- Sistema Report PDF con editor visuale (98% completato)
|
||||
- Fabric.js v6 canvas editor funzionante
|
||||
- Multi-dataset support con preview
|
||||
- **FIX: Data binding PDF ora funzionante** - I campi dati vengono risolti correttamente
|
||||
- **FIX: Formattazione campi** - Date, valute, numeri formattati correttamente nel PDF
|
||||
- Sistema Virtual Dataset implementato (CRUD completo)
|
||||
- SignalR real-time updates funzionante
|
||||
- **Context Menu ricco** - Tasto destro con opzioni complete stile Canva (copia, taglia, incolla, layer, allineamento, trasformazioni)
|
||||
- **FIX: Posizionamento assoluto PDF FUNZIONANTE** - SVG con viewBox in mm, coordinate corrette
|
||||
- **FIX: Immagini nel PDF** - Data URI, API URL e risorse embedded ora renderizzate correttamente
|
||||
- **FIX: Font size nel PDF** - Conversione corretta da px screen a mm per SVG
|
||||
|
||||
**Per riprendere il lavoro sui Report:**
|
||||
|
||||
1. Vai alla sezione "Report PDF System - Implementation Details" più sotto
|
||||
2. Consulta la "Checklist Completamento Report System" per vedere cosa manca
|
||||
3. I file principali sono:
|
||||
- Backend: `/src/Apollinare.API/Controllers/ReportsController.cs`
|
||||
- Frontend: `/frontend/src/pages/ReportEditorPage.tsx`
|
||||
- Canvas: `/frontend/src/components/reportEditor/EditorCanvas.tsx`
|
||||
- **Context Menu:** `/frontend/src/components/reportEditor/ContextMenu.tsx`
|
||||
- **PDF Generator:** `/src/Apollinare.API/Services/Reports/ReportGeneratorService.cs`
|
||||
- **Page Navigator:** `/frontend/src/components/reportEditor/PageNavigator.tsx`
|
||||
|
||||
**Prossimi task prioritari (Report System):**
|
||||
|
||||
1. [x] ~~**CRITICO: Posizionamento assoluto PDF**~~ - COMPLETATO
|
||||
2. [x] ~~Implementare caricamento immagini reali~~ - COMPLETATO
|
||||
3. [x] ~~**FIX: Rotazione oggetti nel PDF**~~ - COMPLETATO
|
||||
4. [x] ~~**Gestione Multi-Pagina**~~ - COMPLETATO
|
||||
5. [ ] Aggiungere rendering tabelle dinamiche per collection
|
||||
6. [ ] Gestire sezioni header/footer ripetute su ogni pagina
|
||||
7. [ ] UI per relazioni tra dataset multipli
|
||||
|
||||
**Comandi utili:**
|
||||
|
||||
```bash
|
||||
# Build backend
|
||||
cd src && dotnet build
|
||||
|
||||
# Build frontend
|
||||
cd frontend && npm run build
|
||||
|
||||
# Run backend (porta 5000)
|
||||
cd src/Apollinare.API && dotnet run
|
||||
|
||||
# Run frontend dev (porta 5173)
|
||||
cd frontend && npm run dev
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Project Overview
|
||||
|
||||
This repository contains documentation for migrating the **Apollinare Catering & Banqueting Management Software** from Oracle APEX to .NET + React TypeScript.
|
||||
|
||||
**Original Application:**
|
||||
|
||||
- Oracle APEX 21.1.0 (Application ID: 112)
|
||||
- 56 pages, 302 items, 98 processes
|
||||
- Database: Oracle 18 XE (schema: APOLLINARECATERINGPROD)
|
||||
- Language: Italian
|
||||
|
||||
**Target Stack:**
|
||||
|
||||
- Backend: .NET (C#)
|
||||
- Frontend: React TypeScript (not Vue - note the user request mentions Vue but the actual target is React TypeScript)
|
||||
- Database: Oracle 18 XE (read-only access for analysis)
|
||||
|
||||
## Database Connection (Read-Only)
|
||||
|
||||
**Connection Details:**
|
||||
|
||||
- Database: Oracle 18 XE
|
||||
- Username: `apollinarecateringprod`
|
||||
- Password: `bmwmRaSBRT53Z2J8CCvYK45EPDyAJ4`
|
||||
- Database: `xepdb1`
|
||||
- Hostname: `apollinare`
|
||||
- Port: `1521`
|
||||
|
||||
**Important:** This connection is READ-ONLY. Use it only to analyze schema, extract business logic from procedures/packages/functions, and understand data relationships.
|
||||
|
||||
## Application Architecture
|
||||
|
||||
### Core Business Domain: Event Catering Management
|
||||
|
||||
The application manages the complete lifecycle of catering events from quote to execution, including:
|
||||
|
||||
- Event creation and management
|
||||
- Client and location management
|
||||
- Inventory (articles) with image storage
|
||||
- Quote generation with complex calculations
|
||||
- Resource (staff) scheduling
|
||||
- Kitchen and setup reports
|
||||
- Multi-level authorization system
|
||||
|
||||
### Main Business Entities
|
||||
|
||||
**Events (EVENTI)** - Central entity
|
||||
|
||||
- Event details (date, location, client, event type)
|
||||
- Guest counts by type (adults, children, seated, buffet)
|
||||
- Status workflow: 0 (Scheda) → 10 (Preventivo/Quote) → 20 (Confermato/Confirmed)
|
||||
- Quote expiration tracking
|
||||
- Distance calculations for location
|
||||
|
||||
**Event Details (1:N relationships):**
|
||||
|
||||
- `EVENTI_DET_OSPITI` - Guest type breakdown
|
||||
- `EVENTI_DET_PREL` - Pick lists (articles needed for the event)
|
||||
- `EVENTI_DET_RIS` - Resource assignments (staff)
|
||||
- `EVENTI_DET_DEGUST` - Tasting event details
|
||||
- `EVENTI_ACCONTI` - Deposits/advances
|
||||
- `EVENTI_ALLEG` - Attachments
|
||||
- `EVENTI_ALTRICOSTI` - Other costs
|
||||
|
||||
**Master Data:**
|
||||
|
||||
- `ARTICOLI` - Articles/items with images (BLOB), quantities, coefficients
|
||||
- `TB_CODICI_CATEG` - Categories with calculation coefficients (COEFF_A/B/S)
|
||||
- `TB_TIPI_MAT` - Material types
|
||||
- `TB_TIPI_EVENTO` - Event types with meal classifications
|
||||
- `TB_TIPI_OSPITI` - Guest types
|
||||
- `CLIENTI` - Clients
|
||||
- `LOCATION` - Event locations
|
||||
- `RISORSE` - Resources (staff) with type classification
|
||||
|
||||
### Critical Business Logic in Database
|
||||
|
||||
**Key Stored Procedures:**
|
||||
|
||||
- `EVENTI_AGGIORNA_QTA_LISTA(p_event_id)` - Updates pick list quantities based on guest counts and coefficients
|
||||
- `EVENTI_AGGIORNA_TOT_OSPITI(p_event_id)` - Recalculates total guest count
|
||||
- `EVENTI_RICALCOLA_ACCONTI(p_event_id)` - Recalculates deposit amounts
|
||||
- `EVENTI_COPIA` - Event duplication functionality
|
||||
- `EVENTI_PREPARE` - Event preparation process
|
||||
|
||||
**Key Functions:**
|
||||
|
||||
- `F_GET_QTA_IMPEGNATA(cod_articolo, data)` - Returns committed quantity for an article on a specific date (inventory reservation)
|
||||
- `F_EVENTO_SCADUTO(data_scad, stato, ...)` - Checks if event quote has expired
|
||||
- `F_MAX_NUMERO_EVENTI_RAGGIUNTO(data)` - Enforces daily event limit
|
||||
- `F_USER_IN_ROLE(app_user, role)` - Role-based authorization
|
||||
- `STRING_TO_TABLE_ENUM(string, position, delimiter)` - Utility for string parsing
|
||||
|
||||
**Important Views:**
|
||||
|
||||
- `V_IMPEGNI_ARTICOLI` - Calculates article commitments across events (inventory availability)
|
||||
- `V_IMPEGNI_ARTICOLI_LOC` - Article commitments by location
|
||||
- `VW_CALENDARIO_EVENTI` - Calendar view of events
|
||||
|
||||
### Quantity Calculation Algorithm
|
||||
|
||||
The application uses a sophisticated coefficient-based system:
|
||||
|
||||
1. **Coefficients** are defined at category level (`TB_CODICI_CATEG.COEFF_A/B/S`)
|
||||
2. **Standard quantities** are stored per article (`ARTICOLI.QTA_STD_A/S/B`)
|
||||
3. **Guest counts** by type determine multipliers (`EVENTI_DET_OSPITI`)
|
||||
4. **Final quantities** calculated as: `Guest_Count × Coefficient × Standard_Qty`
|
||||
|
||||
Types: A (Adulti/Adults), S (Seduti/Seated), B (Buffet)
|
||||
|
||||
### Authorization Model
|
||||
|
||||
**5 Authorization Levels:**
|
||||
|
||||
1. **Admin_auth_schema** - Full admin access
|
||||
- Users: admin, monia, andrea, maria, sabrina, nicole, cucina, developer, elia.ballarani
|
||||
|
||||
2. **User Read/Write** - Controlled by `USERS_READONLY` table
|
||||
- `FLGWRITE` flag determines write access
|
||||
|
||||
3. **Consuntivi** - Access to financial summaries
|
||||
- Users from `GET_CONSUNTIVI_USERS` view
|
||||
|
||||
4. **Gestori** (Managers) - Manager-level permissions
|
||||
- Users from `GET_GESTORI_USERS` view
|
||||
|
||||
5. **Solo Admins** - Highest level
|
||||
- Only: admin, monia
|
||||
|
||||
**Session Management:**
|
||||
|
||||
- `SET_USER_READONLY` process runs before header on every page
|
||||
- Sets `APP_READ_ONLY` application item based on user permissions
|
||||
|
||||
### Page Structure (56 Pages)
|
||||
|
||||
**Master Data Pages:**
|
||||
|
||||
- Pages 2-3: Articles (list + form)
|
||||
- Pages 4-5: Categories
|
||||
- Pages 6-7: Types
|
||||
- Pages 17-18: Clients
|
||||
- Pages 15, 20: Locations
|
||||
- Page 31: Resources (staff)
|
||||
|
||||
**Event Management:**
|
||||
|
||||
- Page 1: Dashboard
|
||||
- Page 8: Event creation wizard
|
||||
- Page 9: Event list
|
||||
- Page 12: Calendar view
|
||||
- Pages 13-14: Event types
|
||||
- **Page 22: Main event form** (most complex - multiple interactive grids)
|
||||
- Page 27, 32: Tastings
|
||||
- Page 35: Event cards/confirmed cards
|
||||
- Page 48: Event templates
|
||||
|
||||
**Reports:**
|
||||
|
||||
- Page 16: Grid view
|
||||
- Page 25: Kitchen summary
|
||||
- Page 28: Cakes and extra costs
|
||||
- Page 30: Setup summary
|
||||
- Page 38: Resources summary
|
||||
- Page 39: Article commitments
|
||||
|
||||
**Admin:**
|
||||
|
||||
- Page 45: Data management
|
||||
- Page 46: Max events configuration
|
||||
- Page 47: Permissions
|
||||
- Page 49: Scheduled jobs
|
||||
- Page 50: Sent emails
|
||||
- Page 51: Pending emails
|
||||
|
||||
### External Integrations
|
||||
|
||||
**JasperReports:**
|
||||
|
||||
- Quote reports (preventivi)
|
||||
- Event cards (schede evento)
|
||||
- Kitchen summaries
|
||||
- Custom iframeObj.js wrapper for embedding reports
|
||||
|
||||
**Email System:**
|
||||
|
||||
- Mail queue (pages 50-51)
|
||||
- Background job processing (page 49)
|
||||
- Template-based notifications
|
||||
|
||||
**Custom JavaScript:**
|
||||
|
||||
- `ajaxUtils.js` - AJAX utilities for dynamic updates
|
||||
- `notifica(pText, pType)` - Dynamic notifications
|
||||
- `setSessionState(elemList, pCallback)` - Session state management
|
||||
- `ajaxExec(...)` - Generic AJAX execution
|
||||
- `execProcessAsync(...)` - Async process execution
|
||||
- `execQueryAsync(...)` - Async query execution
|
||||
|
||||
### Migration Considerations
|
||||
|
||||
**Complex Features Requiring Special Attention:**
|
||||
|
||||
1. **Page 22 (Nuovo Evento)** - Most complex page
|
||||
- Multiple editable interactive grids on single page
|
||||
- Master-detail relationships with real-time calculations
|
||||
- Guest type grid → triggers quantity recalculations in pick list grids
|
||||
- Resource assignment grid
|
||||
- Requires careful state management in React
|
||||
|
||||
2. **BLOB Storage for Images**
|
||||
- Article images stored as BLOBs in Oracle
|
||||
- Migration strategy needed (Azure Blob Storage, AWS S3, or filesystem)
|
||||
- MIMETYPE tracking for proper rendering
|
||||
|
||||
3. **PL/SQL Business Logic**
|
||||
- Decision needed: Port to C# or keep as Oracle functions?
|
||||
- Quantity calculations are complex - ensure parity
|
||||
- Inventory commitment logic (V_IMPEGNI_ARTICOLI) is critical
|
||||
|
||||
4. **State Management**
|
||||
- Heavy use of APEX session state
|
||||
- Consider Redux Toolkit or Zustand for React
|
||||
- Real-time grid updates and calculations
|
||||
|
||||
5. **Reporting**
|
||||
- JasperReports replacement needed
|
||||
- Options: SSRS, Crystal Reports, DevExpress, or PDF libraries (iTextSharp, QuestPDF)
|
||||
|
||||
6. **Email Queue System**
|
||||
- Asynchronous processing required
|
||||
- Consider: Hangfire, Azure Functions, or background services
|
||||
|
||||
7. **Calendar Component**
|
||||
- Page 12 uses APEX calendar
|
||||
- React options: FullCalendar, React Big Calendar, @event-calendar/core
|
||||
|
||||
8. **Multi-Grid Interactions**
|
||||
- Interactive grids with master-detail relationships
|
||||
- Consider: AG Grid, DevExtreme DataGrid, or Material-UI DataGrid
|
||||
|
||||
## Business Rules to Preserve
|
||||
|
||||
1. **Event Status Workflow:** Must follow 0 → 10 → 20 progression
|
||||
2. **Quote Expiration:** Automatic status change when `DATA_SCAD_PREVENTIVO` passed
|
||||
3. **Max Events Per Day:** Enforced limit (configurable)
|
||||
4. **Article Commitment Tracking:** Prevent overbooking of inventory
|
||||
5. **Coefficient-Based Calculations:** Ensure quantity formulas match exactly
|
||||
6. **Deposit Calculations:** Auto-recalculation on cost changes
|
||||
7. **Role-Based Access:** 5-level authorization system
|
||||
8. **Read-Only Mode:** User-specific write restrictions
|
||||
|
||||
## Data Extraction Queries
|
||||
|
||||
When analyzing the database, useful queries:
|
||||
|
||||
```sql
|
||||
-- Get all tables in schema
|
||||
SELECT table_name FROM user_tables ORDER BY table_name;
|
||||
|
||||
-- Get table structure
|
||||
SELECT column_name, data_type, nullable, data_default
|
||||
FROM user_tab_columns
|
||||
WHERE table_name = 'EVENTI'
|
||||
ORDER BY column_id;
|
||||
|
||||
-- Get all procedures and functions
|
||||
SELECT object_name, object_type
|
||||
FROM user_objects
|
||||
WHERE object_type IN ('PROCEDURE', 'FUNCTION', 'PACKAGE')
|
||||
ORDER BY object_type, object_name;
|
||||
|
||||
-- Get procedure source
|
||||
SELECT text FROM user_source
|
||||
WHERE name = 'EVENTI_AGGIORNA_QTA_LISTA'
|
||||
ORDER BY line;
|
||||
|
||||
-- Get view definitions
|
||||
SELECT view_name, text FROM user_views
|
||||
WHERE view_name LIKE 'V_%' OR view_name LIKE 'VW_%';
|
||||
|
||||
-- Get foreign key relationships
|
||||
SELECT a.constraint_name, a.table_name, a.column_name,
|
||||
c_pk.table_name r_table_name, c_pk.constraint_name r_constraint_name
|
||||
FROM user_cons_columns a
|
||||
JOIN user_constraints c ON a.constraint_name = c.constraint_name
|
||||
JOIN user_constraints c_pk ON c.r_constraint_name = c_pk.constraint_name
|
||||
WHERE c.constraint_type = 'R'
|
||||
ORDER BY a.table_name, a.constraint_name;
|
||||
```
|
||||
|
||||
## File References
|
||||
|
||||
- `apollinare-db-connection.md` - Database connection details (credentials)
|
||||
- `f112.sql` - Complete APEX export (53,282 lines)
|
||||
- Application structure
|
||||
- Page definitions
|
||||
- Processes and validations
|
||||
- LOVs and static data
|
||||
- JavaScript libraries
|
||||
|
||||
## Development Approach
|
||||
|
||||
When working on migration tasks:
|
||||
|
||||
1. **Always query the database** to understand current data structure and relationships
|
||||
2. **Extract PL/SQL source code** for procedures/functions before implementing equivalent C# logic
|
||||
3. **Document business rules** discovered in stored procedures
|
||||
4. **Preserve Italian field names** in database but consider English in application layer
|
||||
5. **Test quantity calculations** thoroughly - they are core to the business
|
||||
6. **Map APEX page flows** to React routes and components
|
||||
7. **Identify reusable components** (grids, forms, lookups)
|
||||
8. **Plan data migration** for BLOBs and complex relationships
|
||||
|
||||
## Key Terminology (Italian → English)
|
||||
|
||||
- **Scheda** → Card/Draft (Event status 0)
|
||||
- **Preventivo** → Quote (Event status 10)
|
||||
- **Confermato** → Confirmed (Event status 20)
|
||||
- **Lista Prelievo** → Pick List (articles for event)
|
||||
- **Articoli** → Articles/Items
|
||||
- **Ospiti** → Guests
|
||||
- **Risorse** → Resources (staff)
|
||||
- **Degustazioni** → Tastings
|
||||
- **Allestimenti** → Setups
|
||||
- **Acconti** → Deposits/Advances
|
||||
- **Impegni** → Commitments (inventory reservations)
|
||||
|
||||
## Notes
|
||||
|
||||
- The application is mature and in production use
|
||||
- Italian language throughout (UI, database, code comments)
|
||||
- Complex business logic embedded in database layer
|
||||
- Heavy use of APEX-specific features (Interactive Grids, Dynamic Actions)
|
||||
- Real-time calculations and validations are critical to user experience
|
||||
|
||||
---
|
||||
|
||||
## Report PDF System - Implementation Details
|
||||
|
||||
### Overview
|
||||
|
||||
Sistema completo di generazione report PDF con editor visuale drag-and-drop (stile Canva) e metalinguaggio APRT (Apollinare Report Template) per template portabili.
|
||||
|
||||
### Stack Tecnologico
|
||||
|
||||
**Backend:**
|
||||
|
||||
- QuestPDF (Community License) - Generazione PDF programmatica
|
||||
- .NET 9 Web API con Entity Framework Core
|
||||
- SQLite per storage template, font e immagini
|
||||
|
||||
**Frontend:**
|
||||
|
||||
- React 19 + TypeScript + Vite
|
||||
- Fabric.js v6 - Canvas editor per design visuale
|
||||
- Material-UI per componenti UI
|
||||
|
||||
### Stato Corrente dell'Implementazione
|
||||
|
||||
#### Backend (COMPLETATO)
|
||||
|
||||
**Entities** (`/src/Apollinare.Domain/Entities/`):
|
||||
|
||||
- `ReportTemplate.cs` - Template con JSON, thumbnail, metadata
|
||||
- `ReportFont.cs` - Font custom uploadabili (TTF/OTF)
|
||||
- `ReportImage.cs` - Immagini riutilizzabili nei report
|
||||
|
||||
**Services** (`/src/Apollinare.API/Services/Reports/`):
|
||||
|
||||
- `ReportGeneratorService.cs` - Parsing APRT e generazione PDF con QuestPDF
|
||||
- `AprtModels.cs` - Modelli C# per il metalinguaggio APRT
|
||||
|
||||
**Controllers** (`/src/Apollinare.API/Controllers/`):
|
||||
|
||||
- `ReportTemplatesController.cs` - CRUD template, clone, import/export
|
||||
- `ReportResourcesController.cs` - Gestione font e immagini
|
||||
- `ReportsController.cs` - Generazione PDF, schema dati, dataset management
|
||||
|
||||
**API Endpoints disponibili:**
|
||||
|
||||
```
|
||||
# Templates
|
||||
GET /api/report-templates
|
||||
GET /api/report-templates/{id}
|
||||
POST /api/report-templates
|
||||
PUT /api/report-templates/{id}
|
||||
DELETE /api/report-templates/{id}
|
||||
POST /api/report-templates/{id}/clone
|
||||
GET /api/report-templates/{id}/export
|
||||
POST /api/report-templates/import
|
||||
GET /api/report-templates/categories
|
||||
|
||||
# Resources
|
||||
GET /api/report-resources/fonts
|
||||
POST /api/report-resources/fonts
|
||||
DELETE /api/report-resources/fonts/{id}
|
||||
GET /api/report-resources/fonts/families
|
||||
GET /api/report-resources/images
|
||||
POST /api/report-resources/images
|
||||
DELETE /api/report-resources/images/{id}
|
||||
|
||||
# Report Generation
|
||||
POST /api/reports/generate
|
||||
GET /api/reports/evento/{eventoId}
|
||||
POST /api/reports/preview
|
||||
GET /api/reports/datasets
|
||||
GET /api/reports/schema/{datasetId}
|
||||
GET /api/reports/datasets/{datasetId}/entities
|
||||
```
|
||||
|
||||
#### Frontend (COMPLETATO ~90%)
|
||||
|
||||
**Pagine** (`/frontend/src/pages/`):
|
||||
|
||||
- `ReportTemplatesPage.tsx` - Lista template con cards, filtri, import/export
|
||||
- `ReportEditorPage.tsx` - Editor principale con undo/redo, shortcuts
|
||||
|
||||
**Componenti Editor** (`/frontend/src/components/reportEditor/`):
|
||||
|
||||
- `EditorCanvas.tsx` - Canvas Fabric.js per design visuale
|
||||
- `EditorToolbar.tsx` - Toolbar con strumenti, zoom, grid, azioni
|
||||
- `PropertiesPanel.tsx` - Pannello proprietà elemento/pagina
|
||||
- `DataBindingPanel.tsx` - Browser campi dati con supporto multi-dataset
|
||||
- `DatasetSelector.tsx` - Selezione dataset per template
|
||||
- `PreviewDialog.tsx` - Dialog selezione entità per anteprima
|
||||
|
||||
**Types** (`/frontend/src/types/report.ts`):
|
||||
|
||||
- Definizioni complete APRT (AprtTemplate, AprtElement, AprtStyle, etc.)
|
||||
- DTOs per API (ReportTemplateDto, DataSchemaDto, DatasetTypeDto, etc.)
|
||||
- Utility functions (mmToPx, pxToMm, getPageDimensions)
|
||||
|
||||
**Services** (`/frontend/src/services/reportService.ts`):
|
||||
|
||||
- reportTemplateService - CRUD template
|
||||
- reportFontService - Gestione font
|
||||
- reportImageService - Gestione immagini
|
||||
- reportGeneratorService - Generazione PDF e schema
|
||||
|
||||
### Metalinguaggio APRT (Apollinare Report Template)
|
||||
|
||||
Formato JSON esportabile/importabile per portabilità template:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0",
|
||||
"meta": {
|
||||
"name": "Template Evento",
|
||||
"pageSize": "A4",
|
||||
"orientation": "portrait",
|
||||
"margins": { "top": 20, "right": 15, "bottom": 20, "left": 15 }
|
||||
},
|
||||
"resources": {
|
||||
"fonts": [],
|
||||
"images": []
|
||||
},
|
||||
"dataSources": {
|
||||
"evento": { "type": "object", "schema": "evento" }
|
||||
},
|
||||
"sections": [],
|
||||
"elements": [
|
||||
{
|
||||
"id": "uuid",
|
||||
"type": "text",
|
||||
"position": { "x": 20, "y": 20, "width": 100, "height": 20 },
|
||||
"style": {
|
||||
"fontFamily": "Helvetica",
|
||||
"fontSize": 14,
|
||||
"color": "#000000"
|
||||
},
|
||||
"content": { "type": "binding", "expression": "{{evento.codice}}" },
|
||||
"section": "body"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Tipi elemento supportati:** text, image, shape, table, line, barcode
|
||||
|
||||
**Data binding:** `{{campo}}`, `{{dataset.campo}}`, `{{collection.campo}}`
|
||||
|
||||
**Variabili speciali:** `{{$pageNumber}}`, `{{$totalPages}}`, `{{$date}}`, `{{$datetime}}`
|
||||
|
||||
### Dataset Disponibili
|
||||
|
||||
| Dataset ID | Nome | Descrizione |
|
||||
| ---------- | -------- | ------------------------------------------------------------------ |
|
||||
| evento | Evento | Dati evento con cliente, location, dettagli ospiti, costi, risorse |
|
||||
| cliente | Cliente | Anagrafica clienti completa |
|
||||
| location | Location | Sedi e location eventi |
|
||||
| articolo | Articolo | Catalogo articoli e materiali |
|
||||
| risorsa | Risorsa | Staff e personale |
|
||||
|
||||
### Funzionalità Implementate
|
||||
|
||||
- [x] Editor visuale drag-and-drop con Fabric.js
|
||||
- [x] Supporto elementi: testo, forme, linee, tabelle, immagini (placeholder)
|
||||
- [x] Gestione zoom (25% - 200%)
|
||||
- [x] Griglia e snap to grid
|
||||
- [x] Undo/Redo (max 20 stati)
|
||||
- [x] Shortcuts tastiera (Ctrl+Z, Ctrl+Y, Ctrl+S, Delete)
|
||||
- [x] Pannello proprietà con posizione, stile, contenuto
|
||||
- [x] Data binding con browser campi disponibili
|
||||
- [x] Selezione multipla dataset per template
|
||||
- [x] Preview con selezione entità reali
|
||||
- [x] Salvataggio/caricamento template
|
||||
- [x] Import/export template come file .aprt
|
||||
- [x] Clone template
|
||||
- [x] Generazione PDF default per eventi
|
||||
- [x] Formattazione campi (valuta, data, numero, percentuale)
|
||||
|
||||
### Cosa Manca per Completare
|
||||
|
||||
#### Alta Priorità
|
||||
|
||||
- [ ] **Caricamento immagini reali** - Attualmente placeholder, implementare upload e rendering
|
||||
- [ ] **Tabelle dinamiche** - Rendering collection dati (es. lista ospiti, articoli)
|
||||
- [ ] **Sezioni header/footer** - Ripetizione su ogni pagina
|
||||
- [ ] **Font custom** - Upload e utilizzo font TTF/OTF nei PDF
|
||||
|
||||
#### Media Priorità
|
||||
|
||||
- [ ] **Relazioni tra dataset** - UI per collegare campi tra dataset diversi
|
||||
- [ ] **Barcode/QRCode** - Supporto codici a barre
|
||||
- [ ] **Formule calcolate** - Espressioni matematiche nei campi
|
||||
- [ ] **Stili condizionali** - Formattazione basata su valore dati
|
||||
- [ ] **Raggruppamento elementi** - Group/ungroup nel canvas
|
||||
|
||||
#### Bassa Priorità
|
||||
|
||||
- [ ] **Template predefiniti** - Library di template pronti all'uso
|
||||
- [ ] **Anteprima live** - Preview in tempo reale durante editing
|
||||
- [x] ~~**Multi-pagina** - Editor pagine multiple~~ - COMPLETATO
|
||||
- [ ] **Righelli e guide** - Ausili allineamento avanzati
|
||||
- [ ] **Esportazione altri formati** - Excel, Word oltre PDF
|
||||
|
||||
---
|
||||
|
||||
## Checklist Completamento Report System
|
||||
|
||||
### Backend
|
||||
|
||||
- [x] Entity ReportTemplate
|
||||
- [x] Entity ReportFont
|
||||
- [x] Entity ReportImage
|
||||
- [x] ReportTemplatesController (CRUD + clone + import/export)
|
||||
- [x] ReportResourcesController (fonts + images)
|
||||
- [x] ReportsController (generate + preview + schema + datasets)
|
||||
- [x] ReportGeneratorService con QuestPDF
|
||||
- [x] Schema dati per tutti i dataset (evento, cliente, location, articolo, risorsa)
|
||||
- [x] Generazione PDF default evento
|
||||
- [x] Generazione PDF multi-pagina
|
||||
- [ ] Rendering tabelle dinamiche da collection
|
||||
- [ ] Supporto font custom nel PDF
|
||||
- [ ] Rendering immagini da storage
|
||||
|
||||
### Frontend
|
||||
|
||||
- [x] ReportTemplatesPage (lista + filtri + azioni)
|
||||
- [x] ReportEditorPage (editor principale)
|
||||
- [x] EditorCanvas con Fabric.js v6
|
||||
- [x] EditorToolbar completa
|
||||
- [x] PropertiesPanel (posizione + stile + contenuto)
|
||||
- [x] DataBindingPanel multi-dataset
|
||||
- [x] DatasetSelector
|
||||
- [x] PreviewDialog con selezione entità
|
||||
- [x] Types APRT completi
|
||||
- [x] Services API completi
|
||||
- [x] Undo/Redo
|
||||
- [x] Keyboard shortcuts
|
||||
- [x] PageNavigator (gestione multi-pagina)
|
||||
- [x] Navigazione pagine in toolbar
|
||||
- [ ] Upload e gestione immagini nell'editor
|
||||
- [ ] Editor tabelle avanzato (colonne, binding dati)
|
||||
- [ ] UI relazioni tra dataset
|
||||
- [ ] Gestione sezioni header/footer
|
||||
|
||||
### Testing
|
||||
|
||||
- [x] Build frontend senza errori
|
||||
- [x] Build backend senza errori
|
||||
- [ ] Test funzionale editor canvas
|
||||
- [x] Test generazione PDF con dati reali (binding e formattazione funzionanti)
|
||||
- [ ] Test import/export template
|
||||
- [ ] Test con font e immagini custom
|
||||
|
||||
### Documentazione
|
||||
|
||||
- [x] Documentazione APRT metalanguage
|
||||
- [x] Lista API endpoints
|
||||
- [x] Checklist implementazione
|
||||
- [ ] Guida utente editor
|
||||
- [ ] Esempi template comuni
|
||||
|
||||
---
|
||||
|
||||
## Note Tecniche per Future Sessioni
|
||||
|
||||
### Struttura File Report System
|
||||
|
||||
```
|
||||
src/
|
||||
├── Apollinare.Domain/Entities/
|
||||
│ ├── ReportTemplate.cs # Entity template con TemplateJson
|
||||
│ ├── ReportFont.cs # Font custom uploadati
|
||||
│ └── ReportImage.cs # Immagini riutilizzabili
|
||||
│
|
||||
├── Apollinare.API/
|
||||
│ ├── Controllers/
|
||||
│ │ ├── ReportTemplatesController.cs # CRUD template
|
||||
│ │ ├── ReportResourcesController.cs # Font e immagini
|
||||
│ │ └── ReportsController.cs # Generazione PDF + schema
|
||||
│ │
|
||||
│ └── Services/Reports/
|
||||
│ ├── ReportGeneratorService.cs # QuestPDF generator
|
||||
│ └── AprtModels.cs # Modelli C# per APRT JSON
|
||||
|
||||
frontend/src/
|
||||
├── pages/
|
||||
│ ├── ReportTemplatesPage.tsx # Lista template
|
||||
│ └── ReportEditorPage.tsx # Editor principale
|
||||
│
|
||||
├── components/reportEditor/
|
||||
│ ├── EditorCanvas.tsx # Fabric.js canvas
|
||||
│ ├── EditorToolbar.tsx # Toolbar strumenti
|
||||
│ ├── PropertiesPanel.tsx # Proprietà elemento
|
||||
│ ├── DataBindingPanel.tsx # Browser campi dati
|
||||
│ ├── DatasetSelector.tsx # Selezione dataset
|
||||
│ ├── PreviewDialog.tsx # Dialog anteprima
|
||||
│ └── ContextMenu.tsx # Menu tasto destro (NEW)
|
||||
│
|
||||
├── types/
|
||||
│ └── report.ts # Types APRT + DTOs
|
||||
│
|
||||
└── services/
|
||||
└── reportService.ts # API calls
|
||||
```
|
||||
|
||||
### Problemi Risolti (da ricordare)
|
||||
|
||||
1. **Fabric.js v6 breaking changes:**
|
||||
- `sendToBack()` → `canvas.sendObjectToBack(obj)`
|
||||
- Event handlers hanno signature diversa
|
||||
- Proprietà `data` non è nel tipo base, serve cast a `FabricObjectWithData`
|
||||
|
||||
2. **TypeScript strict mode:**
|
||||
- Usare `as any` per event handlers Fabric.js
|
||||
- Interface `FabricObjectWithData` per oggetti con metadata custom
|
||||
|
||||
3. **QuestPDF TimeSpan:**
|
||||
- `evento.OraInizio` è `TimeSpan?` non `string`
|
||||
- Formattare con `{evento.OraInizio:hh\\:mm}`
|
||||
|
||||
4. **Data Binding PDF (FIX 27/11/2025):**
|
||||
- **Problema:** I binding `{{dataEvento}}` non venivano risolti - PDF mostrava campi vuoti
|
||||
- **Causa:** Il frontend creava binding senza prefisso dataset quando c'era un solo dataset
|
||||
- **Soluzione Frontend** (`DataBindingPanel.tsx`): Sempre includere il prefisso dataset
|
||||
```typescript
|
||||
// Prima: {{dataEvento}} - non funzionava
|
||||
// Dopo: {{evento.dataEvento}} - corretto
|
||||
const createBinding = (datasetId: string, fieldName: string) => {
|
||||
return `{{${datasetId}.${fieldName}}}`;
|
||||
};
|
||||
```
|
||||
- **Soluzione Backend** (`ReportGeneratorService.cs`): Aggiunto fallback per compatibilità con template esistenti
|
||||
```csharp
|
||||
// Se binding senza prefisso, cerca in tutti i dataset
|
||||
if (current == null && parts.Length == 1)
|
||||
{
|
||||
foreach (var kvp in dataContext)
|
||||
{
|
||||
var foundValue = GetPropertyValue(kvp.Value, path);
|
||||
if (foundValue != null) { current = foundValue; break; }
|
||||
}
|
||||
}
|
||||
```
|
||||
- **Formattazione:** Aggiunto `ResolveBindingWithFormat()` per applicare format (date, currency, etc.)
|
||||
|
||||
5. **SignalR Connection (FIX 27/11/2025):**
|
||||
- Aggiunto `app.UseWebSockets()` in Program.cs prima di `app.UseRouting()`
|
||||
- Configurato signalr.ts con `withAutomaticReconnect()`
|
||||
|
||||
6. **MUI Fragment in Menu (FIX 27/11/2025):**
|
||||
- Menu component non accetta Fragment come child
|
||||
- Sostituire `<>...</>` con array `[<Divider key="..." />, <MenuItem key="..." />]`
|
||||
|
||||
7. **HTML p/div nesting (FIX 27/11/2025):**
|
||||
- Error: `<div> cannot be a descendant of <p>`
|
||||
- Fix: `<ListItemText secondaryTypographyProps={{ component: "div" }} />`
|
||||
|
||||
8. **Context Menu Browser Default (FIX 27/11/2025 notte):**
|
||||
- **Problema:** Il menu contestuale del browser appariva invece di quello custom
|
||||
- **Soluzione:** Usare `onContextMenu` su Box container React invece di eventi Fabric.js
|
||||
- **File:** `EditorCanvas.tsx` - Aggiunto handler sul Box wrapper
|
||||
|
||||
9. **Fabric.js v6 Layer Ordering (FIX 27/11/2025 notte):**
|
||||
- **Problema:** `canvas.moveTo()` non esiste in Fabric.js v6
|
||||
- **Soluzione:** Usare `canvas.remove(obj)` + `canvas.insertAt(targetIndex, obj)`
|
||||
- **File:** `EditorCanvas.tsx` - Aggiunto z-index sync in useEffect
|
||||
|
||||
10. **QuestPDF Posizionamento Assoluto (RISOLTO 27/11/2025):**
|
||||
- **Problema:** QuestPDF non ha API `.Position()` per posizionamento assoluto
|
||||
- **Soluzione:** Usare SVG con `viewBox` in mm per avere coordinate 1:1 con il designer
|
||||
- **File:** `ReportGeneratorService.cs` - Metodi `GenerateSvgContent()`, `RenderElementToSvg()`
|
||||
- **Chiave della soluzione:**
|
||||
```csharp
|
||||
// SVG viewBox in mm - 1 unità SVG = 1mm
|
||||
svgBuilder.AppendLine($"<svg xmlns=\"...\" " +
|
||||
$"width=\"{contentWidthMm}mm\" height=\"{contentHeightMm}mm\" " +
|
||||
$"viewBox=\"0 0 {contentWidthMm} {contentHeightMm}\">");
|
||||
```
|
||||
- Le coordinate dal template sono già in mm relative all'area contenuto (dentro i margini)
|
||||
- Non serve più conversione mm→px: usiamo mm direttamente nel viewBox
|
||||
|
||||
11. **Immagini nel PDF (RISOLTO 27/11/2025):**
|
||||
- **Problema:** Le immagini embedded come data URI in `imageSettings.src` non venivano renderizzate
|
||||
- **Soluzione:** `RenderImageToSvg()` ora gestisce 3 fonti:
|
||||
1. Data URI (`data:image/...;base64,...`) - usato direttamente
|
||||
2. API URL (`/api/report-resources/images/{id}`) - caricato da DB e convertito in data URI
|
||||
3. URL esterni (`http://...`) - passato direttamente
|
||||
- **File:** `ReportGeneratorService.cs` - Metodo `RenderImageToSvg()`, `GuessMimeType()`
|
||||
|
||||
12. **Font Size nel PDF (RISOLTO 27/11/2025):**
|
||||
- **Problema:** Il font size appariva troppo grande/piccolo nel PDF
|
||||
- **Causa:** La formula `fontSize * mmToPx / 3` era un'approssimazione incorretta
|
||||
- **Soluzione:** Conversione corretta da px screen (96 DPI) a mm:
|
||||
```csharp
|
||||
// 1px @ 96 DPI = 0.2646mm
|
||||
var fontSizeMm = (style?.FontSize ?? 12) * 0.2646f;
|
||||
```
|
||||
- **File:** `ReportGeneratorService.cs` - Metodo `RenderElementToSvg()` case "text"
|
||||
|
||||
13. **Rotazione Oggetti nel PDF (RISOLTO 28/11/2025):**
|
||||
- **Problema:** Gli oggetti ruotati nel canvas Fabric.js venivano posizionati in modo completamente errato nel PDF
|
||||
- **Causa:** In Fabric.js con `originX='left'` e `originY='top'`, quando un oggetto viene ruotato:
|
||||
- L'oggetto ruota attorno al suo centro geometrico
|
||||
- Le coordinate `left`/`top` salvate rappresentano la posizione dell'origin point **dopo** la rotazione
|
||||
- Il backend calcolava il centro di rotazione in modo errato usando `(x + width/2, y + height/2)`
|
||||
- **Soluzione:** Implementata la formula corretta di Fabric.js per calcolare il centro:
|
||||
|
||||
```csharp
|
||||
// Calcolo del centro usando la formula Fabric.js (originX='left', originY='top')
|
||||
var angleRad = rotation * Math.PI / 180f;
|
||||
var halfWidth = width / 2;
|
||||
var halfHeight = height / 2;
|
||||
var cos = (float)Math.Cos(angleRad);
|
||||
var sin = (float)Math.Sin(angleRad);
|
||||
|
||||
// Centro dell'oggetto in coordinate canvas
|
||||
var centerX = left + halfWidth * cos - halfHeight * sin;
|
||||
var centerY = top + halfWidth * sin + halfHeight * cos;
|
||||
|
||||
// Posizione di disegno (angolo sup-sinistro del rettangolo non ruotato centrato sul centro)
|
||||
var drawX = centerX - halfWidth;
|
||||
var drawY = centerY - halfHeight;
|
||||
|
||||
// Ruota attorno al centro calcolato
|
||||
canvas.RotateDegrees(rotation, centerX, centerY);
|
||||
// Disegna a (drawX, drawY)
|
||||
```
|
||||
|
||||
- **File:** `ReportGeneratorService.cs` - Metodi `RenderElementToCanvas()` e `GenerateSvgContent()` + `RenderElementToSvg()`
|
||||
- **Nota:** La stessa logica è applicata sia al rendering bitmap (SkiaSharp) che SVG
|
||||
|
||||
14. **Gestione Multi-Pagina (IMPLEMENTATO 28/11/2025):**
|
||||
- **Struttura dati:**
|
||||
- `AprtPage`: `{ id, name, pageSize?, orientation?, margins?, backgroundColor? }`
|
||||
- `AprtElement.pageId`: ID della pagina a cui appartiene l'elemento
|
||||
- `AprtTemplate.pages`: Array di pagine del template
|
||||
- **Frontend:**
|
||||
- `PageNavigator.tsx`: Sidebar con lista pagine, context menu (rinomina, duplica, elimina, sposta)
|
||||
- `EditorToolbar.tsx`: Pulsanti prev/next pagina, indicatore "Pagina X di Y"
|
||||
- `ReportEditorPage.tsx`: State `currentPageId`, filtro elementi per pagina, handlers CRUD pagine
|
||||
- `PropertiesPanel.tsx`: Modifica nome pagina e impostazioni (format, orientation, margins, background)
|
||||
- **Backend (`ReportGeneratorService.cs`):**
|
||||
|
||||
```csharp
|
||||
// Pre-render di ogni pagina separatamente
|
||||
foreach (var pageDefinition in aprt.Pages)
|
||||
{
|
||||
var pageElements = aprt.Elements
|
||||
.Where(e => e.Visible && (e.PageId == pageDefinition.Id ||
|
||||
(string.IsNullOrEmpty(e.PageId) && pageDefinition.Id == aprt.Pages[0].Id)))
|
||||
.ToList();
|
||||
|
||||
var pageImageBytes = RenderContentToBitmap(pageElements, pageWidth, pageHeight, ...);
|
||||
pageRenderData.Add((pageWidth, pageHeight, bgColor, pageImageBytes));
|
||||
}
|
||||
|
||||
// Genera PDF con pagine separate
|
||||
Document.Create(container => {
|
||||
foreach (var (pageWidth, pageHeight, bgColor, imageBytes) in pageRenderData)
|
||||
container.Page(page => { page.Size(...); page.Content().Image(imageBytes); });
|
||||
});
|
||||
```
|
||||
|
||||
- **Migrazione template legacy:** `MigrateTemplatePages()` crea pagina default e assegna elementi orfani
|
||||
|
||||
### Schema Database Report System
|
||||
|
||||
Le tabelle sono già nel DbContext (`AppollinareDbContext.cs`):
|
||||
|
||||
- `ReportTemplates` - Template salvati
|
||||
- `ReportFonts` - Font custom
|
||||
- `ReportImages` - Immagini riutilizzabili
|
||||
|
||||
Migration già applicata per SQLite.
|
||||
|
||||
### Dipendenze Chiave
|
||||
|
||||
**Backend (NuGet):**
|
||||
|
||||
- `QuestPDF` - Generazione PDF (Community License, gratis per revenue < $1M)
|
||||
|
||||
**Frontend (npm):**
|
||||
|
||||
- `fabric` v6.x - Canvas editor
|
||||
- `uuid` - Generazione ID elementi
|
||||
- `@tanstack/react-query` - Data fetching
|
||||
|
||||
### Routes Frontend
|
||||
|
||||
```typescript
|
||||
// App.tsx
|
||||
<Route path="/report-templates" element={<ReportTemplatesPage />} />
|
||||
<Route path="/report-editor" element={<ReportEditorPage />} />
|
||||
<Route path="/report-editor/:id" element={<ReportEditorPage />} />
|
||||
```
|
||||
|
||||
Menu aggiunto in `Layout.tsx` sotto "Report" con icona PrintIcon.
|
||||
87174
Claude_Code_26112025.md
Normal file
87174
Claude_Code_26112025.md
Normal file
File diff suppressed because it is too large
Load Diff
425
PLAN.md
Normal file
425
PLAN.md
Normal file
@@ -0,0 +1,425 @@
|
||||
# Piano: Sistema di Report PDF con Editor Visuale
|
||||
|
||||
## Obiettivo
|
||||
Creare un sistema completo di generazione report PDF con:
|
||||
- Editor grafico drag-and-drop (stile Canva)
|
||||
- Potenza di JasperReports (data binding, paginazione, formule)
|
||||
- Metalinguaggio esportabile/importabile (tipo LaTeX)
|
||||
- Salvataggio template riutilizzabili
|
||||
- Supporto immagini e font personalizzati
|
||||
|
||||
## Architettura Proposta
|
||||
|
||||
### 1. Metalinguaggio Template (APRT - Apollinare Report Template)
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0",
|
||||
"meta": {
|
||||
"name": "Scheda Evento",
|
||||
"description": "Template per stampa evento",
|
||||
"author": "admin",
|
||||
"createdAt": "2025-01-15",
|
||||
"pageSize": "A4",
|
||||
"orientation": "portrait",
|
||||
"margins": { "top": 20, "right": 15, "bottom": 20, "left": 15 }
|
||||
},
|
||||
"resources": {
|
||||
"fonts": [
|
||||
{ "id": "font1", "name": "Roboto", "url": "/fonts/roboto.ttf" }
|
||||
],
|
||||
"images": [
|
||||
{ "id": "logo", "name": "Logo Aziendale", "url": "/images/logo.png" }
|
||||
]
|
||||
},
|
||||
"dataSources": {
|
||||
"evento": { "type": "object", "schema": "Evento" },
|
||||
"ospiti": { "type": "array", "schema": "EventoDettaglioOspiti" },
|
||||
"costi": { "type": "array", "schema": "EventoAltroCosto" }
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"type": "header",
|
||||
"height": 80,
|
||||
"repeatOnPages": true,
|
||||
"elements": [...]
|
||||
},
|
||||
{
|
||||
"type": "body",
|
||||
"elements": [...]
|
||||
},
|
||||
{
|
||||
"type": "detail",
|
||||
"dataSource": "ospiti",
|
||||
"elements": [...]
|
||||
},
|
||||
{
|
||||
"type": "footer",
|
||||
"height": 40,
|
||||
"repeatOnPages": true,
|
||||
"elements": [...]
|
||||
}
|
||||
],
|
||||
"elements": [
|
||||
{
|
||||
"id": "elem1",
|
||||
"type": "text",
|
||||
"position": { "x": 10, "y": 10, "width": 200, "height": 30 },
|
||||
"style": {
|
||||
"fontFamily": "font1",
|
||||
"fontSize": 24,
|
||||
"fontWeight": "bold",
|
||||
"color": "#333333",
|
||||
"textAlign": "left"
|
||||
},
|
||||
"content": {
|
||||
"type": "static",
|
||||
"value": "SCHEDA EVENTO"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "elem2",
|
||||
"type": "text",
|
||||
"position": { "x": 10, "y": 50, "width": 150, "height": 20 },
|
||||
"content": {
|
||||
"type": "binding",
|
||||
"expression": "{{evento.codice}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "elem3",
|
||||
"type": "image",
|
||||
"position": { "x": 450, "y": 10, "width": 100, "height": 60 },
|
||||
"content": {
|
||||
"type": "resource",
|
||||
"resourceId": "logo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "elem4",
|
||||
"type": "table",
|
||||
"position": { "x": 10, "y": 200, "width": 550, "height": "auto" },
|
||||
"dataSource": "ospiti",
|
||||
"columns": [
|
||||
{ "field": "tipoOspite.descrizione", "header": "Tipo", "width": 150 },
|
||||
{ "field": "numero", "header": "Quantità", "width": 100 },
|
||||
{ "field": "costoUnitario", "header": "Costo Unit.", "width": 100, "format": "currency" },
|
||||
{ "field": "costoTotale", "header": "Totale", "width": 100, "format": "currency" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "elem5",
|
||||
"type": "shape",
|
||||
"position": { "x": 10, "y": 180, "width": 550, "height": 2 },
|
||||
"style": {
|
||||
"backgroundColor": "#000000"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "pageNum",
|
||||
"type": "text",
|
||||
"section": "footer",
|
||||
"position": { "x": 250, "y": 10, "width": 100, "height": 20 },
|
||||
"content": {
|
||||
"type": "expression",
|
||||
"value": "Pagina {{$pageNumber}} di {{$totalPages}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Struttura Backend
|
||||
|
||||
#### Nuove Entità
|
||||
```
|
||||
ReportTemplate
|
||||
├── Id
|
||||
├── Nome
|
||||
├── Descrizione
|
||||
├── Categoria (Evento, Cliente, Articoli, etc.)
|
||||
├── TemplateJson (il metalinguaggio APRT)
|
||||
├── Thumbnail (preview del template)
|
||||
├── Attivo
|
||||
├── CreatedAt/By, UpdatedAt/By
|
||||
|
||||
ReportFont
|
||||
├── Id
|
||||
├── Nome
|
||||
├── FontFamily
|
||||
├── FontData (BLOB - file TTF/OTF)
|
||||
├── MimeType
|
||||
|
||||
ReportImage
|
||||
├── Id
|
||||
├── Nome
|
||||
├── Categoria
|
||||
├── ImageData (BLOB)
|
||||
├── MimeType
|
||||
├── Width, Height
|
||||
```
|
||||
|
||||
#### Nuovi Controller
|
||||
```
|
||||
ReportTemplatesController
|
||||
├── GET /api/report-templates # Lista template
|
||||
├── GET /api/report-templates/{id} # Dettaglio
|
||||
├── POST /api/report-templates # Crea
|
||||
├── PUT /api/report-templates/{id} # Aggiorna
|
||||
├── DELETE /api/report-templates/{id} # Elimina
|
||||
├── POST /api/report-templates/{id}/clone # Duplica
|
||||
├── GET /api/report-templates/{id}/export # Esporta .aprt
|
||||
├── POST /api/report-templates/import # Importa .aprt
|
||||
|
||||
ReportResourcesController
|
||||
├── GET /api/report-resources/fonts # Lista font
|
||||
├── POST /api/report-resources/fonts # Upload font
|
||||
├── DELETE /api/report-resources/fonts/{id}
|
||||
├── GET /api/report-resources/images # Lista immagini
|
||||
├── POST /api/report-resources/images # Upload immagine
|
||||
├── DELETE /api/report-resources/images/{id}
|
||||
|
||||
ReportGeneratorController
|
||||
├── POST /api/reports/generate # Genera PDF
|
||||
│ Body: { templateId, dataContext: { eventoId, ... } }
|
||||
├── POST /api/reports/preview # Anteprima (PNG/HTML)
|
||||
```
|
||||
|
||||
#### Servizio Generazione PDF
|
||||
Useremo **QuestPDF** per la generazione:
|
||||
- Supporto nativo .NET
|
||||
- API fluent per layout complessi
|
||||
- Font personalizzati
|
||||
- Immagini
|
||||
- Paginazione automatica
|
||||
- Performance eccellenti
|
||||
|
||||
```csharp
|
||||
public class ReportGeneratorService
|
||||
{
|
||||
public byte[] GeneratePdf(ReportTemplate template, object dataContext)
|
||||
{
|
||||
var parsed = ParseTemplate(template.TemplateJson);
|
||||
var document = Document.Create(container =>
|
||||
{
|
||||
container.Page(page =>
|
||||
{
|
||||
page.Size(parsed.PageSize);
|
||||
page.Margin(parsed.Margins);
|
||||
|
||||
if (parsed.Header != null)
|
||||
page.Header().Element(c => RenderSection(c, parsed.Header, dataContext));
|
||||
|
||||
page.Content().Element(c => RenderContent(c, parsed, dataContext));
|
||||
|
||||
if (parsed.Footer != null)
|
||||
page.Footer().Element(c => RenderSection(c, parsed.Footer, dataContext));
|
||||
});
|
||||
});
|
||||
|
||||
return document.GeneratePdf();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Frontend - Editor Visuale
|
||||
|
||||
#### Componenti Principali
|
||||
|
||||
```
|
||||
frontend/src/
|
||||
├── pages/
|
||||
│ ├── ReportEditorPage.tsx # Editor principale
|
||||
│ └── ReportTemplatesPage.tsx # Lista template
|
||||
├── components/
|
||||
│ └── reportEditor/
|
||||
│ ├── ReportEditor.tsx # Container principale
|
||||
│ ├── Canvas.tsx # Area di disegno (Fabric.js o Konva)
|
||||
│ ├── Toolbar.tsx # Barra strumenti (text, image, shape, table)
|
||||
│ ├── PropertiesPanel.tsx # Pannello proprietà elemento selezionato
|
||||
│ ├── DataBindingPanel.tsx # Pannello per mappare dati
|
||||
│ ├── LayersPanel.tsx # Gestione livelli/elementi
|
||||
│ ├── ResourcesPanel.tsx # Font e immagini disponibili
|
||||
│ ├── PageSettings.tsx # Impostazioni pagina
|
||||
│ ├── PreviewModal.tsx # Anteprima PDF
|
||||
│ └── elements/
|
||||
│ ├── TextElement.tsx
|
||||
│ ├── ImageElement.tsx
|
||||
│ ├── ShapeElement.tsx
|
||||
│ ├── TableElement.tsx
|
||||
│ └── BarcodeElement.tsx
|
||||
├── services/
|
||||
│ └── reportService.ts
|
||||
└── types/
|
||||
└── report.ts # Tipi TypeScript per APRT
|
||||
```
|
||||
|
||||
#### Libreria Canvas
|
||||
**Fabric.js** è la scelta migliore:
|
||||
- Drag & drop nativo
|
||||
- Selezione multipla
|
||||
- Ridimensionamento con handle
|
||||
- Rotazione elementi
|
||||
- Serializzazione JSON
|
||||
- Supporto testo, immagini, forme
|
||||
- Griglia e snap
|
||||
- Undo/redo
|
||||
|
||||
#### Flusso Editor
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ Toolbar: [Text] [Image] [Shape] [Table] [Line] [Barcode] │
|
||||
├─────────────┬───────────────────────────────────┬───────────────┤
|
||||
│ │ │ │
|
||||
│ Layers │ CANVAS │ Properties │
|
||||
│ Panel │ ┌─────────────────┐ │ Panel │
|
||||
│ │ │ HEADER │ │ │
|
||||
│ □ Logo │ │ [Logo] [Titolo]│ │ Position │
|
||||
│ □ Titolo │ ├─────────────────┤ │ x: 10 y: 10 │
|
||||
│ □ Data │ │ │ │ w: 200 h: 30 │
|
||||
│ □ Tabella │ │ BODY │ │ │
|
||||
│ □ Footer │ │ │ │ Style │
|
||||
│ │ │ [Data Evento] │ │ Font: Roboto │
|
||||
│ │ │ [Cliente] │ │ Size: 24 │
|
||||
│ │ │ [Tabella] │ │ Color: #333 │
|
||||
│ │ │ │ │ │
|
||||
│ │ ├─────────────────┤ │ Data Binding │
|
||||
│ │ │ FOOTER │ │ {{evento. │
|
||||
│ │ │ [Pag X di Y] │ │ codice}} │
|
||||
│ │ └─────────────────┘ │ │
|
||||
│ │ │ │
|
||||
├─────────────┴───────────────────────────────────┴───────────────┤
|
||||
│ Data Sources: [evento] [ospiti] [costi] [risorse] │
|
||||
│ Available Fields: codice, dataEvento, cliente.ragioneSociale...│
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 4. Implementazione Step-by-Step
|
||||
|
||||
#### Fase 1: Backend Foundation
|
||||
1. Creare entità `ReportTemplate`, `ReportFont`, `ReportImage`
|
||||
2. Aggiornare DbContext e migrare database
|
||||
3. Creare `ReportTemplatesController` con CRUD base
|
||||
4. Creare `ReportResourcesController` per upload font/immagini
|
||||
5. Installare e configurare QuestPDF
|
||||
6. Creare `ReportGeneratorService` base
|
||||
|
||||
#### Fase 2: Metalinguaggio Parser
|
||||
1. Definire classi C# per il metalinguaggio APRT
|
||||
2. Implementare parser JSON → oggetti
|
||||
3. Implementare renderer elementi → QuestPDF
|
||||
4. Gestire binding dati con espressioni {{campo}}
|
||||
5. Implementare paginazione e sezioni ripetute
|
||||
|
||||
#### Fase 3: Frontend Editor Base
|
||||
1. Installare Fabric.js (`fabric`)
|
||||
2. Creare pagina `ReportEditorPage`
|
||||
3. Implementare `Canvas` con Fabric.js
|
||||
4. Implementare `Toolbar` per aggiungere elementi
|
||||
5. Implementare `PropertiesPanel` per editing proprietà
|
||||
6. Implementare serializzazione canvas → APRT
|
||||
|
||||
#### Fase 4: Data Binding
|
||||
1. Creare `DataBindingPanel` con schema dati disponibili
|
||||
2. Implementare drag-drop campi su elementi
|
||||
3. Supportare espressioni {{campo.sottocampo}}
|
||||
4. Implementare formattazione (currency, date, number)
|
||||
5. Supportare espressioni condizionali
|
||||
|
||||
#### Fase 5: Tabelle e Repeater
|
||||
1. Implementare `TableElement` con colonne configurabili
|
||||
2. Supportare data source array per righe ripetute
|
||||
3. Implementare auto-height per tabelle
|
||||
4. Gestire page break automatici
|
||||
|
||||
#### Fase 6: Risorse e Upload
|
||||
1. Implementare upload font custom
|
||||
2. Implementare upload immagini
|
||||
3. Creare libreria risorse condivise
|
||||
4. Preview font e immagini
|
||||
|
||||
#### Fase 7: Preview e Generazione
|
||||
1. Implementare preview real-time (canvas → PNG)
|
||||
2. Implementare generazione PDF finale
|
||||
3. Download PDF
|
||||
4. Stampa diretta
|
||||
|
||||
#### Fase 8: Import/Export
|
||||
1. Implementare export .aprt (JSON + risorse embedded base64)
|
||||
2. Implementare import .aprt
|
||||
3. Validazione template importati
|
||||
|
||||
### 5. Template Esempio: Scheda Evento
|
||||
|
||||
Creeremo un template predefinito per la stampa eventi con:
|
||||
- Header con logo aziendale e titolo
|
||||
- Dati evento (codice, data, cliente, location)
|
||||
- Tabella ospiti con subtotali
|
||||
- Tabella costi aggiuntivi
|
||||
- Riepilogo totali
|
||||
- Note
|
||||
- Footer con paginazione
|
||||
|
||||
### 6. Dipendenze da Aggiungere
|
||||
|
||||
**Backend (NuGet):**
|
||||
```xml
|
||||
<PackageReference Include="QuestPDF" Version="2024.12.0" />
|
||||
```
|
||||
|
||||
**Frontend (npm):**
|
||||
```json
|
||||
{
|
||||
"fabric": "^6.0.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"@types/fabric": "^5.3.0"
|
||||
}
|
||||
```
|
||||
|
||||
### 7. Routes Frontend
|
||||
|
||||
```typescript
|
||||
// App.tsx - nuove routes
|
||||
<Route path="/report-templates" element={<ReportTemplatesPage />} />
|
||||
<Route path="/report-editor/:id?" element={<ReportEditorPage />} />
|
||||
<Route path="/report-preview/:templateId/:entityId" element={<ReportPreviewPage />} />
|
||||
```
|
||||
|
||||
### 8. Stima Componenti
|
||||
|
||||
| Componente | File | Complessità |
|
||||
|------------|------|-------------|
|
||||
| Entità + DbContext | 3 file | Bassa |
|
||||
| Controllers | 3 file | Media |
|
||||
| ReportGeneratorService | 1 file | Alta |
|
||||
| APRT Parser | 1 file | Media |
|
||||
| ReportEditorPage | 1 file | Alta |
|
||||
| Canvas (Fabric.js) | 1 file | Alta |
|
||||
| Toolbar | 1 file | Bassa |
|
||||
| PropertiesPanel | 1 file | Media |
|
||||
| DataBindingPanel | 1 file | Media |
|
||||
| LayersPanel | 1 file | Bassa |
|
||||
| Elementi (5 tipi) | 5 file | Media |
|
||||
| Services frontend | 1 file | Bassa |
|
||||
| Types | 1 file | Bassa |
|
||||
|
||||
**Totale: ~20 file, complessità alta**
|
||||
|
||||
---
|
||||
|
||||
## Decisioni Architetturali
|
||||
|
||||
1. **QuestPDF** invece di iTextSharp (licenza più permissiva, API moderna)
|
||||
2. **Fabric.js** invece di Konva (più features per editing)
|
||||
3. **JSON** come metalinguaggio (leggibile, facile da parsare)
|
||||
4. **Embedded resources** negli export (portabilità completa)
|
||||
5. **Real-time preview** via canvas (no round-trip server)
|
||||
|
||||
## Note Implementative
|
||||
|
||||
- Il canvas Fabric.js lavora in pixel, convertiremo in mm per la stampa
|
||||
- I font custom vanno registrati in QuestPDF all'avvio
|
||||
- Le immagini BLOB vanno convertite in base64 per Fabric.js
|
||||
- La paginazione è gestita lato server da QuestPDF
|
||||
- L'editor salva solo il JSON, la generazione PDF è on-demand
|
||||
336
docs/APPLICATION_OVERVIEW.md
Normal file
336
docs/APPLICATION_OVERVIEW.md
Normal file
@@ -0,0 +1,336 @@
|
||||
# Apollinare Catering & Banqueting - Application Overview
|
||||
|
||||
## Descrizione Applicazione Attuale
|
||||
|
||||
### Cos'è Apollinare
|
||||
|
||||
**Apollinare Catering & Banqueting Management Software** è un gestionale completo per aziende di catering e banqueting che gestisce l'intero ciclo di vita di un evento, dalla prima richiesta del cliente fino all'esecuzione finale.
|
||||
|
||||
L'applicazione è attualmente in uso presso Apollinare Catering (Italia) ed è stata sviluppata su piattaforma Oracle APEX 21.1.0.
|
||||
|
||||
### Funzionalità Principali
|
||||
|
||||
#### 1. Gestione Eventi
|
||||
|
||||
Il cuore dell'applicazione è la gestione degli eventi di catering:
|
||||
|
||||
- **Creazione Evento**: Wizard guidato per la creazione di nuovi eventi
|
||||
- **Dati Evento**: Data, orario cerimonia, orario evento, location, cliente
|
||||
- **Tipologie**: Matrimoni, battesimi, comunioni, cresime, eventi aziendali, feste private
|
||||
- **Tipo Pasto**: Pranzo, cena, pranzo buffet, cena buffet
|
||||
|
||||
#### 2. Workflow Stati Evento
|
||||
|
||||
L'evento attraversa diverse fasi:
|
||||
|
||||
```
|
||||
PREVENTIVO (100) → Cliente interessato, preventivo in preparazione
|
||||
↓
|
||||
SCHEDA (200) → Degustazione effettuata, scheda evento in preparazione
|
||||
↓
|
||||
CONFERMATA (300) → Prima caparra ricevuta
|
||||
↓
|
||||
QUASI CONFERMATO (350) → In attesa conferma definitiva
|
||||
↓
|
||||
CONFERMATO (400) → Evento confermato, in esecuzione
|
||||
↓
|
||||
SUPERATO (900) → Evento concluso o annullato
|
||||
```
|
||||
|
||||
#### 3. Gestione Ospiti
|
||||
|
||||
Sistema sofisticato per la gestione degli ospiti:
|
||||
|
||||
- **Tipi Ospiti**: Adulti, bambini, staff, fornitori esterni
|
||||
- **Conteggi Separati**: Seduti vs buffet, adulti vs bambini
|
||||
- **Coefficienti**: Ogni tipo ospite ha coefficienti per il calcolo quantità
|
||||
|
||||
#### 4. Lista Prelievo (Pick List)
|
||||
|
||||
Gestione automatizzata del materiale necessario:
|
||||
|
||||
- **Articoli**: Catalogo completo con immagini, quantità standard, coefficienti
|
||||
- **Categorie**: Posate, piatti, bicchieri, tovagliato, decorazioni, attrezzature cucina
|
||||
- **Calcolo Automatico**: Le quantità vengono calcolate automaticamente in base a:
|
||||
- Numero ospiti per tipo
|
||||
- Coefficienti categoria (A=Adulti, S=Seduti, B=Buffet)
|
||||
- Quantità standard articolo
|
||||
- **Disponibilità**: Verifica impegni articoli su altri eventi nella stessa data
|
||||
|
||||
#### 5. Gestione Risorse (Staff)
|
||||
|
||||
Pianificazione del personale:
|
||||
|
||||
- **Tipi Risorsa**: Camerieri, cuochi, barman, responsabili sala
|
||||
- **Assegnazione**: Assegnazione risorse per evento
|
||||
- **Report**: Riepilogo impegni risorse per data
|
||||
|
||||
#### 6. Sistema Acconti e Pagamenti
|
||||
|
||||
Gestione finanziaria completa:
|
||||
|
||||
- **Caparre Automatiche**: Sistema 30% - 50% - 20%
|
||||
- **Tracking Pagamenti**: Monitoraggio stato pagamenti
|
||||
- **Solleciti**: Identificazione eventi con pagamenti in scadenza (65 giorni)
|
||||
- **Email Automatiche**: Notifiche automatiche per pagamenti
|
||||
|
||||
#### 7. Reporting
|
||||
|
||||
Sistema di reportistica integrato:
|
||||
|
||||
- **Scheda Evento**: PDF completo per cliente
|
||||
- **Preventivo**: Documento commerciale
|
||||
- **Riepilogo Cucina**: Per lo staff di cucina
|
||||
- **Riepilogo Allestimenti**: Per team setup
|
||||
- **Griglia Eventi**: Vista calendario operativa
|
||||
- **Report Costi**: Analisi costi per evento/categoria
|
||||
|
||||
#### 8. Calendario
|
||||
|
||||
Vista calendario interattiva:
|
||||
|
||||
- **Visualizzazione**: Eventi per giorno/settimana/mese
|
||||
- **Colori Stati**: Codifica colore per stato evento
|
||||
- **Limiti**: Controllo numero massimo eventi per data
|
||||
- **Conflitti**: Verifica location già impegnate
|
||||
|
||||
#### 9. Gestione Degustazioni
|
||||
|
||||
Per eventi come matrimoni:
|
||||
|
||||
- **Pianificazione**: Data e dettagli degustazione
|
||||
- **Tracking**: Stato degustazione
|
||||
- **Note**: Preferenze e allergie
|
||||
|
||||
#### 10. Template Eventi
|
||||
|
||||
Sistema di template per velocizzare la creazione:
|
||||
|
||||
- **Template Predefiniti**: Configurazioni standard per tipologie evento
|
||||
- **Duplicazione**: Copia evento esistente come base
|
||||
- **Versionamento**: Sistema di versioni per tracciare modifiche
|
||||
|
||||
---
|
||||
|
||||
## Proposta SaaS: CaterPro
|
||||
|
||||
### Vision
|
||||
|
||||
Trasformare Apollinare in **CaterPro**, una piattaforma SaaS multi-tenant per la gestione di aziende di catering e banqueting, mantenendo le funzionalità core ma aggiungendo caratteristiche enterprise.
|
||||
|
||||
### Target Market
|
||||
|
||||
1. **Piccole Aziende di Catering** (1-10 dipendenti)
|
||||
- Piano Basic
|
||||
- Gestione eventi semplificata
|
||||
- Fino a 50 eventi/mese
|
||||
|
||||
2. **Medie Aziende di Catering** (10-50 dipendenti)
|
||||
- Piano Professional
|
||||
- Multi-location
|
||||
- Fino a 200 eventi/mese
|
||||
|
||||
3. **Grandi Aziende / Catene** (50+ dipendenti)
|
||||
- Piano Enterprise
|
||||
- Multi-brand, multi-country
|
||||
- Eventi illimitati
|
||||
|
||||
### Architettura SaaS
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ CaterPro Cloud │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
||||
│ │ Tenant A │ │ Tenant B │ │ Tenant C │ ... │
|
||||
│ │ (Catering │ │ (Wedding │ │ (Corporate │ │
|
||||
│ │ Roma) │ │ Planner) │ │ Events) │ │
|
||||
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ Shared Services │
|
||||
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
||||
│ │ Auth/IAM │ │ Billing │ │Analytics │ │ API │ │
|
||||
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ Infrastructure │
|
||||
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
||||
│ │ .NET 8 │ │ React │ │PostgreSQL│ │ Azure │ │
|
||||
│ │ API │ │ SPA │ │ /Oracle │ │ Cloud │ │
|
||||
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Funzionalità SaaS Aggiuntive
|
||||
|
||||
#### Multi-Tenancy
|
||||
- **Isolamento Dati**: Ogni cliente ha i propri dati completamente isolati
|
||||
- **Customizzazione**: Logo, colori, branding personalizzabile
|
||||
- **Subdomain**: cliente.caterpro.com
|
||||
|
||||
#### Gestione Utenti Avanzata
|
||||
- **Ruoli Predefiniti**: Admin, Manager, Operatore, Cucina, Solo Lettura
|
||||
- **Ruoli Custom**: Creazione ruoli personalizzati
|
||||
- **SSO**: Integrazione Azure AD, Google Workspace
|
||||
- **2FA**: Autenticazione a due fattori
|
||||
|
||||
#### Integrazioni
|
||||
- **Calendario**: Google Calendar, Outlook, Apple Calendar
|
||||
- **Pagamenti**: Stripe, PayPal, bonifici SEPA
|
||||
- **Contabilità**: Export per Fatture in Cloud, QuickBooks, Xero
|
||||
- **CRM**: Salesforce, HubSpot
|
||||
- **E-commerce**: Preventivi online, pagamenti online
|
||||
|
||||
#### Mobile App
|
||||
- **App iOS/Android**: Per staff in mobilità
|
||||
- **Check-in Ospiti**: QR code per eventi
|
||||
- **Inventario Mobile**: Scansione barcode articoli
|
||||
- **Foto Evento**: Upload diretto da app
|
||||
|
||||
#### Analytics & BI
|
||||
- **Dashboard Real-time**: KPI principali
|
||||
- **Report Avanzati**: Analisi trend, stagionalità
|
||||
- **Forecasting**: Previsioni ricavi
|
||||
- **Export**: Excel, PDF, API
|
||||
|
||||
#### Automazioni
|
||||
- **Email Marketing**: Campagne automatiche
|
||||
- **Reminder**: Notifiche scadenze, follow-up
|
||||
- **Workflow**: Automazione processi custom
|
||||
- **Webhooks**: Integrazione con sistemi esterni
|
||||
|
||||
### Pricing Model
|
||||
|
||||
#### Basic - €49/mese
|
||||
- 1 utente admin + 2 operatori
|
||||
- 50 eventi/mese
|
||||
- 500 articoli catalogo
|
||||
- Report base
|
||||
- Email support
|
||||
|
||||
#### Professional - €149/mese
|
||||
- 5 utenti inclusi (+€15/utente aggiuntivo)
|
||||
- 200 eventi/mese
|
||||
- Articoli illimitati
|
||||
- Multi-location (fino a 3)
|
||||
- Report avanzati
|
||||
- Integrazioni base
|
||||
- Chat support
|
||||
|
||||
#### Enterprise - €399/mese
|
||||
- Utenti illimitati
|
||||
- Eventi illimitati
|
||||
- Location illimitate
|
||||
- API access
|
||||
- Integrazioni premium
|
||||
- White-label option
|
||||
- SLA garantito
|
||||
- Account manager dedicato
|
||||
|
||||
#### Add-ons
|
||||
- **Mobile App**: +€29/mese
|
||||
- **E-commerce Module**: +€49/mese
|
||||
- **Advanced Analytics**: +€39/mese
|
||||
- **Custom Integrations**: Su richiesta
|
||||
|
||||
### Stack Tecnologico Proposto
|
||||
|
||||
#### Backend (.NET 8)
|
||||
```
|
||||
├── CaterPro.API # Web API REST
|
||||
├── CaterPro.Core # Domain models, interfaces
|
||||
├── CaterPro.Application # Business logic, CQRS
|
||||
├── CaterPro.Infrastructure # Data access, external services
|
||||
├── CaterPro.Identity # Authentication/Authorization
|
||||
└── CaterPro.Workers # Background jobs
|
||||
```
|
||||
|
||||
#### Frontend (React TypeScript)
|
||||
```
|
||||
├── src/
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ ├── features/ # Feature-based modules
|
||||
│ │ ├── events/ # Event management
|
||||
│ │ ├── inventory/ # Article/inventory
|
||||
│ │ ├── calendar/ # Calendar views
|
||||
│ │ ├── reports/ # Reporting
|
||||
│ │ └── settings/ # Configuration
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ ├── services/ # API services
|
||||
│ ├── store/ # Redux/Zustand state
|
||||
│ └── utils/ # Utilities
|
||||
```
|
||||
|
||||
#### Database
|
||||
- **Primary**: PostgreSQL (per SaaS cost-efficiency)
|
||||
- **Alternative**: Oracle (per clienti enterprise on-premise)
|
||||
- **Cache**: Redis
|
||||
- **Search**: Elasticsearch (per ricerca articoli/eventi)
|
||||
|
||||
#### Infrastructure
|
||||
- **Cloud**: Azure / AWS
|
||||
- **Container**: Docker + Kubernetes
|
||||
- **CI/CD**: GitHub Actions / Azure DevOps
|
||||
- **Monitoring**: Application Insights / DataDog
|
||||
|
||||
### Roadmap Migrazione
|
||||
|
||||
#### Fase 1: Core Migration (3-4 mesi)
|
||||
- [ ] Setup architettura .NET 8
|
||||
- [ ] Migrazione modelli dati
|
||||
- [ ] API REST per entità principali
|
||||
- [ ] Frontend React base
|
||||
- [ ] Autenticazione JWT
|
||||
|
||||
#### Fase 2: Feature Parity (2-3 mesi)
|
||||
- [ ] Gestione eventi completa
|
||||
- [ ] Sistema calcolo quantità
|
||||
- [ ] Workflow stati
|
||||
- [ ] Report PDF
|
||||
- [ ] Calendario
|
||||
|
||||
#### Fase 3: SaaS Features (2-3 mesi)
|
||||
- [ ] Multi-tenancy
|
||||
- [ ] Billing integration
|
||||
- [ ] User management avanzato
|
||||
- [ ] Customization engine
|
||||
|
||||
#### Fase 4: Advanced Features (3-4 mesi)
|
||||
- [ ] Mobile app
|
||||
- [ ] Integrazioni terze parti
|
||||
- [ ] Analytics avanzati
|
||||
- [ ] E-commerce module
|
||||
|
||||
### Vantaggi Competitivi
|
||||
|
||||
1. **Esperienza Reale**: Basato su software in produzione da anni
|
||||
2. **Specifico per Settore**: Non un gestionale generico adattato
|
||||
3. **Calcolo Automatico**: Algoritmo quantità unico nel settore
|
||||
4. **Workflow Collaudato**: Processo testato su centinaia di eventi
|
||||
5. **Localizzazione**: Già disponibile in italiano, facilmente estendibile
|
||||
|
||||
### Competitor Analysis
|
||||
|
||||
| Feature | CaterPro | Caterease | Total Party Planner | Better Cater |
|
||||
|---------|----------|-----------|---------------------|--------------|
|
||||
| Gestione Eventi | ✅ | ✅ | ✅ | ✅ |
|
||||
| Calcolo Auto Quantità | ✅ | ❌ | ❌ | Parziale |
|
||||
| Multi-tenant | ✅ | ❌ | ❌ | ✅ |
|
||||
| Mobile App | ✅ | ✅ | ❌ | ✅ |
|
||||
| Italiano | ✅ | ❌ | ❌ | ❌ |
|
||||
| API Pubbliche | ✅ | Parziale | ❌ | ✅ |
|
||||
| Prezzo Entry | €49 | $75 | $50 | $99 |
|
||||
|
||||
---
|
||||
|
||||
## Conclusioni
|
||||
|
||||
L'applicazione Apollinare rappresenta un'eccellente base per lo sviluppo di una soluzione SaaS nel settore catering. Le funzionalità core sono mature e testate, la business logic è ben documentata, e l'architettura può essere modernizzata mantenendo la compatibilità con i processi esistenti.
|
||||
|
||||
La migrazione a .NET + React TypeScript permetterà:
|
||||
- Scalabilità orizzontale per SaaS
|
||||
- Developer experience moderna
|
||||
- Ecosystem di librerie più ampio
|
||||
- Deployment cloud-native
|
||||
- Costi operativi ridotti
|
||||
|
||||
Il mercato italiano del catering è frammentato e sottosevito da soluzioni software moderne, rappresentando un'opportunità significativa per un prodotto SaaS verticale ben eseguito.
|
||||
422
docs/README.md
Normal file
422
docs/README.md
Normal file
@@ -0,0 +1,422 @@
|
||||
# Apollinare Catering - Documentazione Completa
|
||||
|
||||
Questa documentazione contiene l'estrazione completa di tutti gli oggetti del database Oracle e dell'applicazione APEX di Apollinare Catering & Banqueting.
|
||||
|
||||
## [Application Overview](APPLICATION_OVERVIEW.md)
|
||||
|
||||
**Apollinare Catering & Banqueting Management Software** è un gestionale completo per aziende di catering che gestisce l'intero ciclo di vita di un evento: dalla richiesta del cliente, al preventivo, alla conferma, fino all'esecuzione.
|
||||
|
||||
### Funzionalità Principali
|
||||
|
||||
| Area | Descrizione |
|
||||
| --------------------- | ------------------------------------------- |
|
||||
| **Gestione Eventi** | Creazione, workflow stati, versioning |
|
||||
| **Gestione Ospiti** | Tipologie ospiti, conteggi, coefficienti |
|
||||
| **Lista Prelievo** | Calcolo automatico quantità materiale |
|
||||
| **Risorse/Staff** | Pianificazione personale per evento |
|
||||
| **Acconti/Pagamenti** | Sistema caparre 30%-50%-20%, solleciti |
|
||||
| **Calendario** | Vista eventi, limiti giornalieri, conflitti |
|
||||
| **Reporting** | Schede evento, preventivi, report cucina |
|
||||
|
||||
### Proposta SaaS: CaterPro
|
||||
|
||||
La documentazione include una proposta per trasformare Apollinare in **CaterPro**, una piattaforma SaaS multi-tenant:
|
||||
|
||||
- **Target**: Piccole, medie e grandi aziende di catering
|
||||
- **Stack**: .NET 8 + React TypeScript + PostgreSQL/Oracle
|
||||
- **Pricing**: Da €49/mese (Basic) a €399/mese (Enterprise)
|
||||
- **Roadmap**: 10-14 mesi per feature parity + SaaS
|
||||
|
||||
Leggi la [documentazione completa](APPLICATION_OVERVIEW.md) per dettagli su architettura, funzionalità e roadmap.
|
||||
|
||||
---
|
||||
|
||||
## Struttura della Documentazione
|
||||
|
||||
```
|
||||
docs/
|
||||
├── apex/ # Applicazione APEX
|
||||
│ ├── README.md # Overview applicazione
|
||||
│ ├── pages/ # 56 pagine
|
||||
│ ├── processes/ # 98 processi
|
||||
│ ├── lovs/ # 12 List of Values
|
||||
│ ├── javascript/ # Librerie JavaScript
|
||||
│ ├── authorization/ # 5 schemi autorizzazione
|
||||
│ ├── dynamic-actions/ # Azioni dinamiche
|
||||
│ ├── items/ # Items condivisi
|
||||
│ ├── regions/ # Regioni condivise
|
||||
│ └── navigation/ # Navigazione
|
||||
├── tables/ # 32 tabelle
|
||||
├── views/ # 26 viste
|
||||
├── procedures/ # 11 stored procedures
|
||||
├── functions/ # 23 funzioni
|
||||
├── packages/ # 17 packages
|
||||
├── triggers/ # 19 triggers
|
||||
├── sequences/ # 22 sequences
|
||||
└── types/ # 10 tipi custom
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## APEX Application Documentation
|
||||
|
||||
### [APEX Application Overview](apex/README.md)
|
||||
|
||||
**Application:** APCB Project (ID: 112)
|
||||
**APEX Version:** 21.1.0
|
||||
**Schema:** APOLLINARECATERINGPROD
|
||||
|
||||
| Component | Count |
|
||||
| --------------- | ----- |
|
||||
| Pages | 56 |
|
||||
| Items | 302 |
|
||||
| Processes | 98 |
|
||||
| Regions | 151 |
|
||||
| Buttons | 119 |
|
||||
| Dynamic Actions | 62 |
|
||||
| LOVs | 12 |
|
||||
|
||||
### Key APEX Documentation
|
||||
|
||||
- [APEX README](apex/README.md) - Application overview and navigation
|
||||
- [Processes Documentation](apex/processes/README.md) - All 98 processes with PL/SQL code
|
||||
- [LOVs Documentation](apex/lovs/README.md) - 12 List of Values definitions
|
||||
- [JavaScript Libraries](apex/javascript/README.md) - Custom ajaxUtils.js and iframeObj.js
|
||||
- [Authorization Schemes](apex/authorization/README.md) - 5 security schemes
|
||||
|
||||
### Critical APEX Pages
|
||||
|
||||
| Page | Name | Description |
|
||||
| ------ | ---------------- | ------------------------------------------------- |
|
||||
| 1 | Home | Dashboard principale |
|
||||
| **22** | **Nuovo Evento** | **Pagina più complessa (108 items, 32 processi)** |
|
||||
| 9 | Liste | Lista eventi |
|
||||
| 12 | Calendario | Calendario eventi |
|
||||
| 35 | Schede | Schede evento |
|
||||
|
||||
---
|
||||
|
||||
## Indice per Categoria
|
||||
|
||||
### [Tabelle](tables/README.md) (32)
|
||||
|
||||
Tabelle principali del dominio business:
|
||||
|
||||
- [EVENTI](tables/EVENTI.md) - Tabella principale eventi
|
||||
- [EVENTI_DET_PREL](tables/EVENTI_DET_PREL.md) - Liste prelievo
|
||||
- [EVENTI_DET_OSPITI](tables/EVENTI_DET_OSPITI.md) - Dettaglio ospiti
|
||||
- [EVENTI_DET_RIS](tables/EVENTI_DET_RIS.md) - Risorse assegnate
|
||||
- [EVENTI_DET_DEGUST](tables/EVENTI_DET_DEGUST.md) - Degustazioni
|
||||
- [EVENTI_ACCONTI](tables/EVENTI_ACCONTI.md) - Gestione acconti/pagamenti
|
||||
- [EVENTI_ALTRICOSTI](tables/EVENTI_ALTRICOSTI.md) - Altri costi
|
||||
- [EVENTI_ALLEG](tables/EVENTI_ALLEG.md) - Allegati
|
||||
- [ARTICOLI](tables/ARTICOLI.md) - Catalogo articoli
|
||||
- [COSTI_ARTICOLI](tables/COSTI_ARTICOLI.md) - Storico costi
|
||||
- [CLIENTI](tables/CLIENTI.md) - Anagrafica clienti
|
||||
- [LOCATION](tables/LOCATION.md) - Location eventi
|
||||
- [RISORSE](tables/RISORSE.md) - Personale
|
||||
|
||||
Tabelle di lookup:
|
||||
|
||||
- [TB_TIPI_MAT](tables/TB_TIPI_MAT.md) - Tipi materiale
|
||||
- [TB_CODICI_CATEG](tables/TB_CODICI_CATEG.md) - Categorie
|
||||
- [TB_TIPI_EVENTO](tables/TB_TIPI_EVENTO.md) - Tipi evento
|
||||
- [TB_TIPI_OSPITI](tables/TB_TIPI_OSPITI.md) - Tipi ospiti
|
||||
- [TB_TIPI_RISORSA](tables/TB_TIPI_RISORSA.md) - Tipi risorsa
|
||||
- [TB_TIPI_PASTO](tables/TB_TIPI_PASTO.md) - Tipi pasto
|
||||
- [TB_CALENDAR_LOCKS](tables/TB_CALENDAR_LOCKS.md) - Limiti calendario
|
||||
- [TB_CONFIG](tables/TB_CONFIG.md) - Configurazioni
|
||||
|
||||
Tabelle di sistema:
|
||||
|
||||
- [USERS_READONLY](tables/USERS_READONLY.md) - Permessi utenti
|
||||
- [XLIB_LOGS](tables/XLIB_LOGS.md) - Log applicazione
|
||||
- [XLIB_COMPONENTS](tables/XLIB_COMPONENTS.md) - Componenti
|
||||
- [XLIB_JASPERREPORTS_CONF](tables/XLIB_JASPERREPORTS_CONF.md) - Config report
|
||||
- [XLIB_JASPERREPORTS_DEMOS](tables/XLIB_JASPERREPORTS_DEMOS.md) - Demo report
|
||||
|
||||
### [Viste](views/README.md) (26)
|
||||
|
||||
Viste per calcolo costi:
|
||||
|
||||
- [GET_COSTO_ART_BY_EVT](views/GET_COSTO_ART_BY_EVT.md) - Costo articoli per evento
|
||||
- [GET_COSTO_ART_EVT](views/GET_COSTO_ART_EVT.md) - Costo articoli aggregato
|
||||
- [GET_COSTO_CATEG_EVT](views/GET_COSTO_CATEG_EVT.md) - Costo per categoria
|
||||
- [GET_COSTO_DEGUS_EVT](views/GET_COSTO_DEGUS_EVT.md) - Costo degustazioni
|
||||
- [GET_COSTO_OSPITI_EVT](views/GET_COSTO_OSPITI_EVT.md) - Costo ospiti
|
||||
- [GET_COSTO_RIS_EVT](views/GET_COSTO_RIS_EVT.md) - Costo risorse
|
||||
- [GET_COSTO_TIPI_EVT](views/GET_COSTO_TIPI_EVT.md) - Costo per tipo
|
||||
- [GET_ULTIMI_COSTI](views/GET_ULTIMI_COSTI.md) - Ultimi costi articoli
|
||||
|
||||
Viste per eventi:
|
||||
|
||||
- [GET_EVT_DATA](views/GET_EVT_DATA.md) - Dati evento completi
|
||||
- [GET_EVT_DATA_PRINT](views/GET_EVT_DATA_PRINT.md) - Dati per stampa
|
||||
- [GET_PREL_ART_TOT](views/GET_PREL_ART_TOT.md) - Totali prelievo
|
||||
- [GET_PREL_BY_EVT](views/GET_PREL_BY_EVT.md) - Prelievi per evento
|
||||
|
||||
Viste per calendario e stato:
|
||||
|
||||
- [VW_CALENDARIO_EVENTI](views/VW_CALENDARIO_EVENTI.md) - Vista calendario
|
||||
- [VW_EVENT_COLOR](views/VW_EVENT_COLOR.md) - Colori stati
|
||||
- [VW_EVENTI_STATUSES](views/VW_EVENTI_STATUSES.md) - Stati eventi
|
||||
|
||||
Viste per giacenze:
|
||||
|
||||
- [V_IMPEGNI_ARTICOLI](views/V_IMPEGNI_ARTICOLI.md) - Impegni articoli
|
||||
- [V_IMPEGNI_ARTICOLI_LOC](views/V_IMPEGNI_ARTICOLI_LOC.md) - Impegni per location
|
||||
|
||||
Viste per report:
|
||||
|
||||
- [V_REP_ALLESTIMENTI](views/V_REP_ALLESTIMENTI.md) - Report allestimenti
|
||||
- [VW_REP_DEGUSTAZIONI](views/VW_REP_DEGUSTAZIONI.md) - Report degustazioni
|
||||
- [V_GRIGLIA](views/V_GRIGLIA.md) - Vista griglia
|
||||
- [GET_REPORT_CONSUNTIVO_PER_DATA](views/GET_REPORT_CONSUNTIVO_PER_DATA.md) - Consuntivo
|
||||
|
||||
Viste per utenti/permessi:
|
||||
|
||||
- [GET_CONSUNTIVI_USERS](views/GET_CONSUNTIVI_USERS.md) - Utenti consuntivi
|
||||
- [GET_GESTORI_USERS](views/GET_GESTORI_USERS.md) - Utenti gestori
|
||||
- [GET_USERS_LIST](views/GET_USERS_LIST.md) - Lista utenti
|
||||
|
||||
Viste per pagamenti:
|
||||
|
||||
- [GET_EVENTI_DA_PAGARE_ENTRO_65GG](views/GET_EVENTI_DA_PAGARE_ENTRO_65GG.md) - Eventi da sollecitare
|
||||
|
||||
### [Stored Procedures](procedures/README.md) (11)
|
||||
|
||||
Business logic principale:
|
||||
|
||||
- [EVENTI_AGGIORNA_QTA_LISTA](procedures/EVENTI_AGGIORNA_QTA_LISTA.md) - Ricalcolo quantità lista prelievo
|
||||
- [EVENTI_AGGIORNA_TOT_OSPITI](procedures/EVENTI_AGGIORNA_TOT_OSPITI.md) - Aggiorna totale ospiti
|
||||
- [EVENTI_COPIA](procedures/EVENTI_COPIA.md) - Duplicazione evento
|
||||
- [EVENTI_RICALCOLA_ACCONTI](procedures/EVENTI_RICALCOLA_ACCONTI.md) - Ricalcolo acconti
|
||||
- [EVENTO_ELIMINA_PRELIEVI](procedures/EVENTO_ELIMINA_PRELIEVI.md) - Elimina prelievi
|
||||
- [LISTE_COPIA](procedures/LISTE_COPIA.md) - Copia liste tra eventi
|
||||
- [P_CANCEL_SAME_LOCATION_EVENTS](procedures/P_CANCEL_SAME_LOCATION_EVENTS.md) - Annulla eventi stessa location
|
||||
|
||||
Utility:
|
||||
|
||||
- [ROWSORT_TIPI](procedures/ROWSORT_TIPI.md) - Ordinamento tipi
|
||||
- [HTPPRN](procedures/HTPPRN.md) - Stampa HTTP
|
||||
- [SEND_DATA_TO_DROPBOX](procedures/SEND_DATA_TO_DROPBOX.md) - Export Dropbox
|
||||
- [XLOG](procedures/XLOG.md) - Logging
|
||||
|
||||
### [Funzioni](functions/README.md) (23)
|
||||
|
||||
Calcolo quantità e disponibilità:
|
||||
|
||||
- [F_GET_QTA_IMPEGNATA](functions/F_GET_QTA_IMPEGNATA.md) - Quantità impegnata
|
||||
- [F_GET_TOT_OSPITI](functions/F_GET_TOT_OSPITI.md) - Totale ospiti
|
||||
- [F_GET_OSPITI](functions/F_GET_OSPITI.md) - Dettaglio ospiti (pipelined)
|
||||
- [F_LIST_PRELIEVO_ADD_ARTICOLO](functions/F_LIST_PRELIEVO_ADD_ARTICOLO.md) - Aggiunta articolo
|
||||
|
||||
Calcolo costi:
|
||||
|
||||
- [F_GET_COSTO_ARTICOLO](functions/F_GET_COSTO_ARTICOLO.md) - Costo articolo a data
|
||||
|
||||
Validazioni:
|
||||
|
||||
- [F_EVENTO_SCADUTO](functions/F_EVENTO_SCADUTO.md) - Verifica scadenza
|
||||
- [F_MAX_NUMERO_EVENTI_RAGGIUNTO](functions/F_MAX_NUMERO_EVENTI_RAGGIUNTO.md) - Limite eventi
|
||||
- [F_MAX_NUM_EVENTI_CONFERMATI](functions/F_MAX_NUM_EVENTI_CONFERMATI.md) - Limite confermati
|
||||
- [F_CI_SONO_EVENTI_CONFERMATI](functions/F_CI_SONO_EVENTI_CONFERMATI.md) - Check confermati
|
||||
|
||||
Report:
|
||||
|
||||
- [F_REP_ALLESTIMENTI](functions/F_REP_ALLESTIMENTI.md) - Report allestimenti
|
||||
- [F_REP_CUCINA](functions/F_REP_CUCINA.md) - Report cucina
|
||||
- [F_GET_ANGOLO_ALLESTIMENTO](functions/F_GET_ANGOLO_ALLESTIMENTO.md) - Angolo allestimento
|
||||
- [F_GET_ANGOLO_ALLESTIMENTO_OB](functions/F_GET_ANGOLO_ALLESTIMENTO_OB.md) - Angolo open bar
|
||||
- [F_GET_TOVAGLIATO_ALLESTIMENTO](functions/F_GET_TOVAGLIATO_ALLESTIMENTO.md) - Tovagliato
|
||||
|
||||
Autorizzazioni:
|
||||
|
||||
- [F_USER_IN_ROLE](functions/F_USER_IN_ROLE.md) - Verifica ruolo utente
|
||||
- [F_USER_IN_ROLE_STR](functions/F_USER_IN_ROLE_STR.md) - Ruolo utente (stringa)
|
||||
|
||||
Utility:
|
||||
|
||||
- [F_DAY_TO_NAME](functions/F_DAY_TO_NAME.md) - Giorno in italiano
|
||||
- [STRING_TO_TABLE_ENUM](functions/STRING_TO_TABLE_ENUM.md) - Stringa a tabella
|
||||
- [GET_PARAM_VALUE](functions/GET_PARAM_VALUE.md) - Valore parametro
|
||||
- [SPLIT](functions/SPLIT.md) - Split stringa
|
||||
- [MY_INSTR](functions/MY_INSTR.md) - Instr custom
|
||||
- [CLOB2BLOB](functions/CLOB2BLOB.md) - Conversione CLOB
|
||||
- [EXTDATE_GET_ITA](functions/EXTDATE_GET_ITA.md) - Data in italiano
|
||||
|
||||
### [Packages](packages/README.md) (17)
|
||||
|
||||
Business:
|
||||
|
||||
- [MAIL_PKG](packages/MAIL_PKG.md) - Gestione invio email automatiche
|
||||
|
||||
Utility esterne:
|
||||
|
||||
- [UTL_BASE64](packages/UTL_BASE64.md) - Encoding Base64
|
||||
|
||||
JasperReports:
|
||||
|
||||
- [XLIB_JASPERREPORTS](packages/XLIB_JASPERREPORTS.md) - Integrazione JasperReports
|
||||
- [XLIB_JASPERREPORTS_IMG](packages/XLIB_JASPERREPORTS_IMG.md) - Immagini report
|
||||
|
||||
HTTP/Componenti:
|
||||
|
||||
- [XLIB_HTTP](packages/XLIB_HTTP.md) - Chiamate HTTP
|
||||
- [XLIB_COMPONENT](packages/XLIB_COMPONENT.md) - Componenti
|
||||
- [XLIB_LOG](packages/XLIB_LOG.md) - Logging
|
||||
|
||||
JSON (libreria PLJSON):
|
||||
|
||||
- [PLJSON_DYN](packages/PLJSON_DYN.md)
|
||||
- [PLJSON_EXT](packages/PLJSON_EXT.md)
|
||||
- [PLJSON_HELPER](packages/PLJSON_HELPER.md)
|
||||
- [PLJSON_ML](packages/PLJSON_ML.md)
|
||||
- [PLJSON_OBJECT_CACHE](packages/PLJSON_OBJECT_CACHE.md)
|
||||
- [PLJSON_PARSER](packages/PLJSON_PARSER.md)
|
||||
- [PLJSON_PRINTER](packages/PLJSON_PRINTER.md)
|
||||
- [PLJSON_UT](packages/PLJSON_UT.md)
|
||||
- [PLJSON_UTIL_PKG](packages/PLJSON_UTIL_PKG.md)
|
||||
- [PLJSON_XML](packages/PLJSON_XML.md)
|
||||
|
||||
### [Triggers](triggers/README.md) (19)
|
||||
|
||||
Generazione ID:
|
||||
|
||||
- [EVENTI_TRG](triggers/EVENTI_TRG.md) - ID eventi + inizializzazione
|
||||
- [EVENTI_AI_TRG](triggers/EVENTI_AI_TRG.md) - Creazione ospiti default
|
||||
- [EVENTI_DET_PREL_TRG](triggers/EVENTI_DET_PREL_TRG.md) - ID prelievi
|
||||
- [EVENTI_DET_RIS_TRG](triggers/EVENTI_DET_RIS_TRG.md) - ID risorse
|
||||
- [EVENTI_DET_DEGUST_TRG](triggers/EVENTI_DET_DEGUST_TRG.md) - ID degustazioni
|
||||
- [EVENTI_ACCONTI_TRG](triggers/EVENTI_ACCONTI_TRG.md) - ID acconti
|
||||
- [EVENTI_ALTRICOSTI_TRG](triggers/EVENTI_ALTRICOSTI_TRG.md) - ID altri costi
|
||||
- [EVENTI_ALLEG_TRG](triggers/EVENTI_ALLEG_TRG.md) - ID allegati
|
||||
- [CLIENTI_TRG](triggers/CLIENTI_TRG.md) - ID clienti
|
||||
- [LOCATION_TRG](triggers/LOCATION_TRG.md) - ID location
|
||||
- [RISORSE_TRG](triggers/RISORSE_TRG.md) - ID risorse
|
||||
- [ARTICOLI_DET_REGOLE_TRG](triggers/ARTICOLI_DET_REGOLE_TRG.md) - ID regole articoli
|
||||
- [TB_TIPI_PASTO_TRG](triggers/TB_TIPI_PASTO_TRG.md) - ID tipi pasto
|
||||
|
||||
Business logic:
|
||||
|
||||
- [EVENTI_DET_OSPITI_TRG_AI](triggers/EVENTI_DET_OSPITI_TRG_AI.md) - Aggiornamento ospiti
|
||||
- [EVENTI_DET_PREL_QTA_TOT_TRG](triggers/EVENTI_DET_PREL_QTA_TOT_TRG.md) - Calcolo quantità totale
|
||||
|
||||
Ordinamento:
|
||||
|
||||
- [ADD_COD_STEP](triggers/ADD_COD_STEP.md) - Ordine tipi materiale
|
||||
- [ON_DELETE_REORDER](triggers/ON_DELETE_REORDER.md) - Riordino dopo delete
|
||||
|
||||
Sistema:
|
||||
|
||||
- [BI_GL_SCHEMA_CHANGES](triggers/BI_GL_SCHEMA_CHANGES.md) - Log modifiche schema
|
||||
- [XLIB_LOGS_BI_TRG](triggers/XLIB_LOGS_BI_TRG.md) - Log applicazione
|
||||
|
||||
### [Sequences](sequences/README.md) (22)
|
||||
|
||||
Tutte le sequence del database.
|
||||
|
||||
### [Types](types/README.md) (10)
|
||||
|
||||
Tipi custom:
|
||||
|
||||
- [T_DET_OSPITI_ROW](types/T_DET_OSPITI_ROW.md) / [T_DET_OSPITI_TAB](types/T_DET_OSPITI_TAB.md) - Tipo per F_GET_OSPITI
|
||||
- [T_REP_ALLESTIMENTI_ROW](types/T_REP_ALLESTIMENTI_ROW.md) / [T_REP_ALLESTIMENTI_TAB](types/T_REP_ALLESTIMENTI_TAB.md) - Tipo per F_REP_ALLESTIMENTI
|
||||
- [T_REP_CUCINA_ROW](types/T_REP_CUCINA_ROW.md) / [T_REP_CUCINA_TAB](types/T_REP_CUCINA_TAB.md) - Tipo per F_REP_CUCINA
|
||||
- [STRING_LIST](types/STRING_LIST.md) - Lista stringhe
|
||||
- [ENUM_TABLE_OBJECT](types/ENUM_TABLE_OBJECT.md) / [ENUM_TABLE_TYPE](types/ENUM_TABLE_TYPE.md) - Tipi per STRING_TO_TABLE_ENUM
|
||||
- [XLIB_VC2_ARRAY_T](types/XLIB_VC2_ARRAY_T.md) - Array varchar2
|
||||
|
||||
---
|
||||
|
||||
## Schema ER Semplificato
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ CLIENTI │
|
||||
└──────┬──────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ LOCATION │◄────│ EVENTI │────►│TB_TIPI_EVENTO│
|
||||
└─────────────┘ └──────┬──────┘ └─────────────┘
|
||||
│
|
||||
┌─────────────────┼─────────────────┐
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│EVENTI_DET_OSPITI│ │ EVENTI_DET_PREL │ │ EVENTI_DET_RIS │
|
||||
└─────────────────┘ └────────┬────────┘ └────────┬────────┘
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ TB_TIPI_OSPITI │ │ ARTICOLI │ │ RISORSE │
|
||||
└─────────────────┘ └────────┬────────┘ └─────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ TB_CODICI_CATEG │
|
||||
└────────┬────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ TB_TIPI_MAT │
|
||||
└─────────────────┘
|
||||
|
||||
┌─────────────────┬─────────────────┐
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│EVENTI_DET_DEGUST│ │ EVENTI_ACCONTI │ │EVENTI_ALTRICOSTI│
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
## Workflow Stati Evento
|
||||
|
||||
```
|
||||
┌──────────────┐
|
||||
│ PREVENTIVO │ (100) - Bianco
|
||||
└──────┬───────┘
|
||||
│ Degustazione
|
||||
▼
|
||||
┌──────────────┐
|
||||
│SCHEDA EVENTO │ (200) - Celeste
|
||||
│(preparazione)│
|
||||
└──────┬───────┘
|
||||
│ Prima caparra
|
||||
▼
|
||||
┌──────────────┐
|
||||
│ SCHEDA │ (300) - Giallo
|
||||
│ CONFERMATA │
|
||||
└──────┬───────┘
|
||||
│ Quasi confermato
|
||||
▼
|
||||
┌──────────────┐
|
||||
│SCHEDA QUASI │ (350) - Arancio
|
||||
│ CONFERMATA │
|
||||
└──────┬───────┘
|
||||
│ Conferma definitiva
|
||||
▼
|
||||
┌──────────────┐
|
||||
│ CONFERMATO │ (400) - Verde
|
||||
└──────────────┘
|
||||
|
||||
│ Rifiuto/Scadenza
|
||||
▼
|
||||
┌──────────────┐
|
||||
│NON ACCETTATO/│ (900) - Viola
|
||||
│ SUPERATO │
|
||||
└──────────────┘
|
||||
```
|
||||
|
||||
## Note per lo Sviluppo
|
||||
|
||||
1. **Packages PLJSON\_\***: Libreria esterna per parsing JSON, può essere sostituita con funzionalità native .NET
|
||||
|
||||
2. **Packages XLIB\_\***: Componenti per integrazione JasperReports, da valutare sostituzione con report .NET
|
||||
|
||||
3. **Trigger per ID**: In .NET usare Identity columns o GUID
|
||||
|
||||
4. **Calcolo quantità**: La logica in `EVENTI_AGGIORNA_QTA_LISTA` è critica e deve essere portata fedelmente
|
||||
|
||||
5. **Sistema acconti**: Le percentuali 30%-50%-20% sono hardcoded, valutare parametrizzazione
|
||||
195
docs/apex/README.md
Normal file
195
docs/apex/README.md
Normal file
@@ -0,0 +1,195 @@
|
||||
# APEX Application Documentation
|
||||
|
||||
## Application Overview
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| **Application ID** | 112 |
|
||||
| **Application Name** | APCB Project |
|
||||
| **Application Alias** | F_110112 |
|
||||
| **APEX Version** | 21.1.0 |
|
||||
| **Owner/Schema** | APOLLINARECATERINGPROD |
|
||||
| **Language** | Italian (it) |
|
||||
| **Date Format** | DD-MM-YYYY |
|
||||
| **DateTime Format** | DD-MM-YYYY HH24:MI:SS |
|
||||
| **Logo Text** | Apollinare Catering & Banqueting - Management Software |
|
||||
| **Last Updated By** | MONIA |
|
||||
| **Last Update** | 2025-11-24 14:06:02 |
|
||||
|
||||
## Application Statistics
|
||||
|
||||
| Component | Count |
|
||||
|-----------|-------|
|
||||
| **Pages** | 56 |
|
||||
| **Items** | 302 |
|
||||
| **Processes** | 98 |
|
||||
| **Regions** | 151 |
|
||||
| **Buttons** | 119 |
|
||||
| **Dynamic Actions** | 62 |
|
||||
| **LOVs** | 12 |
|
||||
| **Authorization Schemes** | 5 |
|
||||
| **Computations** | 2 |
|
||||
| **Breadcrumb Entries** | 22 |
|
||||
| **List Entries** | 2 |
|
||||
| **Templates** | 64 |
|
||||
| **Plug-ins** | 2 |
|
||||
| **Messages** | 464 |
|
||||
|
||||
## Navigation Structure
|
||||
|
||||
### Desktop Navigation Menu
|
||||
|
||||
```
|
||||
Home (Page 1)
|
||||
├── Articoli (Page 2)
|
||||
│ └── Impegni Articoli (Page 39)
|
||||
├── Categorie (Page 4)
|
||||
├── Tipi (Page 6)
|
||||
├── Clienti (Page 17)
|
||||
├── Location (Page 15)
|
||||
├── Risorse (Page 31)
|
||||
├── Permessi (Page 47) [Admin Only]
|
||||
├── Gestione Dati (Page 45) [Admin Only]
|
||||
├── Job Schedulati (Page 49)
|
||||
├── Mail Inviate (Page 50)
|
||||
└── Mail In Attesa (Page 51)
|
||||
|
||||
Eventi
|
||||
├── Tipi Evento (Page 13) [Admin Only]
|
||||
├── Nuovo Evento (Page 22) [Admin Only]
|
||||
├── Schede/Schede Confermate (Page 35)
|
||||
├── Liste (Page 9) [Admin Only]
|
||||
├── Calendario Eventi (Page 12)
|
||||
├── Degustazioni (Page 27)
|
||||
└── Template Eventi (Page 48) [Admin Only]
|
||||
|
||||
Riepiloghi/Report
|
||||
├── Griglia (Page 16) [Admin Only]
|
||||
├── Riepilogo Cucina (Page 25)
|
||||
├── Torte e Costi Extra (Page 28) [Admin Only]
|
||||
├── Riepilogo Allestimenti (Page 30)
|
||||
└── Riepilogo Risorse (Page 38)
|
||||
```
|
||||
|
||||
## Page Categories
|
||||
|
||||
### Master Data Pages
|
||||
| Page ID | Name | Description |
|
||||
|---------|------|-------------|
|
||||
| 2 | Articoli Rpt | Article list report |
|
||||
| 3 | Articoli | Article detail form |
|
||||
| 4 | Categorie Rpt | Categories list report |
|
||||
| 5 | Categorie | Category detail form |
|
||||
| 6 | Tipi Rpt | Types list report |
|
||||
| 7 | Tipi | Type detail form |
|
||||
| 17 | Clienti Rpt | Clients list report |
|
||||
| 18 | Clienti | Client detail form |
|
||||
| 15 | Location Rpt | Locations list report |
|
||||
| 20 | Location | Location detail form |
|
||||
| 31 | Risorse | Resources (staff) management |
|
||||
|
||||
### Event Management Pages
|
||||
| Page ID | Name | Description |
|
||||
|---------|------|-------------|
|
||||
| 1 | Home | Dashboard |
|
||||
| 8 | Nuovo Evento Wizard | Event creation wizard |
|
||||
| 9 | Lista Eventi | Event list |
|
||||
| 12 | Calendario | Event calendar |
|
||||
| 13 | Tipi Evento Rpt | Event types list |
|
||||
| 14 | Tipi Evento | Event type detail form |
|
||||
| **22** | **Nuovo Evento** | **Main event form (most complex)** |
|
||||
| 27 | Lista Degustazioni | Tastings list |
|
||||
| 32 | Degustazione | Tasting detail |
|
||||
| 35 | Schede/Schede Confermate | Event cards |
|
||||
| 48 | Template Eventi | Event templates |
|
||||
|
||||
### Report Pages
|
||||
| Page ID | Name | Description |
|
||||
|---------|------|-------------|
|
||||
| 16 | Griglia | Grid view |
|
||||
| 25 | Riepilogo Cucina | Kitchen summary |
|
||||
| 28 | Torte e Costi Extra | Cakes and extra costs |
|
||||
| 30 | Riepilogo Allestimenti | Setup summary |
|
||||
| 38 | Riepilogo Risorse | Resources summary |
|
||||
| 39 | Impegni Articoli | Article commitments |
|
||||
|
||||
### Administration Pages
|
||||
| Page ID | Name | Description |
|
||||
|---------|------|-------------|
|
||||
| 45 | Gestione Dati | Data management |
|
||||
| 46 | Max Eventi | Max events configuration |
|
||||
| 47 | Permessi | Permissions management |
|
||||
| 49 | Job Schedulati | Scheduled jobs |
|
||||
| 50 | Mail Inviate | Sent emails |
|
||||
| 51 | Mail In Attesa | Pending emails |
|
||||
|
||||
## Page 22 (Nuovo Evento) - Most Complex Page
|
||||
|
||||
Page 22 is the main event management page with the highest complexity:
|
||||
|
||||
| Component | Count |
|
||||
|-----------|-------|
|
||||
| Items | 108 |
|
||||
| Regions | 33 |
|
||||
| Buttons | 32 |
|
||||
| Processes | 32 |
|
||||
| Dynamic Actions | Multiple |
|
||||
|
||||
### Key Features:
|
||||
- Multiple Interactive Grids (master-detail)
|
||||
- Guest type management with quantity recalculations
|
||||
- Resource assignments
|
||||
- Pick list management with coefficient-based calculations
|
||||
- Event status workflow management
|
||||
- Template support
|
||||
- Versioning system
|
||||
|
||||
## Documentation Structure
|
||||
|
||||
```
|
||||
docs/apex/
|
||||
├── README.md (this file)
|
||||
├── pages/ # Individual page documentation
|
||||
├── processes/ # Process documentation
|
||||
├── lovs/ # List of Values documentation
|
||||
├── javascript/ # JavaScript libraries
|
||||
├── authorization/ # Authorization schemes
|
||||
├── dynamic-actions/ # Dynamic actions
|
||||
├── items/ # Shared items
|
||||
├── regions/ # Shared regions
|
||||
└── navigation/ # Navigation components
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
- [LOVs Documentation](lovs/README.md) - List of Values definitions
|
||||
- [Processes Documentation](processes/README.md) - PL/SQL processes
|
||||
- [JavaScript Libraries](javascript/README.md) - Custom JavaScript
|
||||
- [Authorization Schemes](authorization/README.md) - Security settings
|
||||
- [Page 22 Documentation](pages/PAGE_022.md) - Main event form
|
||||
|
||||
## Event Status Workflow
|
||||
|
||||
```
|
||||
100 (Preventivo/Quote)
|
||||
↓ [Continue Event]
|
||||
200 (Scheda/Preparazione)
|
||||
↓ [Return to Preparazione]
|
||||
300 (Confermata/Quasi)
|
||||
↓ [Almost Continue Event]
|
||||
350 (Quasi Confermato)
|
||||
↓ [Confirm Event]
|
||||
400 (Confermato/Confirmed)
|
||||
↓ [Set Obsoleto]
|
||||
900 (Superato/Expired)
|
||||
```
|
||||
|
||||
## Authorization Schemes
|
||||
|
||||
| Scheme Name | Description |
|
||||
|-------------|-------------|
|
||||
| Admin_auth_schema | Full admin access |
|
||||
| User Read/Write | Controlled by USERS_READONLY table |
|
||||
| Consuntivi | Financial summaries access |
|
||||
| Gestori | Manager-level permissions |
|
||||
| Solo Admins | Highest level (admin, monia only) |
|
||||
296
docs/apex/authorization/README.md
Normal file
296
docs/apex/authorization/README.md
Normal file
@@ -0,0 +1,296 @@
|
||||
# Authorization Schemes Documentation
|
||||
|
||||
This document describes the 5 authorization schemes used in the APEX application for access control.
|
||||
|
||||
## Overview
|
||||
|
||||
| Scheme Name | Type | Users/Condition | Error Message |
|
||||
|-------------|------|-----------------|---------------|
|
||||
| Admin_auth_schema | NATIVE_EXISTS | Specific user list | Utente non autorizzato |
|
||||
| User Read/Write | NATIVE_FUNCTION_BODY | USERS_READONLY table | Utente abilitato in sola lettura |
|
||||
| Consuntivi | NATIVE_EXISTS | GET_CONSUNTIVI_USERS view | Autorizzazione necessaria... |
|
||||
| Gestori | NATIVE_EXISTS | GET_GESTORI_USERS view | Non possiedi i permessi... |
|
||||
| Solo Admins | NATIVE_EXISTS | admin, monia only | Non possiedi i permessi... |
|
||||
|
||||
---
|
||||
|
||||
## Admin_auth_schema
|
||||
|
||||
**Type:** NATIVE_EXISTS
|
||||
**Caching:** BY_USER_BY_PAGE_VIEW
|
||||
|
||||
**SQL Query:**
|
||||
```sql
|
||||
select 1 from dual
|
||||
where lower(:APP_USER) in ('admin','monia','andrea','maria','sabrina','nicole','cucina','developer','elia.ballarani');
|
||||
```
|
||||
|
||||
**Authorized Users:**
|
||||
- admin
|
||||
- monia
|
||||
- andrea
|
||||
- maria
|
||||
- sabrina
|
||||
- nicole
|
||||
- cucina
|
||||
- developer
|
||||
- elia.ballarani
|
||||
|
||||
**Usage:** General administrative access to most management pages.
|
||||
|
||||
---
|
||||
|
||||
## User Read/Write
|
||||
|
||||
**Type:** NATIVE_FUNCTION_BODY
|
||||
**Caching:** BY_USER_BY_PAGE_VIEW
|
||||
|
||||
**PL/SQL Function:**
|
||||
```plsql
|
||||
declare
|
||||
v_readonly number;
|
||||
begin
|
||||
select 1
|
||||
into v_readonly
|
||||
from users_readonly
|
||||
where username = :APP_USER
|
||||
and flgwrite = 0;
|
||||
|
||||
return false;
|
||||
exception when no_data_found then
|
||||
return true;
|
||||
end;
|
||||
```
|
||||
|
||||
**Logic:**
|
||||
- Checks `USERS_READONLY` table
|
||||
- If user exists with `FLGWRITE = 0` → Returns FALSE (read-only mode)
|
||||
- If user not found → Returns TRUE (write access)
|
||||
|
||||
**Usage:** Controls whether user can modify data or only view.
|
||||
|
||||
---
|
||||
|
||||
## Consuntivi
|
||||
|
||||
**Type:** NATIVE_EXISTS
|
||||
**Caching:** BY_USER_BY_PAGE_VIEW
|
||||
|
||||
**SQL Query:**
|
||||
```sql
|
||||
select 1 from dual
|
||||
where :APP_USER in (select users from get_consuntivi_users);
|
||||
```
|
||||
|
||||
**Data Source:** `GET_CONSUNTIVI_USERS` view
|
||||
|
||||
**Usage:** Access to financial summary pages and cost management.
|
||||
|
||||
---
|
||||
|
||||
## Gestori
|
||||
|
||||
**Type:** NATIVE_EXISTS
|
||||
**Caching:** BY_USER_BY_PAGE_VIEW
|
||||
|
||||
**SQL Query:**
|
||||
```sql
|
||||
select 1 from dual
|
||||
where :APP_USER in (select users from get_gestori_users);
|
||||
```
|
||||
|
||||
**Data Source:** `GET_GESTORI_USERS` view
|
||||
|
||||
**Usage:** Manager-level access. Applied to:
|
||||
- Home page
|
||||
- Nuovo Evento (Page 22)
|
||||
- Liste (Page 9)
|
||||
- Griglia (Page 16)
|
||||
- Torte e Costi Extra (Page 28)
|
||||
- Template Eventi (Page 48)
|
||||
- Tipi Evento (Page 13)
|
||||
|
||||
---
|
||||
|
||||
## Solo Admins
|
||||
|
||||
**Type:** NATIVE_EXISTS
|
||||
**Caching:** BY_USER_BY_PAGE_VIEW
|
||||
|
||||
**SQL Query:**
|
||||
```sql
|
||||
select 1 from dual
|
||||
where lower(:APP_USER) in ('admin', 'monia');
|
||||
```
|
||||
|
||||
**Authorized Users:**
|
||||
- admin
|
||||
- monia
|
||||
|
||||
**Usage:** Highest level of access. Reserved for:
|
||||
- Permessi (Page 47)
|
||||
- Gestione Dati (Page 45)
|
||||
- Critical configuration pages
|
||||
|
||||
---
|
||||
|
||||
## Application-Level Processes
|
||||
|
||||
### SET_USER_READONLY
|
||||
|
||||
**Process Point:** Before Header (runs on every page)
|
||||
**Sequence:** 1
|
||||
|
||||
```plsql
|
||||
begin
|
||||
select 1
|
||||
into :APP_READ_ONLY
|
||||
from users_readonly
|
||||
where username = :APP_USER
|
||||
and flgwrite = 0;
|
||||
exception when no_data_found then
|
||||
:APP_READ_ONLY := 0;
|
||||
end;
|
||||
```
|
||||
|
||||
**Sets:** `APP_READ_ONLY` application item
|
||||
- Value `1` = Read-only mode
|
||||
- Value `0` = Full access
|
||||
|
||||
This is checked in page processes with condition:
|
||||
```plsql
|
||||
:APP_READ_ONLY = 0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### SET_ITEM_SESSION
|
||||
|
||||
**Process Point:** On Demand
|
||||
**Security:** MUST_NOT_BE_PUBLIC_USER
|
||||
|
||||
```plsql
|
||||
declare
|
||||
v_itemList varchar2(32000);
|
||||
begin
|
||||
v_itemList := APEX_UTIL.TABLE_TO_STRING(APEX_APPLICATION.G_F01);
|
||||
|
||||
for c in (
|
||||
select
|
||||
(select result from table(STRING_TO_TABLE_ENUM(a.result, 1, '='))) as item,
|
||||
(select result from table(STRING_TO_TABLE_ENUM(a.result, 2, '='))) as val
|
||||
from table(STRING_TO_TABLE_ENUM(v_itemList)) a
|
||||
)
|
||||
loop
|
||||
APEX_UTIL.set_session_state(
|
||||
p_name => c.item,
|
||||
p_value => c.val
|
||||
);
|
||||
end loop;
|
||||
end;
|
||||
```
|
||||
|
||||
**Usage:** Called by `setSessionState()` JavaScript function to update APEX session state for multiple items.
|
||||
|
||||
---
|
||||
|
||||
## Application Items
|
||||
|
||||
### APP_READ_ONLY
|
||||
|
||||
**Protection Level:** Internal
|
||||
**Escape on HTTP Output:** No
|
||||
|
||||
Stores the read-only flag for the current user session.
|
||||
|
||||
### APP_VERSION
|
||||
|
||||
Application version identifier.
|
||||
|
||||
---
|
||||
|
||||
## Authorization Hierarchy
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Solo Admins │
|
||||
│ (admin, monia) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Admin_auth_schema │
|
||||
│ (admin, monia, andrea, maria, sabrina, nicole, │
|
||||
│ cucina, developer, elia.ballarani) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Gestori │
|
||||
│ (from GET_GESTORI_USERS view) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Consuntivi │
|
||||
│ (from GET_CONSUNTIVI_USERS view) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ User Read/Write │
|
||||
│ (based on USERS_READONLY.FLGWRITE flag) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Authenticated Users │
|
||||
│ (basic application access) │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Database Objects for Authorization
|
||||
|
||||
### USERS_READONLY Table
|
||||
|
||||
| Column | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| USERNAME | VARCHAR2 | APEX username |
|
||||
| FLGWRITE | NUMBER | 0 = read-only, 1 = write |
|
||||
|
||||
### GET_GESTORI_USERS View
|
||||
|
||||
Returns list of users with manager permissions.
|
||||
|
||||
### GET_CONSUNTIVI_USERS View
|
||||
|
||||
Returns list of users with financial access.
|
||||
|
||||
---
|
||||
|
||||
## Migration Notes
|
||||
|
||||
When migrating to .NET + React:
|
||||
|
||||
1. **Authentication**
|
||||
- Implement JWT or cookie-based authentication
|
||||
- Consider integration with existing Oracle users or migrate to new system
|
||||
|
||||
2. **Authorization**
|
||||
- Map authorization schemes to .NET roles/claims
|
||||
- Implement policy-based authorization in .NET
|
||||
|
||||
3. **Role Mapping**
|
||||
```csharp
|
||||
public enum UserRole
|
||||
{
|
||||
User, // Basic authenticated user
|
||||
ReadOnly, // Read-only access
|
||||
Consuntivi, // Financial access
|
||||
Gestori, // Manager level
|
||||
Admin, // Admin_auth_schema equivalent
|
||||
SuperAdmin // Solo Admins equivalent
|
||||
}
|
||||
```
|
||||
|
||||
4. **Frontend Authorization**
|
||||
- Store user roles in JWT/session
|
||||
- Implement route guards in React
|
||||
- Conditionally render UI elements based on permissions
|
||||
|
||||
5. **Backend Authorization**
|
||||
```csharp
|
||||
[Authorize(Policy = "Gestori")]
|
||||
public class EventController : Controller
|
||||
{
|
||||
[Authorize(Policy = "SoloAdmins")]
|
||||
public IActionResult DeleteEvent(int id) { ... }
|
||||
}
|
||||
```
|
||||
330
docs/apex/javascript/README.md
Normal file
330
docs/apex/javascript/README.md
Normal file
@@ -0,0 +1,330 @@
|
||||
# JavaScript Libraries Documentation
|
||||
|
||||
This document describes the custom JavaScript libraries used in the APEX application.
|
||||
|
||||
## Static Application Files
|
||||
|
||||
| File Name | Description |
|
||||
|-----------|-------------|
|
||||
| ajaxUtils.js | AJAX utilities for dynamic updates and server communication |
|
||||
| iframeObj.js | Jasper Reports integration wrapper |
|
||||
|
||||
---
|
||||
|
||||
## ajaxUtils.js
|
||||
|
||||
Custom AJAX utility library for managing server-side communication and UI feedback.
|
||||
|
||||
### Functions
|
||||
|
||||
#### `notifica(pText, pType = null)`
|
||||
|
||||
Central dynamic notification function.
|
||||
|
||||
**Parameters:**
|
||||
- `pText` (string): Message text to display
|
||||
- `pType` (string, optional): Notification type - 'alert', 'success', 'error', 'warning', 'info'
|
||||
|
||||
**Behavior:**
|
||||
- Clears existing errors
|
||||
- If `pType` is provided, shows error notification at page level
|
||||
- If `pType` is null, shows success message
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
notifica("Record saved successfully"); // Success message
|
||||
notifica("Error occurred", "error"); // Error message
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `setSessionState(elemList, pCallback = null)`
|
||||
|
||||
Sets APEX session state for multiple items.
|
||||
|
||||
**Parameters:**
|
||||
- `elemList` (string): Comma-separated list of item IDs (without P prefix)
|
||||
- `pCallback` (function, optional): Callback function after session state is set
|
||||
|
||||
**How it works:**
|
||||
1. Splits the element list by comma
|
||||
2. Gets values for each element using jQuery
|
||||
3. Creates a dictionary of item-value pairs
|
||||
4. Calls APEX process `SET_ITEM_SESSION` to update session state
|
||||
5. Executes callback with data and elements dictionary
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
setSessionState("P22_EVENT_ID,P22_CLIENTE", function(pData, elems) {
|
||||
console.log("Session state updated");
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `ajaxExec(pName, clickObj, pParams, pCallback, pConfirm, pLoading, pAsync, pType)`
|
||||
|
||||
Generic AJAX execution wrapper for APEX server processes.
|
||||
|
||||
**Parameters:**
|
||||
- `pName` (string): APEX process name to execute
|
||||
- `clickObj` (jQuery object): Button/element that triggered the action
|
||||
- `pParams` (object): Parameters to pass to the process
|
||||
- `pCallback` (function): Callback function on success/error
|
||||
- `pConfirm` (string): Confirmation message (uses native confirm dialog)
|
||||
- `pLoading` (boolean): Show loading popup
|
||||
- `pAsync` (boolean): Execute asynchronously
|
||||
- `pType` (string): Response data type (default: 'text')
|
||||
|
||||
**Features:**
|
||||
- Prevents page unload during execution
|
||||
- Shows loading spinner on clicked element
|
||||
- Handles confirmation dialogs
|
||||
- Parses response and removes quotes
|
||||
- Executes callback with parsed data
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
ajaxExec("SAVE_EVENT", clickBtn, {x01: eventId}, function(data, btn, params) {
|
||||
notifica("Event saved");
|
||||
}, "Are you sure?", true);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `execProcessAsync(pName, pParams, pPreExec, pCallback, pItems = null, clickObj = null, pConfirm = null, pLoading = null)`
|
||||
|
||||
Wrapper for async process execution with optional session state update.
|
||||
|
||||
**Parameters:**
|
||||
- `pName` (string): Process name
|
||||
- `pParams` (object): Process parameters
|
||||
- `pPreExec` (function): Function to execute before AJAX call
|
||||
- `pCallback` (function): Callback after process execution
|
||||
- `pItems` (string): Items to set in session state first
|
||||
- `clickObj`: Clicked element
|
||||
- `pConfirm` (string): Confirmation message
|
||||
- `pLoading` (boolean): Show loading indicator
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
execProcessAsync("UPDATE_QTY", {x01: itemId}, null, function(data) {
|
||||
apex.region("LIST_PREL").refresh();
|
||||
}, "P22_EVENT_ID");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `execQueryAsync(pQuery, pPreExec, pCallback, clickObj = null, pConfirm = null, pItems = null, pLoading = null)`
|
||||
|
||||
Executes a SQL query asynchronously.
|
||||
|
||||
**Parameters:**
|
||||
- `pQuery` (string): SQL query to execute
|
||||
- `pPreExec` (function): Pre-execution function
|
||||
- `pCallback` (function): Callback with query results
|
||||
- `clickObj`: Clicked element
|
||||
- `pConfirm` (string): Confirmation message
|
||||
- `pItems` (string): Items to set in session state
|
||||
- `pLoading` (boolean): Show loading indicator
|
||||
|
||||
**Note:** Calls the `EXEC_QUERY` APEX process with the query in `x01` parameter.
|
||||
|
||||
---
|
||||
|
||||
## iframeObj.js
|
||||
|
||||
JavaScript wrapper for embedding Jasper Reports in iframes.
|
||||
|
||||
### Configuration
|
||||
|
||||
```javascript
|
||||
var j_datasource = "default"; // Jasper datasource name
|
||||
var j_username = "jasperadmin"; // Jasper server username
|
||||
var j_password = "jasperadmin"; // Jasper server password
|
||||
var j_def_outp = "pdf"; // Default output format (HTML, PDF)
|
||||
```
|
||||
|
||||
### Iframe Class
|
||||
|
||||
#### Constructor
|
||||
|
||||
```javascript
|
||||
var Iframe = function(parentObj, id, attr) { ... }
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `parentObj`: Parent DOM element
|
||||
- `id`: Iframe element ID
|
||||
- `attr`: Additional attributes
|
||||
|
||||
### Methods
|
||||
|
||||
#### `setCss(css)`
|
||||
|
||||
Sets CSS styles on the iframe.
|
||||
|
||||
**Parameters:**
|
||||
- `css` (object): CSS properties dictionary
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
iframe.setCss({ width: "100%", height: "600px", border: "none" });
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `setUrl(Url)`
|
||||
|
||||
Sets the iframe source URL.
|
||||
|
||||
---
|
||||
|
||||
#### `getUrl()`
|
||||
|
||||
Returns the current iframe URL.
|
||||
|
||||
---
|
||||
|
||||
#### `refresh()`
|
||||
|
||||
Reloads the iframe content.
|
||||
|
||||
---
|
||||
|
||||
#### `hide()`
|
||||
|
||||
Hides the iframe (display: none).
|
||||
|
||||
---
|
||||
|
||||
#### `show()`
|
||||
|
||||
Shows the iframe (display: block).
|
||||
|
||||
---
|
||||
|
||||
#### `jasperReport(dir, datasource, params, output, username, password)`
|
||||
|
||||
Generates a Jasper Reports URL and loads it in the iframe.
|
||||
|
||||
**Parameters:**
|
||||
- `dir` (string, required): Report path in Jasper server
|
||||
- `datasource` (string): Data source name (default: "default")
|
||||
- `params` (object): Report parameters as key-value pairs
|
||||
- `output` (string): Output format - 'pdf' or 'html' (default: 'pdf')
|
||||
- `username` (string): Jasper server username
|
||||
- `password` (string): Jasper server password
|
||||
|
||||
**URL Format:**
|
||||
```
|
||||
/jri/report?_repName={dir}&_repFormat={output}&_dataSource={datasource}&_repLocale=it_IT&_repTimeZone=Europe/Rome&{params}
|
||||
```
|
||||
|
||||
**Example:**
|
||||
```javascript
|
||||
var rptFrame = new Iframe(container, "reportFrame");
|
||||
rptFrame.jasperReport(
|
||||
"apcb/scheda_evento_rpt",
|
||||
"default",
|
||||
{ P_EVENT_ID: eventId, P_TIPO: "PREVENTIVO" },
|
||||
"pdf"
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Usage in APEX Pages
|
||||
|
||||
### Time Input Masks
|
||||
|
||||
The application uses inputmask library for time fields:
|
||||
|
||||
```javascript
|
||||
Inputmask("99:99", {
|
||||
placeholder: "HH:MM"
|
||||
}).mask($("#P22_ORA_INI_EVENTO"));
|
||||
```
|
||||
|
||||
### SweetAlert2 Integration
|
||||
|
||||
Used for enhanced confirmation dialogs:
|
||||
|
||||
```javascript
|
||||
Swal.fire({
|
||||
title: 'Conferma',
|
||||
text: 'Vuoi continuare?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// proceed
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Interactive Grid Refresh
|
||||
|
||||
```javascript
|
||||
// Refresh a specific interactive grid
|
||||
apex.region("LISTA_PRELIEVO").refresh();
|
||||
|
||||
// Refresh with callback
|
||||
apex.region("OSPITI").widget().interactiveGrid("getViews", "grid").model.fetchRecords();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Migration Notes
|
||||
|
||||
When migrating to React TypeScript:
|
||||
|
||||
1. **AJAX Utilities** - Replace with:
|
||||
- Axios or fetch for HTTP requests
|
||||
- React Query or SWR for data fetching
|
||||
- Toast library (react-toastify) for notifications
|
||||
|
||||
2. **Session State** - Replace with:
|
||||
- React Context or Redux for state management
|
||||
- URL parameters for shareable state
|
||||
- Session storage for persistence
|
||||
|
||||
3. **Jasper Reports** - Options:
|
||||
- Keep Jasper and embed via iframe
|
||||
- Migrate to SSRS, Crystal Reports
|
||||
- Use PDF libraries (QuestPDF, iTextSharp)
|
||||
- Use React-PDF for client-side PDF generation
|
||||
|
||||
4. **Input Masks** - Use:
|
||||
- react-input-mask
|
||||
- @react-input/mask
|
||||
- Material-UI TextField with InputProps
|
||||
|
||||
5. **SweetAlert2** - Replace with:
|
||||
- MUI Dialog components
|
||||
- react-confirm-alert
|
||||
- Custom modal component
|
||||
|
||||
### Example React Migration
|
||||
|
||||
```typescript
|
||||
// ajaxUtils.js equivalent in React
|
||||
import { toast } from 'react-toastify';
|
||||
import axios from 'axios';
|
||||
|
||||
export const notifica = (text: string, type?: 'success' | 'error' | 'warning' | 'info') => {
|
||||
if (type) {
|
||||
toast[type](text);
|
||||
} else {
|
||||
toast.success(text);
|
||||
}
|
||||
};
|
||||
|
||||
export const executeProcess = async <T>(
|
||||
processName: string,
|
||||
params: Record<string, any>
|
||||
): Promise<T> => {
|
||||
const response = await axios.post(`/api/processes/${processName}`, params);
|
||||
return response.data;
|
||||
};
|
||||
```
|
||||
242
docs/apex/lovs/README.md
Normal file
242
docs/apex/lovs/README.md
Normal file
@@ -0,0 +1,242 @@
|
||||
# List of Values (LOVs) Documentation
|
||||
|
||||
This document contains all 12 List of Values defined in the APEX application.
|
||||
|
||||
## Overview
|
||||
|
||||
| LOV Name | Source Type | Description |
|
||||
|----------|-------------|-------------|
|
||||
| ARTICOLI | SQL Query | Article selection |
|
||||
| CATEGORIE | SQL Query | Category selection |
|
||||
| CLIENTI | SQL Query | Client selection |
|
||||
| LOCATION | SQL Query | Location selection |
|
||||
| RISORSE | SQL Query | Resource (staff) selection |
|
||||
| STATO_EVENTO | Static | Event status values |
|
||||
| TIPI MAT | SQL Query | Material type selection |
|
||||
| TIPI RISORSE | SQL Query | Resource type selection |
|
||||
| TIPO_EVENTO | SQL Query | Event type selection |
|
||||
| TIPO_OSPITI | SQL Query | Guest type selection |
|
||||
| TIPO_PASTO | Static | Meal type values |
|
||||
| USERS | SQL Query | User selection |
|
||||
|
||||
---
|
||||
|
||||
## ARTICOLI
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select /*a.cod_categ || ' - ' || c.descrizione || ' - ' ||*/ a.DESCRIZIONE as descrizione, a.COD_ARTICOLO
|
||||
from articoli a
|
||||
join tb_codici_categ c on a.cod_categ = c.cod_categ
|
||||
order by 1
|
||||
```
|
||||
|
||||
**Usage:** Selecting articles in pick lists and event details.
|
||||
|
||||
---
|
||||
|
||||
## CATEGORIE
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
SELECT descrizione as d,
|
||||
cod_categ as r
|
||||
FROM tb_codici_categ
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
**Usage:** Filtering articles by category, category selection in forms.
|
||||
|
||||
---
|
||||
|
||||
## CLIENTI
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select CLIENTE, ID
|
||||
from clienti
|
||||
```
|
||||
|
||||
**Usage:** Client selection in event forms.
|
||||
|
||||
---
|
||||
|
||||
## LOCATION
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select location || ' - ' || indirizzo, id
|
||||
from location
|
||||
```
|
||||
|
||||
**Usage:** Location selection in event forms. Displays location name with address.
|
||||
|
||||
---
|
||||
|
||||
## RISORSE
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select NOME || ' ' || COGNOME d, id r
|
||||
from risorse
|
||||
```
|
||||
|
||||
**Usage:** Resource (staff) assignment in events. Displays full name.
|
||||
|
||||
---
|
||||
|
||||
## STATO_EVENTO
|
||||
|
||||
**Source Type:** Static
|
||||
|
||||
**Values:**
|
||||
|
||||
| Display Value | Return Value | Sequence |
|
||||
|---------------|--------------|----------|
|
||||
| Scheda Evento (Preparazione) | 0 | 10 |
|
||||
| Preventivo | 10 | 20 |
|
||||
| Confermato | 20 | 30 |
|
||||
|
||||
**Note:** The actual status values in the database have been expanded:
|
||||
- 100 = Preventivo
|
||||
- 200 = Scheda
|
||||
- 300 = Confermata
|
||||
- 350 = Quasi Confermato
|
||||
- 400 = Confermato
|
||||
- 900 = Superato
|
||||
|
||||
**Usage:** Event status display and selection.
|
||||
|
||||
---
|
||||
|
||||
## TIPI MAT
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
SELECT descrizione as d,
|
||||
cod_tipo as r
|
||||
FROM tb_tipi_mat
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
**Usage:** Material type filtering in pick lists. Controls the step-by-step wizard flow.
|
||||
|
||||
---
|
||||
|
||||
## TIPI RISORSE
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select descrizione, cod_tipo
|
||||
from tb_tipi_risorsa
|
||||
```
|
||||
|
||||
**Usage:** Resource type classification (camerieri, cuochi, etc.).
|
||||
|
||||
---
|
||||
|
||||
## TIPO_EVENTO
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select trim(DESCRIZIONE) || decode(tipo_pasto, 'C', ' - Cena', 'P', ' - Pranzo', null) as d,
|
||||
COD_TIPO as r
|
||||
from tb_tipi_evento
|
||||
```
|
||||
|
||||
**Usage:** Event type selection. Displays description with meal type indicator (Pranzo/Cena).
|
||||
|
||||
---
|
||||
|
||||
## TIPO_OSPITI
|
||||
|
||||
**Source Type:** SQL Query (LEGACY_SQL)
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select descrizione as d,
|
||||
cod_tipo as r
|
||||
from tb_tipi_ospiti
|
||||
order by 1
|
||||
```
|
||||
|
||||
**Usage:** Guest type selection in event guest details.
|
||||
|
||||
---
|
||||
|
||||
## TIPO_PASTO
|
||||
|
||||
**Source Type:** Static
|
||||
|
||||
**Values:**
|
||||
|
||||
| Display Value | Return Value | Sequence |
|
||||
|---------------|--------------|----------|
|
||||
| Pranzo | P | 1 |
|
||||
| Cena | C | 2 |
|
||||
| Pranzo Buffet | A | 3 |
|
||||
| Cena Buffet | B | 4 |
|
||||
|
||||
**Usage:** Meal type classification for events and event types.
|
||||
|
||||
---
|
||||
|
||||
## USERS
|
||||
|
||||
**Source Type:** SQL Query
|
||||
|
||||
**Query:**
|
||||
```sql
|
||||
select user_name D, user_name R
|
||||
from WWV_FLOW_USERS
|
||||
```
|
||||
|
||||
**Return Column:** R
|
||||
**Display Column:** D
|
||||
|
||||
**Usage:** User selection for permissions and assignments.
|
||||
|
||||
---
|
||||
|
||||
## Migration Notes
|
||||
|
||||
When migrating to React TypeScript:
|
||||
|
||||
1. **Static LOVs** (STATO_EVENTO, TIPO_PASTO) can be implemented as TypeScript enums or const objects
|
||||
2. **SQL-based LOVs** should be converted to API endpoints
|
||||
3. Consider caching strategy for frequently used LOVs (CATEGORIE, TIPI MAT, etc.)
|
||||
4. TIPO_EVENTO uses Oracle `decode()` function - convert to CASE WHEN or handle in API
|
||||
|
||||
### Example TypeScript Implementation
|
||||
|
||||
```typescript
|
||||
// Static LOV - TIPO_PASTO
|
||||
export const TIPO_PASTO = {
|
||||
PRANZO: { value: 'P', label: 'Pranzo' },
|
||||
CENA: { value: 'C', label: 'Cena' },
|
||||
PRANZO_BUFFET: { value: 'A', label: 'Pranzo Buffet' },
|
||||
CENA_BUFFET: { value: 'B', label: 'Cena Buffet' },
|
||||
} as const;
|
||||
|
||||
// Dynamic LOV - API endpoint
|
||||
// GET /api/lovs/articoli
|
||||
// GET /api/lovs/categorie
|
||||
// GET /api/lovs/clienti
|
||||
// etc.
|
||||
```
|
||||
5
docs/apex/pages/PAGE_002.md
Normal file
5
docs/apex/pages/PAGE_002.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 2 - Articoli Rpt
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P2_IMMAGINE`
|
||||
25
docs/apex/pages/PAGE_003.md
Normal file
25
docs/apex/pages/PAGE_003.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Page 3 - Articoli
|
||||
|
||||
## Items (21)
|
||||
|
||||
- `P3_COD_ARTICOLO`
|
||||
- `P3_COD_CATEG`
|
||||
- `P3_COD_RELATIVO`
|
||||
- `P3_COEFF`
|
||||
- `P3_COEFF_A`
|
||||
- `P3_COEFF_B`
|
||||
- `P3_COEFF_S`
|
||||
- `P3_DESCRIZIONE`
|
||||
- `P3_FLG_CUCINA`
|
||||
- `P3_IMMAGINE`
|
||||
- `P3_IMMAGINE_DISPLAY`
|
||||
- `P3_PERC_IVA`
|
||||
- `P3_PERC_OSPITI`
|
||||
- `P3_QTAGIAC`
|
||||
- `P3_QTAIMP`
|
||||
- `P3_QTA_STD_A`
|
||||
- `P3_QTA_STD_B`
|
||||
- `P3_QTA_STD_S`
|
||||
- `P3_RANK`
|
||||
- `P3_ROWID`
|
||||
- `P3_TIPO_QTA`
|
||||
13
docs/apex/pages/PAGE_005.md
Normal file
13
docs/apex/pages/PAGE_005.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Page 5 - Categorie
|
||||
|
||||
## Items (9)
|
||||
|
||||
- `P5_COD_CATEG`
|
||||
- `P5_COD_TIPO`
|
||||
- `P5_COEFF_A`
|
||||
- `P5_COEFF_B`
|
||||
- `P5_COEFF_S`
|
||||
- `P5_DESCRIZIONE`
|
||||
- `P5_ROWID`
|
||||
- `P5_SHOW_PRINT`
|
||||
- `P5_TIPO_RIEPILOGO`
|
||||
7
docs/apex/pages/PAGE_007.md
Normal file
7
docs/apex/pages/PAGE_007.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Page 7 - Tipi
|
||||
|
||||
## Items (3)
|
||||
|
||||
- `P7_COD_TIPO`
|
||||
- `P7_DESCRIZIONE`
|
||||
- `P7_ROWID`
|
||||
39
docs/apex/pages/PAGE_008.md
Normal file
39
docs/apex/pages/PAGE_008.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Page 8 - Creazione Evento
|
||||
|
||||
## Items (35)
|
||||
|
||||
- `P8_ALLERGIE`
|
||||
- `P8_CATEG`
|
||||
- `P8_CATEG_FILTER`
|
||||
- `P8_CLIENTE`
|
||||
- `P8_CLIENTE_DISPLAY`
|
||||
- `P8_COD_TIPO`
|
||||
- `P8_COD_TIPO_DISPLAY`
|
||||
- `P8_COD_TIPO_FILTER`
|
||||
- `P8_CONFETTATA`
|
||||
- `P8_DATA`
|
||||
- `P8_DATA_DISPLAY`
|
||||
- `P8_DESCRIZIONE`
|
||||
- `P8_DESCRIZIONE_DISPLAY`
|
||||
- `P8_EVENT_ID`
|
||||
- `P8_FLG_TEMPLATE`
|
||||
- `P8_ID_IMAGE_SHOW`
|
||||
- `P8_INDIRIZZO`
|
||||
- `P8_INDIRIZZO_DISPLAY`
|
||||
- `P8_LOCATION`
|
||||
- `P8_LOCATION_DISPLAY`
|
||||
- `P8_MAXSTEP`
|
||||
- `P8_NOTE`
|
||||
- `P8_NOTE_DISPLAY`
|
||||
- `P8_ORA_INI_CER`
|
||||
- `P8_ORA_INI_EVT`
|
||||
- `P8_PERC_SEDUTE`
|
||||
- `P8_STAMPA_MENU`
|
||||
- `P8_STEP`
|
||||
- `P8_TAVOLI_NR`
|
||||
- `P8_TORTA`
|
||||
- `P8_TORTA_DISPLAY`
|
||||
- `P8_TOT_ADULTI`
|
||||
- `P8_TOT_BABY`
|
||||
- `P8_TOT_KINDER`
|
||||
- `P8_TOT_OSPITI`
|
||||
6
docs/apex/pages/PAGE_010.md
Normal file
6
docs/apex/pages/PAGE_010.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 10 - Anteprima Immagine
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P10_IMMAGINE`
|
||||
- `P10_ROWID`
|
||||
5
docs/apex/pages/PAGE_011.md
Normal file
5
docs/apex/pages/PAGE_011.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 11 - Stampa Riepilogo
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P11_EVENT_ID`
|
||||
9
docs/apex/pages/PAGE_014.md
Normal file
9
docs/apex/pages/PAGE_014.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Page 14 - Tipi Evento
|
||||
|
||||
## Items (5)
|
||||
|
||||
- `P14_COD_TIPO`
|
||||
- `P14_DESCRIZIONE`
|
||||
- `P14_LIVELLO`
|
||||
- `P14_ROWID`
|
||||
- `P14_TIPO_PASTO`
|
||||
5
docs/apex/pages/PAGE_016.md
Normal file
5
docs/apex/pages/PAGE_016.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 16 - Griglia
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P16_SETTIMANA`
|
||||
14
docs/apex/pages/PAGE_018.md
Normal file
14
docs/apex/pages/PAGE_018.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Page 18 - Clienti
|
||||
|
||||
## Items (10)
|
||||
|
||||
- `P18_CLIENTE`
|
||||
- `P18_COGNOME_RIF`
|
||||
- `P18_INDIRIZZO`
|
||||
- `P18_MAIL`
|
||||
- `P18_NOME_RIF`
|
||||
- `P18_PIVA`
|
||||
- `P18_RAGSOC`
|
||||
- `P18_ROWID`
|
||||
- `P18_TEL1`
|
||||
- `P18_TEL2`
|
||||
20
docs/apex/pages/PAGE_019.md
Normal file
20
docs/apex/pages/PAGE_019.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Page 19 - Articoli Popup
|
||||
|
||||
## Items (16)
|
||||
|
||||
- `P19_COD_ARTICOLO`
|
||||
- `P19_COD_CATEG`
|
||||
- `P19_COD_RELATIVO`
|
||||
- `P19_COEFF`
|
||||
- `P19_COEFF_A`
|
||||
- `P19_COEFF_B`
|
||||
- `P19_COEFF_S`
|
||||
- `P19_DESCRIZIONE`
|
||||
- `P19_FLG_CUCINA`
|
||||
- `P19_IMMAGINE`
|
||||
- `P19_IMMAGINE_DISPLAY`
|
||||
- `P19_QTA_STD_A`
|
||||
- `P19_QTA_STD_B`
|
||||
- `P19_QTA_STD_S`
|
||||
- `P19_ROWID`
|
||||
- `P19_TIPO_QTA`
|
||||
11
docs/apex/pages/PAGE_020.md
Normal file
11
docs/apex/pages/PAGE_020.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Page 20 - Location
|
||||
|
||||
## Items (7)
|
||||
|
||||
- `P20_ID`
|
||||
- `P20_INDIRIZZO`
|
||||
- `P20_LOCATION`
|
||||
- `P20_NOTE`
|
||||
- `P20_NOTE2`
|
||||
- `P20_REFERENTE`
|
||||
- `P20_ROWID`
|
||||
5
docs/apex/pages/PAGE_021.md
Normal file
5
docs/apex/pages/PAGE_021.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 21 - Costi Articolo
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P21_COD_ARTICOLO`
|
||||
112
docs/apex/pages/PAGE_022.md
Normal file
112
docs/apex/pages/PAGE_022.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# Page 22 - Evento
|
||||
|
||||
## Items (108)
|
||||
|
||||
- `P22_ALLERGIE`
|
||||
- `P22_ALLEST_BUFF`
|
||||
- `P22_ALTRO`
|
||||
- `P22_ALTRO_A`
|
||||
- `P22_ALTRO_B`
|
||||
- `P22_ARTICOLO_ADD`
|
||||
- `P22_ARTICOLO_REMOVE`
|
||||
- `P22_BICCHIERI`
|
||||
- `P22_BUFFET_DOLCI_A`
|
||||
- `P22_BUFFET_DOLCI_B`
|
||||
- `P22_BUFFET_FINALE`
|
||||
- `P22_BUFFET_FINALE_DISPLAY`
|
||||
- `P22_BUFFET_INIZIALE`
|
||||
- `P22_BUFFET_INIZIALE_DISPLAY`
|
||||
- `P22_CARICOAPOLL`
|
||||
- `P22_CARICOSPOSI`
|
||||
- `P22_CATEG`
|
||||
- `P22_CATEG_FILTER`
|
||||
- `P22_CLIENTE`
|
||||
- `P22_CLIENTE_EMAIL`
|
||||
- `P22_CLIENTE_TEL`
|
||||
- `P22_COD_TIPO`
|
||||
- `P22_COD_TIPO_FILTER`
|
||||
- `P22_COLOR`
|
||||
- `P22_CONSUNTIVO_MORE_DETAILS`
|
||||
- `P22_CONTRATTO_FIRMATO`
|
||||
- `P22_DATA`
|
||||
- `P22_DATA_DOC`
|
||||
- `P22_DATA_SCAD_PREVENTIVO`
|
||||
- `P22_DATORASCARICO`
|
||||
- `P22_DATORASCARICO_NOTE`
|
||||
- `P22_DELETED`
|
||||
- `P22_DELETED_BY`
|
||||
- `P22_DELETED_DATE`
|
||||
- `P22_DESCRIZIONE`
|
||||
- `P22_DISABLED`
|
||||
- `P22_DISTANZA_LOCATION`
|
||||
- `P22_EVENT_ID`
|
||||
- `P22_EVENT_ID_DISPLAY`
|
||||
- `P22_EXTRA`
|
||||
- `P22_EXTRA_COSTI`
|
||||
- `P22_FLG_SUPERATO`
|
||||
- `P22_FLG_TEMPLATE`
|
||||
- `P22_GGSETT`
|
||||
- `P22_GRAN_BUFFET_A`
|
||||
- `P22_GRAN_BUFFET_B`
|
||||
- `P22_ID_EVT_FIGLIO`
|
||||
- `P22_ID_EVT_PADRE`
|
||||
- `P22_ID_IMAGE_SHOW`
|
||||
- `P22_INDIRIZZO`
|
||||
- `P22_IS_TEMPLATE`
|
||||
- `P22_LISTA_PRINT`
|
||||
- `P22_LOCATION`
|
||||
- `P22_LOCATION_DESCRI`
|
||||
- `P22_MAIL_ENABLED`
|
||||
- `P22_MAXSTEP`
|
||||
- `P22_NEW`
|
||||
- `P22_NEW_EVENT_ID`
|
||||
- `P22_NOTE`
|
||||
- `P22_NOTE_INVIO`
|
||||
- `P22_NUMALTRI`
|
||||
- `P22_NUMDEGUSTAZIONI`
|
||||
- `P22_NUM_LISTA`
|
||||
- `P22_ORA_CERIMONIA`
|
||||
- `P22_ORA_EVENTO`
|
||||
- `P22_ORA_FINE_CERIMONIA`
|
||||
- `P22_ORA_FINE_EVENTO`
|
||||
- `P22_ORA_FI_CER`
|
||||
- `P22_ORA_FI_EVENTO`
|
||||
- `P22_ORA_INI_CER`
|
||||
- `P22_ORA_INI_EVENTO`
|
||||
- `P22_PERC_SEDUTE`
|
||||
- `P22_PERMES_CONSUNTIVI_REPORT`
|
||||
- `P22_PIATTI`
|
||||
- `P22_PIATTINO_PANE`
|
||||
- `P22_POSATE`
|
||||
- `P22_PRE_BOUV_A`
|
||||
- `P22_PRE_BOUV_B`
|
||||
- `P22_PRIMI`
|
||||
- `P22_PRIMI_DISPLAY`
|
||||
- `P22_REFERENTE_TEL`
|
||||
- `P22_RISORSA_ADD`
|
||||
- `P22_RISORSA_REMOVE`
|
||||
- `P22_RUNNER`
|
||||
- `P22_SCADUTO`
|
||||
- `P22_SECONDI`
|
||||
- `P22_SEDIA`
|
||||
- `P22_SERVIZIO_TAVOLO_A`
|
||||
- `P22_SERVIZIO_TAVOLO_B`
|
||||
- `P22_SOTTOPIATTI`
|
||||
- `P22_STATO`
|
||||
- `P22_STATUS`
|
||||
- `P22_STEP`
|
||||
- `P22_STILE_COLORI`
|
||||
- `P22_TIPOL_TAV_OSPITI`
|
||||
- `P22_TIPOL_TAV_SPOSI`
|
||||
- `P22_TIPORIS_FILTER`
|
||||
- `P22_TORTA`
|
||||
- `P22_TORTA_A`
|
||||
- `P22_TORTA_B`
|
||||
- `P22_TOT_OSPITI`
|
||||
- `P22_TOVAGLIA`
|
||||
- `P22_TOVAGLIOLO`
|
||||
- `P22_VERSION_DISPLAY`
|
||||
- `P22_VERS_NUMBER`
|
||||
- `P22_VERS_TOKEN`
|
||||
- `P22_VINI`
|
||||
- `P22_VINI_DISPLAY`
|
||||
6
docs/apex/pages/PAGE_024.md
Normal file
6
docs/apex/pages/PAGE_024.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 24 - Stampa Riepilogo Extra
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P24_DATA_FI`
|
||||
- `P24_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_025.md
Normal file
6
docs/apex/pages/PAGE_025.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 25 - Cucina
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P25_DATA_FI`
|
||||
- `P25_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_026.md
Normal file
6
docs/apex/pages/PAGE_026.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 26 - Stampa Riepilogo Cucina
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P26_DATA_FI`
|
||||
- `P26_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_027.md
Normal file
6
docs/apex/pages/PAGE_027.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 27 - Degustazioni_Lista
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P27_DATA_FI`
|
||||
- `P27_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_028.md
Normal file
6
docs/apex/pages/PAGE_028.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 28 - Torte e Costi Extra
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P28_DATA_FI`
|
||||
- `P28_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_029.md
Normal file
6
docs/apex/pages/PAGE_029.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 29 - Stampa Riepilogo Allestimenti
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P29_DATA_FI`
|
||||
- `P29_DATA_IN`
|
||||
6
docs/apex/pages/PAGE_030.md
Normal file
6
docs/apex/pages/PAGE_030.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 30 - Riepilogo Allestimenti
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P30_DATA_FI`
|
||||
- `P30_DATA_IN`
|
||||
18
docs/apex/pages/PAGE_032.md
Normal file
18
docs/apex/pages/PAGE_032.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Page 32 - Degustazioni
|
||||
|
||||
## Items (14)
|
||||
|
||||
- `P32_DATA`
|
||||
- `P32_EMAIL`
|
||||
- `P32_ID`
|
||||
- `P32_ID_EVENTO`
|
||||
- `P32_LOCATION`
|
||||
- `P32_MENU`
|
||||
- `P32_NOME`
|
||||
- `P32_NOTE`
|
||||
- `P32_N_DEGUSTAZIONE`
|
||||
- `P32_N_PAGANTI`
|
||||
- `P32_N_PERSONE`
|
||||
- `P32_ORA`
|
||||
- `P32_ROWID`
|
||||
- `P32_TELEFONO`
|
||||
6
docs/apex/pages/PAGE_033.md
Normal file
6
docs/apex/pages/PAGE_033.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 33 - Stampa Scheda Evento
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P33_EVENT_ID`
|
||||
- `P33_LISTA`
|
||||
6
docs/apex/pages/PAGE_035.md
Normal file
6
docs/apex/pages/PAGE_035.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 35 - Lista Schede Evento
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P35_DATEFROM`
|
||||
- `P35_DATETO`
|
||||
6
docs/apex/pages/PAGE_036.md
Normal file
6
docs/apex/pages/PAGE_036.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 36 - Stampa Riepilogo Degustazioni
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P36_DATA_FI`
|
||||
- `P36_DATA_IN`
|
||||
7
docs/apex/pages/PAGE_038.md
Normal file
7
docs/apex/pages/PAGE_038.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Page 38 - Riepilogo Risorse
|
||||
|
||||
## Items (3)
|
||||
|
||||
- `P38_COD_AZIENDA`
|
||||
- `P38_DATA_FI`
|
||||
- `P38_DATA_IN`
|
||||
8
docs/apex/pages/PAGE_039.md
Normal file
8
docs/apex/pages/PAGE_039.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Page 39 - Impegni Articoli
|
||||
|
||||
## Items (4)
|
||||
|
||||
- `P39_COD_ARTICOLO`
|
||||
- `P39_DATA_FI`
|
||||
- `P39_DATA_IN`
|
||||
- `P39_SHOW_HISTORY`
|
||||
7
docs/apex/pages/PAGE_040.md
Normal file
7
docs/apex/pages/PAGE_040.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Page 40 - Stampa Riepilogo Risorse
|
||||
|
||||
## Items (3)
|
||||
|
||||
- `P40_COD_AZIENDA`
|
||||
- `P40_DATA_FI`
|
||||
- `P40_DATA_IN`
|
||||
5
docs/apex/pages/PAGE_041.md
Normal file
5
docs/apex/pages/PAGE_041.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 41 - Backup
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P41_BCKPASSWORD`
|
||||
12
docs/apex/pages/PAGE_042.md
Normal file
12
docs/apex/pages/PAGE_042.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Page 42 - Nuovo Allegato Evento
|
||||
|
||||
## Items (8)
|
||||
|
||||
- `P42_CHARSET`
|
||||
- `P42_EVENT_ID`
|
||||
- `P42_FILENAME`
|
||||
- `P42_FILESIZELIMITKB`
|
||||
- `P42_ID`
|
||||
- `P42_LAST_UPDATE`
|
||||
- `P42_MIME_TYPE`
|
||||
- `P42_RAW_DATA`
|
||||
5
docs/apex/pages/PAGE_043.md
Normal file
5
docs/apex/pages/PAGE_043.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 43 - Registro Acconti Evento
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P43_ID_EVENTO`
|
||||
5
docs/apex/pages/PAGE_044.md
Normal file
5
docs/apex/pages/PAGE_044.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Page 44 - Registro Altri Costi
|
||||
|
||||
## Items (1)
|
||||
|
||||
- `P44_ID_EVENTO`
|
||||
8
docs/apex/pages/PAGE_045.md
Normal file
8
docs/apex/pages/PAGE_045.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Page 45 - GestioneDati
|
||||
|
||||
## Items (4)
|
||||
|
||||
- `P45_CONSUNTIVI_A`
|
||||
- `P45_CONSUNTIVI_DA`
|
||||
- `P45_EVENTI_A`
|
||||
- `P45_EVENTI_DA`
|
||||
6
docs/apex/pages/PAGE_046.md
Normal file
6
docs/apex/pages/PAGE_046.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 46 - Imposta Blocco Calendario
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P46_GIORNO`
|
||||
- `P46_MAX_EVENTI`
|
||||
6
docs/apex/pages/PAGE_047.md
Normal file
6
docs/apex/pages/PAGE_047.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 47 - Permessi
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P47_CONSUNTIVI_USERS`
|
||||
- `P47_GESTORI_USERS`
|
||||
10
docs/apex/pages/PAGE_052.md
Normal file
10
docs/apex/pages/PAGE_052.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Page 52 - send_mail_modal
|
||||
|
||||
## Items (6)
|
||||
|
||||
- `P52_DATA_FROM`
|
||||
- `P52_DATA_FROM_DISPLAY`
|
||||
- `P52_DATA_TO`
|
||||
- `P52_DATA_TO_DISPLAY`
|
||||
- `P52_MAIL_BODY`
|
||||
- `P52_MAIL_SUBJECT`
|
||||
11
docs/apex/pages/PAGE_053.md
Normal file
11
docs/apex/pages/PAGE_053.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Page 53 - COPIA_LISTA_PAGE
|
||||
|
||||
## Items (7)
|
||||
|
||||
- `P53_COPIA_ACCONTI`
|
||||
- `P53_COPIA_ALTRICOSTI`
|
||||
- `P53_COPIA_DEGUSTAZIONI`
|
||||
- `P53_COPIA_PRELIEVI`
|
||||
- `P53_COPIA_RISORSE`
|
||||
- `P53_EVENTO_FROM`
|
||||
- `P53_EVENTO_TO`
|
||||
6
docs/apex/pages/PAGE_101.md
Normal file
6
docs/apex/pages/PAGE_101.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Page 101 - Login Page
|
||||
|
||||
## Items (2)
|
||||
|
||||
- `P101_PASSWORD`
|
||||
- `P101_USERNAME`
|
||||
7
docs/apex/pages/PAGE_999.md
Normal file
7
docs/apex/pages/PAGE_999.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Page 999 - Stampa Preventivo
|
||||
|
||||
## Items (3)
|
||||
|
||||
- `P999_EVENT_ID`
|
||||
- `P999_MORE_DETAILS`
|
||||
- `P999_SHOW_ECONOMICS`
|
||||
558
docs/apex/processes/README.md
Normal file
558
docs/apex/processes/README.md
Normal file
@@ -0,0 +1,558 @@
|
||||
# APEX Processes Documentation
|
||||
|
||||
This document contains all 98 processes defined in the APEX application, organized by page.
|
||||
|
||||
## Process Overview
|
||||
|
||||
| Process Type | Count |
|
||||
|--------------|-------|
|
||||
| NATIVE_FORM_INIT | Multiple |
|
||||
| NATIVE_FORM_DML | Multiple |
|
||||
| NATIVE_PLSQL | Multiple |
|
||||
| NATIVE_IG_DML | Multiple |
|
||||
| NATIVE_SESSION_STATE | Multiple |
|
||||
|
||||
---
|
||||
|
||||
## Shared (Application-Level) Processes
|
||||
|
||||
### SET_USER_READONLY
|
||||
|
||||
**Process Point:** Before Header (runs on every page)
|
||||
**Type:** NATIVE_PLSQL
|
||||
|
||||
Sets the `APP_READ_ONLY` application item based on user permissions.
|
||||
|
||||
```plsql
|
||||
begin
|
||||
if F_USER_IN_ROLE(:APP_USER, 'READONLY') then
|
||||
:APP_READ_ONLY := 1;
|
||||
else
|
||||
:APP_READ_ONLY := 0;
|
||||
end if;
|
||||
end;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Page 3 - Articoli (Article Form)
|
||||
|
||||
### Fetch Row from ARTICOLI
|
||||
**Process Point:** After Header
|
||||
**Type:** NATIVE_FORM_INIT
|
||||
|
||||
Initializes form with article data.
|
||||
|
||||
### Process Row of ARTICOLI
|
||||
**Process Point:** After Submit
|
||||
**Type:** NATIVE_FORM_DML
|
||||
|
||||
Saves/updates article record.
|
||||
|
||||
### Delete Image
|
||||
**Process Point:** After Submit
|
||||
**Type:** NATIVE_PLSQL
|
||||
**Button:** Delete Image
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update articoli
|
||||
set
|
||||
raw_data = null,
|
||||
last_update = null,
|
||||
charset = null,
|
||||
mimetype = null,
|
||||
filename = null
|
||||
where rowid = :P3_ROWID;
|
||||
end;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Page 22 - Nuovo Evento (Main Event Form)
|
||||
|
||||
Page 22 is the most complex page with 32 processes.
|
||||
|
||||
### After Header Processes
|
||||
|
||||
#### Get Event Details
|
||||
**Sequence:** 10
|
||||
**Type:** NATIVE_FORM_INIT
|
||||
|
||||
Fetches event record into form items.
|
||||
|
||||
#### Set Ospiti on load
|
||||
**Sequence:** 20
|
||||
**Type:** NATIVE_PLSQL
|
||||
|
||||
```plsql
|
||||
begin
|
||||
EVENTI_AGGIORNA_TOT_OSPITI(:P22_EVENT_ID);
|
||||
end;
|
||||
```
|
||||
|
||||
#### Default Values
|
||||
**Sequence:** 40
|
||||
**Type:** NATIVE_PLSQL
|
||||
|
||||
```plsql
|
||||
begin
|
||||
select trim(l.location)
|
||||
into :P22_LOCATION_DESCRI
|
||||
from eventi e
|
||||
join location l on l.id = e.id_location
|
||||
where e.id = :P22_EVENT_ID;
|
||||
exception when no_data_found then
|
||||
null;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Normalizza dati
|
||||
**Sequence:** 50
|
||||
**Type:** NATIVE_PLSQL
|
||||
|
||||
Formats time values for display:
|
||||
|
||||
```plsql
|
||||
:P22_ORA_INI_CER := to_char(to_date(:P22_ORA_CERIMONIA, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
|
||||
:P22_ORA_INI_EVENTO := to_char(to_date(:P22_ORA_EVENTO, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
|
||||
:P22_ORA_FI_CER := to_char(to_date(:ORA_FINE_CERIMONIA, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
|
||||
:P22_ORA_FI_EVENTO := to_char(to_date(:ORA_FINE_EVENTO, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
|
||||
```
|
||||
|
||||
#### New Template Default Data
|
||||
**Sequence:** 60
|
||||
**Condition:** P22_IS_TEMPLATE is not null
|
||||
|
||||
```plsql
|
||||
:P22_DATA := sysdate;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### After Submit Processes
|
||||
|
||||
#### Set Date Default if Template
|
||||
**Sequence:** 10
|
||||
**Condition:** P22_IS_TEMPLATE is not null
|
||||
|
||||
```plsql
|
||||
:P22_DATA := sysdate;
|
||||
```
|
||||
|
||||
#### Delete Template
|
||||
**Sequence:** 20
|
||||
**Button:** Delete Template
|
||||
**Condition:** P22_IS_TEMPLATE is not null
|
||||
|
||||
```plsql
|
||||
delete from eventi where id = :P22_EVENT_ID;
|
||||
```
|
||||
|
||||
#### Genera Evento da Template
|
||||
**Sequence:** 30
|
||||
**Button:** Generate from Template
|
||||
**Condition:** P22_IS_TEMPLATE is not null
|
||||
|
||||
```plsql
|
||||
EVENTI_COPIA
|
||||
(
|
||||
ID_EVENTO_OLD => :P22_EVENT_ID,
|
||||
NUOVA_VERSIONE => 0,
|
||||
ID_EVENTO_NEW => :P22_EVENT_ID
|
||||
);
|
||||
```
|
||||
|
||||
#### Formatta Ore Inizio
|
||||
**Sequence:** 40
|
||||
|
||||
Combines date and time for storage:
|
||||
|
||||
```plsql
|
||||
:P22_ORA_EVENTO := :P22_DATA || ' ' || :P22_ORA_INI_EVENTO;
|
||||
:P22_ORA_CERIMONIA := :P22_DATA || ' ' || :P22_ORA_INI_CER;
|
||||
```
|
||||
|
||||
#### Prepara Acconti Automatici
|
||||
**Sequence:** 50
|
||||
**Condition:** REQUEST in ('PREPARA_ACCONTI', 'PRINT_PREVENTIVO')
|
||||
|
||||
```plsql
|
||||
EVENTI_RICALCOLA_ACCONTI(p_event_id => :P22_EVENT_ID);
|
||||
```
|
||||
|
||||
**Comment:** Default 3 deposits: 30%, 50%, 20%
|
||||
|
||||
#### Go Forward
|
||||
**Sequence:** 60
|
||||
**Button:** NEXT
|
||||
|
||||
Navigates to next wizard step:
|
||||
|
||||
```plsql
|
||||
declare
|
||||
v_step number;
|
||||
begin
|
||||
begin
|
||||
select min(cod_step)
|
||||
into v_step
|
||||
from tb_tipi_mat
|
||||
where cod_step > TO_NUMBER(:P22_STEP);
|
||||
end;
|
||||
|
||||
begin
|
||||
select cod_tipo
|
||||
into :P22_COD_TIPO_FILTER
|
||||
from tb_tipi_mat
|
||||
where cod_step = v_step;
|
||||
exception when no_data_found
|
||||
then raise_application_error(-20001, 'Errore sconosciuto');
|
||||
end;
|
||||
|
||||
:P22_STEP := v_step;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Go Backward
|
||||
**Sequence:** 70
|
||||
**Button:** PREVIOUS
|
||||
|
||||
Navigates to previous wizard step.
|
||||
|
||||
#### Tipo Ospiti - Save Interactive Grid Data
|
||||
**Sequence:** 80
|
||||
**Region:** Guest Types Grid
|
||||
**Type:** NATIVE_IG_DML
|
||||
**Condition:** APP_READ_ONLY = 0
|
||||
|
||||
Saves guest type records.
|
||||
|
||||
#### Tipo Ospiti - Aggiorna Lista Prelievo
|
||||
**Sequence:** 90
|
||||
**Type:** NATIVE_PLSQL
|
||||
**Condition:** APP_READ_ONLY = 0
|
||||
|
||||
Recalculates pick list quantities after guest changes:
|
||||
|
||||
```plsql
|
||||
EVENTI_AGGIORNA_QTA_LISTA(
|
||||
P_ID_EVENTO => :P22_EVENT_ID
|
||||
);
|
||||
```
|
||||
|
||||
#### Degustazioni - Save Interactive Grid Data
|
||||
**Sequence:** 100
|
||||
**Region:** Tastings Grid
|
||||
**Type:** NATIVE_IG_DML
|
||||
|
||||
#### Delete Eventi Childs
|
||||
**Sequence:** 110
|
||||
**Button:** DELETE
|
||||
**Condition:** NEVER (disabled)
|
||||
|
||||
```plsql
|
||||
begin
|
||||
delete from eventi_det_ospiti
|
||||
where id_evento = :P22_EVENT_ID;
|
||||
|
||||
delete from eventi_det_prel
|
||||
where id_evento = :P22_EVENT_ID;
|
||||
|
||||
delete from eventi_det_ris
|
||||
where id_evento = :P22_EVENT_ID;
|
||||
|
||||
delete from eventi_det_degust
|
||||
where id_evento = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Set Obsoleto
|
||||
**Sequence:** 120
|
||||
**Button:** Set Obsolete
|
||||
**Condition:** APP_READ_ONLY = 0
|
||||
|
||||
Marks event as expired/cancelled:
|
||||
|
||||
```plsql
|
||||
begin
|
||||
UPDATE EVENTI
|
||||
SET FLG_SUPERATO = 1, STATO = 900, MAIL_ENABLED = 0
|
||||
WHERE ID = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Salva Evento
|
||||
**Sequence:** 130
|
||||
**Condition:** Complex (handles CREATE, SAVE, DELETE)
|
||||
|
||||
Main event save process. Full implementation handles:
|
||||
- All event fields mapping
|
||||
- Email validation
|
||||
- Status-based logic
|
||||
- Versioning support
|
||||
- Soft delete
|
||||
|
||||
Key excerpts:
|
||||
|
||||
```plsql
|
||||
declare
|
||||
r_eventi eventi%rowtype;
|
||||
begin
|
||||
if :REQUEST = 'PREVIOUS' or :REQUEST = 'NEXT'
|
||||
then
|
||||
return;
|
||||
end if;
|
||||
|
||||
if(:P22_DATA is null)
|
||||
then
|
||||
raise_application_error(-20001, 'Inserire la data evento');
|
||||
end if;
|
||||
|
||||
-- Set all row fields
|
||||
r_eventi."ID" := :P22_EVENT_ID;
|
||||
r_eventi.DESCRIZIONE := :P22_DESCRIZIONE;
|
||||
r_eventi.COD_TIPO := :P22_COD_TIPO;
|
||||
-- ... (all other fields)
|
||||
|
||||
-- Email validation
|
||||
IF REGEXP_LIKE(:P22_CLIENTE_EMAIL, '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')
|
||||
OR :P22_CLIENTE_EMAIL IS NULL THEN
|
||||
r_eventi.CLIENTE_EMAIL := :P22_CLIENTE_EMAIL;
|
||||
ELSE
|
||||
RAISE_APPLICATION_ERROR(-20005, 'Formato email cliente non valido');
|
||||
END IF;
|
||||
|
||||
-- Versioning
|
||||
r_eventi.VERS_NUMBER := nvl(:P22_VERS_NUMBER, 0);
|
||||
r_eventi.VERS_TOKEN := :P22_VERS_TOKEN;
|
||||
|
||||
case :REQUEST
|
||||
when 'SAVE' then
|
||||
update eventi set row = r_eventi where id = :P22_EVENT_ID;
|
||||
when 'CREATE' then
|
||||
insert into eventi values r_eventi returning id into :P22_EVENT_ID;
|
||||
when 'DELETE' then
|
||||
if r_eventi.ID_EVT_FIGLIO is not null or r_eventi.ID_EVT_PADRE is not null
|
||||
then
|
||||
raise_application_error(-20001, 'Impossibile eliminare un evento...');
|
||||
end if;
|
||||
update eventi
|
||||
set deleted = 1,
|
||||
deleted_by = :APP_USER,
|
||||
deleted_date = sysdate
|
||||
where id = r_eventi."ID";
|
||||
else
|
||||
null;
|
||||
end case;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Nuova Versione
|
||||
**Sequence:** 140
|
||||
**Button:** New Version
|
||||
|
||||
Creates a new version of the event:
|
||||
|
||||
```plsql
|
||||
EVENTI_COPIA
|
||||
(
|
||||
ID_EVENTO_OLD => :P22_EVENT_ID,
|
||||
NUOVA_VERSIONE => 1,
|
||||
ID_EVENTO_NEW => :P22_NEW_EVENT_ID
|
||||
);
|
||||
```
|
||||
|
||||
#### Lista Prelievo - Save Interactive Grid Data
|
||||
**Sequence:** 150
|
||||
**Type:** NATIVE_IG_DML
|
||||
**Table:** EVENTI_DET_PREL
|
||||
|
||||
Saves pick list records.
|
||||
|
||||
#### Continue Event
|
||||
**Sequence:** 160
|
||||
**Button:** Continue
|
||||
|
||||
Advances event to "Confermata" status (300):
|
||||
|
||||
```plsql
|
||||
declare
|
||||
v_count number;
|
||||
v_count_evt number;
|
||||
begin
|
||||
-- Check if confirmed event exists for same location/date
|
||||
select count(*) into v_count
|
||||
from eventi
|
||||
where data = (select data from eventi where id = :P22_EVENT_ID)
|
||||
and stato = 300
|
||||
and id_location = (select id_location from eventi where id = :P22_EVENT_ID);
|
||||
|
||||
if v_count > 0 then
|
||||
raise_application_error(-20001, 'Esiste un evento Confermato per la location - Impossibile proseguire');
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- Update status
|
||||
update eventi
|
||||
set stato = 300
|
||||
where id = :P22_EVENT_ID;
|
||||
|
||||
-- Check total confirmed events for date
|
||||
select count(*) into v_count_evt
|
||||
from eventi
|
||||
where data = (select data from eventi where id = :P22_EVENT_ID)
|
||||
and stato = 300;
|
||||
|
||||
if v_count_evt > 6 then
|
||||
RAISE_APPLICATION_ERROR(-20000, 'Ci sono già 6 eventi Confermati per la data');
|
||||
end if;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Almost Continue Event
|
||||
**Sequence:** 170
|
||||
**Button:** Almost Continue
|
||||
|
||||
Sets status to "Quasi Confermato" (350):
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update eventi
|
||||
set stato = 350
|
||||
where id = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Confirm Event
|
||||
**Sequence:** 180
|
||||
**Button:** Confirm
|
||||
**Condition:** APP_READ_ONLY = 0
|
||||
|
||||
Final confirmation (status 400) and cancels competing events:
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update eventi
|
||||
set stato = 400
|
||||
where id = :P22_EVENT_ID;
|
||||
|
||||
-- Cancel events with same date and location
|
||||
p_cancel_same_location_events(
|
||||
p_good_event_id => :P22_EVENT_ID
|
||||
);
|
||||
end;
|
||||
```
|
||||
|
||||
#### Unconfirm Event
|
||||
**Sequence:** 190
|
||||
**Button:** Unconfirm
|
||||
|
||||
Returns event to initial status (100):
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update eventi
|
||||
set stato = 100
|
||||
where id = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Reopen Event
|
||||
**Sequence:** 200
|
||||
**Button:** Reopen
|
||||
|
||||
Clears the expired flag:
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update eventi
|
||||
set flg_superato = 0
|
||||
where id = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Return to Preparazione
|
||||
**Sequence:** 210
|
||||
**Button:** Return to Preparation
|
||||
|
||||
Sets status back to preparation (200):
|
||||
|
||||
```plsql
|
||||
begin
|
||||
update eventi
|
||||
set stato = 200
|
||||
where id = :P22_EVENT_ID;
|
||||
end;
|
||||
```
|
||||
|
||||
#### Risorse - Save Interactive Grid Data
|
||||
**Sequence:** 220
|
||||
**Type:** NATIVE_IG_DML
|
||||
|
||||
Saves resource assignments.
|
||||
|
||||
#### Aggiorna QTA Lista
|
||||
**Sequence:** 230
|
||||
**Condition:** APP_READ_ONLY = 0 AND REQUEST = 'AGGIORNA_QTA'
|
||||
|
||||
Manual quantity recalculation:
|
||||
|
||||
```plsql
|
||||
EVENTI_AGGIORNA_QTA_LISTA(
|
||||
P_ID_EVENTO => :P22_EVENT_ID
|
||||
);
|
||||
```
|
||||
|
||||
#### Restore Deleted Event
|
||||
**Sequence:** 240
|
||||
|
||||
Restores soft-deleted event.
|
||||
|
||||
---
|
||||
|
||||
## Event Status Workflow Summary
|
||||
|
||||
| Status Code | Status Name | Italian | Next Action |
|
||||
|-------------|-------------|---------|-------------|
|
||||
| 100 | Preventivo | Quote | Continue Event → 300 |
|
||||
| 200 | Scheda | Preparation | - |
|
||||
| 300 | Confermata | Confirmed (Pending) | Almost Continue → 350 |
|
||||
| 350 | Quasi | Almost Confirmed | Confirm → 400 |
|
||||
| 400 | Confermato | Confirmed | - |
|
||||
| 900 | Superato | Expired/Cancelled | Reopen → clears flag |
|
||||
|
||||
---
|
||||
|
||||
## Common Process Patterns
|
||||
|
||||
### Read-Only Check
|
||||
All write processes include this condition:
|
||||
```plsql
|
||||
:APP_READ_ONLY = 0
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
Standard error pattern:
|
||||
```plsql
|
||||
exception when no_data_found then
|
||||
raise_application_error(-20001, 'Error message in Italian');
|
||||
```
|
||||
|
||||
### Interactive Grid Save
|
||||
Standard IG DML process:
|
||||
- Type: NATIVE_IG_DML
|
||||
- Attributes: REGION_SOURCE, Allow Insert (Y), Allow Update (Y), Allow Delete (Y)
|
||||
|
||||
---
|
||||
|
||||
## Migration Notes
|
||||
|
||||
When migrating these processes to .NET:
|
||||
|
||||
1. **Form Initialization** - Use API endpoints to fetch entity data
|
||||
2. **Form DML** - Implement CRUD endpoints with proper validation
|
||||
3. **Custom PL/SQL** - Convert to C# methods or stored procedures
|
||||
4. **IG DML** - Implement batch update endpoints for grid data
|
||||
5. **Session State** - Use application state management (Redux, Context)
|
||||
6. **Validation** - Implement in both frontend and backend
|
||||
7. **Workflow** - Consider state machine pattern for event status
|
||||
22
docs/functions/CLOB2BLOB.md
Normal file
22
docs/functions/CLOB2BLOB.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# CLOB2BLOB
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "CLOB2BLOB" (AClob CLOB) return BLOB is
|
||||
Result BLOB;
|
||||
o1 integer;
|
||||
o2 integer;
|
||||
c integer;
|
||||
w integer;
|
||||
begin
|
||||
o1 := 1;
|
||||
o2 := 1;
|
||||
c := 0;
|
||||
w := 0;
|
||||
DBMS_LOB.CreateTemporary(Result, true);
|
||||
DBMS_LOB.ConvertToBlob(Result, AClob, length(AClob), o1, o2, 0, c, w);
|
||||
return(Result);
|
||||
end clob2blob;
|
||||
|
||||
```
|
||||
10
docs/functions/EXTDATE_GET_ITA.md
Normal file
10
docs/functions/EXTDATE_GET_ITA.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# EXTDATE_GET_ITA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
function extdate_get_ita( p_date date ) return varchar2
|
||||
as
|
||||
begin
|
||||
return REGEXP_REPLACE(TO_CHAR(p_date, 'Day dd Month yyyy', 'NLS_DATE_LANGUAGE = ITALIAN'), ' [ ]+', ' ');
|
||||
end;```
|
||||
37
docs/functions/F_CI_SONO_EVENTI_CONFERMATI.md
Normal file
37
docs/functions/F_CI_SONO_EVENTI_CONFERMATI.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# F_CI_SONO_EVENTI_CONFERMATI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_CI_SONO_EVENTI_CONFERMATI
|
||||
(
|
||||
P_EVT_DATE IN DATE
|
||||
, P_LOCATION_ID IN NUMBER
|
||||
, P_BYPASS IN NUMBER
|
||||
) RETURN NUMBER AS
|
||||
|
||||
v_evt_cnt number;
|
||||
|
||||
BEGIN
|
||||
|
||||
-- function bypass
|
||||
if P_BYPASS > 0 then
|
||||
return 0;
|
||||
end if;
|
||||
|
||||
select
|
||||
count(e.id) as evt_cnt
|
||||
into v_evt_cnt
|
||||
from eventi e
|
||||
join vw_event_color c on c.id = e.id
|
||||
where e.data = P_EVT_DATE
|
||||
and e.id_location = P_LOCATION_ID
|
||||
and c.status = 'Confermato';
|
||||
|
||||
if v_evt_cnt > 0 then
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
end if;
|
||||
|
||||
END F_CI_SONO_EVENTI_CONFERMATI;```
|
||||
45
docs/functions/F_DAY_TO_NAME.md
Normal file
45
docs/functions/F_DAY_TO_NAME.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# F_DAY_TO_NAME
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_DAY_TO_NAME
|
||||
(
|
||||
DAY_NUMBER IN NUMBER
|
||||
) RETURN VARCHAR2 AS
|
||||
v_day_number number := DAY_NUMBER;
|
||||
v_language varchar2(255);
|
||||
BEGIN
|
||||
with t as (
|
||||
select DECODE(parameter, 'NLS_CHARACTERSET', 'CHARACTER SET',
|
||||
'NLS_LANGUAGE', 'LANGUAGE',
|
||||
'NLS_TERRITORY', 'TERRITORY') name,
|
||||
value from v$nls_parameters
|
||||
WHERE parameter IN ( 'NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY')
|
||||
)
|
||||
select value into v_language
|
||||
from t
|
||||
where name = 'LANGUAGE';
|
||||
|
||||
if v_language = 'AMERICAN' then
|
||||
case v_day_number
|
||||
when 1 then return 'Domenica';
|
||||
when 2 then return 'Lunedì';
|
||||
when 3 then return 'Martedì';
|
||||
when 4 then return 'Mercoledì';
|
||||
when 5 then return 'Giovedì';
|
||||
when 6 then return 'Venerdì';
|
||||
when 7 then return 'Sabato';
|
||||
end case;
|
||||
else
|
||||
case v_day_number
|
||||
when 1 then return 'Lunedì';
|
||||
when 2 then return 'Martedì';
|
||||
when 3 then return 'Mercoledì';
|
||||
when 4 then return 'Giovedì';
|
||||
when 5 then return 'Venerdì';
|
||||
when 6 then return 'Sabato';
|
||||
when 7 then return 'Domenica';
|
||||
end case;
|
||||
end if;
|
||||
END F_DAY_TO_NAME;```
|
||||
22
docs/functions/F_EVENTO_SCADUTO.md
Normal file
22
docs/functions/F_EVENTO_SCADUTO.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# F_EVENTO_SCADUTO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_EVENTO_SCADUTO
|
||||
(
|
||||
DATA_SCADENZA IN DATE,
|
||||
STATO_EVENTO IN NUMBER,
|
||||
STATO_FROM IN NUMBER,
|
||||
STATO_TO IN NUMBER
|
||||
) RETURN NUMBER AS
|
||||
BEGIN
|
||||
if trunc(DATA_SCADENZA) <= trunc(sysdate)
|
||||
and STATO_EVENTO between STATO_FROM and STATO_TO
|
||||
then
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
end if;
|
||||
END F_EVENTO_SCADUTO;
|
||||
```
|
||||
31
docs/functions/F_GET_ANGOLO_ALLESTIMENTO.md
Normal file
31
docs/functions/F_GET_ANGOLO_ALLESTIMENTO.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# F_GET_ANGOLO_ALLESTIMENTO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_ANGOLO_ALLESTIMENTO" (
|
||||
p_filtro VARCHAR2,
|
||||
p_id NUMBER
|
||||
) RETURN VARCHAR2 AS
|
||||
|
||||
TYPE ref_cur IS REF CURSOR;
|
||||
c_data ref_cur;
|
||||
v_val VARCHAR2(1000);
|
||||
v_filtro VARCHAR2(100);
|
||||
v_id NUMBER;
|
||||
BEGIN
|
||||
v_filtro := p_filtro;
|
||||
v_id := p_id;
|
||||
OPEN c_data FOR ' select substr(a.descrizione || '' - '' || p.note ,1,1000)
|
||||
from eventi e
|
||||
left join location l on e.id_location = l.id
|
||||
join eventi_det_prel p on e.id=p.id_evento
|
||||
join articoli a on p.cod_articolo=a.cod_articolo
|
||||
where p.COD_ARTICOLO = :filtro -- AN-GELAT
|
||||
and e.id = to_number(:id)'
|
||||
USING v_filtro, v_id;
|
||||
|
||||
FETCH c_data INTO v_val;
|
||||
CLOSE c_data;
|
||||
RETURN v_val;
|
||||
END;```
|
||||
34
docs/functions/F_GET_ANGOLO_ALLESTIMENTO_OB.md
Normal file
34
docs/functions/F_GET_ANGOLO_ALLESTIMENTO_OB.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# F_GET_ANGOLO_ALLESTIMENTO_OB
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_ANGOLO_ALLESTIMENTO_OB" (
|
||||
p_filtro VARCHAR2,
|
||||
p_id NUMBER
|
||||
) RETURN VARCHAR2
|
||||
--ANGOLI OPEN BAR
|
||||
AS
|
||||
|
||||
TYPE ref_cur IS REF CURSOR;
|
||||
c_data ref_cur;
|
||||
v_val VARCHAR2(1000);
|
||||
v_filtro VARCHAR2(100);
|
||||
v_id NUMBER;
|
||||
BEGIN
|
||||
v_filtro := p_filtro;
|
||||
v_id := p_id;
|
||||
OPEN c_data FOR ' select substr(a.descrizione || '' - '' || p.note ,1,1000)
|
||||
from eventi e
|
||||
left join location l on e.id_location = l.id
|
||||
join eventi_det_prel p on e.id=p.id_evento
|
||||
join articoli a on p.cod_articolo=a.cod_articolo
|
||||
where a.cod_categ = ''AN-FIN''
|
||||
and a.descrizione like :filtro -- AN-GELAT
|
||||
and e.id = to_number(:id)'
|
||||
USING v_filtro, v_id;
|
||||
|
||||
FETCH c_data INTO v_val;
|
||||
CLOSE c_data;
|
||||
RETURN v_val;
|
||||
END;```
|
||||
37
docs/functions/F_GET_COSTO_ARTICOLO.md
Normal file
37
docs/functions/F_GET_COSTO_ARTICOLO.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# F_GET_COSTO_ARTICOLO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
function f_get_costo_articolo(p_cod_articolo varchar2, p_date date)
|
||||
return number
|
||||
as
|
||||
v_costo number := null;
|
||||
begin
|
||||
|
||||
-- Cerco il costo alla data
|
||||
begin
|
||||
SELECT a.costo_uni
|
||||
into v_costo
|
||||
FROM COSTI_ARTICOLI a
|
||||
where a.data_costo = p_date
|
||||
and a.cod_articolo = p_cod_articolo;
|
||||
exception when no_data_found then
|
||||
v_costo := null;
|
||||
end;
|
||||
|
||||
-- Se non lo trovo prendo l'ultimo costo
|
||||
begin
|
||||
SELECT a.costo_uni
|
||||
into v_costo
|
||||
FROM COSTI_ARTICOLI a
|
||||
WHERE a.DATA_COSTO = (SELECT max(b.DATA_COSTO) FROM COSTI_ARTICOLI b where b.cod_articolo = a.cod_articolo)
|
||||
and a.cod_articolo = p_cod_articolo;
|
||||
exception when no_data_found then
|
||||
v_costo := null;
|
||||
end;
|
||||
|
||||
-- se non trovo niente torno 0
|
||||
return nvl(v_costo, 0);
|
||||
end;
|
||||
```
|
||||
164
docs/functions/F_GET_OSPITI.md
Normal file
164
docs/functions/F_GET_OSPITI.md
Normal file
@@ -0,0 +1,164 @@
|
||||
# F_GET_OSPITI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_OSPITI" (
|
||||
p_id_evento IN NUMBER
|
||||
) RETURN t_det_ospiti_tab
|
||||
PIPELINED
|
||||
AS
|
||||
|
||||
v_data DATE;
|
||||
v_location VARCHAR2(100);
|
||||
v_cliente VARCHAR2(100);
|
||||
v_descrizione VARCHAR2(100);
|
||||
v_ora_cerimonia VARCHAR2(10);
|
||||
v_ora_evento VARCHAR2(10);
|
||||
v_tot_adulti NUMBER;
|
||||
v_tot_kinder NUMBER;
|
||||
v_tot_baby NUMBER;
|
||||
v_tot_staff NUMBER;
|
||||
v_tot_invitati NUMBER;
|
||||
v_allergie VARCHAR2(4000);
|
||||
v_torta VARCHAR2(1000);
|
||||
v_confettata VARCHAR2(100);
|
||||
v_stampa_menu VARCHAR2(100);
|
||||
v_angoli VARCHAR2(1000);
|
||||
v_extra_info VARCHAR2(1000);
|
||||
v_note_adulti VARCHAR2(1000);
|
||||
v_note_kinder VARCHAR2(1000);
|
||||
v_note_baby VARCHAR2(1000);
|
||||
v_note_staff VARCHAR2(1000);
|
||||
BEGIN
|
||||
BEGIN
|
||||
v_tot_adulti := 0;
|
||||
v_tot_kinder := 0;
|
||||
v_tot_baby := 0;
|
||||
v_tot_staff := 0;
|
||||
v_tot_invitati := 0;
|
||||
v_angoli := 0;
|
||||
v_note_adulti := '';
|
||||
v_note_kinder := '';
|
||||
v_note_baby := '';
|
||||
v_note_staff := '';
|
||||
|
||||
--ospiti
|
||||
SELECT
|
||||
nvl(SUM(o.numero),
|
||||
0)
|
||||
INTO v_tot_adulti
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 8; -- adulti
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
o.note
|
||||
INTO v_note_adulti
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 8; -- adulti
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
nvl(SUM(o.numero),
|
||||
0)
|
||||
INTO v_tot_kinder
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 5; --Kinder
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
o.note
|
||||
INTO v_note_kinder
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 5; --Kinder
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
nvl(SUM(o.numero),
|
||||
0)
|
||||
INTO v_tot_baby
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 6; -- Baby
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
o.note
|
||||
INTO v_note_baby
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 6; -- Baby
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
nvl(SUM(o.numero),
|
||||
0)
|
||||
INTO v_tot_staff
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 7; -- Staff
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
o.note
|
||||
INTO v_note_staff
|
||||
FROM
|
||||
eventi_det_ospiti o
|
||||
WHERE
|
||||
o.id_evento = p_id_evento
|
||||
AND o.cod_tipo_ospite = 7; -- Staff
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
SELECT
|
||||
nvl(e.tot_ospiti, 0)
|
||||
INTO v_tot_invitati
|
||||
FROM
|
||||
eventi e
|
||||
WHERE
|
||||
e.id = p_id_evento;
|
||||
|
||||
PIPE ROW ( t_det_ospiti_row(p_id_evento, v_tot_adulti, v_tot_kinder, v_tot_baby, v_tot_staff,
|
||||
v_tot_invitati, v_note_adulti, v_note_kinder, v_note_baby, v_note_staff) );
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
NULL;
|
||||
END;
|
||||
|
||||
RETURN;
|
||||
END;```
|
||||
36
docs/functions/F_GET_QTA_IMPEGNATA.md
Normal file
36
docs/functions/F_GET_QTA_IMPEGNATA.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# F_GET_QTA_IMPEGNATA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_QTA_IMPEGNATA" (
|
||||
p_codart VARCHAR2,
|
||||
p_data_from DATE,
|
||||
p_data_to DATE DEFAULT NULL
|
||||
) RETURN NUMBER AS
|
||||
v_qta NUMBER;
|
||||
v_data_to DATE := p_data_to;
|
||||
BEGIN
|
||||
v_qta := 0;
|
||||
IF ( p_data_to IS NULL ) THEN
|
||||
v_data_to := p_data_from;
|
||||
END IF;
|
||||
BEGIN
|
||||
SELECT
|
||||
nvl(SUM(qta_imp),
|
||||
0)
|
||||
INTO v_qta
|
||||
FROM
|
||||
v_impegni_articoli
|
||||
WHERE
|
||||
cod_articolo = p_codart
|
||||
--and data <= p_data --
|
||||
AND data BETWEEN p_data_from AND v_data_to; -- qta impegnata per quella data
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
v_qta := 0;
|
||||
END;
|
||||
|
||||
RETURN v_qta;
|
||||
END;```
|
||||
31
docs/functions/F_GET_TOT_OSPITI.md
Normal file
31
docs/functions/F_GET_TOT_OSPITI.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# F_GET_TOT_OSPITI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_TOT_OSPITI" (
|
||||
p_id_evento IN NUMBER,
|
||||
p_tipo_ospite IN NUMBER := -1
|
||||
) RETURN NUMBER AS
|
||||
v_tot NUMBER;
|
||||
BEGIN
|
||||
v_tot := 0;
|
||||
BEGIN
|
||||
SELECT
|
||||
nvl(SUM(numero),
|
||||
0)
|
||||
INTO v_tot
|
||||
FROM
|
||||
eventi_det_ospiti
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND ( cod_tipo_ospite = p_tipo_ospite
|
||||
OR p_tipo_ospite = - 1 );
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
v_tot := 0;
|
||||
END;
|
||||
|
||||
RETURN v_tot;
|
||||
END;```
|
||||
34
docs/functions/F_GET_TOVAGLIATO_ALLESTIMENTO.md
Normal file
34
docs/functions/F_GET_TOVAGLIATO_ALLESTIMENTO.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# F_GET_TOVAGLIATO_ALLESTIMENTO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_GET_TOVAGLIATO_ALLESTIMENTO" (
|
||||
p_filtro VARCHAR2,
|
||||
p_id NUMBER
|
||||
) RETURN VARCHAR2 AS
|
||||
|
||||
TYPE ref_cur IS REF CURSOR;
|
||||
c_data ref_cur;
|
||||
v_val VARCHAR2(1000);
|
||||
v_filtro VARCHAR2(100);
|
||||
v_id NUMBER;
|
||||
BEGIN
|
||||
v_filtro := p_filtro;
|
||||
v_id := p_id;
|
||||
OPEN c_data FOR ' select substr(a.descrizione || '' - '' || p.note ,1,1000) as dato
|
||||
from eventi e
|
||||
left join location l on e.id_location = l.id
|
||||
join eventi_det_prel p on e.id=p.id_evento
|
||||
join articoli a on p.cod_articolo=a.cod_articolo
|
||||
join TB_CODICI_CATEG c on a.cod_categ=c.cod_categ
|
||||
--where c.COD_TIPO = ''TVB'' -- dividere tovagliolo da tovagliato con i codici categ
|
||||
where c.COD_TIPO = :filtro
|
||||
and rownum = 1 -- se esistono più articoli fare list_agg op loop
|
||||
and e.id = to_number(:id)'
|
||||
USING v_filtro, v_id;
|
||||
|
||||
FETCH c_data INTO v_val;
|
||||
CLOSE c_data;
|
||||
RETURN v_val;
|
||||
END;```
|
||||
84
docs/functions/F_LIST_PRELIEVO_ADD_ARTICOLO.md
Normal file
84
docs/functions/F_LIST_PRELIEVO_ADD_ARTICOLO.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# F_LIST_PRELIEVO_ADD_ARTICOLO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
function f_list_prelievo_add_articolo(
|
||||
p_event_id number,
|
||||
p_articolo_add varchar2,
|
||||
p_qta_aperitivo NUMBER := 0,
|
||||
p_qta_seduto NUMBER := 0,
|
||||
p_qta_dolci NUMBER := 0
|
||||
)
|
||||
return varchar2
|
||||
as
|
||||
v_qta_imp number;
|
||||
v_qta_giac number;
|
||||
v_data_evento date;
|
||||
v_cod_art varchar2(10);
|
||||
v_error_json varchar2(4000);
|
||||
v_qta_da_imp NUMBER;
|
||||
v_qta_da_imp_test NUMBER;
|
||||
v_num_evt_imp number;
|
||||
BEGIN
|
||||
|
||||
v_cod_art := p_articolo_add;
|
||||
v_qta_da_imp := nvl(p_qta_aperitivo, 0) + nvl(p_qta_seduto, 0) + nvl(p_qta_dolci, 0);
|
||||
|
||||
begin
|
||||
|
||||
select trunc(data) as data
|
||||
into v_data_evento
|
||||
from eventi where id = p_event_id;
|
||||
exception when no_data_found then
|
||||
rollback;
|
||||
RETURN '{"type":"error","code":"'||SQLCODE||'","stack":"'||SQLERRM||'","message":"Evento non trovato"}';
|
||||
end;
|
||||
begin
|
||||
select qta_giac
|
||||
into v_qta_giac
|
||||
from articoli
|
||||
where COD_ARTICOLO = v_cod_art;
|
||||
exception when no_data_found then
|
||||
rollback;
|
||||
RETURN '{"type":"error","code":"'||SQLCODE||'","stack":"'||SQLERRM||'","message":"Articolo non trovato"}';
|
||||
end;
|
||||
|
||||
|
||||
select count(*)
|
||||
into v_num_evt_imp
|
||||
from V_IMPEGNI_ARTICOLI
|
||||
where COD_ARTICOLO = v_cod_art
|
||||
and data between v_data_evento - 2 and v_data_evento + 2;
|
||||
|
||||
v_qta_imp := nvl(f_get_qta_impegnata (v_cod_art, v_data_evento - 2, v_data_evento + 2 ) , 0);
|
||||
|
||||
--insert impegno articolo
|
||||
begin
|
||||
insert into eventi_det_prel (id_evento, cod_articolo,QTA_MAN_APE,QTA_MAN_SEDU,QTA_MAN_BUFDOL, COSTO_ARTICOLO)
|
||||
values (p_event_id, p_articolo_add, p_qta_aperitivo, p_qta_seduto, p_qta_dolci, f_get_costo_articolo(v_cod_art, v_data_evento));
|
||||
|
||||
-- aggiorna liste prelievo
|
||||
EVENTI_AGGIORNA_QTA_LISTA(
|
||||
P_ID_EVENTO => p_event_id
|
||||
);
|
||||
|
||||
-- Controlla banalmente se sono stati prelevati su altri eventi
|
||||
if v_qta_imp + v_qta_da_imp > v_qta_giac then
|
||||
RETURN '{"type":"warning","message":"Attenzione: Non hai abbastanza articoli di questo tipo a magazzino"}';
|
||||
end if;
|
||||
|
||||
-- Se trovo articoli già impegnati in quel giorno mostro un messaggio - 16/11/2022
|
||||
-- Continuo lo stesso ma do un messaggio di errore anzichè di successo
|
||||
if(v_qta_imp > 0 and v_num_evt_imp > 0) then
|
||||
RETURN '{"type":"warning","code":"'||SQLCODE||'","stack":"'||SQLERRM||'","message":"Attenzione! Articolo '||p_articolo_add||' già impegnato '||v_num_evt_imp||' '||(case when v_num_evt_imp > 1 then 'volte' else 'volta' end)||' dal '||to_char(v_data_evento - 2, 'dd-mm-yyyy')||' al '||to_char(v_data_evento + 2, 'dd-mm-yyyy')||'"}';
|
||||
end if;
|
||||
|
||||
RETURN '{"type":"success","message":"Articolo aggiunto con successo"}';
|
||||
exception when others then
|
||||
RETURN '{"type":"success","message":"Articolo aggiunto con errori: '||replace(replace(SQLERRM, 'ORA-20000: Errore:', ''), '-20000 - ', '')||'"}';
|
||||
end;
|
||||
|
||||
rollback;
|
||||
return '{"type":"error","code":"","stack":"","message":"Errore sconosciuto"}';
|
||||
end f_list_prelievo_add_articolo;```
|
||||
38
docs/functions/F_MAX_NUMERO_EVENTI_RAGGIUNTO.md
Normal file
38
docs/functions/F_MAX_NUMERO_EVENTI_RAGGIUNTO.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# F_MAX_NUMERO_EVENTI_RAGGIUNTO
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_MAX_NUMERO_EVENTI_RAGGIUNTO
|
||||
(
|
||||
P_GIORNO IN DATE
|
||||
) RETURN NUMBER AS
|
||||
v_max_eventi TB_CALENDAR_LOCKS.max_eventi%TYPE; -- Variable to hold the max_eventi value from TB_CALENDAR_LOCKS
|
||||
v_event_count NUMBER; -- Variable to hold the count of events from EVENTI
|
||||
BEGIN
|
||||
-- Step 1: Check if P_GIORNO is present in TB_CALENDAR_LOCKS and get the max_eventi value for that day
|
||||
BEGIN
|
||||
SELECT max_eventi
|
||||
INTO v_max_eventi
|
||||
FROM TB_CALENDAR_LOCKS
|
||||
WHERE giorno = P_GIORNO;
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND THEN
|
||||
-- If the date is not found in TB_CALENDAR_LOCKS, return -1 (or some other code to indicate the absence)
|
||||
RETURN -1;
|
||||
END;
|
||||
|
||||
-- Step 2: Count how many events occurred on P_GIORNO in the EVENTI table
|
||||
SELECT COUNT(*)
|
||||
INTO v_event_count
|
||||
FROM EVENTI
|
||||
WHERE TRUNC(DATA) = TRUNC(P_GIORNO); -- Use TRUNC to compare only the date part
|
||||
|
||||
-- Step 3: Compare the event count with the max_eventi and return the appropriate result
|
||||
IF v_event_count >= v_max_eventi THEN
|
||||
RETURN 1; -- Maximum number of events has been reached or exceeded
|
||||
ELSE
|
||||
RETURN 0; -- Maximum number of events has not been reached
|
||||
END IF;
|
||||
|
||||
END F_MAX_NUMERO_EVENTI_RAGGIUNTO;```
|
||||
36
docs/functions/F_MAX_NUM_EVENTI_CONFERMATI.md
Normal file
36
docs/functions/F_MAX_NUM_EVENTI_CONFERMATI.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# F_MAX_NUM_EVENTI_CONFERMATI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_MAX_NUM_EVENTI_CONFERMATI
|
||||
(
|
||||
P_EVT_DATE IN DATE
|
||||
, P_MAX_EVT_NUM NUMBER
|
||||
, P_BYPASS IN NUMBER
|
||||
) RETURN NUMBER AS
|
||||
|
||||
v_evt_cnt number;
|
||||
|
||||
BEGIN
|
||||
|
||||
-- function bypass
|
||||
if P_BYPASS > 0 then
|
||||
return 0;
|
||||
end if;
|
||||
|
||||
select
|
||||
count(e.id) as evt_cnt
|
||||
into v_evt_cnt
|
||||
from eventi e
|
||||
join vw_event_color c on c.id = e.id
|
||||
where e.data = P_EVT_DATE
|
||||
and c.status = 'Confermato';
|
||||
|
||||
if v_evt_cnt >= P_MAX_EVT_NUM then
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
end if;
|
||||
|
||||
END F_MAX_NUM_EVENTI_CONFERMATI;```
|
||||
433
docs/functions/F_REP_ALLESTIMENTI.md
Normal file
433
docs/functions/F_REP_ALLESTIMENTI.md
Normal file
@@ -0,0 +1,433 @@
|
||||
# F_REP_ALLESTIMENTI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_REP_ALLESTIMENTI" ( p_data_in IN varchar2 default to_char(sysdate,'YYYYMMD'),
|
||||
p_data_fi IN varchar2 default to_char(sysdate + 30,'YYYYMMD')
|
||||
)
|
||||
RETURN t_rep_allestimenti_tab PIPELINED AS
|
||||
|
||||
v_data_in varchar2(100);
|
||||
v_data_fi varchar2(100);
|
||||
|
||||
cursor c_evento is
|
||||
with t as (--select e.id, e.data, l.location, e.torta, e.confettata, e.stampa_menu
|
||||
select e.id, e.data, l.location, e.torta,
|
||||
e.altro_a as confettata,
|
||||
e.sedia as stampa_menu
|
||||
from eventi e
|
||||
left join location l on e.id_location = l.id
|
||||
--where data >= sysdate
|
||||
where e.data between to_date(v_data_in,'YYYYMMDD') and to_date(v_data_fi,'YYYYMMDD')
|
||||
and e.stato in (300, 400) -- 300 Scheda Confermata, 400 Confermato (Lista)
|
||||
and e.disabled = 0
|
||||
and e.deleted = 0
|
||||
order by data, to_number(to_char(e.ora_evento,'HH24MI'))
|
||||
)
|
||||
, q as (select t.* , rownum as order_id
|
||||
from t
|
||||
order by data
|
||||
)
|
||||
, r as (select
|
||||
case when order_id =1 then id else null end as id1,
|
||||
case when order_id =2 then id else null end as id2,
|
||||
case when order_id =3 then id else null end as id3,
|
||||
case when order_id =4 then id else null end as id4,
|
||||
case when order_id =5 then id else null end as id5,
|
||||
case when order_id =6 then id else null end as id6,
|
||||
case when order_id =7 then id else null end as id7,
|
||||
case when order_id =8 then id else null end as id8,
|
||||
case when order_id =9 then id else null end as id9,
|
||||
case when order_id =10 then id else null end as id10,
|
||||
case when order_id =11 then id else null end as id11,
|
||||
case when order_id =12 then id else null end as id12,
|
||||
|
||||
case when order_id =1 then data else null end as data1,
|
||||
case when order_id =2 then data else null end as data2,
|
||||
case when order_id =3 then data else null end as data3,
|
||||
case when order_id =4 then data else null end as data4,
|
||||
case when order_id =5 then data else null end as data5,
|
||||
case when order_id =6 then data else null end as data6,
|
||||
case when order_id =7 then data else null end as data7,
|
||||
case when order_id =8 then data else null end as data8,
|
||||
case when order_id =9 then data else null end as data9,
|
||||
case when order_id =10 then data else null end as data10,
|
||||
case when order_id =11 then data else null end as data11,
|
||||
case when order_id =12 then data else null end as data12,
|
||||
|
||||
case when order_id =1 then location else null end as location1,
|
||||
case when order_id =2 then location else null end as location2,
|
||||
case when order_id =3 then location else null end as location3,
|
||||
case when order_id =4 then location else null end as location4,
|
||||
case when order_id =5 then location else null end as location5,
|
||||
case when order_id =6 then location else null end as location6,
|
||||
case when order_id =7 then location else null end as location7,
|
||||
case when order_id =8 then location else null end as location8,
|
||||
case when order_id =9 then location else null end as location9,
|
||||
case when order_id =10 then location else null end as location10,
|
||||
case when order_id =11 then location else null end as location11,
|
||||
case when order_id =12 then location else null end as location12,
|
||||
|
||||
case when order_id =1 then torta else null end as torta1,
|
||||
case when order_id =2 then torta else null end as torta2,
|
||||
case when order_id =3 then torta else null end as torta3,
|
||||
case when order_id =4 then torta else null end as torta4,
|
||||
case when order_id =5 then torta else null end as torta5,
|
||||
case when order_id =6 then torta else null end as torta6,
|
||||
case when order_id =7 then torta else null end as torta7,
|
||||
case when order_id =8 then torta else null end as torta8,
|
||||
case when order_id =9 then torta else null end as torta9,
|
||||
case when order_id =10 then torta else null end as torta10,
|
||||
case when order_id =11 then torta else null end as torta11,
|
||||
case when order_id =12 then torta else null end as torta12,
|
||||
|
||||
case when order_id =1 then confettata else null end as confettata1,
|
||||
case when order_id =2 then confettata else null end as confettata2,
|
||||
case when order_id =3 then confettata else null end as confettata3,
|
||||
case when order_id =4 then confettata else null end as confettata4,
|
||||
case when order_id =5 then confettata else null end as confettata5,
|
||||
case when order_id =6 then confettata else null end as confettata6,
|
||||
case when order_id =7 then confettata else null end as confettata7,
|
||||
case when order_id =8 then confettata else null end as confettata8,
|
||||
case when order_id =9 then confettata else null end as confettata9,
|
||||
case when order_id =10 then confettata else null end as confettata10,
|
||||
case when order_id =11 then confettata else null end as confettata11,
|
||||
case when order_id =12 then confettata else null end as confettata12,
|
||||
|
||||
case when order_id =1 then stampa_menu else null end as stampa_menu1,
|
||||
case when order_id =2 then stampa_menu else null end as stampa_menu2,
|
||||
case when order_id =3 then stampa_menu else null end as stampa_menu3,
|
||||
case when order_id =4 then stampa_menu else null end as stampa_menu4,
|
||||
case when order_id =5 then stampa_menu else null end as stampa_menu5,
|
||||
case when order_id =6 then stampa_menu else null end as stampa_menu6,
|
||||
case when order_id =7 then stampa_menu else null end as stampa_menu7,
|
||||
case when order_id =8 then stampa_menu else null end as stampa_menu8,
|
||||
case when order_id =9 then stampa_menu else null end as stampa_menu9,
|
||||
case when order_id =10 then stampa_menu else null end as stampa_menu10,
|
||||
case when order_id =11 then stampa_menu else null end as stampa_menu11,
|
||||
case when order_id =12 then stampa_menu else null end as stampa_menu12
|
||||
from q
|
||||
)
|
||||
select min(id1) as id1,
|
||||
min(id2) as id2,
|
||||
min(id3) as id3,
|
||||
min(id4) as id4,
|
||||
min(id5) as id5,
|
||||
min(id6) as id6,
|
||||
min(id7) as id7,
|
||||
min(id8) as id8,
|
||||
min(id9) as id9,
|
||||
min(id10) as id10,
|
||||
min(id11) as id11,
|
||||
min(id12) as id12,
|
||||
|
||||
min(data1) as d1,
|
||||
min(data2) as d2,
|
||||
min(data3) as d3,
|
||||
min(data4) as d4,
|
||||
min(data5) as d5,
|
||||
min(data6) as d6,
|
||||
min(data7) as d7,
|
||||
min(data8) as d8,
|
||||
min(data9) as d9,
|
||||
min(data10) as d10,
|
||||
min(data11) as d11,
|
||||
min(data12) as d12,
|
||||
|
||||
min(location1) as l1,
|
||||
min(location2) as l2,
|
||||
min(location3) as l3,
|
||||
min(location4) as l4,
|
||||
min(location5) as l5,
|
||||
min(location6) as l6,
|
||||
min(location7) as l7,
|
||||
min(location8) as l8,
|
||||
min(location9) as l9,
|
||||
min(location10) as l10,
|
||||
min(location11) as l11,
|
||||
min(location12) as l12,
|
||||
|
||||
min(torta1) as t1,
|
||||
min(torta2) as t2,
|
||||
min(torta3) as t3,
|
||||
min(torta4) as t4,
|
||||
min(torta5) as t5,
|
||||
min(torta6) as t6,
|
||||
min(torta7) as t7,
|
||||
min(torta8) as t8,
|
||||
min(torta9) as t9,
|
||||
min(torta10) as t10,
|
||||
min(torta11) as t11,
|
||||
min(torta12) as t12,
|
||||
|
||||
min(confettata1) as c1,
|
||||
min(confettata2) as c2,
|
||||
min(confettata3) as c3,
|
||||
min(confettata4) as c4,
|
||||
min(confettata5) as c5,
|
||||
min(confettata6) as c6,
|
||||
min(confettata7) as c7,
|
||||
min(confettata8) as c8,
|
||||
min(confettata9) as c9,
|
||||
min(confettata10) as c10,
|
||||
min(confettata11) as c11,
|
||||
min(confettata12) as c12,
|
||||
|
||||
min(stampa_menu1) as SM1,
|
||||
min(stampa_menu2) as SM2,
|
||||
min(stampa_menu3) as SM3,
|
||||
min(stampa_menu4) as SM4,
|
||||
min(stampa_menu5) as SM5,
|
||||
min(stampa_menu6) as SM6,
|
||||
min(stampa_menu7) as SM7,
|
||||
min(stampa_menu8) as SM8,
|
||||
min(stampa_menu9) as SM9,
|
||||
min(stampa_menu10) as SM10,
|
||||
min(stampa_menu11) as SM11,
|
||||
min(stampa_menu12) as SM12
|
||||
from r;
|
||||
|
||||
c_evt c_evento%ROWTYPE;
|
||||
|
||||
type v_TOVAGLIATO_AR IS VARRAY(12) OF VARCHAR2(4000);
|
||||
v_TOVAGLIATO v_TOVAGLIATO_AR;
|
||||
|
||||
C1 varchar2(100);
|
||||
C2 varchar2(100);
|
||||
C3 varchar2(100);
|
||||
C4 varchar2(100);
|
||||
C5 varchar2(100);
|
||||
C6 varchar2(100);
|
||||
C7 varchar2(100);
|
||||
C8 varchar2(100);
|
||||
C9 varchar2(100);
|
||||
C10 varchar2(100);
|
||||
C11 varchar2(100);
|
||||
C12 varchar2(100);
|
||||
|
||||
type v_TOVAGLIOLO_AR IS VARRAY(12) OF VARCHAR2(1000);
|
||||
v_TOVAGLIOLO v_TOVAGLIOLO_AR;
|
||||
|
||||
type v_AN_GELATO_AR IS VARRAY(12) OF VARCHAR2(1000);
|
||||
v_AN_GELATO v_AN_GELATO_AR;
|
||||
type v_AN_GELATO2_AR IS VARRAY(12) OF VARCHAR2(1000);
|
||||
v_AN_GELATO2 v_AN_GELATO2_AR;
|
||||
|
||||
type v_AN_OPENBAR_AR IS VARRAY(12) OF VARCHAR2(1000);
|
||||
v_AN_OPENBAR v_AN_OPENBAR_AR;
|
||||
type v_AN_RUM_AR IS VARRAY(12) OF VARCHAR2(1000);
|
||||
v_AN_RUM v_AN_RUM_AR;
|
||||
|
||||
T1 varchar2(100);
|
||||
T2 varchar2(100);
|
||||
T3 varchar2(100);
|
||||
T4 varchar2(100);
|
||||
T5 varchar2(100);
|
||||
T6 varchar2(100);
|
||||
T7 varchar2(100);
|
||||
T8 varchar2(100);
|
||||
T9 varchar2(100);
|
||||
T10 varchar2(100);
|
||||
T11 varchar2(100);
|
||||
T12 varchar2(100);
|
||||
|
||||
v_appo varchar2(100);
|
||||
|
||||
v_dato varchar2(100);
|
||||
v_id_str varchar2(100);
|
||||
v_id number;
|
||||
v_qry varchar2(1000);
|
||||
|
||||
type v_IDEVT_AR IS VARRAY(12) OF number;
|
||||
v_IDEVT v_IDEVT_AR;
|
||||
|
||||
BEGIN
|
||||
--default su date
|
||||
if p_data_in is null then
|
||||
v_data_in := to_char(sysdate,'YYYYMMD');
|
||||
else
|
||||
v_data_in := p_data_in;
|
||||
end if;
|
||||
if p_data_fi is null then
|
||||
v_data_fi := to_char(sysdate + 30,'YYYYMMD');
|
||||
else
|
||||
v_data_fi := p_data_fi;
|
||||
end if;
|
||||
|
||||
v_TOVAGLIATO := v_TOVAGLIATO_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_TOVAGLIOLO := v_TOVAGLIOLO_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_AN_GELATO := v_AN_GELATO_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_AN_GELATO2 := v_AN_GELATO2_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_AN_OPENBAR := v_AN_OPENBAR_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_AN_RUM := v_AN_RUM_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
v_IDEVT := v_IDEVT_AR(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
|
||||
open c_evento;
|
||||
fetch c_evento into c_evt;
|
||||
--exit when c_evento%NOTFOUND;
|
||||
|
||||
--caricare su vettore gli id:
|
||||
v_IDEVT(1) := c_evt.id1;
|
||||
v_IDEVT(2) := c_evt.id2;
|
||||
v_IDEVT(3) := c_evt.id3;
|
||||
v_IDEVT(4) := c_evt.id4;
|
||||
v_IDEVT(5) := c_evt.id5;
|
||||
v_IDEVT(6) := c_evt.id6;
|
||||
v_IDEVT(7) := c_evt.id7;
|
||||
v_IDEVT(8) := c_evt.id8;
|
||||
v_IDEVT(9) := c_evt.id9;
|
||||
v_IDEVT(10) := c_evt.id10;
|
||||
v_IDEVT(11) := c_evt.id11;
|
||||
v_IDEVT(12) := c_evt.id12;
|
||||
|
||||
FOR i in 1 .. 12 LOOP
|
||||
v_dato := '';
|
||||
|
||||
v_id := to_char(v_IDEVT(i));
|
||||
|
||||
v_TOVAGLIATO(i) := f_get_tovagliato_allestimento ('TVB', v_IDEVT(i) ) ;
|
||||
v_AN_GELATO(i) := f_get_angolo_allestimento ('AN-GELAT', v_IDEVT(i) ) ;
|
||||
v_AN_GELATO2(i) := f_get_angolo_allestimento ('AN-GEL-BOM', v_IDEVT(i) ) ;
|
||||
--v_AN_OPENBAR(i) := f_get_angolo_allestimento ('OPEN-B', v_IDEVT(i) ) ;
|
||||
v_AN_OPENBAR(i) := f_get_angolo_allestimento_OB ('%OPEN BAR%', v_IDEVT(i) ) ;
|
||||
v_AN_RUM(i) := f_get_angolo_allestimento ('AN-RUM-CI', v_IDEVT(i) ) ;
|
||||
|
||||
END LOOP;
|
||||
|
||||
PIPE ROW(t_rep_allestimenti_row(c_evt.D1 ,
|
||||
c_evt.D2 ,
|
||||
c_evt.D3 ,
|
||||
c_evt.D4 ,
|
||||
c_evt.D5 ,
|
||||
c_evt.D6 ,
|
||||
c_evt.D7 ,
|
||||
c_evt.D8 ,
|
||||
c_evt.D9 ,
|
||||
c_evt.D10 ,
|
||||
c_evt.D11 ,
|
||||
c_evt.D12 ,
|
||||
|
||||
c_evt.L1 ,
|
||||
c_evt.L2 ,
|
||||
c_evt.L3 ,
|
||||
c_evt.L4 ,
|
||||
c_evt.L5 ,
|
||||
c_evt.L6 ,
|
||||
c_evt.L7 ,
|
||||
c_evt.L8 ,
|
||||
c_evt.L9 ,
|
||||
c_evt.L10 ,
|
||||
c_evt.L11 ,
|
||||
c_evt.L12 ,
|
||||
|
||||
v_TOVAGLIATO(1),
|
||||
v_TOVAGLIATO(2),
|
||||
v_TOVAGLIATO(3),
|
||||
v_TOVAGLIATO(4),
|
||||
v_TOVAGLIATO(5),
|
||||
v_TOVAGLIATO(6),
|
||||
v_TOVAGLIATO(7),
|
||||
v_TOVAGLIATO(8),
|
||||
v_TOVAGLIATO(9),
|
||||
v_TOVAGLIATO(10),
|
||||
v_TOVAGLIATO(11),
|
||||
v_TOVAGLIATO(12),
|
||||
|
||||
c_evt.C1 ,
|
||||
c_evt.C2 ,
|
||||
c_evt.C3 ,
|
||||
c_evt.C4 ,
|
||||
c_evt.C5 ,
|
||||
c_evt.C6 ,
|
||||
c_evt.C7 ,
|
||||
c_evt.C8 ,
|
||||
c_evt.C9 ,
|
||||
c_evt.C10 ,
|
||||
c_evt.C11 ,
|
||||
c_evt.C12 ,
|
||||
|
||||
v_TOVAGLIOLO(1),
|
||||
v_TOVAGLIOLO(2),
|
||||
v_TOVAGLIOLO(3),
|
||||
v_TOVAGLIOLO(4),
|
||||
v_TOVAGLIOLO(5),
|
||||
v_TOVAGLIOLO(6),
|
||||
v_TOVAGLIOLO(7),
|
||||
v_TOVAGLIOLO(8),
|
||||
v_TOVAGLIOLO(9),
|
||||
v_TOVAGLIOLO(10),
|
||||
v_TOVAGLIOLO(11),
|
||||
v_TOVAGLIOLO(12),
|
||||
|
||||
v_AN_GELATO(1) || ', ' || v_AN_GELATO2(1),
|
||||
v_AN_GELATO(2) || ', ' || v_AN_GELATO2(2),
|
||||
v_AN_GELATO(3) || ', ' || v_AN_GELATO2(3),
|
||||
v_AN_GELATO(4) || ', ' || v_AN_GELATO2(4),
|
||||
v_AN_GELATO(5) || ', ' || v_AN_GELATO2(5),
|
||||
v_AN_GELATO(6) || ', ' || v_AN_GELATO2(6),
|
||||
v_AN_GELATO(7) || ', ' || v_AN_GELATO2(7),
|
||||
v_AN_GELATO(8) || ', ' || v_AN_GELATO2(8),
|
||||
v_AN_GELATO(9) || ', ' || v_AN_GELATO2(9),
|
||||
v_AN_GELATO(10) || ', ' || v_AN_GELATO2(10),
|
||||
v_AN_GELATO(11) || ', ' || v_AN_GELATO2(11),
|
||||
v_AN_GELATO(12) || ', ' || v_AN_GELATO2(12),
|
||||
|
||||
v_AN_OPENBAR(1),
|
||||
v_AN_OPENBAR(2),
|
||||
v_AN_OPENBAR(3),
|
||||
v_AN_OPENBAR(4),
|
||||
v_AN_OPENBAR(5),
|
||||
v_AN_OPENBAR(6),
|
||||
v_AN_OPENBAR(7),
|
||||
v_AN_OPENBAR(8),
|
||||
v_AN_OPENBAR(9),
|
||||
v_AN_OPENBAR(10),
|
||||
v_AN_OPENBAR(11),
|
||||
v_AN_OPENBAR(12),
|
||||
|
||||
v_AN_RUM(1),
|
||||
v_AN_RUM(2),
|
||||
v_AN_RUM(3),
|
||||
v_AN_RUM(4),
|
||||
v_AN_RUM(5),
|
||||
v_AN_RUM(6),
|
||||
v_AN_RUM(7),
|
||||
v_AN_RUM(8),
|
||||
v_AN_RUM(9),
|
||||
v_AN_RUM(10),
|
||||
v_AN_RUM(11),
|
||||
v_AN_RUM(12),
|
||||
|
||||
c_evt.T1 ,
|
||||
c_evt.T2 ,
|
||||
c_evt.T3 ,
|
||||
c_evt.T4 ,
|
||||
c_evt.T5 ,
|
||||
c_evt.T6 ,
|
||||
c_evt.T7 ,
|
||||
c_evt.T8 ,
|
||||
c_evt.T9 ,
|
||||
c_evt.T10 ,
|
||||
c_evt.T11 ,
|
||||
c_evt.T12 ,
|
||||
|
||||
c_evt.SM1 ,
|
||||
c_evt.SM2 ,
|
||||
c_evt.SM3 ,
|
||||
c_evt.SM4 ,
|
||||
c_evt.SM5 ,
|
||||
c_evt.SM6 ,
|
||||
c_evt.SM7 ,
|
||||
c_evt.SM8 ,
|
||||
c_evt.SM9 ,
|
||||
c_evt.SM10 ,
|
||||
c_evt.SM11 ,
|
||||
c_evt.SM12
|
||||
));
|
||||
|
||||
close c_evento;
|
||||
|
||||
RETURN;
|
||||
|
||||
END;```
|
||||
245
docs/functions/F_REP_CUCINA.md
Normal file
245
docs/functions/F_REP_CUCINA.md
Normal file
@@ -0,0 +1,245 @@
|
||||
# F_REP_CUCINA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "F_REP_CUCINA" (p_data_in IN varchar2,p_data_fi IN varchar2)
|
||||
RETURN t_rep_cucina_tab PIPELINED AS
|
||||
|
||||
|
||||
cursor c_evento is
|
||||
select e.id,
|
||||
e.data,
|
||||
l.LOCATION,
|
||||
e.cliente,
|
||||
t.DESCRIZIONE,
|
||||
e.ORA_CERIMONIA,
|
||||
e.ORA_EVENTO,
|
||||
e.ALLERGIE,
|
||||
e.torta,
|
||||
e.CONFETTATA,
|
||||
e.STAMPA_MENU,
|
||||
e.extra_info,
|
||||
e.cliente_email,
|
||||
e.cliente_tel,
|
||||
e.referente_tel,
|
||||
e.distanza_location,
|
||||
e.buffet_iniziale,
|
||||
e.buffet_finale,
|
||||
e.primi,
|
||||
e.secondi,
|
||||
e.vini,
|
||||
e.extra_costi
|
||||
from eventi e
|
||||
left join location l on e.id_location = l.id
|
||||
join tb_tipi_evento t on e.cod_tipo = t.cod_tipo
|
||||
where e.data between to_date(p_data_in,'YYYYMMDD') and to_date(p_data_fi,'YYYYMMDD')
|
||||
and e.stato = 300 -- Considero soltanto le schede confermate
|
||||
and e.disabled = 0
|
||||
and e.deleted = 0;
|
||||
|
||||
|
||||
v_data date;
|
||||
v_LOCATION varchar2(4000);
|
||||
v_cliente varchar2(4000);
|
||||
v_DESCRIZIONE varchar2(4000);
|
||||
v_ORA_CERIMONIA varchar2(4000);
|
||||
v_ORA_EVENTO varchar2(4000);
|
||||
v_TOT_ADULTI number;
|
||||
v_TOT_KINDER number;
|
||||
v_TOT_BABY number;
|
||||
v_TOT_STAFF number;
|
||||
v_TOT_INVITATI number;
|
||||
v_ALLERGIE varchar2(4000);
|
||||
v_TORTA varchar2(4000);
|
||||
v_CONFETTATA varchar2(4000);
|
||||
v_STAMPA_MENU varchar2(4000);
|
||||
v_angoli varchar2(4000);
|
||||
v_EXTRA_INFO varchar2(4000);
|
||||
v_NOTE_ADULTI varchar2(4000);
|
||||
v_NOTE_KINDER varchar2(4000);
|
||||
v_NOTE_BABY varchar2(4000);
|
||||
v_NOTE_STAFF varchar2(4000);
|
||||
v_cliente_email varchar2(4000) := '';
|
||||
v_cliente_tel varchar2(4000) := '';
|
||||
v_referente_tel varchar2(4000) := '';
|
||||
v_distanza_location varchar2(4000) := '';
|
||||
v_buffet_iniziale varchar2(4000) := '';
|
||||
v_buffet_finale varchar2(4000) := '';
|
||||
v_primi varchar2(4000) := '';
|
||||
v_secondi varchar2(4000) := '';
|
||||
v_vini varchar2(4000) := '';
|
||||
v_extra_costi varchar2(4000) := '';
|
||||
v_event_id number;
|
||||
|
||||
BEGIN
|
||||
|
||||
for c in c_evento
|
||||
loop
|
||||
|
||||
begin
|
||||
|
||||
v_TOT_ADULTI := 0;
|
||||
v_TOT_KINDER := 0;
|
||||
v_TOT_BABY := 0;
|
||||
v_TOT_STAFF := 0;
|
||||
v_TOT_INVITATI := 0;
|
||||
v_angoli := 0;
|
||||
v_NOTE_ADULTI := '';
|
||||
v_NOTE_KINDER := '';
|
||||
v_NOTE_BABY := '';
|
||||
v_NOTE_STAFF := '';
|
||||
|
||||
v_cliente_email := c.cliente_email;
|
||||
v_cliente_tel := c.cliente_tel;
|
||||
v_referente_tel := c.referente_tel;
|
||||
v_distanza_location := c.distanza_location;
|
||||
v_buffet_iniziale := c.buffet_iniziale;
|
||||
v_buffet_finale := c.buffet_finale;
|
||||
v_primi := c.primi;
|
||||
v_secondi := c.secondi;
|
||||
v_vini := c.vini;
|
||||
v_extra_costi := c.extra_costi;
|
||||
v_event_id := c.id;
|
||||
|
||||
--ospiti
|
||||
select nvl(sum(o.NUMERO),0)
|
||||
into v_TOT_ADULTI
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
--join tb_tipi_ospiti tos on o.cod_tipo_ospite = tos.COD_TIPO
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 8; -- adulti
|
||||
|
||||
begin
|
||||
select o.NOTE
|
||||
into v_NOTE_ADULTI
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 8; -- adulti
|
||||
|
||||
exception when no_data_found then null;
|
||||
end;
|
||||
|
||||
select nvl(sum(o.NUMERO),0)
|
||||
into v_TOT_KINDER
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
--join tb_tipi_ospiti tos on o.cod_tipo_ospite = tos.COD_TIPO
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 5; --Kinder
|
||||
|
||||
begin
|
||||
select o.NOTE
|
||||
into v_NOTE_KINDER
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 5; --Kinder
|
||||
|
||||
exception when no_data_found then null;
|
||||
end;
|
||||
|
||||
select nvl(sum(o.NUMERO),0)
|
||||
into v_TOT_BABY
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
--join tb_tipi_ospiti tos on o.cod_tipo_ospite = tos.COD_TIPO
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 6; -- Baby
|
||||
|
||||
begin
|
||||
select o.NOTE
|
||||
into v_NOTE_BABY
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 6; -- Baby
|
||||
|
||||
exception when no_data_found then null;
|
||||
end;
|
||||
|
||||
select nvl(sum(o.NUMERO),0)
|
||||
into v_TOT_STAFF
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
--join tb_tipi_ospiti tos on o.cod_tipo_ospite = tos.COD_TIPO
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 7; -- Staff
|
||||
|
||||
begin
|
||||
select o.NOTE
|
||||
into v_NOTE_STAFF
|
||||
from eventi e
|
||||
join eventi_det_ospiti o on e.id = o.id_evento
|
||||
where e.id = c.id
|
||||
and o.cod_tipo_ospite = 7; -- Staff
|
||||
|
||||
exception when no_data_found then null;
|
||||
end;
|
||||
|
||||
select nvl(e.tot_ospiti,0)
|
||||
into v_TOT_INVITATI
|
||||
from eventi e
|
||||
where e.id = c.id;
|
||||
|
||||
--angoli "speciali"
|
||||
v_angoli := '';
|
||||
for a in ( select trim(substr(a.descrizione || ' - ' || p.note,1,1000)) descrizione from eventi e
|
||||
join eventi_det_prel p on e.id=p.id_evento
|
||||
join articoli a on p.cod_articolo=a.cod_articolo
|
||||
where a.flg_cucina = 1
|
||||
and e.id = c.id
|
||||
)
|
||||
loop
|
||||
v_angoli := a.descrizione || ', ' || v_angoli ;
|
||||
end loop;
|
||||
|
||||
PIPE ROW(t_rep_cucina_row( c.data,c.location,c.cliente,
|
||||
c.DESCRIZIONE,
|
||||
to_char(c.ORA_CERIMONIA,'HH24:MI'),
|
||||
to_char(c.ORA_EVENTO,'HH24:MI'),
|
||||
v_TOT_ADULTI ,
|
||||
v_TOT_KINDER ,
|
||||
v_TOT_BABY ,
|
||||
v_TOT_STAFF ,
|
||||
v_TOT_INVITATI ,
|
||||
c.ALLERGIE ,
|
||||
c.TORTA ,
|
||||
c.CONFETTATA ,
|
||||
c.STAMPA_MENU ,
|
||||
v_angoli,
|
||||
c.extra_info ,
|
||||
|
||||
v_NOTE_ADULTI ,
|
||||
v_NOTE_KINDER ,
|
||||
v_NOTE_BABY ,
|
||||
v_NOTE_STAFF ,
|
||||
v_cliente_email ,
|
||||
v_cliente_tel ,
|
||||
v_referente_tel ,
|
||||
v_distanza_location ,
|
||||
v_buffet_iniziale ,
|
||||
v_buffet_finale ,
|
||||
v_primi ,
|
||||
v_secondi ,
|
||||
v_vini ,
|
||||
v_extra_costi ,
|
||||
v_event_id
|
||||
));
|
||||
|
||||
--exception when others
|
||||
-- then null;
|
||||
|
||||
exception when others
|
||||
then
|
||||
RAISE_APPLICATION_ERROR(-20000, 'Errore: ' || SQLCODE || ' - ' || SUBSTR(SQLERRM, 1 , 64));
|
||||
|
||||
end;
|
||||
|
||||
end loop;
|
||||
|
||||
RETURN;
|
||||
|
||||
END;```
|
||||
20
docs/functions/F_USER_IN_ROLE.md
Normal file
20
docs/functions/F_USER_IN_ROLE.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# F_USER_IN_ROLE
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_USER_IN_ROLE
|
||||
(
|
||||
P_USER IN VARCHAR2
|
||||
, P_ROLE IN VARCHAR2
|
||||
) RETURN NUMBER AS
|
||||
v_has_role number := 0;
|
||||
BEGIN
|
||||
select count(column_value)
|
||||
into v_has_role
|
||||
from tb_config, table(split(strvalue, ':'))
|
||||
where upper(name) = upper(P_ROLE)
|
||||
and upper(column_value) = upper(P_USER);
|
||||
|
||||
return case when v_has_role > 0 then 1 else 0 end;
|
||||
END F_USER_IN_ROLE;```
|
||||
15
docs/functions/F_USER_IN_ROLE_STR.md
Normal file
15
docs/functions/F_USER_IN_ROLE_STR.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# F_USER_IN_ROLE_STR
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION F_USER_IN_ROLE_STR
|
||||
(
|
||||
P_USER IN VARCHAR2
|
||||
, P_ROLE IN VARCHAR2
|
||||
) RETURN VARCHAR2 AS
|
||||
v_has_role number := 0;
|
||||
BEGIN
|
||||
return case when F_USER_IN_ROLE(P_USER, P_ROLE) > 0 then 'true' else 'false' end;
|
||||
END F_USER_IN_ROLE_STR;
|
||||
```
|
||||
19
docs/functions/GET_PARAM_VALUE.md
Normal file
19
docs/functions/GET_PARAM_VALUE.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# GET_PARAM_VALUE
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
function get_param_value(p_name varchar2)
|
||||
return varchar2 as
|
||||
v_result varchar2(255);
|
||||
begin
|
||||
select strvalue
|
||||
into v_result
|
||||
from tb_config
|
||||
where upper(name) = upper(p_name);
|
||||
|
||||
return v_result;
|
||||
exception when others then
|
||||
return null;
|
||||
end;
|
||||
```
|
||||
36
docs/functions/MY_INSTR.md
Normal file
36
docs/functions/MY_INSTR.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# MY_INSTR
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
function my_instr( p_value varchar2,
|
||||
p_delim varchar2 )
|
||||
return number
|
||||
as
|
||||
|
||||
i number;
|
||||
|
||||
l_length number;
|
||||
|
||||
begin
|
||||
|
||||
if p_value is null then
|
||||
return null;
|
||||
end if;
|
||||
|
||||
i := 1;
|
||||
|
||||
l_length := length(p_value);
|
||||
|
||||
for i in 1..l_length
|
||||
loop
|
||||
if substr(p_value, i, length(p_delim)) = p_delim then
|
||||
return i;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
end;
|
||||
```
|
||||
127
docs/functions/README.md
Normal file
127
docs/functions/README.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# Funzioni Database
|
||||
|
||||
Questa cartella contiene la documentazione di tutte le 23 funzioni del database.
|
||||
|
||||
## Funzioni Calcolo Quantità e Disponibilità
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_GET_QTA_IMPEGNATA](F_GET_QTA_IMPEGNATA.md) | NUMBER | Quantità impegnata di un articolo in un range di date |
|
||||
| [F_GET_TOT_OSPITI](F_GET_TOT_OSPITI.md) | NUMBER | Totale ospiti per evento (opzionale per tipo) |
|
||||
| [F_GET_OSPITI](F_GET_OSPITI.md) | TABLE | Dettaglio ospiti per evento (funzione pipelined) |
|
||||
| [F_LIST_PRELIEVO_ADD_ARTICOLO](F_LIST_PRELIEVO_ADD_ARTICOLO.md) | VARCHAR2 (JSON) | Aggiunge articolo alla lista prelievo con validazioni |
|
||||
|
||||
## Funzioni Calcolo Costi
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_GET_COSTO_ARTICOLO](F_GET_COSTO_ARTICOLO.md) | NUMBER | Costo unitario articolo a una data specifica |
|
||||
|
||||
## Funzioni Validazione
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_EVENTO_SCADUTO](F_EVENTO_SCADUTO.md) | NUMBER (0/1) | Verifica se preventivo è scaduto |
|
||||
| [F_MAX_NUMERO_EVENTI_RAGGIUNTO](F_MAX_NUMERO_EVENTI_RAGGIUNTO.md) | NUMBER (-1/0/1) | Verifica limite eventi giornaliero |
|
||||
| [F_MAX_NUM_EVENTI_CONFERMATI](F_MAX_NUM_EVENTI_CONFERMATI.md) | NUMBER (0/1) | Verifica limite eventi confermati |
|
||||
| [F_CI_SONO_EVENTI_CONFERMATI](F_CI_SONO_EVENTI_CONFERMATI.md) | NUMBER (0/1) | Check esistenza eventi confermati in data/location |
|
||||
|
||||
## Funzioni Report
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_REP_ALLESTIMENTI](F_REP_ALLESTIMENTI.md) | TABLE | Dati per report allestimenti (pipelined) |
|
||||
| [F_REP_CUCINA](F_REP_CUCINA.md) | TABLE | Dati per report cucina (pipelined) |
|
||||
| [F_GET_ANGOLO_ALLESTIMENTO](F_GET_ANGOLO_ALLESTIMENTO.md) | VARCHAR2 | Descrizione angolo allestimento |
|
||||
| [F_GET_ANGOLO_ALLESTIMENTO_OB](F_GET_ANGOLO_ALLESTIMENTO_OB.md) | VARCHAR2 | Descrizione angolo open bar |
|
||||
| [F_GET_TOVAGLIATO_ALLESTIMENTO](F_GET_TOVAGLIATO_ALLESTIMENTO.md) | VARCHAR2 | Descrizione tovagliato |
|
||||
|
||||
## Funzioni Autorizzazione
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_USER_IN_ROLE](F_USER_IN_ROLE.md) | NUMBER (0/1) | Verifica appartenenza utente a ruolo |
|
||||
| [F_USER_IN_ROLE_STR](F_USER_IN_ROLE_STR.md) | VARCHAR2 | Verifica ruolo (ritorna stringa) |
|
||||
|
||||
## Funzioni Utility
|
||||
|
||||
| Funzione | Ritorno | Descrizione |
|
||||
|----------|---------|-------------|
|
||||
| [F_DAY_TO_NAME](F_DAY_TO_NAME.md) | VARCHAR2 | Converte numero giorno in nome italiano |
|
||||
| [STRING_TO_TABLE_ENUM](STRING_TO_TABLE_ENUM.md) | TABLE | Converte stringa delimitata in tabella |
|
||||
| [GET_PARAM_VALUE](GET_PARAM_VALUE.md) | VARCHAR2 | Recupera valore parametro da TB_CONFIG |
|
||||
| [SPLIT](SPLIT.md) | TABLE | Split stringa in elementi |
|
||||
| [MY_INSTR](MY_INSTR.md) | NUMBER | Funzione INSTR personalizzata |
|
||||
| [CLOB2BLOB](CLOB2BLOB.md) | BLOB | Conversione CLOB → BLOB |
|
||||
| [EXTDATE_GET_ITA](EXTDATE_GET_ITA.md) | VARCHAR2 | Formatta data in italiano esteso |
|
||||
|
||||
## Dettaglio Funzioni Critiche
|
||||
|
||||
### F_GET_QTA_IMPEGNATA
|
||||
|
||||
```sql
|
||||
FUNCTION F_GET_QTA_IMPEGNATA(
|
||||
p_codart VARCHAR2,
|
||||
p_data_from DATE,
|
||||
p_data_to DATE DEFAULT NULL
|
||||
) RETURN NUMBER
|
||||
```
|
||||
|
||||
**Logica:**
|
||||
- Interroga `V_IMPEGNI_ARTICOLI`
|
||||
- Somma quantità impegnate nel range di date
|
||||
- Se `p_data_to` è NULL, usa `p_data_from`
|
||||
|
||||
### F_EVENT0_SCADUTO
|
||||
|
||||
```sql
|
||||
FUNCTION F_EVENTO_SCADUTO(
|
||||
DATA_SCADENZA IN DATE,
|
||||
STATO_EVENTO IN NUMBER,
|
||||
STATO_FROM IN NUMBER,
|
||||
STATO_TO IN NUMBER
|
||||
) RETURN NUMBER
|
||||
```
|
||||
|
||||
**Logica:**
|
||||
- Ritorna 1 se `TRUNC(DATA_SCADENZA) <= TRUNC(SYSDATE)`
|
||||
AND `STATO_EVENTO BETWEEN STATO_FROM AND STATO_TO`
|
||||
- Altrimenti ritorna 0
|
||||
|
||||
### F_LIST_PRELIEVO_ADD_ARTICOLO
|
||||
|
||||
```sql
|
||||
FUNCTION F_LIST_PRELIEVO_ADD_ARTICOLO(
|
||||
p_event_id NUMBER,
|
||||
p_articolo_add VARCHAR2,
|
||||
p_qta_aperitivo NUMBER := 0,
|
||||
p_qta_seduto NUMBER := 0,
|
||||
p_qta_dolci NUMBER := 0
|
||||
) RETURN VARCHAR2
|
||||
```
|
||||
|
||||
**Logica:**
|
||||
1. Verifica esistenza evento
|
||||
2. Verifica esistenza articolo
|
||||
3. Recupera giacenza articolo
|
||||
4. Controlla impegni in date vicine (±2 giorni)
|
||||
5. Inserisce record in `EVENTI_DET_PREL`
|
||||
6. Chiama `EVENTI_AGGIORNA_QTA_LISTA`
|
||||
7. Ritorna JSON con esito:
|
||||
- `{"type":"success","message":"..."}`
|
||||
- `{"type":"warning","message":"..."}`
|
||||
- `{"type":"error","code":"...","stack":"...","message":"..."}`
|
||||
|
||||
### F_GET_COSTO_ARTICOLO
|
||||
|
||||
```sql
|
||||
FUNCTION F_GET_COSTO_ARTICOLO(
|
||||
p_cod_articolo VARCHAR2,
|
||||
p_date DATE
|
||||
) RETURN NUMBER
|
||||
```
|
||||
|
||||
**Logica:**
|
||||
1. Cerca costo in `COSTI_ARTICOLI` alla data esatta
|
||||
2. Se non trovato, prende ultimo costo disponibile
|
||||
3. Se non trovato nulla, ritorna 0
|
||||
46
docs/functions/SPLIT.md
Normal file
46
docs/functions/SPLIT.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# SPLIT
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "SPLIT"
|
||||
(
|
||||
p_list varchar2,
|
||||
p_del varchar2 := ','
|
||||
) return string_list
|
||||
is
|
||||
l_idx integer;
|
||||
l_list varchar2(32767) := p_list;
|
||||
|
||||
l_value varchar2(32767);
|
||||
|
||||
l_retval string_list;
|
||||
begin
|
||||
|
||||
l_retval := string_list();
|
||||
|
||||
loop
|
||||
|
||||
--l_idx := instr(l_list,p_del);
|
||||
l_idx := my_instr(l_list,p_del);
|
||||
|
||||
l_retval.extend;
|
||||
|
||||
if l_idx > 0 then
|
||||
--pipe row(substr(l_list,1,l_idx-1));
|
||||
--l_list := substr(l_list,l_idx+length(p_del));
|
||||
l_retval(l_retval.count) := substr(l_list, 1, l_idx - 1);
|
||||
l_list := substr(l_list,l_idx+length(p_del));
|
||||
else
|
||||
--pipe row(l_list);
|
||||
--exit;
|
||||
l_retval(l_retval.count) := l_list;
|
||||
exit;
|
||||
end if;
|
||||
|
||||
end loop;
|
||||
|
||||
return l_retval;
|
||||
|
||||
end split;
|
||||
```
|
||||
26
docs/functions/STRING_TO_TABLE_ENUM.md
Normal file
26
docs/functions/STRING_TO_TABLE_ENUM.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# STRING_TO_TABLE_ENUM
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
FUNCTION "STRING_TO_TABLE_ENUM" (p_string VARCHAR2, v_level in number default 0, p_separator varchar2 default ':') RETURN ENUM_TABLE_TYPE pipelined IS
|
||||
conta number := 0;
|
||||
BEGIN
|
||||
FOR c IN ( select ROW_NUMBER() OVER (ORDER BY ROWNUM) id, result
|
||||
from (
|
||||
with test as (
|
||||
select p_string col
|
||||
from dual
|
||||
)
|
||||
select nvl(regexp_substr(col, '[^' || p_separator || ']+', 1, level), '') result
|
||||
from test
|
||||
connect by level <= length(regexp_replace(col, '[^' || p_separator || ']+')) + 1)
|
||||
)
|
||||
LOOP
|
||||
conta := conta + 1;
|
||||
if v_level = 0 or ( v_level = conta ) then
|
||||
pipe row(enum_table_object(c.id,c.result));
|
||||
end if;
|
||||
END LOOP;
|
||||
RETURN;
|
||||
END STRING_TO_TABLE_ENUM;```
|
||||
422
docs/index.md
Normal file
422
docs/index.md
Normal file
@@ -0,0 +1,422 @@
|
||||
# Apollinare Catering - Documentazione Completa
|
||||
|
||||
Questa documentazione contiene l'estrazione completa di tutti gli oggetti del database Oracle e dell'applicazione APEX di Apollinare Catering & Banqueting.
|
||||
|
||||
## [Application Overview](APPLICATION_OVERVIEW.md)
|
||||
|
||||
**Apollinare Catering & Banqueting Management Software** è un gestionale completo per aziende di catering che gestisce l'intero ciclo di vita di un evento: dalla richiesta del cliente, al preventivo, alla conferma, fino all'esecuzione.
|
||||
|
||||
### Funzionalità Principali
|
||||
|
||||
| Area | Descrizione |
|
||||
| --------------------- | ------------------------------------------- |
|
||||
| **Gestione Eventi** | Creazione, workflow stati, versioning |
|
||||
| **Gestione Ospiti** | Tipologie ospiti, conteggi, coefficienti |
|
||||
| **Lista Prelievo** | Calcolo automatico quantità materiale |
|
||||
| **Risorse/Staff** | Pianificazione personale per evento |
|
||||
| **Acconti/Pagamenti** | Sistema caparre 30%-50%-20%, solleciti |
|
||||
| **Calendario** | Vista eventi, limiti giornalieri, conflitti |
|
||||
| **Reporting** | Schede evento, preventivi, report cucina |
|
||||
|
||||
### Proposta SaaS: CaterPro
|
||||
|
||||
La documentazione include una proposta per trasformare Apollinare in **CaterPro**, una piattaforma SaaS multi-tenant:
|
||||
|
||||
- **Target**: Piccole, medie e grandi aziende di catering
|
||||
- **Stack**: .NET 8 + React TypeScript + PostgreSQL/Oracle
|
||||
- **Pricing**: Da €49/mese (Basic) a €399/mese (Enterprise)
|
||||
- **Roadmap**: 10-14 mesi per feature parity + SaaS
|
||||
|
||||
Leggi la [documentazione completa](APPLICATION_OVERVIEW.md) per dettagli su architettura, funzionalità e roadmap.
|
||||
|
||||
---
|
||||
|
||||
## Struttura della Documentazione
|
||||
|
||||
```
|
||||
docs/
|
||||
├── apex/ # Applicazione APEX
|
||||
│ ├── README.md # Overview applicazione
|
||||
│ ├── pages/ # 56 pagine
|
||||
│ ├── processes/ # 98 processi
|
||||
│ ├── lovs/ # 12 List of Values
|
||||
│ ├── javascript/ # Librerie JavaScript
|
||||
│ ├── authorization/ # 5 schemi autorizzazione
|
||||
│ ├── dynamic-actions/ # Azioni dinamiche
|
||||
│ ├── items/ # Items condivisi
|
||||
│ ├── regions/ # Regioni condivise
|
||||
│ └── navigation/ # Navigazione
|
||||
├── tables/ # 32 tabelle
|
||||
├── views/ # 26 viste
|
||||
├── procedures/ # 11 stored procedures
|
||||
├── functions/ # 23 funzioni
|
||||
├── packages/ # 17 packages
|
||||
├── triggers/ # 19 triggers
|
||||
├── sequences/ # 22 sequences
|
||||
└── types/ # 10 tipi custom
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## APEX Application Documentation
|
||||
|
||||
### [APEX Application Overview](apex/README.md)
|
||||
|
||||
**Application:** APCB Project (ID: 112)
|
||||
**APEX Version:** 21.1.0
|
||||
**Schema:** APOLLINARECATERINGPROD
|
||||
|
||||
| Component | Count |
|
||||
| --------------- | ----- |
|
||||
| Pages | 56 |
|
||||
| Items | 302 |
|
||||
| Processes | 98 |
|
||||
| Regions | 151 |
|
||||
| Buttons | 119 |
|
||||
| Dynamic Actions | 62 |
|
||||
| LOVs | 12 |
|
||||
|
||||
### Key APEX Documentation
|
||||
|
||||
- [APEX README](apex/README.md) - Application overview and navigation
|
||||
- [Processes Documentation](apex/processes/README.md) - All 98 processes with PL/SQL code
|
||||
- [LOVs Documentation](apex/lovs/README.md) - 12 List of Values definitions
|
||||
- [JavaScript Libraries](apex/javascript/README.md) - Custom ajaxUtils.js and iframeObj.js
|
||||
- [Authorization Schemes](apex/authorization/README.md) - 5 security schemes
|
||||
|
||||
### Critical APEX Pages
|
||||
|
||||
| Page | Name | Description |
|
||||
| ------ | ---------------- | ------------------------------------------------- |
|
||||
| 1 | Home | Dashboard principale |
|
||||
| **22** | **Nuovo Evento** | **Pagina più complessa (108 items, 32 processi)** |
|
||||
| 9 | Liste | Lista eventi |
|
||||
| 12 | Calendario | Calendario eventi |
|
||||
| 35 | Schede | Schede evento |
|
||||
|
||||
---
|
||||
|
||||
## Indice per Categoria
|
||||
|
||||
### [Tabelle](tables/README.md) (32)
|
||||
|
||||
Tabelle principali del dominio business:
|
||||
|
||||
- [EVENTI](tables/EVENTI.md) - Tabella principale eventi
|
||||
- [EVENTI_DET_PREL](tables/EVENTI_DET_PREL.md) - Liste prelievo
|
||||
- [EVENTI_DET_OSPITI](tables/EVENTI_DET_OSPITI.md) - Dettaglio ospiti
|
||||
- [EVENTI_DET_RIS](tables/EVENTI_DET_RIS.md) - Risorse assegnate
|
||||
- [EVENTI_DET_DEGUST](tables/EVENTI_DET_DEGUST.md) - Degustazioni
|
||||
- [EVENTI_ACCONTI](tables/EVENTI_ACCONTI.md) - Gestione acconti/pagamenti
|
||||
- [EVENTI_ALTRICOSTI](tables/EVENTI_ALTRICOSTI.md) - Altri costi
|
||||
- [EVENTI_ALLEG](tables/EVENTI_ALLEG.md) - Allegati
|
||||
- [ARTICOLI](tables/ARTICOLI.md) - Catalogo articoli
|
||||
- [COSTI_ARTICOLI](tables/COSTI_ARTICOLI.md) - Storico costi
|
||||
- [CLIENTI](tables/CLIENTI.md) - Anagrafica clienti
|
||||
- [LOCATION](tables/LOCATION.md) - Location eventi
|
||||
- [RISORSE](tables/RISORSE.md) - Personale
|
||||
|
||||
Tabelle di lookup:
|
||||
|
||||
- [TB_TIPI_MAT](tables/TB_TIPI_MAT.md) - Tipi materiale
|
||||
- [TB_CODICI_CATEG](tables/TB_CODICI_CATEG.md) - Categorie
|
||||
- [TB_TIPI_EVENTO](tables/TB_TIPI_EVENTO.md) - Tipi evento
|
||||
- [TB_TIPI_OSPITI](tables/TB_TIPI_OSPITI.md) - Tipi ospiti
|
||||
- [TB_TIPI_RISORSA](tables/TB_TIPI_RISORSA.md) - Tipi risorsa
|
||||
- [TB_TIPI_PASTO](tables/TB_TIPI_PASTO.md) - Tipi pasto
|
||||
- [TB_CALENDAR_LOCKS](tables/TB_CALENDAR_LOCKS.md) - Limiti calendario
|
||||
- [TB_CONFIG](tables/TB_CONFIG.md) - Configurazioni
|
||||
|
||||
Tabelle di sistema:
|
||||
|
||||
- [USERS_READONLY](tables/USERS_READONLY.md) - Permessi utenti
|
||||
- [XLIB_LOGS](tables/XLIB_LOGS.md) - Log applicazione
|
||||
- [XLIB_COMPONENTS](tables/XLIB_COMPONENTS.md) - Componenti
|
||||
- [XLIB_JASPERREPORTS_CONF](tables/XLIB_JASPERREPORTS_CONF.md) - Config report
|
||||
- [XLIB_JASPERREPORTS_DEMOS](tables/XLIB_JASPERREPORTS_DEMOS.md) - Demo report
|
||||
|
||||
### [Viste](views/README.md) (26)
|
||||
|
||||
Viste per calcolo costi:
|
||||
|
||||
- [GET_COSTO_ART_BY_EVT](views/GET_COSTO_ART_BY_EVT.md) - Costo articoli per evento
|
||||
- [GET_COSTO_ART_EVT](views/GET_COSTO_ART_EVT.md) - Costo articoli aggregato
|
||||
- [GET_COSTO_CATEG_EVT](views/GET_COSTO_CATEG_EVT.md) - Costo per categoria
|
||||
- [GET_COSTO_DEGUS_EVT](views/GET_COSTO_DEGUS_EVT.md) - Costo degustazioni
|
||||
- [GET_COSTO_OSPITI_EVT](views/GET_COSTO_OSPITI_EVT.md) - Costo ospiti
|
||||
- [GET_COSTO_RIS_EVT](views/GET_COSTO_RIS_EVT.md) - Costo risorse
|
||||
- [GET_COSTO_TIPI_EVT](views/GET_COSTO_TIPI_EVT.md) - Costo per tipo
|
||||
- [GET_ULTIMI_COSTI](views/GET_ULTIMI_COSTI.md) - Ultimi costi articoli
|
||||
|
||||
Viste per eventi:
|
||||
|
||||
- [GET_EVT_DATA](views/GET_EVT_DATA.md) - Dati evento completi
|
||||
- [GET_EVT_DATA_PRINT](views/GET_EVT_DATA_PRINT.md) - Dati per stampa
|
||||
- [GET_PREL_ART_TOT](views/GET_PREL_ART_TOT.md) - Totali prelievo
|
||||
- [GET_PREL_BY_EVT](views/GET_PREL_BY_EVT.md) - Prelievi per evento
|
||||
|
||||
Viste per calendario e stato:
|
||||
|
||||
- [VW_CALENDARIO_EVENTI](views/VW_CALENDARIO_EVENTI.md) - Vista calendario
|
||||
- [VW_EVENT_COLOR](views/VW_EVENT_COLOR.md) - Colori stati
|
||||
- [VW_EVENTI_STATUSES](views/VW_EVENTI_STATUSES.md) - Stati eventi
|
||||
|
||||
Viste per giacenze:
|
||||
|
||||
- [V_IMPEGNI_ARTICOLI](views/V_IMPEGNI_ARTICOLI.md) - Impegni articoli
|
||||
- [V_IMPEGNI_ARTICOLI_LOC](views/V_IMPEGNI_ARTICOLI_LOC.md) - Impegni per location
|
||||
|
||||
Viste per report:
|
||||
|
||||
- [V_REP_ALLESTIMENTI](views/V_REP_ALLESTIMENTI.md) - Report allestimenti
|
||||
- [VW_REP_DEGUSTAZIONI](views/VW_REP_DEGUSTAZIONI.md) - Report degustazioni
|
||||
- [V_GRIGLIA](views/V_GRIGLIA.md) - Vista griglia
|
||||
- [GET_REPORT_CONSUNTIVO_PER_DATA](views/GET_REPORT_CONSUNTIVO_PER_DATA.md) - Consuntivo
|
||||
|
||||
Viste per utenti/permessi:
|
||||
|
||||
- [GET_CONSUNTIVI_USERS](views/GET_CONSUNTIVI_USERS.md) - Utenti consuntivi
|
||||
- [GET_GESTORI_USERS](views/GET_GESTORI_USERS.md) - Utenti gestori
|
||||
- [GET_USERS_LIST](views/GET_USERS_LIST.md) - Lista utenti
|
||||
|
||||
Viste per pagamenti:
|
||||
|
||||
- [GET_EVENTI_DA_PAGARE_ENTRO_65GG](views/GET_EVENTI_DA_PAGARE_ENTRO_65GG.md) - Eventi da sollecitare
|
||||
|
||||
### [Stored Procedures](procedures/README.md) (11)
|
||||
|
||||
Business logic principale:
|
||||
|
||||
- [EVENTI_AGGIORNA_QTA_LISTA](procedures/EVENTI_AGGIORNA_QTA_LISTA.md) - Ricalcolo quantità lista prelievo
|
||||
- [EVENTI_AGGIORNA_TOT_OSPITI](procedures/EVENTI_AGGIORNA_TOT_OSPITI.md) - Aggiorna totale ospiti
|
||||
- [EVENTI_COPIA](procedures/EVENTI_COPIA.md) - Duplicazione evento
|
||||
- [EVENTI_RICALCOLA_ACCONTI](procedures/EVENTI_RICALCOLA_ACCONTI.md) - Ricalcolo acconti
|
||||
- [EVENTO_ELIMINA_PRELIEVI](procedures/EVENTO_ELIMINA_PRELIEVI.md) - Elimina prelievi
|
||||
- [LISTE_COPIA](procedures/LISTE_COPIA.md) - Copia liste tra eventi
|
||||
- [P_CANCEL_SAME_LOCATION_EVENTS](procedures/P_CANCEL_SAME_LOCATION_EVENTS.md) - Annulla eventi stessa location
|
||||
|
||||
Utility:
|
||||
|
||||
- [ROWSORT_TIPI](procedures/ROWSORT_TIPI.md) - Ordinamento tipi
|
||||
- [HTPPRN](procedures/HTPPRN.md) - Stampa HTTP
|
||||
- [SEND_DATA_TO_DROPBOX](procedures/SEND_DATA_TO_DROPBOX.md) - Export Dropbox
|
||||
- [XLOG](procedures/XLOG.md) - Logging
|
||||
|
||||
### [Funzioni](functions/README.md) (23)
|
||||
|
||||
Calcolo quantità e disponibilità:
|
||||
|
||||
- [F_GET_QTA_IMPEGNATA](functions/F_GET_QTA_IMPEGNATA.md) - Quantità impegnata
|
||||
- [F_GET_TOT_OSPITI](functions/F_GET_TOT_OSPITI.md) - Totale ospiti
|
||||
- [F_GET_OSPITI](functions/F_GET_OSPITI.md) - Dettaglio ospiti (pipelined)
|
||||
- [F_LIST_PRELIEVO_ADD_ARTICOLO](functions/F_LIST_PRELIEVO_ADD_ARTICOLO.md) - Aggiunta articolo
|
||||
|
||||
Calcolo costi:
|
||||
|
||||
- [F_GET_COSTO_ARTICOLO](functions/F_GET_COSTO_ARTICOLO.md) - Costo articolo a data
|
||||
|
||||
Validazioni:
|
||||
|
||||
- [F_EVENTO_SCADUTO](functions/F_EVENTO_SCADUTO.md) - Verifica scadenza
|
||||
- [F_MAX_NUMERO_EVENTI_RAGGIUNTO](functions/F_MAX_NUMERO_EVENTI_RAGGIUNTO.md) - Limite eventi
|
||||
- [F_MAX_NUM_EVENTI_CONFERMATI](functions/F_MAX_NUM_EVENTI_CONFERMATI.md) - Limite confermati
|
||||
- [F_CI_SONO_EVENTI_CONFERMATI](functions/F_CI_SONO_EVENTI_CONFERMATI.md) - Check confermati
|
||||
|
||||
Report:
|
||||
|
||||
- [F_REP_ALLESTIMENTI](functions/F_REP_ALLESTIMENTI.md) - Report allestimenti
|
||||
- [F_REP_CUCINA](functions/F_REP_CUCINA.md) - Report cucina
|
||||
- [F_GET_ANGOLO_ALLESTIMENTO](functions/F_GET_ANGOLO_ALLESTIMENTO.md) - Angolo allestimento
|
||||
- [F_GET_ANGOLO_ALLESTIMENTO_OB](functions/F_GET_ANGOLO_ALLESTIMENTO_OB.md) - Angolo open bar
|
||||
- [F_GET_TOVAGLIATO_ALLESTIMENTO](functions/F_GET_TOVAGLIATO_ALLESTIMENTO.md) - Tovagliato
|
||||
|
||||
Autorizzazioni:
|
||||
|
||||
- [F_USER_IN_ROLE](functions/F_USER_IN_ROLE.md) - Verifica ruolo utente
|
||||
- [F_USER_IN_ROLE_STR](functions/F_USER_IN_ROLE_STR.md) - Ruolo utente (stringa)
|
||||
|
||||
Utility:
|
||||
|
||||
- [F_DAY_TO_NAME](functions/F_DAY_TO_NAME.md) - Giorno in italiano
|
||||
- [STRING_TO_TABLE_ENUM](functions/STRING_TO_TABLE_ENUM.md) - Stringa a tabella
|
||||
- [GET_PARAM_VALUE](functions/GET_PARAM_VALUE.md) - Valore parametro
|
||||
- [SPLIT](functions/SPLIT.md) - Split stringa
|
||||
- [MY_INSTR](functions/MY_INSTR.md) - Instr custom
|
||||
- [CLOB2BLOB](functions/CLOB2BLOB.md) - Conversione CLOB
|
||||
- [EXTDATE_GET_ITA](functions/EXTDATE_GET_ITA.md) - Data in italiano
|
||||
|
||||
### [Packages](packages/README.md) (17)
|
||||
|
||||
Business:
|
||||
|
||||
- [MAIL_PKG](packages/MAIL_PKG.md) - Gestione invio email automatiche
|
||||
|
||||
Utility esterne:
|
||||
|
||||
- [UTL_BASE64](packages/UTL_BASE64.md) - Encoding Base64
|
||||
|
||||
JasperReports:
|
||||
|
||||
- [XLIB_JASPERREPORTS](packages/XLIB_JASPERREPORTS.md) - Integrazione JasperReports
|
||||
- [XLIB_JASPERREPORTS_IMG](packages/XLIB_JASPERREPORTS_IMG.md) - Immagini report
|
||||
|
||||
HTTP/Componenti:
|
||||
|
||||
- [XLIB_HTTP](packages/XLIB_HTTP.md) - Chiamate HTTP
|
||||
- [XLIB_COMPONENT](packages/XLIB_COMPONENT.md) - Componenti
|
||||
- [XLIB_LOG](packages/XLIB_LOG.md) - Logging
|
||||
|
||||
JSON (libreria PLJSON):
|
||||
|
||||
- [PLJSON_DYN](packages/PLJSON_DYN.md)
|
||||
- [PLJSON_EXT](packages/PLJSON_EXT.md)
|
||||
- [PLJSON_HELPER](packages/PLJSON_HELPER.md)
|
||||
- [PLJSON_ML](packages/PLJSON_ML.md)
|
||||
- [PLJSON_OBJECT_CACHE](packages/PLJSON_OBJECT_CACHE.md)
|
||||
- [PLJSON_PARSER](packages/PLJSON_PARSER.md)
|
||||
- [PLJSON_PRINTER](packages/PLJSON_PRINTER.md)
|
||||
- [PLJSON_UT](packages/PLJSON_UT.md)
|
||||
- [PLJSON_UTIL_PKG](packages/PLJSON_UTIL_PKG.md)
|
||||
- [PLJSON_XML](packages/PLJSON_XML.md)
|
||||
|
||||
### [Triggers](triggers/README.md) (19)
|
||||
|
||||
Generazione ID:
|
||||
|
||||
- [EVENTI_TRG](triggers/EVENTI_TRG.md) - ID eventi + inizializzazione
|
||||
- [EVENTI_AI_TRG](triggers/EVENTI_AI_TRG.md) - Creazione ospiti default
|
||||
- [EVENTI_DET_PREL_TRG](triggers/EVENTI_DET_PREL_TRG.md) - ID prelievi
|
||||
- [EVENTI_DET_RIS_TRG](triggers/EVENTI_DET_RIS_TRG.md) - ID risorse
|
||||
- [EVENTI_DET_DEGUST_TRG](triggers/EVENTI_DET_DEGUST_TRG.md) - ID degustazioni
|
||||
- [EVENTI_ACCONTI_TRG](triggers/EVENTI_ACCONTI_TRG.md) - ID acconti
|
||||
- [EVENTI_ALTRICOSTI_TRG](triggers/EVENTI_ALTRICOSTI_TRG.md) - ID altri costi
|
||||
- [EVENTI_ALLEG_TRG](triggers/EVENTI_ALLEG_TRG.md) - ID allegati
|
||||
- [CLIENTI_TRG](triggers/CLIENTI_TRG.md) - ID clienti
|
||||
- [LOCATION_TRG](triggers/LOCATION_TRG.md) - ID location
|
||||
- [RISORSE_TRG](triggers/RISORSE_TRG.md) - ID risorse
|
||||
- [ARTICOLI_DET_REGOLE_TRG](triggers/ARTICOLI_DET_REGOLE_TRG.md) - ID regole articoli
|
||||
- [TB_TIPI_PASTO_TRG](triggers/TB_TIPI_PASTO_TRG.md) - ID tipi pasto
|
||||
|
||||
Business logic:
|
||||
|
||||
- [EVENTI_DET_OSPITI_TRG_AI](triggers/EVENTI_DET_OSPITI_TRG_AI.md) - Aggiornamento ospiti
|
||||
- [EVENTI_DET_PREL_QTA_TOT_TRG](triggers/EVENTI_DET_PREL_QTA_TOT_TRG.md) - Calcolo quantità totale
|
||||
|
||||
Ordinamento:
|
||||
|
||||
- [ADD_COD_STEP](triggers/ADD_COD_STEP.md) - Ordine tipi materiale
|
||||
- [ON_DELETE_REORDER](triggers/ON_DELETE_REORDER.md) - Riordino dopo delete
|
||||
|
||||
Sistema:
|
||||
|
||||
- [BI_GL_SCHEMA_CHANGES](triggers/BI_GL_SCHEMA_CHANGES.md) - Log modifiche schema
|
||||
- [XLIB_LOGS_BI_TRG](triggers/XLIB_LOGS_BI_TRG.md) - Log applicazione
|
||||
|
||||
### [Sequences](sequences/README.md) (22)
|
||||
|
||||
Tutte le sequence del database.
|
||||
|
||||
### [Types](types/README.md) (10)
|
||||
|
||||
Tipi custom:
|
||||
|
||||
- [T_DET_OSPITI_ROW](types/T_DET_OSPITI_ROW.md) / [T_DET_OSPITI_TAB](types/T_DET_OSPITI_TAB.md) - Tipo per F_GET_OSPITI
|
||||
- [T_REP_ALLESTIMENTI_ROW](types/T_REP_ALLESTIMENTI_ROW.md) / [T_REP_ALLESTIMENTI_TAB](types/T_REP_ALLESTIMENTI_TAB.md) - Tipo per F_REP_ALLESTIMENTI
|
||||
- [T_REP_CUCINA_ROW](types/T_REP_CUCINA_ROW.md) / [T_REP_CUCINA_TAB](types/T_REP_CUCINA_TAB.md) - Tipo per F_REP_CUCINA
|
||||
- [STRING_LIST](types/STRING_LIST.md) - Lista stringhe
|
||||
- [ENUM_TABLE_OBJECT](types/ENUM_TABLE_OBJECT.md) / [ENUM_TABLE_TYPE](types/ENUM_TABLE_TYPE.md) - Tipi per STRING_TO_TABLE_ENUM
|
||||
- [XLIB_VC2_ARRAY_T](types/XLIB_VC2_ARRAY_T.md) - Array varchar2
|
||||
|
||||
---
|
||||
|
||||
## Schema ER Semplificato
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ CLIENTI │
|
||||
└──────┬──────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ LOCATION │◄────│ EVENTI │────►│TB_TIPI_EVENTO│
|
||||
└─────────────┘ └──────┬──────┘ └─────────────┘
|
||||
│
|
||||
┌─────────────────┼─────────────────┐
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│EVENTI_DET_OSPITI│ │ EVENTI_DET_PREL │ │ EVENTI_DET_RIS │
|
||||
└─────────────────┘ └────────┬────────┘ └────────┬────────┘
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ TB_TIPI_OSPITI │ │ ARTICOLI │ │ RISORSE │
|
||||
└─────────────────┘ └────────┬────────┘ └─────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ TB_CODICI_CATEG │
|
||||
└────────┬────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ TB_TIPI_MAT │
|
||||
└─────────────────┘
|
||||
|
||||
┌─────────────────┬─────────────────┐
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│EVENTI_DET_DEGUST│ │ EVENTI_ACCONTI │ │EVENTI_ALTRICOSTI│
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
## Workflow Stati Evento
|
||||
|
||||
```
|
||||
┌──────────────┐
|
||||
│ PREVENTIVO │ (100) - Bianco
|
||||
└──────┬───────┘
|
||||
│ Degustazione
|
||||
▼
|
||||
┌──────────────┐
|
||||
│SCHEDA EVENTO │ (200) - Celeste
|
||||
│(preparazione)│
|
||||
└──────┬───────┘
|
||||
│ Prima caparra
|
||||
▼
|
||||
┌──────────────┐
|
||||
│ SCHEDA │ (300) - Giallo
|
||||
│ CONFERMATA │
|
||||
└──────┬───────┘
|
||||
│ Quasi confermato
|
||||
▼
|
||||
┌──────────────┐
|
||||
│SCHEDA QUASI │ (350) - Arancio
|
||||
│ CONFERMATA │
|
||||
└──────┬───────┘
|
||||
│ Conferma definitiva
|
||||
▼
|
||||
┌──────────────┐
|
||||
│ CONFERMATO │ (400) - Verde
|
||||
└──────────────┘
|
||||
|
||||
│ Rifiuto/Scadenza
|
||||
▼
|
||||
┌──────────────┐
|
||||
│NON ACCETTATO/│ (900) - Viola
|
||||
│ SUPERATO │
|
||||
└──────────────┘
|
||||
```
|
||||
|
||||
## Note per lo Sviluppo
|
||||
|
||||
1. **Packages PLJSON\_\***: Libreria esterna per parsing JSON, può essere sostituita con funzionalità native .NET
|
||||
|
||||
2. **Packages XLIB\_\***: Componenti per integrazione JasperReports, da valutare sostituzione con report .NET
|
||||
|
||||
3. **Trigger per ID**: In .NET usare Identity columns o GUID
|
||||
|
||||
4. **Calcolo quantità**: La logica in `EVENTI_AGGIORNA_QTA_LISTA` è critica e deve essere portata fedelmente
|
||||
|
||||
5. **Sistema acconti**: Le percentuali 30%-50%-20% sono hardcoded, valutare parametrizzazione
|
||||
419
docs/procedures/EVENTI_AGGIORNA_QTA_LISTA.md
Normal file
419
docs/procedures/EVENTI_AGGIORNA_QTA_LISTA.md
Normal file
@@ -0,0 +1,419 @@
|
||||
# EVENTI_AGGIORNA_QTA_LISTA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "EVENTI_AGGIORNA_QTA_LISTA" (
|
||||
p_id_evento NUMBER
|
||||
) AS
|
||||
-- ricalcola tutte le qta della lista
|
||||
|
||||
v_cod_art VARCHAR2(10);
|
||||
v_coeff_a NUMBER;
|
||||
v_coeff_s NUMBER;
|
||||
v_coeff_b NUMBER;
|
||||
v_ospiti NUMBER;
|
||||
v_qta_a NUMBER;
|
||||
v_qta_s NUMBER;
|
||||
v_qta_b NUMBER;
|
||||
v_qta_std_a NUMBER;
|
||||
v_qta_std_s NUMBER;
|
||||
v_qta_std_b NUMBER;
|
||||
v_count_tov NUMBER;
|
||||
v_count_tov_buf NUMBER;
|
||||
v_qta_giac NUMBER;
|
||||
v_qta_imp NUMBER;
|
||||
v_data_evt DATE;
|
||||
v_qta_man VARCHAR2(100);
|
||||
BEGIN
|
||||
|
||||
-- Daniele Viti
|
||||
-- Scorre tutti gli articoli dell'evento
|
||||
---------
|
||||
FOR c IN (
|
||||
SELECT DISTINCT
|
||||
cod_articolo
|
||||
FROM
|
||||
eventi_det_prel
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
) LOOP
|
||||
BEGIN
|
||||
|
||||
--default su qta:
|
||||
|
||||
--verifica qta standard
|
||||
SELECT
|
||||
nvl(qta_std_a, 0),
|
||||
nvl(qta_std_s, 0),
|
||||
nvl(qta_std_b, 0)
|
||||
INTO
|
||||
v_qta_std_a,
|
||||
v_qta_std_s,
|
||||
v_qta_std_b
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
IF v_qta_std_a > 0 OR v_qta_std_s > 0 OR v_qta_std_b > 0 THEN
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
qta_ape = v_qta_std_a,
|
||||
qta_sedu = v_qta_std_s,
|
||||
qta_bufdol = v_qta_std_b,
|
||||
qta = qta_ape + qta_sedu + qta_bufdol + qta_man_ape + qta_man_sedu + qta_man_bufdol
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
CONTINUE; -- se esistono le qta standard aggiorna e passa il giro successivo!
|
||||
|
||||
END IF;
|
||||
|
||||
SELECT
|
||||
cod_relativo
|
||||
INTO v_cod_art
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
IF v_cod_art IS NULL THEN
|
||||
--Articolo Relativo assente
|
||||
|
||||
--verifica se cod_articolo è di tipo TOVAGLE O CARAFFE etc...
|
||||
SELECT
|
||||
COUNT(*)
|
||||
INTO v_count_tov
|
||||
FROM
|
||||
articoli a
|
||||
JOIN tb_codici_categ c ON a.cod_categ = c.cod_categ
|
||||
JOIN tb_tipi_mat t ON c.cod_tipo = t.cod_tipo
|
||||
WHERE
|
||||
( c.cod_tipo IN ( 'CA-CARAFFE' )
|
||||
-- or c.COD_CATEG in ('TOV-BUFF','TOV-SED')
|
||||
OR c.cod_categ IN ( 'TOV-SED' ) )
|
||||
AND a.cod_articolo = c.cod_articolo;
|
||||
|
||||
--verifica se cod_articolo è di tipo TOVAGLE BUFFET
|
||||
SELECT
|
||||
COUNT(*)
|
||||
INTO v_count_tov_buf
|
||||
FROM
|
||||
articoli a
|
||||
JOIN tb_codici_categ c ON a.cod_categ = c.cod_categ
|
||||
JOIN tb_tipi_mat t ON c.cod_tipo = t.cod_tipo
|
||||
WHERE
|
||||
c.cod_categ IN ( 'TOV-BUFF' )
|
||||
AND a.cod_articolo = c.cod_articolo; -- 'CM-DANI'
|
||||
|
||||
IF v_count_tov > 0 THEN
|
||||
--c.COD_ARTICOLO è di tipo TOVAGLE O CARAFFE etc...
|
||||
|
||||
-- reperisco le qta tot inserita per i tavoli
|
||||
SELECT
|
||||
nvl(SUM(qta_ape),
|
||||
0),
|
||||
nvl(SUM(qta_sedu),
|
||||
0),
|
||||
nvl(SUM(qta_bufdol),
|
||||
0)
|
||||
INTO
|
||||
v_qta_a,
|
||||
v_qta_s,
|
||||
v_qta_b
|
||||
FROM
|
||||
eventi_det_prel e
|
||||
JOIN articoli a ON e.cod_articolo = a.cod_articolo
|
||||
JOIN tb_codici_categ c ON a.cod_categ = c.cod_categ
|
||||
JOIN tb_tipi_mat t ON c.cod_tipo = t.cod_tipo
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND c.cod_tipo IN ( 'TA' );
|
||||
|
||||
--recupero il coefficente dell'atricolo (tovagliato o caraffe) e lo moltiplico x la qta tavoli
|
||||
SELECT
|
||||
nvl(coeff_a, 0),
|
||||
nvl(coeff_s, 0),
|
||||
nvl(coeff_b, 0)
|
||||
INTO
|
||||
v_coeff_a,
|
||||
v_coeff_s,
|
||||
v_coeff_b
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
qta_ape = v_qta_a * v_coeff_a,
|
||||
qta_sedu = v_qta_s * v_coeff_s,
|
||||
qta_bufdol = v_qta_b * v_coeff_b,
|
||||
qta = qta_ape + qta_sedu + qta_bufdol + qta_man_ape + qta_man_sedu + qta_man_bufdol
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
ELSIF v_count_tov_buf > 0 THEN
|
||||
--c.COD_ARTICOLO è di tipo TOVAGLE BUFFET
|
||||
|
||||
-- reperisco le qta tot inserita per gli angoli buffet
|
||||
SELECT
|
||||
nvl(SUM(qta_ape),
|
||||
0),
|
||||
nvl(SUM(qta_sedu),
|
||||
0),
|
||||
nvl(SUM(qta_bufdol),
|
||||
0)
|
||||
INTO
|
||||
v_qta_a,
|
||||
v_qta_s,
|
||||
v_qta_b
|
||||
FROM
|
||||
eventi_det_prel e
|
||||
JOIN articoli a ON e.cod_articolo = a.cod_articolo
|
||||
JOIN tb_codici_categ c ON a.cod_categ = c.cod_categ
|
||||
JOIN tb_tipi_mat t ON c.cod_tipo = t.cod_tipo
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND c.cod_tipo IN ( 'AN' );
|
||||
|
||||
--recupero il coefficente dell'atricolo (tovagliato buffet) e lo moltiplico x la qta angoli
|
||||
SELECT
|
||||
nvl(coeff_a, 0),
|
||||
nvl(coeff_s, 0),
|
||||
nvl(coeff_b, 0)
|
||||
INTO
|
||||
v_coeff_a,
|
||||
v_coeff_s,
|
||||
v_coeff_b
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
qta_ape = v_qta_a * v_coeff_a,
|
||||
qta_sedu = v_qta_s * v_coeff_s,
|
||||
qta_bufdol = v_qta_b * v_coeff_b,
|
||||
qta = qta_ape + qta_sedu + qta_bufdol + qta_man_ape + qta_man_sedu + qta_man_bufdol
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
ELSE
|
||||
BEGIN
|
||||
v_cod_art := c.cod_articolo;
|
||||
SELECT
|
||||
nvl(coeff_a, 0),
|
||||
nvl(coeff_s, 0),
|
||||
nvl(coeff_b, 0)
|
||||
INTO
|
||||
v_coeff_a,
|
||||
v_coeff_s,
|
||||
v_coeff_b
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = v_cod_art;
|
||||
|
||||
SELECT
|
||||
nvl(tot_ospiti, 0)
|
||||
INTO v_ospiti
|
||||
FROM
|
||||
eventi
|
||||
WHERE
|
||||
id = p_id_evento;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
raise_application_error(-20001, 'Errore: Coefficenti/Num Ospiti NON TROVATI - '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
qta_ape = trunc(v_coeff_a * v_ospiti),
|
||||
qta_sedu = trunc(v_coeff_s * v_ospiti),
|
||||
qta_bufdol = trunc(v_coeff_b * v_ospiti),
|
||||
qta = qta_ape + qta_sedu + qta_bufdol + qta_man_ape + qta_man_sedu + qta_man_bufdol
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
END IF;
|
||||
|
||||
ELSE
|
||||
-- cod relativo valorizzato
|
||||
BEGIN
|
||||
-- reperisco le qta inserite per il cod_relativo nella lista
|
||||
SELECT
|
||||
nvl(qta_ape, 0),
|
||||
nvl(qta_sedu, 0),
|
||||
nvl(qta_bufdol, 0)
|
||||
INTO
|
||||
v_qta_a,
|
||||
v_qta_s,
|
||||
v_qta_b
|
||||
FROM
|
||||
eventi_det_prel
|
||||
WHERE
|
||||
cod_articolo = v_cod_art
|
||||
AND id_evento = p_id_evento;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
CONTINUE;
|
||||
-- Disattivato temporaneamente per evitare spam
|
||||
--RAISE_APPLICATION_ERROR(-20000, 'Errore: Qta NON TROVATA !!! - v_cod_art: ' || v_cod_art || ' - ' || SQLCODE || ' - ' || SUBSTR(SQLERRM, 1 , 64));
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
-- reperisco i coefficenti
|
||||
SELECT
|
||||
nvl(coeff_a, 0),
|
||||
nvl(coeff_s, 0),
|
||||
nvl(coeff_b, 0)
|
||||
INTO
|
||||
v_coeff_a,
|
||||
v_coeff_s,
|
||||
v_coeff_b
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
raise_application_error(-20001, 'Errore: Qta/Coefficenti del codice relativo NON TROVATI - '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
qta_ape = trunc(v_coeff_a * v_qta_a),
|
||||
qta_sedu = trunc(v_coeff_s * v_qta_s),
|
||||
qta_bufdol = trunc(v_coeff_b * v_qta_b),
|
||||
qta = qta_ape + qta_sedu + qta_bufdol + qta_man_ape + qta_man_sedu + qta_man_bufdol
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
END IF;
|
||||
|
||||
-- NOTE SE SUPERO LA QTA DISPONBILE !!!
|
||||
BEGIN
|
||||
SELECT
|
||||
data
|
||||
INTO v_data_evt
|
||||
FROM
|
||||
eventi
|
||||
WHERE
|
||||
id = p_id_evento;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
raise_application_error(-20001, 'v_data_evento - '
|
||||
|| v_data_evt
|
||||
|| ' - '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
qta_giac
|
||||
INTO v_qta_giac
|
||||
FROM
|
||||
articoli
|
||||
WHERE
|
||||
cod_articolo = c.cod_articolo;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
raise_application_error(-20001, 'v_qta_giac - '
|
||||
|| v_qta_giac
|
||||
|| ' - '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
SELECT
|
||||
nvl(f_get_qta_impegnata(c.cod_articolo, v_data_evt),
|
||||
0)
|
||||
INTO v_qta_imp
|
||||
FROM
|
||||
dual;
|
||||
|
||||
EXCEPTION
|
||||
WHEN no_data_found THEN
|
||||
raise_application_error(-20001, 'v_qta_imp - '
|
||||
|| v_qta_imp
|
||||
|| ' - '
|
||||
|| v_cod_art
|
||||
|| ', '
|
||||
|| v_data_evt
|
||||
|| ' - '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
|
||||
--RAISE_APPLICATION_ERROR(-20000, 'v_qta_giac - ' || v_qta_giac || ' - ' || SQLCODE || ' - ' || SUBSTR(SQLERRM, 1 , 64));
|
||||
dbms_output.put_line('CodArt: '
|
||||
|| c.cod_articolo
|
||||
|| '; Qta Imp: '
|
||||
|| v_qta_imp
|
||||
|| '; Qta Giac: '
|
||||
|| v_qta_giac);
|
||||
--NOTA: a differenza del trigger "BEFORE INSERT ON EVENTI_DET_PREL",
|
||||
-- in questo caso la qta_imp è già comprensiva della qta ricalcolata
|
||||
IF v_qta_imp > v_qta_giac THEN
|
||||
v_qta_man := v_qta_imp - v_qta_giac;
|
||||
--:NEW.NOTE := 'QTA TOT NON Disponibile, mancano: ' || to_char(v_qta_man);
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
note = 'QTA TOT NON Disponibile, mancano: ' || to_char(v_qta_man)
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo;
|
||||
|
||||
COMMIT;
|
||||
ELSE
|
||||
UPDATE eventi_det_prel
|
||||
SET
|
||||
note = NULL
|
||||
WHERE
|
||||
id_evento = p_id_evento
|
||||
AND cod_articolo = c.cod_articolo
|
||||
AND note LIKE '%QTA TOT NON Disponibile%';
|
||||
|
||||
COMMIT;
|
||||
END IF;
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
raise_application_error(-20001, 'Errore: '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| substr(sqlerrm, 1, 64));
|
||||
END;
|
||||
END LOOP;
|
||||
|
||||
RETURN;
|
||||
END eventi_aggiorna_qta_lista;```
|
||||
45
docs/procedures/EVENTI_AGGIORNA_TOT_OSPITI.md
Normal file
45
docs/procedures/EVENTI_AGGIORNA_TOT_OSPITI.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# EVENTI_AGGIORNA_TOT_OSPITI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "EVENTI_AGGIORNA_TOT_OSPITI" (
|
||||
p_id_evento IN NUMBER DEFAULT 0
|
||||
) AS
|
||||
--aggiorna la qta toto ospiti
|
||||
--job aggiorna_tot_ospiti
|
||||
|
||||
CURSOR c_eventi IS
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
eventi
|
||||
WHERE
|
||||
id = p_id_evento;
|
||||
|
||||
v_tot_ospiti NUMBER;
|
||||
BEGIN
|
||||
/*
|
||||
for c in c_eventi
|
||||
loop
|
||||
*/
|
||||
BEGIN
|
||||
v_tot_ospiti := f_get_tot_ospiti(p_id_evento);
|
||||
UPDATE eventi
|
||||
SET
|
||||
tot_ospiti = v_tot_ospiti
|
||||
WHERE
|
||||
id = p_id_evento;
|
||||
|
||||
COMMIT;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
raise_application_error(-20000, 'Errore nel calcolo del totale ospiti: '
|
||||
|| sqlcode
|
||||
|| ' - '
|
||||
|| sqlerrm);
|
||||
END;
|
||||
|
||||
-- end loop;
|
||||
|
||||
END eventi_aggiorna_tot_ospiti;```
|
||||
214
docs/procedures/EVENTI_COPIA.md
Normal file
214
docs/procedures/EVENTI_COPIA.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# EVENTI_COPIA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE eventi_copia (
|
||||
id_evento_old IN NUMBER,
|
||||
nuova_versione IN NUMBER DEFAULT 0,
|
||||
id_evento_new OUT NUMBER
|
||||
) AS
|
||||
r_evento eventi%rowtype;
|
||||
v_new_evt_id eventi.id%TYPE;
|
||||
BEGIN
|
||||
SELECT
|
||||
*
|
||||
INTO r_evento
|
||||
FROM
|
||||
eventi
|
||||
WHERE
|
||||
id = id_evento_old;
|
||||
|
||||
r_evento.id := NULL;
|
||||
r_evento.is_template := 0;
|
||||
IF nuova_versione = 1 THEN
|
||||
r_evento.id_evt_padre := id_evento_old;
|
||||
r_evento.vers_number := nvl(r_evento.vers_number, 0) + 1; -- aggiorno il numero versione
|
||||
ELSE
|
||||
r_evento.id_evt_padre := NULL;
|
||||
r_evento.vers_number := 0;
|
||||
END IF;
|
||||
|
||||
-- Copio l'evento facendo creare il nuovo id dal trigger
|
||||
INSERT INTO eventi VALUES r_evento RETURNING id INTO v_new_evt_id;
|
||||
|
||||
IF nuova_versione = 1 THEN
|
||||
-- Aggiorno il vecchio evento col nuovo id
|
||||
UPDATE eventi
|
||||
SET
|
||||
id_evt_figlio = v_new_evt_id
|
||||
WHERE
|
||||
id = id_evento_old;
|
||||
|
||||
END IF;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Aggiungo i figli alla nuova versione
|
||||
-- Degustazioni
|
||||
INSERT INTO eventi_det_degust (
|
||||
id_evento,
|
||||
data,
|
||||
ora,
|
||||
nome,
|
||||
telefono,
|
||||
email,
|
||||
location,
|
||||
n_persone,
|
||||
menu,
|
||||
n_paganti,
|
||||
note,
|
||||
n_degustazione,
|
||||
consumata,
|
||||
costo_degustazione
|
||||
)
|
||||
SELECT
|
||||
v_new_evt_id,
|
||||
data,
|
||||
ora,
|
||||
nome,
|
||||
telefono,
|
||||
email,
|
||||
location,
|
||||
n_persone,
|
||||
menu,
|
||||
n_paganti,
|
||||
note,
|
||||
n_degustazione,
|
||||
consumata,
|
||||
costo_degustazione
|
||||
FROM
|
||||
eventi_det_degust
|
||||
WHERE
|
||||
id_evento = id_evento_old;
|
||||
|
||||
-- Ospiti
|
||||
-- Devo fare una update... DIO TRIGGER
|
||||
FOR c IN (
|
||||
SELECT
|
||||
id_evento,
|
||||
cod_tipo_ospite,
|
||||
numero,
|
||||
note
|
||||
FROM
|
||||
eventi_det_ospiti
|
||||
WHERE
|
||||
id_evento = id_evento_old
|
||||
) LOOP
|
||||
UPDATE eventi_det_ospiti
|
||||
SET
|
||||
numero = c.numero,
|
||||
note = c.note
|
||||
WHERE
|
||||
id_evento = v_new_evt_id
|
||||
AND cod_tipo_ospite = c.cod_tipo_ospite;
|
||||
|
||||
END LOOP;
|
||||
-- insert into eventi_det_ospiti (ID_EVENTO, COD_TIPO_OSPITE, NUMERO, NOTE)
|
||||
-- select v_new_evt_id, COD_TIPO_OSPITE, NUMERO, NOTE
|
||||
-- from eventi_det_ospiti
|
||||
-- where id_evento = ID_EVENTO_OLD;
|
||||
|
||||
-- Prelievi
|
||||
/* COME DA RICHIESTA DEL 01/2024 NON COPIO LA LISTA PRELIEVO NELLA NUOVA VERSIONE */
|
||||
/* RIATTIVO NUOVAMENTE LA COPIA IL 12/02/2024 */
|
||||
INSERT INTO eventi_det_prel (
|
||||
id_evento,
|
||||
cod_articolo,
|
||||
qta,
|
||||
note,
|
||||
qta_ape,
|
||||
qta_sedu,
|
||||
qta_bufdol,
|
||||
qta_man_ape,
|
||||
qta_man_sedu,
|
||||
qta_man_bufdol,
|
||||
costo_articolo
|
||||
)
|
||||
SELECT
|
||||
v_new_evt_id,
|
||||
cod_articolo,
|
||||
qta,
|
||||
note,
|
||||
qta_ape,
|
||||
qta_sedu,
|
||||
qta_bufdol,
|
||||
qta_man_ape,
|
||||
qta_man_sedu,
|
||||
qta_man_bufdol,
|
||||
costo_articolo
|
||||
FROM
|
||||
eventi_det_prel
|
||||
WHERE
|
||||
id_evento = id_evento_old;
|
||||
|
||||
-- Risorse
|
||||
INSERT INTO eventi_det_ris (
|
||||
id_evento,
|
||||
id_risorsa,
|
||||
ore_lav,
|
||||
costo,
|
||||
note
|
||||
)
|
||||
SELECT
|
||||
v_new_evt_id,
|
||||
id_risorsa,
|
||||
ore_lav,
|
||||
costo,
|
||||
note
|
||||
FROM
|
||||
eventi_det_ris
|
||||
WHERE
|
||||
id_evento = id_evento_old;
|
||||
|
||||
-- Costi
|
||||
INSERT INTO eventi_acconti (
|
||||
data,
|
||||
acconto,
|
||||
id_evento,
|
||||
a_conferma,
|
||||
ordine,
|
||||
descrizione
|
||||
)
|
||||
SELECT
|
||||
data,
|
||||
acconto,
|
||||
v_new_evt_id,
|
||||
a_conferma,
|
||||
ordine,
|
||||
descrizione
|
||||
FROM
|
||||
eventi_acconti
|
||||
WHERE
|
||||
id_evento = id_evento_old;
|
||||
|
||||
-- Altri Costi
|
||||
INSERT INTO eventi_altricosti (
|
||||
id_evento,
|
||||
descrizione,
|
||||
costo,
|
||||
quantity
|
||||
)
|
||||
SELECT
|
||||
v_new_evt_id,
|
||||
descrizione,
|
||||
costo,
|
||||
quantity
|
||||
FROM
|
||||
eventi_altricosti
|
||||
WHERE
|
||||
id_evento = id_evento_old;
|
||||
|
||||
-- Carico il nuovo id nella pagina
|
||||
id_evento_new := v_new_evt_id;
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DELETE FROM eventi
|
||||
WHERE
|
||||
id = v_new_evt_id;
|
||||
|
||||
COMMIT;
|
||||
raise_application_error(-20001, sqlcode
|
||||
|| ' - '
|
||||
|| sqlerrm);
|
||||
END eventi_copia;```
|
||||
205
docs/procedures/EVENTI_RICALCOLA_ACCONTI.md
Normal file
205
docs/procedures/EVENTI_RICALCOLA_ACCONTI.md
Normal file
@@ -0,0 +1,205 @@
|
||||
# EVENTI_RICALCOLA_ACCONTI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
procedure EVENTI_RICALCOLA_ACCONTI(p_event_id number) as
|
||||
v_cnt number;
|
||||
v_calc_only_saldo number := 0;
|
||||
v_totale_tipi number;
|
||||
v_totale_degus number;
|
||||
v_totale_ris number;
|
||||
v_totale_ospiti number;
|
||||
v_totale_evento number;
|
||||
v_totale_altricosti number;
|
||||
v_primo_acconto number := 0;
|
||||
v_secondo_acconto number := 0;
|
||||
v_terzo_acconto number := 0;
|
||||
v_prima_perc number := 0.3;
|
||||
v_seconda_perc number := 0.5;
|
||||
v_terza_perc number := 0.2;
|
||||
begin
|
||||
|
||||
select count(*)
|
||||
into v_cnt
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and "DATA" is not null;
|
||||
/*
|
||||
if v_cnt > 0 then
|
||||
raise_application_error(-20001, 'Impossibile ricalcolare gli acconti per un evento già saldato o parzialmente saldato');
|
||||
end if;
|
||||
*/
|
||||
select count(*)
|
||||
into v_cnt
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and (ORDINE = 10 OR ORDINE = 20) -- primo acconto (o anche secondo) dato quindi evento confermato
|
||||
and "DATA" is not null;
|
||||
|
||||
if v_cnt > 0 then
|
||||
v_calc_only_saldo := 1;
|
||||
end if;
|
||||
|
||||
select sum(costo_ivato)
|
||||
into v_totale_tipi
|
||||
from get_costo_tipi_evt
|
||||
where id_evento = p_event_id;
|
||||
|
||||
select sum(costo)
|
||||
into v_totale_degus
|
||||
from get_costo_degus_evt
|
||||
where id_evento = p_event_id;
|
||||
|
||||
select sum(costo)
|
||||
into v_totale_ris
|
||||
from get_costo_ris_evt
|
||||
where id_evento = p_event_id;
|
||||
|
||||
select sum(costo+costo*0.10)
|
||||
into v_totale_ospiti
|
||||
from get_costo_ospiti_evt
|
||||
where id_evento = p_event_id;
|
||||
|
||||
select sum((costo * quantity)+(case when costo > 0 then costo * quantity * 0.10 else 0 end))
|
||||
into v_totale_altricosti
|
||||
from eventi_altricosti
|
||||
where id_evento = p_event_id;
|
||||
|
||||
v_totale_evento :=
|
||||
nvl(v_totale_tipi, 0) -
|
||||
nvl(v_totale_degus, 0) +
|
||||
nvl(v_totale_ris, 0) +
|
||||
nvl(v_totale_ospiti, 0) +
|
||||
nvl(v_totale_altricosti, 0);
|
||||
|
||||
if v_calc_only_saldo = 0 then
|
||||
-- Se nessun acconto è stato pagato allora ricalcola tutti gli acconti
|
||||
delete
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ordine in (10, 20, 30);
|
||||
|
||||
insert into eventi_acconti
|
||||
(DESCRIZIONE, ACCONTO, ID_EVENTO, A_CONFERMA, ORDINE)
|
||||
values
|
||||
('PRIMA CAPARRA (art.7 punto A del contratto) a conferma evento nella cifra di euro:',
|
||||
v_totale_evento * v_prima_perc, p_event_id, 1, 10);
|
||||
|
||||
insert into eventi_acconti
|
||||
(DESCRIZIONE, ACCONTO, ID_EVENTO, A_CONFERMA, ORDINE)
|
||||
values
|
||||
('SECONDA CAPARRA (art. 7 punto B - circa 60 giorni prima dell''evento) nella cifra di euro:',
|
||||
v_totale_evento * v_seconda_perc, p_event_id, 0, 20);
|
||||
|
||||
insert into eventi_acconti
|
||||
(DESCRIZIONE, ACCONTO, ID_EVENTO, A_CONFERMA, ORDINE)
|
||||
values
|
||||
('SALDO A RICEVIMENTO CONSUNTIVO (art.7 punto c del contratto) 5 giorni prima dell''evento',
|
||||
v_totale_evento * v_terza_perc, p_event_id, 0, 30);
|
||||
|
||||
else
|
||||
-- Controllo se gli acconti sono stato pagati e in caso ricalcolo soltanto i saldi
|
||||
begin
|
||||
select acconto
|
||||
into v_primo_acconto
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ORDINE = 10
|
||||
and data is not null; -- Il primo acconto è stato pagato
|
||||
exception when no_data_found then
|
||||
v_primo_acconto := 0;
|
||||
end;
|
||||
|
||||
begin
|
||||
select acconto
|
||||
into v_secondo_acconto
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ORDINE = 20
|
||||
and data is not null; -- Il secondo acconto è stato pagato
|
||||
exception when no_data_found then
|
||||
v_secondo_acconto := 0;
|
||||
end;
|
||||
|
||||
begin
|
||||
select acconto
|
||||
into v_terzo_acconto
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ORDINE = 30
|
||||
and data is not null; -- Il terzo acconto è stato pagato
|
||||
exception when no_data_found then
|
||||
v_terzo_acconto := 0;
|
||||
end;
|
||||
|
||||
-- Se non hanno pagato il primo acconto lo calcolo in automatico
|
||||
if v_primo_acconto = 0 then
|
||||
v_primo_acconto := v_totale_evento * v_prima_perc;
|
||||
end if;
|
||||
|
||||
-- Ricalcolo la percentuale del secondo acconto in base al primo se non è stato pagato
|
||||
if v_secondo_acconto = 0 then
|
||||
v_secondo_acconto := (v_totale_evento - v_primo_acconto) * (v_seconda_perc/(v_seconda_perc + v_terza_perc));
|
||||
end if;
|
||||
|
||||
-- Calcolo il terzo acconto come la rimanenza tra il totale e il primo + secondo se non è stato pagato
|
||||
if v_terzo_acconto = 0 then
|
||||
v_terzo_acconto := v_totale_evento - (v_primo_acconto + v_secondo_acconto);
|
||||
end if;
|
||||
|
||||
-- Controllo se i totali acconti superano il totale dell'evento
|
||||
if v_primo_acconto > v_totale_evento then
|
||||
raise_application_error(-20001, 'Attenzione! Il primo acconto supera il costo totale del''evento');
|
||||
end if;
|
||||
|
||||
if v_primo_acconto + v_secondo_acconto > v_totale_evento then
|
||||
raise_application_error(-20001, 'Attenzione! Il primo e il secondo acconto superano il costo totale del''evento');
|
||||
end if;
|
||||
|
||||
if v_primo_acconto + v_secondo_acconto + v_terzo_acconto > v_totale_evento then
|
||||
raise_application_error(-20001, 'Attenzione! Gli acconti superano il costo totale del''evento');
|
||||
end if;
|
||||
|
||||
-- Se gli acconti successivi sono validi allora li aggiorno, se l'acconto precendente salda tutto li elimino
|
||||
if v_secondo_acconto > 0 then
|
||||
update eventi_acconti
|
||||
set ACCONTO = v_secondo_acconto
|
||||
where id_evento = p_event_id
|
||||
and ordine = 20;
|
||||
|
||||
if SQL%ROWCOUNT = 0 then
|
||||
insert into eventi_acconti
|
||||
(DESCRIZIONE, ACCONTO, ID_EVENTO, A_CONFERMA, ORDINE)
|
||||
values
|
||||
('SECONDA CAPARRA (art. 7 punto B - circa 60 giorni prima dell''evento) nella cifra di euro:',
|
||||
v_secondo_acconto, p_event_id, 0, 20);
|
||||
end if;
|
||||
else
|
||||
delete
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ordine = 20;
|
||||
end if;
|
||||
|
||||
if v_terzo_acconto > 0 then
|
||||
update eventi_acconti
|
||||
set ACCONTO = v_terzo_acconto
|
||||
where id_evento = p_event_id
|
||||
and ordine = 30;
|
||||
|
||||
if SQL%ROWCOUNT = 0 then
|
||||
insert into eventi_acconti
|
||||
(DESCRIZIONE, ACCONTO, ID_EVENTO, A_CONFERMA, ORDINE)
|
||||
values
|
||||
('SALDO A RICEVIMENTO CONSUNTIVO (art.7 punto c del contratto) ', v_terzo_acconto, p_event_id, 0, 30);
|
||||
end if;
|
||||
else
|
||||
delete
|
||||
from eventi_acconti
|
||||
where id_evento = p_event_id
|
||||
and ordine = 30;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end;```
|
||||
12
docs/procedures/EVENTO_ELIMINA_PRELIEVI.md
Normal file
12
docs/procedures/EVENTO_ELIMINA_PRELIEVI.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# EVENTO_ELIMINA_PRELIEVI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE EVENTO_ELIMINA_PRELIEVI
|
||||
(
|
||||
P_ID_EVENTO IN NUMBER
|
||||
) AS
|
||||
BEGIN
|
||||
NULL;
|
||||
END EVENTO_ELIMINA_PRELIEVI;```
|
||||
22
docs/procedures/HTPPRN.md
Normal file
22
docs/procedures/HTPPRN.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# HTPPRN
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "HTPPRN" (pclob in out nocopy clob) is
|
||||
v_excel varchar2(32000);
|
||||
v_clob clob := pclob;
|
||||
begin
|
||||
while length(v_clob) > 0 loop begin
|
||||
if length(v_clob) > 32000 then v_excel:= substr(v_clob,1,32000);
|
||||
htp.prn(v_excel);
|
||||
v_clob:= substr(v_clob,length(v_excel)+1);
|
||||
else
|
||||
v_excel := v_clob;
|
||||
htp.prn(v_excel);
|
||||
v_clob:=''; v_excel := ''; end if;
|
||||
end;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
```
|
||||
308
docs/procedures/LISTE_COPIA.md
Normal file
308
docs/procedures/LISTE_COPIA.md
Normal file
@@ -0,0 +1,308 @@
|
||||
# LISTE_COPIA
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE liste_copia (
|
||||
id_evento_from IN NUMBER,
|
||||
id_evento_to IN NUMBER,
|
||||
copia_degustazioni IN NUMBER DEFAULT 0,
|
||||
copia_prelievi IN NUMBER DEFAULT 0,
|
||||
copia_risorse IN NUMBER DEFAULT 0,
|
||||
copia_acconti IN NUMBER DEFAULT 0,
|
||||
copia_altricosti IN NUMBER DEFAULT 0
|
||||
) AS
|
||||
BEGIN
|
||||
-- Validate that mandatory parameters are provided
|
||||
IF id_evento_from IS NULL OR id_evento_to IS NULL THEN
|
||||
RAISE_APPLICATION_ERROR(-20001, 'Both id_evento_from and id_evento_to must be provided.');
|
||||
END IF;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Degustazioni (Tastings)
|
||||
----------------------------------------------------------------------------
|
||||
IF copia_degustazioni > 0 THEN
|
||||
FOR rec IN (
|
||||
SELECT
|
||||
id,
|
||||
data,
|
||||
ora,
|
||||
nome,
|
||||
telefono,
|
||||
email,
|
||||
location,
|
||||
n_persone,
|
||||
menu,
|
||||
n_paganti,
|
||||
note,
|
||||
n_degustazione,
|
||||
consumata,
|
||||
costo_degustazione
|
||||
FROM eventi_det_degust
|
||||
WHERE id_evento = id_evento_from
|
||||
) LOOP
|
||||
-- Try to update using the unique key (assumed here as n_degustazione)
|
||||
UPDATE eventi_det_degust
|
||||
SET
|
||||
data = rec.data,
|
||||
ora = rec.ora,
|
||||
nome = rec.nome,
|
||||
telefono = rec.telefono,
|
||||
email = rec.email,
|
||||
location = rec.location,
|
||||
n_persone = rec.n_persone,
|
||||
menu = rec.menu,
|
||||
n_paganti = rec.n_paganti,
|
||||
note = rec.note,
|
||||
consumata = rec.consumata,
|
||||
costo_degustazione = rec.costo_degustazione
|
||||
WHERE id_evento = id_evento_to
|
||||
AND id = rec.id;
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO eventi_det_degust (
|
||||
id_evento,
|
||||
data,
|
||||
ora,
|
||||
nome,
|
||||
telefono,
|
||||
email,
|
||||
location,
|
||||
n_persone,
|
||||
menu,
|
||||
n_paganti,
|
||||
note,
|
||||
n_degustazione,
|
||||
consumata,
|
||||
costo_degustazione
|
||||
)
|
||||
VALUES (
|
||||
id_evento_to,
|
||||
rec.data,
|
||||
rec.ora,
|
||||
rec.nome,
|
||||
rec.telefono,
|
||||
rec.email,
|
||||
rec.location,
|
||||
rec.n_persone,
|
||||
rec.menu,
|
||||
rec.n_paganti,
|
||||
rec.note,
|
||||
rec.n_degustazione,
|
||||
rec.consumata,
|
||||
rec.costo_degustazione
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Ospiti (Guests)
|
||||
----------------------------------------------------------------------------
|
||||
FOR rec IN (
|
||||
SELECT
|
||||
cod_tipo_ospite,
|
||||
numero,
|
||||
note
|
||||
FROM eventi_det_ospiti
|
||||
WHERE id_evento = id_evento_from
|
||||
) LOOP
|
||||
UPDATE eventi_det_ospiti
|
||||
SET
|
||||
numero = rec.numero,
|
||||
note = rec.note
|
||||
WHERE id_evento = id_evento_to
|
||||
AND cod_tipo_ospite = rec.cod_tipo_ospite;
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO eventi_det_ospiti (
|
||||
id_evento,
|
||||
cod_tipo_ospite,
|
||||
numero,
|
||||
note
|
||||
)
|
||||
VALUES (
|
||||
id_evento_to,
|
||||
rec.cod_tipo_ospite,
|
||||
rec.numero,
|
||||
rec.note
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Prelievi (Sampling): inserisce solo i record mancanti
|
||||
----------------------------------------------------------------------------
|
||||
IF copia_prelievi > 0 THEN
|
||||
MERGE INTO eventi_det_prel dest
|
||||
USING (
|
||||
SELECT
|
||||
cod_articolo,
|
||||
qta,
|
||||
note,
|
||||
qta_ape,
|
||||
qta_sedu,
|
||||
qta_bufdol,
|
||||
qta_man_ape,
|
||||
qta_man_sedu,
|
||||
qta_man_bufdol,
|
||||
costo_articolo
|
||||
FROM eventi_det_prel
|
||||
WHERE id_evento = id_evento_from
|
||||
) src
|
||||
ON (
|
||||
dest.id_evento = id_evento_to
|
||||
AND dest.cod_articolo = src.cod_articolo
|
||||
)
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (
|
||||
id_evento,
|
||||
cod_articolo,
|
||||
qta,
|
||||
note,
|
||||
qta_ape,
|
||||
qta_sedu,
|
||||
qta_bufdol,
|
||||
qta_man_ape,
|
||||
qta_man_sedu,
|
||||
qta_man_bufdol,
|
||||
costo_articolo
|
||||
)
|
||||
VALUES (
|
||||
id_evento_to,
|
||||
src.cod_articolo,
|
||||
src.qta,
|
||||
src.note,
|
||||
src.qta_ape,
|
||||
src.qta_sedu,
|
||||
src.qta_bufdol,
|
||||
src.qta_man_ape,
|
||||
src.qta_man_sedu,
|
||||
src.qta_man_bufdol,
|
||||
src.costo_articolo
|
||||
);
|
||||
END IF;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Risorse (Resources)
|
||||
----------------------------------------------------------------------------
|
||||
IF copia_risorse > 0 THEN
|
||||
FOR rec IN (
|
||||
SELECT
|
||||
id,
|
||||
id_risorsa,
|
||||
ore_lav,
|
||||
costo,
|
||||
note
|
||||
FROM eventi_det_ris
|
||||
WHERE id_evento = id_evento_from
|
||||
) LOOP
|
||||
UPDATE eventi_det_ris
|
||||
SET
|
||||
ore_lav = rec.ore_lav,
|
||||
costo = rec.costo,
|
||||
note = rec.note
|
||||
WHERE id_evento = id_evento_to
|
||||
AND id = rec.id;
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO eventi_det_ris (
|
||||
id_evento,
|
||||
id_risorsa,
|
||||
ore_lav,
|
||||
costo,
|
||||
note
|
||||
)
|
||||
VALUES (
|
||||
id_evento_to,
|
||||
rec.id_risorsa,
|
||||
rec.ore_lav,
|
||||
rec.costo,
|
||||
rec.note
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Acconti (Payments)
|
||||
----------------------------------------------------------------------------
|
||||
IF copia_acconti > 0 THEN
|
||||
FOR rec IN (
|
||||
SELECT
|
||||
id,
|
||||
data,
|
||||
acconto,
|
||||
a_conferma,
|
||||
ordine,
|
||||
descrizione
|
||||
FROM eventi_acconti
|
||||
WHERE id_evento = id_evento_from
|
||||
) LOOP
|
||||
UPDATE eventi_acconti
|
||||
SET
|
||||
data = rec.data,
|
||||
acconto = rec.acconto,
|
||||
a_conferma = rec.a_conferma,
|
||||
descrizione = rec.descrizione
|
||||
WHERE id_evento = id_evento_to
|
||||
AND id = rec.id;
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO eventi_acconti (
|
||||
data,
|
||||
acconto,
|
||||
id_evento,
|
||||
a_conferma,
|
||||
ordine,
|
||||
descrizione
|
||||
)
|
||||
VALUES (
|
||||
rec.data,
|
||||
rec.acconto,
|
||||
id_evento_to,
|
||||
rec.a_conferma,
|
||||
rec.ordine,
|
||||
rec.descrizione
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Altri Costi (Other Costs)
|
||||
----------------------------------------------------------------------------
|
||||
IF copia_altricosti > 0 THEN
|
||||
FOR rec IN (
|
||||
SELECT
|
||||
id,
|
||||
descrizione,
|
||||
costo,
|
||||
quantity
|
||||
FROM eventi_altricosti
|
||||
WHERE id_evento = id_evento_from
|
||||
) LOOP
|
||||
UPDATE eventi_altricosti
|
||||
SET
|
||||
costo = rec.costo,
|
||||
quantity = rec.quantity
|
||||
WHERE id_evento = id_evento_to
|
||||
AND id = rec.id;
|
||||
|
||||
IF SQL%ROWCOUNT = 0 THEN
|
||||
INSERT INTO eventi_altricosti (
|
||||
id_evento,
|
||||
descrizione,
|
||||
costo,
|
||||
quantity
|
||||
)
|
||||
VALUES (
|
||||
id_evento_to,
|
||||
rec.descrizione,
|
||||
rec.costo,
|
||||
rec.quantity
|
||||
);
|
||||
END IF;
|
||||
END LOOP;
|
||||
END IF;
|
||||
END liste_copia;```
|
||||
41
docs/procedures/P_CANCEL_SAME_LOCATION_EVENTS.md
Normal file
41
docs/procedures/P_CANCEL_SAME_LOCATION_EVENTS.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# P_CANCEL_SAME_LOCATION_EVENTS
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "P_CANCEL_SAME_LOCATION_EVENTS" (p_good_event_id number) as
|
||||
-- ---------------------------
|
||||
-- Autore: Daniele Viti
|
||||
-- Data: 17/01/2020
|
||||
-- Descrizione: Controlla che ci siano più eventi con la stessa locazione e data di quello in esame e li annulla
|
||||
-- ---------------------------
|
||||
v_date date;
|
||||
v_idloc number;
|
||||
begin
|
||||
|
||||
begin
|
||||
-- Seleziono la data e la location per confrontarle dopo
|
||||
select data, id_location
|
||||
into v_date, v_idloc
|
||||
from eventi
|
||||
where id = p_good_event_id;
|
||||
exception when no_data_found then
|
||||
raise_application_error(-20001, 'Impossibile trovare l''evento da confermare');
|
||||
end;
|
||||
|
||||
for c in (
|
||||
select *
|
||||
from eventi
|
||||
where data = v_date
|
||||
and id_location = v_idloc
|
||||
and id != p_good_event_id
|
||||
) loop
|
||||
-- Imposta l'evento come obsoleto (annullato)
|
||||
UPDATE EVENTI
|
||||
SET
|
||||
FLG_SUPERATO = 1,
|
||||
STATO = 900
|
||||
WHERE ID = c.id;
|
||||
end loop;
|
||||
|
||||
end;```
|
||||
90
docs/procedures/README.md
Normal file
90
docs/procedures/README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Stored Procedures
|
||||
|
||||
Questa cartella contiene la documentazione di tutte le 11 stored procedures del database.
|
||||
|
||||
## Procedures Business Logic
|
||||
|
||||
| Procedura | Descrizione |
|
||||
|-----------|-------------|
|
||||
| [EVENTI_AGGIORNA_QTA_LISTA](EVENTI_AGGIORNA_QTA_LISTA.md) | Ricalcola tutte le quantità della lista prelievo |
|
||||
| [EVENTI_AGGIORNA_TOT_OSPITI](EVENTI_AGGIORNA_TOT_OSPITI.md) | Aggiorna il totale ospiti in testata evento |
|
||||
| [EVENTI_COPIA](EVENTI_COPIA.md) | Duplica un evento con tutti i dettagli |
|
||||
| [EVENTI_RICALCOLA_ACCONTI](EVENTI_RICALCOLA_ACCONTI.md) | Ricalcola gli importi degli acconti |
|
||||
| [EVENTO_ELIMINA_PRELIEVI](EVENTO_ELIMINA_PRELIEVI.md) | Elimina i prelievi di un evento |
|
||||
| [LISTE_COPIA](LISTE_COPIA.md) | Copia selettiva di liste tra due eventi |
|
||||
| [P_CANCEL_SAME_LOCATION_EVENTS](P_CANCEL_SAME_LOCATION_EVENTS.md) | Annulla eventi nella stessa location/data |
|
||||
|
||||
## Procedures Utility
|
||||
|
||||
| Procedura | Descrizione |
|
||||
|-----------|-------------|
|
||||
| [ROWSORT_TIPI](ROWSORT_TIPI.md) | Riordina i tipi materiale |
|
||||
| [HTPPRN](HTPPRN.md) | Output HTTP per APEX |
|
||||
| [SEND_DATA_TO_DROPBOX](SEND_DATA_TO_DROPBOX.md) | Export dati verso Dropbox |
|
||||
| [XLOG](XLOG.md) | Procedura di logging |
|
||||
|
||||
## Dettaglio Procedures Critiche
|
||||
|
||||
### EVENTI_AGGIORNA_QTA_LISTA
|
||||
|
||||
**Parametri:**
|
||||
- `p_id_evento NUMBER` - ID dell'evento
|
||||
|
||||
**Logica:**
|
||||
1. Cicla su tutti gli articoli nella lista prelievo
|
||||
2. Per ogni articolo determina il metodo di calcolo:
|
||||
- **Quantità Standard**: Se `QTA_STD_A/S/B` sono valorizzate
|
||||
- **Tovagliato/Caraffe**: Moltiplica per quantità tavoli/angoli
|
||||
- **Codice Relativo**: Moltiplica per quantità articolo di riferimento
|
||||
- **Standard**: Moltiplica coefficienti per totale ospiti
|
||||
3. Verifica disponibilità rispetto alla giacenza
|
||||
4. Aggiorna note con warning se quantità insufficiente
|
||||
|
||||
### EVENTI_COPIA
|
||||
|
||||
**Parametri:**
|
||||
- `id_evento_old NUMBER` - ID evento da copiare
|
||||
- `nuova_versione NUMBER DEFAULT 0` - 1 per creare nuova versione
|
||||
- `id_evento_new OUT NUMBER` - ID nuovo evento creato
|
||||
|
||||
**Logica:**
|
||||
1. Copia testata evento
|
||||
2. Se nuova versione: imposta `ID_EVT_PADRE`, incrementa `VERS_NUMBER`
|
||||
3. Aggiorna evento vecchio con `ID_EVT_FIGLIO`
|
||||
4. Copia tutte le tabelle dettaglio:
|
||||
- `EVENTI_DET_DEGUST`
|
||||
- `EVENTI_DET_OSPITI` (via UPDATE, non INSERT)
|
||||
- `EVENTI_DET_PREL`
|
||||
- `EVENTI_DET_RIS`
|
||||
- `EVENTI_ACCONTI`
|
||||
- `EVENTI_ALTRICOSTI`
|
||||
5. In caso di errore: elimina evento creato e solleva eccezione
|
||||
|
||||
### EVENTI_RICALCOLA_ACCONTI
|
||||
|
||||
**Parametri:**
|
||||
- `p_event_id NUMBER` - ID evento
|
||||
|
||||
**Logica:**
|
||||
1. Calcola totale evento dalle viste costo
|
||||
2. Se nessun acconto pagato:
|
||||
- Elimina acconti esistenti
|
||||
- Inserisce nuovi acconti con percentuali 30%-50%-20%
|
||||
3. Se acconti parzialmente pagati:
|
||||
- Mantiene importi pagati
|
||||
- Ricalcola solo acconti non pagati
|
||||
- Verifica che totale acconti ≤ totale evento
|
||||
|
||||
### LISTE_COPIA
|
||||
|
||||
**Parametri:**
|
||||
- `id_evento_from NUMBER` - Evento sorgente
|
||||
- `id_evento_to NUMBER` - Evento destinazione
|
||||
- `copia_degustazioni NUMBER DEFAULT 0`
|
||||
- `copia_prelievi NUMBER DEFAULT 0`
|
||||
- `copia_risorse NUMBER DEFAULT 0`
|
||||
- `copia_acconti NUMBER DEFAULT 0`
|
||||
- `copia_altricosti NUMBER DEFAULT 0`
|
||||
|
||||
**Logica:**
|
||||
Per ogni flag > 0 esegue un MERGE (UPDATE se esiste, INSERT altrimenti).
|
||||
145
docs/procedures/ROWSORT_TIPI.md
Normal file
145
docs/procedures/ROWSORT_TIPI.md
Normal file
@@ -0,0 +1,145 @@
|
||||
# ROWSORT_TIPI
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "ROWSORT_TIPI" (
|
||||
p_direc_cod IN VARCHAR2,
|
||||
o_return OUT CLOB
|
||||
) AS
|
||||
|
||||
v_direc VARCHAR2(4);
|
||||
v_cod_tipo VARCHAR2(10);
|
||||
v_cod_step NUMBER;
|
||||
v_cod_step_new NUMBER;
|
||||
v_return CLOB;
|
||||
BEGIN
|
||||
|
||||
-- Separo i valori in entrata su p_direc_cod 'direc_cod' in un array ( Es: 'desc_AN' => [ 'desc', 'AN' ] )
|
||||
---- Seleziono la direzione (asc o desc)
|
||||
SELECT
|
||||
upper(result)
|
||||
INTO v_direc
|
||||
FROM
|
||||
TABLE ( string_to_table_enum(p_string => p_direc_cod, v_level => 0, p_separator => '_') )
|
||||
WHERE
|
||||
id = 1;
|
||||
|
||||
---- Seleziono l'cod_tipo della riga da spostare
|
||||
|
||||
SELECT
|
||||
upper(result)
|
||||
INTO v_cod_tipo
|
||||
FROM
|
||||
TABLE ( string_to_table_enum(p_string => p_direc_cod, v_level => 0, p_separator => '_') )
|
||||
WHERE
|
||||
id = 2;
|
||||
|
||||
IF v_direc = 'ASC' THEN
|
||||
|
||||
-- Seleziono i numeri di riga
|
||||
SELECT
|
||||
cod_step,
|
||||
cod_step - 1
|
||||
INTO
|
||||
v_cod_step,
|
||||
v_cod_step_new
|
||||
FROM
|
||||
tb_tipi_mat
|
||||
WHERE
|
||||
upper(TRIM(cod_tipo)) = upper(TRIM(v_cod_tipo));
|
||||
|
||||
-- Libero i numeri di riga richiesti
|
||||
-- diminuendo il numero di riga di un valore inutilizzato (Es: 0.5)
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = cod_step - 0.5
|
||||
WHERE
|
||||
cod_tipo = v_cod_tipo;
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = cod_step - 0.5
|
||||
WHERE
|
||||
cod_step = v_cod_step_new;
|
||||
|
||||
-- Sposto la riga precedente al posto di quella selezionata (Es: row 1 diventerà row 2)
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = v_cod_step
|
||||
WHERE
|
||||
cod_step = v_cod_step_new - 0.5;
|
||||
|
||||
-- Sposto la riga selezionata al nuovo posto
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = v_cod_step_new
|
||||
WHERE
|
||||
cod_tipo = v_cod_tipo;
|
||||
|
||||
v_return := 'cod_tipo: '
|
||||
|| v_cod_tipo
|
||||
|| ' - From Row '
|
||||
|| v_cod_step
|
||||
|| ' - To Row '
|
||||
|| v_cod_step_new;
|
||||
|
||||
ELSIF v_direc = 'DESC' THEN
|
||||
|
||||
-- Seleziono i numeri di riga
|
||||
SELECT
|
||||
cod_step,
|
||||
cod_step + 1
|
||||
INTO
|
||||
v_cod_step,
|
||||
v_cod_step_new
|
||||
FROM
|
||||
tb_tipi_mat
|
||||
WHERE
|
||||
upper(TRIM(cod_tipo)) = upper(TRIM(v_cod_tipo));
|
||||
|
||||
-- Libero i numeri di riga richiesti
|
||||
-- diminuendo il numero di riga di un valore inutilizzato (Es: 0.5)
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = cod_step + 0.5
|
||||
WHERE
|
||||
cod_tipo = v_cod_tipo;
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = cod_step + 0.5
|
||||
WHERE
|
||||
cod_step = v_cod_step_new;
|
||||
|
||||
-- Sposto la riga precedente al posto di quella selezionata (Es: row 1 diventerà row 2)
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = v_cod_step
|
||||
WHERE
|
||||
cod_step = v_cod_step_new + 0.5;
|
||||
|
||||
-- Sposto la riga selezionata al nuovo posto
|
||||
|
||||
UPDATE tb_tipi_mat
|
||||
SET
|
||||
cod_step = v_cod_step_new
|
||||
WHERE
|
||||
cod_tipo = v_cod_tipo;
|
||||
|
||||
v_return := 'cod_tipo: '
|
||||
|| v_cod_tipo
|
||||
|| ' - From row. '
|
||||
|| v_cod_step
|
||||
|| ' - To row: '
|
||||
|| v_cod_step_new;
|
||||
|
||||
END IF;
|
||||
|
||||
o_return := v_return;
|
||||
END;```
|
||||
61
docs/procedures/SEND_DATA_TO_DROPBOX.md
Normal file
61
docs/procedures/SEND_DATA_TO_DROPBOX.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# SEND_DATA_TO_DROPBOX
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "SEND_DATA_TO_DROPBOX" (ondemand boolean := false) AS
|
||||
v_queryres clob := EMPTY_CLOB();
|
||||
v_file_name varchar2(255);
|
||||
|
||||
l_file UTL_FILE.FILE_TYPE;
|
||||
l_buffer RAW(32767);
|
||||
l_amount BINARY_INTEGER := 32767;
|
||||
l_pos INTEGER := 1;
|
||||
l_blob BLOB := EMPTY_BLOB();
|
||||
l_blob_len INTEGER;
|
||||
BEGIN
|
||||
|
||||
if ondemand then
|
||||
for c in (
|
||||
select 'test' as a from dual
|
||||
union all
|
||||
select 'test2' as a from dual
|
||||
) loop
|
||||
v_queryres := v_queryres || c.a;
|
||||
end loop;
|
||||
else
|
||||
v_queryres := 'test';
|
||||
end if;
|
||||
|
||||
l_blob := CLOB2BLOB(v_queryres);
|
||||
|
||||
l_blob_len := DBMS_LOB.getlength(l_blob);
|
||||
|
||||
if ondemand then
|
||||
v_file_name := 'backup_ondemand_'||to_char(sysdate, 'YYYYMMDDHH24MISS')||'.sql';
|
||||
else
|
||||
v_file_name := 'backup_'||to_char(sysdate, 'YYYYMMDD')||'.sql';
|
||||
end if;
|
||||
|
||||
l_file := UTL_FILE.fopen('DROPBOXBCK', v_file_name, 'wb', 32767);
|
||||
|
||||
-- Read chunks of the BLOB and write them to the file
|
||||
-- until complete.
|
||||
WHILE l_pos <= l_blob_len LOOP
|
||||
DBMS_LOB.read(l_blob, l_amount, l_pos, l_buffer);
|
||||
UTL_FILE.put_raw(l_file, l_buffer, TRUE);
|
||||
l_pos := l_pos + l_amount;
|
||||
END LOOP;
|
||||
|
||||
-- Close the file.
|
||||
UTL_FILE.fclose(l_file);
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
-- Close the file if something goes wrong.
|
||||
IF UTL_FILE.is_open(l_file) THEN
|
||||
UTL_FILE.fclose(l_file);
|
||||
END IF;
|
||||
RAISE;
|
||||
|
||||
END SEND_DATA_TO_DROPBOX;```
|
||||
19
docs/procedures/XLOG.md
Normal file
19
docs/procedures/XLOG.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# XLOG
|
||||
|
||||
## Codice Sorgente
|
||||
|
||||
```sql
|
||||
PROCEDURE "XLOG" (
|
||||
p_module IN VARCHAR2,
|
||||
p_msg IN VARCHAR2,
|
||||
p_type IN VARCHAR2 DEFAULT 'DEBUG',
|
||||
p_level PLS_INTEGER DEFAULT 15
|
||||
)
|
||||
IS
|
||||
BEGIN
|
||||
xlib_log.m (p_module => p_module,
|
||||
p_msg => p_msg,
|
||||
p_type => p_type,
|
||||
p_level => p_level
|
||||
);
|
||||
END xlog;```
|
||||
26
docs/sequences/README.md
Normal file
26
docs/sequences/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Sequences
|
||||
|
||||
| Nome | Min | Max | Increment | Last Number | Cache | Cycle |
|
||||
|------|-----|-----|-----------|-------------|-------|-------|
|
||||
| ARTICOLI_DET_REGOLE_SEQ | 1 | 9999999999999999999999999999 | 1 | 1 | 20 | N |
|
||||
| CLIENTI_SEQ | 1 | 9999999999999999999999999999 | 1 | 1 | 20 | N |
|
||||
| CLIENTI_SEQ1 | 1 | 9999999999999999999999999999 | 1 | 61 | 20 | N |
|
||||
| CLIENTI_SEQ2 | 1 | 9999999999999999999999999999 | 1 | 61 | 20 | N |
|
||||
| DEPT_SEQ | 1 | 9999999999999999999999999999 | 1 | 50 | 20 | N |
|
||||
| EMP_SEQ | 1 | 9999999999999999999999999999 | 1 | 8000 | 20 | N |
|
||||
| EVENTI_ACCONTI_SEQ | 1 | 9999999999999999999999999999 | 1 | 131158 | 20 | N |
|
||||
| EVENTI_ALLEG_SEQ | 1 | 9999999999999999999999999999 | 1 | 401 | 20 | N |
|
||||
| EVENTI_ALTRICOSTI_SEQ | 1 | 9999999999999999999999999999 | 1 | 5984 | 0 | N |
|
||||
| EVENTI_DET_DEGUST_SEQ | 1 | 9999999999999999999999999999 | 1 | 19008 | 20 | N |
|
||||
| EVENTI_DET_PREL_SEQ | 1 | 9999999999999999999999999999 | 1 | 181233 | 20 | N |
|
||||
| EVENTI_DET_RIS_SEQ | 1 | 9999999999999999999999999999 | 1 | 500 | 20 | N |
|
||||
| EVENTI_SEQ | 3503 | 9999999999999999999999999999 | 1 | 7808 | 0 | N |
|
||||
| GL_SCHEMA_CHANGES_SEQ | 1 | 9999999999999999999999999999 | 1 | 28 | 0 | N |
|
||||
| LOCATION_SEQ | 1 | 9999999999999999999999999999 | 1 | 8507 | 20 | N |
|
||||
| LOCATION_SEQ1 | 1 | 9999999999999999999999999999 | 1 | 1261 | 20 | N |
|
||||
| PERCORSI_SEQ | 1 | 9999999999999999999999999999 | 1 | 21 | 20 | N |
|
||||
| RISORSE_SEQ | 1 | 9999999999999999999999999999 | 1 | 401 | 20 | N |
|
||||
| RISORSE_SEQ1 | 1 | 9999999999999999999999999999 | 1 | 21 | 20 | N |
|
||||
| RISORSE_SEQ2 | 1 | 9999999999999999999999999999 | 1 | 1 | 20 | N |
|
||||
| TB_TIPI_PASTO_SEQ | 1 | 9999999999999999999999999999 | 1 | 21 | 20 | N |
|
||||
| XLIB_SEQ | 1 | 9999999999999999999999999999 | 1 | 21 | 20 | N |
|
||||
44
docs/tables/ARTICOLI.md
Normal file
44
docs/tables/ARTICOLI.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# ARTICOLI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| COD_ARTICOLO | VARCHAR2(10) | N | |
|
||||
| DESCRIZIONE | VARCHAR2(4000) | Y | |
|
||||
| COD_CATEG | VARCHAR2(10) | Y | |
|
||||
| RAW_DATA | BLOB | Y | |
|
||||
| CHARSET | VARCHAR2(4000) | Y | |
|
||||
| LAST_UPDATE | DATE | Y | |
|
||||
| FILENAME | VARCHAR2(4000) | Y | |
|
||||
| MIMETYPE | VARCHAR2(4000) | Y | |
|
||||
| COD_RELATIVO | VARCHAR2(10) | Y | |
|
||||
| COEFF | NUMBER | Y | 1 |
|
||||
| COEFF_A | NUMBER | Y | 1 |
|
||||
| COEFF_S | NUMBER | Y | 1 |
|
||||
| COEFF_B | NUMBER | Y | 1 |
|
||||
| QTA_STD_A | NUMBER | Y | |
|
||||
| QTA_STD_S | NUMBER | Y | |
|
||||
| QTA_STD_B | NUMBER | Y | |
|
||||
| FLG_CUCINA | NUMBER | Y | 0 |
|
||||
| QTA_GIAC | NUMBER | Y | 9999 |
|
||||
| RANK | NUMBER | Y | 0 |
|
||||
| PERC_OSPITI | NUMBER | N | 100 |
|
||||
| PERC_IVA | NUMBER | N | 10 |
|
||||
| FLG_QTA_TYPE | VARCHAR2(1) | Y | 'S' |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`COD_ARTICOLO`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| ARTICOLI_COD_REL | COD_ARTICOLO | ARTICOLI | COD_ARTICOLO |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| ARTICOLI_PK | UNIQUE | COD_ARTICOLO |
|
||||
20
docs/tables/ARTICOLI_DET_REGOLE.md
Normal file
20
docs/tables/ARTICOLI_DET_REGOLE.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# ARTICOLI_DET_REGOLE
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| COD_ARTICOLO | VARCHAR2(10) | N | |
|
||||
| ID | NUMBER | N | |
|
||||
| COD_RELATIVO | VARCHAR2(10) | Y | |
|
||||
| COEFF | NUMBER | Y | 1 |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID, COD_ARTICOLO`
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| ARTICOLI_DET_REGOLE_PK | UNIQUE | ID, COD_ARTICOLO |
|
||||
26
docs/tables/CLIENTI.md
Normal file
26
docs/tables/CLIENTI.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# CLIENTI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID | NUMBER | N | |
|
||||
| CLIENTE | VARCHAR2(100) | Y | |
|
||||
| NOME_RIF | VARCHAR2(100) | Y | |
|
||||
| COGNOME_RIF | VARCHAR2(100) | Y | |
|
||||
| RAGSOC | VARCHAR2(100) | Y | |
|
||||
| PIVA | VARCHAR2(20) | Y | |
|
||||
| INDIRIZZO | VARCHAR2(100) | Y | |
|
||||
| TEL1 | VARCHAR2(20) | Y | |
|
||||
| TEL2 | VARCHAR2(20) | Y | |
|
||||
| MAIL | VARCHAR2(100) | Y | |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| CLIENTI_PK | UNIQUE | ID |
|
||||
26
docs/tables/COSTI_ARTICOLI.md
Normal file
26
docs/tables/COSTI_ARTICOLI.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# COSTI_ARTICOLI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| COD_ARTICOLO | VARCHAR2(10) | N | |
|
||||
| DATA_COSTO | DATE | N | |
|
||||
| DESCRIZIONE | VARCHAR2(255) | Y | |
|
||||
| COSTO_UNI | NUMBER | Y | |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`COD_ARTICOLO, DATA_COSTO`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| COSTI_ARTICOLI_FK1 | COD_ARTICOLO | ARTICOLI | COD_ARTICOLO |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| COSTI_ARTICOLI_PK | UNIQUE | COD_ARTICOLO, DATA_COSTO |
|
||||
122
docs/tables/EVENTI.md
Normal file
122
docs/tables/EVENTI.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# EVENTI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID | NUMBER | N | |
|
||||
| DESCRIZIONE | VARCHAR2(4000) | Y | |
|
||||
| COD_TIPO | VARCHAR2(10) | Y | |
|
||||
| CLIENTE | VARCHAR2(100) | Y | |
|
||||
| INDIRIZZO | VARCHAR2(200) | Y | |
|
||||
| DATA | DATE | Y | |
|
||||
| TOT_OSPITI | NUMBER | Y | NULL |
|
||||
| STATO | NUMBER | Y | 0 |
|
||||
| TORTA_A | VARCHAR2(4000) | Y | |
|
||||
| NOTE | VARCHAR2(4000) | Y | |
|
||||
| DATA_DOC | DATE | Y | |
|
||||
| APX_USER | VARCHAR2(20) | Y | |
|
||||
| ID_CLIENTE | NUMBER | Y | |
|
||||
| ID_LOCATION | NUMBER | Y | |
|
||||
| FLG_TEMPLATE | NUMBER | Y | 0 |
|
||||
| ORA_CERIMONIA | DATE | Y | |
|
||||
| ORA_EVENTO | DATE | Y | |
|
||||
| PERC_SEDUTE_APER | NUMBER | Y | |
|
||||
| CONFETTATA_A | VARCHAR2(4000) | Y | |
|
||||
| STAMPA_MENU | VARCHAR2(100) | Y | |
|
||||
| ALLERGIE | VARCHAR2(4000) | Y | |
|
||||
| EXTRA_INFO | VARCHAR2(1000) | Y | |
|
||||
| EXTRA_COSTI | VARCHAR2(1000) | Y | |
|
||||
| NUM_LISTA | NUMBER | Y | 0 |
|
||||
| DISTANZA_LOCATION | VARCHAR2(1000) | Y | |
|
||||
| PRIMI | VARCHAR2(4000) | Y | |
|
||||
| SECONDI | VARCHAR2(4000) | Y | |
|
||||
| VINI | VARCHAR2(4000) | Y | |
|
||||
| CARICOSPOSI | VARCHAR2(4000) | Y | |
|
||||
| CARICOAPOLL | VARCHAR2(4000) | Y | |
|
||||
| STILE_COLORI | VARCHAR2(255) | Y | |
|
||||
| ALLEST_BUFF | VARCHAR2(4000) | Y | |
|
||||
| GIRO_BRACCIO | VARCHAR2(255) | Y | |
|
||||
| GRAN_BUFFET_A | VARCHAR2(4000) | Y | |
|
||||
| SERVIZIO_TAVOLO_A | VARCHAR2(4000) | Y | |
|
||||
| BUFFET_DOLCI_A | VARCHAR2(4000) | Y | |
|
||||
| CLIENTE_TEL | VARCHAR2(255) | Y | |
|
||||
| CLIENTE_EMAIL | VARCHAR2(255) | Y | |
|
||||
| REFERENTE_TEL | VARCHAR2(255) | Y | |
|
||||
| BUFFET_INIZIALE | VARCHAR2(4000) | Y | |
|
||||
| BUFFET_FINALE | VARCHAR2(4000) | Y | |
|
||||
| TIPOL_TAV_SPOSI | VARCHAR2(255) | Y | |
|
||||
| TIPOL_TAV_OSPITI | VARCHAR2(255) | Y | |
|
||||
| SEDIA | VARCHAR2(255) | Y | |
|
||||
| TOVAGLIA | VARCHAR2(255) | Y | |
|
||||
| TOVAGLIOLO | VARCHAR2(255) | Y | |
|
||||
| RUNNER | VARCHAR2(255) | Y | |
|
||||
| SOTTOPIATTI | VARCHAR2(255) | Y | |
|
||||
| PIATTINO_PANE | VARCHAR2(255) | Y | |
|
||||
| POSATE | VARCHAR2(255) | Y | |
|
||||
| BICCHIERI | VARCHAR2(255) | Y | |
|
||||
| NUM_FLORIST | VARCHAR2(255) | Y | |
|
||||
| NUM_MUSICISTI | VARCHAR2(255) | Y | |
|
||||
| NUM_FOTOGRAFI | VARCHAR2(255) | Y | |
|
||||
| NUM_ALTRI | VARCHAR2(4000) | Y | |
|
||||
| BUFFET | VARCHAR2(255) | Y | |
|
||||
| BUFFET_SEDIE | VARCHAR2(255) | Y | |
|
||||
| BUFFET_TAVOLI | VARCHAR2(255) | Y | |
|
||||
| CONFETTATA_B | VARCHAR2(4000) | Y | |
|
||||
| GRAN_BUFFET_B | VARCHAR2(4000) | Y | |
|
||||
| SERVIZIO_TAVOLO_B | VARCHAR2(4000) | Y | |
|
||||
| BUFFET_DOLCI_B | VARCHAR2(4000) | Y | |
|
||||
| TORTA_B | VARCHAR2(4000) | Y | |
|
||||
| TORTA | VARCHAR2(4000) | Y | |
|
||||
| CONFETTATA | VARCHAR2(4000) | Y | |
|
||||
| ALTRO | VARCHAR2(4000) | Y | |
|
||||
| FLG_SUPERATO | NUMBER | Y | 0 |
|
||||
| DATA_SCAD_PREVENTIVO | DATE | Y | |
|
||||
| PIATTI | VARCHAR2(4000) | Y | |
|
||||
| NOTE_INVIO | VARCHAR2(1000) | Y | |
|
||||
| PRE_BOUV_A | VARCHAR2(4000) | Y | |
|
||||
| PRE_BOUV_B | VARCHAR2(4000) | Y | |
|
||||
| ALTRO_A | VARCHAR2(4000) | Y | |
|
||||
| ALTRO_B | VARCHAR2(4000) | Y | |
|
||||
| DATORASCARICO | DATE | Y | |
|
||||
| DATORASCARICO_NOTE | VARCHAR2(4000) | Y | |
|
||||
| IS_TEMPLATE | NUMBER | N | 0 |
|
||||
| ID_EVT_PADRE | NUMBER | Y | |
|
||||
| ID_EVT_FIGLIO | NUMBER | Y | |
|
||||
| VERS_NUMBER | NUMBER | N | 0 |
|
||||
| VERS_TOKEN | VARCHAR2(255) | Y | |
|
||||
| DISABLED | NUMBER | N | 0 |
|
||||
| DELETED | NUMBER | N | 0 |
|
||||
| DELETED_BY | VARCHAR2(255) | Y | |
|
||||
| DELETED_DATE | DATE | Y | NULL |
|
||||
| ORA_FINE_CERIMONIA | DATE | Y | |
|
||||
| ORA_FINE_EVENTO | DATE | Y | |
|
||||
| MAIL_ENABLED | NUMBER | N | 0 |
|
||||
| CONTRATTO_FIRMATO | NUMBER | N | 0 |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| EVENTI_CLIENTE_FK | ID_CLIENTE | CLIENTI | ID |
|
||||
| EVENTI_LOCATION_FK | ID_LOCATION | LOCATION | ID |
|
||||
| EVENTI_TIPO_FK | COD_TIPO | TB_TIPI_EVENTO | COD_TIPO |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_IDX1 | UNIQUE | ID, ID_EVT_PADRE |
|
||||
| EVENTI_IDX2 | UNIQUE | ID, ID_EVT_FIGLIO |
|
||||
| EVENTI_ID_EVT_FIGLIO_IDX | NONUNIQUE | ID_EVT_FIGLIO |
|
||||
| EVENTI_ID_EVT_PADRE_IDX | NONUNIQUE | ID_EVT_PADRE |
|
||||
| EVENTI_INDEX1 | NONUNIQUE | DATA, STATO |
|
||||
| EVENTI_INDEX2 | NONUNIQUE | STATO |
|
||||
| EVENTI_IS_TEMPLATE_IDX | NONUNIQUE | IS_TEMPLATE |
|
||||
| EVENTI_PK | UNIQUE | ID |
|
||||
| EVENTI_VERS_NUMBER_IDX | NONUNIQUE | VERS_NUMBER |
|
||||
| EVENTI_VERS_TOKEN_IDX | NONUNIQUE | VERS_TOKEN |
|
||||
29
docs/tables/EVENTI_ACCONTI.md
Normal file
29
docs/tables/EVENTI_ACCONTI.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# EVENTI_ACCONTI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID | NUMBER | N | |
|
||||
| DATA | DATE | Y | NULL |
|
||||
| ACCONTO | NUMBER | N | |
|
||||
| ID_EVENTO | NUMBER | N | |
|
||||
| A_CONFERMA | NUMBER | N | 0 |
|
||||
| ORDINE | NUMBER | N | 0 |
|
||||
| DESCRIZIONE | VARCHAR2(255) | Y | |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| EVENTI_ACCONTI_FK1 | ID_EVENTO | EVENTI | ID |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_ACCONTI_PK | UNIQUE | ID |
|
||||
24
docs/tables/EVENTI_ALLEG.md
Normal file
24
docs/tables/EVENTI_ALLEG.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# EVENTI_ALLEG
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID | NUMBER | N | |
|
||||
| EVENT_ID | NUMBER | N | |
|
||||
| RAW_DATA | BLOB | Y | |
|
||||
| CHARSET | VARCHAR2(255) | Y | |
|
||||
| MIME_TYPE | VARCHAR2(255) | Y | |
|
||||
| LAST_UPDATE | DATE | Y | sysdate |
|
||||
| FILENAME | VARCHAR2(255) | Y | |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_ALLEG_INDEX1 | NONUNIQUE | EVENT_ID |
|
||||
| EVENTI_ALLEG_PK | UNIQUE | ID |
|
||||
28
docs/tables/EVENTI_ALTRICOSTI.md
Normal file
28
docs/tables/EVENTI_ALTRICOSTI.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# EVENTI_ALTRICOSTI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID | NUMBER | N | |
|
||||
| ID_EVENTO | NUMBER | N | |
|
||||
| DESCRIZIONE | VARCHAR2(255) | N | |
|
||||
| COSTO | NUMBER | N | |
|
||||
| QUANTITY | NUMBER | Y | 1 |
|
||||
| ORDINE | NUMBER | N | 0 |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| EVENTI_ALTRICOSTI_FK1 | ID_EVENTO | EVENTI | ID |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_ALTRICOSTI_PK | UNIQUE | ID |
|
||||
32
docs/tables/EVENTI_DET_DEGUST.md
Normal file
32
docs/tables/EVENTI_DET_DEGUST.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# EVENTI_DET_DEGUST
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID_EVENTO | NUMBER | N | |
|
||||
| ID | NUMBER | N | |
|
||||
| DATA | DATE | Y | |
|
||||
| ORA | VARCHAR2(20) | Y | |
|
||||
| NOME | VARCHAR2(1000) | Y | |
|
||||
| TELEFONO | VARCHAR2(20) | Y | |
|
||||
| EMAIL | VARCHAR2(20) | Y | |
|
||||
| LOCATION | VARCHAR2(1000) | Y | |
|
||||
| N_PERSONE | NUMBER | Y | |
|
||||
| MENU | VARCHAR2(1000) | Y | |
|
||||
| N_PAGANTI | NUMBER | Y | |
|
||||
| NOTE | VARCHAR2(4000) | Y | |
|
||||
| N_DEGUSTAZIONE | NUMBER | Y | |
|
||||
| CONSUMATA | NUMBER | N | 0 |
|
||||
| COSTO_DEGUSTAZIONE | NUMBER | Y | |
|
||||
| DETRAIBILE | NUMBER | N | 0 |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID_EVENTO, ID`
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_DET_DEGUST_PK | UNIQUE | ID_EVENTO, ID |
|
||||
30
docs/tables/EVENTI_DET_OSPITI.md
Normal file
30
docs/tables/EVENTI_DET_OSPITI.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# EVENTI_DET_OSPITI
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID_EVENTO | NUMBER | N | |
|
||||
| COD_TIPO_OSPITE | VARCHAR2(10) | N | |
|
||||
| NUMERO | NUMBER | Y | 0 |
|
||||
| NOTE | VARCHAR2(4000) | Y | |
|
||||
| COSTO | NUMBER | Y | 0 |
|
||||
| SCONTO | NUMBER | Y | 0 |
|
||||
| ORDINE | NUMBER | Y | |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID_EVENTO, COD_TIPO_OSPITE`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| EVENTI_DET_OSPITI_IDEV_FK | ID_EVENTO | EVENTI | ID |
|
||||
| EVENTI_DET_OSPITI_TIPO_FK | COD_TIPO_OSPITE | TB_TIPI_OSPITI | COD_TIPO |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_DET_OSPITI_PK | UNIQUE | ID_EVENTO, COD_TIPO_OSPITE |
|
||||
38
docs/tables/EVENTI_DET_PREL.md
Normal file
38
docs/tables/EVENTI_DET_PREL.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# EVENTI_DET_PREL
|
||||
|
||||
## Struttura
|
||||
|
||||
| Colonna | Tipo | Nullable | Default |
|
||||
|---------|------|----------|----------|
|
||||
| ID_EVENTO | NUMBER | N | |
|
||||
| ID | NUMBER | N | |
|
||||
| COD_ARTICOLO | VARCHAR2(10) | N | |
|
||||
| QTA | NUMBER | Y | 0 |
|
||||
| NOTE | VARCHAR2(4000) | Y | |
|
||||
| QTA_APE | NUMBER | Y | 0 |
|
||||
| QTA_SEDU | NUMBER | Y | 0 |
|
||||
| QTA_BUFDOL | NUMBER | Y | 0 |
|
||||
| QTA_MAN_APE | NUMBER | Y | 0 |
|
||||
| QTA_MAN_SEDU | NUMBER | Y | 0 |
|
||||
| QTA_MAN_BUFDOL | NUMBER | Y | 0 |
|
||||
| COSTO_ARTICOLO | NUMBER | Y | |
|
||||
| PERC_OSPITI | NUMBER | Y | |
|
||||
| ORDINE | NUMBER | N | 0 |
|
||||
|
||||
## Primary Key
|
||||
|
||||
`ID`
|
||||
|
||||
## Foreign Keys
|
||||
|
||||
| Constraint | Colonna | Tabella Ref | Colonna Ref |
|
||||
|------------|---------|-------------|-------------|
|
||||
| EVENTI_DET_PREL_ART_FK | COD_ARTICOLO | ARTICOLI | COD_ARTICOLO |
|
||||
| EVENTI_DET_PREL_IDEV_FK | ID_EVENTO | EVENTI | ID |
|
||||
|
||||
## Indici
|
||||
|
||||
| Nome | Unique | Colonne |
|
||||
|------|--------|----------|
|
||||
| EVENTI_DET_PREL_IDX_COD_ART | UNIQUE | ID_EVENTO, COD_ARTICOLO |
|
||||
| EVENTI_DET_PREL_PK | UNIQUE | ID |
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user