* find_tipincasare23_doc.prg * Cautare read-only: document real cu tip_incasare in (2,3), incasat<>0, tip 1-4, ne-proforma, * nesters, ca sa probeze maparea D4 (bon fiscal / card) alaturi de documentul 1071 (chitanta). * Nu scrie nimic. SET SAFETY OFF SET TALK OFF PUBLIC gcErrLog gcErrLog = 'D:\ROA\ROAFACTURARE\COMUN\utile\Teste\editare_factura\find_tipincasare23_doc_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 STRTOFILE('EROARE: conectare esuata' + CHR(13) + CHR(10), gcErrLog, 1) QUIT ENDIF LOCAL lcSelect, lnSucces lcSelect = [select id_vanzare, tip, eproforma, sters, incasat, nr_incasare, tip_incasare, serie_chit, data_act, id_fact from fact_vfacturi ] + ; [where incasat <> 0 and tip between 1 and 4 and eproforma = 0 and sters = 0 and tip_incasare in (2,3) ] + ; [order by tip_incasare, id_vanzare] lnSucces = goExecutor.oExecute(lcSelect, 'crsCandidati') STRTOFILE('oExecute: ' + TRANSFORM(lnSucces) + ' eroare: ' + goExecutor.cEroare + CHR(13) + CHR(10), gcErrLog, 1) goExecutor.oReset() IF lnSucces >= 0 AND USED('crsCandidati') STRTOFILE('candidati gasiti: ' + TRANSFORM(RECCOUNT('crsCandidati')) + CHR(13) + CHR(10), gcErrLog, 1) SELECT crsCandidati SCAN STRTOFILE('id_vanzare=' + TRANSFORM(id_vanzare) + ' tip=' + TRANSFORM(tip) + ' incasat=' + TRANSFORM(incasat) + ; ' nr_incasare=' + TRANSFORM(nr_incasare) + ' tip_incasare=' + TRANSFORM(tip_incasare) + ; ' serie_chit=[' + TRANSFORM(NVL(serie_chit,'')) + ']' + ; ' data_act=' + TRANSFORM(data_act) + ' id_fact=' + TRANSFORM(NVL(id_fact,0)) + CHR(13) + CHR(10), gcErrLog, 1) ENDSCAN ELSE STRTOFILE('interogare esuata' + CHR(13) + CHR(10), gcErrLog, 1) ENDIF *!* verifica si luna documentului 1071, util pentru decizia rutei de proba (do_editare_unificata cere luna curenta) IF Used('crs1071') Use In crs1071 ENDIF lnSucces = goExecutor.oExecute([select id_vanzare, data_act, sters, eproforma, tip, id_fact from fact_vfacturi where id_vanzare = 1071], 'crs1071') goExecutor.oReset() IF lnSucces >= 0 AND USED('crs1071') AND RECCOUNT('crs1071') = 1 STRTOFILE('1071: data_act=' + TRANSFORM(crs1071.data_act) + ' sters=' + TRANSFORM(crs1071.sters) + ' eproforma=' + TRANSFORM(crs1071.eproforma) + ' tip=' + TRANSFORM(crs1071.tip) + ' id_fact=' + TRANSFORM(NVL(crs1071.id_fact,0)) + CHR(13) + CHR(10), gcErrLog, 1) ENDIF STRTOFILE('gnAn=' + TRANSFORM(gnAn) + ' gnLuna=' + TRANSFORM(gnLuna) + CHR(13) + CHR(10), gcErrLog, 1) STRTOFILE('done' + CHR(13) + CHR(10), gcErrLog, 1) QUIT PROCEDURE test_error_handler LPARAMETERS tnErr, tcMsg, tcProg, tnLine STRTOFILE('EROARE #' + TRANSFORM(tnErr) + ': ' + tcMsg + ' in ' + tcProg + ' linia ' + TRANSFORM(tnLine) + CHR(13) + CHR(10), gcErrLog, 1) QUIT ENDPROC