ofacturare_editare.prg (nou): helpere comune - garda eFactura, cursoarele notei si ale rulajelor, randul de vanzare corespunzator notei si liniile de articole citite din view-ul VVANZARI_ARTICOLE. omodificari.vc2 (frm_modific2024): pagina noua de articole ale facturii, deocamdata doar afisare. Apare numai cand ofacturare_editare.prg e inregistrat si documentul are rand in VANZARI; in ROACONT si ROAGEST, unde fisierul nu e incarcat, pagina lipseste si registrul jurnal ramane neatins. Randul de vanzare al notei se cauta pe toate tripletele distincte (nract, serie_act, dataact) din nota, pentru ca primul rand poate fi o incasare. ofacturare_comun.vc2 (frm_facturi): do_editare_factura si butonul aferent, dupa modelul lui do_sterge, cu garzile de luna inchisa, luna curenta, document sters, referinte si eFactura. docs: comentariile se scriu strict necesar, si in cod si in scripturile de migrare - fara referinte la planuri, stories, decizii sau erori, istoricul doar in antetul fisierului. Plus regula zero (predarea contextului), capcanele de la testarea headless si completari pe fluxul text -> binar. utile/Teste: suita de regresie pentru editarea facturii si harness-ul watchdog (nu sunt in SVN, unde utile/Teste e ignorat). .gitignore ignora si capturile PNG si watchdog_out/, ramase din rulari. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SN8snvkk94KuhWwoXUUey3
155 lines
5.3 KiB
Plaintext
155 lines
5.3 KiB
Plaintext
* test_incarca_vanzare_din_nota.prg
|
|
* Smoke test izolat pentru IncarcaVanzareDinNota (ofacturare_editare.prg), inainte de a atinge
|
|
* omodificari.vc2 runda 2. Verifica pe cazurile de regresie ale bugului "Go Top orb pe tact":
|
|
* cod=1137874/an=2009/luna=8 -> trebuie sa gaseasca id_vanzare=506 (azi, cu Go Top orb, da 0 randuri)
|
|
* cod=1139934/an=2021/luna=12 -> id_vanzare=882 (coliziune VANZARI.COD deja cunoscuta)
|
|
* plus regresie pe cazurile vechi: cod=1140888 -> id_vanzare=1050; cod=1125486 -> nu gaseste (tact fara VANZARI)
|
|
* plus cazul EOF: tact pozitionat deliberat la EOF (ca dupa CalculeazaTotal() din Show()) inainte de
|
|
* apel - dovedeste ca "cod" se ia din cursorul de triplete (SELECT DISTINCT), nu de pe randul curent
|
|
* Nu atinge Oracle in scriere - doar SELECT-uri prin goExecutor. QUIT la final.
|
|
|
|
SET SAFETY OFF
|
|
SET TALK OFF
|
|
|
|
LOCAL lcLog
|
|
lcLog = 'D:\ROA\ROAFACTURARE\COMUN\utile\Teste\editare_factura\test_incarca_vanzare_din_nota_log.txt'
|
|
STRTOFILE('start' + CHR(13) + CHR(10), lcLog)
|
|
|
|
PUBLIC gcErrLog
|
|
gcErrLog = lcLog
|
|
ON ERROR DO test_error_handler WITH ERROR(), MESSAGE(), PROGRAM(), LINENO()
|
|
|
|
DO ('D:\ROA\ROAFACTURARE\COMUN\utile\Teste\test_init_env_auto.prg') WITH 'CENTRAL', 'MARIUSM_AUTO', 'ROMFASTSOFT'
|
|
IF gnHandle <= 0
|
|
STRTOFILE('EROARE: conectare esuata' + CHR(13) + CHR(10), lcLog, 1)
|
|
QUIT
|
|
ENDIF
|
|
|
|
SET PROCEDURE TO D:\ROA\ROAFACTURARE\COMUN\programe\ofacturare_editare.prg ADDITIVE
|
|
|
|
DO verifica WITH 1137874, 2009, 8, 'blocant Go Top - prim rand INCASARE', lcLog, .T., 506
|
|
DO verifica WITH 1139934, 2021, 12, 'coliziune VANZARI.COD', lcLog, .T., 882
|
|
DO verifica WITH 1140888, (gnAn), (gnLuna), 'regresie runda 1 - factura normala', lcLog, .T., 1050
|
|
DO verifica WITH 1125486, 2008, 2, 'regresie runda 1 - fara VANZARI', lcLog, .F., 0
|
|
DO verifica_eof WITH 1137874, 2009, 8, lcLog, 506
|
|
|
|
STRTOFILE('done' + CHR(13) + CHR(10), lcLog, 1)
|
|
QUIT
|
|
|
|
|
|
* pozitioneaza tact deliberat la EOF (Go Bottom + Skip) inainte de IncarcaVanzareDinNota - dovedeste
|
|
* ca "cod" nu se mai citeste de pe randul curent al aliasului (corectia care a inlocuit Evaluate(alias.cod))
|
|
PROCEDURE verifica_eof
|
|
LPARAMETERS tnCod, tnAn, tnLuna, tcLog, tnIdVanzareAsteptat
|
|
|
|
LOCAL llOk, llGasit, lnIdVanzare, llEofInainte, llEofDupa
|
|
|
|
llOk = IncarcaCursoareModificareNota(tnCod, tnAn, tnLuna, .F.)
|
|
llGasit = .F.
|
|
lnIdVanzare = 0
|
|
llEofInainte = .F.
|
|
llEofDupa = .F.
|
|
|
|
IF llOk AND Used('tact')
|
|
SELECT tact
|
|
Go Bottom In tact
|
|
Skip In tact
|
|
llEofInainte = Eof('tact')
|
|
llGasit = IncarcaVanzareDinNota('tact')
|
|
llEofDupa = Eof('tact')
|
|
IF llGasit
|
|
lnIdVanzare = tvanz.id_vanzare
|
|
ENDIF
|
|
ENDIF
|
|
|
|
STRTOFILE('--- EOF pe tact, cod=' + TRANSFORM(tnCod) + ' [pozitionare la EOF inainte de apel] ---' + CHR(13) + CHR(10) + ;
|
|
' Eof(tact) inainte de apel = ' + TRANSFORM(llEofInainte) + ' (asteptat .T.)' + CHR(13) + CHR(10) + ;
|
|
' gasit = ' + TRANSFORM(llGasit) + ' (asteptat .T.)' + CHR(13) + CHR(10) + ;
|
|
' id_vanzare = ' + TRANSFORM(lnIdVanzare) + ' (asteptat ' + TRANSFORM(tnIdVanzareAsteptat) + ')' + CHR(13) + CHR(10) + ;
|
|
' Eof(tact) dupa apel (pozitia restaurata) = ' + TRANSFORM(llEofDupa) + ' (asteptat .T.)' + CHR(13) + CHR(10) + ;
|
|
' ' + IIF(llEofInainte AND llGasit AND lnIdVanzare == tnIdVanzareAsteptat AND llEofDupa, 'PASS', 'FAIL') + CHR(13) + CHR(10), tcLog, 1)
|
|
|
|
IF Used('actactan')
|
|
Use In actactan
|
|
ENDIF
|
|
IF Used('tact')
|
|
Use In tact
|
|
ENDIF
|
|
IF Used('rul_temp')
|
|
Use In rul_temp
|
|
ENDIF
|
|
IF Used('trul')
|
|
Use In trul
|
|
ENDIF
|
|
IF Used('rul_temp_obinv')
|
|
Use In rul_temp_obinv
|
|
ENDIF
|
|
IF Used('trul_obinv')
|
|
Use In trul_obinv
|
|
ENDIF
|
|
IF Used('tvanz')
|
|
Use In tvanz
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
|
|
PROCEDURE verifica
|
|
LPARAMETERS tnCod, tnAn, tnLuna, tcEticheta, tcLog, tlAsteptatGasit, tnIdVanzareAsteptat
|
|
|
|
LOCAL llOk, llGasit, lnIdVanzare, lcMsg, lnAreaOrigineTest, lcAliasOrigineTest
|
|
|
|
llOk = IncarcaCursoareModificareNota(tnCod, tnAn, tnLuna, .F.)
|
|
llGasit = .F.
|
|
lnIdVanzare = 0
|
|
lnAreaOrigineTest = 0
|
|
lcAliasOrigineTest = ''
|
|
|
|
IF llOk AND Used('tact')
|
|
SELECT tact
|
|
lnAreaOrigineTest = Select()
|
|
lcAliasOrigineTest = Alias()
|
|
llGasit = IncarcaVanzareDinNota('tact')
|
|
IF llGasit
|
|
lnIdVanzare = tvanz.id_vanzare
|
|
ENDIF
|
|
ENDIF
|
|
|
|
lcMsg = '--- cod=' + TRANSFORM(tnCod) + ' [' + tcEticheta + '] ---' + CHR(13) + CHR(10) + ;
|
|
' IncarcaCursoareModificareNota => ' + TRANSFORM(llOk) + CHR(13) + CHR(10) + ;
|
|
' gasit = ' + TRANSFORM(llGasit) + ' (asteptat ' + TRANSFORM(tlAsteptatGasit) + ')' + CHR(13) + CHR(10) + ;
|
|
' id_vanzare = ' + TRANSFORM(lnIdVanzare) + ' (asteptat ' + TRANSFORM(tnIdVanzareAsteptat) + ')' + CHR(13) + CHR(10) + ;
|
|
' workarea restaurata la ' + TRANSFORM(lnAreaOrigineTest) + ': ' + TRANSFORM(Select() == lnAreaOrigineTest) + CHR(13) + CHR(10) + ;
|
|
' ' + IIF(llGasit == tlAsteptatGasit AND lnIdVanzare == tnIdVanzareAsteptat AND Select() == lnAreaOrigineTest, 'PASS', 'FAIL') + CHR(13) + CHR(10)
|
|
|
|
STRTOFILE(lcMsg, tcLog, 1)
|
|
|
|
IF Used('actactan')
|
|
Use In actactan
|
|
ENDIF
|
|
IF Used('tact')
|
|
Use In tact
|
|
ENDIF
|
|
IF Used('rul_temp')
|
|
Use In rul_temp
|
|
ENDIF
|
|
IF Used('trul')
|
|
Use In trul
|
|
ENDIF
|
|
IF Used('rul_temp_obinv')
|
|
Use In rul_temp_obinv
|
|
ENDIF
|
|
IF Used('trul_obinv')
|
|
Use In trul_obinv
|
|
ENDIF
|
|
IF Used('tvanz')
|
|
Use In tvanz
|
|
ENDIF
|
|
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
|