Files
comun/utile/Teste/facturare_unificat/probe_cont_667c.prg
2026-09-17 11:19:54 +03:00

73 lines
3.2 KiB
Plaintext

SET SAFETY OFF
SET TALK OFF
SET NOTIFY OFF
CLOSE DATABASES
PUBLIC gcLog
gcLog = "D:\ROA\ROAFACTURARE\COMUN\utile\Teste\facturare_unificat\out\probe_cont_667c.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)
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
gnIdUtil = 8
DO AfLog WITH "=== politici (id_pol, nume, id_nota, nota scd/scc) ==="
SQLEXEC(gnHandle, "select p.id_pol, p.nume_lista_preturi, p.id_nota, n.scd, n.scc from crm_politici_preturi p left join crm_note_vanzari v on v.id_nota=p.id_nota left join note_contabile n on n.id_set=v.id_set order by p.id_pol", "crspol")
IF USED('crspol')
SCAN
DO AfLog WITH " id_pol=" + TRANSFORM(crspol.id_pol) + " nume=[" + ALLTRIM(NVL(crspol.nume_lista_preturi,[])) + "] id_nota=" + TRANSFORM(NVL(crspol.id_nota,0)) + " scd=[" + ALLTRIM(NVL(crspol.scd,[])) + "] scc=[" + ALLTRIM(NVL(crspol.scc,[])) + "]"
ENDSCAN
USE IN crspol
ENDIF
DO AfLog WITH "=== randuri crm_politici_pret_art cu id_nota propriu ==="
SQLEXEC(gnHandle, "select a.id_pol, a.id_articol, e.denumire, e.cont, a.id_nota, n.scd, n.scc from crm_politici_pret_art a join nom_articole e on e.id_articol=a.id_articol left join crm_note_vanzari v on v.id_nota=a.id_nota left join note_contabile n on n.id_set=v.id_set where a.id_nota is not null order by a.id_pol, a.id_articol", "crsartnota")
IF USED('crsartnota')
SCAN
DO AfLog WITH " pol=" + TRANSFORM(crsartnota.id_pol) + " art=" + TRANSFORM(crsartnota.id_articol) + " [" + ALLTRIM(NVL(crsartnota.denumire,[])) + "] cont=[" + ALLTRIM(NVL(crsartnota.cont,[])) + "] id_nota=" + TRANSFORM(crsartnota.id_nota) + " scd=[" + ALLTRIM(NVL(crsartnota.scd,[])) + "] scc=[" + ALLTRIM(NVL(crsartnota.scc,[])) + "]"
ENDSCAN
USE IN crsartnota
ENDIF
DO AfLog WITH "=== articole nomenclator cu cont 667/709/267/2678 ==="
SQLEXEC(gnHandle, "select id_articol, denumire, cont, acont, sters from nom_articole where trim(cont) in ('667','709','267','2678') order by cont, id_articol", "crsnom")
IF USED('crsnom')
SCAN
DO AfLog WITH " art=" + TRANSFORM(crsnom.id_articol) + " cont=[" + ALLTRIM(NVL(crsnom.cont,[])) + "] acont=[" + ALLTRIM(NVL(crsnom.acont,[])) + "] sters=" + TRANSFORM(NVL(crsnom.sters,0)) + " [" + ALLTRIM(NVL(crsnom.denumire,[])) + "]"
ENDSCAN
USE IN crsnom
ENDIF
DO AfLog WITH "=== plcont 2026 pentru conturile de discount ==="
SQLEXEC(gnHandle, "select cont from plcont where an=2026 and substr(trim(cont),1,3) in ('667','709','267') order by cont", "crspl")
IF USED('crspl')
SCAN
DO AfLog WITH " plcont=[" + ALLTRIM(crspl.cont) + "]"
ENDSCAN
USE IN crspl
ENDIF
DO Final
PROCEDURE AfLog
LPARAMETERS tcMsg
STRTOFILE(tcMsg + CHR(13) + CHR(10), gcLog, 1)
ENDPROC
PROCEDURE AfErr
LPARAMETERS tnErr, tcMsg, tcProg, tnLine
DO AfLog WITH "ERROR " + TRANSFORM(tnErr) + " [" + tcProg + ":" + TRANSFORM(tnLine) + "] " + tcMsg
ENDPROC
PROCEDURE Final
DO AfLog WITH "END " + TTOC(DATETIME())
QUIT
ENDPROC