*!* *-------------------------- *!* Procedure LIST_SCHIMBPRET *!* Parameters M.NRACT1 *!* Sele act *!* Loca For Val(nnir)=m.NRACT1 And Left(scd,3)='371' And Left(scc,3)='378' *!* If !Found() *!* Do mesaj With 'Nu a fost inregistrat nici un NIR','in luna curenta, cu numarul '+Allt(Str(m.NRACT1)) *!* Return *!* Endif *!* Scatter Fields cod,DATAACT Memvar *!* Select CODMAT,DENUMIRE,Iif(CANT=0,CANTE,CANT) As CANT,Sum(Iif(CANT#0,0,pretvTVA)) As pretv,Sum(Iif(CANT=0,0,pretvTVA)) As pretvnou; *!* FROM rull Where cod=M.cod ; *!* INTO Table &loc/&nfscurt/tempo/schimbp Group By DENUMIRE,CODMAT *!* Select schimbp *!* Report Form schimbpret To Printer Prompt Preview *!* Use In schimbp *!* Do STERGE *!* Return *!* *-------------------------- *!* Procedure LIST_NIR *!* Parameters M.NNIR,DECARE *!* m.nnir=Allt(M.NNIR) *!* LOCAL M.SUM1,M.SUM2 *!* STORE 0 TO M.SUM1,M.SUM2 *!* SELECT ACT *!* SET ORDER TO TAG COD *!* Sele rull *!* Set Filter To *!* Go Top *!* Loca For Val(nnir)=Val(m.nnir) And CANT#0 And CANTE=0 *!* If !Found() *!* Do mesaj With 'Nu a fost inregistrat nici un NIR','in luna curenta, cu numarul '+m.nnir *!* Return *!* Else *!* Sele rull *!* Scat Fiel cod Memv *!* Sele act *!* Set Filter To *!* SEEK m.cod *!* If Found() *!* Scat Memv *!* Endif *!* Loca For cod=m.cod And scc='767 ' *!* If Found() *!* Do tva *!* Sele act *!* m.sum1=suma *!* m.sum2=m.sum1*(m.ctva-1) *!* Else *!* Store 0 To m.sum1,m.sum2 *!* Endif *!* m.T='NIRURI' *!* Select Distinct act.nume,act.fdoc,act.nract,act.dataireg,act.DATAACT,ACT.COD From act; *!* WHERE cod=M.cod AND LEFT(ACT.SCC,2)='40' Into Cursor FF1 *!* *!* SELECT * from ff1 WHERE RECNO() = 1 INTO CURSOR ff *!* USE IN ff1 *!* Select RULL.*,FF.*,RULL.nnir+Str(RULL.gest) AS NGEST; *!* from FF,rull; *!* where FF.cod=rull.cod And Val(rull.nnir)=Val(m.nnir) And rull.CANTE=0 And rull.CANT#0; *!* into CURSOR ra ORDER BY NGEST *!* *!* Select RULL.*,FF.*; *!* *!* from FF,rull; *!* *!* where FF.cod=rull.cod And Val(rull.nnir)=Val(m.nnir) And rull.CANTE=0 And rull.CANT#0; *!* *!* into TABLE &loc\&nfscurt\tempo\ra *!* *Sele ra *!* *Index On nnir+Str(gest) Tag ngest Of &loc\&nfscurt\tempo\ra *!* *Sele ra *!* *Set Order To Tag ngest *!* sele optiuni *!* loca for optiune='NIR STANDARD' *!* nir_standard = da *!* SELECT ra *!* DO CASE *!* CASE DECARE=1 *!* If !NIR_STANDARD *!* Report Format NIRMATD.FRX To Printer Prompt Preview *!* Else *!* Report Format NIRTOT.FRX To Printer Prompt Preview *!* ENDIF *!* CASE DECARE=2 *!* Report Format NIRMARFNIR.FRX To Printer Prompt Preview *!* ENDCASE *!* Use In ra *!* Use In FF *!* ENDIF *!* SELECT ACT *!* SET ORDER TO TAG DATAIREG *!* Do STERGE *!* Return *!* *-------------------------- *!* Procedure LIST_BON_achi *!* Parameters M.NNIR *!* Sele rull *!* Loca For Val(rull.nnir)==VAL(m.NNIR) AND CANTE#0 *!* If !Found() *!* Do mesaj With 'Nu a fost inregistrat nici un bon','cu numarul '+M.NNIR *!* Return *!* ENDIF *!* M.COD=COD *!* m.T='BONURI' *!* SELECT DISTINCT NUME_2 As RESPONS,COD; *!* WHERE COD=M.COD; *!* FROM ACT INTO CURSOR FF *!* Select Distinct rull.*,FF.*; *!* from FF,rull; *!* where FF.cod=rull.cod And Val(rull.nnir)=VAL(m.NNIR) And rull.cante # 0 And rull.cant=0; *!* into Table &loc\&nfscurt\tempo\ra *!* Sele ra *!* Index On Str(gest,2)+nnir To &loc\&nfscurt\tempo\ra *!* Report Format BONCONS.FRX To Printer Prompt Preview *!* Use In ra *!* USE IN FF *!* DO STERGE *!* RETURN *!* *-------------------------- *!* Procedure LIST_BON *!* Parameters M.NNIR *!* Sele act *!* Loca For Val(nnir)==VAL(m.NNIR) AND INLIST(ID_SET,0,56,61,78,80,88,90) &&NUMAI BONURI (NOI SAU VECHI) *!* If !Found() *!* Do mesaj With 'Nu a fost inregistrat nici un bon','cu numarul '+M.NNIR *!* Return *!* ENDIF *!* M.COD=COD *!* m.T='BONURI' *!* SELECT DISTINCT NUME_2 As RESPONS,COD; *!* WHERE COD=M.COD; *!* FROM ACT INTO CURSOR FF *!* Select Distinct rull.*,FF.*; *!* from FF,rull; *!* where FF.cod=rull.cod And Val(rull.nnir)=VAL(m.NNIR) And rull.cante # 0 And rull.cant=0; *!* into Table &loc\&nfscurt\tempo\ra *!* Sele ra *!* Index On Str(gest,2)+nnir To &loc\&nfscurt\tempo\ra *!* If !BON_ACHI *!* Report Format BONLI.FRX To Printer Prompt Preview *!* Else *!* Report Format BONCONS.FRX To Printer Prompt Preview *!* Endif *!* Use In ra *!* USE IN FF *!* DO STERGE *!* RETURN *!* *------------------------------------------------------------- *!* PROCEDURE list_pvoi *!* PARAMETERS m.nnir *!* Sele act *!* Set Order To Tag cod *!* Loca For Val(nnir)=VAL(m.nnir) AND INLIST(ID_SET,82,55) *!* If Found() *!* Scatter Memvar *!* Sele rull *!* Set Filt To cod=m.cod AND LEFT(scd,1) = '3' *!* Report Format PVOI.FRX To Printer Prompt Preview *!* Sele act *!* Set Order To Tag dataireg *!* Else *!* Do mesaj With 'Numar inexistent!','' *!* Endif *!* Do STERGE *!* SELECT rull *!* SET FILTER TO *!* RETURN *!* *------------------------------------------------------------- *!* PROCEDURE list_fact *!* PARAMETERS m.nract1 *!* SELE FIRMA *!* LOCA FOR NFSCURT=FSCURT *!* SCAT MEMV *!* FCOD_FISCAL=M.COD_FISCAL *!* SELE act *!* LOCA for nract=m.nract1 and LEFT(scd,3)='411' *!* IF found() *!* SCAT memv *!* SELE clienti *!* LOCA for nume=m.nume *!* IF found() *!* SCAT fiel COD_FISCAL memv *!* ELSE *!* m.COD_FISCAL='' *!* ENDIF *!* *!* DO FORM DATEFACT *!* *!* SELECT respon *!* LOCATE FOR ales *!* SCATTER MEMVAR *!* *!* SELE RULl *!* *!* SET FILTER TO cod=m.cod AND CANTE#0 *!* *!* *and left(scd,3)='371' *!* sele optiuni *!* loca for optiune='FORMAT A4' *!* IF DA *!* SELE RULl *!* REPORT FORM FACTvanz TO PRINTER PROMPT PREVIEW *!* ELSE *!* SELE RULl *!* REPORT FORM FACTvanz_A5 TO PRINTER PROMPT PREVIEW *!* ENDIF *!* ELSE *!* DO mesaj with 'Factura '+allt(str(m.nract1))+' nu este','inregistrata in aceasta luna!' *!* ENDIF *!* DO sterge *!* SELECT rul *!* SET FILTER TO *!* RETURN *!* *-------------------------- *!* Procedure LIST_pv_prod *!* Parameters M.NNIR *!* m.nnir=Allt(M.NNIR) *!* LOCAL M.SUM1,M.SUM2 *!* STORE 0 TO M.SUM1,M.SUM2 *!* SELECT ACT *!* SET ORDER TO TAG COD *!* Sele rull *!* Set Filter To *!* Go Top *!* Loca For Val(nnir)=Val(m.nnir) And CANT#0 And CANTE=0 *!* If !Found() *!* Do mesaj With 'Nu a fost inregistrat nici un PV','in luna curenta, cu numarul '+m.nnir *!* Return *!* Else *!* Sele rull *!* Scat Fiel cod Memv *!* Sele act *!* Set Filter To *!* SEEK m.cod *!* If Found() *!* Scat Memv *!* Endif *!* Loca For cod=m.cod *!* If Found() *!* Do tva *!* Sele act *!* m.sum1=suma *!* m.sum2=m.sum1*(m.ctva-1) *!* Else *!* Store 0 To m.sum1,m.sum2 *!* Endif *!* *m.T='NIRURI' *!* Select Distinct act.nume,act.fdoc,act.nract,act.dataireg,act.DATAACT,ACT.COD From act; *!* WHERE cod=M.cod AND ID_SET=81 Into Cursor FF *!* *!* Select RULL.*,FF.*,RULL.nnir+Str(RULL.gest) AS NGEST; *!* from FF,rull; *!* where FF.cod=rull.cod And Val(rull.nnir)=Val(m.nnir) And rull.CANTE=0 And rull.CANT#0; *!* into CURSOR ra ORDER BY NGEST *!* *!* Select RULL.*,FF.*; *!* *!* from FF,rull; *!* *!* where FF.cod=rull.cod And Val(rull.nnir)=Val(m.nnir) And rull.CANTE=0 And rull.CANT#0; *!* *!* into TABLE &loc\&nfscurt\tempo\ra *!* *Sele ra *!* *Index On nnir+Str(gest) Tag ngest Of &loc\&nfscurt\tempo\ra *!* *Sele ra *!* *Set Order To Tag ngest *!* *!* *sele optiuni *!* *loca for optiune='FORMAT A4' *!* *IF DA *!* Sele ra *!* Report Format PV_PROD.FRX To Printer Prompt Preview *!* *ELSE *!* * Sele ra *!* * Report Format PV_PROD_A5.FRX To Printer Prompt Preview *!* *ENDIF *!* Use In ra *!* Use In FF *!* ENDIF *!* SELECT ACT *!* SET ORDER TO TAG DATAIREG *!* Do STERGE *!* RETURN *!* *------------------------------------------------------------- *!* PROCEDURE LIST_RETUR *!* PARAMETERS M.NRACT1,DECARE *!* sele act *!* loca for nract=m.nract1 *!* if found() *!* scat memv *!* m.numegest=m.explicatia *!* SELE RULL *!* *SET FILTER TO cod=m.cod *!* sele rulL.* from rulL where cod=m.cod and LEFT(scd,1) = '3' into table &loc\&nfscurt\tempo\ra *!* sele ra *!* repl all cante with -cante *!* IF DECARE=5 *!* REPORT FORMAT RETURMAT.FRX TO PRINTER PROMPT PREVIEW *!* ELSE *!* REPORT FORMAT RETUR.FRX TO PRINTER PROMPT PREVIEW *!* ENDIF *!* else *!* do mesaj with 'Nu a fost emisa nota cu nr.'+allt(str(m.nract1)),'in aceasta luna.' *!* endif *!* DO STERGE *!* RETURN *!* *------------------------------- *!* PROCEDURE LIST_TRANSFER *!* PARAMETERS M.NRACT1,DECARE *!* sele act *!* loca for nract=m.nract1 and INLIST(id_set,74,75,76,89) *!* if found() *!* scat memv *!* m.numegest=m.explicatia *!* SELE RULl *!* SET ORDER TO tag cod *!* *loca for cod=m.cod *!* SEEK m.cod *!* if !found() *!* DO MESAJ WITH 'Nu exista aceasta nota de transfer','' *!* return *!* ELSE *!* IF decare # 26 *!* SET FILTER TO cod=m.cod and !empty(cante) *!* IF NR_GEST=6 OR DECARE=18 *!* report form nirtransferl to printer prompt preview *!* ELSE *!* report form nirtransferMATl to printer prompt preview *!* ENDIF *!* ELSE *!* LOCATE FOR cod=m.cod AND !EMPTY(cant) *!* m.nume_2 = nresp *!* SET FILTER TO cod=m.cod and !empty(cante) *!* LOCATE *!* pcResp = nresp *!* report form transfer8039 to printer prompt preview *!* ENDIF *!* endif *!* ELSE *!* DO MESAJ WITH 'Nu exista aceasta nota de transfer','' *!* ENDIF *!* sele act *!* set filter to *!* SELECT RULl *!* SET ORDER TO *!* SET FILTER TO *!* DO STERGE *!* RETURN *!* *------------------------------------------------------- *!* PROCEDURE FIFO *!* PARAMETERS TCOD,TMAT,TDATA,tpret,tcant *!* tmat=UPPER(ALLTRIM(tmat)) *!* tcod=UPPER(ALLTRIM(tcod)) *!* SELECT DISTINCT denumire,codmat,pret FROM fifo INTO CURSOR verif *!* SELECT verif *!* SCAN *!* SCATTER NAME ver *!* SELECT iesiri *!* GO TOP *!* LOCATE FOR UPPER(ALLTRIM(denumire))=UPPER(ALLTRIM(ver.denumire)) AND UPPER(ALLTRIM(codmat))=UPPER(ALLTRIM(ver.codmat)) AND pret=ver.pret *!* IF !FOUND() *!* SELECT fifo *!* REPLACE ALL dataout WITH {},cante WITH 0,incomplet WITH .f.; *!* FOR UPPER(ALLTRIM(denumire))=UPPER(ALLTRIM(ver.denumire)) AND UPPER(ALLTRIM(codmat))=UPPER(ALLTRIM(ver.codmat)) AND pret=ver.pret *!* ENDIF *!* SELECT verif *!* ENDSCAN *!* RELEASE ver *!* USE IN verif *!* SELECT fifo *!* LOCATE FOR UPPER(ALLTRIM(denumire))=tmat AND UPPER(ALLTRIM(codmat))=tcod *!* IF !FOUND() *!* IF USED('cfifo') *!* USE IN cfifo *!* ENDIF *!* *!* SELECT denumire,codmat,pret,cants+cant-cante as cant,cante,datain,dataout,curs as idf; *!* FROM stoc; *!* WHERE ALLTRIM(UPPER(denumire))==tmat AND ALLTRIM(UPPER(codmat))==tcod ; *!* AND cants+cant-cante>0 AND gest=m.gest; *!* INTO TABLE &loc\&nfscurt\tempo\cfifo ORDER BY datain *!* SELECT CFIFO *!* REPLACE ALL cante WITH 0,dataout WITH {} *!* CALCULATE MIN(datain) TO mindata *!* IF tdata>mindata *!* DO mesaj WITH 'ATENTIE !','Nu se respecta metoda FIFO !' *!* MARCA=.T. *!* RETURN *!* ENDIF *!* *!* SELECT fifo *!* APPEND FROM &loc\&nfscurt\tempo\cfifo *!* LOCATE FOR UPPER(ALLTRIM(denumire))=tmat AND UPPER(ALLTRIM(codmat))=tcod AND pret=tpret *!* REPLACE dataout WITH DATE()&&,cante WITH tcant *!* *!* IF cant-cante>0 *!* *!* REPLACE incomplet WITH .t. *!* *!* ENDIF *!* ELSE *!* SELECT fifo *!* CALCULATE MIN(datain) TO mindata FOR UPPER(ALLTRIM(denumire))=tmat AND UPPER(ALLTRIM(codmat))=tcod AND (EMPTY(dataout) OR incomplet) *!* GO TOP *!* LOCATE FOR UPPER(ALLTRIM(denumire))=tmat AND UPPER(ALLTRIM(codmat))=tcod AND pret=tpret &&AND (EMPTY(dataout) OR incomplet) *!* IF tdata>mindata *!* DO mesaj WITH 'ATENTIE !','Nu se respecta metoda FIFO' *!* MARCA=.T. *!* RETURN *!* ENDIF *!* REPLACE dataout WITH DATE()&&,cante WITH tcant *!* *!* IF cant-cante>0 *!* *!* REPLACE incomplet WITH .t. *!* *!* ELSE *!* *!* REPLACE incomplet WITH .f. *!* *!* ENDIF *!* ENDIF *!* ENDPROC *!* *------------------------------------------------------- *!* PROCEDURE LIFO *!* PARAMETERS TCOD,TMAT,TDATA,tpret *!* tmat=UPPER(ALLTRIM(tmat)) *!* tcod=UPPER(ALLTRIM(tcod)) *!* SELECT DISTINCT denumire,codmat,pret FROM fifo INTO CURSOR verif *!* SELECT verif *!* SCAN *!* SCATTER NAME ver *!* SELECT iesiri *!* GO TOP *!* LOCATE FOR UPPER(ALLTRIM(denumire))=UPPER(ALLTRIM(ver.denumire)) AND UPPER(ALLTRIM(codmat))=UPPER(ALLTRIM(ver.codmat)) AND pret=ver.pret *!* IF !FOUND() *!* SELECT fifo *!* REPLACE ALL dataout WITH {},cante WITH 0,incomplet WITH .f.; *!* FOR UPPER(ALLTRIM(denumire))=UPPER(ALLTRIM(ver.denumire)) AND UPPER(ALLTRIM(codmat))=UPPER(ALLTRIM(ver.codmat)) AND pret=ver.pret *!* ENDIF *!* SELECT verif *!* ENDSCAN *!* RELEASE ver *!* USE IN verif *!* SELECT fifo *!* LOCATE FOR UPPER(ALLTRIM(denumire))=tmat AND UPPER(ALLTRIM(codmat))=tcod *!* IF !FOUND() *!* IF USED('cfifo') *!* USE IN cfifo *!* ENDIF *!* *!* SELECT denumire,codmat,pret,cants+cant-cante as cant,cante,datain,dataout,curs as idf; *!* FROM stoc; *!* WHERE ALLTRIM(UPPER(denumire))==tmat AND ALLTRIM(UPPER(codmat))==tcod ; *!* AND cants+cant-cante>0 AND gest=m.gest; *!* INTO TABLE &loc\&nfscurt\tempo\cfifo ORDER BY datain *!* SELECT CFIFO *!* REPLACE ALL cante WITH 0,dataout WITH {} *!* CALCULATE Max(datain) TO maxdata *!* IF tdata' *!* SCATTER MEMVAR BLANK *!* *!* DO CAUT_ALFa_cursor WITH "tgrupa","dn_grupa",'Alegeti grupa:','' *!* USE IN tgrupa *!* *!* IF buton = 2 *!* RETURN *!* ENDIF *!* IF ALLTRIM(m.dn_grupa) # '' *!* lcCond = lcCond + [ and id_grupa = m.id_grupa] *!* ENDIF *!* *!* SELECT DISTINCT dn_sbgrupa, id_sbgrupa FROM art_sbgr WHERE id_grupa = m.id_grupa INTO CURSOR tgrupa READWRITE ORDER BY dn_sbgrupa *!* SELECT tgrupa *!* APPEND blan *!* REPLACE dn_sbgrupa WITH ' ' *!* SCATTER MEMVAR BLANK *!* *!* DO CAUT_ALFa_cursor WITH "tgrupa","dn_sbgrupa",'Alegeti subgrupa:','' *!* USE IN tgrupa *!* *!* IF buton = 2 *!* RETURN *!* ENDIF *!* IF ALLTRIM(m.dn_sbgrupa) # '' *!* lcCond = lcCond + [ and id_sbgrupa = m.id_sbgrupa] *!* ENDIF *!* *!* SELECT DISTINCT id_articol, denumire, codmat, um, id_grupa, id_sbgrupa ; *!* FROM listast WHERE &lccond INTO CURSOR tlist READWRITE ORDER BY id_grupa, id_sbgrupa, denumire, codmat *!* *!* SELECT t.*, g.dn_grupa, s.dn_sbgrupa ; *!* FROM ((tlist t LEFT JOIN art_gr g ON t.id_grupa = g.id_grupa ) ; *!* LEFT JOIN art_sbgr s ON t.id_sbgrupa = s.id_sbgrupa AND t.id_grupa = s.id_grupa ) ; *!* INTO CURSOR tlista *!* USE IN tlist *!* *!* SELECT t.*, sum(r.pret*r.cant) as valoare, sum(r.cant) as intrari FROM rul r JOIN tlista t ON r.id_articol = t.id_articol ; *!* WHERE BETWEEN(r.dataact,pdData1, pdData2) AND r.cant#0 AND LEFT(ALLTRIM(r.scd),3) = '371' AND !INLIST(r.id_set, 74, 75, 76) ; *!* INTO CURSOR trez ; *!* GROUP BY r.id_articol ; *!* ORDER BY t.dn_grupa, t.dn_sbgrupa, t.denumire, t.codmat *!* *!* titlu = 'Intrari de la ' + DTOC(pdData1) + ' la ' + DTOC(pdData2) *!* *!* SELECT trez *!* REPORT FORM stoc_grupe TO PRINTER PROMPT PREVIEW *!* *!* USE IN tlista *!* USE IN trez *!* ENDPROC && list_articole_gr *!* *__________________________________________________________________________________________________ *!* *!* PROCEDURE list_stoc_articol *!* SELECT s.denumire,s.codmat,s.um,s.gest,ALLTRIM(STR(s.id_articol))+ALLTRIM(STR(s.gest))+ALLTRIM(s.denumire)+ALLTRIM(s.codmat) as articol,sum(s.cants+s.cant-s.cante) as cantitate,g.numegest; *!* from stoc s,numegest g ; *!* WHERE s.gest=g.gest; *!* GROUP BY articol INTO CURSOR tstoc ORDER BY denumire *!* SELECT tstoc *!* *BROWSE *!* REPORT FORM stoc_articol TO PRINTER PROMPT PREVIEW *!* USE IN tstoc *!* ENDPROC && list_stoc_articol *!* *__________________________________________________________________________________________________ *!* PROCEDURE fisa_magazie_simpla *!* LOCAL ln_stoci *!* STORE 0 TO ln_stoci *!* SELECT rull *!* SCATTER NAME oru *!* SELECT DISTINCT r.nnir,r.cante,r.cant,r.dataact,a.nract,r.cant AS STOCI,r.cant AS STOCF ; *!* FROM rull r LEFT JOIN act a ON r.cod=a.cod ; *!* WHERE (denumire=oru.denumire AND codmat=oru.codmat AND gest=oru.gest) AND id_articol=oru.id_articol ; *!* INTO TABLE &loc\&nfscurt\tempo\fisa_stoc ORDER BY r.dataact *!* SELECT FISA_STOC *!* REPLACE ALL STOCI WITH 0,stocf WITH 0 *!* SELECT stoc *!* LOCATE FOR (denumire=oru.denumire AND codmat=oru.codmat AND gest=oru.gest) AND id_articol=oru.id_articol *!* IF FOUND() *!* ln_stoci=cants *!* ENDIF *!* SELECT fisa_stoc *!* GO top *!* REPLACE stoci WITH ln_stoci &&,stocf WITH ln_stoci+cant-cante *!* SCAN *!* REPLACE stocf WITH ln_stoci+cant-cante *!* ln_stoci=stocf *!* ENDSCAN *!* SELECT listast *!* LOCATE FOR id_articol=oru.id_articol *!* Lnid_grupa=id_grupa *!* Lnid_sbgrupa=id_sbgrupa *!* *WAIT WINDOW STR(oru.gest) *!* SELECT numegest.numegest,art_gr.dn_grupa,art_sbgr.dn_sbgrupa FROM numegest,art_gr ,art_sbgr; *!* where numegest.gest=oru.gest AND art_gr.id_grupa=Lnid_grupa AND art_sbgr.id_sbgrupa=Lnid_sbgrupa ; *!* INTO CURSOR tdate *!* *BROWSE *!* SELECT fisa_stoc *!* REPORT FORM fisa_magazie_simpla TO PRINTER PROMPT PREVIEW *!* RELEASE oru *!* USE IN fisa_stoc *!* USE IN tdate *!* ENDPROC && fisa_magazie_simpla *!* *____________________________________________________________________________________________ *!* PROCEDURE list_stoc_art *!* PARAMETERS tc_cond *!* tc_cond=ALLTRIM(tc_cond) *!* IF USED('tstoc') *!* USE IN tstoc *!* ENDIF *!* SELECT *,sum(cants+cant-cante) as stocf,SUM((CANTs+cant-cante)*PRET) AS VALoare, ; *!* ALLTRIM(denumire)+ALLTRIM(codmat)+ALLTRIM(STR(id_articol)) as indexul ; *!* FROM stoc WHERE &tc_cond ; *!* GROUP BY indexul ; *!* INTO CURSOR tstoc *!* SELECT tstoc *!* ENDPROC && list_stoc_art *!* *____________________________________________________________________________________________ *!* PROCEDURE raport_material_furnizor *!* PRIVATE poConditie, lddata1, lddata2 *!* DO FORM frm_filtru_text WITH 'r.denumire','Denumirea materialului',1 TO pcConditie *!* *!* IF .filtru = "" *!* *!* .Value = 0 *!* *!* ENDIF *!* *!* loLuna=ret_luna("Selectati luna de inceput") *!* lddata1=CTOD('01/'+loLuna.nl+'/'+loLuna.an) && 01/01/2003 *!* loLuna=ret_luna("Selectati luna de sfarsit") *!* lddata2=CTOD('01/'+loLuna.nl+'/'+loLuna.an) && 01/01/2003 *!* *lddata2=GOMONTH(CTOD('01/'+m.Nl+'/'+m.An),1)-1 && 31/07/2003 *!* CREATE TABLE &loc\&nfscurt\tempo\tfis (an c(4), luna c(2), denumire c(100), codmat c(50), cod n(10),cant n(12), pret n(14), nnir c(10), nume c(30)) *!* SELECT calendar *!* SCAN FOR BETWEEN(CTOD('01/'+nl+'/'+an), lddata1, lddata2) *!* *!* lcAn = an *!* lcLuna = nl *!* *!* lcDate = ADDBS(calefirma)+'AN' + an + '\DATE' + nl+'\' *!* lcFisRul = lcDate + "rull.dbf" *!* lcFisAct = lcDate + "act.dbf" *!* *!* IF !FILE(lcFisRul) OR !FILE(lcFisAct) *!* SELECT calendar *!* LOOP *!* ENDIF *!* *!* IF USED('rulaje') *!* USE IN rulaje *!* ENDIF *!* *!* IF USED('rj') *!* USE IN rj *!* ENDIF *!* *!* IF USED('tcrul') *!* USE IN tcrul *!* ENDIF *!* *!* USE &lcFisRul AGAIN IN 0 shared ALIAS rulaje ORDER TAG "denumire" *!* USE &lcFisAct AGAIN IN 0 shared ALIAS rj ORDER TAG "nume" *!* SELECT DISTINCT r.denumire, r.codmat, r.cod, r.cant, r.pret, r.nnir, a.nume,ALLTRIM(r.denumire)+ALLTRIM(r.codmat)+ALLTRIM(STR(ROUND(pret,0))) as numecod ; *!* FROM rulaje r LEFT JOIN rj a ON r.cod = a.cod AND r.nnir = a.nnir ; *!* WHERE &pcConditie AND r.cant # 0 AND LEFT(a.scc,3) = '401'; *!* INTO CURSOR tcrul ; *!* ORDER BY a.nume, numecod *!* *!* SELECT tcrul *!* TOTAL TO &loc\&nfscurt\tempo\xtotal ON numecod FIELDS cant *!* * GROUP BY r.denumire, r.codmat, r.pret, a.nume ; *!* SELECT tfis *!* * APPEND FROM DBF('tcrul') *!* APPEND FROM &loc\&nfscurt\tempo\xtotal *!* REPLACE ALL luna WITH lcLuna FOR EMPTY(luna) *!* REPLACE ALL an WITH lcAn FOR EMPTY(an) *!* SELECT calendar *!* ENDSCAN *!* SELECT tfis *!* INDEX ON AN + ALLTRIM(NUME)+ LUNA TAG nume OF &loc\&nfscurt\tempo\xULEI ASCENDING *!* SELECT tfis *!* REPORT FORM list_ulei TO PRINTER PROMPT PREVIEW *!* IF USED('rulaje') *!* USE IN rulaje *!* ENDIF *!* IF USED('rj') *!* USE IN rj *!* ENDIF *!* IF USED('tcrul') *!* USE IN tcrul *!* ENDIF *!* USE IN tfis *!* ENDPROC && raport_material_furnizor *!* *________________________________________ *!* PROCEDURE raport_productie_postcalcul *!* SELECT DISTINCT NRORD FROM RULL into TABLE &LOC\&NFSCURT\tempo\raA.DBF *!* SELECT RAA *!* *!* APPEND BLANK *!* *!* REPLACE NRORD WITH " " *!* Index ON NRORD TAG NRORD *!* do caut_alfa with "RAA","Nrord","NUMELE COMENZII","M.nrord" *!* PRIVATE pnCant *!* pnCant = 0 *!* Ointre=CREATEOBJECT("CAUTintre") *!* WITH Ointre *!* .CAPTION="Dat in executie" *!* .label1.caption="Cantitatea :" *!* .label2.visible=.f. *!* .text1.controlsource="pnCant" *!* .text2.visible=.f. *!* endwith *!* ointre.show(1) *!* *!* SELECT denumire, um, sum(cante) as canttot, pret, gest, codmat, ; *!* sum(round(pret*cante, 0)) as valtot, sum(ROUND(cante/pnCant,3)) as cant_unit, sum(round(pret*cante/pnCant, 3)) as val_unit; *!* from rull ; *!* where nrord = m.nrord And cante # 0 And cant = 0 ; *!* into CURSOR rapostcalcul GROUP BY denumire, codmat, pret ORDER BY denumire *!* *!* SELECT RApostcalcul *!* *!* *Index On NRORD+STR(VAL(ALLTRIM(nnir)))+DTOC(dataact) TAG nnir &&To &LOC\&NFSCURT\tempo\FFD *!* *!* BROWSE *!* SELECT RApostcalcul *!* *!* SET FILTER TO NRORD=M.NRORD *!* REPORT FORM postcalcul TO PRINTER PROMPT PREVIEW *!* USE IN rapostcalcul *!* ENDPROC && raport_productie_postcalcul