2051 lines
78 KiB
Plaintext
2051 lines
78 KiB
Plaintext
*!* 19.08.2014
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz: adaugare camp UM pe listare deviz, comanda
|
||
|
||
*!* 14.11.2014
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz - materialele se listeaza in ordinea adaugarii pe bon in rulaj (la fel ca in gestiuni)
|
||
*!* #4076
|
||
|
||
*!* 14.11.2014
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz - Daca nu cumulez materialele, pot aparea piese date in consum si aceleasi piese pe retur, care ar fi trebuit sa fie pe 0 cantitativ si sa nu apara in deviz
|
||
*!* apar in ordinea din bon, dar cumulate, daca sunt mai multe aparitii pentru acelasi articol
|
||
|
||
*!* 25.11.2014
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz: se listeaza nrfact/datafact pe deviz
|
||
|
||
*!* 25.11.2014
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz: ?pnIdOrdl in loc de valoarea id-ului - hard parse in baza de date si dureaza f mult
|
||
|
||
*!* 25.04.2019
|
||
*!* marius.mutu
|
||
*!* listare_comanda_deviz - pcExecutant - numele mecanicilor pentru listarea pe rap_deviz.frx la Executant
|
||
|
||
************************************************************************************************************************
|
||
**** Obiecte
|
||
**** oDateFacturaDevize
|
||
**** Proceduri
|
||
**** listare_deviz
|
||
**** listare_comenzi_validate
|
||
**** listare_comanda
|
||
**** listare_raport_comanda
|
||
**** listarefacturi_itp
|
||
**** listarefacturi_spalare
|
||
**** listarefacturi_sectie
|
||
**** facturi_emise_pe_asig
|
||
**** listare_masiniclienti -- neapelata
|
||
**** listare_clientiadrese -- neapelata
|
||
**** fact_emi -- neapelata
|
||
**** fact_ord_em -- neapelata
|
||
**** list_man_tot_desf
|
||
**** list_man_tot_com
|
||
**** list_comanda
|
||
**** listare_precomanda -- nu se mai foloseste in factureaza
|
||
**** listare_avans
|
||
**** listare_factura
|
||
**** creare_bon_fiscal -- apelata din actbaza.verfi.Terminat1.click
|
||
**** listare_bon_fiscal
|
||
**** facturi_emise_pe_sectii
|
||
**** manopera_sectii_anfabr
|
||
**** manopera_sectii_anfabr_centralizator
|
||
**** manopera_sectii
|
||
**** devize_pe_marci_de_masini
|
||
************************************************************************************************************************
|
||
Define Class oDateFacturaDevize As Custom
|
||
ntipfactura = 0
|
||
devize_multiple = 0
|
||
listanrord = []
|
||
dataact = {}
|
||
datascad = {}
|
||
serie_act = []
|
||
nract = 0
|
||
id_client = Null
|
||
nume_client = []
|
||
nume_responsabil= [] && alte date pentru facturare
|
||
BIresp = []
|
||
CNPresp = []
|
||
id_delegat = Null
|
||
nume_delegat = []
|
||
BIdelegat = []
|
||
elibdelegat = []
|
||
CNPdelegat = []
|
||
eliberatde = []
|
||
nrinmat_del = []
|
||
proc_tva = 0
|
||
nrchit = 0
|
||
datachit = {}
|
||
sumaachit = 0
|
||
sumavorbe = []
|
||
text_aditional = []
|
||
|
||
Procedure Init
|
||
Lparameters tnIdPartener,tcSirNrord,tcNrInmat,tnDevize,tnTipFactura
|
||
With This
|
||
.id_client = tnIdPartener
|
||
.nrinmat_del = tcNrInmat
|
||
.devize_multiple = tnDevize
|
||
.listanrord = tcSirNrord
|
||
.nTipFactura = tnTipFactura
|
||
Endwith
|
||
Endproc
|
||
|
||
Enddefine
|
||
************************************************************************************************************************
|
||
************************************************* INCEPUT : listare_deviz **********************************************
|
||
Procedure listare_comanda_deviz
|
||
Lparameters toFereastra,toComanda,tnTip
|
||
Local lcSql,lnSucces,llReturn,lcCursorManopera,lcCursorMateriale,llCursorManopera,llCursorMateriale,lcCursorDateClient, lcCursorDateFirma, lcCursorDeviz, lcSetareRaport
|
||
Private pnTipDeviz, pcDataOra
|
||
PRIVATE pcExecutant
|
||
pcExecutant = ''
|
||
pnTipDeviz = Iif(toComanda.Validat=1 And !Empty(tnTip),2,1)
|
||
llReturn = .T.
|
||
lcCursorManopera = [oper]
|
||
lcCursorRulaje = [rul]
|
||
lcCursorMateriale = [rulcumulat]
|
||
lcCursorDateClient = [crsdateclient]
|
||
lcCursorDateFirma = [crsdatefirma]
|
||
lcCursorDeviz = [crslistare]
|
||
llCursorManopera = Used(lcCursorManopera)
|
||
llCursorMateriale = Used(lcCursorRulaje)
|
||
|
||
pcDataOra = get_ora(2)
|
||
|
||
If !llCursorManopera
|
||
*!* row_number() over (order by datai,id_oper) as nrcrt,
|
||
lcSql = [select id_ordl,codop,timpn,pret,denop,datai,id_oper ] + ;
|
||
[from ] + gcS + [.auto_voper where id_ordl = ] + Alltrim(Str(toComanda.id_ordl)) + [ and ] + ;
|
||
[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12 ] + ;
|
||
[order by 1]
|
||
llSucces = goExecutor.oExecuta(lcSql,lcCursorManopera)
|
||
llReturn = m.llSucces
|
||
|
||
IF m.llSucces
|
||
TEXT TO lcSql TEXTMERGE NOSHOW
|
||
select STRINGAGG(denumire) as mecanic
|
||
from (select distinct d.nume || ' ' || d.prenume as denumire
|
||
from dev_oper_mecanici a
|
||
join dev_oper b
|
||
on (a.id_oper = b.id_oper and b.sters = 0)
|
||
join dev_mecanici c
|
||
on a.id_mecanic = c.id_mecanic
|
||
join nom_parteneri d
|
||
on c.id_part = d.id_part
|
||
where a.sters = 0
|
||
and b.id_ordl = <<toComanda.id_ordl>>)
|
||
ENDTEXT
|
||
|
||
llSucces = goExecutor.oSelecteaza2Value(lcSql, @pcExecutant)
|
||
llReturn = m.llSucces
|
||
ENDIF && m.llSucces
|
||
|
||
Endif
|
||
If !llCursorMateriale And llReturn
|
||
*!* row_number() over (order by a.dataact,a.id_rul) as nrcrt,
|
||
*!* modificare v 2.0.41 : am inlocuit pack_sesiune.calculeaza_pret_tva cu pack_sesiune.calculeaza_pret_cu_tva
|
||
lcSql = [select a.*,b.denumire,b.codmat, b.um from (] + ;
|
||
[select id_articol,pretv,SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul, ] + ;
|
||
[pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + Alltrim(Str(toComanda.proc_tvav,10,4)) + [,0,2) as pretctva ] + ;
|
||
[from ] + gcS + [.rul where sters = 0 and id_lucrare = ] + Alltrim(Str(toComanda.id_lucrare)) + [ ] + ;
|
||
[group by id_articol,pretv) a ] + ;
|
||
[left join nom_articole b on a.id_articol = b.id_articol ] + ;
|
||
[order by a.id_rul]
|
||
|
||
*** Daca nu cumulez articolele, pot aparea piese date in consum si aceleasi piese pe retur, care ar fi trebuit sa fie pe 0 cantitativ si sa nu apara in deviz
|
||
*!* TEXT TO lcSql TEXTMERGE NOSHOW
|
||
*!* select a.id_articol,a.pretv,a.cante,a.dataact,a.id_rul,
|
||
*!* pack_sesiune.calculeaza_pret_cu_tva(a.pretv,1,pack_def.GetIdMonedaNationala(),<<Alltrim(Str(toComanda.proc_tvav,10,4))>>, 0, 2) as pretctva,
|
||
*!* b.denumire,b.codmat, b.um
|
||
*!* from rul a left join nom_articole b on a.id_articol = b.id_articol
|
||
*!* where a.sters = 0 and a.id_lucrare = <<Alltrim(Str(toComanda.id_lucrare))>>
|
||
*!* order by a.id_rul
|
||
*!* ENDTEXT
|
||
|
||
*!* where a.cante <> 0
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursorMateriale)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,16,'Eroare')
|
||
llReturn = .F.
|
||
Endif
|
||
ELSE
|
||
*!* modificare v 2.0.41 : am inlocuit tva cu pretctva
|
||
Select codmat,denumire,um,pretv,pretctva,Sum(cante) As cante,Min(dataact) As dataact,Min(id_rul) As id_rul ;
|
||
From (lcCursorRulaje) ;
|
||
Group By codmat,denumire,um,pretv,pretctva ;
|
||
ORDER BY 8 ;
|
||
INTO Cursor (lcCursorMateriale)
|
||
|
||
*** Daca nu cumulez articolele, pot aparea piese date in consum si aceleasi piese pe retur, care ar fi trebuit sa fie pe 0 cantitativ si sa nu apara in deviz
|
||
*!* Select codmat,denumire,um,cante,pretv,pretctva,dataact,id_rul ;
|
||
*!* From (lcCursorRulaje) ;
|
||
*!* ORDER BY id_rul ;
|
||
*!* INTO Cursor (lcCursorMateriale)
|
||
|
||
Endif
|
||
If Used(lcCursorManopera) And Used(lcCursorMateriale) And llReturn
|
||
If Reccount(lcCursorManopera)>0 Or Reccount(lcCursorMateriale)>0
|
||
Private pnTotalMatDeviz,pnTotalTVAMatDeviz,pnTotalManDeviz,pnTotalTvaDeviz, pnIdOrdl
|
||
*!* modificare v 2.0.37 : am pus a.kmint in loc de b.kmint
|
||
pnIdOrdl = toComanda.id_ordl
|
||
lcSql=[select a.nrord,a.nume,a.cod_fiscal,a.datai,a.asigurator,a.inspector,] + ;
|
||
[a.banca,a.cont_banca,a.adresa,a.nr_dosar,a.reg_comert,a.tip_persoana,] + ;
|
||
[b.nrinmat,b.series,b.seriem,b.culoare,a.kmint,a.ore_functionare,b.marca,b.masina ] + ;
|
||
[from ] + gcS + [.auto_vordl a ] + ;
|
||
[left join ] + gcS + [.auto_vmasiniclienti b on a.id_masiniclient=b.id_masiniclient ] + ;
|
||
[where a.id_ordl=?pnIdOrdl] && + Alltrim(Str(toComanda.id_ordl))
|
||
|
||
lnSucces=goExecutor.oExecute(lcSql,lcCursorDateClient)
|
||
If lnSucces<0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
Select (lcCursorDateClient)
|
||
Scatter Name olistare Memo
|
||
ADDPROPERTY(olistare,"proc_tvav",toComanda.proc_tvav)
|
||
Use In (lcCursorDateClient)
|
||
|
||
ADDPROPERTY(olistare, 'nrfact', IIF(TYPE('toComanda.nrfact') <> 'U', toComanda.nrfact, 0))
|
||
ADDPROPERTY(olistare, 'datafact', IIF(TYPE('toComanda.datafact') <> 'U', toComanda.datafact, {}))
|
||
|
||
Select (lcCursorMateriale)
|
||
*!* modificare v 2.0.41 : am inlocuit tva cu pretctva
|
||
Calculate Sum(Round(cante*pretv,gnPc)),Sum(Round(cante*pretctva,gnPc)) To pnTotalMatDeviz,pnTotalCTVAMatDeviz
|
||
|
||
Select (lcCursorManopera)
|
||
Calculate Sum(Round(timpn*Pret,gnPc)) To pnTotalManDeviz
|
||
*!* modificare v 2.0.41 : am inlocuit pnTotalTvaMatDeviz cu pnTotalCTVAMatDeviz-pnTotalMatDeviz
|
||
pnTotalTvaDeviz=Iif(glAutoBonDet,pnTotalCTVAMatDeviz-pnTotalMatDeviz,Round(pnTotalMatDeviz*(toComanda.proc_tvav-1),gnPc))+Round(pnTotalManDeviz*(toComanda.proc_tvav-1),gnPc)
|
||
|
||
Select id_rul as id,olistare.nrord As nrord,'A' As semn,codmat,denumire,PADR(um,10, ' ') as um,cante,pretv As Pret,;
|
||
dataact as data From (lcCursorMateriale) Where cante <> 0 ;
|
||
UNION All ;
|
||
SELECT id_oper as id,olistare.nrord As nrord,'B' As semn,codop As codmat,denop As denumire, PADR('ORE',10, ' ') as um,;
|
||
timpn As cante,Pret,datai as data ;
|
||
From (lcCursorManopera) Order By 3,1 Into Cursor (lcCursorDeviz)
|
||
|
||
If toComanda.Validat = 1
|
||
lcSql = [select localitate,strada,numar,adresa,cod_fiscal,reg_comert from syn_nom_firme where ] + ;
|
||
[id_firma = ?gnIdFirma]
|
||
lnSucces=goExecutor.oExecute(lcSql,lcCursorDateFirma)
|
||
If lnSucces<0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
llReturn = .F.
|
||
Else
|
||
Select (lcCursorDateFirma)
|
||
Scatter Name firma
|
||
Use In (lcCursorDateFirma)
|
||
lcRaport = [rap_deviz]
|
||
*!* modificare MIX 07.09.2007
|
||
*!* Select crslistare
|
||
*!* *!* modificare 09.08.2006
|
||
*!* Locate For Like('MIX*',denumire) And semn=='A'
|
||
*!* If Found()
|
||
*!* Calculate Sum(Round(cante*Pret,gnPc)),Max(Recno()) To lnSumaMix,lnNrCrt For Like('MIX*',denumire) And semn='A'
|
||
*!* If Used('crslistare2')
|
||
*!* Use In crslistare2
|
||
*!* Endif
|
||
*!* Select Recno() As nrcrtord,* From crslistare Where !(Like('MIX*',denumire) And semn='A') Into Cursor crslistare2 Readwrite
|
||
*!* Select crslistare2
|
||
*!* Append Blank
|
||
*!* Replace codmat With '',denumire With 'MIX',semn With 'A',Pret With lnSumaMix,cante With 1,nrcrtord With lnNrCrt,nrord With olistare.nrord
|
||
*!* Use In crslistare
|
||
*!* Select * From crslistare2 Into Cursor crslistare Order By nrcrtord
|
||
*!* Use In crslistare2
|
||
*!* Endif
|
||
*!* modificare MIX 07.09.2007 ^
|
||
Endif
|
||
Else
|
||
lcRaport = [rap_comanda]
|
||
Endif
|
||
If llReturn
|
||
toFereastra.AlwaysOnTop=.F.
|
||
lcSetareRaport = SET("ReportBehavior")
|
||
Set REPORTBEHAVIOR 90
|
||
Select (lcCursorDeviz)
|
||
Go Top
|
||
|
||
goExport.export2frx(lcCursorDeviz,lcRaport,.F., , , , , .T.) && modificare v 2.1.9
|
||
Set REPORTBEHAVIOR &lcSetareRaport
|
||
toFereastra.AlwaysOnTop=.T.
|
||
Use In (lcCursorDeviz)
|
||
Endif
|
||
Release pnTotalMatDeviz,pnTotalTVAMatDeviz,pnTotalManDeviz,pnTotalTvaDeviz
|
||
Endif
|
||
Else
|
||
amessagebox("Nu exista manopera si materiale pe comanda " + Alltrim(toComanda.nrord)+ "!",0+48,"Atentie")
|
||
Endif
|
||
Endif
|
||
If !llCursorManopera
|
||
Use In (SELECT((lcCursorManopera)))
|
||
Endif
|
||
Use In (Select((lcCursorMateriale)))
|
||
Release lcSql,lnSucces,llReturn,lcCursorManopera,lcCursorMateriale,llCursorManopera,llCursorMateriale,lcCursorDateClient, lcCursorDateFirma, pnTipDeviz, lcSetareRaport
|
||
Endproc && listare_deviz
|
||
************************************************* SFARSIT : listare_deviz **********************************************
|
||
******************************************* INCEPUT : listare_comenzi_validate ****************************************
|
||
Procedure listare_comenzi_validate
|
||
Parameters tnTip
|
||
|
||
&& 1:POST GARANTIE; 2:GARANTIE; 3:REGIE; 4:PREGATIRE; 5:REGIE2 ; 6:PRODUCTIE;
|
||
Local lcSql, lcCursor, lnSucces, lcTip
|
||
|
||
Do Case
|
||
Case tnTip = 1
|
||
lcTip = 'POST GARANTIE'
|
||
Case tnTip = 2
|
||
lcTip = 'GARANTIE'
|
||
Case tnTip = 3
|
||
lcTip = 'REGIE'
|
||
Case tnTip = 4
|
||
lcTip = 'PREGATIRE'
|
||
Case tnTip = 5
|
||
lcTip = 'REGIE 2'
|
||
Case tnTip = 6
|
||
lcTip = 'PRODUCTIE'
|
||
Endcase
|
||
|
||
If Used('crscomenzi')
|
||
Use In crscomenzi
|
||
Endif
|
||
lcSql = [select datai,nrord,nume,manopera,materiale ] + ;
|
||
[from auto_validare_comenzi where validat = 1 and ] + ;
|
||
[extract(month from dataoravalid) + extract(year from dataoravalid) * 12 = ?gnLuna + ?gnAn * 12 ] + ;
|
||
[and id_tip = ?tnTip]
|
||
lcCursor = [crscomenzi]
|
||
_Screen.MousePointer = 11
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Return
|
||
Endif
|
||
_Screen.MousePointer = 0
|
||
|
||
If Reccount('crscomenzi')=0
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Else
|
||
Private pcTitlu,pcDataOra
|
||
pcDataOra=get_ora(2)
|
||
pcTitlu=[CENTRALIZATOR COMENZI ] + lcTip + [ VALIDATE <20>N LUNA ] + Padl(Alltrim(Str(gnLuna)),2,[0]) + [/] + Alltrim(Str(gnAn))
|
||
gofundal.Visible=.F.
|
||
Keyboard "{ctrl+f10}"
|
||
Select crscomenzi
|
||
Report Form centralizator_devize To Printer Prompt Preview
|
||
*!* DO LISTAREUSERREPORT WITH "crscomenzi", "FRX", "centralizator_devize" IN PROCEDURI_RAPOARTE.PRG
|
||
gofundal.Visible=.T.
|
||
Endif
|
||
|
||
If Used('crscomenzi')
|
||
Use In crscomenzi
|
||
Endif
|
||
Endproc
|
||
******************************************* SFARSIT : listare_comenzi_validate ****************************************
|
||
************************************************ INCEPUT : listare_comanda *********************************************
|
||
* Listare precomanda
|
||
Procedure listare_comanda_old_de_sters
|
||
Lparameters tnIdTip
|
||
Private pofirma,pocomanda,pcschema1,pcselect1,pddataora
|
||
Store '' To pofirma,pocomanda
|
||
|
||
pcschema=['']
|
||
pcselect=['select adresa,localitate,strada,numar,cod_fiscal from syn_nom_firme where 1=2']
|
||
pcorder=[]
|
||
pcfiltru=[id_firma = ]+Alltrim(Str(gnIdFirma)) && modificare v 2.0.29 : am inlocuit gnId_Firma
|
||
llAfiseaza=.F.
|
||
gencursor('pofirma','crsFirma',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pofirma.ca_baza1.afisare()
|
||
Sele crsfirma
|
||
Scatter Name firma Memo
|
||
|
||
pddataora = get_ora()
|
||
|
||
pcschema=['']
|
||
pcselect=['select cod_fiscal,adresa,telefon,sysdate as dataora from vnom_parteneri where ']
|
||
pcorder=[]
|
||
pcfiltru=[id_part=]+Alltrim(Str(ocomlistare.nidclie))
|
||
llAfiseaza=.F.
|
||
gencursor('pocomanda','crsComanda',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pocomanda.ca_baza1.afisare()
|
||
Select crsComanda
|
||
Scatter Name ocom Memo
|
||
AddProperty(ocom,'marca',ocomlistare.marca)
|
||
AddProperty(ocom,'nrinmat',ocomlistare.nrinmat)
|
||
AddProperty(ocom,'masina',ocomlistare.masina)
|
||
AddProperty(ocom,'nrord',ocomlistare.nrord)
|
||
AddProperty(ocom,'nume',ocomlistare.nume)
|
||
AddProperty(ocom,'series',ocomlistare.series)
|
||
AddProperty(ocom,'seriem',ocomlistare.seriem)
|
||
AddProperty(ocom,'asigurator',ocomlistare.asigurator)
|
||
AddProperty(ocom,'inspector',ocomlistare.inspector)
|
||
AddProperty(ocom,'kmint',ocomlistare.kmint)
|
||
AddProperty(ocom,'furnizor',ocomlistare.furnizor)
|
||
AddProperty(ocom,'nrachi',ocomlistare.nrachi)
|
||
*!* AddProperty(ocom,'dataachi',ocomlistare.dataachi)
|
||
AddProperty(ocom,'anfabricatie',ocomlistare.anfabricatie)
|
||
AddProperty(ocom,'termen',ocomlistare.termen)
|
||
AddProperty(ocom,'datai',Ttod(ocom.dataora))
|
||
AddProperty(ocom,'nr_dosar',ocomlistare.nr_dosar)
|
||
*!* modificare v 2.0.9
|
||
ADDPROPERTY(ocom,'solicitari_client',ocomlistare.solicitari_client)
|
||
*!* modificare v 2.0.9 ^
|
||
nrord=ocom.nrord
|
||
listare_raport_comanda([CRSCOMANDA],tnIdTip)
|
||
|
||
Use In crsComanda
|
||
Use In crsfirma
|
||
|
||
Endproc
|
||
************************************************ SFARSIT : listare_comanda *********************************************
|
||
|
||
******************************************** INCEPUT : listare_raport_comanda ******************************************
|
||
Procedure listare_raport_comanda
|
||
Lparameters lcCursor,tnTipComanda
|
||
If gnTip_LPrecomanda = 1 && cu tipizate
|
||
lcRaport = [_PRECO]
|
||
Else
|
||
If tnTipComanda=2
|
||
lcRaport = [PRECOG]
|
||
Else
|
||
lcRaport = [PRECO]
|
||
Endif
|
||
Endif
|
||
*!* modificare v 2.0.5
|
||
*!* Do LISTAREUSERREPORT With lcCursor, "FRX", lcRaport In PROCEDURI_RAPOARTE.PRG
|
||
goExport.export2frx(lcCursor,lcRaport,.F., , , , , .T.) && modificare v 2.1.9
|
||
*!* modificare v 2.0.5
|
||
Endproc
|
||
******************************************** SFARSIT : listare_raport_comanda ******************************************
|
||
*********************************************** INCEPUT : listarefacturi_itp *******************************************
|
||
Procedure listarefacturi_itp
|
||
If Type('gnId_Sectie_ITP') = 'U' Or Empty(gnId_Sectie_ITP) Or Isnull(gnId_Sectie_ITP)
|
||
amessagebox("Alegeti sectia de ITP din Configurare > Optiuni !",0+48,"Atentie")
|
||
Return
|
||
Endif
|
||
|
||
Do listarefacturi_sectie With gnId_Sectie_ITP,gnId_Set_ITP
|
||
Endproc
|
||
*********************************************** SFARSIT : listarefacturi_itp *******************************************
|
||
********************************************* INCEPUT : listarefacturi_spalare *****************************************
|
||
Procedure listarefacturi_spalare
|
||
If Type('gnId_Sectie_Spalare') = 'U' Or Empty(gnId_Sectie_Spalare) Or Isnull(gnId_Sectie_Spalare)
|
||
amessagebox("Alegeti sectia de spalare din Configurare > Optiuni !",0+48,"Atentie")
|
||
Return
|
||
Endif
|
||
|
||
Do listarefacturi_sectie With gnId_Sectie_Spalare,gnId_Set_Spalare
|
||
Endproc
|
||
********************************************* SFARSIT : listarefacturi_spalare *****************************************
|
||
********************************************* INCEPUT : listarefacturi_sectie ******************************************
|
||
Procedure listarefacturi_sectie
|
||
Lparameters tnIdSectie,tnIdSet
|
||
Private pcsectie,pcDataOra
|
||
If Used('crssectie')
|
||
Use In crssectie
|
||
Endif
|
||
lcSql = [select sectie from ] + gcS + [.vnom_sectii where id_sectie = ] + Alltrim(Str(tnIdSectie))
|
||
lcCursor = [crssectie]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Return
|
||
Endif
|
||
Select crssectie
|
||
pcsectie=Alltrim(sectie)
|
||
Use In crssectie
|
||
|
||
pcDataOra=get_ora(2)
|
||
|
||
If Used('crsfacturi')
|
||
Use In crsfacturi
|
||
Endif
|
||
lcSql = [select distinct nrord,NVL(serie_act,'')||nract as nrfact,dataact as datafact,partd as nume,] + ;
|
||
[sum(case when scc='704' then suma else 0 end) over (partition by id_lucrare) as manopera,] + ;
|
||
[sum(case when scc='4428' or (scc = '4427' and scd <> '4428') then suma else 0 end) over (partition by id_lucrare) as tva ] + ;
|
||
[from ] + gcS + [.vact where scd='4111' and id_sectie = ] + Alltrim(Str(tnIdSectie)) + [ ] + ;
|
||
[and id_set = ] + Alltrim(Str(tnIdSet)) + [ ] + ;
|
||
[and luna=] + Alltrim(Str(gnLuna)) + [ and an=] + Alltrim(Str(gnAn))
|
||
lcCursor = [crsfacturi]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Return
|
||
Endif
|
||
|
||
If Reccount('crsfacturi')=0
|
||
Use In crsfacturi
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Select crsfacturi
|
||
Report Form facturisectie To Printer Prompt Preview
|
||
Use In crsfacturi
|
||
|
||
Endproc
|
||
********************************************* SFARSIT : listarefacturi_sectie ******************************************
|
||
********************************************* INCEPUT : facturi_emise_pe_asig ******************************************
|
||
Procedure facturi_emise_pe_asig
|
||
Private ofrmopt,ofrminterval,ofrmaleg,pnButon,pcAnLuna1,pcAnLuna2,pnOptiune,pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
|
||
Store '' To ofrmaleg,pofacturi
|
||
|
||
pnOptiune=1
|
||
pnButon=1
|
||
lcTitlu="RAPORT FACTURI EMISE"
|
||
lcIntrebare="Doriti ca raportul sa contina :"
|
||
lnNrOptiuni=2
|
||
ofrmopt=Createobject("frm_optiune",lcTitlu,lcIntrebare,lnNrOptiuni)
|
||
ofrmopt.ogOptiuni.option1.Caption="Doar facturile cu asiguratori"
|
||
ofrmopt.ogOptiuni.option2.Caption="Toate facturile"
|
||
ofrmopt.Show(1)
|
||
|
||
Release ofrmopt
|
||
If pnButon<>1
|
||
Return
|
||
Endif
|
||
lcView=Iif(pnOptiune=1,[auto_facturi_asig],[auto_facturi_toate])
|
||
|
||
pnButon=1
|
||
pcAnLuna1=Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2=pcAnLuna1
|
||
ofrminterval=Createobject('frm_interval_luni')
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
|
||
If pnButon=1
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra
|
||
Local lnNrLuni1,lnNrLuni2
|
||
lnNrLuni1=Val(Substr(pcAnLuna1,1,2))+Val(Substr(pcAnLuna1,3))*12
|
||
lnNrLuni2=Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12
|
||
pcDataOra = get_ora(2)
|
||
pcschema=['']
|
||
pcorder=[]
|
||
pcselect=['select * from ] + gcS + [.]+lcView+[ where 1=2']
|
||
pcfiltru=[extract(month from dataact)+extract(year from dataact)*12 ]+;
|
||
[between ]+Alltrim(Str(lnNrLuni1))+[ and ]+Alltrim(Str(lnNrLuni2))
|
||
llAfiseaza=.F.
|
||
gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pofacturi.ca_baza1.afisare()
|
||
_Screen.MousePointer=0
|
||
|
||
If Reccount('crsfacturi')=0
|
||
Use In crsfacturi
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport facturi emise pe asiguratori")
|
||
Return
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'LISTA FACTURILOR EMISE PE ASIGURATORI'
|
||
pcPerioada = Iif(lnNrLuni1==lnNrLuni2,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select crsfacturi
|
||
Report Form rap_facturi_asig To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[asigurator,nrord,nract,TTOD(dataact),nume,manopera,materiale,]+;
|
||
[valctva-manopera-materiale,valctva]
|
||
lcSirNume=[Asigurator,Nr_comanda,Nr_factura,Data_factura,Nume,Manopera,Materiale,Tva,Valoare_cu_tva]
|
||
exportare('crsfacturi',lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Use In crsfacturi
|
||
Endif
|
||
Endif
|
||
|
||
Endproc
|
||
********************************************* SFARSIT : facturi_emise_pe_asig ******************************************
|
||
*******************************************
|
||
* PROCEDURE listare_masiniclienti( )
|
||
* Data/ora : 01/27/05, 15:21:24
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure listare_masiniclienti( )
|
||
Private pomasinicl,pcschema1,pcselect1
|
||
Store '' To pomasinicl
|
||
|
||
pcschema1=['']
|
||
pcselect1=['select * from ] + gcS + [.auto_vmasiniclienti where 1=2']
|
||
pcorder1= [partener]
|
||
pcfiltru1 = [1 = 1]
|
||
gencursor('pomasinicl','climas',pcselect1,pcfiltru1,pcschema1,pcorder1)
|
||
pomasinicl.ca_baza1.afisare()
|
||
|
||
If Reccount('climas')=0
|
||
Use In climas
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Select climas
|
||
|
||
Private pcTitlu,pcDataOra
|
||
Store '' To pcTitlu,pcDataOra
|
||
pcTitlu = 'CLIEN<45>I'
|
||
pcDataOra = get_ora(2)
|
||
Select climas
|
||
Report Form clie To Printer Prompt Preview
|
||
|
||
Endproc
|
||
**********************sfarsit procedura listare_masiniclienti*******************
|
||
|
||
*******************************************
|
||
* PROCEDURE listare_clientiadrese( )
|
||
* Data/ora : 01/27/05, 15:27:46
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure listare_clientiadrese( )
|
||
*!* sele clie
|
||
*!* set order to tag nume
|
||
*!* report form clieadresa to printer prompt preview
|
||
|
||
|
||
*!* Private pocl,pcschema1,pcselect1
|
||
*!* Store '' To pocl
|
||
|
||
*!* pcschema1=['']
|
||
|
||
lcSql = [select n.denumire as nume, n.cod_fiscal, n.id_part,n.telefon,N.ADRESA,n.zona from ]+gcS+[.vnom_parteneri n where n.id_part in (select id_part from ]+gcS+[.Vcoresp_tip_part where id_tip_part in (select id_tip_part from ]+gcS+[.vcoresp_tip_cont where cont = '4111'))]
|
||
lcCursor = [clie]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
|
||
If Reccount('clie')=0
|
||
Use In clie
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Private pcTitlu,pcDataOra
|
||
Store '' To pcTitlu,pcDataOra
|
||
pcTitlu = 'CLIEN<45>I'
|
||
pcDataOra = get_ora(2)
|
||
Select clie
|
||
Report Form clieadresa To Printer Prompt Preview
|
||
|
||
Endproc
|
||
|
||
**********************sfarsit procedura listare_clientiadrese*******************
|
||
*******************************************
|
||
* PROCEDURE fact_emi( )
|
||
* Data/ora : 01/28/05, 09:06:56
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure fact_ord_em
|
||
Private ofrmopt,ofrminterval,ofrmaleg,pnButon,pcAnLuna1,pcAnLuna2,pnOptiune,pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
|
||
Private pddataora,pcDataOra
|
||
Store '' To ofrmaleg,pofacturi
|
||
|
||
pnOptiune=1
|
||
pnButon=1
|
||
|
||
pnButon=1
|
||
pddataora = get_ora()
|
||
pcDataOra=Ttoc(pddataora)
|
||
pdData1=Ttod(pddataora)
|
||
pdData2=pdData1
|
||
ofrminterval=Createobject('frm_interval_zile')
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
|
||
If pnButon=1
|
||
_Screen.MousePointer=11
|
||
Local lnNrLuni1,lnNrLuni2
|
||
pcschema=['']
|
||
pcorder=[]
|
||
pcselect=['select * from ] + gcS + [.auto_facturi_clienti where 1=2']
|
||
pcfiltru=[dataact between to_date(']+Alltrim(Dtoc(pdData1))+[','DD/MM/YYYY') ]+;
|
||
[and to_date(']+Alltrim(Dtoc(pdData2))+[','DD/MM/YYYY') ]
|
||
llAfiseaza=.F.
|
||
gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pofacturi.ca_baza1.afisare()
|
||
_Screen.MousePointer=0
|
||
|
||
If Reccount('crsfacturi')=0
|
||
Use In crsfacturi
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport facturi emise pe clienti")
|
||
Return
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'LISTA FACTURILOR EMISE PE CLIEN<45>I'
|
||
pcPerioada = Iif(pdData1=pdData2,;
|
||
'Ziua '+Dtoc(pdData1),;
|
||
'Perioada '+Dtoc(pdData1)+' - '+Dtoc(pdData2))
|
||
Select crsfacturi
|
||
*!* Report Form rap_facturi_clienti To Printer Prompt Preview
|
||
goExport.export2frx("crsFacturi","rap_facturi_clienti",.F., , , , , .T.)
|
||
Case pnOptiune=2
|
||
lcSirColoane=[TTOD(dataact),nrord,nract,nume,telefon,manopera,materiale,]+;
|
||
[valctva-manopera-materiale,valctva]
|
||
lcSirNume=[Data_factura,Nr_comanda,Nr_factura,Nume,Telefon,Manopera,Materiale,Tva,Valoare_cu_tva]
|
||
exportare('crsfacturi',lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Use In crsfacturi
|
||
Endif
|
||
Endif
|
||
|
||
Endproc
|
||
**********************sfarsit procedura fact_ord_em*******************
|
||
*****************************************
|
||
Procedure fact_emi( )
|
||
Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
|
||
Store '' To pofacturi
|
||
pcschema=['NRCRT n(5),NRORD c(50),DATAI d,NUME c(50),MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
|
||
['ASIGURATOR c(24),INSPECTOR c(24),NRINMAT c(35),'+]+;
|
||
['NRACT n(14),DATAACT d,VALCTVA n(19,2)']
|
||
pcorder=[a.asigurator]
|
||
pcselect=['select row_number() over (partition by a.nrord order by ] + pcorder + [) as nrcrt,'+]+;
|
||
['a.nrord,a.datai,a.nume,a.manopera,a.materiale,a.asigurator,'+]+;
|
||
['a.inspector,a.nrinmat,'+]+;
|
||
['b.nract,b.dataact,b.precdeb+b.debit as valctva '+]+;
|
||
['from ] + gcS + [.auto_vvalid_comenzi a '+]+;
|
||
['join ] + gcS + [.vireg_parteneri b on a.id_lucrare=b.id_lucrare '+]+;
|
||
['where 1=2']
|
||
pcfiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn)) + [ and a.facturat = 1]
|
||
*!* pcselect=['select row_number() over (partition by a.nrord order by ] + pcorder + [) as nrcrt,'+]+;
|
||
*!* ['a.nrord,a.datai,a.nume,a.manopera,a.materiale as materiale,a.asigurator,'+]+;
|
||
*!* ['a.inspector,a.tip_incas,a.numar,a.nrinmat,b.nract,b.dataact,'+]+;
|
||
*!* ['(b.precdeb+b.debit)*]+ALLTRIM(STR(m.ctvam,4,2))+[ as valctva '+]+;
|
||
*!* ['from ] + gcS + [.dev_vvalid_comenzi a '+]+;
|
||
*!* ['join ] + gcS + [.vireg_parteneri b on a.id_lucrare=b.id_lucrare '+]+;
|
||
*!* ['where 1=2']
|
||
*!* pcfiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn)) + [ and a.facturat = 1 ] + ;
|
||
*!* [and b.id_set in (31003,31004,31005,31011,31012)]
|
||
llAfiseaza=.F.
|
||
gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pofacturi.ca_baza1.afisare()
|
||
|
||
If Reccount('crsfacturi')=0
|
||
Use In crsfacturi
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Private pcTitlu,pcDataOra
|
||
Store '' To pcTitlu,pcDataOra
|
||
pcTitlu = 'LISTA FACTURILOR EMISE PE ASIGURATORI'
|
||
pcDataOra = get_ora(2)
|
||
|
||
Select crsfacturi
|
||
*!* BROWSE
|
||
|
||
*!* sele clie
|
||
*!* set order to tag codc
|
||
|
||
*!* sele ordl
|
||
*!* set rela off into clie
|
||
*!* set rela to codc into clie additive
|
||
*!* set filter to facturat
|
||
*!* set order to tag asig
|
||
*Report Form facturia To Printer Prompt Preview
|
||
goExport.export2frx("crsFacturi","facturia",.F., , , , , .T.)
|
||
Use In crsfacturi
|
||
*!* sele ordl
|
||
*!* set order to tag nrord
|
||
*!* set rela off into clie
|
||
|
||
|
||
Endproc
|
||
|
||
**********************sfarsit procedura fact_emi*******************
|
||
|
||
*******************************************
|
||
* PROCEDURE fact_ord_em( )
|
||
* Data/ora : 01/28/05, 09:38:44
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
*!* Procedure fact_ord_em( )
|
||
|
||
*!* Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
|
||
*!* Store '' To pofacturi
|
||
*!* pcschema=['NRCRT n(5),NRORD c(30),DATAI d,NUME c(50),MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
|
||
*!* ['ASIGURATOR c(24),INSPECTOR c(24),NRINMAT c(10),'+]+;
|
||
*!* ['NRACT n(14),DATAACT d,VALCTVA n(19,2)']
|
||
*!* pcorder=[b.dataact]
|
||
*!* pcselect=['select row_number() over (partition by a.nrord order by ] + pcorder + [) as nrcrt,'+]+;
|
||
*!* ['a.nrord,a.datai,a.nume,a.manopera,a.materiale,a.asigurator,'+]+;
|
||
*!* ['a.inspector,a.nrinmat,'+]+;
|
||
*!* ['b.nract,b.dataact,b.precdeb+b.debit as valctva '+]+;
|
||
*!* ['from ] + gcS + [.dev_vvalid_comenzi a '+]+;
|
||
*!* ['join ] + gcS + [.vireg_parteneri b on a.id_lucrare=b.id_lucrare '+]+;
|
||
*!* ['where 1=2']
|
||
*!* pcfiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn)) + [ and facturat = 1]
|
||
*!* llAfiseaza=.F.
|
||
*!* gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
*!* pofacturi.ca_baza1.afisare()
|
||
|
||
*!* If Reccount('crsfacturi')=0
|
||
*!* Use In crsfacturi
|
||
*!* amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
*!* Return
|
||
*!* Endif
|
||
|
||
*!* Private pcTitlu,pcdataora
|
||
*!* Store '' To pcTitlu,pcdataora
|
||
*!* pcTitlu = 'FACTURI EMISE'
|
||
*!* pcdataora = get_ora(2)
|
||
|
||
|
||
*!* Select crsfacturi
|
||
*!* Report Form facturi To Printer Prompt Preview
|
||
|
||
|
||
|
||
*!* Endproc
|
||
|
||
**********************sfarsit procedura fact_ord_em*******************
|
||
*******************************************
|
||
* PROCEDURE list_man_tot_desf( )
|
||
* Data/ora : 01/28/05, 13:50:16
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure list_man_tot_desf(tltotal)
|
||
If tltotal
|
||
lcSelect = ['select * from ] + gcS + [.auto_vmecanici where 2=2']
|
||
oca = cauta_alfa(lcSelect,'1 = 2',[''],'nume','nume,prenume,inactiv','Mecanici','nume,prenume')
|
||
Endif
|
||
|
||
If Type('oca')<>'U' And Empty(oca.id_mecanic)
|
||
amessagebox("Nu ati ales nici un mecanic!",0+48,"Atentie")
|
||
Return
|
||
Endif
|
||
|
||
loTherm = Newobject("_thermometer","_therm","","Rapoarte")
|
||
lcTask = "Generare..."
|
||
_Screen.MousePointer= 11
|
||
With loTherm
|
||
.AlwaysOnTop=.T.
|
||
.Show()
|
||
|
||
lnPercent = 10
|
||
.Update(lnPercent, lcTask)
|
||
distribuire_timp_normat()
|
||
|
||
lnPercent = 65
|
||
.Update(lnPercent, lcTask)
|
||
Private pomasinicl,pcschema1,pcselect1
|
||
Store '' To pomasinicl
|
||
*!* pcschema1=['ID_OPERMECANIC N(10),ID_OPER N(10),ORE N(12,3),INACTIV N(1),ID_MECANIC N(5),'+]+;
|
||
*!* ['NUME C(50),PRENUME C(50),MARCA N(5),ID_SALARIAT N(5),SECTIE C(30),ID_ORDL N(10),'+]+;
|
||
*!* ['PRET N(21,4),DATAI D,NRFACT N,DATAFACT D,DENOP C(100),TIMPN N(8,3),NRORD C(50)']
|
||
pcschema1=['']
|
||
pcselect1=['select t.* from ] + gcS + [.auto_listare_man_tot_desf t where 1=2']
|
||
pcorder1= [t.nume,t.prenume]
|
||
pcfiltru1 = Iif(tltotal,[t.id_mecanic = ] + Alltrim(Str(oca.id_mecanic)) ,[2=2])
|
||
gencursor('pomasinicl','salmec',pcselect1,pcfiltru1,pcschema1,pcorder1)
|
||
pomasinicl.ca_baza1.afisare()
|
||
.Complete()
|
||
.AlwaysOnTop=.F.
|
||
Endwith
|
||
Release loTherm
|
||
_Screen.MousePointer= 0
|
||
|
||
If Reccount('salmec')=0
|
||
Use In salmec
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Select salmec
|
||
|
||
Private pcTitlu,pcDataOra
|
||
Store '' To pcTitlu,pcDataOra
|
||
pcTitlu = 'Manoper<65> -Salarii'
|
||
pcDataOra = get_ora(2)
|
||
Select salmec
|
||
Report Form opersal To Printer Prompt Preview
|
||
Use In salmec
|
||
|
||
Endproc
|
||
|
||
**********************sfarsit procedura list_man_tot_desf*******************
|
||
|
||
*******************************************
|
||
* PROCEDURE list_man_tot_com( )
|
||
* Data/ora : 01/28/05, 15:20:20
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure list_man_tot_com(tltotal)
|
||
If tltotal
|
||
lcSelect = ['select * from ] + gcS + [.auto_vmecanici where 2=2']
|
||
oca = cauta_alfa(lcSelect,'1 = 2',[''],'nume','nume,prenume,inactiv','Mecanici','nume,prenume')
|
||
Endif
|
||
|
||
If Type('oca')<>'U' And Empty(oca.id_mecanic)
|
||
amessagebox("Nu ati ales nici un mecanic!",0+48,"Atentie")
|
||
Return
|
||
Endif
|
||
|
||
loTherm = Newobject("_thermometer","_therm","","Rapoarte")
|
||
lcTask = "Generare..."
|
||
_Screen.MousePointer= 11
|
||
With loTherm
|
||
.AlwaysOnTop=.T.
|
||
.Show()
|
||
|
||
lnPercent = 10
|
||
.Update(lnPercent, lcTask)
|
||
distribuire_timp_normat()
|
||
|
||
lnPercent = 65
|
||
.Update(lnPercent, lcTask)
|
||
Private pomasinicl,pcschema1,pcselect1,pcGrup
|
||
Store '' To pomasinicl
|
||
pcschema1=['']
|
||
pcselect1 = ['select t.* from ] +gcS+ [.auto_listare_man_tot_com t where 1 = 2']
|
||
pcorder1= [t.nume,t.prenume,t.nrord]
|
||
pcfiltru1 = Iif(tltotal,[t.id_mecanic = ] + Alltrim(Str(oca.id_mecanic)),[2=2])
|
||
*!* pcGrup = [t.id_ordl,t.nrord,t.id_mecanic,t.nume,t.prenume,trunc(t.datai),t.sectie]
|
||
llAfiseaza = .F.
|
||
gencursor('pomasinicl','salmec',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
||
pomasinicl.ca_baza1.afisare()
|
||
.Complete()
|
||
.AlwaysOnTop=.F.
|
||
Endwith
|
||
Release loTherm
|
||
_Screen.MousePointer= 0
|
||
|
||
If Reccount('salmec')=0
|
||
Use In salmec
|
||
amessagebox("Nu exista inregistrari pentru listare!",0+64,"Info listare")
|
||
Return
|
||
Endif
|
||
|
||
Private pcTitlu,pcDataOra
|
||
Store '' To pcTitlu,pcDataOra
|
||
pcTitlu = 'Manoper<65> -Salarii'
|
||
pcDataOra = get_ora(2)
|
||
Select salmec
|
||
Report Form opersalCOM To Printer Prompt Preview
|
||
Use In salmec
|
||
|
||
Endproc
|
||
|
||
**********************sfarsit procedura list_man_tot_com*******************
|
||
|
||
|
||
*******************************************
|
||
* PROCEDURE list_comanda( )
|
||
* Data/ora : 01/29/05, 11:05:08
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
****** PARAMETER BLOCK **************
|
||
* Parametri : 0
|
||
*
|
||
*******************************************
|
||
Procedure list_comanda( )
|
||
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
|
||
Store '' To pocomenzi
|
||
If Used('crscomenzi')
|
||
Use In crscomenzi
|
||
Endif
|
||
pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,NUME c(50),NRORD c(50),TIP_COMANDA c(50),VALIDAT N(1),ID_TIP N(5),NR_DOSAR C(40),PROC_TVAV N(10,4)']
|
||
pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.nume,a.nrord,a.tip_comanda,a.validat,a.id_tip,a.nr_dosar,a.proc_tvav '+]+;
|
||
[' from ] + gcS + [.auto_normare_comenzi a where 1=2']
|
||
pcfiltru=[1=2]
|
||
*!* pcFiltru = [(extract(month from datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from datafact) = ]+Alltrim(Str(gnAn)) + [ or datafact is null)]
|
||
|
||
pcorder=[datai,nrord]
|
||
llAfiseaza=.F.
|
||
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pocomenzi.ca_baza1.afisare()
|
||
|
||
ofrmviz=Createobject('frm_com_list')
|
||
ofrmviz.Show(1)
|
||
If Used('crscomenzi')
|
||
Use In crscomenzi
|
||
Endif
|
||
Release pocomenzi
|
||
|
||
Endproc
|
||
|
||
**********************sfarsit procedura list_comanda*******************
|
||
*------------------------------inceput procedura listare_precomanda-----------------------------------------
|
||
Procedure listare_precomanda
|
||
Lparameters tnIdOrdl
|
||
Private pofirma,pocomanda,pcschema1,pcselect1,pddataora
|
||
Store '' To pofirma,pocomanda
|
||
|
||
pddataora=get_ora()
|
||
lcSql = [select adresa,localitate,strada,numar,cod_fiscal from syn_nom_firme where id_firma = ]+Alltrim(Str(gnIdFirma))
|
||
llSucces = goExecutor.oExecuta(m.lcSql, 'crsFirma')
|
||
IF m.llSucces
|
||
Select crsfirma
|
||
Scatter Name firma Memo
|
||
ELSE
|
||
RETURN
|
||
ENDIF
|
||
USE IN (SELECT('crsFirma'))
|
||
|
||
pcschema=['DATAI d,NUME c(50),COD_FISCAL c(30),ADRESA c(150),TELEFON c(30),NRORD c(50),NRINMAT c(35),SERIES c(17),'+]+;
|
||
['SERIEM c(17),ASIGURATOR c(24),INSPECTOR C(100), MARCA c(24),MASINA c(20),KMINT n(10),ORE_FUNCTIONARE N(10), ID_TIP n(5),'+]+;
|
||
['SOLICITARI_CLIENT M, OBSERVATII M, DEFECTIUNI M, NR_DOSAR C(100), FURNIZOR C(100), NRACHI N(16), ANFABRICATIE N(4),'+]+;
|
||
['TERMEN D']
|
||
pcselect=['select datai,nume,cod_fiscal,adresa,telefon,nrord,nrinmat,series,seriem,asigurator,inspector,marca,masina,kmint,ore_functionare,id_tip,'+]+;
|
||
['solicitari_client,observatii,defectiuni,nr_dosar,furnizor, nrachi, anfabricatie, termen '+]+;
|
||
[' from auto_vordl where ']
|
||
|
||
pcorder=[]
|
||
pcfiltru = [ id_ordl = ] + Alltrim(Str(tnIdOrdl))
|
||
llAfiseaza=.F.
|
||
gencursor('pocomanda','crsComanda',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
|
||
pocomanda.ca_baza1.afisare()
|
||
Select crsComanda
|
||
Scatter Name ocom Memo
|
||
nrord=ocom.nrord
|
||
|
||
listare_raport_comanda([CRSCOMANDA],ocom.id_tip)
|
||
|
||
Use In (SELECT('crsComanda'))
|
||
Release ocom
|
||
Endproc
|
||
**********************sfarsit procedura listare_precomanda*******************
|
||
************************************ INCEPUT : listare_avans ************************************
|
||
*!* modificare v 2.0.28
|
||
*!* Procedure listare_avans
|
||
*!* Lparameters tnIdPartener,tcCursor,tcSirNrord,tcNrInmat,tnDevize
|
||
*!* Private poDate,pofirma,poClient,ptDataOra
|
||
*!* poDate = Createobject('oDateFacturaDevize',tnIdPartener,tcSirNrord,tcNrInmat,tnDevize,0)
|
||
*!* lcSql = [select 1 as tip,(case when tip_persoana = 1 then prefix||' '||denumire||' '||sufix else denumire end) as denumire,]+;
|
||
*!* [cod_fiscal,adresa,telefon,'' as telefon2,'' as telefon3,'' as fax,reg_comert,banca,cont_banca,'' as banca2,'' as cont_banca2,] + ;
|
||
*!* ['' as banca3,'' as cont_banca3,sysdate as dataora,tip_persoana,0 as capital_soc_var,] + ;
|
||
*!* [0 as capital_soc_sub from ] + gcS + [.vnom_parteneri where id_part = ?poDate.id_client ] + ;
|
||
*!* [union all ] + ;
|
||
*!* [select 2 as tip,denumire,cod_fiscal,'' as adresa,'' as telefon,'' as telefon2,'' as telefon3,'' as fax,reg_comert,'' as banca,'' as cont_banca,] + ;
|
||
*!* ['' as banca2,'' as cont_banca2,'' as banca3,'' as cont_banca3,null as dataora,tip_persoana,0 as capital_soc_var,0 as capital_soc_sub from ] + gcS + [.nom_parteneri ] + ;
|
||
*!* [where sters = 0 and inactiv = 0 and id_part in ] + ;
|
||
*!* [(select id_partener from ] + gcS + [.utilizatori_rol_intern where sters = 0 and id_util = ?gnIdUtil)] + ;
|
||
*!* [union all ] + ;
|
||
*!* [select 3 as tip,antet as denumire,cod_fiscal,adresa,telefon,telefon2,telefon3,fax,reg_comert,banca1 as banca,] + ;
|
||
*!* [cont_banca1 as cont_banca,banca2,cont_banca2,banca3,cont_banca3,null as dataora,0 as tip_persoana,capital_soc_var,capital_soc_sub ] + ;
|
||
*!* [from syn_nom_firme where id_firma = ?gnIdFirma ]
|
||
*!* If Used('crsdatefacturare')
|
||
*!* Use In crsdatefacturare
|
||
*!* Endif
|
||
*!* lcCursor = [crsdatefacturare]
|
||
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
*!* If lnSucces<0
|
||
*!* amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
|
||
*!* Return
|
||
*!* Endif
|
||
*!* Select crsdatefacturare
|
||
*!* Scan
|
||
*!* Do Case
|
||
*!* Case tip = 1
|
||
*!* Scatter Name poClient Memo
|
||
*!* poDate.nume_client = poClient.denumire
|
||
*!* ptDataOra = poClient.dataora
|
||
*!* Case tip = 2
|
||
*!* With poDate
|
||
*!* .nume_responsabil = denumire
|
||
*!* .BIresp = reg_comert
|
||
*!* .CNPresp = cod_fiscal
|
||
*!* Endwith
|
||
*!* Otherwise
|
||
*!* Scatter Name pofirma Memo
|
||
*!* Endcase
|
||
*!* Endscan
|
||
*!* Use In crsdatefacturare
|
||
|
||
*!* ofrmdelegat=Createobject("frm_delegat_factura")
|
||
*!* ofrmdelegat.nidpartener = poDate.id_client
|
||
*!* ofrmdelegat.cclient = poDate.nume_client
|
||
*!* ofrmdelegat.cnrinmat_exp = poDate.nrinmat_del
|
||
*!* ofrmdelegat.Show(1)
|
||
*!* Release ofrmdelegat
|
||
|
||
*!* Private pnTotCTva,pnTotFTva,pnTotTva,plAchitat,plEmiteBon
|
||
*!* Store 0 To pnTotCTva,pnTotFTva,pnTotTva
|
||
*!* Store {} To pdDataChit,pdDataAct
|
||
*!* Store .T. To plAchitat,plEmiteBon
|
||
|
||
*!* If gnAvans419=1
|
||
*!* lcScc='419'
|
||
*!* Else
|
||
*!* lcScc='707'
|
||
*!* Endif
|
||
|
||
*!* Select &tcCursor
|
||
*!* *!* modificare v 2.0.21
|
||
*!* *!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = lcScc And Left(Alltrim(explicatia),5) = "AVANS" To pnTotFTva
|
||
*!* *!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And Left(Alltrim(explicatia),5) = "AVANS" To pnTotTva
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = lcScc And LIKE([*AVANS*],UPPER(ALLTRIM(explicatia))) To pnTotFTva
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And LIKE([*AVANS*],UPPER(ALLTRIM(explicatia))) To pnTotTva
|
||
*!* *!* modificare v 2.0.21 ^
|
||
*!* pnTotCTva = pnTotFTva + pnTotTva
|
||
|
||
*!* Select &tcCursor
|
||
*!* Locate For Alltrim(scd) = '4111'
|
||
*!* If Found()
|
||
*!* poDate.nract = &tcCursor..nract
|
||
*!* poDate.serie_act = &tcCursor..serie_act
|
||
*!* poDate.dataact = &tcCursor..dataact
|
||
*!* poDate.proc_tva = &tcCursor..proc_tva*100-100
|
||
*!* poDate.datascad = &tcCursor..datascad
|
||
*!* Endif
|
||
|
||
*!* Select &tcCursor
|
||
*!* Locate For Alltrim(scd) = '5311'
|
||
*!* Do Case
|
||
*!* Case Found() And pnTipIncasare=2
|
||
*!* Store .F. To plAchitat
|
||
*!* Store .T. To plEmiteBon
|
||
*!* poDate.nrchit = &tcCursor..nract
|
||
*!* poDate.sumaachit = &tcCursor..suma
|
||
*!* Case Found() And pnTipIncasare=3
|
||
*!* Store .F. To plEmiteBon
|
||
*!* poDate.nrchit = &tcCursor..nract
|
||
*!* poDate.datachit = &tcCursor..dataact
|
||
*!* poDate.sumaachit = &tcCursor..suma
|
||
*!* poDate.sumavorbe = SUMA_IN_VORBE(Round(poDate.sumaachit,gnPc))
|
||
*!* Otherwise
|
||
*!* Store .F. To plAchitat
|
||
*!* Store .F. To plEmiteBon
|
||
*!* Endcase
|
||
|
||
|
||
*!* *!* modificare v 2.0.2
|
||
*!* Select &tcCursor
|
||
*!* Local lcRaport
|
||
*!* Do Case
|
||
*!* Case gnTIP_LFACTURA=2 And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="factav_farachit"
|
||
*!* Case gnTIP_LFACTURA=1 And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="factav_cuchit"
|
||
*!* Case plAchitat And !plEmiteBon And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="factav_cuchit"
|
||
*!* Case gnTIP_LFACTURA=2 And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="factav_farachit_l"
|
||
*!* Case gnTIP_LFACTURA=1 And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="factav_cuchit_l"
|
||
*!* Case plAchitat And !plEmiteBon And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="factav_cuchit_l"
|
||
*!* Case gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="factav_farachit_l"
|
||
*!* Otherwise
|
||
*!* lcRaport="factav_farachit"
|
||
*!* Endcase
|
||
*!* *-------------------
|
||
*!* lnRaspuns=6
|
||
*!* Do While lnRaspuns=6
|
||
*!* *!* Do Case
|
||
*!* *!* Case gnTIP_LFACTURA = 2
|
||
*!* *!* *!* Report Form factav1 To Printer Prompt Preview
|
||
*!* *!* modificare v 2.0.5
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", lcRaport In PROCEDURI_RAPOARTE.PRG
|
||
*!* goExport.export2frx(tcCursor,lcRaport)
|
||
*!* *!* modificare v 2.0.5 ^
|
||
*!* *!* Case gnTIP_LFACTURA = 1
|
||
*!* *!* *!* Report Form factav2 To Printer Prompt Preview
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", "factav_cuchit" In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Otherwise
|
||
*!* *!* *!* Report Form factav To Printer Prompt Preview
|
||
*!* *!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", "factav" In PROCEDURI_RAPOARTE.PRG
|
||
*!* * If plAchitat And !plEmiteBon
|
||
*!* * Do LISTAREUSERREPORT With tcCursor, "FRX", crsfactav In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Else
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", "factav_farachit" In PROCEDURI_RAPOARTE.PRG
|
||
*!* * Endif
|
||
*!* *!* Endcase
|
||
|
||
*!* lnRaspuns=amessagebox("Doriti sa mai listati factura?",4+32+256,"Confirmare repetare listare")
|
||
*!* Enddo
|
||
|
||
*!* *!* modificare v 2.0.26
|
||
*!* *!* exportInPdf(tcCursor,lcRaport)
|
||
*!* If glAtasamenteAuto
|
||
*!* exportInPdf(tcCursor,lcRaport)
|
||
*!* Endif
|
||
*!* *!* modificare v 2.0.26 ^
|
||
*!* *!* modificare v 2.0.2^
|
||
|
||
*!* If plEmiteBon
|
||
*!* *!* modificare v 2.0.1
|
||
*!* *!* listare_bon_fiscal(Ttod(ptDataOra),poDate.nract,pnTotCTva,poDate.nrchit,poDate.sumaachit,poDate.proc_tva)
|
||
*!* listare_bon_fiscal(ptDataOra,poDate.nract,pnTotCTva,poDate.nrchit,poDate.sumaachit,poDate.proc_tva)
|
||
*!* *!* modificare v 2.0.1 ^
|
||
*!* Endif
|
||
|
||
*!* Release poDate
|
||
*!* Endproc && listare_avans
|
||
*!* modificare v 2.0.28 ^
|
||
*!* **********************sfarsit procedura listare_avans*******************
|
||
*=====================================================
|
||
*!* modificare v 2.0.28
|
||
*!* *!* modificare v 2.0.2
|
||
*!* Procedure exportInPdf
|
||
*!* Lparameters tcCursor, lcRaport, tlPreview, tcCursorSalvare
|
||
|
||
*!* Private pnTip,pcFormat
|
||
|
||
*!* If Used('crsListareAvansRepet')
|
||
*!* Use In crsListareAvansRepet
|
||
*!* Endif
|
||
*!* Create Cursor crsListareAvansRepet(nume_frx c(50),fisier w)
|
||
|
||
*!* goExport.export2pdf(tcCursor,lcRaport,.F.,'crsListareAvansRepet')
|
||
*!* If Reccount('crsListareAvansRepet') > 0
|
||
*!* Select crsListareAvansRepet
|
||
*!* Go Top
|
||
*!* lcNume_Frx = crsListareAvansRepet.nume_frx
|
||
*!* pnTip = 1
|
||
*!* If Like([*A5],Upper(Alltrim(lcNume_Frx)))
|
||
*!* pcFormat = [A5]
|
||
*!* Else
|
||
*!* pcFormat = [A4]
|
||
*!* Endif
|
||
|
||
*!* lcSql = [INSERT INTO ATASAMENTE_VANZARI(ID_UTIL,DOCUMENT,TIP,FORMAT,COD) VALUES (?gnIdUtil,?crsListareAvansRepet.fisier,?pnTip,?pcFormat,PACK_CONTAFIN.GET_COD);]
|
||
*!* lnSucces = goExecutor.oExecute(lcSql)
|
||
*!* If lnSucces < 0
|
||
*!* amessagebox(goExecutor.cEroare,16,"Eroare")
|
||
*!* Endif
|
||
*!* Endif
|
||
*!* Use In crsListareAvansRepet
|
||
*!* Release pnTip,pcFormat
|
||
*!* Endproc
|
||
*!* *!* modificare v 2.0.2 ^
|
||
*!* modificare v 2.0.28 ^
|
||
****=============================================================
|
||
*------------------------------inceput procedura listare_FACTURA-----------------------------------------
|
||
* PROCEDURE listare_FACTURA( tnTipFact, tcRaport )
|
||
* Data : 03/21/05, 16:03:19
|
||
* autor : liana.macinic
|
||
* descriere:
|
||
|
||
*!* toClient : id-ul de client
|
||
*!* tcCursor : Alias'ul cursorului
|
||
*!* tnTipfact : 1 - finala, 2 - spalare , 3 - restul, 4 - finala devize multiple
|
||
*!* tnProcDiscM,tnProcDiscN,tnProcDiscM,tnDiscountN,tnDiscountM,tnDiscountTvaM,tnDiscountTvaN
|
||
*
|
||
*******************************************
|
||
*!* modificare v 2.0.28
|
||
*!* Procedure listare_FACTURA
|
||
*!* Parameters tnIdClient,tcCursor,tcSirNrord,tcNrInmat,tnTipfact,tnProcDiscM,tnProcDiscN,tnDiscountM,tnDiscountN,tnDiscountTvaM,tnDiscountTvaN,tcdenop,tnTipFactura
|
||
|
||
*!* If Empty(tcdenop)
|
||
*!* Store 'MANOPERA' To tcdenop
|
||
*!* Endif
|
||
|
||
*!* If Empty(tnProcDiscN)
|
||
*!* Store 0 To tnProcDiscN,tnDiscountN,tnDiscountTvaN
|
||
*!* Endif
|
||
|
||
*!* If Empty(tnProcDiscM)
|
||
*!* Store 0 To tnProcDiscM,tnDiscountM,tnDiscountTvaM
|
||
*!* Endif
|
||
|
||
*!* tnDiscountN = Abs(tnDiscountN)
|
||
*!* tnDiscountM = Abs(tnDiscountM)
|
||
|
||
*!* Private poDate,pofirma,poClient,ptDataOra
|
||
*!* poDate = Createobject('oDateFacturaDevize',tnIdClient,tcSirNrord,tcNrInmat,Iif(tnTipfact=4,1,0),tnTipFactura)
|
||
*!* lcSql = [select 1 as tip,(case when tip_persoana = 1 then prefix||' '||denumire||' '||sufix else denumire end) as denumire,]+;
|
||
*!* [cod_fiscal,adresa,telefon,'' as telefon2,'' as telefon3,'' as fax,reg_comert,banca,cont_banca,'' as banca2,'' as cont_banca2,] + ;
|
||
*!* ['' as banca3,'' as cont_banca3,sysdate as dataora,tip_persoana,0 as capital_soc_var,] + ;
|
||
*!* [0 as capital_soc_sub from ] + gcS + [.vnom_parteneri where id_part = ?poDate.id_client ] + ;
|
||
*!* [union all ] + ;
|
||
*!* [select 2 as tip,denumire,cod_fiscal,'' as adresa,'' as telefon,'' as telefon2,'' as telefon3,'' as fax,reg_comert,'' as banca,'' as cont_banca,] + ;
|
||
*!* ['' as banca2,'' as cont_banca2,'' as banca3,'' as cont_banca3,] + ;
|
||
*!* [null as dataora,tip_persoana,0 as capital_soc_var,0 as capital_soc_sub from ] + gcS + [.nom_parteneri ] + ;
|
||
*!* [where sters = 0 and inactiv = 0 and id_part in ] + ;
|
||
*!* [(select id_partener from ] + gcS + [.utilizatori_rol_intern where sters = 0 and id_util = ?gnIdUtil)] + ;
|
||
*!* [union all ] + ;
|
||
*!* [select 3 as tip,antet as denumire,cod_fiscal,adresa,telefon,telefon2,telefon3,fax,reg_comert,banca1 as banca,] + ;
|
||
*!* [cont_banca1 as cont_banca,banca2,cont_banca2,banca3,cont_banca3,null as dataora,0 as tip_persoana,capital_soc_var,capital_soc_sub ] + ;
|
||
*!* [from syn_nom_firme where id_firma = ?gnIdFirma ]
|
||
*!* If Used('crsdatefacturare')
|
||
*!* Use In crsdatefacturare
|
||
*!* Endif
|
||
*!* lcCursor = [crsdatefacturare]
|
||
*!* lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
*!* If lnSucces<0
|
||
*!* amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
|
||
*!* Return
|
||
*!* Endif
|
||
*!* Select crsdatefacturare
|
||
*!* Scan
|
||
*!* Do Case
|
||
*!* Case tip = 1
|
||
*!* Scatter Name poClient Memo
|
||
*!* poDate.nume_client = poClient.denumire
|
||
*!* ptDataOra = poClient.dataora
|
||
*!* Case tip = 2
|
||
*!* With poDate
|
||
*!* .nume_responsabil = denumire
|
||
*!* .BIresp = reg_comert
|
||
*!* .CNPresp = cod_fiscal
|
||
*!* Endwith
|
||
*!* Otherwise
|
||
*!* Scatter Name pofirma Memo
|
||
*!* Endcase
|
||
*!* Endscan
|
||
*!* Use In crsdatefacturare
|
||
|
||
*!* ofrmdelegat=Createobject("frm_delegat_factura")
|
||
*!* ofrmdelegat.nidpartener = poDate.id_client
|
||
*!* ofrmdelegat.cclient = poDate.nume_client
|
||
*!* ofrmdelegat.cnrinmat_exp = poDate.nrinmat_del
|
||
*!* ofrmdelegat.Show(1)
|
||
*!* Release ofrmdelegat
|
||
|
||
*!* Private pnSumaMat,pnSumaMan,pnTvaMat,pnTvaMan,pnDiscMan,pnDiscMat,pnTvaDiscMan,pnTvaDiscMat,pnAvans,pnTvaAvans
|
||
*!* Store 0 To pnSumaMat,pnSumaMan,pnTvaMat,pnTvaMan,pnDiscMan,pnDiscMat,pnTvaDiscMan,pnTvaDiscMat,pnAvans,pnTvaAvans
|
||
|
||
*!* Select &tcCursor
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '707' And Left(Alltrim(explicatia),3) = "MAT" To pnSumaMat
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And Left(Alltrim(explicatia),7) = "TVA MAT" To pnTvaMat
|
||
*!* *!* Sum suma For Alltrim(scd) = '411' And Alltrim(scc) = '707' And Left(Alltrim(explicatia),12) = "DISCOUNT MAT" To pnDiscMat
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And Left(Alltrim(explicatia),12) = "DISCOUNT MAT" To pnTvaDiscMat
|
||
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '704' And Left(Alltrim(explicatia),3) = "MAN" To pnSumaMan
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And Left(Alltrim(explicatia),7) = "TVA MAN" To pnTvaMan
|
||
*!* *!* Sum suma For Alltrim(scd) = '411' And Alltrim(scc) = '704' And Left(Alltrim(explicatia),12) = "DISCOUNT MAN" To pnDiscMan
|
||
*!* Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '4427' And Left(Alltrim(explicatia),12) = "DISCOUNT MAN" To pnTvaDiscMan
|
||
|
||
*!* Select &tcCursor
|
||
*!* *!* Locate For Alltrim(explicatia ) = 'STORNARE AVANS'
|
||
*!* *!* If Found()
|
||
*!* *!* pnAvans = (-1) * Abs(&tcCursor..suma)
|
||
*!* *!* Endif
|
||
*!* Calculate Sum(suma) For Alltrim(explicatia)='STORNARE AVANS' To pnAvans
|
||
*!* Calculate Sum(suma) For Alltrim(explicatia)='STORNARE AVANS' And Alltrim(scc)<>'4427' To pnAvansFTva
|
||
*!* Calculate Sum(suma) For Alltrim(explicatia)='STORNARE AVANS' And Alltrim(scc)='4427' To pnAvansTva
|
||
*!* pnAvans=(-1) * Abs(Round(pnAvans,gnPa))
|
||
*!* pnAvansTva=(-1) * Abs(Round(pnAvansTva,gnPa))
|
||
*!* pnAvansFTva=(-1) * Abs(Round(pnAvansFTva,gnPa))
|
||
|
||
*!* Private plAchitat,plEmiteBon
|
||
*!* Store .T. To plAchitat,plEmiteBon
|
||
|
||
*!* Select &tcCursor
|
||
*!* Locate For Alltrim(scd) = '4111'
|
||
*!* If Found()
|
||
*!* poDate.nract = &tcCursor..nract
|
||
*!* poDate.serie_act = &tcCursor..serie_act
|
||
*!* poDate.dataact = &tcCursor..dataact
|
||
*!* poDate.proc_tva = &tcCursor..proc_tva*100-100
|
||
*!* poDate.datascad = &tcCursor..datascad
|
||
*!* Endif
|
||
|
||
*!* Select &tcCursor
|
||
*!* Locate For Alltrim(scd) = '5311'
|
||
*!* Do Case
|
||
*!* Case Found() And pnTipIncasare=2
|
||
*!* Store .F. To plAchitat
|
||
*!* Store .T. To plEmiteBon
|
||
*!* poDate.nrchit = &tcCursor..nract
|
||
*!* poDate.sumaachit = &tcCursor..suma
|
||
*!* Case Found() And pnTipIncasare=3
|
||
*!* Store .F. To plEmiteBon
|
||
*!* poDate.nrchit = &tcCursor..nract
|
||
*!* poDate.datachit = &tcCursor..dataact
|
||
*!* poDate.sumaachit = &tcCursor..suma
|
||
*!* poDate.sumavorbe = SUMA_IN_VORBE(Round(poDate.sumaachit,gnPc))
|
||
*!* Otherwise
|
||
*!* Store .F. To plEmiteBon
|
||
*!* Store .F. To plAchitat
|
||
*!* Endcase
|
||
|
||
*!* *-------------------
|
||
*!* *!* modificare 07.04
|
||
*!* *!* pnDiscMan = tnDiscountM
|
||
*!* *!* pnDiscMat = tnDiscountN
|
||
*!* pnDiscMan = Sign(pnSumaMan) * tnDiscountM
|
||
*!* tnDiscountM = Sign(pnSumaMan) * tnDiscountM
|
||
*!* pnTvaDiscMan = (-1) * pnTvaDiscMan
|
||
|
||
*!* pnDiscMat = Sign(pnSumaMat) * tnDiscountN
|
||
*!* tnDiscountN = Sign(pnSumaMat) * tnDiscountN
|
||
*!* pnTvaDiscMat = (-1) * pnTvaDiscMat
|
||
*!* *!* modificare ^
|
||
|
||
|
||
*!* *!* modificare v 2.0.2
|
||
*!* Local lcRaport
|
||
*!* Do Case
|
||
*!* Case gnTIP_LFACTURA=2 And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="fact_farachit"
|
||
*!* Case gnTIP_LFACTURA=1 And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="fact_cuchit"
|
||
*!* Case plAchitat And !plEmiteBon And gnTIP_LFACTURA_LINII=1
|
||
*!* lcRaport="fact_cuchit"
|
||
*!* Case gnTIP_LFACTURA=2 And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="fact_farachit_l"
|
||
*!* Case gnTIP_LFACTURA=1 And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="fact_cuchit_l"
|
||
*!* Case plAchitat And !plEmiteBon And gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="fact_cuchit_l"
|
||
*!* Case gnTIP_LFACTURA_LINII=2
|
||
*!* lcRaport="fact_farachit_l"
|
||
*!* Otherwise
|
||
*!* lcRaport="fact_farachit"
|
||
*!* Endcase
|
||
*!* lnRaspuns=6
|
||
*!* Do While lnRaspuns=6
|
||
*!* Select &tcCursor
|
||
*!* *!* Do Case
|
||
*!* *!* Case gnTIP_LFACTURA = 2
|
||
*!* *!* *!* Report Form fact_farachit To Printer Prompt Preview
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", "fact_farachit" In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Case gnTIP_LFACTURA = 1
|
||
*!* *!* *!* Report Form fact_cuchit To Printer Prompt Preview
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", "fact_cuchit" In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Otherwise
|
||
*!* *!* Report Form fact_farachit To Printer Prompt Preview
|
||
*!* *!* modificare v 2.0.5
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", lcRaport In PROCEDURI_RAPOARTE.PRG
|
||
*!* goExport.export2frx(tcCursor,lcRaport)
|
||
*!* *!* modificare v 2.0.5
|
||
*!* *!* If plAchitat And !plEmiteBon
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", fact_cuchit In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Else
|
||
*!* *!* Do LISTAREUSERREPORT With tcCursor, "FRX", fact_farachit In PROCEDURI_RAPOARTE.PRG
|
||
*!* *!* Endif
|
||
*!* *!* Endcase
|
||
|
||
*!* lnRaspuns=amessagebox("Doriti sa mai listati factura?",4+32+256,"Confirmare repetare listare")
|
||
*!* Enddo
|
||
|
||
*!* *!* modificare v 2.0.26
|
||
*!* *!* exportInPdf(tcCursor,lcRaport)
|
||
*!* If glAtasamenteAuto
|
||
*!* exportInPdf(tcCursor,lcRaport)
|
||
*!* Endif
|
||
*!* *!* modificare v 2.0.26 ^
|
||
*!* *!* modificare v 2.0.2 ^
|
||
|
||
|
||
*!* If plEmiteBon
|
||
*!* *!* modificare v 2.0.21
|
||
*!* If glAutoBonDet
|
||
*!* listare_bon_fiscal_det(ptDataOra,poDate.nrchit,poDate.sumaachit,poDate.proc_tva,tnProcDiscN,pnSumaMan+pnTvaMan,tnProcDiscM)
|
||
*!* Else
|
||
*!* *!* modificare v 2.0.21 ^
|
||
*!* lnTotCTva=pnSumaMat+pnSumaMan-pnDiscMat-pnDiscMan+Round(pnAvansFTva,gnPc)+;
|
||
*!* pnTvaMat+pnTvaMan+pnTvaDiscMat+pnTvaDiscMan+Round(pnAvansTva,gnPc)
|
||
*!* *!* modificare v 2.0.1
|
||
*!* *!* listare_bon_fiscal(Ttod(ptDataOra),poDate.nract,lnTotCTva,poDate.nrchit,poDate.sumaachit,poDate.proc_tva)
|
||
*!* listare_bon_fiscal(ptDataOra,poDate.nract,lnTotCTva,poDate.nrchit,poDate.sumaachit,poDate.proc_tva)
|
||
*!* *!* modificare v 2.0.1 ^
|
||
*!* *!* modificare v 2.0.21
|
||
*!* Endif
|
||
*!* *!* modificare v 2.0.21 ^
|
||
*!* Endif
|
||
|
||
*!* Release poDate
|
||
*!* Endproc && listare_factura
|
||
*********************************************************************************************************
|
||
Procedure creare_bon_fiscal
|
||
|
||
Endproc && creare_bon_fiscal
|
||
*********************************************************************************************************
|
||
*!* modificare v 2.0.28
|
||
*!* *!* modificare v 2.0.21
|
||
*!* Procedure listare_bon_fiscal_det
|
||
*!* Lparameters ttDataOra,tnNrBon,tnSumaAchit,tnProcentTva,tnProcDiscMat,tnSumaManopera,tnProcDiscMan
|
||
*!* Local lcCursor
|
||
*!* lcCursor = [crsDateBon]
|
||
*!* Create Cursor (lcCursor) (denumire c(100), UM c(10), CANT N(10,4), Pret N(18,4), DEPARTAMENT N(2), PROC_TVAV N(5,2),PROCENT N(5,2),DISCOUNT N(2) DEFAULT 0)
|
||
*!* *!* modificare v 2.0.26
|
||
*!* *!* Insert Into (lcCursor) (denumire,um,cant,Pret,departament,proc_tvav) ;
|
||
*!* *!* Select denumire, Nvl(um,'BUC') As um, cant, Pret, 1, 1+(tnProcentTva/100) From crsBonDetaliat
|
||
*!* If Used('crsBonDetaliat')
|
||
*!* Insert Into (lcCursor) (denumire,um,cant,Pret,departament,proc_tvav) ;
|
||
*!* Select denumire, Nvl(um,'BUC') As um, cant, Pret, 1, 1+(tnProcentTva/100) From crsBonDetaliat
|
||
*!* Endif
|
||
*!* *!* modificare v 2.0.26 ^
|
||
*!* Select (lcCursor)
|
||
*!* If tnProcDiscMat <> 0
|
||
*!* Append Blank
|
||
*!* Replace denumire With 'DISCOUNT MATERIALE',um With 'BUC',cant With 1,procent With tnProcDiscMat,;
|
||
*!* departament With 1,proc_tvav With 1+(tnProcentTva/100),discount With 2
|
||
*!* Endif
|
||
*!* If tnSumaManopera <> 0
|
||
*!* Append Blank
|
||
*!* Replace denumire With 'MANOPERA SERVICE',um WITH 'BUC',cant With 1,Pret With tnSumaManopera,;
|
||
*!* departament With 1,proc_tvav With 1+(tnProcentTva/100)
|
||
*!* Endif
|
||
*!* If tnProcDiscMan <> 0
|
||
*!* Append Blank
|
||
*!* Replace denumire With 'DISCOUNT MANOPERA',um With 'BUC',cant With 1,procent With tnProcDiscMan,;
|
||
*!* departament With 1,proc_tvav With 1+(tnProcentTva/100),discount With 1
|
||
*!* Endif
|
||
*!* loHash = GetHash()
|
||
*!* loHash.SetValue("cTip", "1;")
|
||
*!* loHash.SetValue("nNumarBon", tnNrBon)
|
||
*!* loHash.SetValue("nValoareNumerar", tnSumaAchit)
|
||
*!* loHash.SetValue("nValoareTotal", tnSumaAchit)
|
||
*!* loHash.SetValue("cCursor",lcCursor)
|
||
*!* loHash.SetValue("tDataOra",ttDataOra)
|
||
*!* goControllerEcr.imprima(loHash)
|
||
*!* Use In (lcCursor)
|
||
*!* Release loHash
|
||
*!* Endproc && listare_bon_fiscal_det
|
||
*!* *!* modificare v 2.0.21 ^
|
||
*!* modificare v 2.0.28 ^
|
||
*********************************************************************************************************
|
||
*!* modificare v 2.0.28
|
||
*!* Procedure listare_bon_fiscal
|
||
*!* Lparameters ttDataOra,tnNrFact,tnTotCTva,tnNrBon,tnSumaAchit,tnProcentTva
|
||
*!* *!* modificare v 2.0.1
|
||
*!* *!* *!* lcSir=[1;Fact.]+Alltrim(Str(tnNrFact))+[;1;1;1;]+Alltrim(Str(tnTotCTva*100))+[;1000;0]+CRLF
|
||
*!* *!* lcSir=[1;Fact.]+Alltrim(Str(tnNrFact))+[;1;1;1;]+Alltrim(Str(tnSumaAchit*100))+[;1000;0\n]+CRLF
|
||
*!* *!* lcSir=lcSir+[5;]+Alltrim(Str(tnSumaAchit*100))+[;0;0;0\n]+Chr(13)+Chr(10)+Chr(13)+Chr(10)
|
||
*!* *!* imprimare_bon_fiscal(lcSir,tdDataOra,tnNrBon)
|
||
*!* Local lcCursor
|
||
*!* lcCursor = [crsDateBon]
|
||
*!* Create Cursor (lcCursor) (denumire c(100), UM c(10), CANT N(10,4), Pret N(18,4), DEPARTAMENT N(2), PROC_TVAV N(5,2))
|
||
*!* Append Blank
|
||
*!* Replace denumire With [Fact.]+Alltrim(Str(tnNrFact)),CANT With 1,Pret With tnSumaAchit,PROC_TVAV With 1+(tnProcentTva/100),DEPARTAMENT With 1
|
||
|
||
*!* loHash = GetHash()
|
||
*!* loHash.SetValue("cTip", "1;")
|
||
*!* loHash.SetValue("nNumarBon", tnNrBon)
|
||
*!* loHash.SetValue("nValoareNumerar", tnSumaAchit)
|
||
*!* loHash.SetValue("nValoareTotal", tnSumaAchit)
|
||
*!* loHash.SetValue("cCursor",lcCursor)
|
||
*!* loHash.SetValue("tDataOra",ttDataOra)
|
||
*!* goControllerEcr.imprima(loHash)
|
||
*!* Use In (lcCursor)
|
||
*!* Release loHash
|
||
*!* *!* modificare v 2.0.1 ^
|
||
*!* Endproc && listare_bon_fiscal
|
||
*!* modificare v 2.0.28 ^
|
||
*********************************************************************************************************
|
||
Procedure facturi_emise_pe_sectii
|
||
Private pcAnLuna1,pcAnLuna2,pnNrLuni1,pnNrLuni2
|
||
Local lcCursor
|
||
lnRepetare = 1
|
||
pnButon = 1
|
||
Do While lnRepetare = 1 And pnButon = 1
|
||
pcAnLuna1 = Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2 = pcAnLuna1
|
||
ofrminterval = Createobject('frm_interval_luni')
|
||
ofrminterval.lb_titlu_alb_b121.Caption = [DATA FACTURII]
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
If Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12 <= gnAn*12 + gnLuna
|
||
lnRepetare = 0
|
||
Else
|
||
amessagebox("Luna de sfarsit nu poate fi mai mare decat cea curenta!",48,"Atentie")
|
||
Endif
|
||
Enddo
|
||
|
||
If pnButon = 1
|
||
lcCursor = [crsfacturisectii]
|
||
loCauta = caut_sectie(1,.F.,.T.)
|
||
If pnButon = 1
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra,pnIdSectie
|
||
pnIdSectie = 0
|
||
pnNrLuni1=Val(Substr(pcAnLuna1,1,2))+Val(Substr(pcAnLuna1,3))*12
|
||
pnNrLuni2=Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12
|
||
pcDataOra = get_ora(2)
|
||
If loCauta.id_sectie <> 0
|
||
pnIdSectie = loCauta.id_sectie
|
||
lcFiltru = [where a.id_sectie = ?pnIdSectie]
|
||
Else
|
||
lcFiltru = []
|
||
Endif
|
||
lcSql = [select a.nract,a.dataact,a.id_lucrare,a.id_partd,a.id_sectie,b.nrord,c.denumire,d.sectie,] + ;
|
||
[NVL(e.valoarea, 0) as valoarea,NVL(e.valoarev, 0) as valoarev,decode(NVL(e.valoarea, 1),0,0,(NVL(e.valoarev, 0) - NVL(e.valoarea, 0)) * 100 / NVL(e.valoarea, 1)) as proc_adaos,] + ;
|
||
[NVL(f.ore, 0) as ore,NVL(f.ore_spec, 0) as ore_spec,NVL(f.valoare_man, 0) as valoare_man,NVL(f.valoare_man_spec, 0) as valoare_man_spec ] + ;
|
||
[from (select distinct nract, dataact, id_lucrare, id_partd, id_sectie from ] + gcS + [.act where an * 12 + luna ] + ;
|
||
[between ?pnNrLuni1 and ?pnNrLuni2 and sters = 0 and id_set in (31011, 31012) and scd like '41%' and scc not like '44%') a ] + ;
|
||
[left join ] + gcS + [.vnom_lucrari b on a.id_lucrare = b.id_lucrare ] + ;
|
||
[left join ] + gcS + [.nom_parteneri c on a.id_partd = c.id_part ] + ;
|
||
[left join ] + gcS + [.nom_sectii d on a.id_sectie = d.id_sectie ] + ;
|
||
[left join (select sum(round(pret * cante, 2)) as valoarea, ] + ;
|
||
[sum(round(pretv * cante, 2)) as valoarev, id_lucrare, id_sectie ] + ;
|
||
[from ] + gcS + [.rul where sters = 0 group by id_lucrare, id_sectie) e ] + ;
|
||
[on a.id_lucrare = e.id_lucrare and a.id_sectie = e.id_sectie ] + ;
|
||
[left join (select sum(NVL2(c1.id_norma, 0, b1.timpn)) as ore,] + ;
|
||
[sum(NVL2(c1.id_norma, b1.timpn, 0)) as ore_spec,] + ;
|
||
[sum(NVL2(c1.id_norma, 0, round(b1.timpn * b1.pret, 2))) as valoare_man,] + ;
|
||
[sum(NVL2(c1.id_norma, round(b1.timpn * b1.pret, 2), 0)) as valoare_man_spec,] + ;
|
||
[a1.id_lucrare,b1.id_sectie from ] + gcS + [.dev_ordl a1 ] + ;
|
||
[left join ] + gcS + [.dev_oper b1 on a1.id_ordl = b1.id_ordl ] + ;
|
||
[left join (select pack_sesiune.getoptiunefirma(USER,'ID_NORME_SPEC') as id_norma from ] + gcS + [.dev_oper where rownum = 1) c1 ] + ;
|
||
[on b1.id_norme = c1.id_norma where a1.sters = 0 and b1.sters = 0 ] + ;
|
||
[group by a1.id_lucrare, b1.id_sectie) f on a.id_lucrare = f.id_lucrare ] + ;
|
||
[and a.id_sectie = f.id_sectie ] + ;
|
||
lcFiltru + [ order by d.sectie, a.dataact, a.nract]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
_Screen.MousePointer=0
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
If Reccount(lcCursor)=0
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport facturi emise pe sectii")
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'LISTA FACTURILOR FINALE PE SEC<45>II'
|
||
pcPerioada = Iif(pnNrLuni1==pnNrLuni2,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select (lcCursor)
|
||
Keyboard '{CTRL+F10}'
|
||
Report Form rap_facturi_sectii To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[sectie,nract,TTOD(dataact),nrord,denumire,valoarea,valoarev,proc_adaos,ore,ore_spec,valoare_man,valoare_man_spec]
|
||
lcSirNume=[Sectie,Nr_factura,Data_factura,Nr_comanda,Nume,Pret_achizitie,Pret_vanzare,Procent_adaos,Ore_manopera,Ore_manopera_speciala,] + ;
|
||
[Valoare_manopera,Valoare_manopera_speciala]
|
||
exportare(lcCursor,lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Endif
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
Endif
|
||
Endif
|
||
Endif
|
||
|
||
Endproc && facturi_emise_pe_sectii
|
||
Procedure manopera_sectii_anfabr
|
||
Private pcAnLuna1,pcAnLuna2,pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Store 0 To pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Local lcCursor
|
||
lnRepetare = 1
|
||
pnButon = 1
|
||
Do While lnRepetare = 1 And pnButon = 1
|
||
pcAnLuna1 = Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2 = pcAnLuna1
|
||
ofrminterval = Createobject('frm_interval_luni')
|
||
ofrminterval.lb_titlu_alb_b121.Caption = [LUNA INCHIDERE COMANDA]
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
If Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12 <= gnAn*12 + gnLuna
|
||
lnRepetare = 0
|
||
Else
|
||
amessagebox("Luna de sfarsit nu poate fi mai mare decat cea curenta!",48,"Atentie")
|
||
Endif
|
||
Enddo
|
||
|
||
If pnButon = 1
|
||
lcCursor = [crsmanopsecmas]
|
||
loCauta = caut_sectie(1,.F.,.T.)
|
||
If pnButon = 1
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra,pnIdSectie
|
||
pnIdSectie = 0
|
||
pnLunaI = Val(Substr(pcAnLuna1,1,2))
|
||
pnAnI = Val(Substr(pcAnLuna1,3))
|
||
pnLunaF = Val(Substr(pcAnLuna2,1,2))
|
||
pnAnF = Val(Substr(pcAnLuna2,3))
|
||
|
||
lcSql = [begin pack_auto.set_perioada_raport(?pnLunaI,?pnAnI,?pnLunaF,?pnAnF); end;]
|
||
lnSucces = goExecutor.oExecute(lcSql)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Endif
|
||
|
||
pcDataOra = get_ora(2)
|
||
If loCauta.id_sectie <> 0
|
||
pnIdSectie = loCauta.id_sectie
|
||
lcFiltru = [where id_sectie = ?pnIdSectie]
|
||
Else
|
||
lcFiltru = []
|
||
Endif
|
||
lcSql = [select datai, nrord, tip_comanda, sectie, anfabricatie, denumire, total ] + ;
|
||
[from ] + gcS + [.auto_listare_man_anfabr ] + ;
|
||
lcFiltru + [ order by sectie,tip_comanda,anfabricatie, datai, nrord]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
_Screen.MousePointer=0
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
If Reccount(lcCursor)=0
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport manopera comenzii inchise pe sectii / an fabricatie")
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'MANOPER<45> COMENZI <20>NCHISE PE SEC<45>II / AN FABRICA<43>IE'
|
||
pcPerioada = Iif(pnLunaI+pnAnI*12==pnLunaF+pnAnF*12,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select (lcCursor)
|
||
Keyboard '{CTRL+F10}'
|
||
Report Form rap_manopera_anfabricatie To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[sectie,tip_comanda,anfabricatie,TTOD(datai),nrord,denumire,total]
|
||
lcSirNume=[Sectie,Tip_comanda,An_fabricatie_masina,Data_comanda,Comanda,Client,Total]
|
||
exportare(lcCursor,lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Endif
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
Endif
|
||
Endif
|
||
Endif
|
||
|
||
Endproc && manopera_sectii_anfabr
|
||
*********************************************************************************************************
|
||
Procedure manopera_sectii_anfabr_centralizator
|
||
Private pcAnLuna1,pcAnLuna2,pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Store 0 To pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Local lcCursor
|
||
lnRepetare = 1
|
||
pnButon = 1
|
||
Do While lnRepetare = 1 And pnButon = 1
|
||
pcAnLuna1 = Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2 = pcAnLuna1
|
||
ofrminterval = Createobject('frm_interval_luni')
|
||
ofrminterval.lb_titlu_alb_b121.Caption = [LUNA INCHIDERE COMANDA]
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
If Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12 <= gnAn*12 + gnLuna
|
||
lnRepetare = 0
|
||
Else
|
||
amessagebox("Luna de sfarsit nu poate fi mai mare decat cea curenta!",48,"Atentie")
|
||
Endif
|
||
Enddo
|
||
|
||
If pnButon = 1
|
||
lcCursor = [crsmanopsecmas]
|
||
loCauta = caut_sectie(1,.F.,.T.)
|
||
If pnButon = 1
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra,pnIdSectie
|
||
pnIdSectie = 0
|
||
pnLunaI = Val(Substr(pcAnLuna1,1,2))
|
||
pnAnI = Val(Substr(pcAnLuna1,3))
|
||
pnLunaF = Val(Substr(pcAnLuna2,1,2))
|
||
pnAnF = Val(Substr(pcAnLuna2,3))
|
||
|
||
lcSql = [begin pack_auto.set_perioada_raport(?pnLunaI,?pnAnI,?pnLunaF,?pnAnF); end;]
|
||
lnSucces = goExecutor.oExecute(lcSql)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Endif
|
||
|
||
pcDataOra = get_ora(2)
|
||
If loCauta.id_sectie <> 0
|
||
pnIdSectie = loCauta.id_sectie
|
||
lcFiltru = [where d.id_sectie = ?pnIdSectie]
|
||
Else
|
||
lcFiltru = []
|
||
Endif
|
||
lcSql = [select c.denumire as tip_comanda, e.sectie, NVL(f.anfabricatie,0) as anfabricatie,] + ;
|
||
[sum(round(d.timpn * d.pret, ?gnPc)) as total,grouping_id(e.sectie, c.denumire, NVL(f.anfabricatie, 0)) as gid ] + ;
|
||
[from ] + gcS + [.auto_analiza_salarii a ] + ;
|
||
[left join ] + gcS + [.dev_ordl b on a.id_ordl = b.id_ordl ] + ;
|
||
[left join ] + gcS + [.dev_tip_deviz c on a.id_tip = c.id_tip ] + ;
|
||
[left join ] + gcS + [.dev_oper d on b.id_ordl = d.id_ordl and d.sters = 0 ] + ;
|
||
[left join ] + gcS + [.nom_sectii e on d.id_sectie = e.id_sectie ] + ;
|
||
[left join ] + gcS + [.dev_masiniclienti f on b.id_masiniclient = f.id_masiniclient ] + ;
|
||
lcFiltru + [ group by rollup(e.sectie, c.denumire, NVL(f.anfabricatie,0)) ] + ;
|
||
[ order by e.sectie, 4, c.denumire, NVL(f.anfabricatie,0)]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
_Screen.MousePointer=0
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
If Reccount(lcCursor)=0
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport manopera comenzii inchise pe sectii / an fabricatie")
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'CENTRALIZATOR MANOPER<45> COMENZI <20>NCHISE PE SEC<45>II / AN FABRICA<43>IE'
|
||
pcPerioada = Iif(pnLunaI+pnAnI*12==pnLunaF+pnAnF*12,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select (lcCursor)
|
||
Keyboard '{CTRL+F10}'
|
||
Report Form rap_manopera_anfabricatie_c To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[sectie,tip_comanda,anfabricatie,total]
|
||
lcSirNume=[Sectie,Tip_comanda,An_fabricatie_masina,Total]
|
||
exportare(lcCursor,lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Endif
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
Endif
|
||
Endif
|
||
Endif
|
||
|
||
Endproc && manopera_sectii_anfabr_centralizator
|
||
*********************************************************************************************************
|
||
Procedure manopera_sectii
|
||
Private pcAnLuna1,pcAnLuna2,pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Store 0 To pnLunaI,pnAnI,pnLunaF,pnAnF
|
||
Local lcCursor
|
||
lnRepetare = 1
|
||
pnButon = 1
|
||
Do While lnRepetare = 1 And pnButon = 1
|
||
pcAnLuna1 = Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2 = pcAnLuna1
|
||
ofrminterval = Createobject('frm_interval_luni')
|
||
ofrminterval.lb_titlu_alb_b121.Caption = [LUNA INCHIDERE COMANDA]
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
If Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12 <= gnAn*12 + gnLuna
|
||
lnRepetare = 0
|
||
Else
|
||
amessagebox("Luna de sfarsit nu poate fi mai mare decat cea curenta!",48,"Atentie")
|
||
Endif
|
||
Enddo
|
||
|
||
If pnButon = 1
|
||
lcCursor = [crsmanopsecmas]
|
||
*!* loCauta = caut_sectie(1,.F.,.T.)
|
||
If pnButon = 1
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra,pnIdSectie
|
||
pnIdSectie = 0
|
||
pnLunaI = Val(Substr(pcAnLuna1,1,2))
|
||
pnAnI = Val(Substr(pcAnLuna1,3))
|
||
pnLunaF = Val(Substr(pcAnLuna2,1,2))
|
||
pnAnF = Val(Substr(pcAnLuna2,3))
|
||
|
||
lcSql = [begin pack_auto.set_perioada_raport(?pnLunaI,?pnAnI,?pnLunaF,?pnAnF); end;]
|
||
lnSucces = goExecutor.oExecute(lcSql)
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Endif
|
||
|
||
pcDataOra = get_ora(2)
|
||
*!* If loCauta.id_sectie <> 0
|
||
*!* pnIdSectie = loCauta.id_sectie
|
||
*!* lcFiltru = [where id_sectie = ?pnIdSectie]
|
||
*!* Else
|
||
lcFiltru = []
|
||
*!* Endif
|
||
lcSql = [select id_sectie, sectie, total_ore, total_valoare ] + ;
|
||
[from ] + gcS + [.auto_listare_man_sectii ] + ;
|
||
lcFiltru + [ order by sectie]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
|
||
_Screen.MousePointer=0
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
If Reccount(lcCursor)=0
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport manopera comenzii inchise pe sectii")
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'MANOPER<45> COMENZI <20>NCHISE PE SEC<45>II'
|
||
pcPerioada = Iif(pnLunaI+pnAnI*12==pnLunaF+pnAnF*12,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select (lcCursor)
|
||
Keyboard '{CTRL+F10}'
|
||
Report Form rap_manopera_sectii To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[sectie,total_ore,total_valoare]
|
||
lcSirNume=[Sectie,Total_ore,Total_valoare]
|
||
exportare(lcCursor,lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Endif
|
||
If Used(lcCursor)
|
||
Use In (lcCursor)
|
||
Endif
|
||
Endif
|
||
Endif
|
||
Endif
|
||
|
||
Endproc && manopera_sectii
|
||
*********************************************************************************************************
|
||
Procedure devize_pe_marci_de_masini
|
||
Private pcAnLuna1,pcAnLuna2,pnNrLuni1,pnNrLuni2
|
||
lcCursorRaport = [crsdevize]
|
||
pnButon = 1
|
||
pcAnLuna1 = Padl(Alltrim(Str(gnLuna)),2,'0')+Alltrim(Str(gnAn))
|
||
pcAnLuna2 = pcAnLuna1
|
||
ofrminterval = Createobject('frm_interval_luni')
|
||
ofrminterval.lb_titlu_alb_b121.Caption = [DATA DESCHIDERII COMENZII]
|
||
ofrminterval.Show(1)
|
||
Release ofrminterval
|
||
|
||
If pnButon = 1
|
||
loCauta = caut_marci_masini(1,.F.,.T.)
|
||
If pnButon = 1
|
||
If Used(lcCursorRaport)
|
||
Use In (lcCursorRaport)
|
||
Endif
|
||
_Screen.MousePointer=11
|
||
Private pcDataOra,pnIdMarca
|
||
pnIdSectie = 0
|
||
pnNrLuni1=Val(Substr(pcAnLuna1,1,2))+Val(Substr(pcAnLuna1,3))*12
|
||
pnNrLuni2=Val(Substr(pcAnLuna2,1,2))+Val(Substr(pcAnLuna2,3))*12
|
||
pcDataOra = get_ora(2)
|
||
lcFiltru = [where NVL(a.validat,0) = 1 and extract(year from a.datai) * 12 + extract(month from a.datai) between ] + ;
|
||
[?pnNrLuni1 and ?pnNrLuni2]
|
||
If loCauta.id_marca <> 0
|
||
pnIdMarca = loCauta.id_marca
|
||
lcFiltru = lcFiltru + [ and e.id_marca = ?pnIdMarca]
|
||
Endif
|
||
*!* modificare v 2.0.37 : am sters c.kmint
|
||
lcSql = [select a.id_ordl,a.datai,a.nrord,a.kmint,] + ;
|
||
[nvl(b.facturat, 0) as facturat,c.nrinmat,d.id_marca,d.masina,e.marca,f.denumire,] + ;
|
||
[g.ore,g.valoare_man from ] + gcS + [.auto_comenzi_validate a ] + ;
|
||
[left join ] + gcS + [.auto_vordl_facturi b on a.id_lucrare = b.id_lucrare ] + ;
|
||
[left join ] + gcS + [.dev_masiniclienti c on a.id_masiniclient = c.id_masiniclient ] + ;
|
||
[left join ] + gcS + [.dev_nom_masini d on c.id_masina = d.id_masina ] + ;
|
||
[left join ] + gcS + [.dev_nom_marci e on d.id_marca = e.id_marca ] + ;
|
||
[left join ] + gcS + [.nom_parteneri f on c.id_partener = f.id_part ] + ;
|
||
[left join (select sum(timpn) as ore, sum(round(timpn * pret, 2)) as valoare_man,id_ordl ] + ;
|
||
[from ] + gcS + [.dev_oper where sters = 0 group by id_ordl) g on a.id_ordl = g.id_ordl ] + ;
|
||
lcFiltru + [ order by e.marca,a.datai,d.masina]
|
||
lnSucces = goExecutor.oExecute(lcSql,lcCursorRaport)
|
||
_Screen.MousePointer=0
|
||
If lnSucces < 0
|
||
amessagebox(goExecutor.cEroare,0+16,'Eroare')
|
||
Else
|
||
If Reccount(lcCursorRaport)=0
|
||
amessagebox("Nu exista inregistrari pentru vizualizare!",0+64,"Info raport devize pe marci")
|
||
Else
|
||
Private pcPerioada
|
||
pnButon=1
|
||
Do While pnButon=1
|
||
pnOptiune=1
|
||
ofrmaleg=Createobject('frm_aleg_vizualizare')
|
||
ofrmaleg.Show(1)
|
||
Do Case
|
||
Case pnButon<>1
|
||
Loop
|
||
Case pnOptiune=1
|
||
Private pcTitlu
|
||
Store '' To pcTitlu
|
||
pcTitlu = 'LISTA DEVIZELOR PE M<>RCI DE MA<4D>INI'
|
||
pcPerioada = Iif(pnNrLuni1==pnNrLuni2,;
|
||
'Luna '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3),;
|
||
'Perioada '+Substr(pcAnLuna1,1,2)+'/'+Substr(pcAnLuna1,3)+' - '+Substr(pcAnLuna2,1,2)+'/'+Substr(pcAnLuna2,3))
|
||
Select (lcCursorRaport)
|
||
Keyboard '{CTRL+F10}'
|
||
Report Form rap_devize_marci To Printer Prompt Preview
|
||
Case pnOptiune=2
|
||
lcSirColoane=[marca,nrord,TTOD(datai),denumire,nrinmat,masina,kmint,facturat,ore,valoare_man]
|
||
lcSirNume=[Marca,Nr_comanda,Data_comanda,Nume,Nr_inmatriculare,Model,Km_la_bord,Facturat,Ore_manopera,Valoare_manopera]
|
||
exportare(lcCursorRaport,lcSirColoane,lcSirNume)
|
||
Endcase
|
||
Release ofrmaleg
|
||
Enddo
|
||
Endif
|
||
If Used(lcCursorRaport)
|
||
Use In (lcCursorRaport)
|
||
Endif
|
||
Endif
|
||
Endif
|
||
Endif
|
||
|
||
Endproc && devize_pe_marci_de_masini
|
||
********************************************************************************************************* |