Files
comun/utile/Teste/editare_factura/probe_s9_candidati.prg
Marius Mutu 8e022d332e #13: formular de facturare unificat - etapa curenta
Squash al branch-ului de lucru plan13-s2.

Clase: ofacturare (nucleul formularului unificat), ofacturare_comun,
ferestre_cere_date, ocomenzi, caut_ora (lista de preturi in combo-urile de
cautare), omodificari.

Programe: ofacturare impartit - ofacturare_antet, ofacturare_rutare_scriere si
ogrid_latimi sunt fisiere noi; oproceduri_facturare primeste discountul pe linie
si cota standard de TVA cand articolul nu are cota pe politica.

Documentatie: capcana SQLExec no_data_found, conventia de encoding, depanarea
testelor VFP si regulile de lucru - conflictele cu modificarile venite din alte
proiecte sunt rezolvate pastrand ambele parti.

Loguri de rulare a testelor scoase din versionare; testele raman.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkyjGyrV2S7932om4kfSiK
2026-09-09 21:38:25 +03:00

89 lines
4.4 KiB
Plaintext

* probe_s9_candidati.prg
* Cauta, read-only, cate un document editabil de fiecare familie pentru testul S9-1/S9-2:
* aviz (tip=4, cu avize sursa reale), comanda (tip in 3,21,25,28,42,47, cu id_comanda), contract
* (tip in 2,6,26,52, cu id_ctr), ELSE (fara comanda/ctr/aviz sursa). Luna curenta, sters=0,
* fara urmasi, fara eproforma, fara efactura.
SET SAFETY OFF
SET TALK OFF
PUBLIC gcErrLog
gcErrLog = 'D:\ROA\ROAFACTURARE\COMUN\utile\Teste\editare_factura\probe_s9_candidati_log.txt'
STRTOFILE('start ' + TRANSFORM(DATETIME()) + CHR(13) + CHR(10), gcErrLog)
DO ('D:\ROA\ROAFACTURARE\COMUN\utile\Teste\test_init_env_auto_roafacturare.prg') WITH 'CENTRAL', 'MARIUSM_AUTO', 'ROMFASTSOFT'
IF gnHandle <= 0
STRTOFILE('EROARE: conectare esuata' + CHR(13) + CHR(10), gcErrLog, 1)
QUIT
ENDIF
gnIdUtil = 8
STRTOFILE('gnAn=' + TRANSFORM(gnAn) + ' gnLuna=' + TRANSFORM(gnLuna) + CHR(13) + CHR(10), gcErrLog, 1)
LOCAL lcSql, lnSucces
*!* aviz cu avize sursa reale (VANZARI_CORESP TIP=1)
lcSql = [select v.id_vanzare, v.tip, v.cod from vanzari v where v.sters=0 and v.tip=4 ] + ;
[and extract(year from v.data_act)=] + TRANSFORM(gnAn) + [ and extract(month from v.data_act)=] + TRANSFORM(gnLuna) + ;
[ and v.eproforma=0 and v.id_vanzare in (select id_vanzare_fact from vanzari_coresp where tip=1 and sters=0) ] + ;
[and not exists (select 1 from vanzari_coresp c where c.id_vanzare_sursa=v.id_vanzare and c.sters=0) ] + ;
[and rownum <= 5]
lnSucces = goExecutor.oExecute(lcSql, 'v_cand_aviz')
STRTOFILE('aviz: ' + TRANSFORM(lnSucces) + ' reccount=' + TRANSFORM(IIF(USED('v_cand_aviz'),RECCOUNT('v_cand_aviz'),-1)) + CHR(13) + CHR(10), gcErrLog, 1)
IF USED('v_cand_aviz')
SELECT v_cand_aviz
SCAN
STRTOFILE(' aviz cand: id_vanzare=' + TRANSFORM(id_vanzare) + ' tip=' + TRANSFORM(tip) + ' cod=' + TRANSFORM(cod) + CHR(13)+CHR(10), gcErrLog, 1)
ENDSCAN
USE IN v_cand_aviz
ENDIF
goExecutor.oReset()
*!* comanda, cu id_comanda populat
lcSql = [select v.id_vanzare, v.tip, v.cod, v.id_comanda from vanzari v where v.sters=0 and v.tip in (3,21,25,28,42,47) ] + ;
[and extract(year from v.data_act)=] + TRANSFORM(gnAn) + [ and extract(month from v.data_act)=] + TRANSFORM(gnLuna) + ;
[ and v.eproforma=0 and v.id_comanda is not null and rownum <= 5]
lnSucces = goExecutor.oExecute(lcSql, 'v_cand_cmd')
STRTOFILE('comanda: ' + TRANSFORM(lnSucces) + ' reccount=' + TRANSFORM(IIF(USED('v_cand_cmd'),RECCOUNT('v_cand_cmd'),-1)) + CHR(13) + CHR(10), gcErrLog, 1)
IF USED('v_cand_cmd')
SELECT v_cand_cmd
SCAN
STRTOFILE(' comanda cand: id_vanzare=' + TRANSFORM(id_vanzare) + ' tip=' + TRANSFORM(tip) + ' cod=' + TRANSFORM(cod) + ' id_comanda=' + TRANSFORM(id_comanda) + CHR(13)+CHR(10), gcErrLog, 1)
ENDSCAN
USE IN v_cand_cmd
ENDIF
goExecutor.oReset()
*!* contract, cu id_ctr populat
lcSql = [select v.id_vanzare, v.tip, v.cod, v.id_ctr from vanzari v where v.sters=0 and v.tip in (2,6,26,52) ] + ;
[and extract(year from v.data_act)=] + TRANSFORM(gnAn) + [ and extract(month from v.data_act)=] + TRANSFORM(gnLuna) + ;
[ and v.eproforma=0 and v.id_ctr is not null and rownum <= 5]
lnSucces = goExecutor.oExecute(lcSql, 'v_cand_ctr')
STRTOFILE('contract: ' + TRANSFORM(lnSucces) + ' reccount=' + TRANSFORM(IIF(USED('v_cand_ctr'),RECCOUNT('v_cand_ctr'),-1)) + CHR(13) + CHR(10), gcErrLog, 1)
IF USED('v_cand_ctr')
SELECT v_cand_ctr
SCAN
STRTOFILE(' contract cand: id_vanzare=' + TRANSFORM(id_vanzare) + ' tip=' + TRANSFORM(tip) + ' cod=' + TRANSFORM(cod) + ' id_ctr=' + TRANSFORM(id_ctr) + CHR(13)+CHR(10), gcErrLog, 1)
ENDSCAN
USE IN v_cand_ctr
ENDIF
goExecutor.oReset()
*!* ELSE: tip fara comanda/ctr, fara aviz sursa (asteptam listaid = '')
lcSql = [select v.id_vanzare, v.tip, v.cod from vanzari v where v.sters=0 and v.tip not in (3,21,25,28,42,47,4,2,6,26,52,44,45,46,51) ] + ;
[and extract(year from v.data_act)=] + TRANSFORM(gnAn) + [ and extract(month from v.data_act)=] + TRANSFORM(gnLuna) + ;
[ and v.eproforma=0 and v.id_comanda is null and v.id_ctr is null and rownum <= 5]
lnSucces = goExecutor.oExecute(lcSql, 'v_cand_else')
STRTOFILE('else: ' + TRANSFORM(lnSucces) + ' reccount=' + TRANSFORM(IIF(USED('v_cand_else'),RECCOUNT('v_cand_else'),-1)) + CHR(13) + CHR(10), gcErrLog, 1)
IF USED('v_cand_else')
SELECT v_cand_else
SCAN
STRTOFILE(' else cand: id_vanzare=' + TRANSFORM(id_vanzare) + ' tip=' + TRANSFORM(tip) + ' cod=' + TRANSFORM(cod) + CHR(13)+CHR(10), gcErrLog, 1)
ENDSCAN
USE IN v_cand_else
ENDIF
goExecutor.oReset()
STRTOFILE('end ' + TRANSFORM(DATETIME()) + CHR(13) + CHR(10), gcErrLog, 1)
QUIT