Import eFactura in lot: borderou, contabilizare in serie, alegerea contului (2.11.75)

Borderoul arata pentru fiecare factura ce mai are de completat (conturi, gestiuni,
analitice) si daca are articole de gestiune, cu filtru pe fiecare. Facturile complete
se contabilizeaza in serie, cu rezumat la final. Contul de furnizor/client se alege
din planul de conturi, cu analiticul cerut imediat dupa. Cheia normalizata de articol
si anularea in bloc a documentelor generate din import intra tot aici.

Livrat in SVN r18075-18077. Materialul de lucru din docs/ e sters.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aroafxp4z8bmM5oVECZRXY
This commit is contained in:
2026-09-09 22:01:50 +03:00
parent 2fed7f8838
commit a2baead7c0
17 changed files with 60 additions and 2091 deletions

View File

@@ -263,6 +263,19 @@ Explicatiile, dovezile si descoperirile colaterale merg in `docs/`, cu un link.
raspuns rationamentul, nu se explica de ce a fost greu, nu se justifica alegerile decat daca
sunt cerute.
## gstack
Foloseste skill-ul `/browse` din gstack pentru tot browsing-ul web; nu mai folosi
tool-urile `mcp__claude-in-chrome__*`.
Skill-uri disponibile din gstack: `/office-hours`, `/plan-ceo-review`, `/plan-eng-review`,
`/plan-design-review`, `/design-consultation`, `/design-shotgun`, `/design-html`, `/review`,
`/ship`, `/land-and-deploy`, `/canary`, `/benchmark`, `/browse`, `/connect-chrome`, `/qa`,
`/qa-only`, `/design-review`, `/setup-browser-cookies`, `/setup-deploy`, `/setup-gbrain`,
`/retro`, `/investigate`, `/document-release`, `/document-generate`, `/codex`, `/cso`,
`/autoplan`, `/plan-devex-review`, `/devex-review`, `/careful`, `/freeze`, `/guard`,
`/unfreeze`, `/gstack-upgrade`, `/learn`.
## Skill routing
When the user's request matches an available skill, invoke it via the Skill tool. When in doubt, invoke the skill.

View File

@@ -1209,7 +1209,7 @@ DEFINE CLASS frm_introd_compact AS formtermin OF "..\comun\clase\baza.vcx"
ENDPROC
PROCEDURE Show
LPARAMETERS nStyle
LPARAMETERS nStyle, tnTop
lcObj = ALLTRIM(this.pcobj)
@@ -4567,7 +4567,7 @@ DEFINE CLASS frm_introd_compact2007 AS formtermin OF "..\comun\clase\baza.vcx"
ENDPROC
PROCEDURE Show
Lparameters nStyle
Lparameters nStyle, tnTop
*!* modificare ROACONT v 2.5.45 : am modificat anchor-ul de la gridb1 ( de la 15 la 11 ) si item1 ( de la 12 la 8 )
*!* pentru ca atunci cand se modifica inaltimea ferestrei, gridul si itemul erau ancorate in jos pe absolut si se
*!* "ridicau" pe masura ce se diminua inaltimea ferestrei
@@ -4651,6 +4651,13 @@ DEFINE CLASS frm_introd_compact2007 AS formtermin OF "..\comun\clase\baza.vcx"
lnHeight = this.Height
this.WindowState= 2
this.Height = MAX(m.lnHeight, INT(_screen.Height*2/3))
If Vartype(m.tnTop) = 'N' And m.tnTop > 0
this.WindowState = 0
this.Left = 0
this.Top = m.tnTop
this.Width = _screen.Width
this.Height = _screen.Height - m.tnTop
Endif
This.gridb1.column22.Visible = m.gl406 && taxcode
This.gridb1.column23.Visible = m.gl406 && taxcode descriere

View File

@@ -212,7 +212,10 @@ SET PROCEDURE TO ofacturare_comun.prg ADDITIVE
SET PROCEDURE TO ofacturare_editare.prg ADDITIVE
SET PROCEDURE TO oproceduri_facturare.prg ADDITIVE
SET PROCEDURE TO anaf_efactura.prg ADDITIVE
SET PROCEDURE TO import_efactura.prg ADDITIVE
SET PROCEDURE TO recunoastere_articol_ef.prg ADDITIVE
SET PROCEDURE TO import_efactura.prg ADDITIVE
SET PROCEDURE TO anulare_lot_ef.prg ADDITIVE
SET PROCEDURE TO coada_contabilizare_ef.prg ADDITIVE
SET PROCEDURE TO xmlefactura.prg ADDITIVE
SET PROCEDURE TO oscrie_in_fisiere.prg ADDITIVE

View File

@@ -1,5 +1,36 @@
<!--
09/09/2026
ROACONT - 2.11.75
:modificare:
Import eFactura. S-a imbunatatit potrivirea articolelor din factura cu cele din ROA: pe langa
catalog si istoricul furnizorului, programul se uita si la acelasi articol contat oriunde in
firma si la restul liniilor facturii, iar denumirile care difera doar prin cifre (abonamente
lunare, loturi) se potrivesc si ele. Masurat pe un an de facturi din 21 de firme, contul se
propune acum pe 97% din linii, fata de 78% inainte; la fel se propun gestiunea si analiticul.
:nou:
Import eFactura. Borderoul arata pentru fiecare factura cate conturi, gestiuni sau analitice mai
are de completat si daca are articole de gestiune, fara sa intri pe ea. Lista se poate restrange
la facturile neterminate sau la cele cu articole de gestiune.
:nou:
Import eFactura. Facturile care nu mai au nimic de completat se pot bifa si contabiliza in serie,
una dupa alta, cu notele afisate spre confirmare la fiecare factura, ca si pana acum. Cele carora
le lipseste ceva sunt sarite, iar la final apare un rezumat cu ce a intrat si ce nu, cu motivul.
:nou:
Import eFactura. Anularea in bloc a documentelor generate din import.
:nou:
Import eFactura. Contul de furnizor sau de client al facturii se poate alege din planul de
conturi, cu dublu click pe el, iar analiticul se cere imediat dupa.
:nou:
Configurare eFactura. Optiuni pentru modul de propunere a contului.
-->
<!--
09/09/2026
ROACONT - 2.11.74
:modificare:

View File

