2792 lines
101 KiB
Plaintext
2792 lines
101 KiB
Plaintext
*!* 27.08.2009
|
|
*!* marius.mutu
|
|
*!* listare_transfer : taxa_reconditionare - rap_nirtransfer_achi2 (landscape + coloane durata ramasa, taxa reconditionare)
|
|
*!* taxa reconditionare apare doar daca se transfera de la un responsabil la magazie
|
|
|
|
*!* 01.07.2010
|
|
*!* marius.mutu
|
|
*!* listare_nir - id_jtva_coloana achizitie taxare inversa, nu stiu de ce era 1
|
|
|
|
*!* 13.08.2014
|
|
*!* marius.mutu
|
|
*!* list_total_NIR - s-a eliminat join cu act dupa cont - puteau aparea duplicate, in act existau mai multe inregistrari cu acelasi cont
|
|
|
|
*!* 05.02.2015
|
|
*!* marius.mutu
|
|
*!* LISTARE_BON_TOT - se listeaza bonurile cu foxypreviewer
|
|
|
|
*!* 13.06.2017
|
|
*!* marius.mutu
|
|
*!* list_raport_gestiuni - export xls
|
|
|
|
*!* 09.07.2018
|
|
*!* marius.mutu
|
|
*!* listare_protocol - id_set 243
|
|
|
|
*!* 02.07.2020
|
|
*!* marius.mutu
|
|
*!* LISTARE_TRANSFER
|
|
*!* 229 transfer rezervare - se listeaza si clientii/lucrarile corespondente
|
|
|
|
*!* LISTARE_BON_TOT
|
|
*!* tratare id_Set = 274 iesire din ob inv in fol si inregistrare cheltuiala
|
|
|
|
*!* 20.02.2024
|
|
*!* LISTARE_BON_TOT
|
|
*!* adaugare sal_stat.formatia
|
|
|
|
Procedure listare_protocol
|
|
Lparameters tnNract, tnTip
|
|
|
|
*!* tnTip: 1 (default) = protocol (pret cu tva); 2 = sponsorizare (pret fara tva)
|
|
Private pnNrAct,pnCod
|
|
Local lcCursor,lcCursor2, lnTip
|
|
lcCursor=[crsdateact]
|
|
lcCursor2 = [crsprotocol]
|
|
|
|
If Type('tnTip') <> 'N'
|
|
lnTip = 1
|
|
Else
|
|
lnTip = tnTip
|
|
Endif
|
|
pnNrAct = tnNract
|
|
*!* v 2.0.18 roagest (denumire partener, id_set 232, 233, 235)
|
|
lcSql = [Select distinct a.cod, a.dataact, p.id_part as id_client, p.denumire, b.nume_gestiune as gestiune from act a ] + ;
|
|
[ left join nom_gestiuni b on a.id_gestout = b.id_gestiune ] + ;
|
|
[ left join nom_parteneri p on a.id_partc = p.id_part ] + ;
|
|
[where a.an = ?gnAn and a.luna = ?gnLuna and a.nract = ?pnNrAct and a.scc = '401' and a.sters = 0 and a.id_set in (230,232,233,235,261,270,243) ] + ;
|
|
Strtran(gcCondSucursala,[id_sucursala],[a.id_sucursala])
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
|
|
If Reccount(lcCursor) > 0
|
|
Select (lcCursor)
|
|
Scatter Name poClient
|
|
*!* v 2.0.18 roagest (iau partenerul din jurnal)
|
|
*!* AddProperty(poClient,[id_client],[0])
|
|
*!* AddProperty(poClient,[denumire],[])
|
|
pnCod = cod
|
|
poDate=Createobject("oDateFactura",0,0)
|
|
poDate.nract = pnNrAct
|
|
poDate.dataact = Iif(Type('dataact')='T',Ttod(dataact),dataact)
|
|
poDate.dataora_exp = get_ora() && modificare ROAGEST v 2.0.150
|
|
|
|
*!* loCauta = caut_partener()
|
|
*!* If gnButon <> 2
|
|
*!* poClient.id_client = loCauta.id_part
|
|
*!* poClient.denumire = loCauta.denumire
|
|
*!* Else
|
|
poDate.tip = 23 && artificiu ca sa nu mai caute doar in delegatii pentru partenerul respectiv
|
|
*!* EndIf
|
|
*!* v 2.0.18 roagest ^
|
|
Use In (lcCursor)
|
|
|
|
Private ofrmdatesupl
|
|
ofrmdatesupl = Createobject("frm_alte_date")
|
|
ofrmdatesupl.Show(1)
|
|
Release ofrmdatesupl
|
|
|
|
*!* modificare ROAGEST v 2.0.150
|
|
If gnButon = 1
|
|
*!* modificare ROAGEST v 2.0.150 ^
|
|
lcSql = [select denumire as nume_responsabil,cod_fiscal as CNPresp,reg_comert as BIresp from nom_parteneri ] + ;
|
|
[where sters = 0 and inactiv = 0 and id_part in ] + ;
|
|
[(select id_partener from utilizatori_rol_intern where sters = 0 and id_util = ?gnIdUtil)]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor2)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
Select (lcCursor2)
|
|
poDate.nume_responsabil = nume_responsabil
|
|
poDate.BIresp = BIresp
|
|
poDate.CNPresp = CNPresp
|
|
Use In (lcCursor2)
|
|
|
|
lcSql = [select a.cante as cantitate,] + ;
|
|
Iif(lnTip = 1, [a.pretv+a.tvav], [a.pretv]) + [ as pretctva, ] + ;
|
|
Iif(lnTip = 1, [Round(a.cante*(a.pretv+a.tvav),?gnPc)], [Round(a.cante*a.pretv,?gnPc)]) + [ as valctva,] + ;
|
|
[a.serie,a.lot,b.codmat,b.denumire,b.um ] + ;
|
|
[from rul a left join nom_articole b on a.id_articol = b.id_articol ] + ;
|
|
[where a.sters = 0 and a.cod = ] + ALLTRIM(STR(m.pnCod))
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor2)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
goExport.export2frx(lcCursor2,[protocol], , , , , , .T.)
|
|
If Used(lcCursor2)
|
|
Use In (lcCursor2)
|
|
Endif
|
|
*!* modificare ROAGEST v 2.0.150
|
|
Endif
|
|
*!* modificare ROAGEST v 2.0.150 ^
|
|
Else
|
|
amessagebox("Nu exista avizul cu acest numar in luna curenta!",48,"Atentie")
|
|
Endif
|
|
Release lcCursor,lcCursor2,pnNrAct,pnCod
|
|
Endproc && listare_protocol
|
|
*****************************************************************************************************************
|
|
Procedure listare_nir
|
|
Parameters tnNir, tnTip, tlProductie, tlBon_livrare,tnTipRulaj
|
|
DO listare_nir_TOT WITH tnNir,tnNir, tnTip, tlProductie, tlBon_livrare,tnTipRulaj
|
|
ENDPROC &&listare_nir
|
|
*****************************************************************************************************************
|
|
|
|
Procedure listare_nir_TOT
|
|
Parameters tnNir1,tnNir2, tnTip, tlProductie, tlBon_livrare,tnTipRulaj
|
|
&& nu merge pt baza de date din preluare (cauza id_fact);
|
|
&& solutie : in loc de id_fact , cod - nu am pus cod pt ca nu e terminata modificarea din contabilitate
|
|
&& tlProductie - pt. programul RoaProductie am raportul pv_prod.frx
|
|
&& tnTipRulaj: NIR = 0 INTRARE REALA, 1 TRANSFER (DE LA O GESTIUNE VALORICA)
|
|
&&13.01.2015 - a fost adaugat pnNir1, pnNir2
|
|
LOCAL lnTipRulaj
|
|
STORE 0 TO lnTipRulaj
|
|
Private lnCod,pnNir1,pnNir2,lnSuma1,lnSuma2,loact,pnTip,pnBazaDiscount,pnTvaDiscount,lcListaID,lcExceptii,lcContFact
|
|
Store "" To loact,lcListaID,lcExceptii,lcContFact
|
|
Store 0 To lnSuma1,lnSuma2,pnNir1,pnNir2,pnBazaDiscount,pnTvaDiscount
|
|
pnNir1=tnNir1
|
|
pnNir2=tnNir2
|
|
Private poact
|
|
Store Null To poact
|
|
|
|
lcContFact = ['401','404','408']
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
*!* v 2.0.28
|
|
*!* LA NIR BILETE RATC - CALCULUL, NOTELE CONTABILE, LISTAREA SE FAC:
|
|
*!* VALOAREA CU TVA
|
|
*!* VALOAREA TVA = VALOAREA CU TVA * (PROC_TVA - 1)/ PROC_TVA
|
|
*!* VALOAREA FARA TVA = VALOAREA CU TVA - VALOAREA TVA
|
|
Private plNIRBONPretCuTVA
|
|
plNIRBONPretCuTVA = Iif(Inlist(tnTip,17,27),.T.,.F.) && NIR BILETE RATC
|
|
pnTip = Iif(pnTip = 17, 6,Iif(pnTip = 27,7,pnTip))
|
|
*!* v 2.0.28 ^
|
|
|
|
lnTipRulaj=IIF(EMPTY(tnTipRulaj),0,1)
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
*!* lcSql=[select cod,nnir,dataact,codmat,denumire,um,pret,tva,cant,pretv,tvav,cante,cgest,proc_tva,proc_tvav,id_fact,id_gestiune,procent, reteta ]+;
|
|
*!* [ from vrul ]+;
|
|
*!* [ where luna=?gnLuna and an=?gnAn and nnir=]+ALLTRIM(STR(pnNir))+[ and cant<>0 and cante=0 ] + ;
|
|
*!* [ and id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag = ?pnTip)]
|
|
|
|
&& 09.11.2006 - factura Metro - toate tipurile de gestiune, exc. M pret vanzare
|
|
If tlBon_livrare
|
|
lcSql=[select cod,nnir,dataact,codmat,denumire,serie,lot,um,cont,acont,pret,tva,cant,pretv,tvav,cante,cgest, nume_gestiune, gestionar, comisie_receptie1, comisie_receptie2, comisie_receptie3,] + ;
|
|
[proc_tva,proc_tvav,id_fact,id_gestiune,procent, reteta, pretd, curs, nume_val, id_rul ] + ;
|
|
[ from vrul ]+;
|
|
[ where an=] + ALLTRIM(STR(gnAn)) + [ and luna=] + ALLTRIM(STR(gnLuna)) + [ and nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + [ and cant=0 and cante<>0 and id_tip_rulaj = 0 ] + gcCondSucursala
|
|
Else
|
|
lcSql=[select cod,nnir,dataact,codmat,denumire,serie,lot,um,cont,acont,pret,tva,cant,pretv,tvav,cante,cgest, nume_gestiune, gestionar, comisie_receptie1, comisie_receptie2, comisie_receptie3,] + ;
|
|
[proc_tva,proc_tvav,id_fact,id_gestiune,procent, reteta,pretd, curs, nume_val, id_rul ] + ;
|
|
[from vrul ]+;
|
|
[ where an=] + ALLTRIM(STR(gnAn)) + [ and luna=] + ALLTRIM(STR(gnLuna)) + [ and nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + [ and cant<>0 and cante=0 and id_tip_rulaj =]+ALLTRIM(STR(lnTipRulaj)) + gcCondSucursala
|
|
Endif
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu a fost inregistrat nici un NIR in luna curenta cu numarul intre "+Alltrim(Str(pnNir1))+" si "+ALLTRIM(STR(pnNir2))+" !",0+48,"Atentie")
|
|
lnSucces = -1
|
|
Else
|
|
lcSql=[select cont_c from exceptii_ireg where cont in ('401','404','408') and invers = 1 and debit = 0 ]
|
|
lcCursor=[crsExceptii]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0 && dc eroare nu ies, iau exceptie default
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
lcExceptii = ['767']
|
|
Endif
|
|
If Used('crsExceptii')
|
|
Select crsExceptii
|
|
Scan
|
|
lcExceptii = lcExceptii + [,'] + Alltrim(cont_c) + [']
|
|
Endscan
|
|
lcExceptii = Substr(lcExceptii ,2)
|
|
Use In crsExceptii
|
|
Endif
|
|
|
|
If Empty(lcExceptii)
|
|
lcExceptii = ['767']
|
|
Endif
|
|
|
|
*** la emiterea de factura din ROAAUTO se completeaza ID_FACT-ul facturii de vanzare pe toate rulajele care au lucrarea din factura ???
|
|
*** asa ca id_fact din rul nu mai corespunde cu cel din act
|
|
*** folosesc cod in schimb
|
|
*!* Select Distinct id_fact From crsrul Into Cursor tfacturi
|
|
Select Distinct cod as id_fact From crsrul Into Cursor tfacturi
|
|
Select tfacturi
|
|
Scan
|
|
lcListaID = lcListaID + [,] + Alltrim(Str(id_fact))
|
|
Endscan
|
|
lcListaID = Substr(lcListaID,2)
|
|
|
|
If tlProductie
|
|
If tlBon_livrare
|
|
lcSql=[SELECT nract, serie_act, dataact, dataireg, fdoc, nnir, nrord, sectie, ]+;
|
|
[ partd as nume, 0 as factura, 0 as discount, 0 as tvaDiscount ]+;
|
|
[from vact ]+;
|
|
[ where an=] + ALLTRIM(STR(gnAn)) + [ and luna=] + ALLTRIM(STR(gnLuna)) + [ and nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + [ and substr(scd,1,3) = '428' and substr(scc,1,3) = '758']
|
|
Else
|
|
lcSql=[SELECT nract, serie_act, dataact, dataireg, fdoc, nnir, nrord, sectie, max(case when scc in (]+lcContFact+[) then partc else partd end) as nume,] +;
|
|
[sum(case when SUBSTR(scd,1,2) = '40' and scc in (]+lcExceptii+[) then suma else 0.0000 end) as discount,]+;
|
|
[sum(case when SUBSTR(scd,1,2) = '40' and scc in (]+lcExceptii+[) then ROUND(suma*(proc_tva-1),?gnPc) else 0.0000 end) as tvaDiscount,]+;
|
|
[sum(case when SUBSTR(scc,1,2) = '40' then suma else 0.0000 end) as factura ]+;
|
|
[from vact ] +;
|
|
[ where an=] + ALLTRIM(STR(gnAn)) + [ and luna=] + ALLTRIM(STR(gnLuna)) + [ and nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + ;
|
|
[ group by serie_act, nract, dataact, dataireg, fdoc, nnir, nrord, sectie]
|
|
Endif
|
|
Else
|
|
|
|
&& v 2.0.17 - nu prelua corect numele furnizorului la listarea nirului - facea max intre partc si partd, in loc de partd am pus null
|
|
*!* lcSql=[SELECT nract, serie_act, dataact, dataireg, fdoc, nnir, max(case when scc in (]+lcContFact+[) then partc else partd end) as nume,] +
|
|
&& v 2.0.17 ^
|
|
*!* modificare v 2.1.17 : am adaugat 170,171,172,173,174,175
|
|
*!* modificare v 2.2.4 : am scos 170,171,172,173,174,175
|
|
lcSql=[SELECT nract, serie_act, dataact, dataireg, fdoc, nnir, max(case when scc in (]+lcContFact+[) then partc else null end) as nume,] +;
|
|
[sum(case when SUBSTR(scd,1,2) = '40' and scc in (]+lcExceptii+[) then suma else 0.0000 end) as discount,]+;
|
|
[sum(case when SUBSTR(scd,1,2) = '40' and scc in (]+lcExceptii+[) then ROUND(suma*(proc_tva-1),?gnPc) else 0.0000 end) as tvaDiscount,]+;
|
|
[sum(case when SUBSTR(scc,1,2) = '40' then suma else 0.0000 end) as factura, ]+;
|
|
[MAX(case when id_jtva_coloana in (137,138,139,140,141,142,143,144,145,146,162,163) then 1 else 0 end) as id_jtva_coloana ]+;
|
|
[from vact ] +;
|
|
[ where an=] + ALLTRIM(STR(gnAn)) + [ and luna=] + ALLTRIM(STR(gnLuna)) + [ and nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + [ and scc in (]+lcContFact+[,]+lcExceptii+[) ]+ ;
|
|
[ and cod in (] + lcListaID + [)] + ;
|
|
[ group by serie_act, nract, dataact,dataireg, fdoc, nnir]
|
|
Endif
|
|
lcCursor=[crsdiscount]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
Endif
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
pcDataOra = get_ora(2)
|
|
|
|
If Used('crslistare')
|
|
Use In crslistare
|
|
Endif
|
|
|
|
*!* 19.06.2006
|
|
*!* marius.mutu
|
|
*!* nir import - exista > 1 factura pe acelasi nnir si se dubleaza reperele
|
|
Select * From crsdiscount Into Cursor crsDiscountTemp1 Order By nnir,factura Desc
|
|
Select * From crsDiscountTemp1 Where 1 = 2 Into Cursor crsDiscountTemp Readwrite
|
|
|
|
Select crsDiscountTemp1
|
|
lnNnir = 0
|
|
Scan
|
|
Scatter Name loDisc
|
|
If lnNnir <> loDisc.nnir
|
|
lnNnir = loDisc.nnir
|
|
Insert Into crsDiscountTemp From Name loDisc
|
|
Endif
|
|
Endscan
|
|
Use In crsDiscountTemp1
|
|
|
|
If tlProductie
|
|
Select Alltrim(Str(a.nnir))+a.cgest As cnir_gest,a.*, ;
|
|
b.fdoc,b.nract,b.serie_act,b.dataireg,b.nume,b.nrord,b.factura - b.discount As total_factura, b.discount, b.tvaDiscount;
|
|
FROM crsrul a With (Buffering=.T.);
|
|
LEFT Join crsDiscountTemp b On a.nnir = b.nnir ;
|
|
INTO Cursor crslistare Order By 1, id_rul
|
|
Else
|
|
Select Alltrim(Str(a.nnir))+a.cgest As cnir_gest,a.*, ;
|
|
b.fdoc,b.nract,b.serie_act,b.dataireg,b.nume,b.factura - b.discount As total_factura, b.discount, b.tvaDiscount, b.id_jtva_coloana;
|
|
FROM crsrul a With (Buffering=.T.) ;
|
|
LEFT Join crsDiscountTemp b On a.nnir = b.nnir ;
|
|
INTO Cursor crslistare Order By 1, id_rul
|
|
Endif
|
|
|
|
Use In crsDiscountTemp
|
|
|
|
*!* 30.08.2007
|
|
*!* marius.mutu
|
|
*!* variabile pentru curs, numevaluta
|
|
*!* rap_nir_materiale.frx : sume in valuta
|
|
Select crslistare
|
|
Locate For Curs <> 0 Or pretd<>0
|
|
If Found()
|
|
pnCursNir = Curs
|
|
pcNumeValuta = Alltrim(nume_val)
|
|
Else
|
|
pnCursNir = 0
|
|
pcNumeValuta = ""
|
|
Endif
|
|
|
|
|
|
|
|
If tlProductie
|
|
If tlBon_livrare
|
|
lcRaport = 'bon_livrare'
|
|
Else
|
|
lcRaport = 'pv_prod'
|
|
Endif
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* Report Form &lcRaport To Printer Prompt Preview
|
|
goExport.export2frx([crslistare],lcRaport, , , , , , .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
*REPORT FORM pv_prod.frx TO PRINTER PROMPT PREVIEW
|
|
Else
|
|
*!* modificare v 2.1.17
|
|
*!* *!* 01.07.2010
|
|
*!* *!* lnIdJtvaTI = 1 &&TAXARE INVERSA
|
|
*!* lnIdJtvaTI = GetIdJtvaStandard('ACHIZITIE_TI') && TAXARE INVERSA
|
|
lnIdJtvaTI = 1
|
|
*!* *!* 01.07.2010 ^
|
|
*!* modificare v 2.1.17 ^
|
|
Private pcEtichetaTI &&TAXARE INVERSA
|
|
pcEtichetaTI = ''
|
|
Select crslistare
|
|
*!* BROWSE
|
|
Locate For id_jtva_coloana=lnIdJtvaTI
|
|
If Found()
|
|
pcEtichetaTI='TAXARE INVERSA'
|
|
Endif
|
|
|
|
If gnNir_standard = 1 && este NIR standard
|
|
*!* Report Form rap_nir_standard.frx To Printer Prompt Preview
|
|
goExport.export2frx([crslistare],[rap_nir_standard], , , , , , .T.)
|
|
Else
|
|
If Inlist(pnTip, 6, 7) && NIR MF PRET VZ, NIR RATC
|
|
*!* Report Form rap_nir_marfuri.frx To Printer Prompt Preview
|
|
goExport.export2frx([crslistare],[rap_nir_marfuri], , , , , , .T.)
|
|
Else
|
|
Private pcSemnaturi
|
|
Store '' To pcSemnaturi
|
|
param_listari('nir_rap_materiale',,@pcSemnaturi,.T.)
|
|
|
|
Select crslistare
|
|
*!* Report Form rap_nir_materiale.frx To Printer Prompt Preview
|
|
goExport.export2frx([crslistare],[rap_nir_materiale], , , , , , .T.)
|
|
Endif
|
|
Endif
|
|
Endif
|
|
Endif
|
|
|
|
If Used('tfacturi')
|
|
Use In tfacturi
|
|
Endif
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
If Used('crslistare')
|
|
Use In crslistare
|
|
Endif
|
|
If Used('crsdiscount')
|
|
Use In crsdiscount
|
|
Endif
|
|
|
|
Endproc && listare_nir_TOT
|
|
*--------------------------------------------------------------------
|
|
*!* Procedure listare_nir_MODEL1 && NU FACE BINE IN SITUATIA : MAI MULTE NIRURI PE ACELASI NR. FACTURA(ID_FACT#)
|
|
*!* Parameters tnNir,tnTip
|
|
|
|
*!* Private lnCod,pnNir,lnSuma1,lnSuma2,loact,pnTip,pnBazaDiscount,pnTvaDiscount,lcListaID
|
|
*!* Store "" To loact,lcListaID
|
|
*!* Store 0 To lnSuma1,lnSuma2,pnNir,pnBazaDiscount,pnTvaDiscount
|
|
*!* pnNir=tnNir
|
|
|
|
*!* If Empty(tnTip)
|
|
*!* pnTip = 0
|
|
*!* Else
|
|
*!* pnTip = tnTip
|
|
*!* Endif
|
|
|
|
*!* If Used('crsrul')
|
|
*!* Use In crsrul
|
|
*!* Endif
|
|
|
|
*!* lcSql=[select cod,nnir,dataact,codmat,denumire,um,pret,tva,cant,pretv,tvav,cante,cgest,proc_tva,proc_tvav,id_fact,id_gestiune,procent from ] + gcS + [.vrul where luna=?gnLuna and an=?gnAn and nnir=]+Alltrim(Str(pnNir))+[ and cant<>0 and cante=0 ] + ;
|
|
*!* [and id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag = ?pnTip)]
|
|
*!* lcCursor=[crsrul]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
|
|
*!* If lnSucces > 0
|
|
*!* If Reccount('crsrul')=0
|
|
*!* aMESSAGEBOX("Nu a fost inregistrat nici un NIR in luna curenta cu numarul "+Alltrim(Str(pnNir))+" !",0+48,"Atentie")
|
|
*!* lnSucces = -1
|
|
*!* Else
|
|
*!* Select Distinct id_fact From crsrul Into Cursor tfacturi
|
|
*!* Select tfacturi
|
|
*!* Scan
|
|
*!* lcListaID = lcListaID + [,] + Alltrim(Str(id_fact))
|
|
*!* Endscan
|
|
*!* lcListaID = Substr(lcListaID,2)
|
|
|
|
*!* If Used('crsireg')
|
|
*!* Use In crsireg
|
|
*!* Endif
|
|
|
|
*!* lcSql=[select fdoc,nract,dataireg,cont,nume,id_fact,sum(credit) as total_factura from ] + gcS + [.vireg_parteneri where SUBSTR(cont,1,2) = '40' and id_fact in (] + lcListaID + [) ] + ;
|
|
*!* [group by fdoc,nract,dataireg,cont,nume,id_fact]
|
|
*!* lcCursor=[crsireg]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
*!* Endif
|
|
*!* Endif
|
|
|
|
*!* If lnSucces > 0 And gnNir_standard = 0
|
|
*!* lcSql=[select sum(suma) as discount,sum(ROUND(suma*(proc_tva-1),?gnPc)) as tvaDiscount,id_fact from ] + gcS + [.vact where luna=?gnLuna and an=?gnAn and SUBSTR(scd,1,2) = '40' and SUBSTR(scc,1,3) = '767' and id_fact in (] + lcListaID + [) ] +;
|
|
*!* [ group by id_fact]
|
|
*!* lcCursor=[crsdiscount]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
*!* Endif
|
|
|
|
*!* If lnSucces > 0
|
|
*!* *!* Select crsireg
|
|
*!* *!* If Reccount("crsireg")>0
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
*!* If Used('crslistare')
|
|
*!* Use In crslistare
|
|
*!* Endif
|
|
*!* If Used('crsdiscount') && dc gnNir_standard = 0
|
|
*!* Select Alltrim(Str(a.nnir))+a.cgest As cnir_gest,a.*,b.fdoc,b.nract,b.dataireg,b.Cont,b.nume,b.total_factura, ;
|
|
*!* NVL(c.discount,000000000.0000) As discount, Nvl(c.tvaDiscount,000000000.0000) As tvaDiscount;
|
|
*!* FROM crsrul a ;
|
|
*!* LEFT Join crsireg b On b.id_fact=a.id_fact ;
|
|
*!* LEFT Join crsdiscount c On c.id_fact=a.id_fact ;
|
|
*!* INTO Cursor crslistare Order By 1
|
|
*!* Else
|
|
*!* Select Alltrim(Str(a.nnir))+a.cgest As cnir_gest,a.*,b.fdoc,b.nract,b.dataireg,b.Cont,b.nume,b.total_factura ;
|
|
*!* FROM crsrul a ;
|
|
*!* LEFT Join crsireg b On b.id_fact=a.id_fact ;
|
|
*!* INTO Cursor crslistare Order By 1
|
|
*!* Endif
|
|
|
|
*!* Select crslistare
|
|
*!* If gnNir_standard = 1 && este NIR standard
|
|
*!* Report Form rap_nir_standard.frx To Printer Prompt Preview
|
|
*!* Else
|
|
*!* If pnTip = 6
|
|
*!* Report Form rap_nir_marfuri.frx To Printer Prompt Preview
|
|
*!* Else
|
|
*!* Report Form rap_nir_materiale.frx To Printer Prompt Preview
|
|
*!* Endif
|
|
*!* Endif
|
|
*!* *!* Endif
|
|
*!* Endif
|
|
|
|
*!* If Used('crsireg')
|
|
*!* Use In crsireg
|
|
*!* Endif
|
|
*!* If Used('crsrul')
|
|
*!* Use In crsrul
|
|
*!* Endif
|
|
*!* If Used('crslistare')
|
|
*!* Use In crslistare
|
|
*!* Endif
|
|
*!* If Used('crsdiscount')
|
|
*!* Use In crsdiscount
|
|
*!* Endif
|
|
|
|
*!* Endproc && listare_nir
|
|
*!* *--------------------------------------------------------------------
|
|
*!* Procedure listare_nir_model2 && NU FACE BINE IN SITUATIA : MAI MULTE FACTURI PE ACEEASI NR NIR
|
|
*!* Parameters tnNir,tnTip
|
|
|
|
*!* Private lnCod,pnNir,lnSuma1,lnSuma2,loact,pnTip,pnBazaDiscount,pnTvaDiscount
|
|
*!* Store "" To loact
|
|
*!* Store 0 To lnSuma1,lnSuma2,pnNir,pnBazaDiscount,pnTvaDiscount
|
|
*!* pnNir=tnNir
|
|
|
|
*!* If Empty(tnTip)
|
|
*!* pnTip = 0
|
|
*!* Else
|
|
*!* pnTip = tnTip
|
|
*!* Endif
|
|
|
|
*!* If Used('crsrul')
|
|
*!* Use In crsrul
|
|
*!* Endif
|
|
|
|
*!* lcSql=[select cod,nnir,dataact,codmat,denumire,um,pret,tva,cant,pretv,tvav,cante,cgest,proc_tva,proc_tvav,id_fact,id_gestiune,procent from ] + gcS + [.vrul where luna=?gnLuna and an=?gnAn and nnir=]+Alltrim(Str(pnNir))+[ and cant<>0 and cante=0]
|
|
*!* lcCursor=[crsrul]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
|
|
*!* If lnSucces > 0
|
|
*!* If Reccount('crsrul')=0
|
|
*!* aMESSAGEBOX("Nu a fost inregistrat nici un NIR in luna curenta cu numarul "+Alltrim(Str(pnNir))+" !",0+48,"Atentie")
|
|
*!* lnSucces = -1
|
|
*!* Else
|
|
*!* Select crsrul
|
|
*!* lnCod=cod
|
|
*!* lnIdfact = id_fact
|
|
|
|
*!* If Used('crsireg')
|
|
*!* Use In crsireg
|
|
*!* Endif
|
|
|
|
*!* lcSql=[select fdoc,nract,dataireg,cont,acont,nume,id_fact from ] + gcS + [.vireg_parteneri where luna=?gnLuna and an=?gnAn and SUBSTR(cont,1,2) = '40' and id_fact=?lnIdFact ]
|
|
*!* lcCursor=[crsireg]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
*!* Endif
|
|
*!* Endif
|
|
|
|
|
|
*!* If lnSucces > 0 And gnNir_standard = 0
|
|
*!* lcSql=[select sum(suma) as discount, proc_tva from ] + gcS + [.vact where luna=?gnLuna and an=?gnAn and SUBSTR(scd,1,2) = '40' and SUBSTR(scc,1,3) = '767' and id_fact=?lnIdFact ] +;
|
|
*!* [ group by proc_tva]
|
|
*!* lcCursor=[crsdiscount]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Endif
|
|
*!* Endif
|
|
|
|
*!* If lnSucces > 0
|
|
*!* Select crsireg
|
|
*!* If Reccount("crsireg")>0
|
|
*!* *ptDataOra=get_ora()
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
*!* If Used('crsdiscount') && dc gnNir_standard = 0
|
|
*!* Select crsdiscount
|
|
*!* Sum discount To pnBazaDiscount
|
|
*!* Sum Round((discount*(proc_tva-1)),gnPc) To pnTvaDiscount
|
|
*!* Endif
|
|
|
|
*!* If Used('crslistare')
|
|
*!* Use In crslistare
|
|
*!* Endif
|
|
|
|
*!* Select Alltrim(Str(a.nnir))+a.cgest As cnir_gest,a.*,b.* From crsrul a Left Join crsireg b On b.id_fact=a.id_fact Where ;
|
|
*!* a.nnir = pnNir And a.cante=0 And a.cant!=0 Into Cursor crslistare Order By 1
|
|
|
|
*!* Select crslistare
|
|
*!* If gnNir_standard = 1 && este NIR standard
|
|
*!* Report Form rap_nir_standard.frx To Printer Prompt Preview
|
|
*!* Else
|
|
*!* If pnTip = 6
|
|
*!* Report Form rap_nir_marfuri.frx To Printer Prompt Preview
|
|
*!* Else
|
|
*!* Report Form rap_nir_materiale.frx To Printer Prompt Preview
|
|
*!* Endif
|
|
*!* Endif
|
|
*!* Endif
|
|
*!* Endif
|
|
|
|
*!* If Used('crsireg')
|
|
*!* Use In crsireg
|
|
*!* Endif
|
|
*!* If Used('crsrul')
|
|
*!* Use In crsrul
|
|
*!* Endif
|
|
*!* If Used('crslistare')
|
|
*!* Use In crslistare
|
|
*!* Endif
|
|
*!* If Used('crsdiscount')
|
|
*!* Use In crsdiscount
|
|
*!* Endif
|
|
|
|
*!* Endproc
|
|
|
|
|
|
*--------------------------
|
|
Procedure listare_descarcare_productie
|
|
Parameters tnNir, tnTip
|
|
|
|
Private pnNir, pnNr_pag, pcFelDoc
|
|
pnNir = tnNir
|
|
pnNr_pag = tnTip
|
|
pcFelDoc = 'Pv productie'
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
*!* lcSql=[select id_articol, pret, denumire, codmat, um, cont, SUM(cant) as cant, SUM(cante) as cante from vrul where luna=?gnLuna and an=?gnAn and nnir = ?pnNir and (SUBSTR(cont,1,3) = '301' or (SUBSTR(cont,1,3) = '371'))]+;
|
|
*!* [and id_gestiune in (select distinct id_gestiune from vnom_gestiuni where nr_pag = ?pnNr_pag) ] + ;
|
|
*!* [group by id_articol, pret, denumire, codmat, um, cont ]+;
|
|
*!* [ order by cont, denumire]
|
|
|
|
If !Empty(pnNr_pag)
|
|
&& or id_set = 268) -- adaugat pe 29mar2013 v2.2.7 - sa apara la descarcarea_productie si intrarea si iesirea mixului care e pe contul 345, nu numai a ingredientelor
|
|
lcCond = [ and ((SUBSTR(cont,1,3) = '301' or (SUBSTR(cont,1,3) = '371')) or id_set = 268)]
|
|
Else
|
|
lcCond = []
|
|
Endif
|
|
|
|
*!* lcSql=[select a.id_gestiune,a.nume_gestiune,a.id_articol,a.pret,a.denumire, a.codmat,a.um,a.cont,a.nnir, a.dataact,]+;
|
|
*!* [(case when b.lvl = 1 then a.cant else 0 end) as cant, (case when b.lvl = 1 then 0 else a.cante end) as cante,]+;
|
|
*!* [(case when b.lvl is null then 1 when b.lvl = 1 then 2 else 3 end) as ie ]+;
|
|
*!* [ from (select id_gestiune,id_articol,pret,cont,nnir,dataact, SUM(cant) as cant,SUM(cante) as cante,um,denumire,codmat,nume_gestiune from vrul where luna=?gnLuna and an=?gnAn and nnir = ?pnNir ]+;
|
|
*!* lcCond + gcCondSucursala + [ ] + ;
|
|
*!* [group by id_gestiune, id_articol, pret, cont, nnir, dataact,um,denumire,codmat,nume_gestiune) a left join (select level as lvl from dual connect by level < 3) b on a.cant <> 0 and a.cante <> 0 order by nume_gestiune, ie, denumire]
|
|
|
|
* Am luat in considerare si cazul in care productia aparea doar ca intrare, nu si ca iesire ca la productia de mix vopsea auto
|
|
TEXT TO lcSql NOSHOW
|
|
select id_gestiune,
|
|
nume_Gestiune,
|
|
id_articol,
|
|
pret,
|
|
denumire,
|
|
codmat,
|
|
um,
|
|
lot,
|
|
serie,
|
|
cont,
|
|
nnir,
|
|
dataact,
|
|
cant,
|
|
cante,
|
|
ie
|
|
from (select a.id_gestiune,
|
|
a.nume_gestiune,
|
|
a.id_articol,
|
|
a.pret,
|
|
a.denumire,
|
|
a.codmat,
|
|
a.um,
|
|
a.lot,
|
|
a.serie,
|
|
a.cont,
|
|
a.nnir,
|
|
a.dataact,
|
|
(case
|
|
when b.lvl = 1 then
|
|
a.cant
|
|
else
|
|
0
|
|
end) as cant,
|
|
(case
|
|
when b.lvl = 1 then
|
|
0
|
|
else
|
|
a.cante
|
|
end) as cante,
|
|
(case
|
|
when b.lvl is null then
|
|
1
|
|
when b.lvl = 1 then
|
|
2
|
|
else
|
|
3
|
|
end) as ie
|
|
from (select id_gestiune,
|
|
id_articol,
|
|
pret,
|
|
cont,
|
|
nnir,
|
|
dataact,
|
|
SUM(cant) as cant,
|
|
SUM(cante) as cante,
|
|
um,
|
|
lot,
|
|
serie,
|
|
denumire,
|
|
codmat,
|
|
nume_gestiune
|
|
from vrul
|
|
where luna= ?gnLuna and an= ?gnAn and nnir = ?pnNir
|
|
group by id_gestiune,
|
|
id_articol,
|
|
pret,
|
|
cont,
|
|
nnir,
|
|
dataact,
|
|
um,
|
|
lot,
|
|
serie,
|
|
denumire,
|
|
codmat,
|
|
nume_gestiune) a
|
|
left join (select level as lvl from dual connect by level < 3) b
|
|
on a.cant <> 0
|
|
order by nume_gestiune, ie, denumire)
|
|
where cant <> 0 or cante <> 0
|
|
ENDTEXT
|
|
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu a fost inregistrat nici un BON in luna curenta cu numarul "+Alltrim(Str(pnNir))+" !",0+48,"Atentie")
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
Return
|
|
Endif
|
|
|
|
goExport.export2frx([crsrul],[rap_descarcare_productie], , , , , , .T.)
|
|
|
|
Use In (SELECT('crsrul'))
|
|
Endproc && listare_descarcare_productie
|
|
*--------------------------
|
|
|
|
Procedure LISTARE_BON
|
|
Parameters tnNir, tnTip, tcListaIdSet
|
|
DO LISTARE_BON_TOT WITH tnNir, tnNir, tnTip, tcListaIdSet
|
|
ENDPROC
|
|
|
|
* FOMULAR CERERE DATE LISTARE BONURI IN LUCRU
|
|
* Trebuie facut un formular pentru completarea PERIOADA, NNIR1, NNIR2, GESTIUNE, LUCRARE
|
|
* Se apeleaza apoi LISTARE_BON_TOT
|
|
PROCEDURE LISTARE_INFO
|
|
pcNumeGestiune = Alltrim(Upper(locauta.nume_gestiune))
|
|
pnIdGest = Iif(pcNumeGestiune # "<TOATE INREGISTRARILE>", locauta.id_gestiune, -1)
|
|
|
|
Release locauta
|
|
|
|
If pnIdGest = -1
|
|
lcCond = [ and r.id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag = ?pnTip) and id_gestiune in ] + ;
|
|
[(select g.id_gestiune from ] + gcS + [.vgest_coresp_grupe_gestiuni g join ] + ;
|
|
gcS + [.vgest_coresp_util_grupe u on g.id_grupe = u.id_grupe and u.id_util = ?gnIdUtil) ]
|
|
Else
|
|
lcCond = [ and r.id_gestiune = ?pnIdGest ]
|
|
ENDIF
|
|
|
|
oper = Createobject('frm_perioada_luni')
|
|
oper._optiongrup1.Value=1
|
|
oper.Show(1)
|
|
Release oper
|
|
|
|
|
|
If Occurs('_',pcondper)>0
|
|
lpos = At('_',pcondper)
|
|
ldata1 = Substr(pcondper,1,lpos-1)
|
|
ldata2 = Substr(pcondper,lpos+1)
|
|
lcd1 = Substr(ldata1,1,2)+'.'+Substr(ldata1,3,4)
|
|
lcd2 = Substr(ldata2,1,2)+'.'+Substr(ldata2,3,4)
|
|
pcperioada='De la: '+lcd1+' pana la '+lcd2
|
|
Else
|
|
ldata1 = pcondper
|
|
pcperioada='LUNA: '+Substr(ldata1,1,2)+'.'+Substr(ldata1,3,4)
|
|
ldata2 = ldata1
|
|
Endif
|
|
lnLuna1 = Val(Substr(ldata1,1,2))
|
|
lnAn1 = Val(Substr(ldata1,3,4))
|
|
lnLuna2 = Val(Substr(ldata2,1,2))
|
|
lnAn2 = Val(Substr(ldata2,3,4))
|
|
|
|
*pcselect = ['select * from ] + gcS + [.vLucrari_validat where 2=2']
|
|
pcselect = [select * from vnom_Lucrari]
|
|
pcfiltru = [1=2]
|
|
pcschema = []
|
|
pcorder = [nrord]
|
|
pccoloane = [nrord]
|
|
pcTitlu = [Lucrare/Comanda]
|
|
*pcFiltruOriginal = [validat = 0 and inactiv = 0]
|
|
pcFiltruOriginal = []
|
|
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitlu,'',.T.,pcFiltruOriginal) && 11.07.2007
|
|
|
|
If Empty(locauta.id_lucrare) And Empty(locauta.nrord)
|
|
Return
|
|
Endif
|
|
|
|
lnIdLucrare = locauta.id_lucrare
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
lnInf = lnLuna1+ 12*lnAn1
|
|
lnSup = lnLuna2+ 12*lnAn2
|
|
|
|
ENDPROC
|
|
|
|
Procedure LISTARE_BON_TOT
|
|
*!* modificare ROADEVIZE 24.10.2013 : tcListaIdSet
|
|
Parameters tnNir1, tnNir2, tnTip, tcListaIdSet, tnIdGestiune, tnIdLucrare
|
|
|
|
LOCAL llCasareObiecteNoi
|
|
Private lnCod,pnNir1,pnNir2,lnSuma1,lnSuma2,loact,pnTip
|
|
Store "" To loact
|
|
Store 0 To lnSuma1,lnSuma2,pnNir1, pnNir2
|
|
pnNir1 = tnNir1
|
|
pnNir2 = tnNir2
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
* Listare BON CASARE obiecte inventar noi, din RUL in loc de RUL_OBINV
|
|
llCasareObiecteNoi = !EMPTY(m.tcListaIdSet) and TYPE('tcListaIdSet') = 'C' and m.tcListaIdSet = '72'
|
|
|
|
*!* modificare 03.10.2007
|
|
Do Case
|
|
Case Empty(tnTip)
|
|
lcCondTipGest = " " && bon de consum cu inventar
|
|
Case tnTip = 6
|
|
lcCondTipGest = " where nr_pag = ?pnTip "
|
|
Otherwise
|
|
lcCondTipGest = " where nr_pag <> 6 "
|
|
ENDCASE
|
|
*!* modificare 29.03.2013 v 2.2.7: id_set <> 268 in lcCondTipGest - sa nu se listeze bonurile importate din xml cu productia de vopsea pentru ca n-ar fi corect sa apara produsul final pe bon
|
|
|
|
lcCondIdSet = " and r.id_set <> 268 "
|
|
*!* modificare ROADEVIZE 24.10.2013
|
|
If !Empty(tcListaIdSet)
|
|
lcCondIdSet = lcCondIdSet + " and r.id_set in (" + tcListaIdSet + ")"
|
|
Endif
|
|
*!* modificare ROADEVIZE 24.10.2013 ^
|
|
*!* If !Empty(tnTip)
|
|
*!* lcCondTipGest = " where nr_pag = ?pnTip "
|
|
*!* Else
|
|
*!* lcCondTipGest = "" && bon de consum cu inventar
|
|
*!* Endif
|
|
*!* modificare 03.10.2007 ^
|
|
|
|
*!* 27.08.2009
|
|
|
|
|
|
IF tnTip = 3 AND !m.llCasareObiecteNoi && obiecte de inventar in folosinta
|
|
*!* modificare v 2.2.4 : am pus select max(marca)... in loc de sal_personal.marca pentru ca s-ar putea sa am un salariat de mai multe ori in sal_personal
|
|
* id_set = 274 = iesire din folosinta si inregistrare cheltuiala, apare o iesire in rul_obinv.cante <> 0
|
|
* id_set = 55 = bon consum si dare in folosinta, apare o iesire in rul si o intrare in rul_obinv.cant <> 0
|
|
*!* lcSql=[select r.*,(select max(marca) from sal_personal where id_part = r.id_responsabil and id_salariat in ] + ;
|
|
*!* [(select id_persoana from sal_stat where an =?gnAn and luna = ?gnLuna and sters = 0)) as marca from vrul_obinv r ]+;
|
|
*!* [ where r.an=] + ALLTRIM(STR(gnAn)) + [ and r.luna=] + ALLTRIM(STR(gnLuna)) + [ and r.nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + ;
|
|
*!* [ and r.cant <> 0 and r.cante = 0 and r.id_tip_rulaj <> 3]+;
|
|
*!* STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
*!* [and r.id_gestiune in (select distinct id_gestiune from vnom_gestiuni ]+ lcCondTipGest + [)] + lcCondIdSet +;
|
|
*!* [order by r.nnir, r.cgest, r.nrord, r.nresp, r.sectie, r.id_rul_obinv]
|
|
*!* modificare 21.06 : am adaugat id_rul la order by
|
|
|
|
TEXT TO lcSql TEXTMERGE NOSHOW
|
|
select r.*,
|
|
(select max(p.marca)
|
|
from sal_personal p join sal_stat s on (p.id_salariat = s.id_persoana)
|
|
where p.id_part = r.id_responsabil
|
|
and s.an= <<m.gnAn>> and s.luna = <<m.gnLuna>> and s.sters = 0) as marca,
|
|
(select max(f.denumire)
|
|
from sal_personal p join sal_stat s on (p.id_salariat = s.id_persoana)
|
|
left join sal_nom_formatii f on s.id_formatie = f.id_formatia
|
|
where p.id_part = r.id_responsabil
|
|
and s.an= <<m.gnAn>> and s.luna = <<m.gnLuna>> and s.sters = 0) as formatie
|
|
from vrul_obinv r
|
|
where r.an = <<m.gnAn>>
|
|
and r.luna = <<m.gnLuna>>
|
|
and r.nnir between <<m.pnNir1>> and <<m.pnNir2>>
|
|
and r.cant <> 0 and r.cante = 0 and r.id_tip_rulaj <> 3
|
|
<<STRTRAN(m.gcCondSucursala,[id_sucursala],[r.id_sucursala])>>
|
|
and r.id_gestiune in (select distinct id_gestiune from vnom_gestiuni <<m.lcCondTipGest>>)
|
|
<<m.lcCondIdSet>>
|
|
order by r.nnir, r.cgest, r.nrord, r.nresp, r.sectie, r.id_rul_obinv
|
|
ENDTEXT
|
|
ELSE
|
|
*!* modificare v 2.2.4 : am pus select max(marca)... in loc de sal_personal.marca pentru ca s-ar putea sa am un salariat de mai multe ori in sal_personal
|
|
*!* lcSql=[select r.*,(select max(marca) from sal_personal where id_part = r.id_responsabil and id_salariat in ] + ;
|
|
*!* [(select id_persoana from sal_stat where an =?gnAn and luna = ?gnLuna and sters = 0)) as marca from vrul r ]+;
|
|
*!* [ where r.an=] + ALLTRIM(STR(gnAn)) + [ and r.luna=] + ALLTRIM(STR(gnLuna)) + [ and r.nnir between ] + ALLTRIM(STR(pnNir1)) + [ and ] + ALLTRIM(STR(pnNir2)) + ;
|
|
*!* [ and r.cant=0 and r.cante<>0 and r.id_tip_rulaj <> 3]+;
|
|
*!* STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
*!* [and r.id_gestiune in (select distinct id_gestiune from vnom_gestiuni ]+ lcCondTipGest + [)] + lcCondIdSet +;
|
|
*!* [order by r.nnir, r.cgest, r.nrord, r.nresp, r.sectie, r.id_rul]
|
|
*!* modificare 21.06 : am adaugat id_rul la order by
|
|
TEXT TO lcSql TEXTMERGE NOSHOW
|
|
select r.*,
|
|
(select max(p.marca)
|
|
from sal_personal p join sal_stat s on (p.id_salariat = s.id_persoana)
|
|
where p.id_part = r.id_responsabil
|
|
and s.an= <<m.gnAn>> and s.luna = <<m.gnLuna>> and s.sters = 0) as marca,
|
|
(select max(f.denumire)
|
|
from sal_personal p join sal_stat s on (p.id_salariat = s.id_persoana)
|
|
left join sal_nom_formatii f on s.id_formatie = f.id_formatia
|
|
where p.id_part = r.id_responsabil
|
|
and s.an= <<m.gnAn>> and s.luna = <<m.gnLuna>> and s.sters = 0) as formatie
|
|
from vrul r
|
|
where r.an = <<m.gnAn>>
|
|
and r.luna = <<m.gnLuna>>
|
|
and r.nnir between <<m.pnNir1>> and <<m.pnNir2>>
|
|
and r.cant = 0 and r.cante <> 0 and r.id_tip_rulaj <> 3
|
|
<<STRTRAN(m.gcCondSucursala,[id_sucursala],[r.id_sucursala])>>
|
|
and r.id_gestiune in (select distinct id_gestiune from vnom_gestiuni <<m.lcCondTipGest>>)
|
|
<<m.lcCondIdSet>>
|
|
order by r.nnir, r.cgest, r.nrord, r.nresp, r.sectie, r.id_rul
|
|
ENDTEXT
|
|
|
|
ENDIF && tnTip = 3
|
|
*!* 27.08.2009 ^
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu a fost inregistrat nici un BON in luna curenta cu numere intre " +Alltrim(Str(m.pnNir1))+ " si " + +Alltrim(Str(m.pnNir2))+ " !",0+48,"Atentie")
|
|
Use In crsrul
|
|
Return
|
|
Endif
|
|
|
|
*ptDataOra=get_ora()
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
Private pcSemnaturi
|
|
Store '' To pcSemnaturi
|
|
param_listari('rap_bon_achi',,@pcSemnaturi,.T.)
|
|
|
|
Select crsrul
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 : goExport
|
|
If pnTip = 5 && marfa la pret de achizitie
|
|
If Type("gnList_bon_marfa") = "U"
|
|
*!* Report Form rap_bon_vanz To Printer Prompt Preview
|
|
lcRaport = [rap_bon_vanz]
|
|
Else
|
|
Do Case
|
|
Case gnList_bon_marfa = 0
|
|
*!* Report Form rap_bon_achi To Printer Prompt Preview
|
|
lcRaport = [rap_bon_achi]
|
|
Case gnList_bon_marfa = 1
|
|
*!* Report Form rap_bon_vanz To Printer Prompt Preview
|
|
lcRaport = [rap_bon_vanz]
|
|
Case gnList_bon_marfa = 2
|
|
*!* Report Form rap_bon_achi_vanz To Printer Prompt Preview
|
|
lcRaport = [rap_bon_achi_vanz]
|
|
Otherwise
|
|
*!* Report Form rap_bon_vanz To Printer Prompt Preview
|
|
lcRaport = [rap_bon_vanz]
|
|
Endcase
|
|
Endif
|
|
Else
|
|
*!* Report Form rap_bon_achi To Printer Prompt Preview
|
|
*!* 27.08.2009
|
|
|
|
IF tnTip = 3 AND !m.llCasareObiecteNoi && obiecte de inventar
|
|
lcRaport = [rap_bon_achi_inv]
|
|
ELSE
|
|
lcRaport = [rap_bon_achi]
|
|
ENDIF
|
|
*!* 27.08.2009 ^
|
|
Endif
|
|
|
|
IF TYPE('goExport') = 'O'
|
|
*goExport.export2frx([crsrul],lcRaport)
|
|
goExport.export2frx([crsrul],lcRaport, , , , , , .T.)
|
|
ELSE
|
|
Report Form (lcRaport) To Printer Prompt Preview
|
|
ENDIF
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
Endproc && LISTARE_BON
|
|
|
|
|
|
*------------------------------------------------------------------
|
|
*!* 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 LISTARE_TRANSFER
|
|
Parameters tnNir,tnTip, tcRul
|
|
|
|
Private lnCod,pnNir,lnSuma1,lnSuma2,pnTip,pcGestout
|
|
Store "" To pcGestout
|
|
Store 0 To lnSuma1,lnSuma2,pnNir
|
|
pnNir = tnNir
|
|
|
|
Local lcRul
|
|
If Empty(tcRul) Or Type('tcRul') # 'C' Or Pcount() < 3
|
|
lcRul = 'vrul'
|
|
Else
|
|
lcRul = Alltrim(tcRul)
|
|
Endif
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
*!* lcSql=[select distinct r.*, a.nract, a.gestin, a.id_gestin from ] + gcS + [.] + lcRul + [ r left join ] + gcS +[.vact a on r.cod=a.cod and a.luna=r.luna and a.an=r.an and a.id_gestin is not null ] + ;
|
|
*!* [where r.luna=?gnLuna and r.an=?gnAn and r.nnir = ?pnNir and r.cant=0 and r.cante<>0 order by r.nnir, r.cgest, r.sectie, r.nrord, r.nresp, r.cgestc, r.nrespc]
|
|
Do Case
|
|
Case pnTip = 7
|
|
*!* lcSql = [select cod,nnir,dataact,cgest,nume_gestiune,cgestc,nume_gestiunec,nresp,nrespc,denumire,codmat,um,max(decode(cante, 0, 0, cante)) as cante,] + ;
|
|
*!* [max(decode(cante, 0, 0, pret)) as pret,max(decode(cant, 0, 0, pret)) as pret_nou,id_articol,id_gestiune,] + ;
|
|
*!* [id_responsabil, cont from ] + gcS + [.vrul where luna = ?gnLuna and an = ?gnAn and nnir = ?pnNir ] + ;
|
|
*!* [group by id_articol, id_gestiune, id_responsabil, cont, cod, nnir, dataact, cgest, nume_gestiune,] + ;
|
|
*!* [cgestc,nume_gestiunec, nresp, nrespc,] + ;
|
|
*!* [denumire, codmat, um order by nnir,cgest,nresp]
|
|
lcSql = [select a.cod, a.nnir, a.dataact, a.cgest, a.serie, a.lot, a.nume_gestiune, a.cgestc, a.nume_gestiunec, a.nresp, a.resp_marca, ] + ;
|
|
[a.nrespc, a.respc_marca, a.denumire, a.codmat, a.um, a.cante, a.pret, b.pret as pret_nou, a.id_articol, a.id_Gestiune, ] + ;
|
|
[a.id_responsabil, a.cont, a.id_rul from ] + gcS + [.vrul a ] + ;
|
|
[left join rul b on a.cod = b.cod and a.id_articol = b.id_articol ] + ;
|
|
[and a.id_gestiune = b.id_gestiunec and a.id_gestiunec = b.id_gestiune and a.cante = b.cant ] + ;
|
|
[and Nvl(a.id_rul_aux,-99) = Nvl(b.id_rul_aux,-99) ] + ;
|
|
[and NVL(a.id_sucursala,-99) = NVL(b.id_sucursala,-99) ] + ;
|
|
[where a.luna = ] + ALLTRIM(STR(gnLuna)) + [ and a.an = ] + ALLTRIM(STR(gnAn)) + [ and a.nnir = ] + ALLTRIM(STR(pnNir)) + [ and a.cante <> 0 ] + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[a.id_sucursala]) + [ ] + ;
|
|
[order by a.nnir, a.cgest, a.nresp, a.id_rul]
|
|
*!* modificare migrare v 1.0 > v 2.0
|
|
Case pnTip = 8
|
|
lcSql=[select distinct r.*, a.nract, p.cod_fiscal, p.reg_comert, p.adresa from ] + ;
|
|
lcRul + [ r left join act a on r.cod=a.cod and a.luna=r.luna and a.an=r.an ] + ;
|
|
[ left join vnom_parteneri p on p.id_part = r.id_part_rez ] + ;
|
|
[where r.luna=?gnLuna and r.an=?gnAn and r.nnir = ?pnNir and r.cant<>0 and r.cante=0 ] + ;
|
|
[and r.id_set = 229 ] + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
[order by r.nnir, r.cgest, r.sectie, r.nrord, r.nresp, r.cgestc, r.nrespc, r.id_rul]+;
|
|
IIF('obinv'$Lower(lcRul), '_obinv', '')
|
|
*!* modificare migrare v 1.0 > v 2.0 ^
|
|
*!* 27.08.2009
|
|
CASE pnTip = 10 && transfer ob inv in folosinta - durata
|
|
*!* as fi vrut doar transferurile de ob inv in folosinta cu durata ramasa
|
|
**! trebuie sa iau de pe linia cu intrarile noua durata ramasa, nu de pe iesiri
|
|
lcSql=[select distinct r.*, a.nract from ] + lcRul + [ r left join ] + gcS +[.act a on r.cod=a.cod ] + ;
|
|
[and a.luna=r.luna and a.an=r.an and NVL(r.id_sucursala,-99) = NVL(a.id_sucursala,-99) ] + ;
|
|
[where r.luna=] + ALLTRIM(STR(gnLuna)) + [ and r.an=] + ALLTRIM(STR(gnAn)) + [ and r.nnir = ] + ALLTRIM(STR(pnNir)) + [ and r.cante=0 and r.cant<>0 and r.id_set<>229 ] + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
[order by r.nnir, r.cgest, r.sectie, r.nrord, r.nresp, r.cgestc, r.nrespc, r.id_rul]+;
|
|
IIF('obinv'$Lower(lcRul), '_obinv', '')
|
|
*!* 27.08.2009 ^
|
|
OTHERWISE
|
|
lcSql=[select distinct r.*, a.nract from ] + lcRul + [ r left join ] + gcS +[.act a on r.cod=a.cod ] + ;
|
|
[and a.luna=r.luna and a.an=r.an and NVL(r.id_sucursala,-99) = NVL(a.id_sucursala,-99) ] + ;
|
|
[where r.luna=] + ALLTRIM(STR(gnLuna)) + [ and r.an=] + ALLTRIM(STR(gnAn)) + [ and r.nnir = ] + ALLTRIM(STR(pnNir)) + [ and r.cant=0 and r.cante<>0 and r.id_set<>229 ] + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
[order by r.nnir, r.cgest, r.sectie, r.nrord, r.nresp, r.cgestc, r.nrespc, r.id_rul]+;
|
|
IIF('obinv'$Lower(lcRul), '_obinv', '')
|
|
|
|
ENDCASE
|
|
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu a fost inregistrata nici o nota de transfer in luna curenta cu numarul "+Alltrim(Str(pnNir))+" !",0+48,"Atentie")
|
|
Use In crsrul
|
|
Return
|
|
Endif
|
|
|
|
|
|
*!* SELECT DISTINCT id_gestiune, nume_gestiune FROM crsrul INTO CURSOR crs_gest_out
|
|
*!* SELECT crs_gest_out
|
|
*!* SCAN
|
|
*!* pcGestout = pcGestout + ',' + ALLTRIM(nume_gestiune)
|
|
*!* ENDSCAN
|
|
*!* USE IN crs_gest_out
|
|
|
|
*!* pcGestout = SUBSTR(pcGestout,2)
|
|
*ptDataOra=get_ora()
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 : goExport
|
|
*!* pcDataOra = get_ora(2)
|
|
Select crsrul
|
|
Do Case
|
|
Case pnTip = 7
|
|
Private pcgestc, pcnume_gestiunec
|
|
Select crsrul
|
|
pcgestc = cgestc
|
|
pcnume_gestiunec = nume_gestiunec
|
|
*!* Report Form rap_dif_pret To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_dif_pret])
|
|
Release pcgestc, pcnume_gestiunec
|
|
*!* *!* modificare migrare v 1.0 > v 2.0
|
|
Case pnTip = 8
|
|
* partener/lucrare rezervare
|
|
Private pcPartRez, pcNrOrdRez, pcPartNrordRez, pcPartNrordRezC
|
|
Select crsrul
|
|
pcPartRez = Alltrim(Nvl(part_rez,[]))
|
|
pcNrOrdRez = Alltrim(Nvl(nrord_rez,[]))
|
|
pcPartNrordRez = ALLTRIM(nvl(part_rez,'')) + ;
|
|
iif(!empty(alltrim(nvl(nrord_rez,''))), iif(!empty(nvl(part_rez,'')), ' / ', '') + ALLTRIM(nrord_rez), '') + ;
|
|
IIF(!EMPTY(NVL(cod_fiscal, '')), ', CUI: ' + ALLTRIM(cod_fiscal) + IIF(!EMPTY(NVL(reg_comert, '')), ', Reg. Com.: ' + ALLTRIM(reg_comert), ''), '') + ;
|
|
iif(!empty(nvl(adresa,'')), CHR(13) + CHR(10) + 'Adresa: ' + alltrim(adresa), '')
|
|
|
|
pcPartNrordRezC = ''
|
|
SET STEP ON
|
|
* articolele se transfera la un singur partener/lucrare, dar pot proveni de la mai multi parteneri/lucrari rezervate
|
|
* fac o lista partener/lucrare rezervare corespondenti
|
|
IF !EMPTY(NVL(crsRul.cod,0))
|
|
lcSql=[select distinct part_rez, nrord_rez from ] + lcRul + ;
|
|
[ where luna=?gnLuna and an=?gnAn and cod = ] + ALLTRIM(STR(crsrul.cod)) + [ and nnir = ?pnNir and cant=0 and cante<>0 ] + ;
|
|
[ and id_set = 229 ] + m.gcCondSucursala
|
|
|
|
llSucces = goExecutor.oexecuta(lcSql,"crsRulC")
|
|
If m.llSucces
|
|
SELECT crsRulC
|
|
SCAN
|
|
lcPartRezC = ALLTRIM(NVL(part_rez, ''))
|
|
lcNrordRezC = ALLTRIM(NVL(nrord_rez, ''))
|
|
pcPartNrordRezC = m.pcPartNrordRezC + IIF(RECNO() > 1, ', ', '') + m.lcPartRezC + ;
|
|
IIF(!EMPTY(m.lcNrordRezC), IIF(!EMPTY(m.lcPartRezC), '/', '') + m.lcNrordRezC, '')
|
|
ENDSCAN
|
|
USE IN (SELECT('crsRulC'))
|
|
ENDIF
|
|
ENDIF
|
|
|
|
Select crsrul
|
|
*!* Report Form rap_nirrezervare To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_nirrezervare], , , , , , .T.)
|
|
|
|
Release pcPartRez,pcNrOrdRez,pcPartNrordRez,pcPartNrordRezC, pnIdSet
|
|
*!* *!* modificare migrare v 1.0 > v 2.0 ^
|
|
*!* 27.08.2009
|
|
Case pnTip = 10 && obiecte de inventar in folosinta - durata
|
|
goExport.export2frx([crsrul],[rap_nirtransfer_achi2_durata], , , , , , .T.)
|
|
*!* 27.08.2009 ^
|
|
Case pnTip # 6
|
|
*!* Report Form rap_nirtransfer_achi2 To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_nirtransfer_achi2], , , , , , .T.)
|
|
Otherwise
|
|
*!* Report Form rap_nirtransfer_vanz To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_nirtransfer_vanz], , , , , , .T.)
|
|
Endcase
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
Endproc
|
|
|
|
*-------------------------------------------------------
|
|
|
|
Procedure LISTARE_RETUR
|
|
Parameters tnNir,tnTip
|
|
|
|
Private lnCod,pnNir,lnSuma1,lnSuma2,pnTip,pcGestout,pcNrord
|
|
Store "" To pcGestout,pcNrord
|
|
Store 0 To lnSuma1,lnSuma2,pnNir
|
|
pnNir = tnNir
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
*!* modificare v 2.4.4 : am pus select max(marca) ... in loc de sal_personal.marca
|
|
lcSql=[select distinct r.cod,r.id_articol,r.denumire,r.codmat,r.um,r.dataact,r.pret,r.pretv,-r.cante as cante,]+;
|
|
[r.id_lucrare,r.nrord,r.id_gestiune,r.nume_gestiune,r.serie,r.lot,r.cgest,r.nnir,a.nract,r.serie_act,r.nresp,] + ;
|
|
[(select max(marca) from sal_personal where id_part = r.id_responsabil and id_salariat in ] + ;
|
|
[(select id_persoana from sal_stat where an =?gnAn and luna = ?gnLuna and sters = 0)) as marca, r.id_rul from vrul r ]+;
|
|
[ left join act a on a.sters=0 and r.cod=a.cod and a.luna=r.luna and a.an=r.an ] + ;
|
|
[where r.luna=?gnLuna and r.an=?gnAn and r.nnir = ?pnNir and r.cant=0 and r.cante<>0] + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] + ;
|
|
[order by r.nnir,r.cgest,r.nrord,r.id_rul]
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu a fost emisa nota cu numarul "+Alltrim(Str(pnNir))+" in luna curenta!",0+48,"Atentie")
|
|
Use In crsrul
|
|
Return
|
|
Endif
|
|
|
|
Select Distinct id_gestiune, nume_gestiune, nrord From crsrul Into Cursor crs_gest_out
|
|
Select crs_gest_out
|
|
Scan
|
|
pcGestout = pcGestout + ',' + Alltrim(nume_gestiune)
|
|
pcNrord = pcNrord + ',' + Alltrim(nrord)
|
|
Endscan
|
|
Use In crs_gest_out
|
|
|
|
pcGestout = Substr(pcGestout,2)
|
|
pcNrord = Substr(pcNrord,2)
|
|
*ptDataOra=get_ora()
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
Private pcSemnaturi
|
|
Store '' To pcSemnaturi
|
|
|
|
Select crsrul
|
|
If pnTip # 6
|
|
param_listari('rap_retur_achi',,@pcSemnaturi,.T.)
|
|
Select crsrul
|
|
*!* Report Form rap_retur_achi To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_retur_achi], , , , , , .T.)
|
|
Else
|
|
*!* Report Form rap_retur_vanz To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_retur_vanz], , , , , , .T.)
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
Return
|
|
ENDPROC && listare_retur
|
|
*-------------------------------------------------------
|
|
|
|
*!* Procedure listare_facturi
|
|
*!* Parameters tcSerieAct,tnNract
|
|
|
|
*!* *!* && object goFirma
|
|
|
|
*!* lcSql = [Select distinct cod, serie_act, nract,id_fact,id_partd,dataact from ] + gcS + [.vact ] + ;
|
|
*!* [where an = ?gnAn and luna = ?gnLuna and nract = ?tnNract and NVL(serie_act,'+_') = NVL(?tcSerieAct,'+_') ] + ;
|
|
*!* [and scd = '4111']
|
|
*!* lcCursor=[crsact]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Return
|
|
*!* Endif
|
|
|
|
*!* Select crsact
|
|
*!* Scatter Name oAct
|
|
*!* lnIdPart = oAct.id_partd
|
|
*!* lnIdfact = oAct.id_fact
|
|
*!* lnCod = oAct.cod
|
|
*!* pdDataact = Ttod(oAct.dataact)
|
|
|
|
*!* lcSql = [Select * from ] + gcS + [.vnom_parteneri where id_part = ?lnIdPart ]
|
|
*!* lcCursor=[crspart]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Return
|
|
*!* Endif
|
|
|
|
*!* Select crspart
|
|
*!* Scatter Name opart
|
|
|
|
*!* lcSql = [Select * from ] + gcS + [.vrul where an = ?gnAn and luna = ?gnLuna and id_fact=?lnIdFact and cod=?lnCod and cante<>0]
|
|
*!* lcCursor=[crsrul]
|
|
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
|
*!* If lnSucces < 0
|
|
*!* aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
|
|
*!* Return
|
|
*!* Endif
|
|
|
|
*!* Store [] To pcdelegat, pcbi, pceliberatde, pcnrinmat
|
|
*!* Do Form DATEFACT
|
|
*!* *!* sele optiuni
|
|
*!* *!* loca for optiune='FORMAT A4'
|
|
*!* llA4 = .T.
|
|
|
|
*!* *ptDataOra=get_ora()
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
*!* Select crsrul
|
|
|
|
*!* If llA4
|
|
*!* Report Form rap_FACTURI_vanzari_A4 To Printer Prompt Preview
|
|
*!* Else
|
|
*!* Report Form rap_FACTURI_vanzari_A5 To Printer Prompt Preview
|
|
*!* Endif
|
|
|
|
*!* If Used('crsact')
|
|
*!* Use In crsact
|
|
*!* Endif
|
|
*!* If Used('crsrul')
|
|
*!* Use In crsrul
|
|
*!* Endif
|
|
*!* If Used('crspart')
|
|
*!* Use In crspart
|
|
*!* Endif
|
|
|
|
*!* Endproc && listare_facuri
|
|
*****************************************************************************************
|
|
|
|
Procedure fisa_magazie_FIFO_vechi
|
|
Parameters tcod,tfis1,tfis2,tdata1,tdata2
|
|
|
|
lcod=Alltrim(tcod)
|
|
ldata1 = Alltrim(tdata1)
|
|
If !Empty(tdata2)
|
|
ldata2 = Alltrim(tdata2)
|
|
Else
|
|
ldata2 = ldata1
|
|
Endif
|
|
|
|
If Used('fisa_stoc')
|
|
Use In fisa_stoc
|
|
Endif
|
|
Create Cursor fisa_stoc (ldata d,nrdoc c(15),cantin N(12,3),pretin N(12,3),valin N(14,2),;
|
|
cantout N(12,3),pretout N(12,3),valout N(14,2),cantf N(12,3),pretf N(12,3),valf N(14,2),idf N(3))
|
|
|
|
&& -----------------------&tfis1 = stocul
|
|
|
|
lcSql = [select cants as cantf,pret as pretf,cants*.pret as valf,datain from ] + gcS + [.]+tfis1+[ where id_articol=]+lcod+[ order by datain]
|
|
lcCursor = [cstoc]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
goExecutor.oReset()
|
|
|
|
If lnSucces > 0
|
|
Select cstoc
|
|
Delete All For cantf=0
|
|
|
|
Select fisa_stoc
|
|
Append From Dbf('CSTOC') For !Deleted()
|
|
Select fisa_stoc
|
|
|
|
Go Top
|
|
If Eof()
|
|
Append Blank
|
|
Endif
|
|
|
|
Sum cantf To lnCantf
|
|
Sum valf To lnValf
|
|
|
|
Go Top
|
|
Replace cantin With lnCantf, valin With lnValf,nrdoc With 'Stoc initial'
|
|
Replace All idf With 1
|
|
If lnCantf#0
|
|
Replace pretin With lnValf/lnCantf
|
|
Endif
|
|
&&----------------------&tfis2 = rulajele
|
|
|
|
lcSql = [select * from ] + gcS + [.] + tfis2 + [ where id_articol=]+lcod+;
|
|
[ and trunc(dataact) between to_date(']+ldata1+[','YYYY-MM-DD') AND TO_DATE(']+ldata2+[','YYYY-MM-DD')]+;
|
|
[ order by dataact]
|
|
lcCursor = [trulaj]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
goExecutor.oReset()
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
Select trulaj
|
|
Scan
|
|
Scatter Name xrul
|
|
|
|
Select fisa_stoc
|
|
Calculate Max(idf) To lnMax
|
|
lnMax=lnMax+1
|
|
Append From Dbf('cstoc') For !Deleted()
|
|
Replace All idf With lnMax For Empty(idf)
|
|
|
|
Do Case
|
|
Case xrul.cant#0 &&AND !INLIST(xrul.pret,&lista)
|
|
Locate For pretf=xrul.Pret And idf=lnMax
|
|
If !Found()
|
|
Select fisa_stoc
|
|
Append Blank
|
|
Replace cantin With xrul.cant,pretin With xrul.Pret,valin With xrul.cant*xrul.Pret
|
|
Replace cantf With xrul.cant,pretf With xrul.Pret,valf With xrul.cant*xrul.Pret
|
|
Replace idf With lnMax,ldata With xrul.datain,nrdoc With xrul.nnir
|
|
|
|
Select cstoc
|
|
Append Blank
|
|
Replace cantf With xrul.cant,pretf With xrul.Pret,valf With xrul.cant*xrul.Pret
|
|
Else
|
|
Replace cantin With xrul.cant,pretin With xrul.Pret,valin With xrul.cant*xrul.Pret
|
|
Replace cantf With cantf+cantin,valf With valf+valin
|
|
Replace ldata With xrul.datain,nrdoc With xrul.nnir
|
|
|
|
Select cstoc
|
|
Locate For pretf=xrul.Pret
|
|
Replace cantf With cantf+xrul.cant,valf With valf+xrul.cant*xrul.Pret
|
|
Endif
|
|
Case xrul.cante#0
|
|
Select fisa_stoc
|
|
Locate For pretf=xrul.Pret And idf=lnMax
|
|
If !Found()
|
|
*DO mesaj WITH 'Stoc negativ',''
|
|
Append Blank
|
|
Replace idf With lnMax
|
|
Endif
|
|
|
|
Replace cantout With xrul.cante,pretout With xrul.Pret,valout With xrul.cante*xrul.Pret
|
|
Replace cantf With cantf-cantout,pretf With xrul.Pret,valf With valf-valout
|
|
Replace ldata With xrul.dataout,nrdoc With xrul.nnir
|
|
|
|
Select cstoc
|
|
Locate For pretf=xrul.Pret
|
|
If !Found()
|
|
*DO mesaj WITH 'Stoc negativ',''
|
|
Append Blank
|
|
Endif
|
|
Replace cantf With cantf-xrul.cante,pretf With xrul.Pret,valf With valf-xrul.cante*xrul.Pret
|
|
|
|
Endcase
|
|
Select cstoc
|
|
Delete All For cantf=0
|
|
Release xrul
|
|
Select trulaj
|
|
Endscan
|
|
Endif
|
|
If Used('trulaj')
|
|
Use In trulaj
|
|
Endif
|
|
If Used('cstoc')
|
|
Use In cstoc
|
|
Endif
|
|
|
|
Endproc &&fisa_magazie_FIFO
|
|
|
|
*-----------------------------------------------------------------
|
|
|
|
Procedure list_bon_pe_lucrare
|
|
Parameters tnTip
|
|
|
|
Private lnCod,lnIdLucrare,lnSuma1,lnSuma2,loact,pnTip,lnLuna1,lnLuna2,lnAn1,lnAn2,pcondper,lnInf ,lnSup,lcCondIdSet
|
|
Store "" To loact,pcondper
|
|
Store 0 To lnSuma1,lnSuma2,lnIdLucrare,lnInf,lnSup
|
|
|
|
oper = Createobject('frm_perioada_luni')
|
|
oper._optiongrup1.Value=1
|
|
oper.Show(1)
|
|
Release oper
|
|
|
|
|
|
If Occurs('_',pcondper)>0
|
|
lpos = At('_',pcondper)
|
|
ldata1 = Substr(pcondper,1,lpos-1)
|
|
ldata2 = Substr(pcondper,lpos+1)
|
|
lcd1 = Substr(ldata1,1,2)+'.'+Substr(ldata1,3,4)
|
|
lcd2 = Substr(ldata2,1,2)+'.'+Substr(ldata2,3,4)
|
|
pcperioada='De la: '+lcd1+' pana la '+lcd2
|
|
Else
|
|
ldata1 = pcondper
|
|
pcperioada='LUNA: '+Substr(ldata1,1,2)+'.'+Substr(ldata1,3,4)
|
|
ldata2 = ldata1
|
|
Endif
|
|
lnLuna1 = Val(Substr(ldata1,1,2))
|
|
lnAn1 = Val(Substr(ldata1,3,4))
|
|
lnLuna2 = Val(Substr(ldata2,1,2))
|
|
lnAn2 = Val(Substr(ldata2,3,4))
|
|
|
|
*pcselect = ['select * from ] + gcS + [.vLucrari_validat where 2=2']
|
|
pcselect = [select * from vnom_Lucrari]
|
|
pcfiltru = [1=2]
|
|
pcschema = []
|
|
pcorder = [nrord]
|
|
pccoloane = [nrord]
|
|
pcTitlu = [Lucrare/Comanda]
|
|
*pcFiltruOriginal = [validat = 0 and inactiv = 0]
|
|
pcFiltruOriginal = []
|
|
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitlu,'',.T.,pcFiltruOriginal) && 11.07.2007
|
|
|
|
If Empty(locauta.id_lucrare) And Empty(locauta.nrord)
|
|
Return
|
|
Endif
|
|
|
|
lnIdLucrare = locauta.id_lucrare
|
|
|
|
If Empty(tnTip)
|
|
pnTip = 0
|
|
Else
|
|
pnTip = tnTip
|
|
Endif
|
|
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
lnInf = lnLuna1+ 12*lnAn1
|
|
lnSup = lnLuna2+ 12*lnAn2
|
|
*!* modificare 29.03.2013 v 2.2.7: id_set <> 268 in lcCondTipGest - sa nu se listeze bonurile importate din xml cu productia de vopsea pentru ca n-ar fi corect sa apara produsul final pe bon
|
|
|
|
lcCondIdSet = " and id_set <> 268 "
|
|
|
|
lcSql=[select * from ] + gcS + [.vrul where (luna+12*an between ?lnInf and ?lnSup) and cant=0 and cante<>0 ] +;
|
|
IIF(Alltrim(locauta.nrord)="<TOATE INREGISTRARILE>",[],[and id_lucrare=?lnIdLucrare ]) +;
|
|
[and id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag ] + ;
|
|
IIF(pnTip=6,[=],[<>])+[ 6) ] + gcCondSucursala + lcCondIdSet +;
|
|
[order by nrord,nnir,cgest,nresp,sectie,id_rul]
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
|
|
If Reccount('crsrul')=0
|
|
amessagebox("Nu exista bonuri pe aceasta lucrare !",0+48,"Atentie")
|
|
lnSucces = -1
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* pcDataOra = get_ora(2)
|
|
*!* Select crsrul
|
|
If pnTip # 6
|
|
*!* Report Form rap_bon_lucrare To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_bon_lucrare], , , , , , .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
Endif
|
|
Endif
|
|
|
|
Release locauta
|
|
If Used('crsrul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
Endproc && list_bon_pe_lucrare
|
|
|
|
*-------------------------------------------------------------
|
|
|
|
Procedure list_total_NIR
|
|
Parameters tnTip
|
|
|
|
pnTip = tnTip
|
|
|
|
*!* modificare ROAGEST v 2.0.6
|
|
*!* Do Case
|
|
*!* Case "-1" $ gcGestPermis
|
|
*!* pcselect = [select * from vnom_GESTIUNI]
|
|
*!* pcFiltruOrig = [inactiv = 0 and nr_pag = ?pnTip]
|
|
*!* pcfiltru = [1=2]
|
|
*!* pcschema = ['']
|
|
*!* pcorder = [nume_gestiune]
|
|
*!* pccoloane = [nume_gestiune,cgest]
|
|
*!* pcTitlu = [Alegeti gestiunea]
|
|
*!* pcTitluColoane = [Gestiune,Indicativ]
|
|
*!* locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"",.T.,pcFiltruOrig) && 11.07.2007
|
|
*!* Otherwise
|
|
pcselect = [select * from vnom_GESTIUNI]
|
|
pcFiltruOrig = [inactiv = 0 and nr_pag = ?pnTip and id_gestiune in ] + ;
|
|
[(select g.id_gestiune from vgest_coresp_grupe_gestiuni g join ] + ;
|
|
[vgest_coresp_util_grupe u on g.id_grupe = u.id_grupe and u.id_util = ?gnIdUtil)]
|
|
pcfiltru = [1=2]
|
|
pcschema = ['']
|
|
pcorder = [nume_gestiune]
|
|
pccoloane = [nume_gestiune,cgest]
|
|
pcTitlu = [Alegeti gestiunea]
|
|
pcTitluColoane = [Gestiune,Indicativ]
|
|
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"",.T.,pcFiltruOrig ) && 11.07.2007
|
|
*!* Endcase
|
|
*!* modificare ROAGEST v 2.0.6 ^
|
|
If locauta.id_gestiune = 0 And Alltrim(Upper(locauta.nume_gestiune)) # "<TOATE INREGISTRARILE>"
|
|
Release locauta
|
|
Return
|
|
Endif
|
|
|
|
pcNumeGestiune = Alltrim(Upper(locauta.nume_gestiune))
|
|
pnIdGest = Iif(pcNumeGestiune # "<TOATE INREGISTRARILE>", locauta.id_gestiune, -1)
|
|
|
|
Release locauta
|
|
|
|
If pnIdGest = -1
|
|
lcCond = [ and r.id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag = ?pnTip) and id_gestiune in ] + ;
|
|
[(select g.id_gestiune from ] + gcS + [.vgest_coresp_grupe_gestiuni g join ] + ;
|
|
gcS + [.vgest_coresp_util_grupe u on g.id_grupe = u.id_grupe and u.id_util = ?gnIdUtil) ]
|
|
Else
|
|
lcCond = [ and r.id_gestiune = ?pnIdGest ]
|
|
Endif
|
|
|
|
lcSql = [SELECT r.serie,r.lot,r.codmat,r.denumire,r.um,r.cant,r.pret,r.pretd,r.tva,r.id_gestiune,r.cgest,r.nume_gestiune,r.nnir,r.proc_tva, ]+;
|
|
[r.gestionar,r.comisie_receptie1,r.comisie_receptie2,r.comisie_receptie3, ] + ;
|
|
[(select NVL(min(a.id_act), -1) from act a where r.cod = a.cod AND r.cont = a.scd and r.an = a.an and r.luna = a.luna and a.sters = 0 ]+;
|
|
[and NVL(r.id_sucursala, -99) = NVL(a.id_sucursala, -99)) as id_act, r.nume_val, r.curs ]+ ;
|
|
[FROM vrul r ] +;
|
|
[WHERE r.cant<>0 AND r.cante=0 and r.an = ?gnAn and r.luna = ?gnLuna ] + lcCond
|
|
|
|
*STRTOFILE(lcSql, 'c:\Sql.txt')
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
If Reccount('crsrul') > 0
|
|
lcListaID = [-1]
|
|
Select Distinct id_act From crsrul Into Cursor tActuri
|
|
Select tActuri
|
|
Scan
|
|
lcListaID = lcListaID + [,] + Alltrim(Str(id_act))
|
|
Endscan
|
|
*lcListaID = SUBSTR(lcListaID,2)
|
|
|
|
lcSql = [SELECT id_act, partc as nume, serie_act, nract, dataact, dataireg, fdoc from vact where id_act in (] + lcListaID +[)]
|
|
lcCursor=[crsAct]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
|
|
Select r.*, a.*, 0 As discount, 0 As tvaDiscount From crsrul r ;
|
|
LEFT Join crsact a On r.id_act = a.id_act ;
|
|
INTO Cursor crslistare ;
|
|
ORDER By r.nnir
|
|
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* pcDataOra = get_ora(2)
|
|
*!* Select crslistare
|
|
*!* modificare 08.11.2007
|
|
*!* Report Form rap_nir_toate.frx To Printer Prompt Preview
|
|
goExport.export2frx([crslistare],[rap_nir_toate], , , , , , .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
*!* If pnTip = 6
|
|
*!* Report Form rap_nir_toate.frx To Printer Prompt Preview
|
|
*!* Else
|
|
*!* Report Form rap_nir_toate.frx To Printer Prompt Preview
|
|
*!* Endif
|
|
*!* modificare 08.11.2007 ^
|
|
Else
|
|
amessagebox('Nu a fost inregistrat nici un NIR in luna curenta' + Chr(13) + 'care sa indeplineasca conditiile!',0+48,'Atentie')
|
|
Endif
|
|
Endif
|
|
If Used('crsListare')
|
|
Use In crslistare
|
|
Endif
|
|
If Used('crsAct')
|
|
Use In crsact
|
|
Endif
|
|
If Used('crsRul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
Endproc && list_total_NIR
|
|
|
|
*-------------------------------------------------------------
|
|
|
|
Procedure list_total_BON
|
|
Parameters tnTip
|
|
|
|
pnTip = tnTip
|
|
|
|
*!* modificare ROAGEST v 2.0.6
|
|
*!* Do Case
|
|
*!* Case "-1" $ gcGestPermis
|
|
*!* pcselect = [select * from vnom_GESTIUNI]
|
|
*!* pcFiltruOrig = [inactiv = 0 and nr_pag = ?pnTip]
|
|
*!* pcfiltru = [1=2]
|
|
*!* pcschema = ['']
|
|
*!* pcorder = [nume_gestiune]
|
|
*!* pccoloane = [nume_gestiune,cgest]
|
|
*!* pcTitlu = [Alegeti gestiunea]
|
|
*!* pcTitluColoane = [Gestiune,Indicativ]
|
|
*!* locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"",.T.,pcFiltruOrig) && 11.07.2007
|
|
*!* Otherwise
|
|
pcselect = [select * from vnom_GESTIUNI]
|
|
pcFiltruOrig = [inactiv = 0 and nr_pag = ?pnTip and id_gestiune in ] + ;
|
|
[(select g.id_gestiune from vgest_coresp_grupe_gestiuni g join ] + ;
|
|
[vgest_coresp_util_grupe u on g.id_grupe = u.id_grupe and u.id_util = ?gnIdUtil)]
|
|
pcfiltru = [1=2]
|
|
pcschema = []
|
|
pcorder = [nume_gestiune]
|
|
pccoloane = [nume_gestiune,cgest]
|
|
pcTitlu = [Alegeti gestiunea]
|
|
pcTitluColoane = [Gestiune,Indicativ]
|
|
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"",.T.,pcFiltruOrig ) && 11.07.2007
|
|
*!* Endcase
|
|
*!* modificare ROAGEST v 2.0.6 ^
|
|
If locauta.id_gestiune = 0 And Alltrim(Upper(locauta.nume_gestiune)) # "<TOATE INREGISTRARILE>"
|
|
Release locauta
|
|
Return
|
|
Endif
|
|
|
|
pcNumeGestiune = Alltrim(Upper(locauta.nume_gestiune))
|
|
pnIdGest = Iif(pcNumeGestiune # "<TOATE INREGISTRARILE>", locauta.id_gestiune, -1)
|
|
|
|
Release locauta
|
|
|
|
If pnIdGest = -1
|
|
lcCond = [ and r.id_gestiune in (select distinct id_gestiune from ] + gcS + [.vnom_gestiuni where nr_pag = ?pnTip) and id_gestiune in ] + ;
|
|
[(select g.id_gestiune from ] + gcS + [.vgest_coresp_grupe_gestiuni g join ] + ;
|
|
gcS + [.vgest_coresp_util_grupe u on g.id_grupe = u.id_grupe and u.id_util = ?gnIdUtil) ]
|
|
Else
|
|
lcCond = [ and r.id_gestiune = ?pnIdGest ]
|
|
Endif
|
|
|
|
*!* modificare 29.03.2013 v 2.2.7: id_set <> 268 in lcCondTipGest - sa nu se listeze bonurile importate din xml cu productia de vopsea pentru ca n-ar fi corect sa apara produsul final pe bon
|
|
|
|
lcCondIdSet = " and r.id_set <> 268 "
|
|
|
|
lcSql = [SELECT r.serie,r.lot,r.codmat,r.denumire,r.um,r.cantE,r.pret,r.id_gestiune,r.cgest,r.nume_gestiune,r.nnir,r.dataact, ]+ ;
|
|
[r.gestionar,r.comisie_receptie1,r.comisie_receptie2,r.comisie_receptie3 ] + ;
|
|
[FROM vrul r ] +;
|
|
[WHERE r.cantE<>0 AND r.cant=0 and r.an = ?gnAn and r.luna = ?gnLuna ] + lcCond + ;
|
|
STRTRAN(gcCondSucursala,[id_sucursala],[r.id_sucursala]) + [ ] +lcCondIdSet + ;
|
|
[ORDER BY r.nume_gestiune, r.nnir]
|
|
|
|
* [group by r.codmat,r.denumire,r.um,r.cant,r.pret,r.id_gestiune,r.cgest,r.nume_gestiune,r.nnir,r.proc_tva ]+
|
|
*STRTOFILE(lcSql, 'c:\Sql.txt')
|
|
|
|
If Used('crsRul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
lcCursor=[crsrul]
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Endif
|
|
|
|
If lnSucces > 0
|
|
If Reccount('crsrul') > 0
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* pcDataOra = get_ora(2)
|
|
*!* Select crsrul
|
|
*!* Report Form rap_BONURI.frx To Printer Prompt Preview
|
|
goExport.export2frx([crsrul],[rap_bonuri], , , , , , .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
Else
|
|
amessagebox('Nu a fost inregistrat nici un NIR in luna curenta' + Chr(13) + 'care sa indeplineasca conditiile!',0+48,'Atentie')
|
|
Endif
|
|
Endif
|
|
|
|
If Used('crsRul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
Endproc && list_total_BON
|
|
|
|
*-----------------------------------------------------
|
|
Procedure ver_nir_facturi
|
|
Parameters tnFelFact, tlProductie
|
|
Local lcSchema, lcSelect, lcOrder, lcFiltru, lcFiltruOriginal, llAfiseaza
|
|
Local lcCondProductie, lcCondConturi
|
|
lcCondProductie = ""
|
|
lcCondConturi = ""
|
|
|
|
Private pnCod, pcCont, pcAcont, pnFel
|
|
Store '' To pcCont, pcAcont
|
|
pnCod = 0
|
|
|
|
Local llProductie
|
|
llProductie = tlProductie
|
|
|
|
Private poNirBon
|
|
Store '' To poNirBon
|
|
|
|
If Empty(tnFelFact)
|
|
pnFel = 1 && de achizitie
|
|
Else
|
|
pnFel = tnFelFact
|
|
Endif
|
|
|
|
|
|
|
|
*!* VERIFICARE FACTURI - NIR-URI
|
|
&& SELECTEZ DIN ACT FACTURILE DE ACHIZITIE/VANZARE (BAZA, TVA, SUMA - INCLUSIV DISCOUNTUL 667, 767)
|
|
lcSchema = []
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
If tlProductie
|
|
lcCondProductie = [a.id_set in (26000,26001)]
|
|
ELSE
|
|
*!* modificare ROAGEST v 2.0.120 : am adaugat conditia "not like '5%'"
|
|
lcCondProductie = [2=2]
|
|
lcCondConturi = Iif(pnFel = 1, [ and ((a.scc in ('401', '404', '408', '462') and a.scd not like '5%') OR (a.scd in ('401', '404', '408', '462') and a.scc not like '5%'))], ;
|
|
[ and ((a.scc in ('4111','4118','461') and a.scd not like '5%') OR (a.scd in ('4111','4118','461') and a.scc not like '5%'))])
|
|
Endif
|
|
*!* lcCondProductie = Iif(tlProductie, [a.id_set in (26000, 26001) ], [2=2 ])
|
|
*!* lcCondConturi = Iif(pnFel = 1, [ and (a.scc in ('401', '404', '408', '462') OR a.scd in ('401', '404', '408', '462'))], ;
|
|
*!* [ and (a.scc in ('4111','4118','461') OR a.scd in ('4111','4118','461'))])
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
TEXT to lcSelect textmerge noshow
|
|
select a1.cod,
|
|
a1.nract,
|
|
a1.serie_act,
|
|
a1.dataact,
|
|
b.denumire as part,
|
|
a1.nnir,
|
|
a1.id_sectie,
|
|
s.sectie,
|
|
a1.suma - a1.tva as baza,
|
|
a1.tva,
|
|
a1.suma,
|
|
a1.disc_baza,
|
|
a1.disc_tva,
|
|
a1.an,
|
|
a1.luna
|
|
from (select cod,
|
|
nract,
|
|
serie_act,
|
|
dataact,
|
|
an,
|
|
luna,
|
|
decode(exceptie, 1, id_partd, id_partc) as id_partc,
|
|
nnir,
|
|
id_sectie,
|
|
sum(DECODE(EXCEPTIE, 1, -suma, suma)) as suma,
|
|
sum(CASE
|
|
WHEN SCD IN ('4426', '4427', '4428') OR
|
|
SCC IN ('4426', '4427', '4428') then
|
|
DECODE(EXCEPTIE, 1, -suma, suma)
|
|
ELSE
|
|
0
|
|
END) as tva,
|
|
SUM(case when SCC = '767' THEN SUMA ELSE 0 END) AS disc_baza,
|
|
SUM(case when SCC = '767' THEN ROUND(SUMA*(proc_tva-1),<<gnPc>>) ELSE 0 END) AS disc_tva
|
|
from act a
|
|
LEFT JOIN (SELECT DISTINCT 1 AS EXCEPTIE,
|
|
DECODE(DEBIT, 1, CONT_C, CONT) AS ESCD,
|
|
DECODE(DEBIT, 1, CONT, CONT_C) AS ESCC
|
|
FROM EXCEPTII_IREG
|
|
WHERE INVERS = 1) E ON A.SCD = E.ESCD
|
|
AND A.SCC = E.ESCC
|
|
|
|
WHERE <<lcCondProductie>> <<gcCondSucursala>> <<lcCondConturi>>
|
|
and sters = 0
|
|
and cod in (select distinct cod
|
|
from vrul
|
|
where <<Iif(pnFel = 1, [cant <> 0], [cante <> 0])>>
|
|
<<gcCondSucursala>>)
|
|
GROUP BY COD,
|
|
SERIE_ACT,
|
|
NRACT,
|
|
DATAACT,
|
|
AN,
|
|
LUNA,
|
|
NNIR,
|
|
ID_SECTIE,
|
|
decode(exceptie, 1, id_partd, id_partc)) a1
|
|
left join nom_parteneri b on a1.id_partc = b.id_part
|
|
left join nom_sectii s on a1.id_sectie = s.id_sectie
|
|
ENDTEXT
|
|
*!* WHERE NVL(A1.DATAACT,to_date('1900-01-01','YYYY-MM-DD'))
|
|
*!* between to_date('20080101 00:00:00','YYYY-MM-DD HH24:MI:SS') AND
|
|
*!* to_date('20080930 23:59:59','YYYY-MM-DD HH24:MI:SS')
|
|
|
|
lcgroup = []
|
|
lcFiltruOriginal = []
|
|
lcOrder = [A1.DATAACT,A1.SERIE_ACT,A1.NRACT]
|
|
|
|
lcFiltru = [a1.an=?gnAn and a1.luna=?gnLuna]
|
|
llModParam = .T.
|
|
llAfiseaza = .F.
|
|
|
|
gencursor('poNirBon','crsAct', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza, lcgroup, llModParam, lcFiltruOriginal)
|
|
poNirBon.ca_baza1.afisare()
|
|
|
|
&& SELECTEZ DIN RUL ARTICOLELE DE PE FACTURA CURENTA DUPA COD
|
|
Private poRul
|
|
poRul = ''
|
|
|
|
|
|
lcSqlRul = [select cod, nnir, id_articol, codmat, denumire, serie, lot, um, pret, tva, proc_tva, pretv, tvav, proc_tvav, ] + ;
|
|
IIF(pnFel = 1, [cant], [cante]) + [ as cantitate,] + ;
|
|
[(case id_set when 234 then Round((PRET+TVA)*CANT, ?gnPC)- Round(Round((PRET+TVA)*CANT, ?gnPC)*(proc_tva-1)/proc_tva, ?gnPC) ] + ;
|
|
[ else ROUND(pret*] + Iif(pnFel = 1, [cant], [cante]) + [,?gnPc) end) as valoare,] + ;
|
|
[(case when nr_pag = 6 and proc_tvav <> 0 then + Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) - ] + ;
|
|
[ Round(Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv+tvav), ?gnPC)*(PROC_TVAV-1)/PROC_TVAV, ?gnPC) else ] + ;
|
|
[ Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC) end) as valoarev, ] + ;
|
|
[(case when nr_pag = 6 and proc_tvav <> 0 then Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) else ] + ;
|
|
[ Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC) + Round(Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC)*(PROC_TVAV-1), ?gnPC) end) as valoarevtva, ] + ;
|
|
[cont, acont from vrul]
|
|
|
|
*!* pcfiltru = [ an = ?gnAn and luna = ?gnLuna and cod = ?pnCod ]
|
|
pcfiltru = [ 1=2 ]
|
|
|
|
pcschema = []
|
|
pcorder = [dataora]
|
|
lcFiltruOriginal = Iif(tlProductie,[id_set in (26000,26001) and ],[]) + [id_tip_rulaj = 0] + gcCondSucursala + [ and cod = ?pnCod]
|
|
llAfiseaza = .F.
|
|
llModParam = .T.
|
|
lcGrup = []
|
|
gencursor('poRul','crsRul',lcSqlRul,pcfiltru,pcschema,pcorder,llAfiseaza,lcGrup,llModParam,lcFiltruOriginal)
|
|
poRul.ca_baza1.afisare()
|
|
|
|
*!* VERIFICARE NIR-URI - FACTURI
|
|
&& SELECTEZ DIN RUL NIR-URILE GRUPATE DUPA COD, NNIR, SECTIE, NRORD, DATAACT
|
|
lcSqlRulCont = [select cod, nnir, sectie, nrord, dataact, ] + ;
|
|
[SUM(case id_set when 234 then Round((PRET+TVA)*CANT, ?gnPC)- Round(Round((PRET+TVA)*CANT, ?gnPC)*(proc_tva-1)/proc_tva, ?gnPC) ] + ;
|
|
[ else ROUND(pret*] + Iif(pnFel = 1, [cant], [cante]) + [,?gnPc) end) as valoare,] + ;
|
|
[SUM(case id_set when 234 then Round(Round((PRET+TVA)*CANT, ?gnPC)*(proc_tva-1)/proc_tva, ?gnPC) ] + ;
|
|
[ else Round(ROUND(pret*] + Iif(pnFel = 1, [cant], [cante]) + [,?gnPc)*(proc_tva-1), ?gnPC) end) as valtva,] + ;
|
|
[SUM(case id_set when 234 then Round((PRET+TVA)*CANT, ?gnPC) ] + ;
|
|
[ else ROUND(pret*] + Iif(pnFel = 1, [cant], [cante]) + [,?gnPc) + Round(Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pret, ?gnPC)*(PROC_TVA-1), ?gnPC) end) as valctva,] + ;
|
|
[SUM(case when nr_pag in (6,7) and proc_tvav <> 0 then + Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) - ] + ;
|
|
[ Round(Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv+tvav), ?gnPC)*(PROC_TVAV-1)/PROC_TVAV, ?gnPC) else ] + ;
|
|
[ Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC) end) as valoarev, ] + ;
|
|
[SUM(case when nr_pag in (6,7) and proc_tvav <> 0 then Round(] + Iif(pnFel = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) else ] + ;
|
|
[ Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC) + Round(Round(] + Iif(pnFel = 1, [cant], [cante]) + [*pretv, ?gnPC)*(PROC_TVAV-1), ?gnPC) end) as valoarevtva ] + ;
|
|
[from vrul where an = ?gnAn and luna = ?gnLuna and ]+;
|
|
IIF(tlProductie, [(id_set=26000 or id_set=26001) and ],[]) + ;
|
|
[id_tip_rulaj = 0 ] + gcCondSucursala + [ and ] + ;
|
|
IIF(pnFel = 1, [cant], [cante]) + [ <> 0 ] + ;
|
|
[group by cod, nnir, dataact, nrord, sectie ORDER BY DATAACT, NNIR]
|
|
|
|
lcCursor = [crsRulCont]
|
|
lnSucces = goExecutor.oexecute(lcSqlRulCont,lcCursor)
|
|
If lnSucces < 0
|
|
lcmesaj = goExecutor.cEroare
|
|
ofrm_er = Createobject('frm_mesaj','Eroare','exclam.ico','Avertizare',lcmesaj)
|
|
ofrm_er.Show(1)
|
|
Release ofrm_er
|
|
Endif
|
|
|
|
Private poact
|
|
poact = ''
|
|
|
|
|
|
&& selectez din act factura corespunzatoare codului NIR-ului pe care sunt pozitionat
|
|
lcFiltru = []
|
|
lcSchema = []
|
|
lcOrder = []
|
|
lcgroup = []
|
|
llModParam = .T.
|
|
lcFiltruOriginal = []
|
|
|
|
TEXT to lcSelect textmerge noshow
|
|
select a1.cod,
|
|
a1.nract,
|
|
a1.serie_act,
|
|
a1.dataact,
|
|
b.denumire as part,
|
|
a1.nnir,
|
|
a1.id_sectie,
|
|
s.sectie,
|
|
a1.suma - a1.tva as baza,
|
|
a1.tva,
|
|
a1.suma,
|
|
a1.an,
|
|
a1.luna
|
|
from (select cod,
|
|
nract,
|
|
serie_act,
|
|
dataact,
|
|
an,
|
|
luna,
|
|
decode(exceptie, 1, id_partd, id_partc) as id_partc,
|
|
nnir,
|
|
id_sectie,
|
|
sum(DECODE(EXCEPTIE, 1, -suma, suma)) as suma,
|
|
sum(CASE
|
|
WHEN SCD IN ('4426', '4427', '4428') OR
|
|
SCC IN ('4426', '4427', '4428') then
|
|
DECODE(EXCEPTIE, 1, -suma, suma)
|
|
ELSE
|
|
0
|
|
END) as tva
|
|
from act a
|
|
LEFT JOIN (SELECT DISTINCT 1 AS EXCEPTIE,
|
|
DECODE(DEBIT, 1, CONT_C, CONT) AS ESCD,
|
|
DECODE(DEBIT, 1, CONT, CONT_C) AS ESCC
|
|
FROM EXCEPTII_IREG
|
|
WHERE INVERS = 1) E ON A.SCD = E.ESCD
|
|
AND A.SCC = E.ESCC
|
|
|
|
WHERE <<lcCondProductie>> <<gcCondSucursala>> <<lcCondConturi>>
|
|
and sters = 0
|
|
and cod=?pnCod
|
|
GROUP BY COD,
|
|
SERIE_ACT,
|
|
NRACT,
|
|
DATAACT,
|
|
AN,
|
|
LUNA,
|
|
NNIR,
|
|
ID_SECTIE,
|
|
decode(exceptie, 1, id_partd, id_partc)) a1
|
|
left join nom_parteneri b on a1.id_partc = b.id_part
|
|
left join nom_sectii s on a1.id_sectie = s.id_sectie
|
|
|
|
ENDTEXT
|
|
|
|
gencursor('poAct','crsActCont', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza, lcgroup, llModParam, lcFiltruOriginal)
|
|
poact.ca_baza1.afisare()
|
|
|
|
*** vizualizare
|
|
Select crsact
|
|
Do Form frm_verificare_rulaje With pnFel, llProductie
|
|
|
|
If Used('crsAct')
|
|
Use In crsact
|
|
Endif
|
|
|
|
If Used('crsRul')
|
|
Use In crsrul
|
|
Endif
|
|
|
|
If Used('crsActCont')
|
|
Use In crsActCont
|
|
Endif
|
|
|
|
If Used('crsRulCont')
|
|
Use In crsRulCont
|
|
Endif
|
|
Endproc && ver_nir_facturi
|
|
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
PROCEDURE listare_centralizator_nir_bon
|
|
LPARAMETERS tnTip, tlProductie, tcFiltruData
|
|
* tnTip: 1 = NIR (cant <> 0); 2 = BON CONSUM (cante <> 0)
|
|
* tlProductie: ROAPRODUCTIE
|
|
* tcFiltruData: dataact >= ... and dataact <=...., apelat din ver_nir_facturi > frm_verificare_rulaje.scx
|
|
Private poNirBon
|
|
Store '' To poNirBon
|
|
|
|
Local lcFiltruData, lnTip
|
|
lcFiltruData=[]
|
|
lnTip = IIF(TYPE('tnTip') = 'N', m.tnTip, 1)
|
|
|
|
If !EMPTY(m.tcFiltruData)
|
|
lcFiltruData = lcFiltruData + m.tcFiltruData
|
|
ENDIF
|
|
|
|
****************************
|
|
llUsedAct = USED('crsAct')
|
|
IF !m.llUsedAct
|
|
|
|
&& SELECTEZ DIN ACT FACTURILE DE ACHIZITIE/VANZARE (BAZA, TVA, SUMA - INCLUSIV DISCOUNTUL 667, 767)
|
|
lcSchema = []
|
|
If tlProductie
|
|
lcCondProductie = [a.id_set in (26000,26001)]
|
|
ELSE
|
|
lcCondProductie = [2=2]
|
|
lcCondConturi = Iif(lnTip = 1, [ and ((a.scc in ('401', '404', '408', '462') and a.scd not like '5%') OR (a.scd in ('401', '404', '408', '462') and a.scc not like '5%'))], ;
|
|
[ and ((a.scc in ('4111','4118','461') and a.scd not like '5%') OR (a.scd in ('4111','4118','461') and a.scc not like '5%'))])
|
|
Endif
|
|
|
|
TEXT to lcSelect textmerge noshow
|
|
select a1.cod,
|
|
a1.nract,
|
|
a1.serie_act,
|
|
a1.dataact,
|
|
b.denumire as part,
|
|
a1.nnir,
|
|
a1.id_sectie,
|
|
s.sectie,
|
|
a1.suma - a1.tva as baza,
|
|
a1.tva,
|
|
a1.suma,
|
|
a1.disc_baza,
|
|
a1.disc_tva,
|
|
a1.an,
|
|
a1.luna
|
|
from (select cod,
|
|
nract,
|
|
serie_act,
|
|
dataact,
|
|
an,
|
|
luna,
|
|
decode(exceptie, 1, id_partd, id_partc) as id_partc,
|
|
nnir,
|
|
id_sectie,
|
|
sum(DECODE(EXCEPTIE, 1, -suma, suma)) as suma,
|
|
sum(CASE
|
|
WHEN SCD IN ('4426', '4427', '4428') OR
|
|
SCC IN ('4426', '4427', '4428') then
|
|
DECODE(EXCEPTIE, 1, -suma, suma)
|
|
ELSE
|
|
0
|
|
END) as tva,
|
|
SUM(case when SCC = '767' THEN SUMA ELSE 0 END) AS disc_baza,
|
|
SUM(case when SCC = '767' THEN ROUND(SUMA*(proc_tva-1),<<gnPc>>) ELSE 0 END) AS disc_tva
|
|
from act a
|
|
LEFT JOIN (SELECT DISTINCT 1 AS EXCEPTIE,
|
|
DECODE(DEBIT, 1, CONT_C, CONT) AS ESCD,
|
|
DECODE(DEBIT, 1, CONT, CONT_C) AS ESCC
|
|
FROM EXCEPTII_IREG
|
|
WHERE INVERS = 1) E ON A.SCD = E.ESCD
|
|
AND A.SCC = E.ESCC
|
|
|
|
WHERE <<lcCondProductie>> <<gcCondSucursala>> <<lcCondConturi>>
|
|
and sters = 0
|
|
and cod in (select distinct cod
|
|
from vrul
|
|
where <<Iif(lnTip = 1, [cant <> 0], [cante <> 0])>>
|
|
<<gcCondSucursala>>)
|
|
GROUP BY COD,
|
|
SERIE_ACT,
|
|
NRACT,
|
|
DATAACT,
|
|
AN,
|
|
LUNA,
|
|
NNIR,
|
|
ID_SECTIE,
|
|
decode(exceptie, 1, id_partd, id_partc)) a1
|
|
left join nom_parteneri b on a1.id_partc = b.id_part
|
|
left join nom_sectii s on a1.id_sectie = s.id_sectie
|
|
ENDTEXT
|
|
*!* WHERE NVL(A1.DATAACT,to_date('1900-01-01','YYYY-MM-DD'))
|
|
*!* between to_date('20080101 00:00:00','YYYY-MM-DD HH24:MI:SS') AND
|
|
*!* to_date('20080930 23:59:59','YYYY-MM-DD HH24:MI:SS')
|
|
|
|
lcgroup = []
|
|
lcFiltruOriginal = []
|
|
lcOrder = [A1.DATAACT,A1.SERIE_ACT,A1.NRACT]
|
|
|
|
lcFiltru = [a1.an=?gnAn and a1.luna=?gnLuna]
|
|
llModParam = .T.
|
|
llAfiseaza = .F.
|
|
|
|
gencursor('poNirBon','crsAct', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza, lcgroup, llModParam, lcFiltruOriginal)
|
|
poNirBon.ca_baza1.afisare()
|
|
ENDIF && llUsedAct
|
|
****************************
|
|
*!* 11.06.2015
|
|
*!* MARIUS.MUTU
|
|
*!* ID_SET = 268: bon consum pe lucrari in curs de executie cu import din fisier (pentru import consum vopsea 301 si creare si consum mix vopsea 345)
|
|
*!* nu am nevoie de iesirea de mix 345 pentru ca se dubleaza iesirea de pe bon. Iese deja 301
|
|
|
|
|
|
|
|
*!* 04.02.2009
|
|
&& SELECTEZ DIN RUL NIR-URILE GRUPATE DUPA COD, NNIR, SECTIE, NRORD, DATAACT
|
|
lcSqlRulListare = [select cod, nnir, sectie, nrord, dataact, ] + ;
|
|
[SUM(case id_set when 234 then Round((PRET+TVA)*CANT, ?gnPC)- Round(Round((PRET+TVA)*CANT, ?gnPC)*(proc_tva-1)/proc_tva, ?gnPC) ] + ;
|
|
[ else ROUND(pret*] + Iif(lnTip = 1, [cant], [cante]) + [,?gnPc) end) as valoare,] + ;
|
|
[SUM(case id_set when 234 then Round(Round((PRET+TVA)*CANT, ?gnPC)*(proc_tva-1)/proc_tva, ?gnPC) ] + ;
|
|
[ else Round(ROUND(pret*] + Iif(lnTip = 1, [cant], [cante]) + [,?gnPc)*(proc_tva-1), ?gnPC) end) as valtva,] + ;
|
|
[SUM(case id_set when 234 then Round((PRET+TVA)*CANT, ?gnPC) ] + ;
|
|
[ else ROUND(pret*] + Iif(lnTip = 1, [cant], [cante]) + [,?gnPc) + Round(Round(] + Iif(lnTip = 1, [cant], [cante]) + [*pret, ?gnPC)*(PROC_TVA-1), ?gnPC) end) as valctva,] + ;
|
|
[SUM(case when nr_pag in (6,7) and proc_tvav <> 0 then + Round(] + Iif(lnTip = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) - ] + ;
|
|
[ Round(Round(] + Iif(lnTip = 1, [cant], [cante]) + [*(pretv+tvav), ?gnPC)*(PROC_TVAV-1)/PROC_TVAV, ?gnPC) else ] + ;
|
|
[ Round(] + Iif(lnTip = 1, [cant], [cante]) + [*pretv, ?gnPC) end) as valoarev, ] + ;
|
|
[SUM(case when nr_pag in (6,7) and proc_tvav <> 0 then Round(] + Iif(lnTip = 1, [cant], [cante]) + [*(pretv + tvav), ?gnPC) else ] + ;
|
|
[ Round(] + Iif(lnTip = 1, [cant], [cante]) + [*pretv, ?gnPC) + Round(Round(] + Iif(lnTip = 1, [cant], [cante]) + [*pretv, ?gnPC)*(PROC_TVAV-1), ?gnPC) end) as valoarevtva ] + ;
|
|
[from vrul where ] + Iif(!EMPTY(lcFiltruData),;
|
|
[(]+lcFiltruData+[ and ],;
|
|
[an = ?gnAn and luna = ?gnLuna and ]) +;
|
|
IIF(tlProductie, [(id_set=26000 or id_set=26001) and ],[]) + ;
|
|
[id_tip_rulaj = 0 ] + gcCondSucursala + [ and ] + ;
|
|
IIF(m.lnTip = 1, [cant], [cante]) + [ <> 0 ] + ;
|
|
IIF(m.lnTip = 2, [ and ((id_set = 268 and cont <> '345') or id_set <> 268)], []) + ;
|
|
[group by cod, nnir, dataact, nrord, sectie ORDER BY DATAACT, NNIR]
|
|
|
|
* ID_SET = 268: bon consum pe lucrari in curs de executie cu import din fisier (pentru import consum vopsea 301 si creare si consum mix vopsea 345)
|
|
* nu am nevoie de iesirea de mix 345 pentru ca se dubleaza iesirea de pe bon. Iese deja 301
|
|
|
|
lcCursor = [crsRulListare]
|
|
lnSucces = goExecutor.oexecute(lcSqlRulListare,lcCursor)
|
|
If lnSucces < 0
|
|
aMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare')
|
|
Return
|
|
Endif
|
|
*!* 04.02.2009 ^
|
|
Use In (SELECT('crsraport'))
|
|
|
|
If m.lnTip = 2 && Bonuri
|
|
lcRaport=[centralizator_bon.frx]
|
|
Select nnir,dataact,nrord,sectie,Sum(valoare) As valoare,Sum(valoarev) As valoarev ;
|
|
FROM crsrullistare Group By nnir,dataact,nrord,sectie ;
|
|
ORDER By dataact,nnir Into Cursor crsraport
|
|
Else
|
|
lcRaport=[centralizator_nir.frx]
|
|
Use In (SELECT('crstoate'))
|
|
|
|
If Type('crsact.part') <> 'U'
|
|
Select a.Part As nume,a.serie_act,a.nract,a.dataact,a.baza As valftvacont, a.suma As valctvacont, b.nnir,b.valoare As valftva,b.valtva As valtva,b.valctva As valctva, ;
|
|
a.disc_baza as valdiscb, a.disc_tva as valdisct, b.valoarev - b.valoare as valadaos ;
|
|
FROM crsact a Left Join crsrullistare b On a.cod=b.cod ;
|
|
ORDER By a.dataact,b.nnir Into Cursor crstoate
|
|
Else
|
|
Select '' As nume,a.serie_act,a.nract,a.dataact,a.baza As valftvacont, a.suma As valctvacont, b.nnir,b.valoare As valftva,b.valtva,b.valctva ;
|
|
FROM crsact a Left Join crsrullistare b On a.cod=b.cod ;
|
|
ORDER By a.dataact,b.nnir Into Cursor crstoate
|
|
Endif
|
|
|
|
Select nume,nract,serie_act,dataact,nnir,valftvacont, valctvacont, Sum(valftva) As valftva,Sum(valtva) As valtva,Sum(valctva) As valctva ,SUM(valdiscb) as valdiscb,SUM(valdisct) as valdisct,SUM(valadaos) as valadaos;
|
|
FROM crstoate Group By nume,serie_act,nract,dataact,nnir,valftvacont, valctvacont ;
|
|
ORDER By dataact,nnir Into Cursor crsraport
|
|
|
|
Use In (SELECT('crstoate'))
|
|
Endif
|
|
|
|
If Reccount('crsraport')>0
|
|
pcDataora=get_ora(2)
|
|
Select crsraport
|
|
Report Form (lcRaport) To Printer Prompt Preview
|
|
Else
|
|
AMESSAGEBOX("Nu exista inregistrari pentru listare!",0+48,"Atentie")
|
|
Endif
|
|
|
|
Use In (SELECT('crsraport'))
|
|
IF m.llUsedAct
|
|
USE IN (SELECT('crsAct'))
|
|
ENDIF
|
|
|
|
ENDPROC && listare_centralizator_nir_bon
|
|
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
Procedure list_raport_gestiuni
|
|
Lparameters tnNr_pag
|
|
|
|
LOCAL lcFile
|
|
Private pdData1,pdData2,pnId_gestiune, pnNr_pag, pnSoldPrec, pcNumeGest, pcDataOra,pnId_gestiunec,pcNumeGestc,pnGrupezGestc,pcGrupare,pcTitlu,pcSubtitlu,pcSirIdSubgrupArt,pcSirNumeSubgrupArt,pcSirIdArticole,pcSirNumeArticole
|
|
Store 0 To pnId_gestiune, pnNr_pag, pnSoldPrec,pnId_gestiunec,pnGrupezGestc
|
|
Store '' To pcGrupare,pcSirIdSubgrupArt,pcSirNumeSubgrupArt,pcSirIdArticole,pcSirNumeArticole,pcSubtitlu
|
|
lcFile = ''
|
|
*!* locauta = caut_gestiune(tnNr_pag, gnIdUtil,.t.)
|
|
*!* pnId_gestiune = locauta.id_gestiune
|
|
*!* pcNumeGest = locauta.nume_gestiune
|
|
*!* IF gnbuton = 2
|
|
*!* RETURN
|
|
*!* ENDIF
|
|
pdData1 = Date(gnAn, gnLuna, 1)
|
|
pdData2 = Gomonth(pdData1,1) - 1
|
|
|
|
*!* loid = Createobject("frm_interval_date")
|
|
*!* loid.Show(1)
|
|
*!* IF gnbuton = 2
|
|
*!* RETURN
|
|
*!* ENDIF
|
|
pnNr_pag = tnNr_pag
|
|
|
|
loid = Createobject("frm_raport_gestiuni")
|
|
loid.Show(1)
|
|
If gnbuton = 2
|
|
Return
|
|
Endif
|
|
*!* pnNr_pag = locauta.nr_pag
|
|
If Empty(pdData1) Or Empty(pdData2) Or Empty(pnNr_pag)
|
|
Return
|
|
Endif
|
|
|
|
If Empty(Nvl(pcSirIdSubgrupArt,[]))
|
|
pcSirIdSubgrupArt = [Null]
|
|
Else
|
|
pcSubtitlu = [Subgrupe : ] + pcSirNumeSubgrupArt + CHR(13) + CHR(10)
|
|
Endif
|
|
|
|
If Empty(Nvl(pcSirIdArticole,[]))
|
|
pcSirIdArticole = [Null]
|
|
Else
|
|
pcSubtitlu = pcSubtitlu + [Articole : ] + pcSirNumeArticole
|
|
Endif
|
|
|
|
If pnId_gestiunec = 0
|
|
pnId_gestiunec = Null
|
|
Endif
|
|
|
|
If pnGrupezGestc = 0
|
|
pcGrupare = [EOF()]
|
|
Else
|
|
pcGrupare = [nume_gestiunec]
|
|
Endif
|
|
|
|
If pnId_gestiune = 0
|
|
pnId_gestiune = Null
|
|
Endif
|
|
pcTitlu = [RAPORT GESTIUNE]
|
|
lcSql = [{call pack_gest_rapoarte.raport_gestiune(?pnId_gestiune, ?pdData1, ?pdData2, ?pnNr_pag, ?gnIdSucursala,] + ;
|
|
[?pnGrupezGestc,?pnId_gestiunec,] + pcSirIdArticole + [,] + pcSirIdSubgrupArt + [,?@pnSoldPrec)}]
|
|
lcCursor = 'cRulaje'
|
|
If goExecutor.oExecuta(m.lcSql,m.lcCursor)
|
|
Select (lcCursor)
|
|
goExport.export2frx(lcCursor,[rap_gestiune], , , , , , .T.)
|
|
|
|
IF AMESSAGEBOX('Doriti sa salvati raportul in format xls?',4+32,_screen.Caption) = 6
|
|
lcFile = PUTFILE('Raport gestiune','raport_gestiune','xls')
|
|
IF !EMPTY(m.lcFile)
|
|
|
|
SELECT *, CAST(0 as N(18,4)) as sold FROM cRulaje ;
|
|
WHERE .F. ;
|
|
INTO CURSOR cRaportXls READWRITE
|
|
|
|
INSERT INTO cRaportXls (fdoc, sold) VALUES ('SOLD INITIAL', m.pnSoldPrec)
|
|
SELECT cRaportXLS
|
|
APPEND from DBF('cRulaje')
|
|
|
|
SELECT cRaportXls
|
|
GO TOP
|
|
lnSold = sold
|
|
SCAN
|
|
lnSold = NVL(m.lnSold, 0) + NVL(deb, 0) - NVL(cred, 0)
|
|
REPLACE sold WITH m.lnSold
|
|
ENDSCAN
|
|
SELECT cRaportXls
|
|
COPY TO (m.lcFile) TYPE XL5
|
|
USE IN (SELECT('cRaportXls'))
|
|
open_default_app(m.lcFile)
|
|
ENDIF
|
|
ENDIF
|
|
Use In (SELECT(m.lcCursor))
|
|
Endif
|
|
|
|
*!* modificare 18.02.2008
|
|
*!* If Reccount('cRulaje')>0
|
|
*!* pcDataOra = get_ora(2)
|
|
*!* Select cRulaje
|
|
*!* Report Form rap_gestiune To Printer Prompt Preview
|
|
*!* Else
|
|
*!* amessagebox("Nu exista inregistrari pentru listare!",48,"Atentie")
|
|
*!* Endif
|
|
*!* modificare 18.02.2008 ^
|
|
|
|
Endproc && list_raport_gestiuni
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
Procedure list_raport_gestiuni_centralizator
|
|
*!* modificare v 2.0.81
|
|
Lparameters tnNr_pag
|
|
Private pdDataI,pdDataF,pnNr_pag,pnSoldPrec
|
|
Store {} To pdDataI,pdDataF
|
|
Store 0 To pnSoldPrec
|
|
ofrmperioada = Createobject('frm_perioada_zzllaaaa')
|
|
ofrmperioada.Show(1)
|
|
If gnbuton = 1
|
|
pnNr_pag = tnNr_pag
|
|
If !Empty(pdDataI) And !Empty(pdDataF) And !Empty(pnNr_pag)
|
|
lcSel = [{call pack_gest_rapoarte.raport_gestiune_centralizator(?pdDataI, ?pdDataF, ?pnNr_pag, ?gnIdSucursala,?@pnSoldPrec)}]
|
|
lcCursor = 'cRulaje'
|
|
lnSucces = goExecutor.oexecute(lcSel, lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Else
|
|
goExport.export2frx([cRulaje],[rap_gestiune_toate], , , , , , .T.)
|
|
Use In cRulaje
|
|
Endif
|
|
Endif
|
|
Endif
|
|
*!* modificare v 2.0.81 ^
|
|
Endproc && list_raport_gestiuni_centralizator
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
Procedure list_schimbPret
|
|
Parameters tnNir, tnTip
|
|
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
*!* Private pcDataOra
|
|
*!* pcDataOra = get_ora(2)
|
|
|
|
IF TYPE('schimbPret.partener_rezervare') = 'U'
|
|
Select *, '' as partener_rezervare ;
|
|
From schimbPret ;
|
|
Where schimb = 1 ;
|
|
Into Cursor cList
|
|
ELSE
|
|
Select * From schimbPret Where schimb = 1 Into Cursor cList
|
|
ENDIF
|
|
|
|
*!* Select cList
|
|
*!* Keyboard "{ctrl+f10}"
|
|
*!* Report Form rap_schimbPret To Printer Prompt Preview
|
|
goExport.export2frx([clist],[rap_schimbPret], , , , , , .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
|
|
If Used("cList")
|
|
Use In cList
|
|
Endif
|
|
Use In (Select("schimbPret"))
|
|
|
|
Endproc && list_schimbPret
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
Procedure raport_vanzari
|
|
|
|
Private poVanzari, poDetalii
|
|
Local llAfiseaza
|
|
Store .F. To llAfiseaza
|
|
Store '' To poVanzari, poDetalii
|
|
If Used('crsVanzari')
|
|
Use In crsVanzari
|
|
Endif
|
|
If Used('crsDetalii')
|
|
Use In crsDetalii
|
|
Endif
|
|
|
|
* pcschema1=['id_pol n(10), nume_lista_preturi c(100), datai d, datas d, id_valuta n(10), nume_val c(10), id_nota N(5), notaContab C(30), utilizator c(100),dataora t']
|
|
pcschema1=['']
|
|
pcselect1=['select * from vvanzari_tot where 2=2']
|
|
pcorder1=[dataora]
|
|
pcfiltru1 = [1 = 2]
|
|
llAfiseaza = .F.
|
|
gencursor('poVanzari','crsVanzari',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
|
poVanzari.ca_baza1.afisare()
|
|
|
|
pcschema1=['']
|
|
pcselect1=['select * from vvanzari_detalii_tot where 2=2']
|
|
pcorder1=[nume_lista_preturi, denumire]
|
|
pcfiltru1 = [1 = 2]
|
|
llAfiseaza = .F.
|
|
gencursor('poDetalii','crsDetalii',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
|
poDetalii.ca_baza1.afisare()
|
|
|
|
lov = Createobject("frm_vanzari")
|
|
lov.Show(1)
|
|
|
|
Release lov, poVanzari, poDetalii
|
|
|
|
Endproc && raport_vanzari
|
|
***----------------------------------------------------------------------------------------------------------------------------------
|
|
***-----------------------------------------------------------------------------------------------------------
|
|
Procedure listare_imputare
|
|
Parameters tnNir
|
|
|
|
Private pnOperatie
|
|
pnOperatie = 3
|
|
|
|
Private pcTitlu, pcperioada, pcDataOra, pdDataI, pdDataF, pnId_responsabil && pt. raport
|
|
Store "" To pcTitlu, pcperioada
|
|
pcDataOra = get_ora(2)
|
|
Store {//} To pdDataI, pdDataF
|
|
pnId_responsabil = 0
|
|
pcTitlu = "IMPUTARE"
|
|
|
|
***-------------------------------
|
|
lcSel = [{call pack_gest_rapoarte.fisa_echip_uzat_pred_imputat(?gnAn, ?gnLuna, ?tnNir, ?pdDataI, ?pdDataF, ?pnId_responsabil, ?pnOperatie, ?gnIdSucursala)}]
|
|
lcCursor = 'cFisa'
|
|
lnSucces = goExecutor.oexecute(lcSel,lcCursor)
|
|
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
***-------------------------------
|
|
|
|
Private pcSemnaturi
|
|
Store '' To pcSemnaturi
|
|
|
|
Local lcRaport
|
|
lcRaport = "RAP_ECHIP_IMPUTAT"
|
|
|
|
param_listari(lcRaport,,@pcSemnaturi, .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
IF TYPE('goExport') = 'O'
|
|
goExport.export2frx([cFisa],lcRaport, , , , , , .T.)
|
|
ELSE
|
|
Select cFisa
|
|
Report Form &lcRaport To Printer Prompt Preview
|
|
ENDIF
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
|
|
If Used("cFisa")
|
|
Use In cFisa
|
|
Endif
|
|
|
|
Endproc && listare_imputare
|
|
***-----------------------------------------------------------------------------------------------------------
|
|
***-----------------------------------------------------------------------------------------------------------
|
|
Procedure listare_casare
|
|
Parameters tnNir, tnIdSet
|
|
* tnIdSet default 70
|
|
SET STEP ON
|
|
Private pnOperatie
|
|
pnOperatie = 1
|
|
IF !EMPTY(m.tnIdSet) AND m.tnIdset = 274
|
|
pnOperatie = 4 && iesire din gestiune ob. inv. in folosinta
|
|
ENDIF
|
|
|
|
*!* 26.01.2011
|
|
PRIVATE pnNnir
|
|
pnNnir = tnNir
|
|
*!* 26.01.2011 ^
|
|
|
|
Private pcTitlu, pcperioada, pcDataOra, pdDataI, pdDataF, pnId_responsabil && pt. raport
|
|
Store "" To pcTitlu, pcperioada
|
|
pcDataOra = get_ora(2)
|
|
Store {//} To pdDataI, pdDataF
|
|
pnId_responsabil = 0
|
|
pcTitlu = "CASARE (din folosinta)"
|
|
|
|
***-------------------------------
|
|
lcSel = [{call pack_gest_rapoarte.fisa_echip_uzat_pred_imputat(?gnAn, ?gnLuna, ?tnNir, ?pdDataI, ?pdDataF, ?pnId_responsabil, ?pnOperatie, ?gnIdSucursala)}]
|
|
lcCursor = 'cFisa'
|
|
lnSucces = goExecutor.oexecute(lcSel,lcCursor)
|
|
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,0+16,"Eroare")
|
|
Return
|
|
Endif
|
|
***-------------------------------
|
|
|
|
Private pcSemnaturi
|
|
Store '' To pcSemnaturi
|
|
|
|
Local lcRaport
|
|
lcRaport = 'rap_echip_uzat'
|
|
|
|
param_listari(lcRaport,,@pcSemnaturi, .T.)
|
|
*!* modificare ROAPRODUCTIE v 2.0.2
|
|
IF TYPE('goExport') = 'O'
|
|
goExport.export2frx([cFisa],lcRaport, , , , , , .T.)
|
|
ELSE
|
|
Select cFisa
|
|
Report Form &lcRaport To Printer Prompt Preview
|
|
ENDIF
|
|
*!* modificare ROAPRODUCTIE v 2.0.2 ^
|
|
If Used("cFisa")
|
|
Use In cFisa
|
|
Endif
|
|
|
|
Endproc && listare_casare
|
|
***------------------------------------- inceput list_centr_valoric_subgr ---------------------------------
|
|
Procedure list_centr_valoric_subgr
|
|
Lparameters tnTip
|
|
|
|
Local lnTip, lcRaport
|
|
If Type("tnTip")="N"
|
|
lnTip=tnTip
|
|
Else
|
|
lnTip = 1
|
|
Endif
|
|
|
|
Local lcSql,lnSucces,lcCursor
|
|
Private pcperioada,pdDataI,pdDataF,pcTitlu,pnIdGrupa,pcNumeGrupa,pcListaIdGestiuni,pcSeparator
|
|
Store '' To pcNumeGrupa,pcListaIdGestiuni
|
|
Store {} To pdDataI,pdDataF
|
|
lcCursor = [crscentrsubgr]
|
|
pcSeparator = [,]
|
|
|
|
ofrmperioada=Createobject('frm_perioada_zzllaaaa')
|
|
ofrmperioada.Show(1)
|
|
If gnbuton=1
|
|
pcperioada = [Perioada ] + Dtoc(pdDataI) + [ - ] + Dtoc(pdDataF)
|
|
Else
|
|
Return
|
|
Endif
|
|
|
|
lcXMLGestiune = caut_gestiune_xml(2)
|
|
If !Empty(lcXMLGestiune) And gnbuton = 1
|
|
Xmltocursor(lcXMLGestiune, "crsGestTemp")
|
|
If Reccount('crsGestTemp') = 0
|
|
amessagebox('Nu ati selectat nici o gestiune!',0+48,'Inventar')
|
|
Return
|
|
Endif
|
|
pcListaIdGestiuni = cursor2lista("crsGestTemp", "id_gestiune", pcSeparator)
|
|
Use In crsGestTemp
|
|
Else
|
|
Return
|
|
Endif
|
|
|
|
locauta = caut_grupa_gestiune()
|
|
If !Empty(locauta.id_grupe) And gnbuton = 1
|
|
pnIdGrupa = locauta.id_grupe
|
|
pcNumeGrupa = locauta.nume_grupa
|
|
Else
|
|
Return
|
|
Endif
|
|
|
|
pcTitlu = [CENTRALIZATOR VALORI PE SUBGRUPE DE ARTICOLE]
|
|
If Used(lcCursor)
|
|
Use In (lcCursor)
|
|
Endif
|
|
|
|
If lnTip = 1
|
|
|
|
lcSql = [{call pack_gest_rapoarte.centr_valoric_subgr (?pcNumeGrupa,?pnIdGrupa,] + ;
|
|
[?pcListaIdGestiuni,?pcSeparator,?pdDataI,?pdDataF,?gnIdSucursala)}]
|
|
lcRaport = [rap_gest_val_subgrupe]
|
|
Else
|
|
lcSql = [{call pack_gest_rapoarte.centr_valoric_subgr_gestc (?pcNumeGrupa,?pnIdGrupa,] + ;
|
|
[?pcListaIdGestiuni,?pcSeparator,?pdDataI,?pdDataF,?gnIdSucursala)}]
|
|
lcRaport = [rap_gest_val_subgrupe_gestc]
|
|
Endif
|
|
lnSucces = goExecutor.oexecute(lcSql,lcCursor)
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,16,"Eroare")
|
|
Else
|
|
goExport.export2frx(lcCursor,lcRaport, , , , , , .T. )
|
|
Endif
|
|
|
|
If Used(lcCursor)
|
|
Use In (lcCursor)
|
|
Endif
|
|
|
|
Release lcSql,lnSucces,pcperioada,pdDataI,pdDataF,pcTitlu,pnIdGrupa,pcNumeGrupa,pcListaIdGestiuni,pcSeparator
|
|
Endproc && list_centr_valoric_subgr
|
|
**************************************************************************************************************
|
|
Procedure list_centr_intrari
|
|
Lparameters tnTipGest
|
|
Private pnIdGestiune,pcNumeGestiune,pcDataOra,pnNrRapoarte
|
|
Local loCauta,loCauta2
|
|
loCauta = caut_gestiune(tnTipGest,gnIdUtil)
|
|
If gnButon = 1
|
|
pnIdGestiune = loCauta.id_gestiune
|
|
pcNumeGestiune = loCauta.nume_gestiune
|
|
lcSql = [select distinct a.id_subgrupa, b.subgrupa from ] + gcS + [.nom_articole a ] + ;
|
|
[left join ] + gcS + [.gest_art_sbgr b on a.id_subgrupa = b.id_subgrupa ] + ;
|
|
[where a.id_articol in (select distinct id_articol from ] + gcS + [.rul where sters = 0 ] + ;
|
|
[and an = ?gnAn and luna = ?gnLuna ] + gcCondSucursala + [ and cant <> 0 ] + ;
|
|
[and id_tip_rulaj = 0 and id_gestiune = ?pnIdGestiune) order by subgrupa]
|
|
lnSucces = goExecutor.oExecute(lcSql,[crssubgrupe])
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,64,"Eroare")
|
|
Else
|
|
lcSql = [{call pack_gest_rapoarte.centr_intrari(?pnIdGestiune,?gnIdSucursala,?gnLuna,?gnAn)}]
|
|
lnSucces = goExecutor.oExecute(lcSql,[crsraport])
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,64,"Eroare")
|
|
Else
|
|
If Reccount('crsraport') > 0
|
|
pcDataOra = get_ora(2)
|
|
Select subgrupa From crssubgrupe Into Array laNumeColoane
|
|
If Alen(laNumeColoane) >= 10
|
|
pnNrRapoarte = 2
|
|
Local ox As ReportListener
|
|
ox = Createobject('ReportListener')
|
|
ox.DynamicLineHeight = .F.
|
|
ox.ListenerType = 1
|
|
goExport.export2frx([crsraport],[rap_centralizator_intrari],.F.,2,[],[NOPAGEEJECT],ox)
|
|
goExport.export2frx([crsraport],[rap_centralizator_intrari2],.F.,2,[],[],ox)
|
|
Release ox
|
|
Else
|
|
pnNrRapoarte = 1
|
|
goExport.export2frx([crsraport],[rap_centralizator_intrari], , , , , , .T.)
|
|
Endif
|
|
Release laNumeColoane
|
|
Else
|
|
amessagebox("Nu exista inregistrari pentru listare!",48,"Atentie")
|
|
Endif
|
|
Endif
|
|
If Used('crsraport')
|
|
Use In crsraport
|
|
Endif
|
|
Endif
|
|
If Used('crssubgrupe')
|
|
Use In crssubgrupe
|
|
Endif
|
|
Endif
|
|
Release pnIdGestiune,pcNumeGestiune,pcDataOra,pnNrRapoarte,loCauta,loCauta2
|
|
Endproc && list_centr_intrari
|
|
**************************************************************************************************************
|
|
Procedure list_centr_iesiri
|
|
Lparameters tnTipGest,tnTipCentralizator
|
|
*!* tnTipCentralizator
|
|
*!* = 1 - transferuri
|
|
*!* = 2 - facturi clienti
|
|
*!* = 3 - protocol si sponsorizari
|
|
Private pnIdGestiune,pcNumeGestiune,pcDataOra,pnNrRapoarte,pnTipCentralizator,pcTitlu,pnIdGrupaGest,pcNumeGrupaGest,pnIdGestiune,pcNumeGestiune,pdDataI,pdDataF
|
|
Store {} To pdDataI,pdDataF
|
|
Local lofrmperioada,loCauta,lcSql,lnSucces
|
|
lofrmperioada = Createobject('frm_perioada_zzllaaaa')
|
|
lofrmperioada.Show(1)
|
|
If !Empty(Nvl(pdDataI,{})) And !Empty(Nvl(pdDataF,{}))
|
|
pnTipCentralizator = tnTipCentralizator
|
|
pnIdGrupaGest = Null
|
|
pcNumeGrupaGest = []
|
|
Local loCauta,loCauta2,lcSql
|
|
loCauta = caut_gestiune(tnTipGest,gnIdUtil)
|
|
If gnButon = 1
|
|
pnIdGestiune = loCauta.id_gestiune
|
|
pcNumeGestiune = loCauta.nume_gestiune
|
|
Do Case
|
|
Case pnTipCentralizator = 1
|
|
loCauta = caut_grupa_gestiune()
|
|
If gnButon = 1
|
|
pnIdGrupaGest = loCauta.id_grupe
|
|
pcNumeGrupaGest = loCauta.nume_grupa
|
|
Endif
|
|
pcTitlu = [CENTRALIZATOR IESIRI (TRANSFERURI CATRE ] + Iif(!Empty(pcNumeGrupaGest),[GRUPA ] + Alltrim(pcNumeGrupaGest),[GESTIUNI LA P.V.]) + [) ] + ;
|
|
[DIN GESTIUNEA ] + Alltrim(pcNumeGestiune) + [ ( ] + Alltrim(Dtoc(pdDataI) + [ - ] + Dtoc(pdDataF)) + [ )]
|
|
Case pnTipCentralizator = 2
|
|
pcTitlu = [CENTRALIZATOR IESIRI (FACTURI) DIN GESTIUNEA ] + Alltrim(pcNumeGestiune) + [ ( ] + Alltrim(Dtoc(pdDataI) + [ - ] + Dtoc(pdDataF)) + [ )]
|
|
Case pnTipCentralizator = 3
|
|
pcTitlu = [CENTRALIZATOR IESIRI (PROTOCOL, SPONSORIZARI) DIN GESTIUNEA ] + Alltrim(pcNumeGestiune) + [ ( ] + Alltrim(Dtoc(pdDataI) + [ - ] + Dtoc(pdDataF)) + [ )]
|
|
Endcase
|
|
If aMessagebox("Doriti ca raportul sa cuprinda si statistica privind stocul ( initial, total intrari , total iesiri, final ) ?",4+32,"Statistici stoc")=6
|
|
_Screen.MousePointer = 11
|
|
lcSql = [{call pack_gest_rapoarte.centralizator_stoc(?pnIdGestiune,?pdDataI,?pdDataF,?gnIdSucursala)}]
|
|
lnSucces = goExecutor.oExecute(lcSql,[crsStatisticiStoc])
|
|
_Screen.MousePointer = 0
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,64,"Eroare")
|
|
Endif
|
|
Endif
|
|
_Screen.MousePointer = 11
|
|
lcSql = [{call pack_gest_rapoarte.cursor_subgrupe(?pnIdGestiune,?gnIdSucursala,?pdDataI,?pdDataF,?pnTipCentralizator,?pnIdGrupaGest)}]
|
|
lnSucces = goExecutor.oExecute(lcSql,[crssubgrupe])
|
|
_Screen.MousePointer = 0
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,64,"Eroare")
|
|
Else
|
|
_Screen.MousePointer = 11
|
|
lcSql = [{call pack_gest_rapoarte.centr_iesiri(?pnIdGestiune,?gnIdSucursala,?pdDataI,?pdDataF,?pnTipCentralizator,?pnIdGrupaGest)}]
|
|
lnSucces = goExecutor.oExecute(lcSql,[crsraport])
|
|
_Screen.MousePointer = 0
|
|
If lnSucces < 0
|
|
amessagebox(goExecutor.cEroare,64,"Eroare")
|
|
Else
|
|
If Reccount('crsraport') > 0
|
|
pcDataOra = get_ora(2)
|
|
Select subgrupa From crssubgrupe Into Array laNumeColoane
|
|
If Alen(laNumeColoane) >= 11
|
|
pnNrRapoarte = 2
|
|
Local ox As ReportListener
|
|
ox = Createobject('ReportListener')
|
|
ox.DynamicLineHeight = .F.
|
|
ox.ListenerType = 1
|
|
goExport.export2frx([crsraport],[rap_centralizator_iesiri],.F.,2,[],[NOPAGEEJECT],ox)
|
|
goExport.export2frx([crsraport],[rap_centralizator_iesiri2],.F.,2,[],[],ox)
|
|
Release ox
|
|
Else
|
|
pnNrRapoarte = 1
|
|
goExport.export2frx([crsraport],[rap_centralizator_iesiri], , , , , , .T.)
|
|
Endif
|
|
Release laNumeColoane
|
|
Else
|
|
amessagebox("Nu exista inregistrari pentru listare!",48,"Atentie")
|
|
Endif
|
|
Endif
|
|
If Used('crsraport')
|
|
Use In crsraport
|
|
Endif
|
|
Endif
|
|
If Used('crssubgrupe')
|
|
Use In crssubgrupe
|
|
EndIf
|
|
If Used('crsStatisticiStoc')
|
|
Use in crsStatisticiStoc
|
|
EndIf
|
|
Endif
|
|
Endif
|
|
Release pnIdGestiune,pcNumeGestiune,pcDataOra,pnNrRapoarte,loCauta,lcSql,pcTitlu,pnIdGrupaGest,pcNumeGrupaGest,pdDataI,pdDataF,lofrmperioada
|
|
Endproc && list_centr_iesiri
|
|
************************************************************************************************************** |