|  | 
| (* -------------------------------------------------------------------------------- | 
| * | 
| * Programma di esempio per la registrazione di una fattura di vendita utilizzando | 
| * le funzioni della libreria SPPSERV.DLL. | 
| * Prima di utilizzare questo esempio è necessario modificare alcune informazioni | 
| * in modo da adattare il codice alla base dati utilizzata. | 
| * | 
| * In questo esempio l'esercizio di lavoro e' considerato corrispondente all'anno | 
| * solare in corso e le date impostate per default a quella attuale. | 
| * | 
| * QUESTO SORGENTE E' FORNITO A TITOLO DI ESEMPIO COME DIMOSTRAZIONE DELL'UTILIZZO | 
| * DELLA LIBRERIA SPPSERV.DLL. NESSUNA GARANZIA, NE' IMPLICITA NE' ESPLICITA, E' | 
| * PREVISTA PER QUALSIASI UTILIZZO DIVERSO DA QUELLO INDICATO. | 
| * | 
| -------------------------------------------------------------------------------- *) | 
| program SppServTest1; | 
|  | 
| {$APPTYPE CONSOLE} | 
|  | 
| uses | 
| Windows, StdCtrls, ExtCtrls, SysUtils; | 
|  | 
| const | 
| MY_LIBRARY_NAME  = 'sppserv.dll'; | 
| SPPSRV_SUCCESS   = 0; | 
|  | 
| var | 
| // prototipi delle funzioni della sppserv.dll | 
| SPPSRVVersion              : function() : integer stdcall; | 
| SPPSRVInit                 : function(mainwnd : HWND) : integer stdcall; | 
| SPPSRVExit                 : function() : integer  stdcall; | 
| SPPSRVComuniConnect        : function(comuniconnectstring : pChar) : integer stdcall; | 
| SPPSRVDittaConnect         : function(dittaconnectstring : pChar) : integer stdcall; | 
| SPPSRVSetEsercizio         : function(esercizio : pChar) : integer stdcall; | 
| SPPSRVSetEuro              : function(IsEuro : boolean) : integer stdcall; | 
| SPPSRVSetUtente            : function(utente : pChar) : integer stdcall; | 
| SPPSRVSetTodayDate         : function(todaydate : pChar) : integer stdcall; | 
| SPPSRVActivateTransaction  : function() : integer stdcall; | 
| SPPSRVGetNum               : function(code : pChar) : integer stdcall; | 
| SPPSRVInitMovcoTransaction : function() : integer stdcall; | 
| SPPSRVEndMovcoTransaction  : function() : integer stdcall; | 
| SPPSRVSetMovcoField        : function(fldname : pChar; value : pChar) : integer stdcall; | 
| SPPSRVAppendMovcoRecord    : function() : integer stdcall; | 
| SPPSRVCheckMovcoRecord     : function() : integer stdcall; | 
| SPPSRVSetMovIvaField       : function(fldname : pChar; value : pChar) : integer stdcall; | 
| SPPSRVAppendMovIvaRecord   : function() : integer stdcall; | 
| SPPSRVCheckMovIvaRecord    : function() : integer stdcall; | 
| SPPSRVGetMovcoField        : function(fldname : pChar; value : pChar; | 
| valuelen : integer) : integer stdcall; | 
|  | 
| dll : THandle; | 
| IsError, rc, nprot : integer; | 
| numeroprot, numerodoc : string; | 
| MovcoNum : array[0..15] of char; | 
|  | 
| label | 
| END_OF_TEST, FINE; | 
|  | 
| procedure ReportError(Msg : string); | 
| var | 
| lpMsgBuf : pAnsiChar; | 
| ErrorCode : DWORD; | 
| begin | 
| GetMem(lpMsgBuf, 512); | 
| ErrorCode := GetLastError(); | 
| FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_ARGUMENT_ARRAY, | 
| nil, ErrorCode, LANG_NEUTRAL, lpMsgBuf, 512, nil); | 
| WriteLn(Msg + ': errore ' + IntToStr(ErrorCode) + ' (' + lpMsgBuf + ')'); | 
| FreeMem(lpMsgBuf); | 
| end; | 
|  | 
| procedure SetMovcoField(fldname : string; value : string); | 
| var | 
| rc : integer; | 
| begin | 
| rc := SPPSRVSetMovcoField(pChar(fldname), pChar(value)); | 
| if (rc <> SPPSRV_SUCCESS) then | 
| WriteLn('SPPSRVSetMovcoField (' +  fldname + ') ha tornato: ' + IntToStr(rc)); | 
| end; | 
|  | 
| procedure SetMovIvaField(fldname : string; value : string); | 
| var | 
| rc : integer; | 
| begin | 
| rc := SPPSRVSetMovIvaField(pChar(fldname), pChar(value)); | 
| if (rc <> SPPSRV_SUCCESS) then | 
| WriteLn('SPPSRVSetMovIvaField (' + fldname + ') ha tornato: ' + IntToStr(rc)); | 
| end; | 
|  | 
| begin | 
| WriteLn('Inizio test ' + MY_LIBRARY_NAME); | 
| WriteLn('---------------------------------------------------'); | 
| WriteLn('Caricamento DLL e estrazione funzioni...'); | 
| dll := LoadLibrary(MY_LIBRARY_NAME); | 
| if (dll > 0) then | 
| WriteLn(MY_LIBRARY_NAME + ' caricata con successo') | 
| else begin | 
| WriteLn('**********************************************'); | 
| WriteLn('ERRORE: LoadLibrary("' + MY_LIBRARY_NAME + '") fallita!'); | 
| ReportError('Dettagli'); | 
| WriteLn('**********************************************'); | 
| goto END_OF_TEST; | 
| end; | 
| // estrazione delle funzioni esportate dalla dll | 
| IsError := 0; | 
| @SPPSRVInit := GetProcAddress(dll, 'SPPSRVInit'); | 
| if (Assigned(SPPSRVInit)) then | 
| WriteLn('SPPSRVInit caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVInit") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVVersion := GetProcAddress(dll, 'SPPSRVVersion'); | 
| if (Assigned(SPPSRVVersion)) then | 
| WriteLn('SPPSRVVersion caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVVersion") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVExit := GetProcAddress(dll, 'SPPSRVExit'); | 
| if (Assigned(SPPSRVExit)) then | 
| WriteLn('SPPSRVExit caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVExit") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVComuniConnect := GetProcAddress(dll, 'SPPSRVComuniConnect'); | 
| if (Assigned(SPPSRVComuniConnect)) then | 
| WriteLn('SPPSRVComuniConnect caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVComuniConnect") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVDittaConnect := GetProcAddress(dll, 'SPPSRVDittaConnect'); | 
| if (Assigned(SPPSRVDittaConnect)) then | 
| WriteLn('SPPSRVDittaConnect caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVDittaConnect") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetEsercizio := GetProcAddress(dll, 'SPPSRVSetEsercizio'); | 
| if (Assigned(SPPSRVSetEsercizio)) then | 
| WriteLn('SPPSRVSetEsercizio caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVSetEsercizio") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetUtente := GetProcAddress(dll, 'SPPSRVSetUtente'); | 
| if (Assigned(SPPSRVSetUtente)) then | 
| WriteLn('SPPSRVSetUtente caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll,\"" << "SPPSRVSetUtente" << "\") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetTodayDate := GetProcAddress(dll, 'SPPSRVSetTodayDate'); | 
| if (Assigned(SPPSRVSetTodayDate)) then | 
| WriteLn('SPPSRVSetTodayDate caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll,\"" << "SPPSRVSetTodayDate" << "\") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetEuro := GetProcAddress(dll, 'SPPSRVSetEuro'); | 
| if (Assigned(SPPSRVSetEuro)) then | 
| WriteLn('SPPSRVSetEuro caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVSetEuro") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| {$ifndef STARTSUITE} | 
| @SPPSRVActivateTransaction := GetProcAddress(dll, 'SPPSRVActivateTransaction'); | 
| if (Assigned(SPPSRVActivateTransaction)) then | 
| WriteLn('SPPSRVActivateTransaction caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVActivateTransaction") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| {$endif} | 
| @SPPSRVGetNum := GetProcAddress(dll, 'SPPSRVGetNum'); | 
| if (Assigned(SPPSRVGetNum)) then | 
| WriteLn('SPPSRVGetNum caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVGetNum") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVInitMovcoTransaction := GetProcAddress(dll, 'SPPSRVInitMovcoTransaction'); | 
| if (Assigned(SPPSRVInitMovcoTransaction)) then | 
| WriteLn('SPPSRVInitMovcoTransaction caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVInitMovcoTransaction") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVEndMovcoTransaction := GetProcAddress(dll, 'SPPSRVEndMovcoTransaction'); | 
| if (Assigned(SPPSRVEndMovcoTransaction)) then | 
| WriteLn('SPPSRVEndMovcoTransaction caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVEndMovcoTransaction") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetMovcoField := GetProcAddress(dll, 'SPPSRVSetMovcoField'); | 
| if (Assigned(SPPSRVSetMovcoField)) then | 
| WriteLn('SPPSRVSetMovcoField caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVSetMovcoField") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVCheckMovcoRecord := GetProcAddress(dll, 'SPPSRVCheckMovcoRecord'); | 
| if (Assigned(SPPSRVCheckMovcoRecord)) then | 
| WriteLn('SPPSRVCheckMovcoRecord caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVCheckMovcoRecord") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVAppendMovcoRecord := GetProcAddress(dll, 'SPPSRVAppendMovcoRecord'); | 
| if (Assigned(SPPSRVAppendMovcoRecord)) then | 
| WriteLn('SPPSRVAppendMovcoRecord caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVAppendMovcoRecord") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVSetMovIvaField := GetProcAddress(dll, 'SPPSRVSetMovIvaField'); | 
| if (Assigned(SPPSRVSetMovIvaField)) then | 
| WriteLn('SPPSRVSetMovIvaField caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVSetMovIvaField") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVCheckMovIvaRecord := GetProcAddress(dll, 'SPPSRVCheckMovIvaRecord'); | 
| if (Assigned(SPPSRVCheckMovIvaRecord)) then | 
| WriteLn('SPPSRVCheckMovIvaRecord caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVCheckMovIvaRecord") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVAppendMovIvaRecord := GetProcAddress(dll, 'SPPSRVAppendMovIvaRecord'); | 
| if (Assigned(SPPSRVAppendMovIvaRecord)) then | 
| WriteLn('SPPSRVAppendMovIvaRecord caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVAppendMovIvaRecord") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| @SPPSRVGetMovcoField := GetProcAddress(dll, 'SPPSRVGetMovcoField'); | 
| if (Assigned(SPPSRVGetMovcoField)) then | 
| WriteLn('SPPSRVGetMovcoField caricata con successo') | 
| else begin | 
| WriteLn('**************************************************************'); | 
| WriteLn('ERRORE: GetProcAddress(dll, "SPPSRVGetMovcoField") fallita!'); | 
| WriteLn('**************************************************************'); | 
| IsError := 1; | 
| end; | 
| if (IsError = 1) then goto END_OF_TEST; | 
|  | 
| WriteLn('Test inserimento fattura di vendita...'); | 
|  | 
| (* | 
| * §: ESEMPIO di registrazione di una fattura di vendita | 
| * Il codice che segue realizza la registrazione di una fattura di vendita. | 
| * Viene gestita anche l’acquisizione del numero di protocollo iva. | 
| *) | 
|  | 
| // inizializzazione della DLL | 
| rc := SPPSRVInit(GetDesktopWindow()); | 
| WriteLn('SPPSRVInit ha tornato: ' + IntToStr(rc)); | 
| if (rc <> SPPSRV_SUCCESS) then goto END_OF_TEST; | 
| // numero di versione della dll | 
| rc := SPPSRVVersion(); | 
| WriteLn('SPPSRVVersion ha tornato: ' + IntToStr(rc)); | 
| // connessione al database dei dati comuni e dei dati ditta | 
| {$ifdef STARTSUITE} | 
| // versione per SIGLA StartSuite (archivi dui tipo DBF) | 
| rc := SPPSRVComuniConnect('C:\SIGLAPP\PROVGEN'); | 
| WriteLn('SPPSRVComuniConnect ha tornato: ' + IntToStr(rc)); | 
| if (rc <> SPPSRV_SUCCESS) then goto FINE; | 
| rc := SPPSRVDittaConnect('C:\SIGLAPP\PROVDIT'); | 
| WriteLn('SPPSRVDittaConnect ha tornato: ' + IntToStr(rc)); | 
| if (rc <> SPPSRV_SUCCESS) then goto FINE; | 
| {$else} | 
| // versione per SIGLA (accesso ai dati via ODBC) | 
| rc := SPPSRVComuniConnect('DSN=SPPGEN;UID=sigla;PWD=sigla'); | 
| WriteLn('SPPSRVComuniConnect ha tornato: ' + IntToStr(rc)); | 
| if (rc <> SPPSRV_SUCCESS) then goto FINE; | 
| rc := SPPSRVDittaConnect('DSN=SPPDIT;UID=sigla;PWD=sigla'); | 
| WriteLn('SPPSRVDittaConnect ha tornato: ' + IntToStr(rc)); | 
| if (rc <> SPPSRV_SUCCESS) then goto FINE; | 
| rc := SPPSRVActivateTransaction(); | 
| WriteLn('SPPSRVActivateTransaction ha tornato: ' + IntToStr(rc)); | 
| {$endif} | 
| // impostazione dell'esercizio di lavoro | 
| rc := SPPSRVSetEsercizio('2012'); | 
| WriteLn('SPPSRVSetEsercizio ha tornato: ' + IntToStr(rc)); | 
| // impostazione dell'utente | 
| rc := SPPSRVSetUtente('SIGLA   '); | 
| WriteLn('SPPSRVSetUtente ha tornato: ' + IntToStr(rc)); | 
| // impostazione della data | 
| rc := SPPSRVSetTodayDate('20120412'); | 
| WriteLn('SPPSRVSetTodayDate ha tornato: ' + IntToStr(rc)); | 
| // impostazione dell'euro come valuta di lavoro | 
| rc := SPPSRVSetEuro(TRUE); | 
| WriteLn('SPPSrvSetEuro ha tornato: ' + IntToStr(rc)); | 
| // acquisizione del protocollo iva dal numeratore V1 (associato alla causale contabile | 
| // utilizzata); per la ft. di vendita si utilizza sia come protocollo che come numero | 
| // documento (N.B.: SPPSRVGetNum esegue automaticamente una Commit) | 
| nprot := SPPSRVGetNum('V1'); | 
| WriteLn('SPPSRVGetNum ha tornato: ' + IntToStr(nprot)); | 
| if (nprot < 0) then goto FINE; | 
| // memorizzazione del numero acquistito in formato ASCII | 
| numeroprot := Format('%.7d', [nprot]); | 
| numerodoc := Format('%.10d', [nprot]); | 
| // inizializzazione della transazione | 
| rc := SPPSRVInitMovcoTransaction(); | 
| WriteLn('SPPSRVInitMovcoTransaction ha tornato: ' + IntToStr(rc)); | 
| if (rc = SPPSRV_SUCCESS) then begin | 
| // solo dopo l'inizializzazione può essere letto il valore del campo NUMERO | 
| // della tabella MOVCO (sarà automaticamente utilizzato anche per MOVIVA) | 
| rc := SPPSRVGetMovcoField('NUMERO', MovcoNum, Length(MovcoNum)); | 
| WriteLn('SPPSRVGetMovcoField NUMERO ha tornato: ' + IntToStr(rc)); | 
| end; | 
| // registrazione del record sul cliente (1o record di MOVCO) | 
| WriteLn('Registrazione del record sul cliente...'); | 
| SetMovcoField('DATAREG', '20120412'); | 
| SetMovcoField('ESEREGISTR', '2012'); | 
| SetMovcoField('DATACOMPET', '20120412'); | 
| SetMovcoField('DTCOMPCONT', '20120412'); | 
| SetMovcoField('ESECOMPET', '2012'); | 
| SetMovcoField('SOTTOCONTO', 'DELTA     '); | 
| SetMovcoField('C_F', 'C'); | 
| SetMovcoField('SEGNO', 'D'); | 
| // imposta la causale contabile | 
| SetMovcoField('CAUSALE', 'COR'); | 
| SetMovcoField('EIMPORTO','121.00'); | 
| SetMovcoField('EIMPFATTUR','121.00'); | 
| // imposta data e numero del documento | 
| SetMovcoField('DATAPROTOC', '20120412'); | 
| SetMovcoField('DATADOCUM', '20120412'); | 
| SetMovcoField('NUMDOCUM', numerodoc); | 
| SetMovcoField('NUMPROTOC', numeroprot); | 
| // imposta il codice del registro IVA (dipende dalla causale contabile) | 
| SetMovcoField('REGIVA', 'CO'); | 
| // imposta il tipo documento IVA (dipende dalla causale contabile) | 
| SetMovcoField('TIPODOCIVA', 'CO'); | 
| // imposta il campo CASO a "prima nota iva" | 
| SetMovcoField('CASO', '0'); | 
| // controllo e inserimento del record | 
| rc := SPPSRVCheckMovcoRecord(); | 
| WriteLn('SPPSRVCheckMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| rc := SPPSRVAppendMovcoRecord(); | 
| WriteLn('SPPSRVAppendMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| // registrazione del record sul ricavo (2o record di MOVCO) | 
| WriteLn('Registrazione del record sul ricavo...'); | 
| SetMovcoField('SOTTOCONTO', 'VENMAT    '); | 
| SetMovcoField('CONTROPART', 'DELTA     '); | 
| SetMovcoField('C_F', 'A'); | 
| SetMovcoField('SEGNO', 'A'); | 
| SetMovcoField('EIMPORTO', '100.00'); | 
| // i campi non impostati mantengono il valore del record precedente | 
| // controllo e inserimento del record | 
| rc := SPPSRVCheckMovcoRecord(); | 
| WriteLn('SPPSRVCheckMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| rc := SPPSRVAppendMovcoRecord(); | 
| WriteLn('SPPSRVAppendMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| // registrazione del record sull’iva (3o record di MOVCO) | 
| WriteLn('Registrazione del record sull''iva...'); | 
| SetMovcoField('SOTTOCONTO', '2370101003'); | 
| SetMovcoField('SEGNO', 'A'); | 
| SetMovcoField('EIMPORTO', '21.00'); | 
| SetMovcoField('EIMPORTOIV', '21.00'); | 
| SetMovcoField('MOV_IVA_SN', 'S'); | 
| // controllo e inserimento del record | 
| rc := SPPSRVCheckMovcoRecord(); | 
| WriteLn('SPPSRVCheckMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| rc := SPPSRVAppendMovcoRecord(); | 
| WriteLn('SPPSRVAppendMovcoRecord ha tornato: ' + IntToStr(rc)); | 
| // registra un record su MOVIVA | 
| WriteLn('Registrazione del record su moviva...'); | 
| SetMovIvaField('SOTTOCONTO', 'DELTA     '); | 
| SetMovIvaField('C_F', 'C'); | 
| SetMovIvaField('TIPODOCIVA', 'CO'); | 
| SetMovIvaField('REGISTRO', 'CO'); | 
| SetMovIvaField('NUMPROTOC', numeroprot); | 
| SetMovIvaField('NUMERODOC', numerodoc); | 
| SetMovIvaField('DATADOC', '20120412'); | 
| SetMovIvaField('DATAREG', '20120412'); | 
| SetMovIvaField('ETOTFATTUR','121.00'); | 
| SetMovIvaField('EIMPONIBIL','100.00'); | 
| SetMovIvaField('CODIVA','21  '); | 
| SetMovIvaField('EIMPOSTA','21.00'); | 
| // controllo e inserimento del record | 
| rc := SPPSRVCheckMovIvaRecord(); | 
| WriteLn('SPPSRVCheckMovIvaRecord ha tornato: ' + IntToStr(rc)); | 
| rc := SPPSRVAppendMovIvaRecord(); | 
| WriteLn('SPPSRVAppendMovIvaRecord ha tornato: ' + IntToStr(rc)); | 
|  | 
| // termine della transazione | 
| rc := SPPSRVEndMovcoTransaction(); | 
| WriteLn('SPPSRVEndMovcoTransaction ha tornato: ' + IntToStr(rc)); | 
| WriteLn('Registrazione eseguita MOVCO.NUMERO = "' + StrPas(MovcoNum) + '"'); | 
|  | 
| FINE: | 
| // resetta la DLL | 
| rc := SPPSRVExit(); | 
| WriteLn('SPPSRVExit ha tornato: ' + IntToStr(rc)); | 
|  | 
| END_OF_TEST: | 
| if (dll > 0 ) then FreeLibrary(dll); | 
| WriteLn('---------------------------------------------------'); | 
| WriteLn('Fine test ' + MY_LIBRARY_NAME); | 
|  | 
| WriteLn('... premere <INVIO> per terminare...'); | 
| ReadLn; | 
| end. |