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
298 lines
12 KiB
Plaintext
298 lines
12 KiB
Plaintext
* test_s5_3b_discount_serie.prg
|
|
* Headless: S5-3b in frm_facturare_articole2.Init - D (ascunderea zonei de discount pe factura)
|
|
* si E (eliminarea coloanei cSerie din grd_factura), pentru toate cele 21 de tipuri +
|
|
* eProforma + lCopiere, plus reasezarea benzii de totaluri (aseaza_totaluri).
|
|
*
|
|
* Valorile asteptate pentru D si E sunt scrise HARDCODAT din v1 (nu citite din cursorul
|
|
* COMUN\programe\ofacturare.prg), ca sa prinda si o eventuala greseala de transcriere in cursor:
|
|
* D (ascunde_discount = .T., 11 tipuri): ofacturare.vc2 (v1) :15304,15323,15333,15342,15352,15361,15371
|
|
* -> 4, {21,28,42,47}, {22,29}, 23, 41, 25, 26
|
|
* E (sterge_serie = .T., 18 tipuri): confirmat pe v1 de orchestrator -
|
|
* 1, 2, 3, 5, 6, 7, 10, 21, 22, 23, 24, 25, 26, 28, 29, 41, 42, 47
|
|
* Non-regresie: ck_discountevidentiat.Visible ramane .T. pe toate cazurile (paritate v1 - nu e
|
|
* in clb_discount pe v1, tine de discountul pe articole).
|
|
*
|
|
* ColumnCount asteptat: 14 - (1 daca sterge_serie) - (3, pentru ca poDate.in_valuta ramane la
|
|
* valoarea implicita 0 din oDateFactura -> ramura care sterge cVpretFtva/cVdiscountftva/
|
|
* cVvaldiminuatftva, ofacturare.vc2:20887-20891).
|
|
*
|
|
* Rulare: vfp9.exe -A -T "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\test_s5_3b_discount_serie.prg"
|
|
* Log: D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\out\test_s5_3b_discount_serie.log
|
|
* Mediu: ROA_CENTRAL / MARIUSM_AUTO; seriile de facturi (tipdoc 5) sunt pe utilizator -> gnIdUtil = 8.
|
|
|
|
SET SAFETY OFF
|
|
SET TALK OFF
|
|
SET NOTIFY OFF
|
|
PUBLIC gcLog, gnFail, gnPass, gcCaz
|
|
gcLog = "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\out\test_s5_3b_discount_serie.log"
|
|
IF !DIRECTORY("D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\out")
|
|
MD "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\out"
|
|
ENDIF
|
|
STRTOFILE("START " + TTOC(DATETIME()) + CHR(13) + CHR(10), gcLog)
|
|
gnFail = 0
|
|
gnPass = 0
|
|
gcCaz = ""
|
|
ON ERROR DO AfErr WITH ERROR(), MESSAGE(), PROGRAM(), LINENO()
|
|
|
|
DO "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\test_init_env_auto_roafacturare.prg" WITH 'CENTRAL', 'MARIUSM_AUTO', 'ROMFASTSOFT'
|
|
IF TYPE('gnHandle') <> 'N' OR gnHandle <= 0
|
|
DO AfLog WITH "FAIL: conexiune Oracle esuata"
|
|
DO Final
|
|
ENDIF
|
|
SET PROCEDURE TO "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\mock_amessagebox.prg" ADDITIVE
|
|
PUBLIC gcMockUltimMesaj, gnMockUltimTip
|
|
gcMockUltimMesaj = ""
|
|
gnMockUltimTip = 0
|
|
IF !actualizeaza_optiuni_program()
|
|
DO AfLog WITH "FAIL: actualizeaza_optiuni_program()"
|
|
DO Final
|
|
ENDIF
|
|
gnIdUtil = 8
|
|
goExecutor.oExecuta([begin pack_sesiune.set_Id_Util(?gnIdUtil); end;])
|
|
DO AfLog WITH "ENV OK"
|
|
* gridextras.vcx e referit din ofacturare.vcx cu cale relativa (..\utile\gridextras), rezolvabila doar din exe/IDE
|
|
SET PATH TO "D:\ROA\ROAFACTURARE\COMUN\utile\gridextras" ADDITIVE
|
|
|
|
PRIVATE poDate, poGeneratorNumere
|
|
poGeneratorNumere = CREATEOBJECT("oGeneratorNumere")
|
|
gnScadereStoc = 0
|
|
|
|
IF USED('crscursuri')
|
|
USE IN crscursuri
|
|
ENDIF
|
|
CREATE CURSOR crscursuri (curs N(12,4), nume_val C(10), multiplicator N(6))
|
|
DO creeaza_facturacrs WITH 'crsfactura'
|
|
* grd_factura.cGestiune e legat la crsFactura.gestiune, camp inexistent in creeaza_facturacrs (nume_gestiune)
|
|
SELECT *, CAST(NULL AS C(100)) AS gestiune FROM crsfactura INTO CURSOR crsfact_tmp READWRITE
|
|
USE IN crsfactura
|
|
SELECT * FROM crsfact_tmp INTO CURSOR crsfactura READWRITE
|
|
USE IN crsfact_tmp
|
|
|
|
* tabel: tip, nIdTipDoc (5=factura,6=aviz), ascunde_discount asteptat, sterge_serie asteptat
|
|
DO Caz WITH 1, 5, .F., .T.
|
|
DO Caz WITH 5, 5, .F., .T.
|
|
DO Caz WITH 7, 5, .F., .T.
|
|
DO Caz WITH 10, 5, .F., .T.
|
|
DO Caz WITH 2, 5, .F., .T.
|
|
DO Caz WITH 6, 5, .F., .T.
|
|
DO Caz WITH 3, 5, .F., .T.
|
|
DO Caz WITH 4, 5, .T., .F.
|
|
DO Caz WITH 21, 6, .T., .T.
|
|
DO Caz WITH 28, 6, .T., .T.
|
|
DO Caz WITH 42, 6, .T., .T.
|
|
DO Caz WITH 47, 6, .T., .T.
|
|
DO Caz WITH 22, 6, .T., .T.
|
|
DO Caz WITH 29, 6, .T., .T.
|
|
DO Caz WITH 23, 6, .T., .T.
|
|
DO Caz WITH 41, 6, .T., .T.
|
|
DO Caz WITH 25, 6, .T., .T.
|
|
DO Caz WITH 26, 6, .T., .T.
|
|
DO Caz WITH 8, 5, .F., .F.
|
|
DO Caz WITH 9, 5, .F., .F.
|
|
DO Caz WITH 24, 5, .F., .T.
|
|
|
|
* eProforma si lCopiere: pe v1 ambele campuri (ascunde_discount, sterge_serie) sunt .F. - vezi §8 din propunere
|
|
DO CazEProforma WITH 1, 5, .F., .F.
|
|
DO CazCopiere WITH 2, 5, .F., .F.
|
|
|
|
DO Reasezare
|
|
|
|
DO Final
|
|
|
|
*----------------------------------------------------------------------------------------
|
|
PROCEDURE Caz
|
|
LPARAMETERS tnTip, tnIdTipDoc, tlAscundeAst, tlStergeAst
|
|
LOCAL loNou
|
|
gcCaz = "[tip=" + TRANSFORM(tnTip) + "] "
|
|
poDate = NULL
|
|
poDate = CREATEOBJECT("oDateFactura", 26000 + tnTip, tnTip)
|
|
poDate.nIdTipDoc = tnIdTipDoc
|
|
poGeneratorNumere.ResetNumere()
|
|
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(tnIdTipDoc)
|
|
|
|
loNou = CREATEOBJECT('frm_facturare_articole2')
|
|
IF VARTYPE(loNou) <> 'O'
|
|
DO Assert WITH .F., "Createobject frm_facturare_articole2"
|
|
RETURN
|
|
ENDIF
|
|
|
|
DO Verifica WITH loNou, tnTip, tlAscundeAst, tlStergeAst
|
|
|
|
loNou.Release()
|
|
RELEASE loNou
|
|
IF poDate.rezultat_serii <> 0
|
|
poGeneratorNumere.dezaloca_numar(tnIdTipDoc)
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
PROCEDURE CazEProforma
|
|
LPARAMETERS tnTip, tnIdTipDoc, tlAscundeAst, tlStergeAst
|
|
LOCAL loNou
|
|
gcCaz = "[eProforma tip=" + TRANSFORM(tnTip) + "] "
|
|
poDate = NULL
|
|
poDate = CREATEOBJECT("oDateFactura", 26100 + tnTip, tnTip)
|
|
poDate.nIdTipDoc = tnIdTipDoc
|
|
poDate.eProforma = 1
|
|
poGeneratorNumere.ResetNumere()
|
|
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(tnIdTipDoc)
|
|
|
|
loNou = CREATEOBJECT('frm_facturare_articole2')
|
|
IF VARTYPE(loNou) <> 'O'
|
|
DO Assert WITH .F., "Createobject frm_facturare_articole2 (eProforma)"
|
|
RETURN
|
|
ENDIF
|
|
|
|
DO Verifica WITH loNou, tnTip, tlAscundeAst, tlStergeAst
|
|
|
|
loNou.Release()
|
|
RELEASE loNou
|
|
IF poDate.rezultat_serii <> 0
|
|
poGeneratorNumere.dezaloca_numar(tnIdTipDoc)
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
PROCEDURE CazCopiere
|
|
LPARAMETERS tnTip, tnIdTipDoc, tlAscundeAst, tlStergeAst
|
|
LOCAL loNou, loSursa
|
|
gcCaz = "[lCopiere tip=" + TRANSFORM(tnTip) + "] "
|
|
poDate = NULL
|
|
poDate = CREATEOBJECT("oDateFactura", 26200 + tnTip, tnTip)
|
|
poDate.nIdTipDoc = tnIdTipDoc
|
|
poGeneratorNumere.ResetNumere()
|
|
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(tnIdTipDoc)
|
|
|
|
loSursa = CREATEOBJECT('Custom')
|
|
loNou = CREATEOBJECT('frm_facturare_articole2', loSursa)
|
|
IF VARTYPE(loNou) <> 'O'
|
|
DO Assert WITH .F., "Createobject frm_facturare_articole2 cu toFactura"
|
|
RETURN
|
|
ENDIF
|
|
|
|
DO Verifica WITH loNou, tnTip, tlAscundeAst, tlStergeAst
|
|
|
|
loNou.Release()
|
|
RELEASE loNou
|
|
IF poDate.rezultat_serii <> 0
|
|
poGeneratorNumere.dezaloca_numar(tnIdTipDoc)
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
PROCEDURE Verifica
|
|
LPARAMETERS toNou, tnTip, tlAscundeAst, tlStergeAst
|
|
LOCAL lnColAst, lnColBaza
|
|
|
|
* D - vizibilitatea zonei de discount pe factura
|
|
DO Assert WITH toNou.lb_disc_factura.Visible == !tlAscundeAst, "D lb_disc_factura.Visible=" + TRANSFORM(toNou.lb_disc_factura.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
DO Assert WITH toNou.tx_disc_factura_nat.Visible == !tlAscundeAst, "D tx_disc_factura_nat.Visible=" + TRANSFORM(toNou.tx_disc_factura_nat.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
DO Assert WITH toNou.lb_disc_factura_ron.Visible == !tlAscundeAst, "D lb_disc_factura_ron.Visible=" + TRANSFORM(toNou.lb_disc_factura_ron.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
DO Assert WITH toNou.tx_disc_factura_procent.Visible == !tlAscundeAst, "D tx_disc_factura_procent.Visible=" + TRANSFORM(toNou.tx_disc_factura_procent.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
DO Assert WITH toNou.lb_disc_factura_procent_semn.Visible == !tlAscundeAst, "D lb_disc_factura_procent_semn.Visible=" + TRANSFORM(toNou.lb_disc_factura_procent_semn.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
DO Assert WITH toNou.clb_motiv_discount.Visible == !tlAscundeAst, "D clb_motiv_discount.Visible=" + TRANSFORM(toNou.clb_motiv_discount.Visible) + " asteptat=" + TRANSFORM(!tlAscundeAst)
|
|
|
|
* Non-regresie: ck_discountevidentiat nu se ascunde niciodata (tine de discountul pe articole)
|
|
DO Assert WITH toNou.ck_discountevidentiat.Visible == .T., "D ck_discountevidentiat.Visible=" + TRANSFORM(toNou.ck_discountevidentiat.Visible) + " asteptat=.T. (non-regresie)"
|
|
|
|
* E - coloana cSerie
|
|
* Grid nu are colectia .Objects (doar .Columns), deci do_exista_obiect() arunca eroare pe un
|
|
* Grid; TYPE()/PEMSTATUS raman .T./'O' dupa RemoveObject (vezi memoria pemstatus-dupa-removeobject).
|
|
* Existenta reala se verifica prin bucla pe .Columns(i).Name, ca do_exista_obiect dar pe colectia
|
|
* corecta pentru Grid.
|
|
LOCAL llCSerieExista, lnI
|
|
llCSerieExista = .F.
|
|
FOR lnI = 1 TO toNou.grd_factura.ColumnCount
|
|
IF UPPER(toNou.grd_factura.Columns(lnI).Name) == "CSERIE"
|
|
llCSerieExista = .T.
|
|
EXIT
|
|
ENDIF
|
|
ENDFOR
|
|
DO Assert WITH llCSerieExista == !tlStergeAst, "E cSerie exista=" + TRANSFORM(llCSerieExista) + " asteptat=" + TRANSFORM(!tlStergeAst)
|
|
|
|
* Init:20887-20895 sterge 3 coloane (cVpretFtva/cVdiscountftva/cVvaldiminuatftva) daca
|
|
* poDate.in_valuta = 0, altfel 4 (cPretFtva/cDiscountctva/cPretCtva/cValdiminuatctva).
|
|
* oDateFactura.Init seteaza in_valuta = 1 pentru tnTip in (5,6,7,9,10,52) - ofacturare_comun.prg:254.
|
|
lnColBaza = IIF(INLIST(tnTip, 5, 6, 7, 9, 10, 52), 14 - 4, 14 - 3)
|
|
lnColAst = lnColBaza - IIF(tlStergeAst, 1, 0)
|
|
DO Assert WITH toNou.grd_factura.ColumnCount == lnColAst, "E ColumnCount=" + TRANSFORM(toNou.grd_factura.ColumnCount) + " asteptat=" + TRANSFORM(lnColAst)
|
|
ENDPROC
|
|
|
|
PROCEDURE Reasezare
|
|
LOCAL loVizibil, loAscuns, lnGap, lnCkAst
|
|
gcCaz = "[reasezare] "
|
|
lnGap = 24
|
|
|
|
poDate = NULL
|
|
poDate = CREATEOBJECT("oDateFactura", 26301, 1)
|
|
poDate.nIdTipDoc = 5
|
|
poGeneratorNumere.ResetNumere()
|
|
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(5)
|
|
loVizibil = CREATEOBJECT('frm_facturare_articole2')
|
|
IF poDate.rezultat_serii <> 0
|
|
poGeneratorNumere.dezaloca_numar(5)
|
|
ENDIF
|
|
|
|
poDate = NULL
|
|
poDate = CREATEOBJECT("oDateFactura", 26304, 4)
|
|
poDate.nIdTipDoc = 5
|
|
poGeneratorNumere.ResetNumere()
|
|
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(5)
|
|
loAscuns = CREATEOBJECT('frm_facturare_articole2')
|
|
IF poDate.rezultat_serii <> 0
|
|
poGeneratorNumere.dezaloca_numar(5)
|
|
ENDIF
|
|
|
|
IF VARTYPE(loVizibil) <> 'O' OR VARTYPE(loAscuns) <> 'O'
|
|
DO Assert WITH .F., "Createobject pentru reasezare (tip 1 / tip 4)"
|
|
ELSE
|
|
* lb_total_tva are Anchor=12 (jos+dreapta - vezi ofacturare.vc2:17942). Creat fara .Show(),
|
|
* motorul de anchor al VFP repozitioneaza controalele ancorate la dreapta pastrand offsetul
|
|
* design-time fata de marginea din dreapta a formularului, suprascriind orice .Left pus
|
|
* programatic in Init - Left ramane 689 (design-time, ofacturare.vc2:17944) indiferent de
|
|
* ascunde_discount. E acelasi tipar ca "Anchor=4 face Top design-time sa conteze la rulare"
|
|
* (memoria vfp anchor), generalizat la ancorarea pe dreapta; nu e o regresie a S5-3b - firul
|
|
* de cod This.lb_total_tva.Left = lnLeft (aseaza_totaluri:18459) e neschimbat, doar ramura de
|
|
* care depinde lnLeft e noua. Proba pe lb_total_tva.Left necesita fereastra reala (§9.2,
|
|
* datorie deschisa); aici se verifica reasezarea prin ck_discountevidentiat (Anchor=4).
|
|
DO AfLog WITH "DIAG lb_total_tva.Left vizibil=" + TRANSFORM(loVizibil.lb_total_tva.Left) + " ascuns=" + TRANSFORM(loAscuns.lb_total_tva.Left) + " (Anchor=12 - neconcludent fara .Show(), vezi comentariu)"
|
|
DO Assert WITH loAscuns.ck_discountevidentiat.Left < loVizibil.ck_discountevidentiat.Left, "reasezare ck_discountevidentiat.Left ascuns=" + TRANSFORM(loAscuns.ck_discountevidentiat.Left) + " vizibil=" + TRANSFORM(loVizibil.ck_discountevidentiat.Left)
|
|
|
|
lnCkAst = MAX(loAscuns.lb_disc_articole.Left + loAscuns.lb_disc_articole.Width, loAscuns.lb_disc_articole_ron.Left + loAscuns.lb_disc_articole_ron.Width) + lnGap
|
|
DO Assert WITH loAscuns.ck_discountevidentiat.Left == lnCkAst, "reasezare ck_discountevidentiat.Left=" + TRANSFORM(loAscuns.ck_discountevidentiat.Left) + " asteptat=" + TRANSFORM(lnCkAst)
|
|
ENDIF
|
|
|
|
IF VARTYPE(loVizibil) == 'O'
|
|
loVizibil.Release()
|
|
ENDIF
|
|
RELEASE loVizibil
|
|
IF VARTYPE(loAscuns) == 'O'
|
|
loAscuns.Release()
|
|
ENDIF
|
|
RELEASE loAscuns
|
|
ENDPROC
|
|
|
|
PROCEDURE Assert
|
|
LPARAMETERS tlCond, tcMsg
|
|
IF tlCond
|
|
gnPass = gnPass + 1
|
|
ELSE
|
|
gnFail = gnFail + 1
|
|
DO AfLog WITH "FAIL: " + gcCaz + tcMsg
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
PROCEDURE AfLog
|
|
LPARAMETERS tcMsg
|
|
STRTOFILE(tcMsg + CHR(13) + CHR(10), gcLog, 1)
|
|
ENDPROC
|
|
|
|
PROCEDURE AfErr
|
|
LPARAMETERS tnErr, tcMsg, tcProg, tnLine
|
|
gnFail = gnFail + 1
|
|
DO AfLog WITH "ERROR " + gcCaz + TRANSFORM(tnErr) + " [" + tcProg + ":" + TRANSFORM(tnLine) + "] " + tcMsg
|
|
ENDPROC
|
|
|
|
PROCEDURE Final
|
|
DO AfLog WITH "TOTAL pass=" + TRANSFORM(gnPass) + " fail=" + TRANSFORM(gnFail)
|
|
DO AfLog WITH "END " + TTOC(DATETIME())
|
|
QUIT
|
|
ENDPROC
|