@@ -1,173 +0,0 @@
# Backtest: identificarea partenerului la importul de extrase
Masurat 03.09.2026 pe serverul `10.0.20.36` (`ROA_ROMFAST`), conectat ca `ROMFAST`, citire
incrucisata pe schemele cabinetului. Doar `SELECT`. Datele extrase (denumiri de parteneri, IBAN-uri)
au ramas in directorul temporar al sesiunii, **nu sunt in repo**.
## Ce s-a masurat si de ce altfel decat prima data
Masuratoarea din `BACKTEST_VENDING.md` sectiunea 8 numara doar daca `ID_FACTD/ID_FACTC` e completat, si
a dat 100%. Cifra e reala, dar nu spune nimic: imperecherea o face operatorul, manual sau confirmand
propunerea importului. Nu exista tabel de audit - corectiile din `frm_modific2024` se fac inainte de
scrierea in `ACT` (`Programe\ocont2003.prg:1245-1257`).
Ce se poate face totusi: liniile venite din import sunt identificabile (`ID_SET = 90023`), iar textul
bancii se pastreaza in `ACT.EXPLICATIA`. Se ia fiecare linie in ordine cronologica, se aplica pe ea
regula (fara sa vada viitorul) si se compara cu partenerul care e efectiv inregistrat pe linie - adica
adevarul confirmat de operator. Asta e un backtest onest, nu o estimare.
Populatia: liniile de banca cu contrapartida 401/411 si partener completat, ultimele 12 luni incheiate.
**3.490 de linii, 7 firme.** Celelalte 14 firme ale cabinetului nu folosesc deloc importul de extras
(zero linii cu `ID_SET = 90023`).
## Rezultatul
| | linii pre-completate corect | acoperire | precizie |
|---|---|---|---|
| **Azi** (denumire de pe pozitie fixa, potrivire exacta) | 161 din 3.490 | **4,6%** | - |
| **Cheie invatata din istoric**, cu garda de unicitate | 974 din 3.490 | **28,5%** | **97,9%** |
Pe firme, varianta propusa:
| Firma | linii/an | gasite | precizie |
|---|---|---|---|
| ROMFAST (export Banca Transilvania) | 400 | 79,5% | 99,4% |
| COTOFANACONCEPT | 85 | 50,6% | 97,7% |
| PASS | 1.486 | 29,1% | 99,3% |
| INTERIOR | 187 | 16,6% | 83,9% |
| TURQUOISE | 1.176 | 13,2% | 96,1% |
| CERAMOTERM | 153 | 10,5% | 75,0% |
| CUX | 3 | 0% | - |
## Cum arata regula masurata
Pentru fiecare linie se construiesc doua chei: IBAN-ul, daca descrierea contine unul, si textul
descrierii normalizat (se taie tipul tranzactiei de la inceput, se sterg datele calendaristice si
toate cifrele, se pastreaza primele 24 de caractere). Se propune partenerul doar daca acea cheie a
aparut in istoricul firmei **si a dus de fiecare data la acelasi partener**. Daca cheia a fost
ambigua macar o data, nu se propune nimic.
Garda de unicitate nu e un detaliu: fara ea, aceeasi masuratoare da 58,3% acoperire dar **56,4%
precizie** - adica aproape jumatate din propuneri gresite, ceea ce ar face functia inutilizabila.
## De ce difera atat de mult intre firme
Nu tine de firma, tine de ce trimite banca in descriere.
- La ROMFAST (export Banca Transilvania) descrierea contine denumirea comerciantului sau a
partenerului: `INCASARE OP;FF 2026161;<DENUMIRE FURNIZOR> SRL;<IBAN>;...`. Cheia e stabila si
se invata dupa prima aparitie.
- La TURQUOISE si CERAMOTERM banca trimite doar numere de referinta:
`CV FACT NR 4463/02.12.2025 REFERINTA INSTANT: 1764758837752667950764`. Dupa stergerea cifrelor
ramane `CV FACT NR REFERINTA INS` - un text generic pe care il au 611 linii cu 76 de parteneri
diferiti. Garda de unicitate observa asta si **refuza sa propuna**, ceea ce e comportamentul corect.
Concluzia practica: regula se auto-regleaza dupa format. Acolo unde banca da informatie, propune mult
si bine; acolo unde nu da, tace. Nu are nevoie de configurare per banca.
## Doua constatari colaterale
**IBAN-ul extras de parser nu ajunge niciodata in baza.** Din 879 de linii importate la ROMFAST,
`EXPLICATIA4` (unde `Programe\oproceduri_import.prg:902` scrie IBAN-ul) e goala la 878. Iar in
nomenclator doar 174 din 3.880 de parteneri activi (4,5%) au `CONT_BANCA` completat. Deci cheia de
cautare dupa IBAN, care ar fi cea mai sigura, nu are azi de unde sa functioneze. Daca importul ar
salva IBAN-ul pe partener atunci cand operatorul confirma potrivirea, nomenclatorul s-ar umple singur
si cheia ar deveni utilizabila in cateva luni.
**Platile la POS sunt cazul cel mai prost tratat azi.** La ROMFAST sunt 115 linii pe an catre 33 de
comercianti distincti (abonamente software, magazine online, telecom). Parserul pune pe pozitia denumirii numele
**propriei firme** (`ROMFAST SRL`), deci cautarea de partener nu are cum sa reuseasca; denumirea reala
a comerciantului e in textul EPOS, care azi nu e folosit. Aceleasi linii, cu regula invatata: 70,4%
gasite la 95,1% precizie.
## Reproducere
Scripturile de extragere sunt in sesiune, nu in repo (contin denumiri de parteneri). Interogarea de
baza, per schema:
```sql
select to_char(a.dataact,'yyyy-mm-dd'),
case when substr(a.scd,1,3) in ('401','411') then pd.denumire else pc.denumire end,
a.explicatia
from <SCHEMA>.act a
left join <SCHEMA>.nom_parteneri pd on pd.id_part = a.id_partd
left join <SCHEMA>.nom_parteneri pc on pc.id_part = a.id_partc
where nvl(a.sters,0)=0 and nvl(a.id_set,0)=90023
and a.dataact >= add_months(trunc(sysdate,'MM'),-12) and a.dataact < trunc(sysdate,'MM')
and (substr(a.scd,1,3)='512' or substr(a.scc,1,3)='512')
and (substr(a.scd,1,3) in ('401','411') or substr(a.scc,1,3) in ('401','411'))
and (case when substr(a.scd,1,3) in ('401','411') then a.id_partd else a.id_partc end) > 0
order by a.dataact;
```
Capcana in care am cazut si eu: partenerul trebuie luat **de pe latura contului 401/411**, nu cu
`nvl(id_partd, id_partc)` - pe latura contului de banca partenerul e contul bancar al firmei, si
masuratoarea iese fals de buna.
---
## Limitele impuse de formate si de ce scriu bancile (masurat 03.09.2026)
Trei obiectii reale, verificate pe date, nu admise pe cuvant.
### 1. Bancile nu au acelasi format
Adevarat, si codul o arata: `ExtrasBanca_General::Parse` (`Programe\oproceduri_import.prg:1417`)
recunoaste dupa antet ~25 de formate CSV (Stripe, PayU, Intesa, Garanti, OTP, Raiffeisen, Unicredit,
ING, BT, PayPal, BRD, BCR, First Bank, CEC, MobilPay, Idea, CreditEurope, Alpha ...), plus MT940 si
doua formate XML.
Tocmai de asta cheia invatata din istoric e raspunsul potrivit: **nu depinde de format.** Cele 7 firme
masurate folosesc banci si formate diferite, iar aceeasi regula, fara nicio configurare per banca, a dat
79,5% la ROMFAST, 50,6% la COTOFANACONCEPT, 29,1% la PASS si 10-17% acolo unde banca nu trimite nimic
util. Nu trebuie scris cod pentru fiecare banca; regula invata ce trimite banca fiecarei firme.
### 2. Nu toate bancile completeaza codul fiscal al platitorului
Adevarat si masurabil in cod: din locurile unde parserele scriu in cursorul de import
(`oproceduri_import.prg`), o parte scriu doar denumirea (`Replace tert With ...`, ex. liniile 3579,
3944, 4131), altele scriu si IBAN, si doar unele scriu si codul fiscal (liniile 1618, 2080, 2746, 2824,
3244, 3908, 3984, 4047). La Banca Transilvania codul fiscal e fixat gol neconditionat
(`oproceduri_import.prg:3015`).
Consecinta: cheia cea mai sigura - codul fiscal - nu e disponibila la majoritatea formatelor, iar cheia
de rezerva - IBAN-ul - nu are pe ce lucra pentru ca nomenclatorul are IBAN doar la 4,5% dintre
parteneri. Ramane textul, si de aceea el trebuie invatat, nu citit de pe o pozitie fixa.
### 3. Nu toti scriu numarul documentului platit, si explicatiile sunt libere
**Aceasta e obiectia care schimba o concluzie.** Masurat pe 3.074 de linii de banca pe care operatorul
le-a legat de o factura, la cele 7 firme: numarul acelei facturi apare in textul bancii doar in **25,0%**
din cazuri. In 73,9% din cazuri textul contine numere, dar altele - referinte, numere de OP, coduri de
tranzactie.
| Firma | linii legate de factura | numarul facturii chiar e in text |
|---|---|---|
| TURQUOISE | 784 | 56,6% |
| ROMFAST | 317 | 46,4% |
| INTERIOR | 123 | 17,1% |
| CERAMOTERM | 113 | 15,0% |
| COTOFANACONCEPT | 87 | 11,5% |
| PASS | 1.462 | 8,8% |
| CUX | 188 | 0% |
Deci **plafonul teoretic** al oricarei imbunatatiri care cauta factura dupa numarul din explicatie este
25%, si la unele firme aproape zero. Operatorul nu citeste numarul din text - el stie din suma, din
partener si din soldul deschis care factura se achita.
Alternativa masurata: dupa ce partenerul e cunoscut, cat de des suma platii identifica singura un
document?
| | linii | suma identifica exact un document | din care corect |
|---|---|---|---|
| toate cele 7 firme | 3.490 | **21,2%** | **89,9%** |
Si aici precizia e prea mica pentru completare automata (aproape una din zece gresita), iar in 7,0% din
linii suma se potriveste pe mai multe documente deodata.
**Concluzia care se schimba:** partea de factura a importului de extrase nu are un castig mare de
automatizare, indiferent cat de bine se scrie algoritmul - informatia lipseste din fisier in trei
sferturi din cazuri. Efortul merita mutat de la "gaseste factura singur" la "arata-i operatorului
lista scurta a documentelor deschise ale partenerului, ordonate dupa cat de bine se potriveste suma",
ca sa aleaga dintr-o lista in loc sa caute. Ceea ce face utila si aici imbunatatirea de la partener:
fara partener nu exista lista scurta.

View File

