Initial commit — sursa ROAACNPRO
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62
.gitignore
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# Visual FoxPro - fisiere compilate
|
||||
*.fxp
|
||||
*.mpx
|
||||
|
||||
# Visual FoxPro - backup-uri
|
||||
*.bak
|
||||
*.BAK
|
||||
*.TBK
|
||||
|
||||
# Visual FoxPro - fisiere memo pereche (binare generate automat)
|
||||
*.pjt
|
||||
*.PJT
|
||||
*.sct
|
||||
*.SCT
|
||||
*.vct
|
||||
*.VCT
|
||||
*.frt
|
||||
*.FRT
|
||||
*.lbt
|
||||
*.LBT
|
||||
*.mnt
|
||||
*.MNT
|
||||
|
||||
# Visual FoxPro - meniuri generate (din .mnx)
|
||||
*.mpr
|
||||
*.MPR
|
||||
|
||||
# Visual FoxPro - log-uri si erori
|
||||
*.ERR
|
||||
*.err
|
||||
log.txt
|
||||
|
||||
# Visual FoxPro - fisiere temporare
|
||||
*.tmp
|
||||
*.TMP
|
||||
*.dct
|
||||
*.DCT
|
||||
|
||||
# Executabile compilate
|
||||
*.exe
|
||||
*.EXE
|
||||
|
||||
# SVN (proiectul foloseste SVN, nu git, pentru COMUN)
|
||||
.svn/
|
||||
|
||||
# COMUN este gestionat separat prin SVN
|
||||
COMUN/
|
||||
|
||||
# Windows
|
||||
*.lnk
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
bash.exe.stackdump
|
||||
|
||||
# FoxPro runtime index-uri auto-generate (pastrate doar daca sunt sursa)
|
||||
# Comenteaza liniile de mai jos daca .cdx/.idx sunt fisiere sursa intentionate
|
||||
# *.cdx
|
||||
# *.idx
|
||||
FoxyPreviewer_Emails.CDX
|
||||
FoxyPreviewer_Emails.DBF
|
||||
FoxyPreviewer_Emails.FPT
|
||||
PACK_FACTURARE.pck
|
||||
131
CLAUDE.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## What this is
|
||||
|
||||
ROAACNPRO is a **Visual FoxPro 9** desktop application (Romanian-language) for port/lock
|
||||
operations billing on the Danube. It invoices the service types defined in
|
||||
`Include/roaacnpro.h`: `TRANZIT` (transit), `CHEIAJ` (wharfage), `APA` (water), `CHIRII`
|
||||
(rentals), `PILOTAJ` (pilotage), `PENALITATI` (penalties), `ALTE`/`DIVERSE` (other). It is one
|
||||
member of the larger "ROA" suite (ROAGEST, ROACONT, ROACASA, ROADEF, etc.) and reads vessel/
|
||||
voyage/lock data from the external **RORIS Oracle** system.
|
||||
|
||||
The code, comments, menus, and changelog are all in Romanian — match that language when editing
|
||||
user-facing strings, comments, and changelog entries.
|
||||
|
||||
## Build, run, version control
|
||||
|
||||
- **Build/run requires the Visual FoxPro 9 IDE on Windows.** There is no command-line build.
|
||||
Open `roaacnpro.pjx` in the VFP IDE and use *Build > Build Executable* to produce
|
||||
`roaacnpro.exe`. The startup program is `Programe/roaacnpro.prg` (set as the project main).
|
||||
- **`.prg` files are source; `.fxp` are compiled, `.bak` are backups.** Edit the `.prg`. The
|
||||
`.scx/.sct` (forms), `.vcx/.vct` (class libraries), `.frx/.frt` (reports), and `.mnx/.mpr`
|
||||
(menus) are VFP binary/generated artifacts — **edit them in the VFP IDE, not by hand.** `.mpr`
|
||||
is GENMENU-generated from `.mnx`; never hand-edit `.mpr`.
|
||||
- **Version control is Subversion** (`.svn/`), not git. `COMUN/` is its own SVN working copy.
|
||||
- **`config.fpw`** sets the runtime environment (CODEPAGE 1252, `EXCLUSIVE=OFF`, `SAFETY=OFF`,
|
||||
`MULTILOCKS=ON`). Don't enable SAFETY — the code relies on silent overwrite.
|
||||
- The compiler error log is `roaacnpro.ERR`; the runtime log is `log.txt`. Many entries in
|
||||
`roaacnpro.ERR` are benign cross-references resolved at runtime from `COMUN` libraries.
|
||||
|
||||
## The COMUN shared framework
|
||||
|
||||
`COMUN/` (and the sibling `..\COMUNROA\`) is **shared, framework-level code used by every ROA
|
||||
app** — it is not specific to ROAACNPRO. Treat it as a vendored library:
|
||||
|
||||
- A change in `COMUN/` affects all ROA applications. Prefer making app-specific changes in this
|
||||
repo's top-level `Programe/`, `Clase/`, `Ferestre/`, `Rapoarte/`, `Meniuri/` directories.
|
||||
Only touch `COMUN/` when the fix genuinely belongs to the shared framework.
|
||||
- `SET PATH` (see `Programe/roaacnpro.prg` ~line 37) makes `COMUN\CLASE`, `COMUN\FERESTRE`,
|
||||
`COMUN\PROGRAME`, `COMUN\RAPOARTE`, and the `COMUN\UTILE\*` helper libraries (calendar, ctl32,
|
||||
hpdf PDF, web/HTTP, nfjson, nfxml, excel, GridExtras) resolvable by bare filename. So
|
||||
`SET PROCEDURE TO email.prg` resolves to `COMUN\PROGRAME\email.prg`.
|
||||
|
||||
## Application architecture
|
||||
|
||||
Startup flow (`Programe/roaacnpro.prg`):
|
||||
|
||||
1. Sets `gcAppPath`, builds `gcComunPath`, `SET PATH`, `SET PROCEDURE TO roa.prg`.
|
||||
2. `goApp = CreateObject("oApp")` — `oApp` is a thin subclass of **`RoaApp`**
|
||||
(`COMUN/programe/roa.prg`, ~1200 lines). This is the application object and the backbone of
|
||||
the whole framework.
|
||||
3. `goApp.initializeaza(...)` runs an ordered `initializeaza*` pipeline: program check, read
|
||||
login params, Win32 declares, env, paths, class libs, procedures, settings ini, **security**
|
||||
(Oracle host/credentials, decrypted from `roa_security.xml`), report previewer, locale,
|
||||
variables, and global objects.
|
||||
4. `goApp.lanseazaAplicatie()` shows `_screen`, runs the startup menu + `fundal.scx` shell form.
|
||||
5. `READ EVENTS` — VFP event loop. `onShutDown` handles exit.
|
||||
|
||||
**App-specific overrides** live in `oApp` at the bottom of `Programe/roaacnpro.prg`: the empty
|
||||
hook methods `initializeazaAlteClassLib` / `initializeazaAlteProceduri` are where this app loads
|
||||
its own class libraries (`oacnpro.vcx`, `ofacturare_comun.vcx`, `serii_numere.vcx`, …) and
|
||||
procedure files (`proceduri_acnpro.prg`, `ofacturare.prg`, `xmlefactura.prg`, …). When adding a
|
||||
new class library or procedure file to the app, register it in one of these two methods — that
|
||||
is the canonical extension point.
|
||||
|
||||
### Globals convention
|
||||
|
||||
The framework promotes the `RoaApp` properties into **public global variables** in
|
||||
`initializeazaVariabileGlobale` / `initializeazaObiecteGlobale`. These are used pervasively
|
||||
throughout the codebase:
|
||||
|
||||
- `goApp` (the app object), `goConn`/`goExecutor` (Oracle connection + SQL executor),
|
||||
`goLog`/`poLog` (logger), `goCalendar`, `goExport`, `goFundal` (shell form), `goFirma`,
|
||||
`goUtilizator`.
|
||||
- `gcS` = Oracle schema, `gnIdFirma`, `gnIdUtil`, `gnAn`/`gnLuna` (working year/month),
|
||||
`gcAppPath`, `gcDirMare` (suite root), `gcComunPath`.
|
||||
- `g`-prefix = global, `gc`/`gn`/`gl` = char/numeric/logical, `m.` = memory-variable scoping.
|
||||
|
||||
### Data layer
|
||||
|
||||
- Backend is **Oracle**, reached via ODBC/SQL pass-through through `goConn`/`goExecutor`. Run
|
||||
queries with `SQLEXEC()` against the connection handle; results come back as VFP cursors.
|
||||
- `database.txt` documents the Oracle setup: it creates **synonyms** (`ips_voyages`,
|
||||
`ips_berthings`, `ips_cargoes`, …) into the external `roris` schema and `GRANT`s to the app
|
||||
user. The `ips_*` tables are RORIS source data; `ips_*_vanzari` and the app's own tables hold
|
||||
billing data. `versiune_db.txt` tracks the DB schema version.
|
||||
- App tables and report cursors carry Romanian/domain names (`tranzit`, `cheiaj`, `factura`,
|
||||
`recapitulatie`, `tarife`, `contracte`).
|
||||
|
||||
## Domain quick reference
|
||||
|
||||
- **Service-type constants** are in `Include/roaacnpro.h` (string `TIP_*` and numeric `NTIP_*`,
|
||||
e.g. `NTIP_TRANZIT 0`, `NTIP_CHEIAJ 1`). These same defines are repeated at the top of
|
||||
`Programe/proceduri_acnpro.prg`.
|
||||
- **`Programe/proceduri_acnpro.prg`** — core billing procedures (`factura_salvare_db`,
|
||||
`calcul_cheiaj`, `salvare_cheiaj`, `make_factura_penalitati`, TVA/VAT handling, …). The file
|
||||
header is an append-only dated change journal; follow that style when adding procedures.
|
||||
- **`docs/facturare.md`** — read this first for any **invoice/billing change**: it maps the
|
||||
invoice flow (form `frm_factura` → `factura_salvare_db` → `PACK_FACTURARE.pck` → reports/list),
|
||||
the `crsFactura` structure, the VAT formulas, and which files to touch for a given task. Key
|
||||
rule: `PACK_FACTURARE.pck` is the source of truth; the `frm_factura` preview must mirror its
|
||||
formulas, and reports/list only read package-computed values.
|
||||
- **`Programe/proceduri_acnpro_rapoarte.prg`** — report-generation procedures feeding the
|
||||
`Rapoarte/*.frx` layouts (factura, recapitulatie_cheiaj/tranzit/penalitati, registru tranzit).
|
||||
- **`Programe/importroris*.prg`** + `importroris.pjx` — a *separate* small executable
|
||||
(`importroris.exe`) that imports voyage/lock data from RORIS. `verificare_roris_ecluze.*` is
|
||||
another standalone verification tool. These build independently of the main project.
|
||||
- **VAT/TVA** is first-class and time-sensitive: the app supports multiple concurrent VAT-rate
|
||||
regimes (e.g. 19/9/5% historical vs. 21/11% from 2025-08-01). Be careful that billing logic
|
||||
selects rates by the document's period, not "current" rates.
|
||||
|
||||
## Changelog & release convention
|
||||
|
||||
`changelog_roaacnpro.txt` is the user-facing release log. **Newest entry goes at the top**, in
|
||||
this exact HTML-comment block format (Romanian, `DD/MM/YYYY`):
|
||||
|
||||
```
|
||||
<!--
|
||||
10/02/2026
|
||||
ROAACNPRO - 2.0.3
|
||||
|
||||
:modificare:
|
||||
<what changed>
|
||||
-->
|
||||
```
|
||||
|
||||
Tags: `:nou:` (new feature), `:modificare:` (change), `:eroare:` (bug fix). Bump the
|
||||
`MAJOR.MINOR.PATCH` version when you add an entry. The app auto-updates from
|
||||
`https://www.romfast.ro/...` via `COMUN/programe/actualizare_aplicatie.prg`; the runtime reads
|
||||
its version from the built `.exe`.
|
||||
BIN
Clase/oacnpro.vcx
Normal file
BIN
Clase/ofundal_facturare.vcx
Normal file
BIN
Ferestre/fundal.scx
Normal file
BIN
Ferestre/importroris.scx
Normal file
BIN
Grafice/cheiaj.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Grafice/f1.jpg
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
Grafice/f2.jpg
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
Grafice/f3.jpg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
Grafice/icon_cheiaj1.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
Grafice/icon_cheiaj2.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Grafice/icon_registru1.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
Grafice/icon_registru2.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Grafice/icon_tranzit1.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Grafice/icon_tranzit2.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
Grafice/icon_utilitati1.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
Grafice/icon_utilitati2.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Grafice/import_16.png
Normal file
|
After Width: | Height: | Size: 737 B |
BIN
Grafice/import_24.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Grafice/import_32.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Grafice/import_roris.ico
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
Grafice/registru.png
Normal file
|
After Width: | Height: | Size: 994 B |
BIN
Grafice/roaacnpro.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Grafice/roafacturare.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Grafice/tranzit.png
Normal file
|
After Width: | Height: | Size: 1019 B |
BIN
Grafice/utilitati.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
17
Include/roaacnpro.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#Define TIP_TRANZIT 'TRANZIT'
|
||||
#Define TIP_CHEIAJ 'CHEIAJ'
|
||||
#Define TIP_APA 'APA'
|
||||
#Define TIP_CHIRII 'CHIRII'
|
||||
#Define TIP_PILOTAJ 'PILOTAJ'
|
||||
#Define TIP_ALTE 'ALTE'
|
||||
#Define TIP_PENALITATI 'PENALITATI'
|
||||
#Define TIP_DIVERSE 'DIVERSE'
|
||||
|
||||
#Define NTIP_TRANZIT 0
|
||||
#Define NTIP_CHEIAJ 1
|
||||
#Define NTIP_APA 2
|
||||
#Define NTIP_CHIRII 3
|
||||
#Define NTIP_PILOTAJ 4
|
||||
#Define NTIP_ALTE 5
|
||||
#Define NTIP_PENALITATI 6
|
||||
#Define NTIP_DIVERSE 9
|
||||
BIN
Meniuri/roaacnpro.mnx
Normal file
BIN
Meniuri/situatii_venituri.mnx
Normal file
BIN
Meniuri/tarife.mnx
Normal file
49
Programe/importroris_main.prg
Normal file
@@ -0,0 +1,49 @@
|
||||
Lparameters tcOptiune, tnZile
|
||||
* tcOptiune: s (lanseaza import silentios)
|
||||
* tnZile: nnn (numarul de zile pentru import)
|
||||
|
||||
Set Century On
|
||||
Set Date Dmy
|
||||
Set Exact On
|
||||
Set Ansi On
|
||||
Set Deleted On
|
||||
Set Safety Off
|
||||
Set Deleted On
|
||||
Set NullDisplay To ''
|
||||
|
||||
PRIVATE gcMainPath, gcLogStamp
|
||||
gcMainPath = UPPER(ADDBS(JUSTPATH(SYS(16,0))))
|
||||
gcMainPath = STRTRAN(m.gcMainPath,'PROGRAME\', '')
|
||||
gcLogStamp = SYS(2015)
|
||||
lcPath = gcMainPath + 'ferestre\;'
|
||||
|
||||
SET DEFAULT TO (m.gcMainPath)
|
||||
SET PATH TO (m.lcPath) ADDITIVE
|
||||
|
||||
Local lcOptiune, lnOptiune, llSilentios, lnZile
|
||||
lcOptiune = Lower(Alltrim(Transform(m.tcOptiune)))
|
||||
llSilentios = (m.lcOptiune = 's')
|
||||
lnZile = Int(Val(Transform(m.tnZile)))
|
||||
lnZile = Iif(Empty(m.lnZile), 30, m.lnZile)
|
||||
|
||||
|
||||
WriteLog('Start import RORIS silentios: ' + TRANSFORM(m.llSilentios) + ', zile: ' + ALLTRIM(TRANSFORM(m.lnZile)))
|
||||
|
||||
If m.llSilentios
|
||||
lnOptiune = 1
|
||||
Do importroris_proceduri.prg With llSilentios, m.lnOptiune, m.lnZile
|
||||
Else
|
||||
Do Form importroris
|
||||
ENDIF
|
||||
|
||||
WriteLog('End import RORIS silentios: ' + TRANSFORM(m.llSilentios) + ', zile: ' + ALLTRIM(TRANSFORM(m.lnZile)))
|
||||
WriteLog('')
|
||||
|
||||
PROCEDURE WriteLog
|
||||
LPARAMETERS tcMesaj
|
||||
lcMesaj = m.gcLogStamp + ' ' + TRANSFORM(DATETIME()) + ' ' + TRANSFORM(m.tcMesaj) + CHR(13)
|
||||
lcFile = m.gcMainPath + 'log.txt'
|
||||
IF FILE(m.lcFile)
|
||||
STRTOFILE(m.lcMesaj, m.lcFile, .T.)
|
||||
ENDIF
|
||||
ENDPROC
|
||||
191
Programe/importroris_proceduri.prg
Normal file
@@ -0,0 +1,191 @@
|
||||
Lparameters llSilentios, lnOptiune, lnZile
|
||||
|
||||
|
||||
If Empty(m.lnOptiune)
|
||||
lnOptiune = xmenu('Creeaza job import RORIS;Verifica log')
|
||||
Endif
|
||||
If Empty(m.lnOptiune)
|
||||
Return
|
||||
Endif
|
||||
|
||||
lnHandle = SQLConnect('ROA', 'ACN', 'ROMFASTSOFT')
|
||||
|
||||
If m.lnHandle <= 0
|
||||
Aerror(laEroare)
|
||||
WriteLog(laEroare(3))
|
||||
IF !m.llSilentios
|
||||
Messagebox(laEroare(3))
|
||||
ENDIF
|
||||
Return
|
||||
Endif
|
||||
|
||||
Do Case
|
||||
Case m.lnOptiune = 1
|
||||
IF EMPTY(m.lnZile)
|
||||
lcZile = Inputbox('Numar zile de tranzit pentru import (implicit 30)', 'Nr zile', '30')
|
||||
lnZile = Iif(!Empty(Val(m.lcZile)), Val(m.lcZile), 30)
|
||||
ENDIF
|
||||
|
||||
Private ptLastGenerationTime
|
||||
ptLastGenerationTime = Date() - m.lnZile
|
||||
|
||||
If m.llSilentios OR (Messagebox('Se lanseaza importul pentru tranzitele >= ' + Ttoc(m.ptLastGenerationTime) + '?',4+32,_Screen.Caption) = 6)
|
||||
lcSql = [begin pack_acn_import.import_roris_job(?ptLastGenerationTime); end;]
|
||||
lnSucces = SQLExec(m.lnHandle, m.lcSql)
|
||||
If m.lnSucces > 0
|
||||
WriteLog('S-a creat job-ul pentru import')
|
||||
|
||||
IF !m.llSilentios
|
||||
Messagebox('S-a creat job-ul pentru import',0+64,_Screen.Caption,10)
|
||||
ENDIF
|
||||
Else
|
||||
Aerror(laEroare)
|
||||
WriteLog(laEroare(3))
|
||||
IF !m.llSilentios
|
||||
Messagebox(laEroare(3))
|
||||
ENDIF
|
||||
Endif
|
||||
Endif
|
||||
Case m.lnOptiune = 2
|
||||
lcSql = [select to_char(substr(info,1,200)) as info, dataora from info where locatia = 'import_roris' and trunc(dataora) = trunc(sysdate) order by dataora desc]
|
||||
lnSucces = SQLExec(m.lnHandle, m.lcSql, 'crsImportTemp')
|
||||
If m.lnSucces > 0
|
||||
CREATE CURSOR crsImport (info c(200) null, dataora T)
|
||||
SELECT crsImport
|
||||
APPEND FROM DBF('crsImportTemp')
|
||||
|
||||
Select crsImport
|
||||
GO TOP
|
||||
BROWSE TITLE 'LOG IMPORT (ESC pentru iesire)' PREFERENCE IMPORT
|
||||
USE IN (SELECT('crsImportTemp'))
|
||||
USE IN (SELECT('crsImport'))
|
||||
Else
|
||||
Aerror(laEroare)
|
||||
Messagebox(laEroare(3))
|
||||
ENDIF
|
||||
|
||||
Case m.lnOptiune = 3
|
||||
TEXT TO lcsql NOSHOW
|
||||
SELECT LOG_ID,
|
||||
CAST(LOG_DATE AS DATE) as log_date,
|
||||
JOB_NAME,
|
||||
STATUS,
|
||||
CAST(actual_start_date AS DATE) as start_date,
|
||||
to_char(RUN_DURATION) AS duration,
|
||||
additional_info as errors
|
||||
FROM USER_SCHEDULER_JOB_RUN_DETAILS
|
||||
WHERE TRUNC(LOG_DATE) >= TRUNC(SYSDATE) - 7
|
||||
ORDER BY LOG_ID DESC
|
||||
ENDTEXT
|
||||
|
||||
lnSucces = SQLExec(m.lnHandle, m.lcSql, 'crsJobTemp')
|
||||
If m.lnSucces > 0
|
||||
CREATE CURSOR crsJob (log_id I, log_date T null, job_name C(200) null, status C(20) null, start_date T null, duration C(30) null, errors C(250) null)
|
||||
SELECT crsJob
|
||||
APPEND FROM DBF('crsJobTemp')
|
||||
|
||||
Select crsJob
|
||||
GO TOP
|
||||
BROWSE TITLE 'Stare joburi import (ESC pentru iesire)' PREFERENCE JOB
|
||||
USE IN (SELECT('crsJobTemp'))
|
||||
USE IN (SELECT('crsJob'))
|
||||
Else
|
||||
Aerror(laEroare)
|
||||
Messagebox(laEroare(3))
|
||||
ENDIF
|
||||
|
||||
|
||||
Endcase
|
||||
|
||||
SQLDisconnect(m.lnHandle)
|
||||
|
||||
|
||||
|
||||
*-------------------------------------------
|
||||
* Function...: Xmenu
|
||||
* Author.....: MARTIN
|
||||
* Date.......: 04/06/1997
|
||||
* Notes......: Based on an idea from Steve Zimmelman for FoxPro 2.x
|
||||
* Parameters.: tcItems = Semicolon-separated String with the various options
|
||||
* ...........: tnBar = Initially selected item (default=1)
|
||||
* Returns....: Selected item number
|
||||
* See Also...: PROMPT() [FoxPro Native]
|
||||
*
|
||||
Procedure xmenu
|
||||
Lparameters TCITEMS, TNBAR
|
||||
|
||||
Local NITEMCOUNT, AITEMS, X, NROW, NCOL, CTITLE, NLASTPOS, CCOLOR, AITEMS
|
||||
|
||||
Private CPOPMENU, NSELECT && They flow into the GetChoice internal procedure
|
||||
|
||||
If Pcount() < 2
|
||||
TNBAR = 1
|
||||
Endif
|
||||
|
||||
Activate Screen
|
||||
|
||||
* Parse every item
|
||||
*
|
||||
m.NITEMCOUNT = Occurs( ';', TCITEMS ) + 1
|
||||
Dimen AITEMS[ m.nItemCount ]
|
||||
m.NLASTPOS = 1
|
||||
|
||||
For m.X = 1 To m.NITEMCOUNT
|
||||
|
||||
If m.X < m.NITEMCOUNT
|
||||
|
||||
AITEMS[ m.x ] = Subs( m.TCITEMS, m.NLASTPOS, ;
|
||||
( At( ';', m.TCITEMS, m.X ) - 1 ) - m.NLASTPOS + 1 )
|
||||
Else
|
||||
AITEMS[ m.x ] = Subs( m.TCITEMS, m.NLASTPOS, ;
|
||||
( Len( m.TCITEMS ) - m.NLASTPOS ) + 1 )
|
||||
Endif
|
||||
|
||||
If AITEMS[ m.x ] # "\-"
|
||||
|
||||
AITEMS[ m.x ] = Allt( AITEMS[ m.x ] )
|
||||
Endif
|
||||
|
||||
m.NLASTPOS = At( ';', m.TCITEMS, m.X ) + 1
|
||||
Next
|
||||
|
||||
* Calculates the mouse pointer position
|
||||
*
|
||||
m.NROW = Iif( Mrow() + m.NITEMCOUNT < Srow(), Mrow() - 1, Srow() - m.NITEMCOUNT )
|
||||
m.NCOL = Iif( Mcol() + 10 < Scol(), Mcol() - 3, Mcol() - 13 )
|
||||
|
||||
* Gets an unique name for the pop-up
|
||||
*
|
||||
m.CPOPMENU = 'M' + Sys(3) + "_"
|
||||
|
||||
Define Popup ( m.CPOPMENU ) SHORTCUT Relative From NROW, NCOL
|
||||
|
||||
For m.X = 1 To m.NITEMCOUNT
|
||||
|
||||
Define Bar m.X Of ( m.CPOPMENU ) Prompt AITEMS[ m.x ]
|
||||
Next
|
||||
|
||||
m.CANS = ""
|
||||
m.NSELECT = 0
|
||||
Clear Type
|
||||
|
||||
On Selection Popup ( m.CPOPMENU ) Do GETCHOICE
|
||||
|
||||
Activate Popup ( m.CPOPMENU ) Bar TNBAR
|
||||
|
||||
Pop Key
|
||||
Release Popup ( m.CPOPMENU )
|
||||
|
||||
Return Iif( Lastkey() = 27, 0, m.NSELECT )
|
||||
|
||||
Endproc && XMENU
|
||||
|
||||
*--------------------
|
||||
Procedure GETCHOICE
|
||||
|
||||
m.NSELECT = Bar()
|
||||
|
||||
Deactivate Popup ( m.CPOPMENU )
|
||||
|
||||
Endproc && GETCHOICE
|
||||
|
||||
1
Programe/ovariabile_globale.prg
Normal file
@@ -0,0 +1 @@
|
||||
**OVARIABILE_GLOBALE.PRG
|
||||
6091
Programe/proceduri_acnpro.prg
Normal file
1253
Programe/proceduri_acnpro_rapoarte.prg
Normal file
146
Programe/roaacnpro.prg
Normal file
@@ -0,0 +1,146 @@
|
||||
Parameters tParametri
|
||||
*!* obiecte globale
|
||||
Private poLog, goLog, oTool, oHelp, goExecutor, goConn, goMyXMLHTTP, goCalendar, goExport, goUtilizator, goFundal, goFirma, goApp
|
||||
Store "" To poLog, goLog, oTool, oHelp, goExecutor, goConn, goMyXMLHTTP, goCalendar, goExport, goUtilizator, goFundal, goFirma
|
||||
|
||||
*!* Private gcLocalePath, goLocale
|
||||
*!* STORE "" TO gcLocalePath, goLocale
|
||||
|
||||
*!* variabile globale
|
||||
Public CRLF,CR,LF,Tab
|
||||
Public gcNumeProgram, NUMEPROGRAM, MENIUPROGRAM, FUNDALPROGRAM
|
||||
Public pcNl, pcAn, gcAcces, gcAppPath, gcAppName, gcUtilizatoriPath, gcDirMare, DIRGEN, gcTempPath, ;
|
||||
glParametri, gcHost, gcUsername, gcPassword, gcUserNameApp, gcPasswordApp, gnIdUtil, gnIdProgram, ;
|
||||
gnAn, gnLuna, gcS, gnIdFirma, gcGeneralIniFile, gcSecurityFile, gnHandle, gnButon, BUTON, gcFirma, gcBasePath, gcComunPath, ;
|
||||
gnTipGest, gcGestPermis, glFontCharSet, gcReportPreviewer, gcReportPreviewerPath, gcLocale, gcSettingsFile
|
||||
Public gcAntet,gcCopyRight, pcTitlu
|
||||
gcAntet = ''
|
||||
pcTitlu = ''
|
||||
gcCopyRight = '<27> ROA Romfast SRL'
|
||||
Public glUltimaLuna, glPrimaLuna, glLunaBuna, glLuna_neplatita, glLunaInchisa
|
||||
Public glQuit, pl_verificat
|
||||
Public gnewcryptfll, gnewcryptxml, gTransferTotal
|
||||
Private gnId_Prg_Owner
|
||||
gnId_Prg_Owner = 0
|
||||
*!* altele
|
||||
Declare nror[65000]
|
||||
Declare RTVA[22,2]
|
||||
Public luna_inchisa, luna_neplatita, PRIMADATA, m.ctva, m.ctvam, m.ctvai, antet, m.nivel
|
||||
Public OStart,OSETVIZ,OSETTULBAR,OSETINSTRUM,orm,OTEXT,OJUR,osetgest,tlbr_INSTR,tlbr_VIZ,oprinc
|
||||
Public pcapsocsub,pcapsocvar
|
||||
|
||||
_screen.Icon = 'D:\ROA\ROAACNPRO\GRAFICE\ROAACNPRO.ICO'
|
||||
|
||||
|
||||
gcAppPath = UPPER(Addbs(Justpath(Sys(16,0))))
|
||||
gcAppPath = STRTRAN(m.gcAppPath, 'PROGRAME\', '')
|
||||
gcComunPath = gcAppPath + 'COMUN\CLASE;' + ;
|
||||
gcAppPath + 'COMUN\FERESTRE;' + ;
|
||||
gcAppPath + 'COMUN\PROGRAME;' + ;
|
||||
gcAppPath + 'COMUN\GRAFICE;' + ;
|
||||
gcAppPath + 'COMUN\RAPOARTE;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\CALENDAR;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\CTL32;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\HPDF;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\WEB;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\NFJSON;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\NFXML;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\EXCEL;' + ;
|
||||
gcAppPath + 'COMUN\UTILE\GridExtras ;' + ;
|
||||
Addbs(Substr(gcAppPath,1,Rat([\],gcAppPath,2)))+[COMUNROA\]
|
||||
|
||||
Set Default To (m.gcAppPath)
|
||||
|
||||
SET PATH to (m.gcComunPath) ADDITIVE
|
||||
Set Procedure To roa.prg Additive
|
||||
Private goApp
|
||||
|
||||
On Shutdown do onShutDown
|
||||
|
||||
goApp = Createobject("oApp")
|
||||
If goApp.initializeaza(tParametri,[ROAACNPRO])
|
||||
goApp.lanseazaAplicatie()
|
||||
|
||||
* STATUSBAR APLICATIE
|
||||
If Not Pemstatus(_Screen,"StatusBar", 5) Then
|
||||
_Screen.Newobject("StatusBar","ctl32_statusbar", "ctl32_statusbar.vcx", null, 3)
|
||||
* _Screen.Newobject("StatusBar","ctl32_statusbar", "ctl32_statusbar_fals.vcx", null, 3) && inlocuieste cu ctl_32_statusbar_fals.vcx daca sunt probleme
|
||||
ENDIF
|
||||
IF TYPE('goFundal') = 'O'
|
||||
IF NOT PEMSTATUS(goFundal, "oStatusBar", 5) then
|
||||
ADDPROPERTY(goFundal, "oStatusBar", Null)
|
||||
ENDIF
|
||||
goFundal.oStatusBar = _Screen.StatusBar
|
||||
goFundal.oStatusBar.ctlIcon="roastartmic.ico"
|
||||
goFundal.oStatusBar.ctlMessage = _Screen.Caption
|
||||
* formularul fundal.scx trebuie sa aiba o metoda StatusBarClick
|
||||
BindEvent(goFundal.oStatusBar, [ctlClick], goFundal, [StatusBarClick]) && Thisform.oStatusBar.newtooltip()
|
||||
ENDIF
|
||||
Endif
|
||||
|
||||
READ EVENTS
|
||||
|
||||
*Release goApp
|
||||
|
||||
|
||||
|
||||
Define Class oApp As RoaApp
|
||||
|
||||
Procedure initializeazaAlteCai
|
||||
Endproc
|
||||
|
||||
Procedure initializeazaAlteClassLib
|
||||
SET CLASSLIB TO ofacturare_comun.vcx ADDITIVE
|
||||
SET CLASSLIB TO onom_curs.vcx ADDITIVE
|
||||
SET CLASSLIB TO oacnpro.vcx ADDITIVE
|
||||
SET CLASSLIB TO comun.vcx ADDITIVE
|
||||
SET CLASSLIB TO serii_numere.vcx ADDITIVE
|
||||
SET CLASSLIB TO onom_articole.vcx ADDITIVE
|
||||
SET CLASSLIB TO overificari.vcx ADDITIVE
|
||||
Endproc
|
||||
|
||||
Procedure initializeazaAlteProceduri
|
||||
SET PROCEDURE TO proceduri_acnpro.prg ADDITIVE
|
||||
SET PROCEDURE TO proceduri_acnpro_rapoarte.prg ADDITIVE
|
||||
SET PROCEDURE TO ofacturare.prg ADDITIVE
|
||||
SET PROCEDURE TO ofacturare_comun ADDITIVE
|
||||
SET PROCEDURE TO oserii_numere ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_curs ADDITIVE
|
||||
SET PROCEDURE TO odocumente.prg ADDITIVE
|
||||
SET PROCEDURE TO email.prg ADDITIVE
|
||||
SET PROCEDURE TO oproceduri_rapoarte_fact.prg ADDITIVE
|
||||
SET PROCEDURE TO matxtab.prg ADDITIVE
|
||||
SET PROCEDURE TO nfxmlread.prg ADDITIVE
|
||||
SET PROCEDURE TO nfjsonread.prg ADDITIVE
|
||||
SET PROCEDURE TO xmlefactura.prg ADDITIVE
|
||||
Endproc
|
||||
|
||||
Procedure initializeazaAlteVariabileGlobale
|
||||
Endproc
|
||||
|
||||
Procedure initializeazaAlteObiecteGlobale
|
||||
Endproc
|
||||
|
||||
ENDDEFINE
|
||||
|
||||
*!* Function Shutdown
|
||||
*!* If Type("goApp")=="O" And Not Isnull(goApp)
|
||||
*!* Return goApp.OnShutDown()
|
||||
*!* Endif
|
||||
*!* Cleanup()
|
||||
*!* Quit
|
||||
*!* Endfunc
|
||||
|
||||
|
||||
*-- Occurs when the user attempts to exit Visual FoxPro.
|
||||
Procedure onShutDown
|
||||
IF AMESSAGEBOX('Doriti sa iesiti din program?',4+32, goApp.cNumeProgram) = 6
|
||||
On Shutdown
|
||||
On Error
|
||||
Clear Events
|
||||
If _vfp.StartMode <> 0
|
||||
Quit
|
||||
Endif
|
||||
Endif
|
||||
ENDPROC && onShutDown
|
||||
30
Programe/update_nomenclator.prg
Normal file
@@ -0,0 +1,30 @@
|
||||
**********************************************************
|
||||
Procedure update_nomenclator
|
||||
|
||||
Do update_lunilean
|
||||
|
||||
*** tabele meniu deschise din proiect
|
||||
Local lcCaleDateMenu
|
||||
|
||||
lcCaleDateMenu=gcAppPath+[\COMUN\DATEMENU\]
|
||||
|
||||
lnSucces = xdate()
|
||||
|
||||
If !Used('menu1')
|
||||
Use &lcCaleDateMenu.menu1 In 0 Alias menu1 Excl
|
||||
Endif
|
||||
|
||||
If !Used('INFISIERE')
|
||||
Use &lcCaleDateMenu.INFISIERE In 0 Alias INFISIERE
|
||||
Endif
|
||||
|
||||
If !Used('selectii')
|
||||
Use &lcCaleDateMenu.gest_selectii In 0 Alias selectii
|
||||
Endif
|
||||
|
||||
*!* modificare v 2.1.1
|
||||
If !Used('mila1')
|
||||
Use &lcCaleDateMenu.mila1 In 0 Alias mila1
|
||||
endif
|
||||
|
||||
Endproc && update_nomenclator
|
||||
1352
Programe/verificare_roris_ecluze.prg
Normal file
BIN
Rapoarte/factura_acn.frx
Normal file
BIN
Rapoarte/factura_acn_orig.frx
Normal file
BIN
Rapoarte/iso2007.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
Rapoarte/logo.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Rapoarte/logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
Rapoarte/recapitulatie_alte.frx
Normal file
BIN
Rapoarte/recapitulatie_cheiaj.frx
Normal file
BIN
Rapoarte/recapitulatie_penalitati.frx
Normal file
BIN
Rapoarte/recapitulatie_tranzit.frx
Normal file
BIN
Rapoarte/sit_cheiaj4.frx
Normal file
BIN
Rapoarte/sit_cheiaj5.frx
Normal file
BIN
Rapoarte/sit_tranzit3.frx
Normal file
BIN
Rapoarte/stampila.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Rapoarte/stampila.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
99
Rapoarte/stampila.svg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
Rapoarte/stampila_old.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
1198
changelog_roaacnpro.txt
Normal file
14
cheiaj.prg
Normal file
@@ -0,0 +1,14 @@
|
||||
SELECT .F. as ales, v.declaratio, vs.name as nava, NVL(b.arrival_ti, {//::}) as datai, NVL(b.departure_, {//::}) as datap, ;
|
||||
NVL(tn.id, 0) as tipn_id, NVL(tn.tipn, SPACE(30)) as tipn, CAST(NVL(vs.lbt, 0) as n(9,2)) as lbp, ;
|
||||
CAST(NVL(vs.length, 0) as n(12,2)) as lung, CAST(NVL(vs.trn, 0) as n(9,2))as trn, CAST(NVL(vs.gross_tonn, 0) as n(12,2)) as cap, ;
|
||||
CAST(NVL(vs.horsepower, 0) as n(12,0)) as cp, ;
|
||||
NVL(rp.name, SPACE(30)) as port ;
|
||||
from ips_berthings b JOIN ips_voyages v ON b.voy_id = v.id ;
|
||||
LEFT JOIN ips_vessels vs ON b.ves_id = vs.id ;
|
||||
LEFT JOIN ips_vessel_types vtp1 ON vs.vtp_id = vtp1.id ;
|
||||
LEFT JOIN ips_vessel_types vtp ON vtp1.grp_id = vtp.id ;
|
||||
LEFT JOIN ips_tipn tn on vtp.aramis_typ = tn.id ;
|
||||
LEFT JOIN ips_route_points rp ON b.rpt_id = rp.id ;
|
||||
WHERE v.declaratio = '19A0456' ;
|
||||
ORDER BY b.arrival_ti ;
|
||||
INTO CURSOR cNavePort READWRITE
|
||||
15
cheiaj_istoric_declaratii.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- completare ips_regdoc cu nave lipsa din istorice cu mai multe declaratii
|
||||
|
||||
merge into ips_regdoc a using
|
||||
(select bdv.* from
|
||||
(Select v.numar_act, v.data_act as data, 1 as tip, v.id_part as id_client, v.id_ctr as id_contract, v.curs, v.id_vanzare, vv.declaratio as document, b.id_locatia, bd.id_articol, bd.id_valuta, 1 as cantitate, Sum(bd.valftva) As valftva, Sum(bd.valtva) As valtva, Sum(bd.valctva) As valctva, Sum(bd.valval) As valval, Sum(bd.valval) As Pret
|
||||
From ips_berthing_details_vanzari bd Join ips_berthings_vanzari b On bd.bv_id = b.Id
|
||||
join ips_vvoyages_vanzari vv on b.vv_id = vv.vv_id
|
||||
join vanzari v on vv.vz_id = v.id_vanzare
|
||||
where extract(year from v.data_act) = 2020 and v.tip_factura = 1
|
||||
Group By v.numar_act, v.data_act, v.id_part, v.id_ctr, v.curs, v.id_vanzare, vv.declaratio, b.id_locatia, bd.id_articol, bd.id_valuta) bdv left join
|
||||
ips_regdoc r on bdv.document = r.document and bdv.id_vanzare = r.id_vanzare and bdv.id_locatia = r.id_locatia and bdv.id_articol = r.id_articol and bdv.id_valuta = r.id_Valuta
|
||||
where bdv.valftva <> nvl(r.valftva,0)) b on (a.id_vanzare = b.id_vanzare and a.document = b.document and a.id_locatia = b.id_locatia and a.id_articol = b.id_articol and a.id_Valuta = b.id_valuta)
|
||||
when not matched then
|
||||
insert (id_vanzare, tip, document, data, id_client, id_contract, id_locatia, id_articol, valftva, valtva, valctva, valval, Pret, curs, id_valuta, cantitate)
|
||||
values (b.id_vanzare, b.tip, b.document, b.data, b.id_client, b.id_contract, b.id_locatia, b.id_articol, b.valftva, b.valtva, b.valctva, b.valval, b.valval, b.curs, b.id_valuta, b.cantitate);
|
||||
42
config.fpw
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
SCREEN = OFF
|
||||
|
||||
|
||||
_STARTUP = ""
|
||||
|
||||
* to eliminate load time:
|
||||
_BROWSER = ""
|
||||
_SPELLCHK = ""
|
||||
_GENMENU = ""
|
||||
_GENGRAPH = ""
|
||||
_GENXTAB = ""
|
||||
_COVERAGE = ""
|
||||
_SCCTEXT = ""
|
||||
_CONVERTER = ""
|
||||
_TRANSPORTER = ""
|
||||
_BUILDER = ""
|
||||
_WIZARD = ""
|
||||
|
||||
* other special CONFIG.FPW settings you may wish to change:
|
||||
* (these are the defaults)
|
||||
MVCOUNT = 1025
|
||||
OUTSHOW = ON
|
||||
|
||||
* Set other global settings here if you like, for example:
|
||||
RESOURCE = OFF
|
||||
_THROTTLE = 0
|
||||
|
||||
* See the application object's SetDataSessionSets() method
|
||||
* for some additional settings you
|
||||
* may like to use in your config file.
|
||||
* The following are not the default settings,
|
||||
* (and ordinarily will be taken care of in the
|
||||
* Load of private-session forms and formsets):
|
||||
TALK = OFF
|
||||
MULTILOCKS = ON
|
||||
EXCLUSIVE = OFF
|
||||
SAFETY = OFF
|
||||
|
||||
STACKSIZE = 512
|
||||
CODEPAGE = 1252
|
||||
501
curatare.prg
Normal file
@@ -0,0 +1,501 @@
|
||||
*** IMPORT DATA
|
||||
|
||||
update ips_voyage_members set vsl_id = null where id in (
|
||||
select vm.id from IPS_VOYAGE_MEMBERS vm left join ips_vessels vs on vm.vsl_id = vs.id
|
||||
where vs.id is null)
|
||||
|
||||
*** IPS_VOYAGE_MEMBERS
|
||||
SELECT IPS_VOYAGE_MEMBERS
|
||||
REINDEX
|
||||
SELECT ID, COUNT(*) AS NR FROM IPS_VOYAGE_MEMBERS GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT IPS_VOYAGE_MEMBERS
|
||||
IF SEEK(TT.ID,'IPS_VOYAGE_MEMBERS',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
SELECT ips_voyage_members
|
||||
COPY TO e:\voyage_members.csv TYPE csv
|
||||
|
||||
*** IPS_CARGOES
|
||||
SELECT IPS_CARGOES
|
||||
REINDEX
|
||||
SELECT ID, COUNT(*) AS NR FROM IPS_CARGOES GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT IPS_CARGOES
|
||||
IF SEEK(TT.ID,'IPS_CARGOES',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
|
||||
UPDATE IPS_CARGOES SET bill_date = {//::} WHERE LEFT(TTOC(bill_date,1),4) = '0000'
|
||||
UPDATE IPS_CARGOES SET BILL_NR = STRTRAN(BILL_NR, '"', '') WHERE !EMPTY(NVL(BILL_NR, ''))
|
||||
|
||||
select id, vms_id, gds_id, ballast, container, source, cty_id, destinatio, quantity, unit, bill_nr, CAST(IIF(EMPTY(NVL(bill_date,'//::')), '', TTOC(bill_date,1)) as C(20)) as bill_date, delivery from ips_cargoes INTO CURSOR tt
|
||||
SELECT TT
|
||||
COPY TO e:\cargoes.csv TYPE csv
|
||||
|
||||
**** IPS_VESSELS
|
||||
SELECT ips_vessels
|
||||
REINDEX
|
||||
|
||||
SELECT ID, COUNT(*) AS NR FROM IPS_VESSELS GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT IPS_VESSELS
|
||||
IF SEEK(TT.ID,'IPS_VESSELS',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
|
||||
UPDATE IPS_vessels SET registrati = STRTRAN(registrati, '"', '') WHERE !EMPTY(NVL(registrati, ''))
|
||||
UPDATE IPS_vessels SET name = STRTRAN(name, '"', '') WHERE !EMPTY(NVL(name, ''))
|
||||
SELECT ips_vessels
|
||||
COPY TO e:\vessels.csv TYPE csv
|
||||
|
||||
**** IPS_VOYAGE_LOCKS
|
||||
SELECT ips_voyage_locks
|
||||
REINDEX
|
||||
|
||||
SELECT ID, COUNT(*) AS NR FROM ips_voyage_locks GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT ips_voyage_locks
|
||||
IF SEEK(TT.ID,'ips_voyage_locks',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
|
||||
UPDATE ips_voyage_locks SET date = {//::} WHERE LEFT(TTOC(date,1),4) = '0000'
|
||||
|
||||
SELECT id, vye_id, CAST(IIF(EMPTY(NVL(date,'//::')), '', TTOC(date,1)) as C(20)) as date, rpt_id, op_min, op_prep, id_lock, lock_name FROM ips_voyage_locks INTO CURSOR tt
|
||||
SELECT tt
|
||||
COPY TO e:\voyage_locks.csv TYPE csv
|
||||
|
||||
|
||||
**** IPS_VOYAGES
|
||||
SELECT ips_voyages
|
||||
REINDEX
|
||||
|
||||
SELECT ID, COUNT(*) AS NR FROM ips_voyages GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT ips_voyages
|
||||
IF SEEK(TT.ID,'ips_voyages',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
|
||||
UPDATE ips_voyages SET generation = {//::} WHERE LEFT(TTOC(generation,1),4) = '0000'
|
||||
UPDATE ips_voyages SET notificati = {//::} WHERE LEFT(TTOC(notificati,1),4) = '0000'
|
||||
UPDATE ips_voyages SET convoy_nam = STRTRAN(convoy_nam, '"', '') WHERE !EMPTY(NVL(convoy_nam, ''))
|
||||
|
||||
select id, CAST(IIF(EMPTY(NVL(generation,'//::')), '', TTOC(generation,1)) as C(20)) as generation, ctt_id, vms_id, convoy_nam, declaratio, CAST(IIF(EMPTY(NVL(notificati,'//::')), '', TTOC(notificati,1)) as C(20)) as notificati, notificat2, origin, destinatio, state from ips_voyages INTO CURSOR tt
|
||||
SELECT tt
|
||||
COPY TO e:\voyages.csv TYPE csv
|
||||
|
||||
*** IPS_BERTHINGS
|
||||
SELECT IPS_BERTHINGS
|
||||
REINDEX
|
||||
SELECT ID, COUNT(*) AS NR FROM IPS_BERTHINGS GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
lnDuplicate = nr
|
||||
FOR lnDuplicat = 1 TO lnDuplicate - 1
|
||||
SELECT IPS_BERTHINGS
|
||||
IF SEEK(TT.ID,'IPS_BERTHINGS',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDFOR
|
||||
ENDSCAN
|
||||
|
||||
UPDATE IPS_BERTHINGS SET arrival_ti = {//::} WHERE LEFT(TTOC(arrival_ti,1),4) = '0000'
|
||||
UPDATE IPS_BERTHINGS SET departure_ = {//::} WHERE LEFT(TTOC(departure_,1),4) = '0000'
|
||||
|
||||
SELECT id, CAST(IIF(EMPTY(NVL(arrival_ti,'//::')), '', TTOC(arrival_ti,1)) as C(20)) as arrival_ti, voy_id, CAST(IIF(EMPTY(NVL(departure_,'//::')), '', TTOC(departure_,1)) as C(20)) as departure_, rpt_id, ctt_id, ves_id FROM ips_berthings INTO CURSOR tt
|
||||
SELECT TT
|
||||
COPY TO e:\berthings.csv TYPE csv
|
||||
|
||||
*** IPS_ROUTE_POINTS
|
||||
SELECT IPS_ROUTE_POINTS
|
||||
REINDEX
|
||||
SELECT ID, COUNT(*) AS NR FROM IPS_ROUTE_POINTS GROUP BY ID HAVING COUNT(*) > 1 INTO CURSOR TT
|
||||
SELECT TT
|
||||
SCAN
|
||||
SELECT IPS_ROUTE_POINTS
|
||||
IF SEEK(TT.ID,'IPS_ROUTE_POINTS',"ID")
|
||||
DELETE
|
||||
ENDIF
|
||||
ENDSCAN
|
||||
|
||||
SELECT id, acronym, name, cnl_id FROM ips_route_points INTO CURSOR tt
|
||||
SELECT TT
|
||||
COPY TO e:\route_points.csv TYPE csv
|
||||
|
||||
|
||||
*********************************************************************************************
|
||||
*********************************************************************************************
|
||||
*********************************************************************************************
|
||||
*** DATABASE LOAD TABLES FROM CSV
|
||||
TEXT TO lcSql noshow
|
||||
|
||||
-- Create table
|
||||
create table IPS_VOYAGE_MEMBERS_EXT
|
||||
(
|
||||
id VARCHAR2(36),
|
||||
vye_id VARCHAR2(36),
|
||||
vsl_id VARCHAR2(36),
|
||||
ctt_id VARCHAR2(36),
|
||||
ctt_id_has NUMBER(12),
|
||||
ctt_id_ha2 NUMBER(12),
|
||||
confirm_pa VARCHAR2(20),
|
||||
dirty_tank VARCHAR2(1),
|
||||
place_barg VARCHAR2(2),
|
||||
rstart_id VARCHAR2(36),
|
||||
rfin_id VARCHAR2(36),
|
||||
distance VARCHAR2(20),
|
||||
cnt_mnvr VARCHAR2(10),
|
||||
distance_c VARCHAR2(20)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
(TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY DMPDIR
|
||||
ACCESS PARAMETERS
|
||||
(
|
||||
RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
)
|
||||
LOCATION ('voyage_members.csv')
|
||||
);
|
||||
|
||||
|
||||
insert into ips_voyage_members
|
||||
(id,
|
||||
vye_id,
|
||||
vsl_id,
|
||||
ctt_id,
|
||||
ctt_id_has,
|
||||
ctt_id_ha2,
|
||||
confirm_pa,
|
||||
dirty_tank,
|
||||
place_barg,
|
||||
rstart_id,
|
||||
rfin_id,
|
||||
distance,
|
||||
cnt_mnvr,
|
||||
distance_c)
|
||||
select id,
|
||||
vye_id,
|
||||
vsl_id,
|
||||
ctt_id,
|
||||
ctt_id_has,
|
||||
ctt_id_ha2,
|
||||
confirm_pa,
|
||||
dirty_tank,
|
||||
place_barg,
|
||||
rstart_id,
|
||||
rfin_id,
|
||||
TO_NUMBER(distance, '99999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as distance,
|
||||
cnt_mnvr,
|
||||
TO_NUMBER(distance_c,
|
||||
'99999999D99',
|
||||
'NLS_NUMERIC_CHARACTERS=''.,''') as distance_c
|
||||
from ips_voyage_members_ext;
|
||||
|
||||
|
||||
-- Create table
|
||||
create table IPS_CARGOES_EXT
|
||||
(
|
||||
id VARCHAR2(36),
|
||||
vms_id VARCHAR2(36),
|
||||
gds_id VARCHAR2(36),
|
||||
ballast VARCHAR2(20),
|
||||
container VARCHAR2(10),
|
||||
source VARCHAR2(100),
|
||||
cty_id VARCHAR2(36),
|
||||
destinatio VARCHAR2(100),
|
||||
quantity VARCHAR2(20),
|
||||
unit VARCHAR2(10),
|
||||
bill_nr VARCHAR2(6),
|
||||
bill_date DATE,
|
||||
delivery VARCHAR2(5)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
(TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY DMPDIR
|
||||
ACCESS PARAMETERS
|
||||
(
|
||||
RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
(id, vms_id, gds_id, ballast, container, source, cty_id, destinatio, quantity, unit, bill_nr, bill_date date 'yyyymmddhh24miss', delivery)
|
||||
)
|
||||
LOCATION ('cargoes.csv')
|
||||
);
|
||||
|
||||
|
||||
insert into ips_cargoes
|
||||
(id,
|
||||
vms_id,
|
||||
gds_id,
|
||||
ballast,
|
||||
container,
|
||||
source,
|
||||
cty_id,
|
||||
destinatio,
|
||||
quantity,
|
||||
unit,
|
||||
bill_nr,
|
||||
bill_date,
|
||||
delivery)
|
||||
select id,
|
||||
vms_id,
|
||||
gds_id,
|
||||
TO_NUMBER(ballast, '99999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as ballast,
|
||||
TO_NUMBER(container, '9999', 'NLS_NUMERIC_CHARACTERS=''.,''') as container,
|
||||
source,
|
||||
cty_id,
|
||||
destinatio,
|
||||
TO_NUMBER(quantity, '99999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as quantity,
|
||||
unit,
|
||||
bill_nr,
|
||||
bill_date,
|
||||
delivery
|
||||
from ips_cargoes_ext;
|
||||
|
||||
|
||||
create table IPS_VESSELS_EXT
|
||||
(
|
||||
id VARCHAR2(36),
|
||||
registrati VARCHAR2(240),
|
||||
name VARCHAR2(240),
|
||||
lbd VARCHAR2(20),
|
||||
max_draugh VARCHAR2(20),
|
||||
cruising_s VARCHAR2(20),
|
||||
callsign VARCHAR2(240),
|
||||
mmsi VARCHAR2(40),
|
||||
length VARCHAR2(20),
|
||||
breadth VARCHAR2(20),
|
||||
ctt_id VARCHAR2(36),
|
||||
cty_id VARCHAR2(12),
|
||||
deadweight VARCHAR2(20),
|
||||
gross_tonn VARCHAR2(20),
|
||||
net_tonnag VARCHAR2(20),
|
||||
horsepower VARCHAR2(12),
|
||||
gps_from_b VARCHAR2(20),
|
||||
gps_from_c VARCHAR2(20),
|
||||
gps_from_s VARCHAR2(20),
|
||||
inmarsat_n VARCHAR2(240),
|
||||
trn VARCHAR2(20),
|
||||
vtp_id VARCHAR2(36),
|
||||
vtmis_id VARCHAR2(36)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
(TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY DMPDIR
|
||||
ACCESS PARAMETERS
|
||||
(
|
||||
RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
)
|
||||
LOCATION ('vessels.csv')
|
||||
);
|
||||
|
||||
insert into ips_vessels
|
||||
(id,
|
||||
registrati,
|
||||
name,
|
||||
lbd,
|
||||
max_draugh,
|
||||
cruising_s,
|
||||
callsign,
|
||||
mmsi,
|
||||
length,
|
||||
breadth,
|
||||
ctt_id,
|
||||
cty_id,
|
||||
deadweight,
|
||||
gross_tonn,
|
||||
net_tonnag,
|
||||
horsepower,
|
||||
gps_from_b,
|
||||
gps_from_c,
|
||||
gps_from_s,
|
||||
inmarsat_n,
|
||||
trn,
|
||||
vtp_id,
|
||||
vtmis_id)
|
||||
select id,
|
||||
registrati,
|
||||
name,
|
||||
TO_NUMBER(lbd, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as lbd,
|
||||
TO_NUMBER(max_draugh, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as max_draugh,
|
||||
TO_NUMBER(cruising_s, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as cruising_s,
|
||||
callsign,
|
||||
mmsi,
|
||||
TO_NUMBER(length, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as length,
|
||||
TO_NUMBER(breadth, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as breadth,
|
||||
ctt_id,
|
||||
TO_NUMBER(cty_id, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as cty_id,
|
||||
TO_NUMBER(deadweight, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as deadweight,
|
||||
TO_NUMBER(gross_tonn, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as gross_tonn,
|
||||
TO_NUMBER(net_tonnag, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as net_tonnag,
|
||||
TO_NUMBER(horsepower, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as horsepower,
|
||||
TO_NUMBER(gps_from_b, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as gps_from_b,
|
||||
TO_NUMBER(gps_from_c, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as gps_from_c,
|
||||
TO_NUMBER(gps_from_s, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as gps_from_s,
|
||||
inmarsat_n,
|
||||
TO_NUMBER(trn, '9999999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as trn,
|
||||
vtp_id,
|
||||
vtmis_id
|
||||
from ips_vessels_ext;
|
||||
|
||||
|
||||
create table IPS_VOYAGE_LOCKS_EXT
|
||||
(
|
||||
id VARCHAR2(36),
|
||||
vye_id VARCHAR2(36),
|
||||
"date" DATE,
|
||||
rpt_id VARCHAR2(36),
|
||||
op_min VARCHAR2(36),
|
||||
op_prep VARCHAR2(36),
|
||||
id_lock VARCHAR2(36),
|
||||
lock_name VARCHAR2(16)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
(TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY DMPDIR
|
||||
ACCESS PARAMETERS
|
||||
(
|
||||
RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
(id, vye_id, "date" date 'yyyymmddhh24miss', rpt_id, op_min, op_prep, id_lock, lock_name)
|
||||
)
|
||||
LOCATION ('voyage_locks.csv')
|
||||
);
|
||||
|
||||
|
||||
insert into ips_voyage_locks
|
||||
(id, vye_id, "date", rpt_id, op_min, op_prep, id_lock, lock_name)
|
||||
select id,
|
||||
vye_id,
|
||||
"date",
|
||||
rpt_id,
|
||||
TO_NUMBER(op_min, '99999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as op_min,
|
||||
TO_NUMBER(op_prep, '99999999D99', 'NLS_NUMERIC_CHARACTERS=''.,''') as op_prep,
|
||||
id_lock,
|
||||
lock_name
|
||||
from ips_voyage_locks_ext;
|
||||
|
||||
|
||||
create table IPS_VOYAGES_EXT
|
||||
(
|
||||
id VARCHAR2(36),
|
||||
generation DATE,
|
||||
ctt_id VARCHAR2(36),
|
||||
vms_id VARCHAR2(36),
|
||||
convoy_nam VARCHAR2(100),
|
||||
declaratio VARCHAR2(8),
|
||||
notificati DATE,
|
||||
notificat2 VARCHAR2(20),
|
||||
origin VARCHAR2(100),
|
||||
destinatio VARCHAR2(100),
|
||||
state VARCHAR2(1)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
(TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY DMPDIR
|
||||
ACCESS PARAMETERS
|
||||
(
|
||||
RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
(id,generation date 'yyyymmddhh24miss',ctt_id,vms_id,convoy_nam,declaratio,notificati date 'yyyymmddhh24miss',notificat2,origin,destinatio,state)
|
||||
)
|
||||
LOCATION ('voyages.csv')
|
||||
);
|
||||
|
||||
|
||||
insert into ips_voyages
|
||||
(id,
|
||||
generation,
|
||||
ctt_id,
|
||||
vms_id,
|
||||
convoy_nam,
|
||||
declaratio,
|
||||
notificati,
|
||||
notificat2,
|
||||
origin,
|
||||
destinatio,
|
||||
state)
|
||||
select id,
|
||||
generation,
|
||||
ctt_id,
|
||||
vms_id,
|
||||
convoy_nam,
|
||||
declaratio,
|
||||
notificati,
|
||||
notificat2,
|
||||
origin,
|
||||
destinatio,
|
||||
TO_NUMBER(state, '9', 'NLS_NUMERIC_CHARACTERS=''.,''') as state
|
||||
from ips_voyages_ext;
|
||||
|
||||
|
||||
CREATE TABLE ips_berthings_ext
|
||||
(
|
||||
id varchar2 (36),
|
||||
arrival_ti DATE ,
|
||||
voy_id varchar2 (36) ,
|
||||
departure_ DATE ,
|
||||
rpt_id varchar2 (36) ,
|
||||
ctt_id varchar2 (36) ,
|
||||
ves_id varchar2 (36)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
( TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY "DMPDIR"
|
||||
ACCESS PARAMETERS
|
||||
( RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
(id, arrival_ti date 'yyyymmddhh24miss', voy_id, departure_ date 'yyyymmddhh24miss', rpt_id, ctt_id, ves_id)
|
||||
)
|
||||
LOCATION
|
||||
( 'berthings.csv'
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
insert into ips_berthings
|
||||
(id, arrival_ti, voy_id, departure_, rpt_id, ctt_id, ves_id)
|
||||
select id, arrival_ti, voy_id, departure_, rpt_id, ctt_id, ves_id from ips_berthings_ext;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE ips_route_points_ext
|
||||
(
|
||||
id varchar2 (36) ,
|
||||
acronym varchar2 (6),
|
||||
name varchar2 (100),
|
||||
cnl_id NUMBER (2, 0)
|
||||
)
|
||||
ORGANIZATION EXTERNAL
|
||||
( TYPE ORACLE_LOADER
|
||||
DEFAULT DIRECTORY "DMPDIR"
|
||||
ACCESS PARAMETERS
|
||||
( RECORDS DELIMITED BY NEWLINE
|
||||
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
|
||||
(id, acronym, name, cnl_id)
|
||||
)
|
||||
LOCATION
|
||||
( 'route_points.csv'
|
||||
)
|
||||
)
|
||||
;
|
||||
INSERT INTO ips_route_points
|
||||
(id, acronym, name, cnl_id)
|
||||
SELECT id, acronym, name, cnl_id FROM ips_route_points_ext;
|
||||
|
||||
ENDTEXT
|
||||
|
||||
|
||||
133
database.txt
Normal file
@@ -0,0 +1,133 @@
|
||||
ACN
|
||||
create synonym ips_voyages for roris.ips_voyages;
|
||||
create synonym ips_voyage_members for roris.ips_voyage_members;
|
||||
create synonym ips_vessels for roris.ips_vessels;
|
||||
create synonym ips_routes for roris.ips_routes;
|
||||
create synonym ips_contacts for roris.ips_contacts;
|
||||
create synonym ips_cargoes for roris.ips_cargoes;
|
||||
create synonym ips_goods for roris.ips_goods;
|
||||
create synonym ips_goods_groups for roris.ips_goods_groups;
|
||||
create synonym ips_vessel_types for roris.ips_vessel_types;
|
||||
create synonym ips_voyage_locks for roris.ips_voyage_locks;
|
||||
create synonym ips_vas_um for roris.ips_vas_um;
|
||||
create synonym ips_vas_echivalent for roris.ips_vas_echivalent;
|
||||
create synonym ips_grup_tip_nave for roris.ips_grup_tip_nave;
|
||||
create synonym ips_berthings for roris.ips_berthings;
|
||||
create synonym ips_route_points for roris.ips_route_points;
|
||||
create synonym ips_vberthings for roris.ips_vberthings;
|
||||
create synonym ips_vroute_points for roris.ips_vroute_points;
|
||||
create synonym ips_aramis_tip_nave for roris.ips_aramis_tip_nave;
|
||||
create synonym ips_varamis_tip_nave for roris.ips_varamis_tip_nave;
|
||||
create synonym ips_vvoyages for roris.ips_vvoyages;
|
||||
create synonym ips_vvoyage_members for roris.ips_vvoyage_members;
|
||||
create synonym ips_vvessels for roris.ips_vvessels;
|
||||
create synonym ips_vroutes for roris.ips_vroutes;
|
||||
create synonym ips_vcontacts for roris.ips_vcontacts;
|
||||
create synonym ips_vcargoes for roris.ips_vcargoes;
|
||||
create synonym ips_vgoods for roris.ips_vgoods;
|
||||
create synonym ips_vgoods_groups for roris.ips_vgoods_groups;
|
||||
create synonym ips_vvessel_types for roris.ips_vvessel_types;
|
||||
create synonym ips_vgrupe_vase for roris.ips_vgrupe_vase;
|
||||
create synonym ips_vvoyage_locks for roris.ips_vvoyage_locks;
|
||||
create synonym ips_vvas_um for roris.ips_vvas_um;
|
||||
create synonym ips_vvas_echivalent for roris.ips_vvas_echivalent;
|
||||
create synonym ips_vgrup_tip_nave for roris.ips_vgrup_tip_nave;
|
||||
create synonym ips_dane for roris.ips_dane;
|
||||
|
||||
RORIS
|
||||
grant select on roris.ips_route_points to mariusm_auto;
|
||||
grant references on roris.ips_route_points to mariusm_auto;
|
||||
grant select on roris.ips_aramis_tip_nave to mariusm_auto;
|
||||
grant references on roris.ips_aramis_tip_nave to mariusm_auto;
|
||||
grant select on roris.ips_berthings to mariusm_auto;
|
||||
grant references on roris.ips_berthings to mariusm_auto;
|
||||
grant select on roris.ips_voyages to mariusm_auto;
|
||||
grant select on roris.ips_voyage_members to mariusm_auto;
|
||||
grant select on roris.ips_vessels to mariusm_auto;
|
||||
grant select on roris.ips_contacts to mariusm_auto;
|
||||
grant select on roris.ips_cargoes to mariusm_auto;
|
||||
|
||||
grant select on roris.ips_goods to mariusm_auto;
|
||||
grant select on roris.ips_goods_groups to mariusm_auto;
|
||||
grant select on roris.ips_vessel_types to mariusm_auto;
|
||||
grant select on roris.ips_voyage_locks to mariusm_auto;
|
||||
|
||||
grant select on roris.ips_vas_um to mariusm_auto;
|
||||
grant select on roris.ips_vas_echivalent to mariusm_auto;
|
||||
grant select on roris.ips_grup_tip_nave to mariusm_auto;
|
||||
grant select on roris.ips_dane to mariusm_auto;
|
||||
|
||||
grant references on roris.ips_voyages to mariusm_auto;
|
||||
grant references on roris.ips_voyage_members to mariusm_auto;
|
||||
grant references on roris.ips_routes to mariusm_auto;
|
||||
grant references on roris.ips_contacts to mariusm_auto;
|
||||
grant references on roris.ips_cargoes to mariusm_auto;
|
||||
|
||||
grant references on roris.ips_goods to mariusm_auto;
|
||||
grant references on roris.ips_goods_groups to mariusm_auto;
|
||||
grant references on roris.ips_vessel_types to mariusm_auto;
|
||||
grant references on roris.ips_voyage_locks to mariusm_auto;
|
||||
|
||||
grant references on roris.ips_vas_um to mariusm_auto;
|
||||
grant references on roris.ips_vas_echivalent to mariusm_auto;
|
||||
grant references on roris.ips_grup_tip_nave to mariusm_auto;
|
||||
grant references on roris.ips_dane to mariusm_auto;
|
||||
|
||||
alter table IPS_BERTHINGS add constraint PK_BERTHINGS primary key (ID);
|
||||
alter table IPS_CARGOES add constraint PK_CARGOES primary key (ID);
|
||||
alter table IPS_CONTACTS add constraint PK_CONTACTS primary key (ID);
|
||||
alter table IPS_COUNTRIES add constraint PK_COUNTRIES primary key (ID);
|
||||
alter table IPS_GOODS add constraint PK_GOODS primary key (ID);
|
||||
alter table IPS_ROUTE_POINTS add constraint PK_ROUTE_POINTS primary key (ID);
|
||||
alter table IPS_ROUTES add constraint PK_ROUTES primary key (ID);
|
||||
alter table IPS_VESSELS add constraint PK_VESSELS primary key (ID);
|
||||
alter table IPS_VESSEL_TYPES add constraint PK_VESSEL_TYPES primary key (ID);
|
||||
alter table IPS_VOYAGE_LOCKS add constraint PK_VOYAGE_LOCKS primary key (ID);
|
||||
alter table IPS_VOYAGE_MEMBERS add constraint PK_VOYAGE_MEMBERS primary key (ID);
|
||||
alter table IPS_VOYAGES add constraint PK_VOYAGES primary key (ID);
|
||||
|
||||
|
||||
|
||||
|
||||
UPDATE IPS_TARIFE SET ID_VALUTA = 2 WHERE VALUTA LIKE 'EUR%';
|
||||
UPDATE IPS_TARIFE_DIVERSE SET ID_VALUTA = 2 WHERE NUMEVALUTA LIKE 'EUR%';
|
||||
UPDATE IPS_TARIFE_DIVERSE SET ID_VALUTA = 1 WHERE NUMEVALUTA LIKE 'USD%';
|
||||
UPDATE IPS_TARIFE_DIVERSE SET ID_VALUTA = 0 WHERE NUMEVALUTA LIKE 'LEI%' OR NUMEVALUTA IS NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
drop synonym ips_voyages;
|
||||
drop synonym ips_voyage_members;
|
||||
drop synonym ips_vessels;
|
||||
drop synonym ips_routes;
|
||||
drop synonym ips_contacts;
|
||||
drop synonym ips_cargoes;
|
||||
drop synonym ips_goods;
|
||||
drop synonym ips_goods_groups;
|
||||
drop synonym ips_vessel_types;
|
||||
drop synonym ips_voyage_locks;
|
||||
drop synonym ips_vas_um;
|
||||
drop synonym ips_vas_echivalent;
|
||||
drop synonym ips_grup_tip_nave;
|
||||
drop synonym ips_berthings;
|
||||
drop synonym ips_route_points;
|
||||
drop synonym ips_vberthings;
|
||||
drop synonym ips_vroute_points;
|
||||
drop synonym ips_aramis_tip_nave;
|
||||
drop synonym ips_varamis_tip_nave;
|
||||
drop synonym ips_vvoyages;
|
||||
drop synonym ips_vvoyage_members;
|
||||
drop synonym ips_vvessels;
|
||||
drop synonym ips_vroutes;
|
||||
drop synonym ips_vcontacts;
|
||||
drop synonym ips_vcargoes;
|
||||
drop synonym ips_vgoods;
|
||||
drop synonym ips_vgoods_groups;
|
||||
drop synonym ips_vvessel_types;
|
||||
drop synonym ips_vgrupe_vase;
|
||||
drop synonym ips_vvoyage_locks;
|
||||
drop synonym ips_vvas_um;
|
||||
drop synonym ips_vvas_echivalent;
|
||||
drop synonym ips_vgrup_tip_nave;
|
||||
drop synonym ips_dane;
|
||||
79
docs/facturare.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Fluxul facturilor (ROAACNPRO)
|
||||
|
||||
Document de referință minimal: ce fișiere trebuie verificate/modificate când se schimbă
|
||||
ceva la facturare. Backend = Oracle (prin `goExecutor`/`goConn`), front-end = VFP9.
|
||||
|
||||
## Componentele cheie
|
||||
|
||||
| Rol | Fișier | Observații |
|
||||
|-----|--------|-----------|
|
||||
| Formularul de facturare | clasa `frm_factura` din `Clase/oacnpro.vcx` (cod în `.vct`) | **se editează în IDE VFP**, nu manual |
|
||||
| Procedurile de facturare VFP | `Programe/proceduri_acnpro.prg` | `factura_salvare_db`, `make_cfactura`, `factura_acn` |
|
||||
| Rapoarte facturare | `Programe/proceduri_acnpro_rapoarte.prg` + `Rapoarte/*.frx` | relistare/printare factură |
|
||||
| Calcul + salvare valori în Oracle | `PACK_FACTURARE.pck` (pachet PL/SQL) | **sursa de adevăr** pentru valori |
|
||||
| Framework facturare partajat | `COMUN/programe/ofacturare_comun.prg`, `oproceduri_facturare.prg` | partajat între aplicațiile ROA; a se evita modificarea |
|
||||
|
||||
## Lanțul de calcul (form → pachet → rapoarte)
|
||||
|
||||
1. **Introducere / import** (`frm_factura` + `factura_acn`): articolele intră în cursorul
|
||||
`crsFactura` (creat în `make_cfactura`, `proceduri_acnpro.prg`). Import din
|
||||
contract/tranzit/cheiaj prin `Insert Into crsFactura(...)` în `factura_acn`.
|
||||
2. **Preview pe ecran** (`frm_factura.CalculeazaPreturiRand` + `CalculeazaTotaluri`):
|
||||
calculează valorile fiecărui rând **doar pentru afișare**.
|
||||
3. **Salvare** (`factura_salvare_db`): copiază rândurile din `crsFactura` în cursorul
|
||||
`crsvanztemp`, apoi le trimite în Oracle prin `PACK_FACTURARE` (un apel per rând).
|
||||
4. **Calcul autoritar** (`PACK_FACTURARE`): recalculează și stochează
|
||||
`total_fara_tva / total_tva / total_cu_tva` în `vanzari` (antet) și `vanzari_detalii` (rânduri).
|
||||
5. **Relistare / lista de facturi**: `proceduri_acnpro_rapoarte.prg` și interogările din
|
||||
`proceduri_acnpro.prg` (~liniile 1180, 1222) **citesc** valorile deja calculate din Oracle
|
||||
(`v.total_cu_tva` etc.) — **nu recalculează**.
|
||||
|
||||
> **Regula de sincronizare:** valorile reale sunt cele calculate de `PACK_FACTURARE` la salvare.
|
||||
> Preview-ul din `frm_factura` trebuie să folosească **aceleași formule** ca pachetul, iar
|
||||
> `factura_salvare_db` trebuie să trimită corect toți parametrii relevanți. Dacă cele două
|
||||
> diverg, ecranul arată altceva decât factura salvată/relistată.
|
||||
|
||||
## Structura `crsFactura` (rândul de factură în memorie)
|
||||
|
||||
Definit în `make_cfactura` (`proceduri_acnpro.prg`). Câmpuri relevante:
|
||||
|
||||
- `pretval` = preț unitar în valută (prețul introdus de operator; baza calculului)
|
||||
- `Curs` = curs valutar; `Pret` = preț unitar în lei = `pretval * Curs`
|
||||
- `cantitate`
|
||||
- `proc_tva` = multiplicatorul de TVA (ex. **1.19**, nu 19). La salvare e trimis ca `proc_tvav`.
|
||||
- `pret_cu_tva` N(1) = flag: 1 = `pretval` este **cu TVA inclus**, 0 = fără TVA
|
||||
- Lei: `valftva` (fără TVA), `valtva` (TVA), `valctva` (cu TVA)
|
||||
- Valută: `valval` (fără TVA), `tvaval` (TVA), `totval` (cu TVA)
|
||||
|
||||
## Formule TVA
|
||||
|
||||
Cu `proc_tva` = multiplicator (1 + cotă/100):
|
||||
|
||||
- **Preț fără TVA** (`pret_cu_tva = 0`): `valftva = Pret*cant`; `valtva = valftva*(proc_tva-1)`;
|
||||
`valctva = valftva + valtva`.
|
||||
- **Preț cu TVA inclus** (`pret_cu_tva = 1`, calcul invers, identic cu `PACK_FACTURARE`,
|
||||
`V_PRET_CU_TVA = 1`, PACK_FACTURARE.pck ~15700–15922):
|
||||
`valctva = Pret*cant`; `valtva = valctva*(proc_tva-1)/proc_tva`; `valftva = valctva - valtva`.
|
||||
|
||||
Rotunjiri: lei la `gnPC`, valută la `gnPval` (opțiuni firmă `PC` / `PPRETV` în pachet).
|
||||
|
||||
## Unde modific când...
|
||||
|
||||
- **Calculul valorilor pe rând (preview)** → `frm_factura.CalculeazaPreturiRand` (IDE VFP).
|
||||
- **Ce se trimite la salvare în Oracle** → `factura_salvare_db` (insert `crsvanztemp` + apel pachet).
|
||||
- **Calculul/stocarea finală a valorilor** → `PACK_FACTURARE.pck` (a se ține sincron cu preview-ul).
|
||||
- **Coloane noi pe rândul de factură** → `make_cfactura` (cursor) + grid `grdFactura` (IDE VFP)
|
||||
+ import în `factura_acn` + insert în `factura_salvare_db`.
|
||||
- **Aspectul facturii tipărite / relistare** → `proceduri_acnpro_rapoarte.prg` + `Rapoarte/*.frx`.
|
||||
- **Lista de facturi** → interogările din `proceduri_acnpro.prg` (citesc din `vanzari`).
|
||||
|
||||
## Exemplu real: suport „preț cu TVA inclus" (v2.0.4)
|
||||
|
||||
Lanțul complet care a trebuit atins pentru o singură funcționalitate:
|
||||
1. `make_cfactura` — coloană nouă `pret_cu_tva N(1)` în `crsFactura`.
|
||||
2. `frm_factura.CalculeazaPreturiRand` — branch pe `pret_cu_tva` (calcul invers).
|
||||
3. `grdFactura` — coloană checkbox editabilă legată de `crsFactura.pret_cu_tva`.
|
||||
4. `factura_salvare_db` — trimite `Nvl(pret_cu_tva,0)` (nu mai e hardcodat 0) către pachet.
|
||||
|
||||
Pachetul și rapoartele **aveau deja** suport pentru `pret_cu_tva`, deci nu au fost modificate —
|
||||
exemplu tipic de „verifică întâi ce face deja pachetul/raportul".
|
||||
29
import_contafin/cheiaje_acn.prg
Normal file
@@ -0,0 +1,29 @@
|
||||
CD "D:\STANDARDE\CN_A.C.N\DATEAN"
|
||||
|
||||
Sele r.id as rgd_id, r.fact_id, sum(C.VALVAL) as valval, MAX(c.numevaluta) as numevaluta ;
|
||||
From ips_DOCDETALIU d Join ips_CHELTDETALIU C On d.Id = C.DCD_ID;
|
||||
join ips_regdoc r on d.rgd_id = r.id join ips_facturare f on r.fact_id = f.id where YEAR(f.datafact) <= 2019 and !EMPTY(NVL(r.fact_id,0)) ;
|
||||
group by 1,2 ;
|
||||
Order By 1 ;
|
||||
Into Cursor TRECAP
|
||||
|
||||
set textmerge on to memvar lcText noshow
|
||||
sele trecap
|
||||
scan
|
||||
scat name loRec
|
||||
\update ips_Regdoc set pret = <<loRec.Valval>>, valval = <<loRec.Valval>> where id = <<loRec.rgd_id>> and id_vanzare = <<loRec.fact_id>>;
|
||||
if MOD(RECNO(),1000) = 0
|
||||
\commit;
|
||||
endif
|
||||
endscan
|
||||
\
|
||||
\update ips_regdoc r
|
||||
\ set valftva = round(curs * valval, 2)
|
||||
\ where exists (select id
|
||||
\ from vanzari v
|
||||
\ where v.id_vanzare = r.id_vanzare and v.tip_factura = 1
|
||||
\ and extract(year from v.data_act) <=2019);
|
||||
set textmerge to
|
||||
|
||||
strtofile(m.lcText, 'd:\cheiaje.sql')
|
||||
|
||||
BIN
importroris.pjx
Normal file
BIN
roaacnpro.PJX
Normal file
BIN
verificare_roris_ecluze.pjx
Normal file
10
verificare_roris_ecluze_settings.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
[email]
|
||||
mailserver = mail.acn.ro
|
||||
port = 25
|
||||
username = facturare@acn.ro
|
||||
password = fe1VLsNMZDZVJKW
|
||||
ssl = 0
|
||||
from = compania@acn.ro
|
||||
to = compania@acn.ro
|
||||
cc =
|
||||
bcc = mmarius28@gmail.com
|
||||
1
versiune_db.txt
Normal file
@@ -0,0 +1 @@
|
||||
2025_07_23_01
|
||||