COD =PRINTD NUME =Transmite pdf prin e-mail APLIC= EXPL1= EXPL2=d:\HAMOR\PDF\codlista.pdf EXPL3= EXPL4= DESCH=D CMD = // In cadrul aceluiasi apel "Utilitar de imprimare" // pentru comunicarea intre pachete sint accesibile variabilele // globale X_1, X_2, ..., X_9. // La parasirea utilitarului valorile se pierd. // // Inainte de apel se creeaza vectorul h_gcmdparam cu urmatoarele elemente: // // h_gcmdparam[ 1] - C, 6: cod pachet, ex:PRINTx, // h_gcmdparam[ 2] - L : rezultatul operatiei de listare, // la intrare valoarea este .T., // pentru iesire se poate seta in script .T. sau .F. // h_gcmdparam[ 3] - C, 8: cod lista, // h_gcmdparam[ 4] - C, n: drive + cale + nume fisier lista, // h_gcmdparam[ 5] - C,25: denumire lista, // h_gcmdparam[ 6] - C,10: cod imprimanta, // h_gcmdparam[ 7] - C,10: cod hartie, // h_gcmdparam[ 8] - D : data // h_gcmdparam[ 9] - C, 5: ora, hh:mm h_MesHlp ("Asteptati !") x_os := RTRIM(UPPER(GETENV("OS"))) x_crlf := CHR(13)+CHR(10) x_par := h_TruePath(h_FilePathes[fil_tmp]+"FISPAR"+h_StatId()+".TXT ") x_catexe := IF(TYPE("FIL_SPRO")="N", h_TruePath(h_FilePathes[fil_spro]), "") // listare in pdf // imprimanta pdf trebuie sa genereze cod_lista.pdf in catalogul dbf\..\PDF // HAMOR\dbf // \PDF\cod_lista.pdf // fisier pdf x_pdf := h_TruePath(h_FilePathes[fil_file]+"..\PDF\"+RTRIM(h_gcmdparam[ 3])+".PDF") #IF x_os=="LINUX" h_MesErr("Pe LINUX nu este implementat !",0) #ELSEIF !("PDF"$h_gcmdparam[ 6] .OR. "PDC"$h_gcmdparam[ 6] .OR. "WIS"$h_gcmdparam[ 6]) h_MesErr("Nu se listeaza in PDF",0) #ELSEIF !(TYPE("FIL_SCAT") = "N") // daca variabila scat nu este prezenta (exe mai vechi), // daca scat nu este definit, // daca catalog scat este vid, // atunci TYPE("FIL_SCAT")#"N" h_MesErr("Definiti catalogul spooler: scat",0) #ELSE // Sterge fisierul pdf existent #IF FILE (x_pdf) FERASE (x_pdf) #ENDIF s_lst := "" h_OpenInp(h_gcmdparam[4]) h_OpenOut(h_AddPath(RTRIM(h_gcmdparam[3])+".LST",h_FilePathes[fil_scat])) #WHILE h_GetLine(@s_lst) h_PutLine(s_lst) #ENDDO h_CloseInp() h_CloseOut("") // ALERT("Lansat imprimare:"+h_gcmdparam[4]) // generare fisier parametri pentru hMail MEMOWRIT(x_par,; "[EMAIL]"+x_crlf+; "ADDRESSTO="+x_crlf+; "ADDRESSCC="+x_crlf+; "ADDRESSBCC="+x_crlf+; "SUBJECT=Lista "+h_gcmdparam[ 3]+"-"+h_gcmdparam[ 5]+" de la "+x_SocData()+x_crlf+; "ATTACHMENT="+x_pdf+x_crlf+; "DIALOG=1"+x_crlf+; "BODY01=Lista transmisa de "+x_SocData()+x_crlf+; "BODY02=Cod: "+h_gcmdparam[ 3]+x_crlf+; "BODY03=Denumire: "+h_gcmdparam[ 5]+x_crlf+; "BODY05=Hirtie: "+h_gcmdparam[ 7]+x_crlf+; "BODY06=Data: "+h_DTOC(h_gcmdparam[ 8],"zz/ll/aaaa")+x_crlf+; "BODY07=Ora: "+h_gcmdparam[ 9]+x_crlf) // Asteapta terminarea crearii pdf-ului. // Pina cind este in curs de creare de imprimanta pdf, // nu poate fi deschis de acest program // is the requested DOS open mode indicating how the opened // file is to be accessed. The open mode is composed of elements from the // two types of modes described in the tables below. If just the Access // Mode is used, the file is opened non-sharable. The default open mode is // zero, which indicates non-sharable and read-only. // FOPEN() Access Modes // 0 FO_READ Open for reading (default) // 1 FO_WRITE Open for writing // 2 FO_READWRITE Open for reading or writing // The Sharing Modes determine how other processes may access the file. // The Access Modes in combination (+) with the Sharing modes determine the // accessibility of the file in a network environment. // FOPEN() Sharing Modes // 0 FO_COMPAT Compatibility mode (default) // 16 FO_EXCLUSIVE Exclusive use // 32 FO_DENYWRITE Prevent others from writing // 48 FO_DENYREAD Prevent others from reading // 64 FO_DENYNONE Allow others to read or write // FERROR // 0 Successful // 2 File not found nn := 0 // open FO_READ+FO_COMPAT // The default open mode is zero, which indicates non-sharable and read-only. nHandle := FOPEN(x_pdf, 0+0) #WHILE FERROR() != 0 h_Inkey(0.2) nn:=nn+0.2 #IF nn > 20 h_MesErr("Fisier "+x_pdf+" absent sau time out listare",0) Abandon() #ENDIF nHandle := FOPEN(x_pdf, 0+0) #ENDDO FCLOSE(nHandle) // generare comanda pentru hWTools MEMOWRIT(h_AddPath("hmail"+h_StatId()+".cmd",h_FilePathes[fil_scat]),; "[RUN]"+x_crlf+; "MODE=/MIN"+x_crlf+; "DIRECTORY="+x_catexe+x_crlf+; "EXE=hMail.exe"+x_crlf+; "PARAMETERS="+x_par+x_crlf) h_MesHlp("Lansat: hMail "+x_par,0) #ENDIF