@@ -1,309 +0,0 @@
# Backtest pe productie: schemele VENDING si ROMFAST, 12 luni reale
> Subiectul "banca" (identificare partener/factura la import extras) e tratat separat, cu
> masuratori valide, in `BACKTEST_BANCA.md`.
> Sectiunile 1-5 sunt masurate pe `VENDING`. Sectiunea 6 repeta acelasi backtest pe `ROMFAST`
> (alt server, alt profil de firma) si compara.
Data: 03.09.2026. Instanta: `XEPDB1` (Oracle 18c XE), schema **`VENDING`**, prin tunel SSH
(`D:\roa\BITVISE\vending.tlp`, alias TNS `VENDING`). **Strict read-only** - doar `SELECT`.
Interval: 01.09.2025 - 31.08.2026 (12 luni incheiate). Scripturile care au produs fiecare cifra sunt
in `sql\bt_*.sql` din acest folder si se pot rula din nou.
Aceasta e prima masuratoare pe date reale din toata cercetarea. Rundele anterioare foloseau
`MARIUSM_AUTO`, o schema de proba cu 1174 de linii si campuri "TEST" - cifrele de acolo nu
insemnau nimic.
---
## 1. Cat de mare e clientul
| Marime | Valoare |
|---|---|
| Linii in `ACT`, total istoric | 1.309.438 |
| Documente in ultimele 12 luni | ~39.300 |
| Facturi de intrare (credit 401) in 12 luni | **1.864** (~155 pe luna) |
| Furnizori distincti in 12 luni | 263 |
| eFacturi primite in 12 luni | **1.672** (~140 pe luna) |
| Linii de banca in 12 luni | 26.894 (~2.300 pe luna) |
| Linii de casa in 12 luni | ~3.240 |
Facturile de intrare sunt simple: 1.195 din 1.864 au exact 2 linii, 263 au 4 linii. Doar 11
documente depasesc 15 linii. Concentrarea pe furnizori: top 20 acopera 38,9% din facturi, top 50
acopera 62,4%, top 100 acopera 84,9%.
---
## 2. Backtestul de contare pe istoricul furnizorului
**Metoda.** Pentru fiecare factura de intrare din ultimele 12 luni se construieste o *semnatura*:
lista sortata a conturilor de debit distincte ale documentului, fara conturile de TVA (442x). Se
prezice semnatura din documentele **anterioare** ale aceluiasi furnizor (fereastra de istoric: 36 de
luni), niciodata din viitor. Se compara predictia cu ce s-a contat efectiv.
### 2.1 Regula simpla: cel mai frecvent tipar anterior al furnizorului
| Verdict | Documente | Procent |
|---|---|---|
| Potrivit, cu cel putin 3 documente anterioare | 1.294 | 69,4% |
| Gresit, cu cel putin 3 documente anterioare | 358 | 19,2% |
| Potrivit, cu 1-2 documente anterioare | 68 | 3,6% |
| Gresit, cu 1-2 documente anterioare | 54 | 2,9% |
| Furnizor nou, fara istoric | 90 | 4,8% |
### 2.2 Cu poarta de incredere: cat de strict trebuie sa fie "verde"
Se exclud documentele a caror semnatura de debit e chiar 401 (compensari si corectii, nu facturi de
cheltuiala): raman 1.817 documente. "Verde" inseamna ca ultimele N documente ale furnizorului au avut
toate aceeasi semnatura.
| Prag | Acoperire | Precizie |
|---|---|---|
| ultimul document | 95,0% | 81,9% |
| ultimele 2 identice | 75,7% | 91,9% |
| **ultimele 3 identice** | **67,8%** | **94,9%** |
| ultimele 5 identice | 59,2% | 96,2% |
Impartirea pe zone la pragul de 3: **verde 65,2% din facturi cu precizie 93,4% (119 furnizori),
galben 29,9% cu precizie 51,3% (153 furnizori), rosu 4,8% (90 de furnizori noi).**
### 2.3 Ce se greseste, de fapt
Erorile din zona verde nu sunt aleatorii: sunt schimbari de un singur cont, intre conturi inrudite -
371 in loc de 401 (13 cazuri), 6241 in loc de 6041 (7), 6281 in loc de 62321 (3), 6221 in loc de 303
(3). Intr-un ecran de lot cu semafor, astea se corecteaza dintr-un clic, nu cer reintroducerea
documentului.
**Concluzia masurata:** o regula invatata din istoricul propriu al furnizorului, fara niciun LLM,
propune corect contarea pentru **doua treimi din facturile de intrare, cu precizie de aproape 95%**.
Nu e suficient pentru postare tacuta. Este suficient pentru propunere in lot cu confirmare, adica
exact tiparul pe care il livreaza Xero, Visma si SmartBill.
---
## 3. Descoperirea care conteaza mai mult decat backtestul
**91,4% dintre eFacturile primite ajung ca document contabil** (1.529 din 1.672 se potrivesc cu un
document din `ACT` pe cod fiscal furnizor, suma identica si data in +/-15 zile). Deci XML-ul exista
deja in baza de date pentru aproape fiecare factura care se conteaza.
**Dar legatura dintre eFactura si documentul contabil nu se scrie aproape niciodata.** Pe cele 12
luni, campul `ANAF_EFACTURA.ID_FACT` la facturile primite e completat astfel: zero in fiecare luna
pana in iunie 2026, 2 in iulie 2026, 28 in august 2026.
Codul de scriere a legaturii exista si e apelat din importul de eFactura:
`COMUN\programe\import_efactura.prg:229`, chemat din `COMUN\clase\anaf_efactura.vc2:12480` si `:13110`.
Deci nu lipseste functionalitatea - **calea de import nu e folosita**. Aproximativ 1.500 de facturi pe
an se introduc de mana, desi datele lor structurate sunt deja in Oracle.
Asta muta prioritatea: inainte de orice AI, castigul e sa faci din import calea normala de
introducere, nu o optiune paralela.
---
## 4. Ce nu masoara acest backtest
- **Un singur client, profil de comert cu automate.** 155 de facturi de intrare pe luna, dar 2.300 de
linii de banca - un cabinet cu 40 de firme mici arata altfel. Cifra de 68% acoperire la 95% precizie
trebuie reconfirmata pe inca doua scheme inainte de a fi tratata ca proprietate a produsului.
- **Semnatura de conturi, nu suma pe fiecare linie.** Backtestul verifica ce conturi se folosesc, nu
cum se repartizeaza sumele intre ele. La facturile cu mai multe linii de cheltuiala, repartizarea
ramane de facut.
- **Decalajul factura - inregistrare nu s-a putut masura**: 1.855 din 1.864 de documente au
`dataireg` egal cu data actului, deci campul e data contabila, nu momentul tastarii. Timpul real de
lucru se poate obtine doar din `DATAORA`/`ID_UTIL`, de masurat separat.
- **Nu s-a masurat calitatea propunerii pe articol** (`ANAF_EFACTURA_DETALII` are deja `CONT`/`ACONT`),
doar la nivel de document.
---
## 5. Ce decid cifrele
1. **Coada de contabilizare in lot merita construita.** Cu prag de 3 documente identice, doua treimi
din facturile de intrare intra in verde cu 95% precizie, iar erorile sunt de un cont, vizibile.
Tinta de raportat: procentul din lot care nu cere atingere, nu "acuratete".
2. **Inainte de coada, importul de eFactura trebuie sa devina calea implicita.** Fara asta, coada
nu are ce sa proceseze: azi legatura se scrie pe sub 2% din facturile primite.
3. **LLM-ul nu e necesar pentru 68% din volum.** Ramane relevant exact pentru zona rosie (90 de
furnizori noi pe an, 4,8%) si pentru galben (30% din volum, unde regula simpla nimereste doar
jumatate din cazuri) - acolo se testeaza, cu date minimizate.
---
## 6. Replicare pe schema ROMFAST (03.09.2026)
Instanta `ROA` pe `10.0.20.36` (Oracle 19c SE2, alias TNS `ROA_ROMFAST`, retea interna, fara tunel),
schema **`ROMFAST`** - firma proprie, profil de servicii. Acelasi interval, aceleasi scripturi.
| Marime | ROMFAST | VENDING |
|---|---|---|
| Linii in `ACT`, total istoric | 121.584 | 1.309.438 |
| Facturi de intrare in 12 luni | 135 | 1.864 |
| Furnizori distincti in 12 luni | 40 | 263 |
| eFacturi primite in 12 luni | 92 | 1.672 |
| Linii de banca in 12 luni | 907 | 26.894 |
### 6.1 Backtestul de contare da acelasi rezultat
| Prag | ROMFAST acoperire | ROMFAST precizie | VENDING acoperire | VENDING precizie |
|---|---|---|---|---|
| ultimul document | 85,9% | 89,7% | 95,0% | 81,9% |
| ultimele 2 identice | 74,8% | 97,0% | 75,7% | 91,9% |
| **ultimele 3 identice** | **68,1%** | **97,8%** | **67,8%** | **94,9%** |
| ultimele 5 identice | 62,2% | 98,8% | 59,2% | 96,2% |
Doua firme cu volume care difera de 14 ori, din ramuri diferite, dau **aceeasi acoperire la pragul de
3: 68%**, cu precizie intre 95% si 98%. Cifra nu mai e o proprietate a unui client, e o proprietate a
metodei. Zona rosie e mai mare la ROMFAST (14,1% furnizori noi, fata de 4,8%), pentru ca firma are
putini furnizori si multi ocazionali.
### 6.2 Diferenta care conteaza: importul de eFactura chiar se foloseste aici
La `ROMFAST`, legatura eFactura - document contabil e completa: 13 din 13 in septembrie 2025, 7 din 7
in octombrie, si asa mai departe pentru toate cele 12 luni; 96,7% dintre eFacturile primite au
corespondent in `ACT`. La `VENDING`, aceeasi legatura e zero pana in iunie 2026.
Deci **functionalitatea merge; ce lipseste e adoptia la client.** Diferenta dintre cele doua scheme nu
e de cod, e de obicei de lucru. Asta muta primul livrabil dinspre "mai scrie cod" spre "fa din import
calea implicita si vezi de ce nu o foloseste clientul".
---
## 7. Cabinetul de contabilitate: 21 de firme de pe serverul ROMFAST (03.09.2026)
Pe aceeasi instanta `ROA` (`10.0.20.36`) stau **65 de scheme de firma**, dintre care 21 au activitate
reala in ultimele 12 luni. Sunt clientii cabinetului, plus `CARAPETRU` (firma cabinetului). Interogarile
s-au facut conectat ca `ROMFAST`, cu nume calificate de schema (drepturi de citire incrucisata exista).
Scripturi: `sql\bt_11_cabinet.sql`, `bt_12_cabinet_sintetic.sql`, `bt_13_cabinet_efactura.sql`.
**Volumul cabinetului: 13.418 facturi de intrare pe an, 10.712 eFacturi primite pe an.**
### 7.1 Backtestul da un rezultat mai slab si mult mai imprastiat decat la firma singura
Agregat pe cele 21 de firme, cu semnatura pe cont plus analitic (varianta din sectiunile 2 si 6):
**acoperire 48,7% la precizie 87,9%**, fata de 68% la 95-98% masurat pe `VENDING` si `ROMFAST`.
Imprastierea pe firme e mare, si asta conteaza mai mult decat media:
| Firma | Acoperire | Precizie |
|---|---|---|
| CUX | 84,9% | 97,8% |
| CARAPETRU (firma cabinetului) | 78,3% | 96,3% |
| LEV | 68,2% | 93,7% |
| VADECO | 60,6% | 94,1% |
| TURQUOISE | 45,6% | 85,6% |
| WERT | 36,5% | 77,9% |
| VIDD | 32,5% | 83,4% |
### 7.2 Analiticul e o parte din problema
Repetand backtestul cu semnatura pe **contul sintetic**, fara analitic (`sql\bt_12`):
| Prag | Acoperire | Precizie | Din tot volumul, corect |
|---|---|---|---|
| ultimele 3 identice | 51,9% | 89,5% | 46,5% |
| **ultimele 5 identice** | **41,3%** | **93,8%** | **38,7%** |
La pragul de 5 documente identice si cont sintetic, **nicio firma din cele 21 nu coboara sub 85%
precizie**. Asta e configuratia pe care se poate construi o coada cu semafor la un cabinet: propune
contul sintetic, lasa analiticul pe seama regulilor existente si a omului.
### 7.3 Ce inseamna in ore
La un prag prudent (5 documente identice, cont sintetic), **circa 5.200 din cele 13.418 facturi anuale
ale cabinetului ar veni cu contarea corecta deja propusa**. Restul se imparte in aproximativ 7,3%
furnizori noi, unde nu exista istoric, si un rest cu istoric instabil, unde propunerea trebuie privita.
### 7.4 Importul de eFactura e deja adoptat, cu doua exceptii
Din 10.712 eFacturi primite in 12 luni, 6.639 (62,0%) au legatura scrisa catre documentul contabil.
Media e trasa in jos de doua firme: `VADECO` (0 din 1.305) si `TURQUOISE` (24 din 995). **Fara ele,
adoptia e 78,6%** (6.615 din 8.412), iar `CARAPETRU`, `CUX`, `PASS`, `CLINIDERMA`, `CERAMOTERM` sunt
practic la 100%.
Deci intrebarea "de ce nu se foloseste importul" are un raspuns pe firma, nu pe produs: la `VENDING`
importul a intrat in uz abia din iunie 2026 (confirmat de Marius), iar la cabinet doua firme au ramas
in urma. Nu e un defect de cod.
---
## 8. Concluzia finala peste cele trei masuratori
| Masuratoare | Facturi de intrare/an | Acoperire | Precizie |
|---|---|---|---|
| `VENDING` (comert cu automate) | 1.864 | 67,8% | 94,9% |
| `ROMFAST` (servicii) | 135 | 68,1% | 97,8% |
| **Cabinet, 21 de firme** | **13.418** | **48,7%** | **87,9%** |
| Cabinet, cont sintetic, prag 5 | 13.418 | 41,3% | 93,8% |
**Cifra de planificare nu e 68%, ci ~40-50%.** La o firma cu furnizori stabili metoda merge foarte bine;
la un portofoliu de firme diferite, jumatate din facturi vin de la furnizori cu istoric prea scurt sau
prea variat. Asta nu anuleaza coada de contabilizare - 5.200 de facturi pe an contate fara gandire, la
un singur cabinet, raman ore reale - dar schimba ce se promite.
**Aici isi gaseste LLM-ul locul, si acum se poate spune exact unde:** in cele ~50% care nu intra in
zona verde. Nu ca sa inlocuiasca regula, ci ca sa acopere furnizorii noi (7,3% din volum) si istoricul
instabil, unde regula simpla nimereste sub 60%.
---
## 9. Unde e de fapt munca manuala: linia de articol, nu documentul
Observatia lui Marius (03.09.2026): operatorii mapeaza **articol -> cont** la nivel de linie de
eFactura. Articolele care nu au un articol gestionabil mapat, sau al caror text variaza de la o luna la
alta (de exemplu contine perioada), nu se recunosc si se completeaza manual de fiecare data.
Masurat pe 18-19 firme ale cabinetului, liniile de eFactura primite in ultimele 12 luni. Scripturi:
`sql\bt_15_articole_normalizat.sql`...`bt_18_prefix.sql`.
### 9.1 Volumul real
| Marime | Valoare |
|---|---|
| Linii de eFactura primite pe an (19 firme) | **33.844** |
| Linii carora operatorul le pune cont | 15.565 (46,0%) |
| Furnizori distincti pe firma | 200-230 |
Deci munca nu se masoara in 13.418 documente, ci in **peste 15.000 de linii pe an** care primesc cont.
### 9.2 Cheia de potrivire: cat castiga fiecare varianta
Regula testata: pentru fiecare linie, se ia contul de pe ultima linie **anterioara** a aceluiasi
furnizor care are aceeasi cheie de text. Se compara cu ce a pus operatorul.
| Cheia de potrivire | Linii recunoscute | Din cele contate | Precizie |
|---|---|---|---|
| **text exact** (ce face programul azi) | 8.088 | 52,0% | **95,0%** |
| text fara cifre | 10.030 | 64,5% | 94,1% |
| text fara cifre, primele 25 de caractere | 10.436 | 67,1% | 93,9% |
| **text fara cifre, primele 12 caractere** | **11.243** | **72,3%** | **93,4%** |
**Doar stergand cifrele din denumirea articolului si comparand primele 12 caractere, recunoasterea
urca de la 52% la 72%, cu o pierdere de precizie de 1,6 puncte.** In cifre absolute, la un singur
cabinet: **circa 3.150 de linii pe an care azi se completeaza manual ar veni deja completate.**
Exemple de texte care azi rup potrivirea, luate din date: `ROVIGNETA AUTOTURISME_12 LUNI_TIP A`,
`GARANTIE SGR 12X0.5LEI FZ22509`, `Cafea 8000070024441`, `BUCOVINA PLATA*2L SGR`.
### 9.3 Codul de articol al furnizorului nu e o solutie
S-a testat si potrivirea pe codul trimis de furnizor in XML (`CODFURNIZOR`, `CODBARE`, `CODNC8`).
**Practic nu exista**: la `WERT`, 34 de linii din 4.426 au cod de furnizor; la `CIAO`, `DOMINUS` si
`CERAMOTERM`, zero. Textul denumirii ramane singura cheie disponibila.
### 9.4 Ce ramane pentru LLM, acum cu tinta clara
Dupa cea mai buna cheie de text, raman **27,7% din liniile contate - circa 4.300 pe an la un cabinet -
care nu se pot recunoaste din istoric**. Acolo, si numai acolo, are sens un model: text scurt, fara
sume, fara parteneri, cu lista de conturi folosite de firma pentru acel furnizor ca variante. Restul
de 72% se rezolva cu o schimbare de cheie de potrivire, fara niciun apel extern.
### 9.5 Ordinea corecta a livrabilelor, revizuita
1. **Schimba cheia de potrivire a articolului** (normalizare + prefix), cu pragul si lungimea
configurabile, si arata operatorului de unde vine propunerea. Efort mic, castig masurat: +20 puncte
procentuale de recunoastere, ~3.150 de linii pe an la un cabinet.
2. **Coada in lot peste documentele** ale caror linii sunt toate recunoscute - acolo se aplica cifra de
41-52% din sectiunea 7.
3. **LLM pe restul**, cu masurare inainte si dupa.

