* probe_s9_4_fdoc.prg - READ-ONLY: id_fdoc e uniform pe randurile vact_tot ale unui document? * Extractia din StergeDocumentFacturare ia primul rand (GO top, order by id_act), nu max(). SET SAFETY OFF SET TALK OFF PUBLIC gcErrLog gcErrLog = 'D:\ROA\ROAFACTURARE\COMUN\utile\Teste\editare_factura\probe_s9_4_fdoc_log.txt' STRTOFILE('start' + CHR(13) + CHR(10), gcErrLog) ON ERROR DO test_error_handler WITH ERROR(), MESSAGE(), PROGRAM(), LINENO() DO ('D:\ROA\ROAFACTURARE\COMUN\utile\Teste\test_init_env_auto_roafacturare.prg') WITH 'CENTRAL', 'MARIUSM_AUTO', 'ROMFASTSOFT' IF gnHandle <= 0 QUIT ENDIF *!* randurile documentului vechi 1071 (cod 1141096), in ordinea pe care o vede actactan DO Lista WITH 'vact_tot cod 1141096 (doc vechi 1071), order by id_act - primul rand e cel citit', ; [select id_act, id_fdoc, id_set, dataireg from ] + gcs + [.vact_tot ] + ; [where an = 2026 and luna = 8 and cod = 1141096 order by id_act] DO Lista WITH 'vact_tot pentru documentul nou 1138', ; [select a.id_act, a.id_fdoc, a.dataireg from ] + gcs + [.vact_tot a, vanzari v ] + ; [where v.id_vanzare = 1138 and a.cod = v.cod and a.sters = 0 order by a.id_act] *!* cat de des e id_fdoc neuniform in interiorul unui document DO Lista WITH 'documente cu id_fdoc NEUNIFORM pe perioada activa', ; [select count(*) as documente_neuniforme from (] + ; [select cod from ] + gcs + [.vact_tot where sters = 0 and an = 2026 and luna = 8 ] + ; [group by cod having count(distinct id_fdoc) > 1)] DO Lista WITH 'total documente distincte in vact_tot pe perioada activa', ; [select count(distinct cod) as total from ] + gcs + [.vact_tot where sters = 0 and an = 2026 and luna = 8] STRTOFILE('end' + CHR(13) + CHR(10), gcErrLog, 1) QUIT PROCEDURE Lista LPARAMETERS tcTitlu, tcSql LOCAL lnOk, lnI, lcL IF USED('v_q') USE IN v_q ENDIF lnOk = goExecutor.oExecuta(tcSql, 'v_q') IF !lnOk STRTOFILE('--- ' + tcTitlu + ': EROARE ' + goExecutor.cEroare + CHR(13) + CHR(10), gcErrLog, 1) RETURN ENDIF SELECT v_q STRTOFILE('--- ' + tcTitlu + ': ' + TRANSFORM(RECCOUNT('v_q')) + ' randuri' + CHR(13) + CHR(10), gcErrLog, 1) SCAN WHILE RECNO() <= 20 lcL = '' FOR lnI = 1 TO FCOUNT('v_q') lcL = lcL + ALLTRIM(FIELD(lnI, 'v_q')) + '=' + ALLTRIM(TRANSFORM(EVALUATE(FIELD(lnI, 'v_q')))) + ' ' ENDFOR STRTOFILE(' ' + lcL + CHR(13) + CHR(10), gcErrLog, 1) ENDSCAN USE IN v_q ENDPROC PROCEDURE test_error_handler LPARAMETERS tnError, tcMessage, tcProgram, tnLineNo STRTOFILE('EROARE ' + TRANSFORM(tnError) + ' [' + tcProgram + ':' + TRANSFORM(tnLineNo) + '] ' + tcMessage + CHR(13) + CHR(10), gcErrLog, 1) ENDPROC