View File

@@ -1,154 +0,0 @@
# Bonul fiscal digital (cod QR) — stadiu legislatie la 03.09.2026
Cercetare punctuala, nu modifica cod. Surse: presa de specialitate fiscala (StartupCafe,
ValidSoftware, Digi24), text OUG pe legislatie.just.ro / static.anaf.ro, pagina ANAF servicii
web, pagina ANAF iBon. Link-urile complete sunt la finalul fiecarei sectiuni.
## 1. Actul normativ si termenul
- **OUG nr. 69/2024** (21.06.2024, publicata in Monitorul Oficial) — actul de baza. Modifica
OUG 28/1999 (obligatia de dotare cu case de marcat) si introduce cerinta ca bonul fiscal sa
contina, pe langa elementele deja obligatorii: unitatea de masura, codul de identificare
fiscala al beneficiarului (la cererea acestuia) si numarul de identificare al bonului — cu
data/ora emiterii, numarul de identificare al bonului si seria fiscala a aparatului tiparite
**si sub forma de cod QR**. Termen initial de conformare: **2 ani de la intrarea in vigoare**,
adica ~21.06.2026 pentru comerciantii ale caror case de marcat nu pot tipari inca QR.
[text OUG 69/2024 pe static.anaf.ro](https://static.anaf.ro/static/10/Anaf/legislatie/OUG_69_2024.pdf) ·
[portal legislativ](https://legislatie.just.ro/public/DetaliiDocument/284213) ·
[rezumat 7 schimbari - fiscalitatea.ro](https://www.fiscalitatea.ro/emitere-bon-fiscal-7-schimbari-importante-introduse-prin-oug-692024-23479/)
- Termenul a fost **amanat succesiv**: initial 01.09.2025 (prin OUG 125/2024), sanctiunile
pentru bon fara QR au fost suspendate, cu exceptia unor amenzi aplicate punctual in Bucuresti
de SICE inainte de suspendare.
[StartupCafe - sanctiuni amanate](https://startupcafe.ro/cod-qr-pe-bonul-fiscal-sanctiunile-pentru-firme-amanate-din-nou-noul-termen-proiect-oug-89347)
- **Stadiu la 03.09.2026**: termenul curent, comunicat de Ministerul Finantelor printr-un
**proiect de Hotarare de Guvern** publicat 01.04.2026 (nu inca text final adoptat identificat
cu numar HG in sursele gasite), este **1 noiembrie 2026**, prezentat de presa ca fara noi
amanari ("de data asta fara prelungiri"). Nu am gasit un HG/OUG cu numar oficial care sa fi
fost deja publicat in Monitorul Oficial pentru acest termen — sursele citeaza consecvent
"proiect". **Recomandare: verificati din nou aproape de termen** daca proiectul de HG a fost
adoptat si publicat, sau daca a mai fost amanat (istoricul arata amanari repetate).
[StartupCafe - proiect HG 1.11.2026](https://startupcafe.ro/termen-case-marcat-cod-qr-firme-romanesti-obligate-anaf-2026-proiect-oficial-hotarare-guvern-97362) ·
[Digi24 01.04.2026](https://www.digi24.ro/stiri/economie/bonul-fiscal-va-fi-emis-si-in-format-digital-fara-tiparire-obligatorie-ce-termen-au-firmele-pentru-implementare-3705581)
- HG-ul in discutie ar obliga si ANAF sa actualizeze **Ordinul 146/2018** (norme metodologice
case de marcat) in 45 de zile de la intrarea in vigoare — inca un semn ca la 03.09.2026
piesele normative secundare nu erau toate finalizate.
## 2. Ce contine EXACT codul QR
**Raspuns: proprietarul are dreptate — codul QR nu contine valoarea, TVA sau cotele.**
Sursele (OUG 69/2024 + presa de specialitate, convergent) dau consecvent aceeasi lista scurta,
tiparita si in clar pe bon si codificata in QR:
- data si ora emiterii bonului;
- numarul de identificare (unic) al bonului;
- seria fiscala a aparatului de marcat electronic fiscal (AMEF);
- **codul de identificare fiscala (CUI/CNP) al cumparatorului — dar numai la cererea acestuia**,
nu implicit pe fiecare bon.
Nu apar in nicio sursa gasita: valoare totala, cote TVA, linii de produse/servicii. Logica e
similara cu factura simplificata: QR-ul e un **identificator de cautare** (cheie catre
inregistrarea din sistemul ANAF), nu un container al continutului economic al bonului.
Nu am gasit o **specificatie tehnica publicata** (schema XML/JSON a QR-ului, lungime exacta a
campurilor, algoritm de encodare) — nici pe static.anaf.ro, nici in proiectul de HG citat de
presa. Structura XML de transmitere AMEF -> ANAF este mentionata generic ("format actualizat,
dupa modelul e-Factura") dar fara link catre schema publicata. Aplicatia iBon a ANAF (vezi
sectiunea 5) valideaza un "**Bon ID**" de 32 de cifre tiparit distinct pe bon, plus NUI (numar
unic identificare) si data — consistent cu lista de mai sus.
[ValidSoftware - bon fiscal digital 2026](https://validsoftware.ro/bon-fiscal-digital-2026-cod-qr-transmitere-automata-anaf-si-noi-obligatii-pentru-firme/) ·
[OUG 69/2024 static.anaf.ro](https://static.anaf.ro/static/10/Anaf/legislatie/OUG_69_2024.pdf)
## 3. Cine e obligat
- **Obligatia de emitere** cade exclusiv pe **comercianti/operatorii economici care folosesc
case de marcat** (emitentii de bonuri) — ei trebuie sa actualizeze aparatele si software-ul
AMEF, sa obtina avize tehnice si sa transmita datele noi catre ANAF.
- **Cumparatorii** nu au obligatii — pot doar sa ceara includerea codului fiscal propriu pe
bon; nu exista obligatie de scanare sau de pastrare digitala din partea lor.
- **Niciuna dintre sursele consultate nu mentioneaza obligatii pentru programele de
contabilitate** (nici pentru cele care emit bonuri prin integrare AMEF, nici pentru cele
care doar inregistreaza bonuri primite ca документе de cheltuiala). ROACONT e produs de
contabilitate, nu de casa de marcat — nu emite bonuri, deci nu intra sub incidenta directa a
OUG 69/2024. Singurul unghi de impact posibil e indirect: daca firma-client vrea sa
inregistreze automat bonurile PRIMITE ca si cheltuieli (vezi sectiunea 6).
## 4. Exista API/serviciu ANAF pentru INTEROGAREA bonurilor PRIMITE de o firma?
**Raspuns: NU exista, dupa cautarile facute — confirma observatia proprietarului.**
Am cautat explicit:
- pagina oficiala ANAF de servicii web ([anaf.ro/.../servicii_web_anaf](https://www.anaf.ro/anaf/internet/ANAF/servicii_online/servicii_web_anaf/)) —
listeaza servicii sincrone/asincrone/OAuth, dar categoriile documentate public sunt legate de
RO e-Factura (inclusiv `listaMesajeFactura`, descarcare facturi primite pe CUI, ca la SPV) si
de verificare platitor TVA — **nicio mentiune de "bon fiscal" sau "case de marcat" ca serviciu
web de interogare/descarcare**.
- Registrul RO e-Factura ([anaf.ro/.../registrul_eFactura](https://www.anaf.ro/anaf/internet/ANAF/servicii_online/registre/registrul_eFactura)) —
e specific facturilor electronice, nu bonurilor.
- termeni de cautare directi: "bon fiscal" + "webservice"/"API"/"registrul bonurilor"/"e-TVA" —
fara rezultate care sa descrie un asemenea serviciu.
- Sistemul **RO e-TVA**: gestioneaza declaratii TVA si potriviri de sume, nu e un registru de
bonuri individuale interogabile per CUI cumparator.
Concluzie: la 03.09.2026, **nu exista un echivalent "SPV pentru bonuri fiscale"** — o firma nu
poate azi (si proiectul de HG discutat nu mentioneaza ca ar introduce) sa descarce automat, pe
CUI-ul ei, bonurile fiscale pe care le-a **primit** de la furnizori, asa cum descarca facturi
primite din SPV/e-Factura. Ce se transmite automat catre ANAF e fluxul **AMEF -> ANAF**
(comerciantul isi raporteaza propriile vanzari), nu un flux **ANAF -> cumparator**.
## 5. Aplicatie/mecanism pentru cumparator: scanare QR -> bon complet?
Exista **iBon**, aplicatia mobila ANAF lansata 18.05.2026 (Android/iOS) — dar e un instrument
de **verificare**, nu de descarcare a continutului economic:
- utilizatorul fotografiaza bonul sau introduce manual datele; aplicatia recunoaste/valideaza
campurile: **Bon ID (32 de cifre)**, **NUI** (numar unic identificare), **data**;
- valideaza aceste campuri fata de baza de date ANAF (verificare "a fost emis corect / a ajuns
la ANAF"), cu decalaj (multe AMEF-uri transmit seara, deci validarea completa e disponibila
a doua zi);
- functia declarata e de **sesizare**: "nu am putut plati cu cardul", "nu am primit bon fiscal",
"bonul nu are elementele de identificare" — nu de afisare a continutului integral (valoare,
TVA, articole) al bonului.
- Nu am gasit dovezi ca iBon (sau alt canal ANAF) afiseaza continutul economic complet al
bonului dupa scanare, si nici un API public documentat in spatele ei accesibil unei aplicatii
terte (gen ROACONT) pentru acelasi scop.
[ANAF - instructiuni iBon (PDF)](https://static.anaf.ro/static/10/Anaf//Informatii_R/iBON//InstructiuniAplicatieMobila-iBON-08.05.2026-v.1.0.2.pdf) ·
[Digi24 - lansare iBon](https://www.digi24.ro/stiri/actualitate/social/anaf-lanseaza-aplicatia-prin-care-romanii-pot-verifica-daca-au-primit-bon-fiscal-corect-ce-este-ibon-si-cum-functioneaza-3771053) ·
[HotNews - iBon](https://hotnews.ro/finantele-lanseaza-aplicatia-in-care-vei-putea-avertiza-nu-am-putut-plati-cu-cardul-sau-nu-am-primit-bon-fiscal-2246582)
## 6. Concluzie practica pentru ROACONT
1. **Nimic de schimbat urgent in cod.** ROACONT e program de contabilitate, nu de casa de
marcat — obligatiile OUG 69/2024 (QR, transmitere AMEF->ANAF) cad pe comercianti si pe
producatorii de AMEF/software de casa de marcat, nu pe noi.
2. Termenul **1 noiembrie 2026** e inca sustinut de "proiect de HG", nu am gasit confirmare de
act adoptat/publicat — istoricul (2 amanari deja) justifica sa nu tratam data ca definitiva
fara o verificare noua aproape de termen.
3. **"Descarcarea automata a cheltuielilor pe bon" (bonuri PRIMITE) nu e posibila tehnic azi**,
pentru ca nu exista API/registru ANAF de interogare a bonurilor pe CUI cumparator (spre
deosebire de facturi/SPV). Codul QR, chiar generalizat, nu ajuta la asta — nu contine
valoare/TVA, doar identificatori de cautare, si nu exista un serviciu public in care sa
introduci acel identificator si sa primesti continutul integral.
4. Singura cale ramasa e cea deja folosita: **import cu interventia operatorului**, din fisierele
exportate de casa de marcat a fiecarui client — fluxul curent (folosit de o firma) e in
continuare varianta valabila; nu exista, la acest moment, o alternativa automata bazata pe
API ANAF.
5. **De monitorizat, nu de implementat acum**: daca proiectul de HG e adoptat si daca in normele
metodologice actualizate (Ordinul 146/2018 revizuit) apare vreun serviciu nou de interogare —
ar schimba concluzia de la punctul 3. Recomand o reverificare in octombrie 2026, aproape de
termen.
---
**Ce e FAPT (cu sursa) vs. ce e presupunere/necunoscut:**
- FAPT: OUG 69/2024 exista, modifica OUG 28/1999, introduce QR + campurile enumerate la
sectiunea 2 — confirmat de text OUG (static.anaf.ro) si de mai multe surse de presa
independente convergente.
- FAPT: termenul a fost amanat de la 01.09.2025; sanctiunile au fost suspendate.
- **NECONFIRMAT / de verificat**: daca HG-ul din proiectul aprilie 2026 a fost deja adoptat si
publicat oficial cu numar propriu, si daca termenul 01.11.2026 ramane neschimbat — nu am gasit
textul final adoptat, doar relatari de presa despre proiect.
- FAPT (absenta, verificata prin cautare directa pe surse ANAF): nu exista API/serviciu public
de interogare a bonurilor fiscale primite de o firma, la data cercetarii.
- FAPT: exista aplicatia iBon (lansata 18.05.2026), rol de verificare, nu de descarcare a
continutului economic al bonului.

View File

@@ -1,250 +0,0 @@
# Import extrase de banca si imperecherea partener/factura - cum functioneaza azi
Cercetare de cod, fara nicio modificare. Toate afirmatiile au citat fisier:linie din
`D:\roa\ROACONT`. Sursa e VFP compilat in `.prg`/`.vcx`; codul citat mai jos e din `.prg`
(text direct, nu are nevoie de `.vc2`).
## A. Harta fluxului
1. **Pornire**: `Programe\ocont2003.prg:845` (`lans_import_extras`) deschide setul de note
`90023` = "IMPORT EXTRAS MT940" (`ocont2003.prg:858`, `ocont2003.prg:964-965`).
2. `note_fara_predefinire` (`ocont2003.prg:948`) pregateste cursorul `tAct` si apeleaza
`import_extras('tAct', ...)` la `ocont2003.prg:1226`.
3. `import_extras` (`ocont2003.prg:866`) instantiaza clasa fabrica `ImportNote` din
`Programe\oproceduri_import.prg:57` si cheama `.Import()`. In functie de fisierul ales,
`ImportNote` (`oproceduri_import.prg:120-227`) alege subclasa potrivita: `ExtrasBanca_MT940`
(Raiffeisen etc.), `ExtrasBanca_CREDITEUROPE_XML`, `ExtrasBanca_UNICREDIT_CSV`, sau
`ExtrasBanca_General` (`oproceduri_import.prg:1415`) - clasa "detectez singur formatul",
folosita si pentru fisierele **Banca Transilvania**.
4. `ExtrasBanca_General::Parse` (`oproceduri_import.prg:1417`) citeste prima linie
nevida a fisierului si decide dupa continutul ei ce parser cheama. Pentru CSV sunt
~25 formate bancare/procesatori de plati recunoscute dupa antet
(`oproceduri_import.prg:1452-1531`: Stripe, Booking, PayU, Intesa, FanCourier, Cargus, DPD,
Garanti, OTP, Raiffeisen, Unicredit, ING, ING Business, **BT** (linia 1502-1507), PayPal,
BRD, BCR, First Bank, CEC, MobilPay, Un-Doi, Paypoint, Idea, CreditEurope, Alpha).
5. Pentru **Banca Transilvania** liniile 1502-1507 detecteaza doua variante de export
(lista de tranzactii lunara vs. extras de cont) si cheama `This.csvBT(fisier, 1)` respectiv
`This.csvBT(fisier, 2)`. Parserul activ e `csvBT` la `oproceduri_import.prg:2923-3025`
(functia veche `csvBT_original`, linia 3027, nu mai e apelata de nicaieri).
6. Rezultatul parsarii ajunge in cursorul local `c_iex`, apoi `C_IMPORT_TEMP`
(`oproceduri_import.prg:1544-1550`), care alimenteaza motorul de imperechere
`ExtrasBanca::CreeazaNote` (`oproceduri_import.prg:312-926`) - aici se cauta partenerul si
factura pentru fiecare linie.
7. Rezultatul (`cActTemp` -> `tAct`) e afisat operatorului intr-un formular de corectie
manuala, `frm_modific2024` (instantiat la `ocont2003.prg:1229`), unde utilizatorul poate
modifica orice camp (partener, cont, factura) inainte de salvare.
8. La apasarea butonului de salvare (`buton = 1`, `ocont2003.prg:1245-1257`), cursorul corectat
e scris in tabela Oracle **`ACTACTAN`** (jurnalul contabil) prin `oscrie_in_fisiere`
(`ocont2003.prg:1256`). Coloanele relevante confirmate din `INSERT INTO actactan(...)`
real (`Programe\oproceduri_incasari.prg:270-279`, `Programe\oproceduri_inchidere.prg:856-879`)
si din vederea `vact_tot`/`xnote` (`COMUN\programe\ocont2003... ` / `Programe\ocont2003.prg:1101-1183`):
`nr_nota, an, luna, dataireg, nract, dataact, explicatia, scd, ascd, scc, ascc, suma,
suma_val, id_valuta, curs, id_set, id_fact, id_partd, id_partc, id_factd, id_factc,
pereched, perechec, id_fdoc`. Liniile provenite din import extras au `id_set = 90023`
(`ocont2003.prg:858`), ceea ce le face identificabile ulterior in Oracle.
9. Nomenclatorul de parteneri e tabela `NOM_PARTENERI` (cautat prin vederea `vnom_parteneri`,
coloane `cod_fiscal`, `denumire`, `cont_banca`, `sters`, `inactiv`,
`COMUN\programe\oproceduri_comune.prg:6599-6667`). Facturile/documentele de imperecheat
sunt in tabela `IREG_PARTENERI` (fisa partener pe cont/an/luna, coloane `id_fact`, `cont`,
`acont`, `nract`, `id_part`, `an`, `luna`, `precdeb`, `debit`, `preccred`, `credit`,
`id_lucrare`, cautate in `GetDocumentByContPartenerAct`,
`COMUN\programe\oproceduri_comune.prg:6984-7057`).
Pe scurt: **(a) manual** = operatorul introduce direct in `frm_modific2024` fara pasii 3-6.
**(b) import fisier** = pasii 1-9 de mai sus; pasul 7 (formularul) e exact punctul unde
"operatorul intervine" mentionat de tine.
## B. Cum se identifica azi PARTENERUL (client/furnizor)
Motorul e in `ExtrasBanca::CreeazaNote`, blocul de cautare parteneri
(`oproceduri_import.prg:433-547`), rulat o singura data per (cod_fiscal, denumire, iban)
distinct din import (`oproceduri_import.prg:435`), apoi aplicat pe toate liniile
(`oproceduri_import.prg:542-544`). Ordinea de cautare, in cascada:
1. **Dupa cod fiscal** (`oproceduri_import.prg:453-488`) - doar daca linia are cod fiscal
completat. `GetPartenerByCodFiscal` (`COMUN\programe\oproceduri_comune.prg:6599-6621`) face
potrivire **exacta** dupa cod fiscal normalizat (fara spatii, fara prefix "RO"),
`MAX(id_part)` daca sunt mai multi identici. Daca acelasi CUI normalizat exista pe mai
multi parteneri (grup de duplicate, `GetParteneriByCuiNormalizat`,
`oproceduri_import.prg:4515-4526`), se alege partenerul din grup cu cele mai multe
inregistrari (si cel mai mare sold) in `ireg_parteneri` pentru anul/luna curenta
(`oproceduri_import.prg:459-483`, comentariu explicit la linia 52: *"la CUI-uri duplicate
aleg partenerul cu facturi in perioada curenta, nu ultimul creat"*).
2. **Dupa denumire** (`oproceduri_import.prg:490-513`), doar daca pasul 1 nu a gasit nimic.
`GetPartenerByDenumire` (`COMUN\programe\oproceduri_comune.prg:6623-6645`) face potrivire
**exacta** `TRIM(UPPER(denumire)) = ?pcDenumire` - nu foloseste `LIKE`, nu elimina
diacritice, nu normalizeaza forma juridica ("SRL" vs "S.R.L." vs fara sufix). Daca nu
gaseste exact, incearca variante de ordine a cuvintelor pentru nume de persoane
(`GetNamePermutations`, `COMUN\programe\oproceduri_comune.prg:6789 si urm.`, apelat la
`oproceduri_import.prg:500-511`) - util doar pentru "Popescu Ion" vs "Ion Popescu", nu
pentru firme.
3. **Dupa IBAN** (`oproceduri_import.prg:516-523`), doar daca pasii 1-2 au esuat.
`GetPartenerByContBanca` (`COMUN\programe\oproceduri_comune.prg:6647-6667`) - potrivire
**exacta** pe `cont_banca`.
4. **Creare automata de partener nou** (`oproceduri_import.prg:527-540`) - doar daca are cod
fiscal si optiunea `This.lCreeazaParteneri` e activa; fara cod fiscal, linia ramane fara
partener (`id_part = 0`), vizibila operatorului in grid la pasul de corectie.
**Cazul concret Banca Transilvania**: parserul `csvBT` **nu extrage niciodata codul fiscal**
al platitorului - `mcf = ""` e fixat necondiotionat la `oproceduri_import.prg:3015`. Asta
inseamna ca pentru singurul format pe care il ai (BT), pasul 1 de mai sus (cod fiscal, cel mai
sigur) **nu se executa niciodata** - se sare direct la potrivirea exacta dupa denumire (pasul 2),
care e cea mai fragila. Denumirea partenerului extrasa din linia BT vine din pozitia 3 a
campului "Descriere", despartit dupa `;` (`mtert = ALLTRIM(syGETWORDNUM(mexplicatie, 3, ';'))`,
`oproceduri_import.prg:3013`), iar IBAN-ul partenerului din pozitia 4
(`oproceduri_import.prg:3014`).
## C. Cum se identifica azi FACTURA
Tot in `CreeazaNote`, blocul "asociez document" (`oproceduri_import.prg:701-817`), care ruleaza
**doar daca** optiunea `This.lFactura` e activa (cautare dupa numar de document,
`oproceduri_import.prg:710-764`) sau `This.lComanda` (cautare dupa numar de comanda,
`oproceduri_import.prg:769-817`, logica identica dar cauta si in `nrord`/`explicatia`
prin `LIKE`).
Comentariul autorului chiar deasupra blocului descrie exact ce ar trebui sa faca si ce NU face
azi (`oproceduri_import.prg:701-706`):
> *"Repet pana la epuizarea sumei de plata/incasare... Daca nu mai am documente, dar suma de
> plata nu este epuizata, imperechez facturile in ordine cronologica..."* - acest TODO nu e
> implementat.
Ce se intampla efectiv, pas cu pas (`oproceduri_import.prg:719-764`):
1. Se ia lista de numere gasite in text (`documente`, extrase de `GetRegExpAllNumbers`,
`oproceduri_import.prg:4480-4510` - ia **toate** numerele intregi din descriere, dupa ce
elimina datele de forma zz.ll.aa(aa) si anul curent). Pentru BT, aceasta lista vine din
pozitia 2 a campului "Descriere" (`lcDescriereFacturi`, `oproceduri_import.prg:3017-3019`).
2. Pentru **primul** numar din lista, `GetDocumentByContPartenerAct`
(`COMUN\programe\oproceduri_comune.prg:6984-7057`) cauta in `ireg_parteneri` documentul cu
acel `nract`, pe acelasi partener si (daca exista) acelasi cont; daca gaseste **mai mult de
un rezultat**, renunta si doar scrie in log ("Sunt prea multe rezultate care se potrivesc",
linia 7038) - **nu alege niciunul**.
3. Daca a gasit exact un document (`oproceduri_import.prg:726`), suma din extras e acceptata
**doar daca nu depaseste soldul ramas al facturii** (`lnSuma <= solddeb`, liniile 728-734).
Dupa acest test, bucla **iese necondiotionat** (`EXIT`, linia 736) - indiferent daca s-a
facut sau nu vreo asociere.
**Consecinte directe, cu explicatie**:
- **Suma exacta pe o singura factura** -> functioneaza (cazul comun, o plata = o factura).
- **O plata acopera mai multe facturi** (suma > soldul primei facturi gasite) -> testul de la
linia 728/731 esueaza, dar bucla oricum iese la `EXIT` (linia 736) fara sa incerce
urmatorul numar de document din lista si fara sa distribuie suma pe facturi. Rezulta o linie
**fara factura pereche**, desi numarul facturii a fost corect citit din text.
- **O plata partiala pe o factura** (suma < sold) -> se asociaza, dar factura ramane cu sold
neachitat corect in continuare (nu e un bug, e comportamentul dorit).
- **Avansuri** (plata fara numar de factura in text) -> `documente` ramane gol, se forteaza
totusi o cautare cu `'0'` (`oproceduri_import.prg:715-717`), care de regula nu gaseste nimic
-> linia ramane fara factura, de corectat manual.
- **Compensari** -> nu sunt tratate aici; sunt un modul separat (`COMUN\programe\ocompensari.prg`),
nu fac parte din fluxul de import extras.
- **Comisioane bancare** -> sunt recunoscute prin cuvinte cheie in descriere ("comision",
"comision-atm", "pachet izi", etc., `oproceduri_import.prg:2998-3012` pentru BT) si duse
direct pe cont 627, fara sa treaca prin cautarea de partener/factura - acest caz e deja
tratat rezonabil.
## D. Ce e slab si ce s-ar schimba
Defecte reale si confirmate in cod. Ce s-a masurat efectiv pe date de productie e in
`BACKTEST_BANCA.md` - acolo e si cifra care arata ca schimbarea de la punctul 1 de mai jos nu e
cea mai buna: `CONT_BANCA` e completat la doar 4,5% dintre parteneri activi, deci cheia de IBAN
nu are azi pe ce lucra la scara mare.
1. **Pentru BT (singurul format folosit), cautarea partenerului nu foloseste niciodata codul
fiscal** - `oproceduri_import.prg:3015` (`mcf = ""` fix) + cascada din
`oproceduri_import.prg:453-523`. Se ajunge direct la potrivire exacta de denumire
(`COMUN\programe\oproceduri_comune.prg:6623-6645`, fara `LIKE`, fara normalizare diacritice/
forma juridica). Extrasul BT contine IBAN-ul platitorului la pozitia 4 din descriere
(`oproceduri_import.prg:3014`) - IBAN e mai stabil ca si cheie decat denumirea si e deja
extras, dar in cod e incercat abia **al treilea**, dupa cod fiscal (mereu gol pentru BT) si
dupa denumire. Nomenclatorul insa nu are `CONT_BANCA` completat decat la 4,5% dintre
parteneri (masurat, vezi `BACKTEST_BANCA.md`), deci o simpla schimbare de ordine nu recupereaza
mult pe cont propriu - cheia invatata din istoric, masurata in acelasi document, e cea care
aduce castig real.
2. **O plata care acopera mai multe facturi, sau al carei prim numar de factura gasit nu se
potriveste cu soldul, ramane azi complet nepereche** - `oproceduri_import.prg:710-764`,
`EXIT` necondiotionat la linia 736 dupa primul document gasit, indiferent de rezultatul
testului de suma; TODO-ul autorului chiar deasupra (`oproceduri_import.prg:701-706`)
confirma ca aceasta e o lipsa cunoscuta, nu o alegere deliberata. Aceasta e cea mai probabila
cauza pentru "plata acopera mai multe facturi" mentionata in cerinta ta.
3. **Cand acelasi numar de document se potriveste pe mai multe randuri in `ireg_parteneri`,
sistemul renunta silentios** - `COMUN\programe\oproceduri_comune.prg:7035-7039`
(`Reccount('cRezultatTemp') > 1` -> doar log, fara alegere).
4. **Extragerea numarului de factura ia orice numar din text, nu doar numere plauzibile de
factura** - `GetRegExpAllNumbers` (`oproceduri_import.prg:4480-4510`) elimina doar datele
calendaristice, nu si alte numere (referinte, telefoane). Combinat cu punctul 2 (se incearca
doar primul numar gasit), un numar irelevant aflat inaintea numarului real de factura in
text ar putea fi incercat primul si esua fara a mai incerca urmatorul.
5. **Pozitiile fixe din descrierea BT (cuvintele 3 si 4 despartite de `;`) nu sunt validate** -
`oproceduri_import.prg:3013-3014` - daca banca schimba formatul sau tranzactia are alt tip
de descriere decat "Incasare/Plata OP", `mtert`/`miban` pot prelua bucati de text gresite,
fara nicio verificare (ex: ca IBAN-ul extras chiar arata a IBAN).
## E. Formatul fisierului Banca Transilvania (din cod)
Nu exista niciun fisier exemplu de la Banca Transilvania in `Alte\` (doar
`Alte\Extras_de_cont_11634808MT 940.txt` si `.xls`, care nu par BT dupa continut/format).
Descrierea de mai jos vine strict din parserul `csvBT`
(`oproceduri_import.prg:2923-3025`).
**Detectie format** (`oproceduri_import.prg:1502-1507`), pe baza primei linii nevide a
fisierului CSV:
- incepe cu `"tranzactii"` sau `"transactions"` -> `csvBT(fisier, 1)` = "lista de tranzactii"
(export lunar din BT24/NeoBT), antet comentat in cod: `Data tranzactie, Data valuta,
Descriere, Referinta tranzactiei, Debit, Credit, Sold contabil` (7 coloane).
- incepe cu `[lista de tranzactii]` sau `"lista de tranzactii"` -> `csvBT(fisier, 2)` = "extras
de cont", antet: `Data tranzactie, Data valuta, Referinta, Tip tranzactie, Descriere,
Debit, Credit` (7 coloane, ordinea Referinta/Tip tranzactie difera de varianta 1).
**Cont propriu (IBAN al extrasului)**: cautat linie cu linie dupa eticheta `"numar cont:"`,
primele 24 caractere dupa virgula (`oproceduri_import.prg:2936-2940`); daca nu se gaseste,
`This.cIBAN = 'BT'` (`oproceduri_import.prg:2942-2944`).
**Curatare text inainte de parsare CSV** (`oproceduri_import.prg:2954-2969`):
- elimina virgulele din interiorul ghilimelelor si ghilimelele insesi;
- elimina `LF + "~~"` (artefact de export BT24 cand descrierea trece pe linia urmatoare);
- reuneste liniile rupte, pastrand un rand nou doar daca urmeaza dupa el o data (mai multe
formate acceptate: `AAAA-LL-ZZ`, `ZZ/LL/AAAA`, `ZZ.LL.AAAA`, `ZZ-LL-AAAA`, `AAAA/LL/ZZ`);
- detecteaza varianta BT24 (are coloana "sold contabil" -> `llBT24`, linia 2966): la BT24
sumele de pe Debit sunt negative si se inverseaza semnul (`oproceduri_import.prg:2980-2982`).
**Camp "Descriere"** - text liber, dar cu conventie interna a bancii separata prin `;`.
Exemplele reale din codul sursa (comentarii, `oproceduri_import.prg:2989,2992` -
denumiri de firma anonimizate mai jos):
```
"30-05-2024","30-05-2024","Incasare OP - canal electronic;f 2024103;XXX SRL;ROXXBTRLXXXXXXXXXXXXXXXX;BTRLRO22;REF: 014ZEXA24151017X","014ZEXA24151017X","","1,184.24 ","2,184.24 "
2024-06-05,2024-06-05,"Incasare OP - canal electronic;F 2024131;XXX SA;ROXXBTRLXXXXXXXXXXXXXXXX;BTRLRO22;REF: 414ZEXA2415702DU",414ZEXA2415702DU,,"797.30","12,013.14"
```
Campurile din "Descriere" (despartite prin `;`), asa cum le foloseste codul:
1. tip tranzactie (text liber, ex. "Incasare OP - canal electronica");
2. referinta/numar document - din acest camp `GetRegExpAllNumbers` extrage numerele candidate
de factura (`oproceduri_import.prg:3017-3019`);
3. denumirea partenerului (`mtert`, `oproceduri_import.prg:3013`);
4. IBAN-ul partenerului (`miban`, `oproceduri_import.prg:3014`);
5. codul SWIFT al bancii partenerului (necitit de cod);
6. referinta platii (necitita de cod, ramane doar in text).
**Clasificare tip tranzactie** dupa cuvinte cheie in "Descriere"
(`oproceduri_import.prg:2998-3012`): `"comision"` (la inceput), `"comision-atm"`, `"comision
procesare ridicare numerar"`, `"pachet izi"` -> cont 627 (cheltuiala bancara); `"retragere de
numerar"` -> transfer numerar (cont 581/5311); `"transfer intern"` -> transfer intre conturi
proprii (cont 581); orice altceva -> tratat ca tert (client/furnizor), cont 4111/401.
## Ce nu am lamurit
- Nu am gasit un fisier CSV real exportat de Banca Transilvania in acest working copy, deci
descrierea de la punctul E e dedusa din cod si din exemplele scrise ca si comentarii de
dezvoltator - nu am validat-o pe un export proaspat (BT poate sa fi schimbat coloanele intre
timp; codul insusi are comentarii separate pentru "BT24" si "NeoBT" ca doua variante usor
diferite).
- Nu exista (cel putin nu l-am gasit) un tabel de audit/log care sa retina *propunerea automata
a algoritmului* separat de *starea finala dupa corectia manuala din `frm_modific2024`* - masuratorile
de productie (`BACKTEST_BANCA.md`) vad doar rezultatul final, nu cat de mult "salveaza"
operatorul azi prin corectii manuale linie cu linie. Pentru a masura exact asta ar trebui
adaugata o logare la pasul de import (inainte de afisarea formularului).
- Nu am verificat daca IBAN-ul partenerului extras de `csvBT` (`miban`,
`oproceduri_import.prg:3014`) ajunge sa fie salvat ca atare in `ACTACTAN` sau se pierde
la constructia liniei finale (`oproceduri_import.prg:898-909`) - `iban` apare in
`C_IMPORT_TEMP`/`cActTemp`, dar nu l-am gasit explicit in lista de coloane a `INSERT INTO
actactan` verificata la punctul A.8; ar necesita o verificare suplimentara pe schema reala a
tabelei `ACTACTAN` din Oracle (`DESC actactan`), pe care nu am rulat-o (doar SELECT-uri, nu
aveam nici conexiune).

View File

@@ -1,78 +0,0 @@
# Test parser extras BT (csvBT) - pozitie tert/iban in descriere
## Ce dovedeste testul
`ExtrasBanca_General::csvBT` (`Programe\oproceduri_import.prg:2923`) extrage tert si iban
din campul "Descriere" al CSV-ului BT dupa pozitie fixa (`;`, pozitia 3 = tert, pozitia 4 =
iban). Descrierea nu are acelasi numar de campuri la toate tipurile de tranzactie: la
"Plata OP inter - canal electronic" si "Comision plata OP" apare un camp in plus (numarul
OP-ului) inaintea denumirii, deci pozitia 3 ajunge sa fie numarul OP, iar pozitia 4 (IBAN-ul
real) ajunge sa fie luata drept... denumire, ramanand IBAN-ul real neluat deloc (era pe
pozitia 5, ignorata).
Test pe cele 44 de tranzactii reale ale firmei ROMFAST SRL (5 fisiere `tranzactii_*.csv`,
export BT):
| | inainte | dupa |
|---|---|---|
| Linii cu `iban` care arata a IBAN (`RO`+2 cifre+20 alfanumerice) | 8 | 18 |
| Linii cu `tert` numeric (sigur gresit - e numarul OP-ului) | 10 | 0 |
Cele 10 linii corectate sunt exact tranzactiile "Plata OP inter - canal electronic" si
"Comision plata OP". Celelalte 34 de linii (Incasare OP, Transfer intern, Plata la POS,
Pachet PJ) raman identice inainte/dupa - fix-ul nu le atinge.
## Corectia
`Programe\oproceduri_import.prg`, `Procedure csvBT` (in jurul liniei 3013): in loc de
pozitii fixe 3/4, se cauta in campurile despartite de `;` primul care trece validarea de
IBAN, cu functia deja existenta `VerifIBAN` (`COMUN\programe\oproceduri_comune.prg:7885`,
verifica cifra de control, nu doar forma). Daca se gaseste, `iban` = acel camp, `tert` =
campul dinaintea lui. Daca nu se gaseste niciun camp valid ca IBAN, comportamentul ramane
cel de azi (pozitia 3 = tert, pozitia 4 = iban) - acopera "Transfer intern", "Plata la POS",
"Pachet PJ", unde descrierea nu contine IBAN. Pozitia 2 (numerele de factura,
`lcDescriereFacturi`) nu s-a schimbat.
Capcana gasita si reparata la sursa: `VerifIBAN` (`COMUN\programe\oproceduri_comune.prg:7885`)
nu isi declara variabilele locale si le citeste/scrie neprefixate (`iban`, `mcontrol`, `miban`,
`mibansec`, `rest`, `i`, `dv`). In VFP, un nume nescris fara `m.` se rezolva mai intai la un
CAMP din alias-ul curent, abia apoi la variabila - deci atata timp cat apelantul are selectat
un cursor/tabela cu un camp `iban` (aici `c_iex.iban`, in `csvBT`), citirile si scrierile lui
`VerifIBAN` nimeresc campul, nu parametrul, si functia intoarce mereu `.F.`. Defectul afecta
orice apelant al `VerifIBAN` cu un asemenea cursor selectat - inclusiv formularele din
`onomenclatoare.vcx`/`oparteneri.vcx` care il apeleaza. Fix: `LOCAL mcontrol, miban, mibansec,
rest, i, dv` plus prefix `m.` pe toate referintele la parametru si variabile; logica
neschimbata. Diff: `docs/diff_runda1_verifiban_comun.patch` (fata de
`COMUN\programe\oproceduri_comune.prg.pre_runda1.bak`, alt depozit git decat ROACONT).
`csvBT` nu mai are nevoie de niciun ocol - apeleaza direct `VerifIBAN(m.lcCimp)`.
Diff parser: `docs/diff_runda1_parser_bt.patch` (fata de
`Programe\oproceduri_import.prg.pre_runda1.bak`).
## Cum se ruleaza testul
`teste_extras_bt.prg` (radacina proiectului) instantiaza clasa reala `ExtrasBanca_General`
si ruleaza `csvBT` peste toate fisierele `tranzactii_*.csv` dintr-un folder dat ca parametru,
fara Oracle (doar `SET PROCEDURE` pe `oproceduri_import.prg`, `COMUN\programe\oproceduri_comune.prg`,
`COMUN\programe\regex.prg`). Scrie rezultatul in `<folder>\rezultat_test_bt.txt`.
```powershell
$folder = 'D:\calea\catre\fisierele\tranzactii_bt'
$p = Start-Process 'C:\Program Files (x86)\Microsoft Visual FoxPro 9\vfp9.exe' -ArgumentList '-A','-T',"`"D:\roa\ROACONT\teste_extras_bt.prg`" $folder" -PassThru
$p.WaitForExit(120000)
```
Fisierele CSV reale folosite la test (denumiri parteneri + IBAN-uri reale ROMFAST SRL) NU
sunt in `docs/` - raman in scratchpad-ul sesiunii, nu s-au comis.
## Neacoperit
- **Fara IBAN in descriere** (26 din 44 de linii: "Transfer intern", "Plata la POS",
"Pachet PJ"): partenerul nu se poate deduce din descriere in aceste cazuri, fix-ul nu are
ce corecta - comportament identic cu inainte.
- **IBAN strain**: `VerifIBAN` cere exact 24 de caractere (lungimea IBAN romanesc), deci un
IBAN strain (alta lungime) nu e recunoscut si linia cade pe comportamentul de azi
(pozitiile fixe 3/4) - degradare sigura, nu regresie, nu era acoperit nici inainte.
- Nu s-a testat `tnTip = 2` (extras de cont final de luna, alt layout de coloane CSV) -
fisierele disponibile au fost toate `tnTip = 1` (lista de tranzactii).

View File

@@ -1,150 +0,0 @@
set pagesize 0 linesize 200 feedback off heading off trimspool on
select 'FIRMA TOTAL VERDE3 CORECT NOI' from dual;
with sup as (select cod, max(id_partc) idf, min(dataact) d from VADECO.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from VADECO.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VADECO',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from WERT.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from WERT.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from TURQUOISE.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from TURQUOISE.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('TURQUOISE',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTC.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from DRAFTC.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from FINELINE.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from FINELINE.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from ANNA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from ANNA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('ANNA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from PASS.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from PASS.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from LEV.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from LEV.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEV',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from VIDD.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from VIDD.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VIDD',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from INTERIOR.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from INTERIOR.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTD.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from DRAFTD.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTD',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from COTOFANACONCEPT.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from COTOFANACONCEPT.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('COTOFANACONCEPT',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from LEIL2.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from LEIL2.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEIL2',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CERAMOTERM.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CERAMOTERM.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CERAMOTERM',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from DRAFTA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CIAO.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CIAO.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CIAO',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CLINIDERMA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CLINIDERMA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CLINIDERMA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DOMINUS.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from DOMINUS.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DOMINUS',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CARAPETRU.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CARAPETRU.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CARAPETRU',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CAPIDAVATOUR.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CAPIDAVATOUR.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CAPIDAVATOUR',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CUX.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd)||trim(nvl(a.ascd,' ')) c from CUX.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CUX',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),7)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),7)||lpad(sum(case when s1 is null then 1 else 0 end),6) from u;
exit

View File

@@ -1,150 +0,0 @@
set pagesize 0 linesize 200 feedback off heading off trimspool on
select 'FIRMA TOTAL COV3 CORECT3 COV5 CORECT5' from dual;
with sup as (select cod, max(id_partc) idf, min(dataact) d from VADECO.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from VADECO.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VADECO',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from WERT.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from WERT.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from TURQUOISE.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from TURQUOISE.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('TURQUOISE',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTC.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from DRAFTC.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from FINELINE.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from FINELINE.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from ANNA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from ANNA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('ANNA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from PASS.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from PASS.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from LEV.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from LEV.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEV',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from VIDD.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from VIDD.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VIDD',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from INTERIOR.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from INTERIOR.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTD.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from DRAFTD.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTD',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from COTOFANACONCEPT.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from COTOFANACONCEPT.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('COTOFANACONCEPT',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from LEIL2.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from LEIL2.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEIL2',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CERAMOTERM.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CERAMOTERM.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CERAMOTERM',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DRAFTA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from DRAFTA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CIAO.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CIAO.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CIAO',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CLINIDERMA.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CLINIDERMA.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CLINIDERMA',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from DOMINUS.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from DOMINUS.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DOMINUS',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CARAPETRU.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CARAPETRU.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CARAPETRU',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CAPIDAVATOUR.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CAPIDAVATOUR.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CAPIDAVATOUR',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
with sup as (select cod, max(id_partc) idf, min(dataact) d from CUX.act where nvl(sters,0)=0 and substr(scc,1,3)='401' and nvl(id_partc,0)>0 and dataact >= add_months(trunc(sysdate,'MM'),-36) and dataact < trunc(sysdate,'MM') group by cod),
deb as (select distinct s.cod, trim(a.scd) c from CUX.act a join sup s on s.cod=a.cod where nvl(a.sters,0)=0 and a.scd is not null and trim(a.scd) is not null and substr(a.scd,1,3)<>'442'),
sig as (select cod, listagg(c,'+') within group (order by c) sg from deb group by cod),
docs as (select s.cod, s.idf, s.d, g.sg from sup s join sig g on g.cod=s.cod where g.sg <> '401'),
ord as (select d.*, lag(sg,1) over (partition by idf order by d,cod) s1, lag(sg,2) over (partition by idf order by d,cod) s2, lag(sg,3) over (partition by idf order by d,cod) s3, lag(sg,4) over (partition by idf order by d,cod) s4, lag(sg,5) over (partition by idf order by d,cod) s5 from docs d),
u as (select * from ord where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CUX',18)||lpad(count(*),6)||lpad(sum(case when s1=s2 and s2=s3 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s1=sg then 1 else 0 end),8)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 then 1 else 0 end),6)||lpad(sum(case when s1=s2 and s2=s3 and s3=s4 and s4=s5 and s1=sg then 1 else 0 end),8) from u;
exit

View File

@@ -1,24 +0,0 @@
set pagesize 0 linesize 200 feedback off heading off trimspool on
select 'FIRMA PRIMITE LEGATE' from dual;
select rpad('VADECO',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from VADECO.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('WERT',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from WERT.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('TURQUOISE',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from TURQUOISE.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('DRAFTC',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from DRAFTC.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('FINELINE',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from FINELINE.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('ANNA',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from ANNA.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('PASS',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from PASS.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('LEV',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from LEV.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('VIDD',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from VIDD.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('INTERIOR',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from INTERIOR.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('DRAFTD',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from DRAFTD.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('COTOFANACONCEPT',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from COTOFANACONCEPT.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('LEIL2',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from LEIL2.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CERAMOTERM',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CERAMOTERM.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('DRAFTA',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from DRAFTA.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CIAO',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CIAO.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CLINIDERMA',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CLINIDERMA.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('DOMINUS',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from DOMINUS.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CARAPETRU',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CARAPETRU.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CAPIDAVATOUR',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CAPIDAVATOUR.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
select rpad('CUX',18)||lpad(count(*),7)||lpad(sum(case when nvl(id_fact,0)>0 then 1 else 0 end),7) from CUX.anaf_efactura where nvl(factura_emisa,0)=0 and xdata_act >= add_months(trunc(sysdate,'MM'),-12) and xdata_act < trunc(sysdate,'MM');
exit

View File

@@ -1,163 +0,0 @@
set pagesize 0 linesize 220 feedback off heading off trimspool on
select 'FIRMA LINII CUCONT EXACT OKEX NORM OKNO' from dual;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from WERT.anaf_efactura_detalii dt join WERT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTC.anaf_efactura_detalii dt join DRAFTC.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from VADECO.anaf_efactura_detalii dt join VADECO.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VADECO',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from TURQUOISE.anaf_efactura_detalii dt join TURQUOISE.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('TURQUOISE',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from FINELINE.anaf_efactura_detalii dt join FINELINE.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from INTERIOR.anaf_efactura_detalii dt join INTERIOR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from PASS.anaf_efactura_detalii dt join PASS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CARAPETRU.anaf_efactura_detalii dt join CARAPETRU.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CARAPETRU',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEV.anaf_efactura_detalii dt join LEV.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEV',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d, dt.id,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from ANNA.anaf_efactura_detalii dt join ANNA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
sum(ac) over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) pe,
sum(ac) over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) pn,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('ANNA',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when nvl(pe,0)>0 then 1 else 0 end),7)||lpad(sum(case when ac=1 and qe is not null and qe=ct then 1 else 0 end),5)||lpad(sum(case when nvl(pn,0)>0 then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn is not null and qn=ct then 1 else 0 end),5) from u;
exit

View File

@@ -1,269 +0,0 @@
set pagesize 0 linesize 220 feedback off heading off trimspool on
select 'FIRMA LINII CUCONT DENEX OKEX DENNO OKNO' from dual;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from WERT.anaf_efactura_detalii dt join WERT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTC.anaf_efactura_detalii dt join DRAFTC.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from FINELINE.anaf_efactura_detalii dt join FINELINE.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from INTERIOR.anaf_efactura_detalii dt join INTERIOR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from PASS.anaf_efactura_detalii dt join PASS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CARAPETRU.anaf_efactura_detalii dt join CARAPETRU.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CARAPETRU',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEV.anaf_efactura_detalii dt join LEV.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEV',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from ANNA.anaf_efactura_detalii dt join ANNA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('ANNA',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CIAO.anaf_efactura_detalii dt join CIAO.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CIAO',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CLINIDERMA.anaf_efactura_detalii dt join CLINIDERMA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CLINIDERMA',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DOMINUS.anaf_efactura_detalii dt join DOMINUS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DOMINUS',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CUX.anaf_efactura_detalii dt join CUX.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CUX',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CERAMOTERM.anaf_efactura_detalii dt join CERAMOTERM.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CERAMOTERM',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTA.anaf_efactura_detalii dt join DRAFTA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTA',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEIL2.anaf_efactura_detalii dt join LEIL2.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEIL2',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from COTOFANACONCEPT.anaf_efactura_detalii dt join COTOFANACONCEPT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('COTOFANACONCEPT',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from VIDD.anaf_efactura_detalii dt join VIDD.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VIDD',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTD.anaf_efactura_detalii dt join DRAFTD.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTD',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
upper(trim(dt.articol)) a_ex,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CAPIDAVATOUR.anaf_efactura_detalii dt join CAPIDAVATOUR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_ex order by d rows between unbounded preceding and 1 preceding) qe,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) qn
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CAPIDAVATOUR',14)||lpad(count(*),6)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and qe is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qe=ct then 1 else 0 end),5)||lpad(sum(case when ac=1 and qn is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and qn=ct then 1 else 0 end),5) from u;
exit

View File

@@ -1,113 +0,0 @@
set pagesize 0 linesize 220 feedback off heading off trimspool on
select 'FIRMA LINII CUCOD CUBARE CUNC8 DENCOD OKCOD' from dual;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from WERT.anaf_efactura_detalii dt join WERT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTC.anaf_efactura_detalii dt join DRAFTC.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from FINELINE.anaf_efactura_detalii dt join FINELINE.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from INTERIOR.anaf_efactura_detalii dt join INTERIOR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from PASS.anaf_efactura_detalii dt join PASS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CIAO.anaf_efactura_detalii dt join CIAO.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CIAO',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DOMINUS.anaf_efactura_detalii dt join DOMINUS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DOMINUS',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from VIDD.anaf_efactura_detalii dt join VIDD.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VIDD',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CERAMOTERM.anaf_efactura_detalii dt join CERAMOTERM.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CERAMOTERM',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(dt.codfurnizor) cf, trim(dt.codbare) cb, trim(dt.codnc8) c8,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEIL2.anaf_efactura_detalii dt join LEIL2.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')),
p as (select l.*, last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, cf order by d rows between unbounded preceding and 1 preceding) qc from l where cf is not null),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12)),
t as (select count(*) linii, sum(case when cf is not null then 1 else 0 end) cucod, sum(case when cb is not null then 1 else 0 end) cubare, sum(case when c8 is not null then 1 else 0 end) cunc8
from l where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEIL2',14)||lpad(t.linii,6)||lpad(t.cucod,6)||lpad(t.cubare,7)||lpad(t.cunc8,6)||lpad((select sum(case when ac=1 and qc is not null then 1 else 0 end) from u),7)||lpad((select sum(case when ac=1 and qc=ct then 1 else 0 end) from u),6) from t;
exit

View File

@@ -1,255 +0,0 @@
set pagesize 0 linesize 220 feedback off heading off trimspool on
select 'FIRMA CUCONT D_FULL OK_FULL D_P25 OK_P25 D_P12 OK_P12' from dual;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from WERT.anaf_efactura_detalii dt join WERT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('WERT',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTC.anaf_efactura_detalii dt join DRAFTC.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTC',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from FINELINE.anaf_efactura_detalii dt join FINELINE.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('FINELINE',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from INTERIOR.anaf_efactura_detalii dt join INTERIOR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('INTERIOR',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from PASS.anaf_efactura_detalii dt join PASS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('PASS',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CARAPETRU.anaf_efactura_detalii dt join CARAPETRU.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CARAPETRU',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEV.anaf_efactura_detalii dt join LEV.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEV',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from ANNA.anaf_efactura_detalii dt join ANNA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('ANNA',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CIAO.anaf_efactura_detalii dt join CIAO.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CIAO',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CLINIDERMA.anaf_efactura_detalii dt join CLINIDERMA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CLINIDERMA',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DOMINUS.anaf_efactura_detalii dt join DOMINUS.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DOMINUS',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CUX.anaf_efactura_detalii dt join CUX.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CUX',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CERAMOTERM.anaf_efactura_detalii dt join CERAMOTERM.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CERAMOTERM',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from DRAFTA.anaf_efactura_detalii dt join DRAFTA.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('DRAFTA',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from LEIL2.anaf_efactura_detalii dt join LEIL2.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('LEIL2',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from COTOFANACONCEPT.anaf_efactura_detalii dt join COTOFANACONCEPT.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('COTOFANACONCEPT',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from VIDD.anaf_efactura_detalii dt join VIDD.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('VIDD',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
with l as (select e.cod_fiscal_emitent cui, e.xdata_act d,
trim(regexp_replace(regexp_replace(regexp_replace(upper(dt.articol),'[0-9]+',' '),'[^A-Z ]',' '),' +',' ')) a_no,
case when dt.cont is not null and trim(dt.cont) is not null then 1 else 0 end ac,
trim(dt.cont)||'.'||trim(nvl(dt.acont,' ')) ct
from CAPIDAVATOUR.anaf_efactura_detalii dt join CAPIDAVATOUR.anaf_efactura e on e.id = dt.id_efactura
where nvl(e.factura_emisa,0)=0 and e.xdata_act >= add_months(trunc(sysdate,'MM'),-24) and e.xdata_act < trunc(sysdate,'MM')
and dt.articol is not null),
p as (select l.*,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, a_no order by d rows between unbounded preceding and 1 preceding) q1,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,25) order by d rows between unbounded preceding and 1 preceding) q2,
last_value(case when ac=1 then ct end) ignore nulls over (partition by cui, substr(a_no,1,12) order by d rows between unbounded preceding and 1 preceding) q3
from l),
u as (select * from p where d >= add_months(trunc(sysdate,'MM'),-12))
select rpad('CAPIDAVATOUR',13)||lpad(sum(ac),6)||lpad(sum(case when ac=1 and q1 is not null then 1 else 0 end),7)||lpad(sum(case when ac=1 and q1=ct then 1 else 0 end),8)||lpad(sum(case when ac=1 and q2 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q2=ct then 1 else 0 end),7)||lpad(sum(case when ac=1 and q3 is not null then 1 else 0 end),6)||lpad(sum(case when ac=1 and q3=ct then 1 else 0 end),7) from u;
exit

View File

@@ -315,8 +315,10 @@ WITH loProject.FILES
.ADD('comun\include\security.h') && *< FileMetadata: Type="T" Cpid="1252" Timestamp="0" ID="0" ObjRev="0" User="" />
.ADD('comun\programe\acces_meniu.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\anaf_efactura.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\anulare_lot_ef.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\cauta_alfa.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\chatbot.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\coada_contabilizare_ef.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\controllerecr.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\exportare.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\filebringer.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
@@ -370,6 +372,7 @@ WITH loProject.FILES
.ADD('comun\programe\proceduri_rapoarte.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\procese.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\quitapp.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\recunoastere_articol_ef.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\regex.prg') && *< FileMetadata: Type="P" Cpid="1250" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\reglari_denominare2005.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />
.ADD('comun\programe\suma_in_vorbe.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" User="" />